From e73a2ddec04ee455728bd813e06a6cfd3b1d3d1b Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 9 Feb 2018 20:31:22 -0600 Subject: [PATCH] NightVision - Add setting for shutter effects (#6134) Also convert to cba settings Close #6119 --- addons/nightvision/ACE_Settings.hpp | 33 ++---------- addons/nightvision/XEH_preInit.sqf | 2 + .../functions/fnc_onFiredPlayer.sqf | 2 +- addons/nightvision/initSettings.sqf | 54 +++++++++++++++++++ addons/nightvision/stringtable.xml | 6 +++ 5 files changed, 68 insertions(+), 29 deletions(-) create mode 100644 addons/nightvision/initSettings.sqf diff --git a/addons/nightvision/ACE_Settings.hpp b/addons/nightvision/ACE_Settings.hpp index 6487b7a501..1b9b0e164a 100644 --- a/addons/nightvision/ACE_Settings.hpp +++ b/addons/nightvision/ACE_Settings.hpp @@ -1,40 +1,17 @@ class ACE_Settings { class GVAR(disableNVGsWithSights) { - category = CSTRING(Category); - displayName = CSTRING(DisableNVGsWithSights_DisplayName); - description = CSTRING(DisableNVGsWithSights_description); - typeName = "BOOL"; - value = 0; + movedToSQF = 1; }; class GVAR(fogScaling) { - category = CSTRING(Category); - displayName = CSTRING(fogScaling_DisplayName); - description = CSTRING(fogScaling_Description); - typeName = "SCALAR"; - value = 1; - sliderSettings[] = {0, 2, 1, 1}; + movedToSQF = 1; }; class GVAR(noiseScaling) { - category = CSTRING(Category); - displayName = CSTRING(noiseScaling_DisplayName); - description = CSTRING(noiseScaling_Description); - typeName = "SCALAR"; - value = 1; - sliderSettings[] = {0, 2, 1, 1}; + movedToSQF = 1; }; class GVAR(effectScaling) { - category = CSTRING(Category); - displayName = CSTRING(effectScaling_DisplayName); - description = CSTRING(effectScaling_Description); - typeName = "SCALAR"; - value = 1; - sliderSettings[] = {0, 2, 1, 1}; + movedToSQF = 1; }; class GVAR(aimDownSightsBlur) { - category = CSTRING(Category); - displayName = CSTRING(aimDownSightsBlur_DisplayName); - typeName = "SCALAR"; - value = 1; - sliderSettings[] = {0, 2, 1, 1}; + movedToSQF = 1; }; }; diff --git a/addons/nightvision/XEH_preInit.sqf b/addons/nightvision/XEH_preInit.sqf index b47cf6628d..d021ef1f57 100644 --- a/addons/nightvision/XEH_preInit.sqf +++ b/addons/nightvision/XEH_preInit.sqf @@ -6,4 +6,6 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.sqf"; + ADDON = true; diff --git a/addons/nightvision/functions/fnc_onFiredPlayer.sqf b/addons/nightvision/functions/fnc_onFiredPlayer.sqf index 3621c975f8..efd01e1fd4 100644 --- a/addons/nightvision/functions/fnc_onFiredPlayer.sqf +++ b/addons/nightvision/functions/fnc_onFiredPlayer.sqf @@ -18,7 +18,7 @@ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile); -if ((!GVAR(running)) || {_weapon == "throw"} || {_weapon == "put"}) exitWith {}; +if ((!GVAR(running)) || {!GVAR(shutterEffects)} || {_weapon == "throw"} || {_weapon == "put"}) exitWith {}; private _visibleFireCoef = 1; if (_unit == ace_player) then { diff --git a/addons/nightvision/initSettings.sqf b/addons/nightvision/initSettings.sqf new file mode 100644 index 0000000000..884c53055a --- /dev/null +++ b/addons/nightvision/initSettings.sqf @@ -0,0 +1,54 @@ +// CBA Settings [ADDON: ace_nightVision]: + +[ + QGVAR(effectScaling), "SLIDER", + [LSTRING(effectScaling_DisplayName), LSTRING(effectScaling_Description)], + localize LSTRING(Category), + [0,2,1,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] + true, // isGlobal + {[QGVAR(effectScaling), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; +[ + QGVAR(fogScaling), "SLIDER", + [LSTRING(fogScaling_DisplayName), LSTRING(fogScaling_Description)], + localize LSTRING(Category), + [0,2,1,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] + true, // isGlobal + {[QGVAR(fogScaling), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; + +[ + QGVAR(noiseScaling), "SLIDER", + [LSTRING(noiseScaling_DisplayName), LSTRING(noiseScaling_Description)], + localize LSTRING(Category), + [0,2,1,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] + true, // isGlobal + {[QGVAR(noiseScaling), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; + +[ + QGVAR(aimDownSightsBlur), "SLIDER", + [LSTRING(aimDownSightsBlur_DisplayName)], + localize LSTRING(Category), + [0,2,1,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] + true, // isGlobal + {[QGVAR(aimDownSightsBlur), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; + +[ + QGVAR(disableNVGsWithSights), "CHECKBOX", + [LSTRING(DisableNVGsWithSights_DisplayName), LSTRING(DisableNVGsWithSights_description)], + localize LSTRING(Category), + false, // default value + true, // isGlobal + {[QGVAR(disableNVGsWithSights), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; + +[ + QGVAR(shutterEffects), "CHECKBOX", + [LSTRING(shutterEffects_DisplayName), LSTRING(shutterEffects_description)], + localize LSTRING(Category), + true, // default value + false, // isGlobal + {[QGVAR(shutterEffects), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_settings_fnc_init; diff --git a/addons/nightvision/stringtable.xml b/addons/nightvision/stringtable.xml index 9088b7a417..ad4b6bf218 100644 --- a/addons/nightvision/stringtable.xml +++ b/addons/nightvision/stringtable.xml @@ -296,5 +296,11 @@ 調整配戴夜視鏡時畫面雜訊的多寡。 调整配戴夜视镜时画面杂讯的多寡。 + + Shutter Effects + + + Rolling shutter effect from muzzle flashes +