Fixed viewdistance limit not applied when Video Settings option is selected, Removed unnecessary EHs

This commit is contained in:
jonpas 2015-08-17 18:12:00 +02:00
parent 42bd8751aa
commit fe9e4fee07
4 changed files with 8 additions and 15 deletions

View File

@ -5,17 +5,7 @@ if (!hasInterface) exitWith {};
["SettingsInitialized", {
// if not enabled, then bugger off.
if !(GVAR(enabled)) exitWith {};
// Force the view distance down to the limit.
if (viewDistance > GVAR(limitViewDistance)) then {
setViewDistance GVAR(limitViewDistance);
};
// Adapt view distance when the player is created or changed according to whether client is on foot or vehicle.
["playerChanged",{
[false] call FUNC(adaptViewDistance);
}] call EFUNC(common,addEventHandler);
// Set the EH which waits for any of the view distance settings to be changed, so that the effect is show immediately
["SettingChanged",{
if ((_this select 0 == QGVAR(viewDistanceOnFoot)) ||
@ -28,7 +18,8 @@ if (!hasInterface) exitWith {};
}] call EFUNC(common,addEventHandler);
// Set the EH which waits for a vehicle change to automatically swap between On Foot/In Land Vehicle/In Air Vehicle
// Will also run when SettingsInitialized runs and take care of the limit on load
["playerVehicleChanged",{
[false] call FUNC(adaptViewDistance)
}] call EFUNC(common,addEventHandler);
}] call EFUNC(common,addEventHandler);
}] call EFUNC(common,addEventHandler);

View File

@ -26,6 +26,7 @@ _new_view_distance = [_index_requested] call FUNC(returnValue); // changes the s
_object_view_distance_coeff = [GVAR(objectViewDistanceCoeff)] call FUNC(returnObjectCoeff); // changes the setting index into a coefficient.
_view_distance_limit = GVAR(limitViewDistance); // Grab the limit
TRACE_2("Limit",_new_view_distance,_view_distance_limit);
setViewDistance (_new_view_distance min _view_distance_limit);
if (_object_view_distance_coeff > 0) then {

View File

@ -26,4 +26,4 @@ if (!_activated) exitWith {
[_logic, QGVAR(enabled),"moduleViewDistanceEnabled"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(limitViewDistance),"moduleViewDistanceLimit"] call EFUNC(common,readSettingFromModule);
diag_log format ["[ACE]: View Distance Limit Module Initialized. Limit set by module: %1",GVAR(limitViewDistance)];
diag_log format ["[ACE]: View Distance Limit Module Initialized. Limit set by module: %1",GVAR(limitViewDistance)];

View File

@ -22,7 +22,7 @@ private ["_return"];
params ["_index"];
_return = switch (_index) do {
case 0: {-1};
case 0: {viewDistance}; // Video Settings option
case 1: {500};
case 2: {1000};
case 3: {1500};
@ -40,4 +40,5 @@ _return = switch (_index) do {
default {1000};
};
_return;
TRACE_1("VD Index Return",_return);
_return