ACE3/addons/atragmx/functions/fnc_calculate_range_card.sqf

63 lines
2.4 KiB
Plaintext
Raw Normal View History

/*
* Author: Ruthberg
* Calculates the range card output based on the current data set
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
* call ace_atragmx_calculate_range_card
*
* Public: No
*/
#include "script_component.hpp"
2015-04-06 19:11:02 +00:00
[] call FUNC(parse_input);
private ["_scopeBaseAngle"];
2015-04-08 09:05:28 +00:00
_scopeBaseAngle = ((GVAR(workingMemory) select GVAR(currentTarget)) select 3);
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"];
2015-04-08 09:05:28 +00:00
_bulletMass = (GVAR(workingMemory) select GVAR(currentTarget)) select 12;
_boreHeight = (GVAR(workingMemory) select GVAR(currentTarget)) select 5;
_airFriction = (GVAR(workingMemory) select GVAR(currentTarget)) select 4;
_muzzleVelocity = (GVAR(workingMemory) select GVAR(currentTarget)) select 1;
_bc = (GVAR(workingMemory) select GVAR(currentTarget)) select 15;
_dragModel = (GVAR(workingMemory) select GVAR(currentTarget)) select 16;
_atmosphereModel = (GVAR(workingMemory) select GVAR(currentTarget)) select 17;
private ["_temperature", "_barometricPressure", "_relativeHumidity"];
2015-04-08 09:05:28 +00:00
_temperature = (GVAR(temperature) select GVAR(currentTarget));
_barometricPressure = (GVAR(barometricPressure) select GVAR(currentTarget));
_relativeHumidity = (GVAR(relativeHumidity) select GVAR(currentTarget));
if (GVAR(currentUnit) == 1) then
{
2015-04-07 20:44:26 +00:00
_temperature = (_temperature - 32) / 1.8;
_barometricPressure = _barometricPressure * 33.8638866667;
};
private ["_windSpeed", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
2015-04-08 09:05:28 +00:00
_windSpeed = (GVAR(windSpeed) select GVAR(currentTarget));
_windDirection = (GVAR(windDirection) select GVAR(currentTarget));
_inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
_targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
_targetRange = GVAR(rangeCardEndRange);
if (GVAR(currentUnit) != 2) then
{
2015-04-07 20:44:26 +00:00
_targetRange = _targetRange / 1.0936133;
};
2015-04-08 09:05:28 +00:00
if (GVAR(currentUnit) == 1) then
{
2015-04-07 20:44:26 +00:00
_windSpeed = _windSpeed / 2.23693629;
_targetSpeed = _targetSpeed / 2.23693629;
};
2015-04-08 09:05:28 +00:00
GVAR(rangeCardData) = [];
private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
2015-04-07 20:44:26 +00:00
_windSpeed, _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true] call FUNC(calculate_solution);