From daeb069552104c1e9fc48b52320d09533e5a2ed5 Mon Sep 17 00:00:00 2001 From: Will/KJW <100206101+SpicyBagpipes@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:52:44 +0100 Subject: [PATCH] Nightvision - Improve NVG Brightness adjustment limits (#10136) * Update fnc_changeNVGBrightness.sqf * Update XEH_postInit.sqf * Update addons/nightvision/XEH_postInit.sqf Co-authored-by: PabstMirror * Update XEH_postInit.sqf * Update fnc_changeNVGBrightness.sqf * Update nightvision-framework.md * load order independence Co-authored-by: PabstMirror --------- Co-authored-by: PabstMirror Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --- addons/nightvision/XEH_postInit.sqf | 3 +++ addons/nightvision/functions/fnc_changeNVGBrightness.sqf | 2 +- docs/wiki/framework/nightvision-framework.md | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/nightvision/XEH_postInit.sqf b/addons/nightvision/XEH_postInit.sqf index 5a1aa19b82e..2933877771c 100644 --- a/addons/nightvision/XEH_postInit.sqf +++ b/addons/nightvision/XEH_postInit.sqf @@ -21,6 +21,9 @@ GVAR(ppeffectRadialBlur) = -1; GVAR(ppeffectColorCorrect) = -1; GVAR(ppeffectBlur) = -1; +if (isNil QGVAR(const_MaxBrightness)) then { GVAR(const_MaxBrightness) = 0; }; +if (isNil QGVAR(const_MinBrightness)) then { GVAR(const_MinBrightness) = -6; }; + GVAR(isUsingMagnification) = false; ["CBA_settingsInitialized", { diff --git a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf index 1697fa907e8..d0b210fe295 100644 --- a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf +++ b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf @@ -23,7 +23,7 @@ private _effectsEnabled = GVAR(effectScaling) != 0; private _defaultBrightness = [-3, 0] select _effectsEnabled; private _brightness = _player getVariable [QGVAR(NVGBrightness), _defaultBrightness]; -_brightness = ((_brightness + _changeInBrightness) min 0) max -6; +_brightness = ((_brightness + _changeInBrightness) min GVAR(const_MaxBrightness)) max GVAR(const_MinBrightness); _player setVariable [QGVAR(NVGBrightness), _brightness, false]; // Display default setting as 0 diff --git a/docs/wiki/framework/nightvision-framework.md b/docs/wiki/framework/nightvision-framework.md index 5f91421b8d2..939398ee280 100644 --- a/docs/wiki/framework/nightvision-framework.md +++ b/docs/wiki/framework/nightvision-framework.md @@ -43,3 +43,10 @@ Additional color presets ```cpp ace_nightvision_colorPreset[] = {0.0, {0.0, 0.0, 0.0, 0.0}, {1.1, 0.8, 1.9, 0.9}, {1, 1, 6, 0.0}}; // White Phosphor Preset ``` + +## 3. Brightness Limits + +```cpp +ace_nightvision_const_maxBrightness = 0; // Defaults, change at your leisure +ace_nightvision_const_minBrightness = -6; +```