From 191ba3ba4936891bbf57de7d74b8b57dd2577204 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sun, 9 Jul 2023 22:40:09 +0200 Subject: [PATCH 1/3] Fixed 1.0x flickering --- addons/optics/fnc_animateScriptedOptic.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/optics/fnc_animateScriptedOptic.sqf b/addons/optics/fnc_animateScriptedOptic.sqf index 2c83a1855a..183f9e0a26 100644 --- a/addons/optics/fnc_animateScriptedOptic.sqf +++ b/addons/optics/fnc_animateScriptedOptic.sqf @@ -73,6 +73,11 @@ if (cameraView == "GUNNER") then { // Add magnification to zeroing control. private _zoom = 0.25 call CBA_fnc_getFov select 1; +// To avoid flickering of the magnification text, anything above and including 0.995 is rounded to 1 +if (_zoom >= 0.995) then { + _zoom = 1 max _zoom; +}; + _ctrlMagnification ctrlSetText format [ "(%1x)", [_zoom, 1, 1] call CBA_fnc_formatNumber From d494a89819ab293ab8dd5d5ff0a38278b89a122b Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sun, 9 Jul 2023 14:20:25 -0700 Subject: [PATCH 2/3] Update addons/optics/fnc_animateScriptedOptic.sqf Co-authored-by: PabstMirror --- addons/optics/fnc_animateScriptedOptic.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/optics/fnc_animateScriptedOptic.sqf b/addons/optics/fnc_animateScriptedOptic.sqf index 183f9e0a26..c8f3260bac 100644 --- a/addons/optics/fnc_animateScriptedOptic.sqf +++ b/addons/optics/fnc_animateScriptedOptic.sqf @@ -75,7 +75,7 @@ private _zoom = 0.25 call CBA_fnc_getFov select 1; // To avoid flickering of the magnification text, anything above and including 0.995 is rounded to 1 if (_zoom >= 0.995) then { - _zoom = 1 max _zoom; + _zoom = 1 max _zoom; }; _ctrlMagnification ctrlSetText format [ From 669eddd97184af363acb5a0adfd392454d135e45 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Wed, 2 Aug 2023 07:52:28 +0200 Subject: [PATCH 3/3] Added magnification level caching --- addons/optics/fnc_animateScriptedOptic.sqf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/optics/fnc_animateScriptedOptic.sqf b/addons/optics/fnc_animateScriptedOptic.sqf index c8f3260bac..957a4a4fbb 100644 --- a/addons/optics/fnc_animateScriptedOptic.sqf +++ b/addons/optics/fnc_animateScriptedOptic.sqf @@ -73,9 +73,13 @@ if (cameraView == "GUNNER") then { // Add magnification to zeroing control. private _zoom = 0.25 call CBA_fnc_getFov select 1; -// To avoid flickering of the magnification text, anything above and including 0.995 is rounded to 1 -if (_zoom >= 0.995) then { - _zoom = 1 max _zoom; +// To avoid flickering of the magnification text, cache magnification and only modify magnification if change is big enough +if (abs (GVAR(magnificationCache) - _zoom) <= 0.005) then { + _zoom = GVAR(magnificationCache); +} else { + if (_zoom >= 1) then { + GVAR(magnificationCache) = _zoom; + }; }; _ctrlMagnification ctrlSetText format [ @@ -135,10 +139,6 @@ _ctrlBodyNight ctrlSetAngle [_bank, 0.5, 0.5]; // zooming reticle if (isNull (_display displayCtrl IDC_ENABLE_ZOOM)) exitWith {}; -if (_zoom >= 1) then { - GVAR(magnificationCache) = _zoom; -}; - GVAR(ReticleAdjust) set [2, _zoom]; private _reticleAdjust = linearConversion GVAR(ReticleAdjust); private _sizeReticle = _reticleAdjust * _detailScaleFactor;