From 3f868ac94b7774354e1c70367144a0df526d5291 Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 8 Jun 2019 14:17:24 -0600 Subject: [PATCH 01/18] speed and altitude units --- .../missions/Arsenal.VR/script_component.hpp | 2 +- addons/units/$PBOPREFIX$ | 1 + addons/units/CfgEventHandlers.hpp | 15 ++++++ addons/units/XEH_PREP.hpp | 6 +++ addons/units/XEH_postInit.sqf | 3 ++ addons/units/XEH_preInit.sqf | 11 ++++ addons/units/XEH_preStart.sqf | 2 + addons/units/config.cpp | 51 +++++++++++++++++++ addons/units/functions/fnc_altInfo.sqf | 7 +++ addons/units/functions/fnc_altUnits.sqf | 9 ++++ addons/units/functions/fnc_onAltLoad.sqf | 40 +++++++++++++++ addons/units/functions/fnc_onSpeedLoad.sqf | 33 ++++++++++++ addons/units/functions/fnc_speedInfo.sqf | 9 ++++ addons/units/functions/fnc_speedUnits.sqf | 17 +++++++ addons/units/functions/script_component.hpp | 1 + addons/units/initSettings.sqf | 47 +++++++++++++++++ addons/units/script_component.hpp | 25 +++++++++ addons/units/stringtable.xml | 46 +++++++++++++++++ 18 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 addons/units/$PBOPREFIX$ create mode 100644 addons/units/CfgEventHandlers.hpp create mode 100644 addons/units/XEH_PREP.hpp create mode 100644 addons/units/XEH_postInit.sqf create mode 100644 addons/units/XEH_preInit.sqf create mode 100644 addons/units/XEH_preStart.sqf create mode 100644 addons/units/config.cpp create mode 100644 addons/units/functions/fnc_altInfo.sqf create mode 100644 addons/units/functions/fnc_altUnits.sqf create mode 100644 addons/units/functions/fnc_onAltLoad.sqf create mode 100644 addons/units/functions/fnc_onSpeedLoad.sqf create mode 100644 addons/units/functions/fnc_speedInfo.sqf create mode 100644 addons/units/functions/fnc_speedUnits.sqf create mode 100644 addons/units/functions/script_component.hpp create mode 100644 addons/units/initSettings.sqf create mode 100644 addons/units/script_component.hpp create mode 100644 addons/units/stringtable.xml diff --git a/addons/arsenal/missions/Arsenal.VR/script_component.hpp b/addons/arsenal/missions/Arsenal.VR/script_component.hpp index e1e6528a491..7447e1c87fb 100644 --- a/addons/arsenal/missions/Arsenal.VR/script_component.hpp +++ b/addons/arsenal/missions/Arsenal.VR/script_component.hpp @@ -1,4 +1,4 @@ #include "\z\ace\addons\arsenal\script_component.hpp" -#undef PREP // make.py can't redefine already defined macros +#undef PREP #define PREP(var) FUNC(var) = compileFinal preprocessFileLineNumbers format ["fnc_%1.sqf", QUOTE(var)] diff --git a/addons/units/$PBOPREFIX$ b/addons/units/$PBOPREFIX$ new file mode 100644 index 00000000000..2f43e869a78 --- /dev/null +++ b/addons/units/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\units \ No newline at end of file diff --git a/addons/units/CfgEventHandlers.hpp b/addons/units/CfgEventHandlers.hpp new file mode 100644 index 00000000000..e90bed419e7 --- /dev/null +++ b/addons/units/CfgEventHandlers.hpp @@ -0,0 +1,15 @@ +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/units/XEH_PREP.hpp b/addons/units/XEH_PREP.hpp new file mode 100644 index 00000000000..607ccdb1192 --- /dev/null +++ b/addons/units/XEH_PREP.hpp @@ -0,0 +1,6 @@ +PREP(altInfo); +PREP(altUnits); +PREP(onAltLoad); +PREP(onSpeedLoad); +PREP(speedInfo); +PREP(speedUnits); diff --git a/addons/units/XEH_postInit.sqf b/addons/units/XEH_postInit.sqf new file mode 100644 index 00000000000..022888575ed --- /dev/null +++ b/addons/units/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/units/XEH_preInit.sqf b/addons/units/XEH_preInit.sqf new file mode 100644 index 00000000000..9361d05015e --- /dev/null +++ b/addons/units/XEH_preInit.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP_RECOMPILE_START; +#include "XEH_PREP.hpp" +PREP_RECOMPILE_END; + +#include "initSettings.sqf" + +ADDON = true; diff --git a/addons/units/XEH_preStart.sqf b/addons/units/XEH_preStart.sqf new file mode 100644 index 00000000000..a51262a37b9 --- /dev/null +++ b/addons/units/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/units/config.cpp b/addons/units/config.cpp new file mode 100644 index 00000000000..9d90326d5a9 --- /dev/null +++ b/addons/units/config.cpp @@ -0,0 +1,51 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author = ECSTRING(common,ACETeam); + authors[] = {"SynixeBrett"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +class RscText; +class RscInGameUI { + class RscUnitInfo { + class CA_Alt: RscText { + onLoad = QUOTE(call FUNC(onAltLoad)); + }; + class CA_Speed: RscText { + onLoad = QUOTE(call FUNC(onSpeedLoad)); + }; + }; +}; + +class GVAR(alt): 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])"}; + text = "9999"; + x = "6.3 * (((safezoneW / safezoneH) min 1.2) / 40) + (profilenamespace getvariable [""IGUI_GRID_VEHICLE_X"", (safezoneX + 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])"; + y = "2.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (profilenamespace getvariable [""IGUI_GRID_VEHICLE_Y"", (safezoneY + 0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))])"; + w = "2 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + sizeEx = "0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; +}; + +class GVAR(speed): 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])"}; + text = "9999"; + x = "6.3 * (((safezoneW / safezoneH) min 1.2) / 40) + (profilenamespace getvariable [""IGUI_GRID_VEHICLE_X"", (safezoneX + 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])"; + y = "1.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (profilenamespace getvariable [""IGUI_GRID_VEHICLE_Y"", (safezoneY + 0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))])"; + w = "2 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + sizeEx = "0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; +}; + +#include "CfgEventHandlers.hpp" diff --git a/addons/units/functions/fnc_altInfo.sqf b/addons/units/functions/fnc_altInfo.sqf new file mode 100644 index 00000000000..c402eeb218a --- /dev/null +++ b/addons/units/functions/fnc_altInfo.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit isEqualTo ALT_F) exitWith {["f", 0.3047999902464003]}; + +["m", 1] diff --git a/addons/units/functions/fnc_altUnits.sqf b/addons/units/functions/fnc_altUnits.sqf new file mode 100644 index 00000000000..710b2b86572 --- /dev/null +++ b/addons/units/functions/fnc_altUnits.sqf @@ -0,0 +1,9 @@ +#include "script_component.hpp" + +params ["_vehicle"]; + +if (_vehicle isKindOf "Helicopter") exitWith { + [GVAR(heliAlt), QGVAR(heliAlt)] +}; + +[GVAR(planeAlt), QGVAR(planeAlt)] diff --git a/addons/units/functions/fnc_onAltLoad.sqf b/addons/units/functions/fnc_onAltLoad.sqf new file mode 100644 index 00000000000..85bd16aa6f5 --- /dev/null +++ b/addons/units/functions/fnc_onAltLoad.sqf @@ -0,0 +1,40 @@ +#include "script_component.hpp" + +params ["_ctrl"]; + +private _alt = (ctrlParent _ctrl) ctrlCreate [QGVAR(alt), -1]; + +private _units = (vehicle ace_player) call FUNC(altUnits); +private _altInfo = [_units select 0] call FUNC(altInfo); + +systemChat "alt time"; + +((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); +GVAR(ratio) = _altInfo select 1; + +private _settingEH = ["CBA_SettingChanged", { + params ["_setting", "_value"]; + _thisArgs params ["_settingName", "_alt"]; + if (_setting isEqualTo _settingName) then { + private _altInfo = [_value] call FUNC(altInfo); + ((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); + GVAR(ratio) = _altInfo select 1; + }; +}, [_units select 1, _alt]] call CBA_fnc_addEventHandlerArgs; + +[{ + (_this select 0) params ["_ctrl", "_alt", "_settingEH"]; + if (isNull _ctrl) exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + ["CBA_SettingChanged", _settingEH] call CBA_fnc_removeEventHandler; + }; + _ctrl ctrlSetFade 1; + _ctrl ctrlCommit 0; + private _altValue = (((getPosATL vehicle ace_player) select 2) / GVAR(ratio)); + if (_altValue < 10) then { + _altValue = _altValue toFixed 1; + } else { + _altValue = str round _altValue; + }; + _alt ctrlSetText _altValue; +}, 0, [_ctrl, _alt, _settingEH]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/units/functions/fnc_onSpeedLoad.sqf b/addons/units/functions/fnc_onSpeedLoad.sqf new file mode 100644 index 00000000000..a78e2ab8bd7 --- /dev/null +++ b/addons/units/functions/fnc_onSpeedLoad.sqf @@ -0,0 +1,33 @@ +#include "script_component.hpp" + +params ["_ctrl"]; + +private _speed = (ctrlParent _ctrl) ctrlCreate [QGVAR(speed), -1]; + +private _units = (vehicle ace_player) call FUNC(speedUnits); +private _speedInfo = [_units select 0] call FUNC(speedInfo); + +((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); +GVAR(ratio) = _speedInfo select 1; + +private _settingEH = ["CBA_SettingChanged", { + params ["_setting", "_value"]; + _thisArgs params ["_settingName", "_speed"]; + systemChat format ["%1 = %2", _setting, _value]; + if (_setting isEqualTo _settingName) then { + private _speedInfo = [_value] call FUNC(speedInfo); + ((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); + GVAR(ratio) = _speedInfo select 1; + }; +}, [_units select 1, _speed]] call CBA_fnc_addEventHandlerArgs; + +[{ + (_this select 0) params ["_ctrl", "_speed", "_settingEH"]; + if (isNull _ctrl) exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + ["CBA_SettingChanged", _settingEH] call CBA_fnc_removeEventHandler; + }; + _ctrl ctrlSetFade 1; + _ctrl ctrlCommit 0; + _speed ctrlSetText str (round (speed vehicle ace_player / GVAR(ratio))); +}, 0, [_ctrl, _speed, _settingEH]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/units/functions/fnc_speedInfo.sqf b/addons/units/functions/fnc_speedInfo.sqf new file mode 100644 index 00000000000..698eaf3839e --- /dev/null +++ b/addons/units/functions/fnc_speedInfo.sqf @@ -0,0 +1,9 @@ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit isEqualTo SPEED_MPH) exitWith {[LLSTRING(Speed_MPH), 1.609]}; +if (_unit isEqualTo SPEED_KNOT) exitWith {[LLSTRING(Speed_KNOT), 1.852]}; +if (_unit isEqualTo SPEED_MS) exitWith {[LLSTRING(Speed_MS), 3.6]}; + +[LLSTRING(Speed_KMH), 1] diff --git a/addons/units/functions/fnc_speedUnits.sqf b/addons/units/functions/fnc_speedUnits.sqf new file mode 100644 index 00000000000..cc063e47512 --- /dev/null +++ b/addons/units/functions/fnc_speedUnits.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +params ["_vehicle"]; + +if (_vehicle isKindOf "Helicopter") exitWith { + [GVAR(heliSpeed), QGVAR(heliSpeed)] +}; + +if (_vehicle isKindOf "Plane") exitWith { + [GVAR(planeSpeed), QGVAR(planeSpeed)] +}; + +if (_vehicle isKindOf "Ship") exitWith { + [GVAR(seaSpeed), QGVAR(seaSpeed)] +}; + +[GVAR(landSpeed), QGVAR(landSpeed)] diff --git a/addons/units/functions/script_component.hpp b/addons/units/functions/script_component.hpp new file mode 100644 index 00000000000..20354e9e0f9 --- /dev/null +++ b/addons/units/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\units\script_component.hpp" \ No newline at end of file diff --git a/addons/units/initSettings.sqf b/addons/units/initSettings.sqf new file mode 100644 index 00000000000..1649e183e7f --- /dev/null +++ b/addons/units/initSettings.sqf @@ -0,0 +1,47 @@ +[ + QGVAR(landSpeed), + "LIST", + [localize LSTRING(Speed_DisplayName), localize LSTRING(Speed_Description)], + [format["ACE %1", localize LSTRING(Module_DisplayName)], localize LSTRING(Land_DisplayName)], + [[SPEED_KMH, SPEED_MPH, SPEED_KNOT, SPEED_MS], [LSTRING(Speed_KMH), LSTRING(Speed_MPH), LSTRING(Speed_KNOT), LSTRING(Speed_MS)], 0] +] call CBA_settings_fnc_init; + +[ + QGVAR(seaSpeed), + "LIST", + [localize LSTRING(Speed_DisplayName), localize LSTRING(Speed_Description)], + [format["ACE %1", localize LSTRING(Module_DisplayName)], localize "str_a3_rscdisplaygarage_tab_naval"], + [[SPEED_KMH, SPEED_MPH, SPEED_KNOT, SPEED_MS], [LSTRING(Speed_KMH), LSTRING(Speed_MPH), LSTRING(Speed_KNOT), LSTRING(Speed_MS)], 0] +] call CBA_settings_fnc_init; + +[ + QGVAR(heliSpeed), + "LIST", + [localize LSTRING(Speed_DisplayName), localize LSTRING(Speed_Description)], + [format["ACE %1", localize LSTRING(Module_DisplayName)], localize "STR_A3_TIME_TRIALS_HELI_NAME"], + [[SPEED_KMH, SPEED_MPH, SPEED_KNOT, SPEED_MS], [LSTRING(Speed_KMH), LSTRING(Speed_MPH), LSTRING(Speed_KNOT), LSTRING(Speed_MS)], 0] +] call CBA_settings_fnc_init; + +[ + QGVAR(heliAlt), + "LIST", + [localize LSTRING(Alt_DisplayName), localize LSTRING(Alt_Description)], + [format["ACE %1", localize LSTRING(Module_DisplayName)], localize "STR_A3_TIME_TRIALS_HELI_NAME"], + [[ALT_M, ALT_F], [LSTRING(Alt_M), LSTRING(Alt_F)], 0] +] call CBA_settings_fnc_init; + +[ + QGVAR(planeSpeed), + "LIST", + [localize LSTRING(Speed_DisplayName), localize LSTRING(Speed_Description)], + [format["ACE %1", localize LSTRING(Module_DisplayName)], localize "STR_A3_Showcase_FixedWings_Mission_Name"], + [[SPEED_KMH, SPEED_MPH, SPEED_KNOT, SPEED_MS], [LSTRING(Speed_KMH), LSTRING(Speed_MPH), LSTRING(Speed_KNOT), LSTRING(Speed_MS)], 0] +] call CBA_settings_fnc_init; + +[ + QGVAR(planeAlt), + "LIST", + [localize LSTRING(Alt_DisplayName), localize LSTRING(Alt_Description)], + [format["ACE %1", localize LSTRING(Module_DisplayName)], localize "STR_A3_Showcase_FixedWings_Mission_Name"], + [[ALT_M, ALT_F], [LSTRING(Alt_M), LSTRING(Alt_F)], 0] +] call CBA_settings_fnc_init; diff --git a/addons/units/script_component.hpp b/addons/units/script_component.hpp new file mode 100644 index 00000000000..1e082bd9018 --- /dev/null +++ b/addons/units/script_component.hpp @@ -0,0 +1,25 @@ +#define COMPONENT units +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_UNITS + #define DEBUG_MODE_FULL +#endif + #ifdef DEBUG_SETTINGS_UNITS + #define DEBUG_SETTINGS DEBUG_SETTINGS_UNITS +#endif + +#define SPEED_KMH 0 +#define SPEED_MPH 1 +#define SPEED_KNOT 2 +#define SPEED_MS 3 + +#define ALT_M 0 +#define ALT_F 1 + +#define MODE_ATL 0 +#define MODE_ASL 1 + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/units/stringtable.xml b/addons/units/stringtable.xml new file mode 100644 index 00000000000..771575d0aba --- /dev/null +++ b/addons/units/stringtable.xml @@ -0,0 +1,46 @@ + + + + + Units + + + + Speed + + + Units used to display Speed + + + + Altitude + + + Units used to display Altitude + + + + Land Vehicles + + + + km/h + + + mph + + + kn + + + m/s + + + + Meters + + + Feet + + + From 191031d9941cf48d2f4271b865f89e9be2f7bd84 Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 8 Jun 2019 14:20:51 -0600 Subject: [PATCH 02/18] change ratio variable --- addons/units/functions/fnc_onAltLoad.sqf | 6 +++--- addons/units/functions/fnc_onSpeedLoad.sqf | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/units/functions/fnc_onAltLoad.sqf b/addons/units/functions/fnc_onAltLoad.sqf index 85bd16aa6f5..bce2b5010c4 100644 --- a/addons/units/functions/fnc_onAltLoad.sqf +++ b/addons/units/functions/fnc_onAltLoad.sqf @@ -10,7 +10,7 @@ private _altInfo = [_units select 0] call FUNC(altInfo); systemChat "alt time"; ((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); -GVAR(ratio) = _altInfo select 1; +GVAR(altRatio) = _altInfo select 1; private _settingEH = ["CBA_SettingChanged", { params ["_setting", "_value"]; @@ -18,7 +18,7 @@ private _settingEH = ["CBA_SettingChanged", { if (_setting isEqualTo _settingName) then { private _altInfo = [_value] call FUNC(altInfo); ((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); - GVAR(ratio) = _altInfo select 1; + GVAR(altRatio) = _altInfo select 1; }; }, [_units select 1, _alt]] call CBA_fnc_addEventHandlerArgs; @@ -30,7 +30,7 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - private _altValue = (((getPosATL vehicle ace_player) select 2) / GVAR(ratio)); + private _altValue = (((getPosATL vehicle ace_player) select 2) / GVAR(altRatio)); if (_altValue < 10) then { _altValue = _altValue toFixed 1; } else { diff --git a/addons/units/functions/fnc_onSpeedLoad.sqf b/addons/units/functions/fnc_onSpeedLoad.sqf index a78e2ab8bd7..6e9807a6f2d 100644 --- a/addons/units/functions/fnc_onSpeedLoad.sqf +++ b/addons/units/functions/fnc_onSpeedLoad.sqf @@ -8,7 +8,7 @@ private _units = (vehicle ace_player) call FUNC(speedUnits); private _speedInfo = [_units select 0] call FUNC(speedInfo); ((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); -GVAR(ratio) = _speedInfo select 1; +GVAR(speedRatio) = _speedInfo select 1; private _settingEH = ["CBA_SettingChanged", { params ["_setting", "_value"]; @@ -17,7 +17,7 @@ private _settingEH = ["CBA_SettingChanged", { if (_setting isEqualTo _settingName) then { private _speedInfo = [_value] call FUNC(speedInfo); ((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); - GVAR(ratio) = _speedInfo select 1; + GVAR(speedRatio) = _speedInfo select 1; }; }, [_units select 1, _speed]] call CBA_fnc_addEventHandlerArgs; @@ -29,5 +29,5 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - _speed ctrlSetText str (round (speed vehicle ace_player / GVAR(ratio))); + _speed ctrlSetText str (round (speed vehicle ace_player / GVAR(speedRatio))); }, 0, [_ctrl, _speed, _settingEH]] call CBA_fnc_addPerFrameHandler; From 9050f274b7547c952a696736202c38c3dedcb790 Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 8 Jun 2019 14:23:28 -0600 Subject: [PATCH 03/18] remove missied systemChat --- addons/units/functions/fnc_onSpeedLoad.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/units/functions/fnc_onSpeedLoad.sqf b/addons/units/functions/fnc_onSpeedLoad.sqf index 6e9807a6f2d..2f903d59baf 100644 --- a/addons/units/functions/fnc_onSpeedLoad.sqf +++ b/addons/units/functions/fnc_onSpeedLoad.sqf @@ -13,7 +13,6 @@ GVAR(speedRatio) = _speedInfo select 1; private _settingEH = ["CBA_SettingChanged", { params ["_setting", "_value"]; _thisArgs params ["_settingName", "_speed"]; - systemChat format ["%1 = %2", _setting, _value]; if (_setting isEqualTo _settingName) then { private _speedInfo = [_value] call FUNC(speedInfo); ((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); From 9bb5e5daf4a057566e66b00637825d90059ce374 Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 9 Jun 2019 01:56:22 -0600 Subject: [PATCH 04/18] missed systemChat --- addons/units/functions/fnc_onAltLoad.sqf | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/units/functions/fnc_onAltLoad.sqf b/addons/units/functions/fnc_onAltLoad.sqf index bce2b5010c4..b2113826da6 100644 --- a/addons/units/functions/fnc_onAltLoad.sqf +++ b/addons/units/functions/fnc_onAltLoad.sqf @@ -7,8 +7,6 @@ private _alt = (ctrlParent _ctrl) ctrlCreate [QGVAR(alt), -1]; private _units = (vehicle ace_player) call FUNC(altUnits); private _altInfo = [_units select 0] call FUNC(altInfo); -systemChat "alt time"; - ((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); GVAR(altRatio) = _altInfo select 1; From 438941ff0e2f94d7fe263ebc4f66f0a7d4b0db08 Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 9 Jun 2019 02:04:43 -0600 Subject: [PATCH 05/18] some commy suggestions --- addons/units/functions/fnc_onAltLoad.sqf | 2 +- addons/units/functions/fnc_onSpeedLoad.sqf | 2 +- addons/units/stringtable.xml | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/units/functions/fnc_onAltLoad.sqf b/addons/units/functions/fnc_onAltLoad.sqf index b2113826da6..d3e659cb7ba 100644 --- a/addons/units/functions/fnc_onAltLoad.sqf +++ b/addons/units/functions/fnc_onAltLoad.sqf @@ -32,7 +32,7 @@ private _settingEH = ["CBA_SettingChanged", { if (_altValue < 10) then { _altValue = _altValue toFixed 1; } else { - _altValue = str round _altValue; + _altValue = _altValue toFixed 0; }; _alt ctrlSetText _altValue; }, 0, [_ctrl, _alt, _settingEH]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/units/functions/fnc_onSpeedLoad.sqf b/addons/units/functions/fnc_onSpeedLoad.sqf index 2f903d59baf..f9ba3572c8c 100644 --- a/addons/units/functions/fnc_onSpeedLoad.sqf +++ b/addons/units/functions/fnc_onSpeedLoad.sqf @@ -28,5 +28,5 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - _speed ctrlSetText str (round (speed vehicle ace_player / GVAR(speedRatio))); + _speed ctrlSetText ((speed vehicle ace_player / GVAR(speedRatio)) toFixed 0); }, 0, [_ctrl, _speed, _settingEH]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/units/stringtable.xml b/addons/units/stringtable.xml index 771575d0aba..956ea31e147 100644 --- a/addons/units/stringtable.xml +++ b/addons/units/stringtable.xml @@ -3,44 +3,56 @@ Units + Maßeinheiten Speed + Geschwindigkeit - Units used to display Speed + Units used to display Speed. + Maßeinheit, um Geschwindigkeit darzustellen. Altitude + Flughöhe - Units used to display Altitude + Units used to display Altitude. + Maßeinheit, um Flughöhe darzustellen. Land Vehicles + Bodenfahrzeuge km/h + km/h mph + mph kn + kn m/s + m/s Meters + Meter Feet + Fuß From cd6797894e2732e96bc01a5d682dea8e7b2a663a Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 9 Jun 2019 02:19:54 -0600 Subject: [PATCH 06/18] more suggestions --- addons/units/CfgEventHandlers.hpp | 2 ++ addons/units/config.cpp | 25 +++++++++++----------- addons/units/functions/fnc_onAltLoad.sqf | 6 +++--- addons/units/functions/fnc_onSpeedLoad.sqf | 6 +++--- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/addons/units/CfgEventHandlers.hpp b/addons/units/CfgEventHandlers.hpp index e90bed419e7..0d3301d6e0a 100644 --- a/addons/units/CfgEventHandlers.hpp +++ b/addons/units/CfgEventHandlers.hpp @@ -3,11 +3,13 @@ class Extended_PreStart_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_preStart)); }; }; + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; + class Extended_PostInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_postInit)); diff --git a/addons/units/config.cpp b/addons/units/config.cpp index 9d90326d5a9..5b257acaf37 100644 --- a/addons/units/config.cpp +++ b/addons/units/config.cpp @@ -1,4 +1,5 @@ #include "script_component.hpp" +#include "\a3\ui_f\hpp\defineCommonGrids.inc" class CfgPatches { class ADDON { @@ -28,24 +29,24 @@ class RscInGameUI { class GVAR(alt): 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])"}; + 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])"}; text = "9999"; - x = "6.3 * (((safezoneW / safezoneH) min 1.2) / 40) + (profilenamespace getvariable [""IGUI_GRID_VEHICLE_X"", (safezoneX + 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])"; - y = "2.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (profilenamespace getvariable [""IGUI_GRID_VEHICLE_Y"", (safezoneY + 0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))])"; - w = "2 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - sizeEx = "0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + x = 6.3 * GUI_GRID_W + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_X", (safezoneX + 0.5 * GUI_GRID_W)]); + y = 2.3 * GUI_GRID_H + (profileNamespace getVariable [""IGUI_GRID_VEHICLE_Y"", (safezoneY + 0.5 * GUI_GRID_H)]); + w = 2 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + sizeEx = 0.8 * GUI_GRID_H; }; class GVAR(speed): 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])"}; + 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])"}; text = "9999"; - x = "6.3 * (((safezoneW / safezoneH) min 1.2) / 40) + (profilenamespace getvariable [""IGUI_GRID_VEHICLE_X"", (safezoneX + 0.5 * (((safezoneW / safezoneH) min 1.2) / 40))])"; - y = "1.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (profilenamespace getvariable [""IGUI_GRID_VEHICLE_Y"", (safezoneY + 0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))])"; - w = "2 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - sizeEx = "0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + x = 6.3 * GUI_GRID_W + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_X", (safezoneX + 0.5 * GUI_GRID_W)]); + y = 1.3 * GUI_GRID_H + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_Y", (safezoneY + 0.5 * GUI_GRID_H)]); + w = 2 * GUI_GRID_W; + h = 1 * GUI_GRID_H; + sizeEx = 0.8 * GUI_GRID_H; }; #include "CfgEventHandlers.hpp" diff --git a/addons/units/functions/fnc_onAltLoad.sqf b/addons/units/functions/fnc_onAltLoad.sqf index d3e659cb7ba..9b12ee9b7f0 100644 --- a/addons/units/functions/fnc_onAltLoad.sqf +++ b/addons/units/functions/fnc_onAltLoad.sqf @@ -4,8 +4,8 @@ params ["_ctrl"]; private _alt = (ctrlParent _ctrl) ctrlCreate [QGVAR(alt), -1]; -private _units = (vehicle ace_player) call FUNC(altUnits); -private _altInfo = [_units select 0] call FUNC(altInfo); +private _units = (vehicle ACE_player) call FUNC(altUnits); +private _altInfo = _units call FUNC(altInfo); ((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); GVAR(altRatio) = _altInfo select 1; @@ -28,7 +28,7 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - private _altValue = (((getPosATL vehicle ace_player) select 2) / GVAR(altRatio)); + private _altValue = (((getPosATL vehicle ACE_player) select 2) / GVAR(altRatio)); if (_altValue < 10) then { _altValue = _altValue toFixed 1; } else { diff --git a/addons/units/functions/fnc_onSpeedLoad.sqf b/addons/units/functions/fnc_onSpeedLoad.sqf index f9ba3572c8c..b87b7b19756 100644 --- a/addons/units/functions/fnc_onSpeedLoad.sqf +++ b/addons/units/functions/fnc_onSpeedLoad.sqf @@ -4,8 +4,8 @@ params ["_ctrl"]; private _speed = (ctrlParent _ctrl) ctrlCreate [QGVAR(speed), -1]; -private _units = (vehicle ace_player) call FUNC(speedUnits); -private _speedInfo = [_units select 0] call FUNC(speedInfo); +private _units = (vehicle ACE_player) call FUNC(speedUnits); +private _speedInfo = _units call FUNC(speedInfo); ((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); GVAR(speedRatio) = _speedInfo select 1; @@ -28,5 +28,5 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - _speed ctrlSetText ((speed vehicle ace_player / GVAR(speedRatio)) toFixed 0); + _speed ctrlSetText ((speed vehicle ACE_player / GVAR(speedRatio)) toFixed 0); }, 0, [_ctrl, _speed, _settingEH]] call CBA_fnc_addPerFrameHandler; From 899d2af590b5b4495a9d99a1ba3a654905429286 Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 11 Jun 2019 23:11:02 -0600 Subject: [PATCH 07/18] suggested changes and missed quote --- .../arsenal/missions/Arsenal.VR/script_component.hpp | 1 + addons/units/config.cpp | 2 +- addons/units/functions/fnc_altInfo.sqf | 2 +- addons/units/functions/fnc_onAltLoad.sqf | 12 ++++++------ addons/units/functions/fnc_onSpeedLoad.sqf | 12 ++++++------ addons/units/functions/fnc_speedInfo.sqf | 6 +++--- addons/units/script_component.hpp | 6 ++++++ 7 files changed, 24 insertions(+), 17 deletions(-) diff --git a/addons/arsenal/missions/Arsenal.VR/script_component.hpp b/addons/arsenal/missions/Arsenal.VR/script_component.hpp index 7447e1c87fb..5053d168dd4 100644 --- a/addons/arsenal/missions/Arsenal.VR/script_component.hpp +++ b/addons/arsenal/missions/Arsenal.VR/script_component.hpp @@ -1,4 +1,5 @@ #include "\z\ace\addons\arsenal\script_component.hpp" +// make.py can't redefine already defined macros #undef PREP #define PREP(var) FUNC(var) = compileFinal preprocessFileLineNumbers format ["fnc_%1.sqf", QUOTE(var)] diff --git a/addons/units/config.cpp b/addons/units/config.cpp index 5b257acaf37..54792709f46 100644 --- a/addons/units/config.cpp +++ b/addons/units/config.cpp @@ -32,7 +32,7 @@ class GVAR(alt): RscText { 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])"}; text = "9999"; x = 6.3 * GUI_GRID_W + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_X", (safezoneX + 0.5 * GUI_GRID_W)]); - y = 2.3 * GUI_GRID_H + (profileNamespace getVariable [""IGUI_GRID_VEHICLE_Y"", (safezoneY + 0.5 * GUI_GRID_H)]); + y = 2.3 * GUI_GRID_H + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_Y", (safezoneY + 0.5 * GUI_GRID_H)]); w = 2 * GUI_GRID_W; h = 1 * GUI_GRID_H; sizeEx = 0.8 * GUI_GRID_H; diff --git a/addons/units/functions/fnc_altInfo.sqf b/addons/units/functions/fnc_altInfo.sqf index c402eeb218a..2a5aa54b3d6 100644 --- a/addons/units/functions/fnc_altInfo.sqf +++ b/addons/units/functions/fnc_altInfo.sqf @@ -2,6 +2,6 @@ params ["_unit"]; -if (_unit isEqualTo ALT_F) exitWith {["f", 0.3047999902464003]}; +if (_unit isEqualTo ALT_F) exitWith {["f", METERS_TO_FEET]}; ["m", 1] diff --git a/addons/units/functions/fnc_onAltLoad.sqf b/addons/units/functions/fnc_onAltLoad.sqf index 9b12ee9b7f0..0c5a75377a5 100644 --- a/addons/units/functions/fnc_onAltLoad.sqf +++ b/addons/units/functions/fnc_onAltLoad.sqf @@ -5,18 +5,18 @@ params ["_ctrl"]; private _alt = (ctrlParent _ctrl) ctrlCreate [QGVAR(alt), -1]; private _units = (vehicle ACE_player) call FUNC(altUnits); -private _altInfo = _units call FUNC(altInfo); +_units call FUNC(altInfo) params ["_unitText", "_ratio"]; -((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); -GVAR(altRatio) = _altInfo select 1; +((ctrlParent _alt) displayCtrl 1005) ctrlSetText _unitText; +GVAR(altRatio) = _ratio; private _settingEH = ["CBA_SettingChanged", { params ["_setting", "_value"]; _thisArgs params ["_settingName", "_alt"]; if (_setting isEqualTo _settingName) then { - private _altInfo = [_value] call FUNC(altInfo); - ((ctrlParent _alt) displayCtrl 1005) ctrlSetText (_altInfo select 0); - GVAR(altRatio) = _altInfo select 1; + [_value] call FUNC(altInfo) params ["_unitText", "_ratio"]; + ((ctrlParent _alt) displayCtrl 1005) ctrlSetText _unitText; + GVAR(altRatio) = _ratio; }; }, [_units select 1, _alt]] call CBA_fnc_addEventHandlerArgs; diff --git a/addons/units/functions/fnc_onSpeedLoad.sqf b/addons/units/functions/fnc_onSpeedLoad.sqf index b87b7b19756..f2094bca23f 100644 --- a/addons/units/functions/fnc_onSpeedLoad.sqf +++ b/addons/units/functions/fnc_onSpeedLoad.sqf @@ -5,18 +5,18 @@ params ["_ctrl"]; private _speed = (ctrlParent _ctrl) ctrlCreate [QGVAR(speed), -1]; private _units = (vehicle ACE_player) call FUNC(speedUnits); -private _speedInfo = _units call FUNC(speedInfo); +_units call FUNC(speedInfo) params ["_unitText", "_ratio"]; -((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); -GVAR(speedRatio) = _speedInfo select 1; +((ctrlParent _speed) displayCtrl 1004) ctrlSetText _unitText; +GVAR(speedRatio) = _ratio; private _settingEH = ["CBA_SettingChanged", { params ["_setting", "_value"]; _thisArgs params ["_settingName", "_speed"]; if (_setting isEqualTo _settingName) then { - private _speedInfo = [_value] call FUNC(speedInfo); - ((ctrlParent _speed) displayCtrl 1004) ctrlSetText (_speedInfo select 0); - GVAR(speedRatio) = _speedInfo select 1; + [_value] call FUNC(speedInfo) params ["_unitText", "_ratio"]; + ((ctrlParent _speed) displayCtrl 1004) ctrlSetText _unitText; + GVAR(speedRatio) = _ratio; }; }, [_units select 1, _speed]] call CBA_fnc_addEventHandlerArgs; diff --git a/addons/units/functions/fnc_speedInfo.sqf b/addons/units/functions/fnc_speedInfo.sqf index 698eaf3839e..91744043f32 100644 --- a/addons/units/functions/fnc_speedInfo.sqf +++ b/addons/units/functions/fnc_speedInfo.sqf @@ -2,8 +2,8 @@ params ["_unit"]; -if (_unit isEqualTo SPEED_MPH) exitWith {[LLSTRING(Speed_MPH), 1.609]}; -if (_unit isEqualTo SPEED_KNOT) exitWith {[LLSTRING(Speed_KNOT), 1.852]}; -if (_unit isEqualTo SPEED_MS) exitWith {[LLSTRING(Speed_MS), 3.6]}; +if (_unit isEqualTo SPEED_MPH) exitWith {[LLSTRING(Speed_MPH), KMH_TO_MPH]}; +if (_unit isEqualTo SPEED_KNOT) exitWith {[LLSTRING(Speed_KNOT), KMH_TO_KNOT]}; +if (_unit isEqualTo SPEED_MS) exitWith {[LLSTRING(Speed_MS), KMH_TO_MS]}; [LLSTRING(Speed_KMH), 1] diff --git a/addons/units/script_component.hpp b/addons/units/script_component.hpp index 1e082bd9018..e238b9480ee 100644 --- a/addons/units/script_component.hpp +++ b/addons/units/script_component.hpp @@ -16,9 +16,15 @@ #define SPEED_KNOT 2 #define SPEED_MS 3 +#define KMH_TO_MPH 1.609 +#define KMH_TO_KNOT 1.852 +#define KMH_TO_MS 3.6 + #define ALT_M 0 #define ALT_F 1 +#define METERS_TO_FEET 0.3047999902464003 + #define MODE_ATL 0 #define MODE_ASL 1 From 2bdc558c92ff2698a6ac73e797636f7606036a3e Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 5 Jul 2019 13:27:44 -0600 Subject: [PATCH 08/18] move to ui_units --- addons/{units => ui_units}/$PBOPREFIX$ | 0 addons/{units => ui_units}/CfgEventHandlers.hpp | 0 addons/{units => ui_units}/XEH_PREP.hpp | 0 addons/{units => ui_units}/XEH_postInit.sqf | 0 addons/{units => ui_units}/XEH_preInit.sqf | 0 addons/{units => ui_units}/XEH_preStart.sqf | 0 addons/{units => ui_units}/config.cpp | 0 addons/{units => ui_units}/functions/fnc_altInfo.sqf | 0 addons/{units => ui_units}/functions/fnc_altUnits.sqf | 0 addons/{units => ui_units}/functions/fnc_onAltLoad.sqf | 0 addons/{units => ui_units}/functions/fnc_onSpeedLoad.sqf | 0 addons/{units => ui_units}/functions/fnc_speedInfo.sqf | 0 addons/{units => ui_units}/functions/fnc_speedUnits.sqf | 0 addons/{units => ui_units}/functions/script_component.hpp | 0 addons/{units => ui_units}/initSettings.sqf | 0 addons/{units => ui_units}/script_component.hpp | 0 addons/{units => ui_units}/stringtable.xml | 0 17 files changed, 0 insertions(+), 0 deletions(-) rename addons/{units => ui_units}/$PBOPREFIX$ (100%) rename addons/{units => ui_units}/CfgEventHandlers.hpp (100%) rename addons/{units => ui_units}/XEH_PREP.hpp (100%) rename addons/{units => ui_units}/XEH_postInit.sqf (100%) rename addons/{units => ui_units}/XEH_preInit.sqf (100%) rename addons/{units => ui_units}/XEH_preStart.sqf (100%) rename addons/{units => ui_units}/config.cpp (100%) rename addons/{units => ui_units}/functions/fnc_altInfo.sqf (100%) rename addons/{units => ui_units}/functions/fnc_altUnits.sqf (100%) rename addons/{units => ui_units}/functions/fnc_onAltLoad.sqf (100%) rename addons/{units => ui_units}/functions/fnc_onSpeedLoad.sqf (100%) rename addons/{units => ui_units}/functions/fnc_speedInfo.sqf (100%) rename addons/{units => ui_units}/functions/fnc_speedUnits.sqf (100%) rename addons/{units => ui_units}/functions/script_component.hpp (100%) rename addons/{units => ui_units}/initSettings.sqf (100%) rename addons/{units => ui_units}/script_component.hpp (100%) rename addons/{units => ui_units}/stringtable.xml (100%) diff --git a/addons/units/$PBOPREFIX$ b/addons/ui_units/$PBOPREFIX$ similarity index 100% rename from addons/units/$PBOPREFIX$ rename to addons/ui_units/$PBOPREFIX$ diff --git a/addons/units/CfgEventHandlers.hpp b/addons/ui_units/CfgEventHandlers.hpp similarity index 100% rename from addons/units/CfgEventHandlers.hpp rename to addons/ui_units/CfgEventHandlers.hpp diff --git a/addons/units/XEH_PREP.hpp b/addons/ui_units/XEH_PREP.hpp similarity index 100% rename from addons/units/XEH_PREP.hpp rename to addons/ui_units/XEH_PREP.hpp diff --git a/addons/units/XEH_postInit.sqf b/addons/ui_units/XEH_postInit.sqf similarity index 100% rename from addons/units/XEH_postInit.sqf rename to addons/ui_units/XEH_postInit.sqf diff --git a/addons/units/XEH_preInit.sqf b/addons/ui_units/XEH_preInit.sqf similarity index 100% rename from addons/units/XEH_preInit.sqf rename to addons/ui_units/XEH_preInit.sqf diff --git a/addons/units/XEH_preStart.sqf b/addons/ui_units/XEH_preStart.sqf similarity index 100% rename from addons/units/XEH_preStart.sqf rename to addons/ui_units/XEH_preStart.sqf diff --git a/addons/units/config.cpp b/addons/ui_units/config.cpp similarity index 100% rename from addons/units/config.cpp rename to addons/ui_units/config.cpp diff --git a/addons/units/functions/fnc_altInfo.sqf b/addons/ui_units/functions/fnc_altInfo.sqf similarity index 100% rename from addons/units/functions/fnc_altInfo.sqf rename to addons/ui_units/functions/fnc_altInfo.sqf diff --git a/addons/units/functions/fnc_altUnits.sqf b/addons/ui_units/functions/fnc_altUnits.sqf similarity index 100% rename from addons/units/functions/fnc_altUnits.sqf rename to addons/ui_units/functions/fnc_altUnits.sqf diff --git a/addons/units/functions/fnc_onAltLoad.sqf b/addons/ui_units/functions/fnc_onAltLoad.sqf similarity index 100% rename from addons/units/functions/fnc_onAltLoad.sqf rename to addons/ui_units/functions/fnc_onAltLoad.sqf diff --git a/addons/units/functions/fnc_onSpeedLoad.sqf b/addons/ui_units/functions/fnc_onSpeedLoad.sqf similarity index 100% rename from addons/units/functions/fnc_onSpeedLoad.sqf rename to addons/ui_units/functions/fnc_onSpeedLoad.sqf diff --git a/addons/units/functions/fnc_speedInfo.sqf b/addons/ui_units/functions/fnc_speedInfo.sqf similarity index 100% rename from addons/units/functions/fnc_speedInfo.sqf rename to addons/ui_units/functions/fnc_speedInfo.sqf diff --git a/addons/units/functions/fnc_speedUnits.sqf b/addons/ui_units/functions/fnc_speedUnits.sqf similarity index 100% rename from addons/units/functions/fnc_speedUnits.sqf rename to addons/ui_units/functions/fnc_speedUnits.sqf diff --git a/addons/units/functions/script_component.hpp b/addons/ui_units/functions/script_component.hpp similarity index 100% rename from addons/units/functions/script_component.hpp rename to addons/ui_units/functions/script_component.hpp diff --git a/addons/units/initSettings.sqf b/addons/ui_units/initSettings.sqf similarity index 100% rename from addons/units/initSettings.sqf rename to addons/ui_units/initSettings.sqf diff --git a/addons/units/script_component.hpp b/addons/ui_units/script_component.hpp similarity index 100% rename from addons/units/script_component.hpp rename to addons/ui_units/script_component.hpp diff --git a/addons/units/stringtable.xml b/addons/ui_units/stringtable.xml similarity index 100% rename from addons/units/stringtable.xml rename to addons/ui_units/stringtable.xml From 8f7523153cec941f4a65f1b8729e85c691e69572 Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 5 Jul 2019 13:29:42 -0600 Subject: [PATCH 09/18] change prefix in code --- addons/ui_units/$PBOPREFIX$ | 2 +- addons/ui_units/script_component.hpp | 8 ++++---- addons/ui_units/stringtable.xml | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/addons/ui_units/$PBOPREFIX$ b/addons/ui_units/$PBOPREFIX$ index 2f43e869a78..b93deea9f45 100644 --- a/addons/ui_units/$PBOPREFIX$ +++ b/addons/ui_units/$PBOPREFIX$ @@ -1 +1 @@ -z\ace\addons\units \ No newline at end of file +z\ace\addons\ui_units diff --git a/addons/ui_units/script_component.hpp b/addons/ui_units/script_component.hpp index e238b9480ee..ae1f4abf06a 100644 --- a/addons/ui_units/script_component.hpp +++ b/addons/ui_units/script_component.hpp @@ -1,14 +1,14 @@ -#define COMPONENT units +#define COMPONENT ui_units #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE -#ifdef DEBUG_ENABLED_UNITS +#ifdef DEBUG_ENABLED_UI_UNITS #define DEBUG_MODE_FULL #endif - #ifdef DEBUG_SETTINGS_UNITS - #define DEBUG_SETTINGS DEBUG_SETTINGS_UNITS + #ifdef DEBUG_SETTINGS_UI_UNITS + #define DEBUG_SETTINGS DEBUG_SETTINGS_UI_UNITS #endif #define SPEED_KMH 0 diff --git a/addons/ui_units/stringtable.xml b/addons/ui_units/stringtable.xml index 956ea31e147..add4f44df54 100644 --- a/addons/ui_units/stringtable.xml +++ b/addons/ui_units/stringtable.xml @@ -1,56 +1,56 @@ - + Units Maßeinheiten - + Speed Geschwindigkeit - + Units used to display Speed. Maßeinheit, um Geschwindigkeit darzustellen. - + Altitude Flughöhe - + Units used to display Altitude. Maßeinheit, um Flughöhe darzustellen. - + Land Vehicles Bodenfahrzeuge - + km/h km/h - + mph mph - + kn kn - + m/s m/s - + Meters Meter - + Feet Fuß From 400103d1dee8f58feeca45a398216f76a2a686ed Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 5 Jul 2019 13:33:07 -0600 Subject: [PATCH 10/18] fix capitalization --- addons/ui_units/stringtable.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/ui_units/stringtable.xml b/addons/ui_units/stringtable.xml index add4f44df54..ed50c84b02f 100644 --- a/addons/ui_units/stringtable.xml +++ b/addons/ui_units/stringtable.xml @@ -1,56 +1,56 @@ - + Units Maßeinheiten - + Speed Geschwindigkeit - + Units used to display Speed. Maßeinheit, um Geschwindigkeit darzustellen. - + Altitude Flughöhe - + Units used to display Altitude. Maßeinheit, um Flughöhe darzustellen. - + Land Vehicles Bodenfahrzeuge - + km/h km/h - + mph mph - + kn kn - + m/s m/s - + Meters Meter - + Feet Fuß From 35c82f2bceff49bfe5a5c391682c9b7911de366a Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 13 Jul 2019 18:55:33 -0600 Subject: [PATCH 11/18] final fixes, works over water now --- addons/ui_units/functions/fnc_onAltLoad.sqf | 4 +++- addons/ui_units/functions/fnc_onSpeedLoad.sqf | 2 +- addons/ui_units/functions/script_component.hpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/ui_units/functions/fnc_onAltLoad.sqf b/addons/ui_units/functions/fnc_onAltLoad.sqf index 0c5a75377a5..bd388dd3c74 100644 --- a/addons/ui_units/functions/fnc_onAltLoad.sqf +++ b/addons/ui_units/functions/fnc_onAltLoad.sqf @@ -28,7 +28,9 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - private _altValue = (((getPosATL vehicle ACE_player) select 2) / GVAR(altRatio)); + private _vehicle = vehicle ACE_player; + private _rawAlt = ((getPosATL _vehicle) select 2) + (0 min (getTerrainHeightASL getPos _vehicle)); + private _altValue = _rawAlt / GVAR(altRatio); if (_altValue < 10) then { _altValue = _altValue toFixed 1; } else { diff --git a/addons/ui_units/functions/fnc_onSpeedLoad.sqf b/addons/ui_units/functions/fnc_onSpeedLoad.sqf index f2094bca23f..95a148d7b32 100644 --- a/addons/ui_units/functions/fnc_onSpeedLoad.sqf +++ b/addons/ui_units/functions/fnc_onSpeedLoad.sqf @@ -28,5 +28,5 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - _speed ctrlSetText ((speed vehicle ACE_player / GVAR(speedRatio)) toFixed 0); + _speed ctrlSetText ((abs (speed vehicle ACE_player / GVAR(speedRatio))) toFixed 0); }, 0, [_ctrl, _speed, _settingEH]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/ui_units/functions/script_component.hpp b/addons/ui_units/functions/script_component.hpp index 20354e9e0f9..b9c73dea0fe 100644 --- a/addons/ui_units/functions/script_component.hpp +++ b/addons/ui_units/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\units\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\ui_units\script_component.hpp" From 292ba02439f52bbcc7d8a174e747426c88326010 Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 9 Jul 2019 07:39:29 -0600 Subject: [PATCH 12/18] Update addons/ui_units/config.cpp Co-Authored-By: Dedmen Miller --- addons/ui_units/config.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/ui_units/config.cpp b/addons/ui_units/config.cpp index 54792709f46..a82f7448ae2 100644 --- a/addons/ui_units/config.cpp +++ b/addons/ui_units/config.cpp @@ -29,7 +29,12 @@ class RscInGameUI { class GVAR(alt): 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])"}; + 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])" + }; text = "9999"; x = 6.3 * GUI_GRID_W + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_X", (safezoneX + 0.5 * GUI_GRID_W)]); y = 2.3 * GUI_GRID_H + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_Y", (safezoneY + 0.5 * GUI_GRID_H)]); From 3088e0455bc9b910130e6fd241d8c72080c1855e Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 13 Jul 2019 18:58:29 -0600 Subject: [PATCH 13/18] match dedmen's suggested change --- addons/ui_units/config.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/ui_units/config.cpp b/addons/ui_units/config.cpp index a82f7448ae2..ae52cc8fa01 100644 --- a/addons/ui_units/config.cpp +++ b/addons/ui_units/config.cpp @@ -45,7 +45,12 @@ class GVAR(alt): RscText { class GVAR(speed): 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])"}; + 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])" + }; text = "9999"; x = 6.3 * GUI_GRID_W + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_X", (safezoneX + 0.5 * GUI_GRID_W)]); y = 1.3 * GUI_GRID_H + (profileNamespace getVariable ["IGUI_GRID_VEHICLE_Y", (safezoneY + 0.5 * GUI_GRID_H)]); From 62ed33c659a5b030e3e73aec429f444a6ba85d64 Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 13 Jul 2019 19:00:40 -0600 Subject: [PATCH 14/18] fix german translation indent --- addons/ui_units/stringtable.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/ui_units/stringtable.xml b/addons/ui_units/stringtable.xml index ed50c84b02f..a6374c59267 100644 --- a/addons/ui_units/stringtable.xml +++ b/addons/ui_units/stringtable.xml @@ -35,7 +35,7 @@ mph - mph + mph kn @@ -43,7 +43,7 @@ m/s - m/s + m/s From 49c89165733043c03ed3406e272de7d4ab99d526 Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 20 Aug 2019 20:46:50 -0600 Subject: [PATCH 15/18] use cameraon --- addons/ui_units/functions/fnc_onAltLoad.sqf | 4 ++-- addons/ui_units/functions/fnc_onSpeedLoad.sqf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/ui_units/functions/fnc_onAltLoad.sqf b/addons/ui_units/functions/fnc_onAltLoad.sqf index bd388dd3c74..5b691d7c538 100644 --- a/addons/ui_units/functions/fnc_onAltLoad.sqf +++ b/addons/ui_units/functions/fnc_onAltLoad.sqf @@ -4,7 +4,7 @@ params ["_ctrl"]; private _alt = (ctrlParent _ctrl) ctrlCreate [QGVAR(alt), -1]; -private _units = (vehicle ACE_player) call FUNC(altUnits); +private _units = cameraOn call FUNC(altUnits); _units call FUNC(altInfo) params ["_unitText", "_ratio"]; ((ctrlParent _alt) displayCtrl 1005) ctrlSetText _unitText; @@ -28,7 +28,7 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - private _vehicle = vehicle ACE_player; + private _vehicle = cameraOn; private _rawAlt = ((getPosATL _vehicle) select 2) + (0 min (getTerrainHeightASL getPos _vehicle)); private _altValue = _rawAlt / GVAR(altRatio); if (_altValue < 10) then { diff --git a/addons/ui_units/functions/fnc_onSpeedLoad.sqf b/addons/ui_units/functions/fnc_onSpeedLoad.sqf index 95a148d7b32..f70592e8c03 100644 --- a/addons/ui_units/functions/fnc_onSpeedLoad.sqf +++ b/addons/ui_units/functions/fnc_onSpeedLoad.sqf @@ -4,7 +4,7 @@ params ["_ctrl"]; private _speed = (ctrlParent _ctrl) ctrlCreate [QGVAR(speed), -1]; -private _units = (vehicle ACE_player) call FUNC(speedUnits); +private _units = cameraOn call FUNC(speedUnits); _units call FUNC(speedInfo) params ["_unitText", "_ratio"]; ((ctrlParent _speed) displayCtrl 1004) ctrlSetText _unitText; @@ -28,5 +28,5 @@ private _settingEH = ["CBA_SettingChanged", { }; _ctrl ctrlSetFade 1; _ctrl ctrlCommit 0; - _speed ctrlSetText ((abs (speed vehicle ACE_player / GVAR(speedRatio))) toFixed 0); + _speed ctrlSetText ((abs (speed cameraOn / GVAR(speedRatio))) toFixed 0); }, 0, [_ctrl, _speed, _settingEH]] call CBA_fnc_addPerFrameHandler; From 49b5fb5b5f1a0ad97cadc0cda7a53d2a3336f28c Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 4 Oct 2021 17:55:00 -0600 Subject: [PATCH 16/18] Update script_component.hpp --- addons/arsenal/missions/Arsenal.VR/script_component.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/arsenal/missions/Arsenal.VR/script_component.hpp b/addons/arsenal/missions/Arsenal.VR/script_component.hpp index 5053d168dd4..e1e6528a491 100644 --- a/addons/arsenal/missions/Arsenal.VR/script_component.hpp +++ b/addons/arsenal/missions/Arsenal.VR/script_component.hpp @@ -1,5 +1,4 @@ #include "\z\ace\addons\arsenal\script_component.hpp" -// make.py can't redefine already defined macros -#undef PREP +#undef PREP // make.py can't redefine already defined macros #define PREP(var) FUNC(var) = compileFinal preprocessFileLineNumbers format ["fnc_%1.sqf", QUOTE(var)] From 2f9ea0a61b2ebbeb5de44a380f4f42597b0a1421 Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 4 Oct 2021 17:56:52 -0600 Subject: [PATCH 17/18] Update stringtable.xml --- addons/ui_units/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/ui_units/stringtable.xml b/addons/ui_units/stringtable.xml index a6374c59267..cd27a5cc468 100644 --- a/addons/ui_units/stringtable.xml +++ b/addons/ui_units/stringtable.xml @@ -1,6 +1,6 @@ - + Units Maßeinheiten From 60e189179a29f1549bc13b29356cc0691e2e57f4 Mon Sep 17 00:00:00 2001 From: Brett Date: Thu, 1 Sep 2022 13:54:00 -0600 Subject: [PATCH 18/18] doesn't like empty lines I guess --- addons/ui_units/stringtable.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/addons/ui_units/stringtable.xml b/addons/ui_units/stringtable.xml index cd27a5cc468..0c429a4be14 100644 --- a/addons/ui_units/stringtable.xml +++ b/addons/ui_units/stringtable.xml @@ -5,7 +5,6 @@ Units Maßeinheiten - Speed Geschwindigkeit @@ -14,7 +13,6 @@ Units used to display Speed. Maßeinheit, um Geschwindigkeit darzustellen. - Altitude Flughöhe @@ -23,12 +21,10 @@ Units used to display Altitude. Maßeinheit, um Flughöhe darzustellen. - Land Vehicles Bodenfahrzeuge - km/h km/h @@ -45,7 +41,6 @@ m/s m/s - Meters Meter