Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optics - Fixed magnification text flickering at 1.0x zoom level #1583

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions addons/optics/fnc_animateScriptedOptic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ 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, 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 [
"(%1x)",
[_zoom, 1, 1] call CBA_fnc_formatNumber
Expand Down Expand Up @@ -130,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;
Expand Down
Loading