2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-04-11 21:40:46 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Selects a new gun profile and updates the gun column and the result input/output fields
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* gunID <number>
|
2015-04-19 15:40:49 +00:00
|
|
|
* restore workingMemory from gunList <BOOL>
|
|
|
|
* update display <BOOL>
|
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:
|
2016-07-20 04:15:18 +00:00
|
|
|
* call ace_atragmx_fnc_change_gun
|
2015-04-11 21:40:46 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2016-05-03 00:32:44 +00:00
|
|
|
params ["_gunID", "_restoreMemory", "_updateDisplay"];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-17 22:11:53 +00:00
|
|
|
if (_gunID < 0 || _gunID > (count GVAR(gunList)) - 1) exitWith {};
|
|
|
|
|
2015-04-19 15:40:49 +00:00
|
|
|
if (_restoreMemory) then {
|
|
|
|
GVAR(workingMemory) = +(GVAR(gunList) select _gunID);
|
|
|
|
};
|
2015-04-17 22:11:53 +00:00
|
|
|
GVAR(currentGun) = _gunID;
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2016-11-02 12:56:59 +00:00
|
|
|
[false, false] call FUNC(recalculate_muzzle_velocity);
|
|
|
|
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
|
|
|
|
false call FUNC(restore_truing_drop);
|
|
|
|
[false, false] call FUNC(recalculate_c1_ballistic_coefficient);
|
|
|
|
};
|
|
|
|
|
2015-04-19 15:40:49 +00:00
|
|
|
if (_updateDisplay) then {
|
|
|
|
lbSetCurSel [6000, GVAR(currentGun)];
|
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-19 10:07:27 +00:00
|
|
|
GVAR(currentScopeUnit) = 0 max (GVAR(workingMemory) select 6) min 3;
|
|
|
|
GVAR(currentScopeClickUnit) = 0 max (GVAR(workingMemory) select 7) min 2;
|
|
|
|
GVAR(currentScopeClickNumber) = 1 max (GVAR(workingMemory) select 8) min 10;
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-19 15:40:49 +00:00
|
|
|
if (_updateDisplay) then {
|
|
|
|
[] call FUNC(update_gun);
|
|
|
|
[] call FUNC(update_gun_ammo_data);
|
2016-11-02 12:56:59 +00:00
|
|
|
[] call FUNC(update_muzzle_velocity_data);
|
|
|
|
[] call FUNC(update_c1_ballistic_coefficient_data);
|
2015-04-19 15:40:49 +00:00
|
|
|
};
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-08 09:05:28 +00:00
|
|
|
GVAR(elevationOutput) set [GVAR(currentTarget), 0];
|
2015-04-18 13:08:54 +00:00
|
|
|
GVAR(windage1Output) set [GVAR(currentTarget), 0];
|
|
|
|
GVAR(windage2Output) set [GVAR(currentTarget), 0];
|
2015-04-08 09:05:28 +00:00
|
|
|
GVAR(leadOutput) set [GVAR(currentTarget), 0];
|
|
|
|
GVAR(tofOutput) set [GVAR(currentTarget), 0];
|
|
|
|
GVAR(velocityOutput) set [GVAR(currentTarget), 0];
|
2016-11-02 12:56:59 +00:00
|
|
|
GVAR(verticalCoriolisOutput) set [GVAR(currentTarget), 0];
|
|
|
|
GVAR(horizontalCoriolisOutput) set [GVAR(currentTarget), 0];
|
|
|
|
GVAR(spinDriftOutput) set [GVAR(currentTarget), 0];
|
2015-04-06 13:51:59 +00:00
|
|
|
|
2015-04-19 15:40:49 +00:00
|
|
|
if (_updateDisplay) then {
|
2015-04-17 22:11:53 +00:00
|
|
|
[] call FUNC(calculate_target_solution);
|
|
|
|
};
|