2015-05-08 07:28:48 +00:00
|
|
|
/*
|
|
|
|
* Author: Winter
|
|
|
|
* Sets the player's current view distance according to allowed values.
|
2015-05-14 18:16:02 +00:00
|
|
|
*
|
2015-05-08 07:28:48 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-05-10 10:00:19 +00:00
|
|
|
* 0: View Distance setting INDEX <SCALAR>
|
|
|
|
* 1: Show Prompt <BOOL>
|
2015-05-08 07:28:48 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2015-05-08 12:14:15 +00:00
|
|
|
* [] call ace_viewdistance_fnc_changeViewDistance;
|
2015-05-08 07:28:48 +00:00
|
|
|
*
|
2015-05-14 16:25:41 +00:00
|
|
|
* Public: No
|
2015-05-08 07:28:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-14 15:44:35 +00:00
|
|
|
private ["_text","_new_view_distance","_view_distance_limit","_object_view_distance_coeff"];
|
2015-05-14 16:25:41 +00:00
|
|
|
|
2015-05-14 15:44:35 +00:00
|
|
|
PARAMS_2(_index_requested,_show_prompt);
|
2015-05-08 12:49:52 +00:00
|
|
|
|
2015-05-14 16:25:41 +00:00
|
|
|
_new_view_distance = [_index_requested] call FUNC(returnValue); // changes the setting index into an actual view distance value
|
|
|
|
_object_view_distance_coeff = [GVAR(objectViewDistanceCoeff)] call FUNC(returnObjectCoeff); // changes the setting index into a coefficient.
|
2015-05-09 16:42:02 +00:00
|
|
|
_view_distance_limit = GVAR(limitViewDistance); // Grab the limit
|
2015-05-08 12:49:52 +00:00
|
|
|
|
2015-05-14 18:16:02 +00:00
|
|
|
if (_show_prompt) then {
|
|
|
|
_text = if (_new_view_distance <= _view_distance_limit) then {
|
2015-05-16 22:53:55 +00:00
|
|
|
format ["<t align='center'>%1 %2m", (localize "STR_ACE_ViewDistance_infotext"), str(_new_view_distance)];
|
2015-05-14 18:16:02 +00:00
|
|
|
} else {
|
2015-05-16 22:53:55 +00:00
|
|
|
format ["<t align='center'>%1 %2m", (localize "STR_ACE_ViewDistance_invalid"), str(_view_distance_limit)];
|
2015-05-14 18:16:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (GVAR(objectViewDistanceCoeff) > 0) then {
|
2015-05-16 22:53:55 +00:00
|
|
|
_text = _text + format ["<br/><t align='center'>%1 %2%3</t>", (localize "STR_ACE_ViewDistance_objectinfotext"), str(_object_view_distance_coeff * 100),"%"];
|
2015-05-10 10:00:19 +00:00
|
|
|
};
|
2015-05-14 18:16:02 +00:00
|
|
|
[parseText _text,2] call EFUNC(common,displayTextStructured);
|
|
|
|
};
|
|
|
|
|
|
|
|
setViewDistance (_new_view_distance min _view_distance_limit);
|
|
|
|
|
|
|
|
if (_object_view_distance_coeff > 0) then {
|
|
|
|
setObjectViewDistance (_object_view_distance_coeff * _new_view_distance);
|
|
|
|
};
|