2015-04-11 21:40:46 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Parses all input fields in the gun, atmosphere and target column and the result input fields
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Nothing
|
|
|
|
*
|
|
|
|
* Example:
|
2016-07-20 04:15:18 +00:00
|
|
|
* call ace_atragmx_fnc_parse_input
|
2015-04-11 21:40:46 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-06 13:51:59 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
GVAR(altitude) = -1000 max parseNumber(ctrlText 130030) min 20000;
|
|
|
|
GVAR(temperature) = -50 max parseNumber(ctrlText 130040) min 160;
|
2015-04-19 09:18:37 +00:00
|
|
|
GVAR(barometricPressure) = 10 max parseNumber(ctrlText 130050) min 1350;
|
2015-04-17 22:11:53 +00:00
|
|
|
GVAR(relativeHumidity) = (0 max parseNumber(ctrlText 130060) min 100) / 100;
|
2015-04-19 09:02:06 +00:00
|
|
|
if (GVAR(currentUnit) != 2) then {
|
2015-04-17 22:11:53 +00:00
|
|
|
GVAR(altitude) = GVAR(altitude) * 0.3048;
|
|
|
|
GVAR(temperature) = (GVAR(temperature) - 32) / 1.8;
|
|
|
|
GVAR(barometricPressure) = GVAR(barometricPressure) * 33.86389;
|
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-18 13:52:06 +00:00
|
|
|
private ["_inclinationAngleCosine", "_inclinationAngleDegree"];
|
2015-04-17 22:11:53 +00:00
|
|
|
GVAR(latitude) set [GVAR(currentTarget), -90 max Round(parseNumber(ctrlText 140000)) min 90];
|
|
|
|
GVAR(directionOfFire) set [GVAR(currentTarget), 0 max abs(Round(parseNumber(ctrlText 140010))) min 359];
|
|
|
|
GVAR(windSpeed1) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140020)) min 50];
|
|
|
|
GVAR(windSpeed2) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140021)) min 50];
|
|
|
|
GVAR(windDirection) set [GVAR(currentTarget), 1 max Round(parseNumber(ctrlText 140030)) min 12];
|
2015-04-18 15:45:32 +00:00
|
|
|
_inclinationAngleCosine = 0.5 max parseNumber(ctrlText 140041) min 1;
|
2015-04-19 10:40:13 +00:00
|
|
|
_inclinationAngleDegree = -60 max round(parseNumber(ctrlText 140040)) min 60;
|
2015-04-18 13:52:06 +00:00
|
|
|
if (_inclinationAngleDegree != GVAR(inclinationAngle) select GVAR(currentTarget)) then {
|
|
|
|
GVAR(inclinationAngle) set [GVAR(currentTarget), _inclinationAngleDegree];
|
|
|
|
} else {
|
2015-04-18 15:45:32 +00:00
|
|
|
if (_inclinationAngleCosine != Round(cos(GVAR(inclinationAngle) select GVAR(currentTarget)) * 100) / 100) then {
|
2015-04-19 10:40:13 +00:00
|
|
|
GVAR(inclinationAngle) set [GVAR(currentTarget), round(acos(_inclinationAngleCosine))];
|
2015-04-18 13:52:06 +00:00
|
|
|
};
|
|
|
|
};
|
2015-04-21 13:46:53 +00:00
|
|
|
GVAR(targetSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140050)) min 50];
|
|
|
|
if ((ctrlText 140051) == ">") then {
|
|
|
|
GVAR(targetSpeedDirection) set [GVAR(currentTarget), +1];
|
|
|
|
} else {
|
|
|
|
GVAR(targetSpeedDirection) set [GVAR(currentTarget), -1];
|
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 140060)) min 4000];
|
2015-04-18 10:12:19 +00:00
|
|
|
if (GVAR(currentUnit) != 2) then {
|
|
|
|
GVAR(windSpeed1) set [GVAR(currentTarget), (GVAR(windSpeed1) select GVAR(currentTarget)) * 0.44704];
|
|
|
|
GVAR(windSpeed2) set [GVAR(currentTarget), (GVAR(windSpeed2) select GVAR(currentTarget)) * 0.44704];
|
|
|
|
GVAR(targetSpeed) set [GVAR(currentTarget), (GVAR(targetSpeed) select GVAR(currentTarget)) * 0.44704];
|
|
|
|
};
|
|
|
|
if (GVAR(currentUnit) == 1) then {
|
|
|
|
GVAR(targetRange) set [GVAR(currentTarget), (GVAR(targetRange) select GVAR(currentTarget)) * 0.9144];
|
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
private ["_boreHeight", "_bulletMass", "_bulletDiameter", "_airFriction", "_rifleTwist", "_muzzleVelocity", "_zeroRange"];
|
|
|
|
_boreHeight = parseNumber(ctrlText 120000);
|
|
|
|
_bulletMass = parseNumber(ctrlText 120010);
|
2015-05-16 19:44:43 +00:00
|
|
|
_bulletDiameter = parseNumber(ctrlText 120020) * 10;
|
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
|
|
|
_airFriction = 0.1 max parseNumber(ctrlText 120030) min 2;
|
2015-04-06 13:51:59 +00:00
|
|
|
} else {
|
2015-04-17 22:11:53 +00:00
|
|
|
_airFriction = parseNumber(ctrlText 120030) / -1000;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
_rifleTwist = parseNumber(ctrlText 120040);
|
|
|
|
_muzzleVelocity = parseNumber(ctrlText 120050);
|
|
|
|
_zeroRange = parseNumber (ctrlText 120060);
|
|
|
|
if (GVAR(currentUnit) != 2) then {
|
2015-04-07 20:44:26 +00:00
|
|
|
_boreHeight = _boreHeight * 2.54;
|
|
|
|
_bulletMass = _bulletMass * 0.06479891;
|
2015-05-16 19:44:43 +00:00
|
|
|
_bulletDiameter = _bulletDiameter * 2.54;
|
2015-04-17 22:11:53 +00:00
|
|
|
_rifleTwist = _rifleTwist * 2.54;
|
2015-04-07 20:44:26 +00:00
|
|
|
_muzzleVelocity = _muzzleVelocity / 3.2808399;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
if (GVAR(currentUnit) == 1) then {
|
|
|
|
_zeroRange = _zeroRange / 1.0936133;
|
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
_boreHeight = 0.1 max _boreHeight min 10;
|
|
|
|
_bulletMass = 1 max _bulletMass min 100;
|
2015-04-17 22:11:53 +00:00
|
|
|
_bulletDiameter = 1 max _bulletDiameter min 25;
|
2015-04-06 13:51:59 +00:00
|
|
|
_muzzleVelocity = 100 max _muzzleVelocity min 1400;
|
2015-04-17 22:11:53 +00:00
|
|
|
_zeroRange = 0 max _zeroRange min 1000;
|
2015-04-16 16:14:32 +00:00
|
|
|
GVAR(workingMemory) set [5, _boreHeight];
|
|
|
|
GVAR(workingMemory) set [12, _bulletMass];
|
2015-04-17 22:11:53 +00:00
|
|
|
GVAR(workingMemory) set [13, _bulletDiameter];
|
|
|
|
GVAR(workingMemory) set [14, _rifleTwist];
|
2015-04-25 11:34:47 +00:00
|
|
|
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
2015-04-16 16:14:32 +00:00
|
|
|
GVAR(workingMemory) set [15, _airFriction];
|
2015-04-06 13:51:59 +00:00
|
|
|
} else {
|
2015-04-16 16:14:32 +00:00
|
|
|
GVAR(workingMemory) set [4, _airFriction];
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
2015-04-16 16:14:32 +00:00
|
|
|
GVAR(workingMemory) set [1, _muzzleVelocity];
|
2015-04-17 22:11:53 +00:00
|
|
|
GVAR(workingMemory) set [2, _zeroRange];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-06 18:46:33 +00:00
|
|
|
[] call FUNC(update_gun);
|
2015-04-17 22:11:53 +00:00
|
|
|
[] call FUNC(update_gun_ammo_data);
|
2015-04-06 18:46:33 +00:00
|
|
|
[] call FUNC(update_atmosphere);
|
2015-04-17 22:11:53 +00:00
|
|
|
[] call FUNC(update_atmo_env_data);
|
2015-04-06 18:46:33 +00:00
|
|
|
[] call FUNC(update_target);
|
2015-04-18 15:45:32 +00:00
|
|
|
[] call FUNC(update_target_data);
|
2015-04-17 22:11:53 +00:00
|
|
|
|
|
|
|
[] call FUNC(store_user_data);
|