Skip to content

Commit

Permalink
ATragMX - Fixed UI (C1 vs. Distance interpolation) (#5720)
Browse files Browse the repository at this point in the history
* The C1 coefficient needs to be updated automatically whenever the target range changes
  • Loading branch information
ulteq authored Nov 3, 2017
1 parent 9bfab39 commit 9806702
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions addons/atragmx/functions/fnc_change_target_slot.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*/
#include "script_component.hpp"

private _target = 0 max _this min 3;
GVAR(currentTarget) = 0 max _this min 3;

[] call FUNC(parse_input);
GVAR(targetRangeDirtyFlag) = true;

GVAR(currentTarget) = _target;
call FUNC(update_target_selection);
call FUNC(calculate_target_solution);
2 changes: 2 additions & 0 deletions addons/atragmx/functions/fnc_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ GVAR(truingDropMuzzleVelocity) = 0;

GVAR(targetSolutionInput) = nil;

GVAR(targetRangeDirtyFlag) = false;

GVAR(showMainPage) = true;
GVAR(showAddNewGun) = false;
GVAR(showAtmoEnvData) = false;
Expand Down
6 changes: 6 additions & 0 deletions addons/atragmx/functions/fnc_parse_input.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ if (GVAR(currentUnit) == 1) then {
} else {
_targetRange = 25 max _targetRange min 3700;
};
GVAR(targetRangeDirtyFlag) = GVAR(targetRangeDirtyFlag) || {_targetRange != GVAR(targetRange) select GVAR(currentTarget)};
GVAR(latitude) set [GVAR(currentTarget), -90 max Round(parseNumber(ctrlText 140000)) min 90];
GVAR(directionOfFire) set [GVAR(currentTarget), 0 max abs(Round(parseNumber(ctrlText 140010))) min 359];
GVAR(windSpeed1) set [GVAR(currentTarget), _windSpeed1];
Expand Down Expand Up @@ -173,6 +174,11 @@ if (_muzzleVelocity != GVAR(workingMemory) select 1) then {
GVAR(workingMemory) set [1, _muzzleVelocity];
GVAR(workingMemory) set [2, _zeroRange];

if (GVAR(targetRangeDirtyFlag) && missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
[false, false] call FUNC(recalculate_c1_ballistic_coefficient);
GVAR(targetRangeDirtyFlag) = false;
};

[] call FUNC(update_gun);
[] call FUNC(update_gun_ammo_data);
[] call FUNC(update_atmosphere);
Expand Down
2 changes: 2 additions & 0 deletions addons/atragmx/functions/fnc_sord.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ if (!GVAR(initialised)) exitWith {};

params ["_slopeDistance", "_azimuth", "_inclination"];

GVAR(targetRangeDirtyFlag) = (round(_slopeDistance) != (GVAR(targetRange) select GVAR(currentTarget)));

GVAR(inclinationAngle) set [GVAR(currentTarget), round(_inclination)];
GVAR(directionOfFire) set [GVAR(currentTarget), round(_azimuth)];
GVAR(targetRange) set [GVAR(currentTarget), round(_slopeDistance)];

0 comments on commit 9806702

Please sign in to comment.