Skip to content

Commit

Permalink
Scripted optics updates (#1176)
Browse files Browse the repository at this point in the history
* add hideMagnification parameter for scripted optics

* add disableTilt parameter for scripted optics

* fix pip not updated when changing optics

* disable debug
  • Loading branch information
commy2 committed Jul 6, 2019
1 parent 508ebd3 commit a89b691
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions addons/optics/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ GVAR(manualReticleNightSwitch) = false;
GVAR(useReticleNight) = false;
GVAR(reticleSafezoneSize) = RETICLE_SAFEZONE_DEFAULT_SIZE;
GVAR(hidePeripheralVision) = false;
GVAR(hideMagnification) = false;
GVAR(disableTilt) = false;

// Update optic info.
["weapon", {
Expand All @@ -44,6 +46,7 @@ GVAR(hidePeripheralVision) = false;
["loadout", {
params ["_unit"];
_unit call FUNC(updateOpticInfo);
_unit call FUNC(changePIPOpticClass);
_unit call FUNC(changeCarryHandleOpticClass);
}] call CBA_fnc_addPlayerEventHandler;

Expand Down
10 changes: 8 additions & 2 deletions addons/optics/fnc_animateScriptedOptic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ _ctrlMagnification ctrlSetText format [
[_zoom, 1, 1] call CBA_fnc_formatNumber
];

_ctrlMagnification ctrlShow (_zoom >= 1);
_ctrlMagnification ctrlShow (_zoom >= 1 && {!GVAR(hideMagnification)});

private _positionMagnification = ctrlPosition _ctrlZeroing;
_positionMagnification set [0, _positionMagnification#0 + ctrlTextWidth _ctrlZeroing];
Expand Down Expand Up @@ -116,7 +116,13 @@ _ctrlBody ctrlSetTextColor [1,1,1,_dayOpacity];
_ctrlBodyNight ctrlSetTextColor [1,1,1,_nightOpacity];
_ctrlBlackScope ctrlShow (GVAR(usePipOptics) && !isPipEnabled);

private _bank = call FUNC(gunBank);
// tilt while leaning
private _bank = 0;

if (!GVAR(disableTilt)) then {
_bank = call FUNC(gunBank);
};

_ctrlReticle ctrlSetAngle [_bank, 0.5, 0.5];
_ctrlBody ctrlSetAngle [_bank, 0.5, 0.5];
_ctrlBodyNight ctrlSetAngle [_bank, 0.5, 0.5];
Expand Down
3 changes: 3 additions & 0 deletions addons/optics/fnc_updateOpticInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ GVAR(ppEffects) = getArray (_config >> "opticsPPEffects") apply {
_ppEffect
};

GVAR(hideMagnification) = getNumber (_config >> "hideMagnification") != 0;
GVAR(disableTilt) = getNumber (_config >> "disableTilt") != 0;

[uiNamespace getVariable QGVAR(ScriptedOpticDisplay), false] call FUNC(loadScriptedOptic);

//INFO_1("Updated optic info %1.",_optic);
Expand Down

0 comments on commit a89b691

Please sign in to comment.