mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
108 lines
3.8 KiB
Plaintext
108 lines
3.8 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Ruthberg
|
|
* Calculates the truing drop and updates the output fields
|
|
*
|
|
* Arguments:
|
|
* parse input <BOOL>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* call ace_atragmx_fnc_calculate_truing_drop
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
private _parseInput = _this;
|
|
|
|
private _transonicRange = GVAR(truingDropRangeData) select 0;
|
|
private _subsonicRange = GVAR(truingDropRangeData) select 1;
|
|
private _transonicDrop = GVAR(truingDropDropData) select 1;
|
|
private _subsonicDrop = GVAR(truingDropDropData) select 2;
|
|
|
|
if (_parseInput) then {
|
|
_transonicRange = 0 max abs(parseNumber(ctrlText 18011)) min 4000;
|
|
_subsonicRange = 0 max abs(parseNumber(ctrlText 18012)) min 4000;
|
|
if (GVAR(currentUnit) != 2) then {
|
|
_transonicRange = _transonicRange * 0.9144;
|
|
_subsonicRange = _subsonicRange * 0.9144;
|
|
};
|
|
_transonicRange = Round(_transonicRange);
|
|
_subsonicRange = Round(_subsonicRange);
|
|
|
|
_subsonicRange = _transonicRange max _subsonicRange;
|
|
|
|
_transonicDrop = -100 max parseNumber(ctrlText 18013) min 100;
|
|
_subsonicDrop = -100 max parseNumber(ctrlText 18014) min 100;
|
|
private _dropUnit = GVAR(currentScopeUnit);
|
|
if (_dropUnit == 3) then {
|
|
switch (GVAR(currentScopeClickUnit)) do {
|
|
case 0: { _dropUnit = 1; };
|
|
case 1: { _dropUnit = 2; };
|
|
case 2: { _dropUnit = 0; };
|
|
};
|
|
};
|
|
switch (_dropUnit) do {
|
|
case 0: {
|
|
_transonicDrop = MRAD_TO_MOA(_transonicDrop);
|
|
_subsonicDrop = MRAD_TO_MOA(_subsonicDrop);
|
|
};
|
|
case 2: {
|
|
_transonicDrop = _transonicDrop / 1.047;
|
|
_subsonicDrop = _subsonicDrop / 1.047;
|
|
};
|
|
};
|
|
_transonicDrop = Round(_transonicDrop * 100) / 100;
|
|
_subsonicDrop = Round(_subsonicDrop * 100) / 100;
|
|
|
|
_subsonicDrop = _transonicDrop max _subsonicDrop;
|
|
};
|
|
|
|
if ((GVAR(truingDropDropData) select 0) == 0 || {!([_transonicRange, _subsonicRange] isEqualTo GVAR(truingDropRangeData))}) then {
|
|
if (isNil QGVAR(targetSolutionInput)) then {
|
|
call FUNC(calculate_target_solution);
|
|
};
|
|
private _solutionInput = +GVAR(targetSolutionInput);
|
|
|
|
if (_transonicRange == 0) then {
|
|
_transonicRange = Round(403 call FUNC(calculate_distance_at_velocity));
|
|
};
|
|
_solutionInput set [13, _transonicRange];
|
|
private _result1 = _solutionInput call FUNC(calculate_solution);
|
|
_transonicDrop = Round((_result1 select 0) * 100) / 100;
|
|
GVAR(truingDropRangeData) set [0, _transonicRange];
|
|
GVAR(truingDropDropData) set [1, _transonicDrop];
|
|
GVAR(truingDropReferenceDropData) set [0, _transonicDrop];
|
|
|
|
private _speedOfSound = (_solutionInput select 5) call EFUNC(weather,calculateSpeedOfSound);
|
|
if (_subsonicRange == 0) then {
|
|
_subsonicRange = _speedOfSound call FUNC(calculate_distance_at_velocity);
|
|
if (GVAR(currentUnit) == 2) then {
|
|
_subsonicRange = _subsonicRange + 200;
|
|
} else {
|
|
_subsonicRange = _subsonicRange + 200 * 1.0936133;
|
|
};
|
|
_subsonicRange = Round(_subsonicRange);
|
|
};
|
|
_solutionInput set [13, _subsonicRange];
|
|
private _result2 = _solutionInput call FUNC(calculate_solution);
|
|
_subsonicDrop = Round((_result2 select 0) * 100) / 100;
|
|
GVAR(truingDropRangeData) set [1, _subsonicRange];
|
|
GVAR(truingDropDropData) set [2, _subsonicDrop];
|
|
GVAR(truingDropReferenceDropData) set [1, _subsonicDrop];
|
|
} else {
|
|
if (_transonicDrop != GVAR(truingDropDropData) select 1 || _subsonicDrop != GVAR(truingDropDropData) select 2) then {
|
|
GVAR(truingDropDropData) set [1, _transonicDrop];
|
|
GVAR(truingDropDropData) set [2, _subsonicDrop];
|
|
if (GVAR(truingDropMode) == 0) then {
|
|
call FUNC(true_muzzle_velocity);
|
|
} else {
|
|
call FUNC(true_c1_ballistic_coefficient);
|
|
};
|
|
};
|
|
};
|
|
|
|
call FUNC(update_truing_drop_data);
|