Skip to content

Commit

Permalink
Nightvision - Improve NVG Brightness adjustment limits (acemod#10136)
Browse files Browse the repository at this point in the history
* Update fnc_changeNVGBrightness.sqf

* Update XEH_postInit.sqf

* Update addons/nightvision/XEH_postInit.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update XEH_postInit.sqf

* Update fnc_changeNVGBrightness.sqf

* Update nightvision-framework.md

* load order independence

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
  • Loading branch information
3 people authored and blake8090 committed Aug 18, 2024
1 parent 1f5c3fa commit daeb069
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions addons/nightvision/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
2 changes: 1 addition & 1 deletion addons/nightvision/functions/fnc_changeNVGBrightness.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions docs/wiki/framework/nightvision-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
```

0 comments on commit daeb069

Please sign in to comment.