From 5f392e3485f5aa984f4c081bf6c9131c88c93105 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 4 Feb 2017 13:50:52 -0600 Subject: [PATCH] Change aircraft altimiter to show height ASL --- addons/aircraft/CfgEventHandlers.hpp | 5 +++++ addons/aircraft/RscInGameUI.hpp | 7 ++++++ addons/aircraft/XEH_postInit.sqf | 33 ++++++++++++++++++++++++++++ addons/aircraft/config.cpp | 1 + 4 files changed, 46 insertions(+) create mode 100644 addons/aircraft/CfgEventHandlers.hpp create mode 100644 addons/aircraft/XEH_postInit.sqf diff --git a/addons/aircraft/CfgEventHandlers.hpp b/addons/aircraft/CfgEventHandlers.hpp new file mode 100644 index 0000000000..b0cc92b513 --- /dev/null +++ b/addons/aircraft/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/aircraft/RscInGameUI.hpp b/addons/aircraft/RscInGameUI.hpp index 67116a7b62..f02803cae4 100644 --- a/addons/aircraft/RscInGameUI.hpp +++ b/addons/aircraft/RscInGameUI.hpp @@ -10,6 +10,13 @@ class HScrollbar; class RscLadderPicture; class RscControlsGroupNoScrollbars; +class GVAR(aslAltitudeText): RscText { + style = 1; + colorText[] = {"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])", "(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])", "(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])", "(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"}; + sizeEx = "0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; +}; + + class RscInGameUI { class RscUnitInfo; class Rsc_ACE_Helo_UI_Turret: RscUnitInfo { diff --git a/addons/aircraft/XEH_postInit.sqf b/addons/aircraft/XEH_postInit.sqf new file mode 100644 index 0000000000..0efe10d9f2 --- /dev/null +++ b/addons/aircraft/XEH_postInit.sqf @@ -0,0 +1,33 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +["ace_infoDisplayChanged", { + params ["_display", "_type"]; + TRACE_2("ace_infoDisplayChanged",_display,_type); + + if (_type == "Aircraft") then { + if (!(missionNamespace getVariable [QEGVAR(ui,vehicleAltitude), true])) exitWith {TRACE_1("Disabled in ace_ui",EGVAR(ui,vehicleAltitude));}; + [{ + params ["_display"]; + private _oldCtrl = _display displayCtrl 122; + if (isNull _oldCtrl) exitWith {WARNING("old ctrl (122) is null");}; + private _newCtrl = _display ctrlCreate [QGVAR(aslAltitudeText), -1]; + TRACE_2("",_oldCtrl,_newCtrl); + + private _pos = ctrlPosition _oldCtrl; + _newCtrl ctrlSetPosition _pos; + _newCtrl ctrlCommit 0; + + _oldCtrl ctrlSetFade 1; + _oldCtrl ctrlCommit 0; + + [{ + _this ctrlSetText format ["%1", floor ((getPosASL vehicle ACE_player) select 2)]; + isNull _this + }, { + TRACE_2("ctrl deleted",_this,isNull _this); + }, _newCtrl] call CBA_fnc_waitUntilAndExecute; + }, [_display]] call CBA_fnc_execNextFrame; + }; +}] call CBA_fnc_addEventHandler; diff --git a/addons/aircraft/config.cpp b/addons/aircraft/config.cpp index 48bf2c054e..6c08658a7f 100644 --- a/addons/aircraft/config.cpp +++ b/addons/aircraft/config.cpp @@ -17,6 +17,7 @@ class CfgPatches { }; }; +#include "CfgEventHandlers.hpp" #include "CfgAmmo.hpp" #include "CfgMagazines.hpp" #include "CfgVehicles.hpp"