2015-05-08 07:28:48 +00:00
|
|
|
/*
|
|
|
|
* Author: Winter
|
|
|
|
* Sets the player's current view distance according to allowed values.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* 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-08 13:36:47 +00:00
|
|
|
* Public: Yes
|
2015-05-08 07:28:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-08 13:27:13 +00:00
|
|
|
private ["_text","_new_view_distance","_view_distance_limit"];
|
2015-05-10 10:00:19 +00:00
|
|
|
PARAMS_2(_index_requested,_prompt);
|
2015-05-08 12:49:52 +00:00
|
|
|
|
2015-05-10 10:00:19 +00:00
|
|
|
_new_view_distance = [_index_requested] call FUNC(returnValue); // change the index into an actual view distance value
|
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-09 09:56:27 +00:00
|
|
|
if (_new_view_distance <= _view_distance_limit) then {
|
2015-05-10 10:00:19 +00:00
|
|
|
if (_prompt) then {
|
|
|
|
_text = composeText ["View distance: ",str(_new_view_distance)];
|
|
|
|
[_text,1] call EFUNC(common,displayTextStructured);
|
|
|
|
};
|
2015-05-09 09:56:27 +00:00
|
|
|
setViewDistance _new_view_distance;
|
|
|
|
setObjectViewDistance (0.8 * _new_view_distance); // maybe make this 0.8 a constant?
|
2015-05-08 16:30:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2015-05-10 10:00:19 +00:00
|
|
|
if (_prompt) then {
|
|
|
|
_text = composeText ["That option is invalid! The limit is: ",str(_view_distance_limit)];
|
|
|
|
[_text,1] call EFUNC(common,displayTextStructured);
|
|
|
|
setViewDistance _view_distance_limit;
|
|
|
|
setObjectViewDistance (0.8 * _view_distance_limit); // maybe make this 0.8 a constant?
|
|
|
|
};
|
2015-05-08 16:30:28 +00:00
|
|
|
};
|