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

Scripted optics updates #1176

Merged
merged 4 commits into from
Jul 6, 2019
Merged
Show file tree
Hide file tree
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
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