ACE3/addons/missileguidance/functions/fnc_gps_onLoad.sqf

54 lines
1.7 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
/*
2022-06-03 02:36:46 +00:00
* Author: Dani (TCVM)
* Called on load of GPS UI
*
* Arguments:
* Display <NUMBER>
*
* Return Value:
* None
*
* Example:
* [1] call ace_missileguidance_fnc_gps_onLoad
*
* Public: No
*/
[{
2021-05-02 05:04:08 +00:00
params ["_display"];
uiNamespace setVariable [QGVAR(gpsAttackOptionDisplay), _display];
2021-05-02 05:04:08 +00:00
private _mode = if (GVAR(gps_mode) isEqualTo "too") then {
GPS_UI_TOO
} else {
GPS_UI_PB
};
2021-05-02 05:04:08 +00:00
[_mode, true] call FUNC(gps_modeSelect);
2021-05-02 06:34:45 +00:00
(_display displayCtrl GPS_UI_PB_MISSION) ctrlSetText format ["%1 %2", localize LSTRING(GPS_ui_pp_short), GVAR(gps_pbMode) + 1];
2021-05-02 05:04:08 +00:00
// update current settings
GVAR(gps_uiPerFrameHandler) = [{
if (GVAR(gps_mode) isEqualTo "too") then {
// update coordinates based on TGP position
private _target = getPilotCameraTarget (vehicle ACE_PLAYER);
_target params ["_tracking", "_position", "_object"];
2021-04-19 05:05:56 +00:00
2021-05-02 05:04:08 +00:00
if (_position isNotEqualTo [0, 0, 0]) then {
private _mapGrid = [_position] call EFUNC(common,getMapGridFromPos);
_mapGrid params ["_easting", "_northing"];
private _height = _position#2;
2021-04-19 05:05:56 +00:00
2021-05-02 05:04:08 +00:00
private _display = uiNamespace getVariable QGVAR(gpsAttackOptionDisplay);
(_display displayCtrl GPS_UI_EASTING) ctrlSetText _easting;
(_display displayCtrl GPS_UI_NORTHING) ctrlSetText _northing;
(_display displayCtrl GPS_UI_HEIGHT) ctrlSetText str _height;
};
};
2021-04-19 05:05:56 +00:00
2021-05-02 05:04:08 +00:00
// info is read from text boxes, so if boxes are update this will be updated
GVAR(gps_currentSettings) = [-1] call FUNC(gps_saveAttackSettings);
}] call CBA_fnc_addPerFrameHandler;
}, _this] call CBA_fnc_execNextFrame;