tweak numbers

This commit is contained in:
PabstMirror 2021-10-19 01:12:34 -05:00
parent 0dc48780fc
commit 559581f383
2 changed files with 34 additions and 23 deletions

View File

@ -21,6 +21,8 @@ GVAR(ppeffectRadialBlur) = -1;
GVAR(ppeffectColorCorrect) = -1; GVAR(ppeffectColorCorrect) = -1;
GVAR(ppeffectBlur) = -1; GVAR(ppeffectBlur) = -1;
GVAR(scotopicCC) = -1;
GVAR(isUsingMagnification) = false; GVAR(isUsingMagnification) = false;
["CBA_settingsInitialized", { ["CBA_settingsInitialized", {
@ -45,19 +47,22 @@ GVAR(isUsingMagnification) = false;
[false] call FUNC(setupDisplayEffects); [false] call FUNC(setupDisplayEffects);
[true] call FUNC(setupDisplayEffects); [true] call FUNC(setupDisplayEffects);
}; };
if (GVAR(scotopicCC) > -1) then {
ppEffectDestroy GVAR(scotopicCC);
GVAR(scotopicCC) = ppEffectCreate ["colorCorrections", 1502];
GVAR(scotopicCC) ppEffectForceInNVG false;
};
}]; }];
if (GVAR(scotopicEffects)) then { if (GVAR(scotopicEffects)) then {
GVAR(scoTestToggle) = true;
GVAR(scoTestToggle) = true; ["test", "test", "test", {
["test", "test", "test", { GVAR(scoTestToggle) = !GVAR(scoTestToggle);
GVAR(scoTestToggle) = !GVAR(scoTestToggle); }, {false}, [0x21, [false, false, false]], false] call CBA_fnc_addKeybind; // F Key
}, {false}, [0x21, [false, false, false]], false] call CBA_fnc_addKeybind; // F Key
GVAR(scotopicCC) = ppEffectCreate ["colorCorrections", 1502]; GVAR(scotopicCC) = ppEffectCreate ["colorCorrections", 1502];
GVAR(scotopicCC) ppEffectForceInNVG false; GVAR(scotopicCC) ppEffectForceInNVG false;
[FUNC(scotopicEffects), [], 1] call CBA_fnc_waitAndExecute; [0] call FUNC(scotopicEffects); // self-loops
}; };
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;

View File

@ -5,44 +5,50 @@
* Simulates rod and cones vision by decreasing color intensity when dark. * Simulates rod and cones vision by decreasing color intensity when dark.
* *
* Arguments: * Arguments:
* None * 0: Last Intensity <NUMBER>
* *
* Return Value: * Return Value:
* None * None
* *
* Example: * Example:
* [] call ace_nightvision_fnc_scotopicEffects * [0] call ace_nightvision_fnc_scotopicEffects
* *
* Public: No * Public: No
*/ */
#define TIME_INTERVAL 0.333
private _unit = ACE_player; private _unit = ACE_player;
if (EGVAR(common,OldIsCamera) || {!alive _unit} || {currentVisionMode _unit != 0}) exitWith { if (EGVAR(common,OldIsCamera) || {!alive _unit} || {currentVisionMode _unit != 0}) exitWith {
GVAR(scotopicCC) ppEffectEnable false; GVAR(scotopicCC) ppEffectEnable false;
[FUNC(scotopicEffects), [], 0.1] call CBA_fnc_waitAndExecute; [FUNC(scotopicEffects), [0], 0.1] call CBA_fnc_waitAndExecute;
}; };
getLighting params ["", "_ambientLightBrightness"]; (getLightingAt _unit) params ["", "_ambientLight", "", "_dynamiclight"];
(getLightingAt _unit) params ["", "", "", "_dynamiclightBrightness"]; private _light = _ambientLight + 2 * _dynamiclight;
private _light = _ambientLightBrightness + 5 * _dynamiclightBrightness; #ifdef DEBUG_MODE_FULL
if (_light > 30) exitWith { systemChat format ["[%1, %2] = %3", [_ambientLight,1,1] call CBA_fnc_formatNumber, [_dynamiclight,1,1] call CBA_fnc_formatNumber, _light];
#endif
if ((_light > 50) && {(param [0, 0]) == 0}) exitWith { // make sure we've faded out before disabling
GVAR(scotopicCC) ppEffectEnable false; GVAR(scotopicCC) ppEffectEnable false;
// if it's day, we can go to sleep for a long while (but won't be responsive to skipTime?) // if it's day, we can go to sleep for a long while (won't be responsive to scripted-skipTime)
[FUNC(scotopicEffects), [], [1, 120] select (_ambientLightBrightness > 100)] call CBA_fnc_waitAndExecute; [FUNC(scotopicEffects), [0], [TIME_INTERVAL, 60] select (_ambientLight > 100)] call CBA_fnc_waitAndExecute;
}; };
private _intensity = if (_light > 5) then { private _intensity = if (_light > 5) then {
linearConversion [5, 30, _light, 0.3, 0, true]; // Mesopic linearConversion [5, 50, _light, 0.3, 0, true]; // Mesopic
} else { } else {
linearConversion [0, 5, _light, 0.6, 0.3, true]; // Scotopic linearConversion [0, 6, _light, 0.6, 0.3, true]; // Scotopic
}; };
systemChat format ["%1 - %2", _light, _intensity]; #ifdef DEBUG_MODE_FULL
systemChat format ["@%1", _intensity];
#endif
GVAR(scotopicCC) ppEffectEnable GVAR(scoTestToggle) && true; GVAR(scotopicCC) ppEffectEnable GVAR(scoTestToggle); // true;
// "players like the night blue" // "players like the night blue"
GVAR(scotopicCC) ppEffectAdjust [1,1,0,[1,1,1,0],[_intensity*.95, _intensity*.95,_intensity*1.1, 1-_intensity], [0.15, 1.0, 1.50, 1]]; GVAR(scotopicCC) ppEffectAdjust [1,1,0,[1,1,1,0],[_intensity*.95,_intensity*.95,_intensity*1.1,1-_intensity],[0.15, 1.0, 1.50, 1]];
GVAR(scotopicCC) ppEffectCommit 1; GVAR(scotopicCC) ppEffectCommit TIME_INTERVAL;
[FUNC(scotopicEffects), [], 1] call CBA_fnc_waitAndExecute; [FUNC(scotopicEffects), [_intensity], TIME_INTERVAL] call CBA_fnc_waitAndExecute;