2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-04-11 21:40:46 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Calculates the target speed and updates the output fields
|
|
|
|
*
|
|
|
|
* 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:
|
2016-07-20 04:15:18 +00:00
|
|
|
* call ace_atragmx_fnc_calculate_target_speed_assist
|
2015-04-11 21:40:46 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _targetRange = parseNumber(ctrlText 8004);
|
|
|
|
private _numTicks = parseNumber(ctrlText 8005);
|
|
|
|
private _timeSecs = parseNumber(ctrlText 8006);
|
|
|
|
private _estSpeed = 0;
|
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
|
|
|
_targetRange = _targetRange / 1.0936133;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
switch (GVAR(rangeAssistImageSizeUnit)) do {
|
|
|
|
case 0: {
|
2015-04-07 20:44:26 +00:00
|
|
|
_numTicks = _numTicks / 6400 * 360;
|
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
case 1: {
|
2015-04-07 20:44:26 +00:00
|
|
|
_numTicks = _numTicks / 60;
|
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
case 2: {
|
2015-04-07 20:44:26 +00:00
|
|
|
_numTicks = _numTicks / 60 / 1.047;
|
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
if (_timeSecs > 0) then {
|
2015-04-07 20:44:26 +00:00
|
|
|
_estSpeed = tan(_numTicks) * _targetRange / _timeSecs;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
if (GVAR(currentUnit) != 2) then {
|
2015-04-07 20:44:26 +00:00
|
|
|
_estSpeed = _estSpeed * 2.23693629;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ctrlSetText [8007, Str(Round(_estSpeed * 10) / 10)];
|