Skip to content

Commit

Permalink
Scopes - Allow 0.05 mrad increments (#5840)
Browse files Browse the repository at this point in the history
* Scopes - Allow 0.05 mrad increments
  • Loading branch information
ulteq authored Dec 2, 2017
1 parent c5e594f commit 24b58fb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions addons/scopes/functions/fnc_adjustScope.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion addons/scopes/functions/fnc_adjustZero.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion addons/scopes/functions/fnc_resetZero.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion addons/scopes/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 24b58fb

Please sign in to comment.