2015-04-11 21:40:46 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Calculates the range card output based on the current data set
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
2016-07-20 04:15:18 +00:00
|
|
|
* call ace_atragmx_fnc_calculate_range_card
|
2015-04-11 21:40:46 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-06 13:51:59 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-06 19:11:02 +00:00
|
|
|
[] call FUNC(parse_input);
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
GVAR(workingMemory) params ["",
|
|
|
|
"_muzzleVelocity", "",
|
|
|
|
"_scopeBaseAngle",
|
|
|
|
"_airFriction",
|
|
|
|
"_boreHeight", "", "", "", "", "", "",
|
|
|
|
"_bulletMass",
|
|
|
|
"_bulletDiameter",
|
|
|
|
"_barrelTwist",
|
|
|
|
"_bc",
|
|
|
|
"_dragModel",
|
|
|
|
"_atmosphereModel"
|
|
|
|
];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
private _twistDirection = 0;
|
2015-04-17 22:11:53 +00:00
|
|
|
if (_barrelTwist > 0) then {
|
|
|
|
_twistDirection = 1;
|
|
|
|
} else {
|
|
|
|
if (_barrelTwist < 0) then {
|
|
|
|
_twistDirection = -1;
|
|
|
|
};
|
|
|
|
};
|
2016-09-04 14:44:22 +00:00
|
|
|
_barrelTwist = abs _barrelTwist;
|
2015-04-17 22:11:53 +00:00
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
private _altitude = GVAR(altitude);
|
|
|
|
private _temperature = GVAR(temperature);
|
|
|
|
private _barometricPressure = GVAR(barometricPressure);
|
|
|
|
private _relativeHumidity = GVAR(relativeHumidity);
|
2015-04-17 22:11:53 +00:00
|
|
|
if (!GVAR(atmosphereModeTBH)) then {
|
2015-05-29 09:18:40 +00:00
|
|
|
_barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495;
|
2015-04-17 22:11:53 +00:00
|
|
|
_relativeHumidity = 50;
|
|
|
|
};
|
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
private _bulletLength = 45.72;
|
|
|
|
private _stabilityFactor = 1.5;
|
2015-04-25 11:34:47 +00:00
|
|
|
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
2015-04-17 22:11:53 +00:00
|
|
|
if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
|
2015-05-08 11:56:38 +00:00
|
|
|
_stabilityFactor = [_bulletDiameter, _bulletLength, _bulletMass, _barrelTwist * 10, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor);
|
2015-04-17 22:11:53 +00:00
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
private _latitude = GVAR(latitude) select GVAR(currentTarget);
|
|
|
|
private _directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
|
|
|
|
private _windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
|
|
|
|
private _windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
|
|
|
|
private _windDirection = (GVAR(windDirection) select GVAR(currentTarget));
|
|
|
|
private _inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
|
|
|
|
private _targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
|
|
|
|
private _targetRange = GVAR(rangeCardEndRange);
|
2015-04-17 22:11:53 +00:00
|
|
|
if (GVAR(currentUnit) == 1) then {
|
|
|
|
_targetRange = _targetRange / 1.0936133;
|
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-08 09:05:28 +00:00
|
|
|
GVAR(rangeCardData) = [];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2016-09-04 14:44:22 +00:00
|
|
|
private _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
|
2015-04-19 20:30:13 +00:00
|
|
|
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution);
|