2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-11 21:40:46 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Updates the range card listbox content
|
|
|
|
*
|
|
|
|
* Arguments:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2015-04-11 21:40:46 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
2015-04-11 21:40:46 +00:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* call ace_atragmx_fnc_update_range_card
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _lastColumnOutput = "";
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-18 13:08:54 +00:00
|
|
|
if (GVAR(showWind2) && GVAR(rangeCardCurrentColumn) == 0) then {
|
|
|
|
ctrlSetText [5006, "Wind2"];
|
|
|
|
} else {
|
|
|
|
ctrlSetText [5006, (GVAR(rangeCardLastColumns) select GVAR(rangeCardCurrentColumn))];
|
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
if (GVAR(currentUnit) == 1) then {
|
2015-04-07 20:44:26 +00:00
|
|
|
ctrlSetText [5003, "Yards"];
|
2015-04-17 22:11:53 +00:00
|
|
|
} else {
|
2015-04-07 20:44:26 +00:00
|
|
|
ctrlSetText [5003, "Meters"];
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
lnbClear 5007;
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _speedOfSound = GVAR(temperature) call EFUNC(weather,calculateSpeedOfSound);
|
2015-05-29 09:36:37 +00:00
|
|
|
|
2015-04-06 13:51:59 +00:00
|
|
|
{
|
2017-10-10 14:39:59 +00:00
|
|
|
private _range = _x select 0;
|
|
|
|
private _elevation = _x select 1;
|
|
|
|
private _windage1 = (_x select 2) select 0;
|
|
|
|
private _windage2 = (_x select 2) select 1;
|
|
|
|
private _lead = _x select 3;
|
|
|
|
private _TOF = _x select 4;
|
|
|
|
private _velocity = _x select 5;
|
|
|
|
private _kineticEnergy = _x select 6;
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
switch (GVAR(currentScopeUnit)) do {
|
|
|
|
case 0: {
|
2017-10-28 19:42:03 +00:00
|
|
|
_elevation = MOA_TO_MRAD(_elevation);
|
|
|
|
_windage1 = MOA_TO_MRAD(_windage1);
|
|
|
|
_windage2 = MOA_TO_MRAD(_windage2);
|
2015-04-18 13:08:54 +00:00
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
case 2: {
|
2015-04-07 20:44:26 +00:00
|
|
|
_elevation = _elevation * 1.047;
|
2015-04-18 13:08:54 +00:00
|
|
|
_windage1 = _windage1 * 1.047;
|
|
|
|
_windage2 = _windage2 * 1.047;
|
2015-04-07 20:44:26 +00:00
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
case 3: {
|
2017-10-28 19:42:03 +00:00
|
|
|
private _clickSize = [1, 1 / 1.047, MRAD_TO_MOA(1)] select (GVAR(workingMemory) select 7);
|
2017-10-10 14:39:59 +00:00
|
|
|
private _clickNumber = GVAR(workingMemory) select 8;
|
|
|
|
private _clickInterval = _clickSize / _clickNumber;
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2015-04-21 13:01:23 +00:00
|
|
|
_elevation = Round(_elevation / _clickInterval);
|
|
|
|
_windage1 = Round(_windage1 / _clickInterval);
|
|
|
|
_windage2 = Round(_windage2 / _clickInterval);
|
2015-04-07 20:44:26 +00:00
|
|
|
};
|
|
|
|
};
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _elevationOutput = Str(Round(_elevation * 100) / 100);
|
|
|
|
private _windageOutput = Str(Round(_windage1 * 100) / 100);
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _rangeOutput = Str(_range);
|
2015-05-29 09:36:37 +00:00
|
|
|
if (_velocity < _speedOfSound) then {
|
2015-04-07 20:44:26 +00:00
|
|
|
_rangeOutput = _rangeOutput + "*";
|
|
|
|
};
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
if (GVAR(currentUnit) == 1) then {
|
2015-04-07 20:44:26 +00:00
|
|
|
_velocity = _velocity * 3.2808399;
|
|
|
|
};
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
switch (GVAR(rangeCardCurrentColumn)) do {
|
|
|
|
case 0: {
|
2015-04-18 13:08:54 +00:00
|
|
|
if (GVAR(showWind2)) then {
|
|
|
|
_lastColumnOutput = Str(Round(_windage2 * 100) / 100);
|
|
|
|
} else {
|
|
|
|
_lastColumnOutput = Str(Round(_lead * 100) / 100);
|
|
|
|
};
|
2015-04-07 20:44:26 +00:00
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
case 1: {
|
2015-04-07 20:44:26 +00:00
|
|
|
_lastColumnOutput = Str(Round(_velocity));
|
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
case 2: {
|
2015-04-07 20:44:26 +00:00
|
|
|
_lastColumnOutput = Str(Round(_kineticEnergy));
|
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
case 3: {
|
2015-04-07 20:44:26 +00:00
|
|
|
_lastColumnOutput = Str(Round(_TOF * 100) / 100);
|
|
|
|
}
|
|
|
|
};
|
2016-05-03 00:32:44 +00:00
|
|
|
|
2015-04-07 20:44:26 +00:00
|
|
|
lnbAddRow [5007, [_rangeOutput, _elevationOutput, _windageOutput, _lastColumnOutput]];
|
2015-04-08 09:05:28 +00:00
|
|
|
} forEach GVAR(rangeCardData);
|