From ce825ce8d3fa4559d6f7ab12c208c4d477da8ca0 Mon Sep 17 00:00:00 2001 From: ulteq Date: Tue, 21 Nov 2017 23:56:46 +0100 Subject: [PATCH] Scopes - Add 'DISABLE_DISPERSION' helper flag * Allows you to disable vanilla dispersion for testing purposes by defining 'DISABLE_DISPERSION' --- addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf | 4 ++++ addons/scopes/functions/fnc_firedEH.sqf | 3 +++ addons/scopes/script_component.hpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf b/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf index 1c04ef6c8b..5e3cdddb59 100644 --- a/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf +++ b/addons/scopes/functions/fnc_calculateZeroAngleCorrection.sqf @@ -35,6 +35,10 @@ if (_initSpeedCoef < 0) then { private _zeroAngle = "ace_advanced_ballistics" callExtension format ["replicateVanillaZero:%1:%2:%3", _oldZeroRange, _initSpeed, _airFriction]; private _vanillaZero = parseNumber _zeroAngle; +#ifdef DISABLE_DISPERSION + _vanillaZero = 0; +#endif + private _trueZero = if (!_advancedBallistics) then { _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZero:%1:%2:%3:%4", _newZeroRange, _initSpeed, _airFriction, _boreHeight]; (parseNumber _zeroAngle) diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index cbe846f1cc..e3e51d1c11 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -41,6 +41,9 @@ if (GVAR(correctZeroing)) then { _zeroCorrection = [_oldZeroRange, _newZeroRange, _boreHeight, _weapon, _ammo, _magazine, _advancedBallistics] call FUNC(calculateZeroAngleCorrection); }; _zeroing = _zeroing vectorAdd [0, 0, _zeroCorrection - _baseAngle]; +#ifdef DISABLE_DISPERSION + _projectile setVelocity (_unit weaponDirection currentWeapon _unit) vectorMultiply (vectorMagnitude (velocity _projectile)); +#endif }; if (_zeroing isEqualTo [0, 0, 0]) exitWith {}; diff --git a/addons/scopes/script_component.hpp b/addons/scopes/script_component.hpp index 58ae637ef3..c3b09facce 100644 --- a/addons/scopes/script_component.hpp +++ b/addons/scopes/script_component.hpp @@ -16,6 +16,8 @@ #define DEFAULT_RAIL_BASE_ANGLE 0.0086 +// #define DISABLE_DISPERSION + #ifdef DEBUG_ENABLED_SCOPES #define DEBUG_MODE_FULL #endif