Merge pull request #2195 from jonpas/fixVDlimit

Fixed View Distance limit not applied on Video Settings
This commit is contained in:
SilentSpike 2015-08-21 23:47:02 +01:00
commit b8b71e1c76
4 changed files with 11 additions and 15 deletions

View File

@ -5,17 +5,10 @@ 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);
// Limit on load
[false] call FUNC(adaptViewDistance);
// 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 +21,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
// Also run when SettingsInitialized runs (not guaranteed)
["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