From 24b58fbb21bf6d9363254d01737bbc8a0e9f110f Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 2 Dec 2017 16:23:41 +0100 Subject: [PATCH] Scopes - Allow 0.05 mrad increments (#5840) * Scopes - Allow 0.05 mrad increments --- addons/scopes/functions/fnc_adjustScope.sqf | 4 ++-- addons/scopes/functions/fnc_adjustZero.sqf | 2 +- addons/scopes/functions/fnc_resetZero.sqf | 2 +- addons/scopes/script_component.hpp | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 7455cb850e..f670fc1720 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -51,8 +51,8 @@ if (_majorStep) then { }; }; -_elevation = round(_elevation * 10) / 10; -_windage = round(_windage * 10) / 10; +_elevation = round(_elevation / MIN_INCREMENT) * MIN_INCREMENT; +_windage = round(_windage / MIN_INCREMENT) * MIN_INCREMENT; if ((_elevation + _zero) < _maxVertical select 0 or (_elevation + _zero) > _maxVertical select 1) exitWith {false}; if (_windage < _maxHorizontal select 0 or _windage > _maxHorizontal select 1) exitWith {false}; diff --git a/addons/scopes/functions/fnc_adjustZero.sqf b/addons/scopes/functions/fnc_adjustZero.sqf index 011f674248..b551d6b2c7 100644 --- a/addons/scopes/functions/fnc_adjustZero.sqf +++ b/addons/scopes/functions/fnc_adjustZero.sqf @@ -27,7 +27,7 @@ private _adjustment = _unit getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0 private _zeroing = _adjustment select _weaponIndex; _zeroing params ["_elevation", "_windage", "_zero"]; -_zero = round((_zero + _elevation) * 10) / 10; +_zero = round((_zero + _elevation) / MIN_INCREMENT) * MIN_INCREMENT; _elevation = 0; private _opticsClass = ([_unit] call FUNC(getOptics)) select _weaponIndex; diff --git a/addons/scopes/functions/fnc_resetZero.sqf b/addons/scopes/functions/fnc_resetZero.sqf index 14366e5924..8d083cf2ee 100644 --- a/addons/scopes/functions/fnc_resetZero.sqf +++ b/addons/scopes/functions/fnc_resetZero.sqf @@ -27,7 +27,7 @@ private _adjustment = _unit getVariable [QGVAR(Adjustment), [[0, 0, 0], [0, 0, 0 private _zeroing = _adjustment select _weaponIndex; _zeroing params ["_elevation", "_windage", "_zero"]; -_elevation = round((_zero + _elevation) * 10) / 10; +_elevation = round((_zero + _elevation) / MIN_INCREMENT) * MIN_INCREMENT; _zero = 0; private _opticsClass = ([_unit] call FUNC(getOptics)) select _weaponIndex; diff --git a/addons/scopes/script_component.hpp b/addons/scopes/script_component.hpp index c3b09facce..9e867a9bd2 100644 --- a/addons/scopes/script_component.hpp +++ b/addons/scopes/script_component.hpp @@ -14,7 +14,9 @@ #define MINOR_INCREMENT false #define MAJOR_INCREMENT true -#define DEFAULT_RAIL_BASE_ANGLE 0.0086 +#define MIN_INCREMENT 0.05 // mrad + +#define DEFAULT_RAIL_BASE_ANGLE 0.0086 // deg // #define DISABLE_DISPERSION