2017-12-06 19:15:33 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
|
|
|
GVAR(PFID) = -1;
|
|
|
|
GVAR(running) = false;
|
|
|
|
GVAR(nextEffectsUpdate) = -1;
|
|
|
|
|
|
|
|
GVAR(playerHMD) = "#";
|
|
|
|
|
|
|
|
GVAR(priorFog) = nil;
|
|
|
|
GVAR(nvgFog) = [0,0,0];
|
|
|
|
|
|
|
|
GVAR(nvgBlurRadius) = -1;
|
|
|
|
GVAR(nvgGeneration) = -1;
|
|
|
|
GVAR(defaultPositionBorder) = [];
|
|
|
|
GVAR(defaultPositionHex) = [];
|
|
|
|
|
|
|
|
GVAR(ppeffectGrain) = -1;
|
|
|
|
GVAR(ppeffectRadialBlur) = -1;
|
|
|
|
GVAR(ppeffectColorCorrect) = -1;
|
|
|
|
GVAR(ppeffectBlur) = -1;
|
|
|
|
|
2024-08-02 12:52:44 +00:00
|
|
|
if (isNil QGVAR(const_MaxBrightness)) then { GVAR(const_MaxBrightness) = 0; };
|
|
|
|
if (isNil QGVAR(const_MinBrightness)) then { GVAR(const_MinBrightness) = -6; };
|
|
|
|
|
2020-02-23 12:52:32 +00:00
|
|
|
GVAR(isUsingMagnification) = false;
|
2017-12-06 19:15:33 +00:00
|
|
|
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
2018-02-06 19:38:23 +00:00
|
|
|
TRACE_4("settingsInitialized",GVAR(disableNVGsWithSights),GVAR(fogScaling),GVAR(noiseScaling),GVAR(effectScaling));
|
2017-12-06 19:15:33 +00:00
|
|
|
|
2017-12-17 19:09:41 +00:00
|
|
|
["visionMode", LINKFUNC(onVisionModeChanged), false] call CBA_fnc_addPlayerEventHandler;
|
2017-12-06 19:15:33 +00:00
|
|
|
["loadout", LINKFUNC(onLoadoutChanged), true] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["cameraView", LINKFUNC(onCameraViewChanged), true] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["vehicle", LINKFUNC(refreshGoggleType), false] call CBA_fnc_addPlayerEventHandler;
|
|
|
|
["turret", LINKFUNC(refreshGoggleType), true] call CBA_fnc_addPlayerEventHandler;
|
2023-08-21 19:23:53 +00:00
|
|
|
["ACE_controlledUAV", LINKFUNC(refreshGoggleType)] call CBA_fnc_addEventHandler;
|
2017-12-06 19:15:33 +00:00
|
|
|
|
2019-12-11 16:38:43 +00:00
|
|
|
// handle only brightness if effects are disabled
|
|
|
|
GVAR(ppEffectNVGBrightness) = ppEffectCreate ["ColorCorrections", 1236];
|
|
|
|
GVAR(ppEffectNVGBrightness) ppEffectForceInNVG true;
|
|
|
|
GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, (-3+3)/5 + 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]];
|
|
|
|
GVAR(ppEffectNVGBrightness) ppEffectCommit 0;
|
|
|
|
GVAR(ppEffectNVGBrightness) ppEffectEnable (GVAR(effectScaling) == 0);
|
2017-12-06 19:15:33 +00:00
|
|
|
|
|
|
|
addMissionEventHandler ["Loaded", { // Restart UI vars on mission load
|
|
|
|
if (GVAR(running)) then {
|
|
|
|
TRACE_1("restarting effects",CBA_missionTime);
|
|
|
|
[false] call FUNC(setupDisplayEffects);
|
|
|
|
[true] call FUNC(setupDisplayEffects);
|
|
|
|
};
|
|
|
|
}];
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
|
|
|
|
|
|
|
|
// Handle an edge case for non-dedicated servers were the server running the fog effect would sync fog to other clients
|
|
|
|
[QGVAR(nonDedicatedFix), LINKFUNC(nonDedicatedFix)] call CBA_fnc_addEventHandler;
|
|
|
|
if (!isNil QGVAR(serverPriorFog)) then {[] call FUNC(nonDedicatedFix);}; // If var is defined, run it now (we must be a jip)
|
|
|
|
|
|
|
|
|
|
|
|
// Add keybinds
|
|
|
|
["ACE3 Equipment", QGVAR(IncreaseNVGBrightness), localize LSTRING(IncreaseNVGBrightness), {
|
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, ["isNotEscorting", "isNotInside", "isNotSitting", "isNotRefueling"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
// Conditions: specific
|
|
|
|
if ((currentVisionMode ACE_player != 1)) exitWith {false};
|
2024-06-18 14:08:03 +00:00
|
|
|
if !(missionNamespace getVariable [QGVAR(allowBrightnessControl), true]) exitWith {false}; // just a mission setVar (not ace_setting)
|
2017-12-06 19:15:33 +00:00
|
|
|
|
|
|
|
// Statement
|
|
|
|
[ACE_player, 1] call FUNC(changeNVGBrightness);
|
|
|
|
true
|
|
|
|
}, {false}, [201, [false, false, true]], false] call CBA_fnc_addKeybind; //PageUp + ALT
|
|
|
|
|
|
|
|
["ACE3 Equipment", QGVAR(DecreaseNVGBrightness), localize LSTRING(DecreaseNVGBrightness), {
|
|
|
|
// Conditions: canInteract
|
|
|
|
if !([ACE_player, objNull, ["isNotEscorting", "isNotInside", "isNotSitting", "isNotRefueling"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
|
|
// Conditions: specific
|
|
|
|
if ((currentVisionMode ACE_player != 1)) exitWith {false};
|
2024-06-18 14:08:03 +00:00
|
|
|
if !(missionNamespace getVariable [QGVAR(allowBrightnessControl), true]) exitWith {false}; // just a mission setVar (not ace_setting)
|
2017-12-06 19:15:33 +00:00
|
|
|
|
|
|
|
// Statement
|
|
|
|
[ACE_player, -1] call FUNC(changeNVGBrightness);
|
|
|
|
true
|
|
|
|
}, {false}, [209, [false, false, true]], false] call CBA_fnc_addKeybind; //PageDown + ALT
|
|
|
|
|
|
|
|
#ifdef DEBUG_MODE_FULL
|
|
|
|
WARNING("Debug mouse wheel action enabled, this should NOT be in a final release");
|
|
|
|
["MouseZChanged", {
|
|
|
|
GVAR(nextEffectsUpdate) = 0;
|
|
|
|
if (cba_events_shift) then {
|
|
|
|
GVAR(effectScaling) = ((GVAR(effectScaling) + ((_this select 1) / 20)) max 0) min 1;
|
|
|
|
systemChat format ["%1: %2", QGVAR(effectScaling), GVAR(effectScaling)];
|
|
|
|
};
|
|
|
|
if (cba_events_control) then {
|
|
|
|
GVAR(fogScaling) = ((GVAR(fogScaling) + ((_this select 1) / 20)) max 0) min 1;
|
|
|
|
systemChat format ["%1: %2", QGVAR(fogScaling), GVAR(fogScaling)];
|
|
|
|
};
|
|
|
|
}] call CBA_fnc_addDisplayHandler;
|
|
|
|
#endif
|
|
|
|
|