From a7195301dfcd9ac3dceb7ae6d9eda719761c99fe Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 8 Feb 2018 12:01:41 -0600 Subject: [PATCH] Scopes - Use real zero for non-adjustable scopes (#6128) --- addons/scopes/functions/fnc_firedEH.sqf | 8 ++++---- addons/scopes/functions/fnc_getCurrentZeroRange.sqf | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 6d63f9107a6..b183109071d 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -24,12 +24,9 @@ private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponI if (_weaponIndex < 0) exitWith {}; private _adjustment = _unit getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]; -private _zeroing = +(_adjustment select _weaponIndex); +private _zeroing = (_adjustment select _weaponIndex) vectorMultiply 0.05729578; // Convert zeroing from mils to degrees (value of MRAD_TO_DEG(1)) TRACE_1("Adjusting With",_zeroing); -// Convert zeroing from mils to degrees -_zeroing = _zeroing vectorMultiply MRAD_TO_DEG(1); - if (GVAR(correctZeroing) || GVAR(simplifiedZeroing)) then { private _advancedBallistics = missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]; private _baseAngle = (_unit getVariable [QGVAR(baseAngle), [0,0,0]]) select _weaponIndex; @@ -39,6 +36,8 @@ if (GVAR(correctZeroing) || GVAR(simplifiedZeroing)) then { private _zeroCorrection = missionNamespace getVariable format[QGVAR(%1_%2_%3_%4_%5_%6_%7), _oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics]; if (isNil "_zeroCorrection") then { _zeroCorrection = [_oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics] call FUNC(calculateZeroAngleCorrection); + TRACE_7("new calc",_oldZeroRange,_newZeroRange,_boreHeight,_weapon,_ammo,_magazine,_advancedBallistics); + TRACE_1("",_zeroCorrection); }; if (GVAR(simplifiedZeroing)) then { _zeroing = [0, 0, _zeroCorrection - _baseAngle]; @@ -50,6 +49,7 @@ if (GVAR(correctZeroing) || GVAR(simplifiedZeroing)) then { #endif }; +TRACE_1("",_zeroing); if (_zeroing isEqualTo [0, 0, 0]) exitWith {}; _zeroing params ["_elevation", "_windage", "_zero"]; diff --git a/addons/scopes/functions/fnc_getCurrentZeroRange.sqf b/addons/scopes/functions/fnc_getCurrentZeroRange.sqf index 2da5f32eb05..946e2e0b2bc 100644 --- a/addons/scopes/functions/fnc_getCurrentZeroRange.sqf +++ b/addons/scopes/functions/fnc_getCurrentZeroRange.sqf @@ -22,6 +22,7 @@ if (!GVAR(enabled)) exitWith { currentZeroing _unit }; private _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith { currentZeroing _unit }; if (GVAR(simplifiedZeroing)) exitWith { + if (!(GVAR(canAdjustElevation) select _weaponIndex)) exitWith { currentZeroing _unit }; private _adjustment = _unit getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]; ((_adjustment select _weaponIndex) select 0) };