2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-11 21:40:46 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Updates the scope base angle based on the zero range input
|
|
|
|
*
|
|
|
|
* 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_zero_range
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2016-11-02 17:05:19 +00:00
|
|
|
[] call FUNC(parse_input);
|
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _bulletMass = GVAR(workingMemory) select 12;
|
|
|
|
private _boreHeight = GVAR(workingMemory) select 5;
|
|
|
|
private _airFriction = GVAR(workingMemory) select 4;
|
|
|
|
private _muzzleVelocity = GVAR(workingMemory) select 1;
|
|
|
|
private _bc = GVAR(workingMemory) select 15;
|
|
|
|
private _dragModel = GVAR(workingMemory) select 16;
|
|
|
|
private _atmosphereModel = GVAR(workingMemory) select 17;
|
|
|
|
private _zeroRange = GVAR(workingMemory) select 2;
|
|
|
|
private _altitude = GVAR(altitude);
|
|
|
|
private _temperature = GVAR(temperature);
|
|
|
|
private _barometricPressure = GVAR(barometricPressure);
|
|
|
|
private _relativeHumidity = GVAR(relativeHumidity);
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2016-11-02 17:05:19 +00:00
|
|
|
if (!GVAR(atmosphereModeTBH)) then {
|
|
|
|
_barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495;
|
2017-09-08 16:18:17 +00:00
|
|
|
_relativeHumidity = 0.5;
|
2016-11-02 17:05:19 +00:00
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2016-11-09 13:00:25 +00:00
|
|
|
private _scopeBaseAngle = if (!(missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false])) then {
|
2017-11-12 11:11:10 +00:00
|
|
|
private _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZero:%1:%2:%3:%4", _zeroRange, _muzzleVelocity, _airFriction, _boreHeight];
|
2016-11-09 13:00:25 +00:00
|
|
|
(parseNumber _zeroAngle)
|
|
|
|
} else {
|
2017-11-12 11:11:10 +00:00
|
|
|
private _zeroAngle = "ace_advanced_ballistics" callExtension format ["calcZeroAB:%1:%2:%3:%4:%5:%6:%7:%8:%9", _zeroRange, _muzzleVelocity, _boreHeight, _temperature, _barometricPressure, _relativeHumidity, _bc, _dragModel, _atmosphereModel];
|
2016-11-09 13:00:25 +00:00
|
|
|
(parseNumber _zeroAngle)
|
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-16 16:14:32 +00:00
|
|
|
GVAR(workingMemory) set [2, _zeroRange];
|
2016-11-02 17:05:19 +00:00
|
|
|
GVAR(workingMemory) set [3, _scopeBaseAngle];
|