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:
|
|
|
|
* call ace_atragmx_parse_input
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-06 13:51:59 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-08 09:05:28 +00:00
|
|
|
GVAR(temperature) set [GVAR(currentTarget), parseNumber(ctrlText 200)];
|
|
|
|
GVAR(barometricPressure) set [GVAR(currentTarget), 0 max parseNumber(ctrlText 210)];
|
|
|
|
GVAR(relativeHumidity) set [GVAR(currentTarget), (0 max parseNumber(ctrlText 220) min 100) / 100];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-08 09:05:28 +00:00
|
|
|
GVAR(windSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 300)) min 50];
|
|
|
|
GVAR(windDirection) set [GVAR(currentTarget), 1 max Round(parseNumber(ctrlText 310)) min 12];
|
|
|
|
GVAR(inclinationAngle) set [GVAR(currentTarget), -60 max parseNumber(ctrlText 320) min 60];
|
|
|
|
GVAR(targetSpeed) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 330)) min 50];
|
|
|
|
GVAR(targetRange) set [GVAR(currentTarget), 0 max abs(parseNumber(ctrlText 340)) min 4000];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
|
|
|
private ["_boreHeight", "_bulletMass", "_airFriction", "_muzzleVelocity"];
|
|
|
|
_boreHeight = parseNumber(ctrlText 100);
|
|
|
|
_bulletMass = parseNumber(ctrlText 110);
|
2015-04-10 13:17:16 +00:00
|
|
|
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
|
2015-04-07 20:44:26 +00:00
|
|
|
_airFriction = 0.1 max parseNumber(ctrlText 120) min 2;
|
2015-04-06 13:51:59 +00:00
|
|
|
} else {
|
2015-04-07 20:44:26 +00:00
|
|
|
_airFriction = parseNumber(ctrlText 120) / -1000;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
_muzzleVelocity = parseNumber(ctrlText 130);
|
2015-04-08 09:05:28 +00:00
|
|
|
if (GVAR(currentUnit) == 1) then
|
2015-04-06 13:51:59 +00:00
|
|
|
{
|
2015-04-07 20:44:26 +00:00
|
|
|
_boreHeight = _boreHeight * 2.54;
|
|
|
|
_bulletMass = _bulletMass * 0.06479891;
|
|
|
|
_muzzleVelocity = _muzzleVelocity / 3.2808399;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
_boreHeight = 0.1 max _boreHeight min 10;
|
|
|
|
_bulletMass = 1 max _bulletMass min 100;
|
|
|
|
_muzzleVelocity = 100 max _muzzleVelocity min 1400;
|
|
|
|
|
2015-04-08 09:05:28 +00:00
|
|
|
(GVAR(workingMemory) select GVAR(currentTarget)) set [5, _boreHeight];
|
|
|
|
(GVAR(workingMemory) select GVAR(currentTarget)) set [12, _bulletMass];
|
2015-04-10 14:48:45 +00:00
|
|
|
if ((missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) && (missionNamespace getVariable [QEGVAR(advanced_ballistics,AdvancedAirDragEnabled), false])) then {
|
2015-04-08 09:05:28 +00:00
|
|
|
(GVAR(workingMemory) select GVAR(currentTarget)) set [15, _airFriction];
|
2015-04-06 13:51:59 +00:00
|
|
|
} else {
|
2015-04-08 09:05:28 +00:00
|
|
|
(GVAR(workingMemory) select GVAR(currentTarget)) set [4, _airFriction];
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
2015-04-08 09:05:28 +00:00
|
|
|
(GVAR(workingMemory) select GVAR(currentTarget)) set [1, _muzzleVelocity];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
|
|
|
private ["_elevationCur", "_elevationCur", "_elevationScopeStep", "_windageScopeStep"];
|
|
|
|
_elevationCur = parseNumber(ctrlText 402);
|
|
|
|
_windageCur = parseNumber(ctrlText 412);
|
|
|
|
|
2015-04-08 09:05:28 +00:00
|
|
|
switch ((GVAR(currentScopeUnit) select GVAR(currentTarget))) do
|
2015-04-06 13:51:59 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2015-04-07 20:44:26 +00:00
|
|
|
_elevationCur = _elevationCur * 3.38;
|
|
|
|
_windageCur = _windageCur * 3.38;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
2015-04-07 20:44:26 +00:00
|
|
|
|
2015-04-06 13:51:59 +00:00
|
|
|
case 2:
|
|
|
|
{
|
2015-04-07 20:44:26 +00:00
|
|
|
_elevationCur = _elevationCur / 1.047;
|
|
|
|
_windageCur = _windageCur / 1.047;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
2015-04-07 20:44:26 +00:00
|
|
|
|
|
|
|
case 3:
|
2015-04-06 13:51:59 +00:00
|
|
|
{
|
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
|
|
|
|
|
|
|
_elevationCur = _elevationCur * _elevationScopeStep;
|
|
|
|
_windageCur = _windageCur * _windageScopeStep;
|
2015-04-06 13:51:59 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-04-08 09:05:28 +00:00
|
|
|
(GVAR(workingMemory) select GVAR(currentTarget)) set [10, _elevationCur];
|
|
|
|
(GVAR(workingMemory) select GVAR(currentTarget)) set [11, _windageCur];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-06 18:46:33 +00:00
|
|
|
[] call FUNC(update_gun);
|
|
|
|
[] call FUNC(update_atmosphere);
|
|
|
|
[] call FUNC(update_target);
|