mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'viewdistance' of https://github.com/Winter259/ACE3 into viewdistance
This commit is contained in:
commit
7191778402
@ -16,5 +16,12 @@ if (viewDistance > GVAR(limitViewDistance)) then {
|
||||
};
|
||||
},true] call ace_common_fnc_addEventHandler;
|
||||
|
||||
// Set the EH which waits for the Object View Distance coefficient to be changed, so that the effect is show immediately
|
||||
["SettingChanged",{
|
||||
if (_this select 0 == QGVAR(objectViewDistanceCoeff)) then {
|
||||
[true] call FUNC(adaptViewDistance);
|
||||
};
|
||||
},true] call ace_common_fnc_addEventHandler;
|
||||
|
||||
// Set the EH which waits for a vehicle change to automatically swap to On Foot/In Land Vehicle/In Air Vehicle
|
||||
["playerVehicleChanged",{[false] call FUNC(adaptViewDistance)},true] call ace_common_fnc_addEventHandler;
|
@ -4,6 +4,7 @@ ADDON = false;
|
||||
|
||||
PREP(initModule);
|
||||
PREP(returnValue);
|
||||
PREP(returnObjectCoeff);
|
||||
PREP(changeViewDistance);
|
||||
PREP(adaptViewDistance);
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Example:
|
||||
* [] call ace_viewdistance_fnc_adaptViewDistance;
|
||||
*
|
||||
* Public: Yes
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
@ -13,30 +13,36 @@
|
||||
* Example:
|
||||
* [] call ace_viewdistance_fnc_changeViewDistance;
|
||||
*
|
||||
* Public: Yes
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_text","_new_view_distance","_view_distance_limit"];
|
||||
PARAMS_2(_index_requested,_prompt);
|
||||
private ["_text","_new_view_distance","_view_distance_limit","_object_view_distance_coeff"];
|
||||
|
||||
_new_view_distance = [_index_requested] call FUNC(returnValue); // change the index into an actual view distance value
|
||||
PARAMS_2(_index_requested,_show_prompt);
|
||||
|
||||
_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.
|
||||
_view_distance_limit = GVAR(limitViewDistance); // Grab the limit
|
||||
|
||||
if (_new_view_distance <= _view_distance_limit) then {
|
||||
if (_prompt) then {
|
||||
_text = composeText ["View distance successfully changed to: ",str(_new_view_distance)];
|
||||
[_text,1] call EFUNC(common,displayTextStructured);
|
||||
if (_show_prompt) then {
|
||||
_text = parseText format ["<t align='center'>View Distance: %1<br />Object View Distance Coefficient: %2</t>",str(_new_view_distance),str(_object_view_distance_coeff)];
|
||||
[_text,2] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
setViewDistance _new_view_distance;
|
||||
setObjectViewDistance (0.8 * _new_view_distance); // maybe make this 0.8 a constant?
|
||||
if (_object_view_distance_coeff > 0) then {
|
||||
setObjectViewDistance (_object_view_distance_coeff * _new_view_distance);
|
||||
};
|
||||
}
|
||||
else {
|
||||
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?
|
||||
if (_show_prompt) then {
|
||||
_text = parseText format ["<t align='center'>That option is invalid! The limit is: %1<br />Object View Distance Coefficient: %2</t>",str(_view_distance_limit),str(_object_view_distance_coeff)];
|
||||
[_text,2] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
setViewDistance _view_distance_limit;
|
||||
if (_object_view_distance_coeff > 0) then {
|
||||
setObjectViewDistance (_object_view_distance_coeff * _view_distance_limit);
|
||||
};
|
||||
};
|
@ -22,13 +22,13 @@ PARAMS_1(_index);
|
||||
private ["_return"];
|
||||
|
||||
_return = switch (_index) do {
|
||||
case 0: {0.00}; // Off
|
||||
case 1: {0.20}; // Very Low
|
||||
case 2: {0.40}; // Low
|
||||
case 3: {0.60}; // Medium
|
||||
case 4: {0.80}; // High
|
||||
case 5: {1.00}; // Very High
|
||||
default {0.50}; // something broke if this returns
|
||||
case 0: {0.00}; // Off
|
||||
case 1: {0.20}; // Very Low
|
||||
case 2: {0.40}; // Low
|
||||
case 3: {0.60}; // Medium
|
||||
case 4: {0.80}; // High
|
||||
case 5: {1.00}; // Very High
|
||||
default {0.50}; // something broke if this returns
|
||||
};
|
||||
|
||||
_return;
|
@ -12,7 +12,7 @@
|
||||
* Example:
|
||||
* [2] call ace_viewdistance_fnc_returnViewDistanceValue;
|
||||
*
|
||||
* Public: Yes
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user