ACE3/addons/atragmx/functions/fnc_update_range_card.sqf

90 lines
2.2 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
private ["_range", "_elevation", "_windage", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput"];
_lastColumnOutput = "";
2015-04-08 09:05:28 +00:00
ctrlSetText [5006, (GVAR(rangeCardLastColumns) select GVAR(rangeCardCurrentColumn))];
2015-04-08 09:05:28 +00:00
if (GVAR(currentUnit) != 2) then
{
2015-04-07 20:44:26 +00:00
ctrlSetText [5003, "Yards"];
} else
{
2015-04-07 20:44:26 +00:00
ctrlSetText [5003, "Meters"];
};
lnbClear 5007;
{
2015-04-07 20:44:26 +00:00
_range = _x select 0;
_elevation = _x select 1;
_windage = _x select 2;
_lead = _x select 3;
_TOF = _x select 4;
_velocity = _x select 5;
_kineticEnergy = _x select 6;
2015-04-08 09:05:28 +00:00
switch ((GVAR(currentScopeUnit) select GVAR(currentTarget))) do
2015-04-07 20:44:26 +00:00
{
case 0:
{
_elevation = _elevation / 3.38;
_windage = _windage / 3.38;
};
case 2:
{
_elevation = _elevation * 1.047;
_windage = _windage * 1.047;
};
case 3:
{
2015-04-08 09:05:28 +00:00
_elevationScopeStep = ((GVAR(workingMemory) select GVAR(currentTarget)) select 7);
_windageScopeStep = ((GVAR(workingMemory) select GVAR(currentTarget)) select 8);
2015-04-07 20:44:26 +00:00
_elevation = Round(_elevation / _elevationScopeStep);
_windage = Round(_windage / _windageScopeStep);
};
};
_elevationOutput = Str(Round(_elevation * 100) / 100);
_windageOutput = Str(Round(_windage * 100) / 100);
_rangeOutput = Str(_range);
if (_velocity < 340.29) then
{
_rangeOutput = _rangeOutput + "*";
};
2015-04-08 09:05:28 +00:00
if (GVAR(currentUnit) == 1) then
2015-04-07 20:44:26 +00:00
{
_velocity = _velocity * 3.2808399;
};
2015-04-08 09:05:28 +00:00
switch (GVAR(rangeCardCurrentColumn)) do
2015-04-07 20:44:26 +00:00
{
case 0:
{
_lastColumnOutput = Str(Round(_lead * 100) / 100);
};
case 1:
{
_lastColumnOutput = Str(Round(_velocity));
};
case 2:
{
_lastColumnOutput = Str(Round(_kineticEnergy));
};
case 3:
{
_lastColumnOutput = Str(Round(_TOF * 100) / 100);
}
};
lnbAddRow [5007, [_rangeOutput, _elevationOutput, _windageOutput, _lastColumnOutput]];
2015-04-08 09:05:28 +00:00
} forEach GVAR(rangeCardData);