From d3b1766c930547af56563c15e01521f0046f11b2 Mon Sep 17 00:00:00 2001 From: diwako Date: Mon, 18 Feb 2019 18:00:50 +0100 Subject: [PATCH] CBA Restructure --- .gitignore | 6 + addons/main/$PBOPREFIX$ | 1 + .../main/CfgColorStyles.hpp | 45 +- addons/main/CfgEventHandlers.hpp | 15 + .../main/CfgIconStyles.hpp | 30 +- .../UI/icon_styles/nato/GAR_iconManAT_ca.paa | Bin .../nato/GAR_iconManEngineer_ca.paa | Bin .../nato/GAR_iconManExplosive_ca.paa | Bin .../icon_styles/nato/GAR_iconManLeader_ca.paa | Bin .../UI/icon_styles/nato/GAR_iconManMG_ca.paa | Bin .../icon_styles/nato/GAR_iconManMedic_ca.paa | Bin .../UI/icon_styles/standard/buddy_compass.paa | Bin .../UI/icon_styles/standard/buddy_compass.psd | Bin .../UI/icon_styles/terry/buddy_compass.paa | Bin .../UI/icon_styles/terry/iconManAT_ca.paa | Bin .../icon_styles/terry/iconManEngineer_ca.paa | Bin .../icon_styles/terry/iconManExplosive_ca.paa | Bin .../UI/icon_styles/terry/iconManLeader_ca.paa | Bin .../UI/icon_styles/terry/iconManMG_ca.paa | Bin .../UI/icon_styles/terry/iconManMedic_ca.paa | Bin .../icon_styles/terry/iconManOfficer_ca.paa | Bin .../main}/UI/icon_styles/terry/iconMan_ca.paa | Bin addons/main/XEH_PREP.hpp | 2 + addons/main/XEH_postInit.sqf | 2 + addons/main/XEH_preInit.sqf | 138 ++ addons/main/XEH_preStart.sqf | 2 + addons/main/config.cpp | 18 + addons/main/functions/fnc_canHudBeShown.sqf | 12 + addons/main/functions/fnc_toHex.sqf | 31 + addons/main/functions/script_component.hpp | 1 + addons/main/include/getColorStyles.sqf | 68 + addons/main/include/getIconStyles.sqf | 39 + addons/main/script_component.hpp | 14 + addons/main/script_macros.hpp | 9 + addons/main/script_mod.hpp | 9 + addons/main/script_version.hpp | 4 + {mod => addons/main}/stringtable.xml | 60 + addons/radar/$PBOPREFIX$ | 1 + addons/radar/CfgCompassStyles.hpp | 61 + addons/radar/CfgEventHandlers.hpp | 15 + {mod => addons/radar}/CfgUIGrids.hpp | 94 +- {mod => addons/radar}/RscCommon.hpp | 536 ++--- .../bi/SquadRadarBackgroundTexture_ca.psd | Bin .../radar}/UI/compass_styles/bi/compass.paa | Bin .../UI/compass_styles/bi/compass_limited.paa | Bin .../SquadRadarBackgroundTexture_camod.psd | Bin .../radar}/UI/compass_styles/classic/full.paa | Bin .../UI/compass_styles/classic/limited.paa | Bin .../radar}/UI/compass_styles/clock/clock.psd | Bin .../radar}/UI/compass_styles/clock/full.paa | Bin .../UI/compass_styles/clock/limited.paa | Bin .../compass_styles/milint/compass_milint.psd | Bin .../radar}/UI/compass_styles/milint/full.paa | Bin .../UI/compass_styles/milint/limited.paa | Bin .../radar}/UI/compass_styles/olde/full.paa | Bin .../radar}/UI/compass_styles/olde/limited.paa | Bin .../radar}/UI/compass_styles/olde/olde.psd | Bin .../UI/compass_styles/pizza/compass.paa | Bin .../compass_styles/pizza/compass_limited.paa | Bin .../radar}/UI/compass_styles/pizza/pie.psd | Bin .../UI/compass_styles/standard/compass.paa | Bin .../UI/compass_styles/standard/compass.psd | Bin .../standard/compass_limited.paa | Bin .../radar}/UI/compass_styles/xeno/blue.paa | Bin .../radar}/UI/compass_styles/xeno/bluef.paa | Bin .../radar}/UI/compass_styles/xeno/green.paa | Bin .../radar}/UI/compass_styles/xeno/greenf.paa | Bin .../radar}/UI/compass_styles/xeno/red.paa | Bin .../radar}/UI/compass_styles/xeno/redf.paa | Bin .../radar}/UI/compass_styles/xeno/xeno.psd | Bin addons/radar/XEH_PREP.hpp | 7 + addons/radar/XEH_postInit.sqf | 64 + .../radar/XEH_preInit.sqf | 220 +- addons/radar/XEH_preStart.sqf | 2 + addons/radar/config.cpp | 18 + addons/radar/functions/fnc_cacheLoop.sqf | 266 +++ .../radar/functions/fnc_compass.sqf | 174 +- .../functions/fnc_displayUnitOnCompass.sqf | 211 +- .../radar/functions/fnc_getIcon.sqf | 156 +- addons/radar/functions/fnc_pairBuddies.sqf | 17 + .../radar/functions/fnc_rangeButton.sqf | 8 +- .../radar/functions/fnc_setCustomCode.sqf | 14 +- addons/radar/functions/script_component.hpp | 1 + {mod => addons/radar}/gui.hpp | 98 +- .../radar}/gui_compass_controls.hpp | 131 +- .../radar}/gui_namebox_controls.hpp | 80 +- .../radar/include/getCompassStyles.sqf | 26 +- addons/radar/script_component.hpp | 48 + build.bat | 5 + compile.bat | 1 - compile.sh | 1 - hemtt.json | 13 + .../cba/addons/main/script_macros_common.hpp | 1796 +++++++++++++++++ mod/logosmall.paa => logosmall.paa | Bin mod.cpp | 3 + mod/$PBOPREFIX$ | 1 - mod/CfgFunctions.hpp | 16 - mod/authors.txt | 23 - mod/compass_style.hpp | 72 - mod/config.cpp | 32 - mod/functions/fn_cacheLoop.sqf | 271 --- mod/functions/fn_canHudBeShown.sqf | 11 - mod/functions/fn_getColorStyles.sqf | 43 - mod/functions/fn_getIconStyles.sqf | 39 - mod/functions/fn_pairBuddies.sqf | 16 - mod/functions/fn_postInit.sqf | 62 - mod/license.txt | 7 - mod/script_component.hpp | 37 - 108 files changed, 3610 insertions(+), 1593 deletions(-) create mode 100644 addons/main/$PBOPREFIX$ rename mod/color_style.hpp => addons/main/CfgColorStyles.hpp (81%) create mode 100644 addons/main/CfgEventHandlers.hpp rename mod/icon_style.hpp => addons/main/CfgIconStyles.hpp (58%) rename {mod => addons/main}/UI/icon_styles/nato/GAR_iconManAT_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/nato/GAR_iconManEngineer_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/nato/GAR_iconManExplosive_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/nato/GAR_iconManLeader_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/nato/GAR_iconManMG_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/nato/GAR_iconManMedic_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/standard/buddy_compass.paa (100%) rename {mod => addons/main}/UI/icon_styles/standard/buddy_compass.psd (100%) rename {mod => addons/main}/UI/icon_styles/terry/buddy_compass.paa (100%) rename {mod => addons/main}/UI/icon_styles/terry/iconManAT_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/terry/iconManEngineer_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/terry/iconManExplosive_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/terry/iconManLeader_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/terry/iconManMG_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/terry/iconManMedic_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/terry/iconManOfficer_ca.paa (100%) rename {mod => addons/main}/UI/icon_styles/terry/iconMan_ca.paa (100%) create mode 100644 addons/main/XEH_PREP.hpp create mode 100644 addons/main/XEH_postInit.sqf create mode 100644 addons/main/XEH_preInit.sqf create mode 100644 addons/main/XEH_preStart.sqf create mode 100644 addons/main/config.cpp create mode 100644 addons/main/functions/fnc_canHudBeShown.sqf create mode 100644 addons/main/functions/fnc_toHex.sqf create mode 100644 addons/main/functions/script_component.hpp create mode 100644 addons/main/include/getColorStyles.sqf create mode 100644 addons/main/include/getIconStyles.sqf create mode 100644 addons/main/script_component.hpp create mode 100644 addons/main/script_macros.hpp create mode 100644 addons/main/script_mod.hpp create mode 100644 addons/main/script_version.hpp rename {mod => addons/main}/stringtable.xml (93%) create mode 100644 addons/radar/$PBOPREFIX$ create mode 100644 addons/radar/CfgCompassStyles.hpp create mode 100644 addons/radar/CfgEventHandlers.hpp rename {mod => addons/radar}/CfgUIGrids.hpp (94%) rename {mod => addons/radar}/RscCommon.hpp (95%) rename {mod => addons/radar}/UI/compass_styles/bi/SquadRadarBackgroundTexture_ca.psd (100%) rename {mod => addons/radar}/UI/compass_styles/bi/compass.paa (100%) rename {mod => addons/radar}/UI/compass_styles/bi/compass_limited.paa (100%) rename {mod => addons/radar}/UI/compass_styles/classic/SquadRadarBackgroundTexture_camod.psd (100%) rename {mod => addons/radar}/UI/compass_styles/classic/full.paa (100%) rename {mod => addons/radar}/UI/compass_styles/classic/limited.paa (100%) rename {mod => addons/radar}/UI/compass_styles/clock/clock.psd (100%) rename {mod => addons/radar}/UI/compass_styles/clock/full.paa (100%) rename {mod => addons/radar}/UI/compass_styles/clock/limited.paa (100%) rename {mod => addons/radar}/UI/compass_styles/milint/compass_milint.psd (100%) rename {mod => addons/radar}/UI/compass_styles/milint/full.paa (100%) rename {mod => addons/radar}/UI/compass_styles/milint/limited.paa (100%) rename {mod => addons/radar}/UI/compass_styles/olde/full.paa (100%) rename {mod => addons/radar}/UI/compass_styles/olde/limited.paa (100%) rename {mod => addons/radar}/UI/compass_styles/olde/olde.psd (100%) rename {mod => addons/radar}/UI/compass_styles/pizza/compass.paa (100%) rename {mod => addons/radar}/UI/compass_styles/pizza/compass_limited.paa (100%) rename {mod => addons/radar}/UI/compass_styles/pizza/pie.psd (100%) rename {mod => addons/radar}/UI/compass_styles/standard/compass.paa (100%) rename {mod => addons/radar}/UI/compass_styles/standard/compass.psd (100%) rename {mod => addons/radar}/UI/compass_styles/standard/compass_limited.paa (100%) rename {mod => addons/radar}/UI/compass_styles/xeno/blue.paa (100%) rename {mod => addons/radar}/UI/compass_styles/xeno/bluef.paa (100%) rename {mod => addons/radar}/UI/compass_styles/xeno/green.paa (100%) rename {mod => addons/radar}/UI/compass_styles/xeno/greenf.paa (100%) rename {mod => addons/radar}/UI/compass_styles/xeno/red.paa (100%) rename {mod => addons/radar}/UI/compass_styles/xeno/redf.paa (100%) rename {mod => addons/radar}/UI/compass_styles/xeno/xeno.psd (100%) create mode 100644 addons/radar/XEH_PREP.hpp create mode 100644 addons/radar/XEH_postInit.sqf rename mod/functions/fn_preinit.sqf => addons/radar/XEH_preInit.sqf (65%) create mode 100644 addons/radar/XEH_preStart.sqf create mode 100644 addons/radar/config.cpp create mode 100644 addons/radar/functions/fnc_cacheLoop.sqf rename mod/functions/fn_compass.sqf => addons/radar/functions/fnc_compass.sqf (84%) rename mod/functions/fn_displayUnitOnCompass.sqf => addons/radar/functions/fnc_displayUnitOnCompass.sqf (82%) rename mod/functions/fn_getIcon.sqf => addons/radar/functions/fnc_getIcon.sqf (84%) create mode 100644 addons/radar/functions/fnc_pairBuddies.sqf rename mod/functions/fn_rangeButton.sqf => addons/radar/functions/fnc_rangeButton.sqf (79%) rename mod/functions/fn_setCustomCode.sqf => addons/radar/functions/fnc_setCustomCode.sqf (95%) create mode 100644 addons/radar/functions/script_component.hpp rename {mod => addons/radar}/gui.hpp (96%) rename {mod => addons/radar}/gui_compass_controls.hpp (84%) rename {mod => addons/radar}/gui_namebox_controls.hpp (63%) rename mod/functions/fn_getCompassStyles.sqf => addons/radar/include/getCompassStyles.sqf (66%) create mode 100644 addons/radar/script_component.hpp create mode 100644 build.bat delete mode 100644 compile.bat delete mode 100644 compile.sh create mode 100644 hemtt.json create mode 100644 include/x/cba/addons/main/script_macros_common.hpp rename mod/logosmall.paa => logosmall.paa (100%) create mode 100644 mod.cpp delete mode 100644 mod/$PBOPREFIX$ delete mode 100644 mod/CfgFunctions.hpp delete mode 100644 mod/authors.txt delete mode 100644 mod/compass_style.hpp delete mode 100644 mod/config.cpp delete mode 100644 mod/functions/fn_cacheLoop.sqf delete mode 100644 mod/functions/fn_canHudBeShown.sqf delete mode 100644 mod/functions/fn_getColorStyles.sqf delete mode 100644 mod/functions/fn_getIconStyles.sqf delete mode 100644 mod/functions/fn_pairBuddies.sqf delete mode 100644 mod/functions/fn_postInit.sqf delete mode 100644 mod/license.txt delete mode 100644 mod/script_component.hpp diff --git a/.gitignore b/.gitignore index cf79bbb..19f783f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ *.biprivatekey + +hemtt\.exe +keys/ +releases/ +tools/ +*.pbo diff --git a/addons/main/$PBOPREFIX$ b/addons/main/$PBOPREFIX$ new file mode 100644 index 0000000..bdde3bc --- /dev/null +++ b/addons/main/$PBOPREFIX$ @@ -0,0 +1 @@ +z\diwako_dui\addons\main diff --git a/mod/color_style.hpp b/addons/main/CfgColorStyles.hpp similarity index 81% rename from mod/color_style.hpp rename to addons/main/CfgColorStyles.hpp index c40de41..f60ceee 100644 --- a/mod/color_style.hpp +++ b/addons/main/CfgColorStyles.hpp @@ -1,7 +1,5 @@ -class diwako_dui_colors -{ - class standard - { +class diwako_dui_colors { + class standard { name = "Standard"; white = "#FFFFFF"; @@ -9,11 +7,9 @@ class diwako_dui_colors green = "#00E600"; blue = "#005CFF"; yellow = "#E6E600"; - tracked = "#EE42F4"; }; - class ace:standard - { + class ace:standard { name = "ACE 3"; white = "#FFFFFF"; @@ -23,8 +19,7 @@ class diwako_dui_colors yellow = "#FFFFAB"; }; - class sthud:standard - { + class sthud:standard { name = "STUI"; white = "#FFFFFF"; @@ -34,8 +29,7 @@ class diwako_dui_colors yellow = "#D9D900"; }; - class wargame:standard - { + class wargame:standard { name = "Wargame"; white = "#FEFFFF"; @@ -45,8 +39,7 @@ class diwako_dui_colors yellow = "#DC9845"; }; - class wargame2:standard - { + class wargame2:standard { name = "Wargame (Military Green)"; white = "#9CB595"; @@ -56,8 +49,7 @@ class diwako_dui_colors yellow = "#DC9845"; }; - class protanopia:standard - { + class protanopia:standard { name = "Protanopia"; white = "#FFFFFF"; @@ -67,8 +59,7 @@ class diwako_dui_colors yellow = "#D9D934"; }; - class protanomaly:standard - { + class protanomaly:standard { name = "Protanomaly"; white = "#FFFFFF"; @@ -78,8 +69,7 @@ class diwako_dui_colors yellow = "#D9D91B"; }; - class deuteranopia:standard - { + class deuteranopia:standard { name = "Deuteranopia"; white = "#FFFFFF"; @@ -89,8 +79,7 @@ class diwako_dui_colors yellow = "#D9D941"; }; - class deuteranomaly:standard - { + class deuteranomaly:standard { name = "Deuteranomaly"; white = "#FFFFFF"; @@ -100,8 +89,7 @@ class diwako_dui_colors yellow = "#D9D91F"; }; - class tritanopia:standard - { + class tritanopia:standard { name = "Tritanopia"; white = "#FFFFFF"; @@ -111,8 +99,7 @@ class diwako_dui_colors yellow = "#D95E67"; }; - class tritanomaly:standard - { + class tritanomaly:standard { name = "Tritanomaly"; white = "#FFFFFF"; @@ -122,8 +109,7 @@ class diwako_dui_colors yellow = "#D99F28"; }; - class achromatopsia:standard - { + class achromatopsia:standard { name = "Achromatopsia"; white = "#FFFFFF"; @@ -133,8 +119,7 @@ class diwako_dui_colors yellow = "#C0C0C0"; }; - class achromatomaly:standard - { + class achromatomaly:standard { name = "Achromatomaly"; white = "#FFFFFF"; @@ -143,4 +128,4 @@ class diwako_dui_colors blue = "#40409C"; yellow = "#CBCB69"; }; -}; \ No newline at end of file +}; diff --git a/addons/main/CfgEventHandlers.hpp b/addons/main/CfgEventHandlers.hpp new file mode 100644 index 0000000..e90bed4 --- /dev/null +++ b/addons/main/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/mod/icon_style.hpp b/addons/main/CfgIconStyles.hpp similarity index 58% rename from mod/icon_style.hpp rename to addons/main/CfgIconStyles.hpp index a4f706a..f77a690 100644 --- a/mod/icon_style.hpp +++ b/addons/main/CfgIconStyles.hpp @@ -26,33 +26,33 @@ class diwako_dui_icon_style rank_colonel = "a3\ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa"; buddy = "a3\ui_f_curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa"; - buddy_compass = "diwako_dui\UI\icon_styles\standard\buddy_compass"; + buddy_compass = QPATHTO_T(UI\icon_styles\standard\buddy_compass); }; class terry:standard { name = "Just The Tip"; - sql = "diwako_dui\UI\icon_styles\terry\iconManLeader_ca.paa"; - medic = "diwako_dui\UI\icon_styles\terry\iconManMedic_ca.paa"; - auto_rifleman = "diwako_dui\UI\icon_styles\terry\iconManMG_ca.paa"; - at_gunner = "diwako_dui\UI\icon_styles\terry\iconManAT_ca.paa"; - engineer = "diwako_dui\UI\icon_styles\terry\iconManEngineer_ca.paa"; - explosive_specialist = "diwako_dui\UI\icon_styles\terry\iconManExplosive_ca.paa"; - rifleman = "diwako_dui\UI\icon_styles\terry\iconMan_ca.paa"; + sql = QPATHTO_T(UI\icon_styles\terry\iconManLeader_ca.paa); + medic = QPATHTO_T(UI\icon_styles\terry\iconManMedic_ca.paa); + auto_rifleman = QPATHTO_T(UI\icon_styles\terry\iconManMG_ca.paa); + at_gunner = QPATHTO_T(UI\icon_styles\terry\iconManAT_ca.paa); + engineer = QPATHTO_T(UI\icon_styles\terry\iconManEngineer_ca.paa); + explosive_specialist = QPATHTO_T(UI\icon_styles\terry\iconManExplosive_ca.paa); + rifleman = QPATHTO_T(UI\icon_styles\terry\iconMan_ca.paa); - buddy_compass = "diwako_dui\UI\icon_styles\terry\buddy_compass.paa"; + buddy_compass = QPATHTO_T(UI\icon_styles\terry\buddy_compass.paa); }; class nato:standard { name = "NATO JMS"; - sql = "diwako_dui\UI\icon_styles\nato\GAR_iconManLeader_ca.paa"; - medic = "diwako_dui\UI\icon_styles\nato\GAR_iconManMedic_ca.paa"; - auto_rifleman = "diwako_dui\UI\icon_styles\nato\GAR_iconManMG_ca.paa"; - at_gunner = "diwako_dui\UI\icon_styles\nato\GAR_iconManAT_ca.paa"; - engineer = "diwako_dui\UI\icon_styles\nato\GAR_iconManEngineer_ca.paa"; - explosive_specialist = "diwako_dui\UI\icon_styles\nato\GAR_iconManExplosive_ca.paa"; + sql = QPATHTO_T(UI\icon_styles\nato\GAR_iconManLeader_ca.paa); + medic = QPATHTO_T(UI\icon_styles\nato\GAR_iconManMedic_ca.paa); + auto_rifleman = QPATHTO_T(UI\icon_styles\nato\GAR_iconManMG_ca.paa); + at_gunner = QPATHTO_T(UI\icon_styles\nato\GAR_iconManAT_ca.paa); + engineer = QPATHTO_T(UI\icon_styles\nato\GAR_iconManEngineer_ca.paa); + explosive_specialist = QPATHTO_T(UI\icon_styles\nato\GAR_iconManExplosive_ca.paa); }; }; \ No newline at end of file diff --git a/mod/UI/icon_styles/nato/GAR_iconManAT_ca.paa b/addons/main/UI/icon_styles/nato/GAR_iconManAT_ca.paa similarity index 100% rename from mod/UI/icon_styles/nato/GAR_iconManAT_ca.paa rename to addons/main/UI/icon_styles/nato/GAR_iconManAT_ca.paa diff --git a/mod/UI/icon_styles/nato/GAR_iconManEngineer_ca.paa b/addons/main/UI/icon_styles/nato/GAR_iconManEngineer_ca.paa similarity index 100% rename from mod/UI/icon_styles/nato/GAR_iconManEngineer_ca.paa rename to addons/main/UI/icon_styles/nato/GAR_iconManEngineer_ca.paa diff --git a/mod/UI/icon_styles/nato/GAR_iconManExplosive_ca.paa b/addons/main/UI/icon_styles/nato/GAR_iconManExplosive_ca.paa similarity index 100% rename from mod/UI/icon_styles/nato/GAR_iconManExplosive_ca.paa rename to addons/main/UI/icon_styles/nato/GAR_iconManExplosive_ca.paa diff --git a/mod/UI/icon_styles/nato/GAR_iconManLeader_ca.paa b/addons/main/UI/icon_styles/nato/GAR_iconManLeader_ca.paa similarity index 100% rename from mod/UI/icon_styles/nato/GAR_iconManLeader_ca.paa rename to addons/main/UI/icon_styles/nato/GAR_iconManLeader_ca.paa diff --git a/mod/UI/icon_styles/nato/GAR_iconManMG_ca.paa b/addons/main/UI/icon_styles/nato/GAR_iconManMG_ca.paa similarity index 100% rename from mod/UI/icon_styles/nato/GAR_iconManMG_ca.paa rename to addons/main/UI/icon_styles/nato/GAR_iconManMG_ca.paa diff --git a/mod/UI/icon_styles/nato/GAR_iconManMedic_ca.paa b/addons/main/UI/icon_styles/nato/GAR_iconManMedic_ca.paa similarity index 100% rename from mod/UI/icon_styles/nato/GAR_iconManMedic_ca.paa rename to addons/main/UI/icon_styles/nato/GAR_iconManMedic_ca.paa diff --git a/mod/UI/icon_styles/standard/buddy_compass.paa b/addons/main/UI/icon_styles/standard/buddy_compass.paa similarity index 100% rename from mod/UI/icon_styles/standard/buddy_compass.paa rename to addons/main/UI/icon_styles/standard/buddy_compass.paa diff --git a/mod/UI/icon_styles/standard/buddy_compass.psd b/addons/main/UI/icon_styles/standard/buddy_compass.psd similarity index 100% rename from mod/UI/icon_styles/standard/buddy_compass.psd rename to addons/main/UI/icon_styles/standard/buddy_compass.psd diff --git a/mod/UI/icon_styles/terry/buddy_compass.paa b/addons/main/UI/icon_styles/terry/buddy_compass.paa similarity index 100% rename from mod/UI/icon_styles/terry/buddy_compass.paa rename to addons/main/UI/icon_styles/terry/buddy_compass.paa diff --git a/mod/UI/icon_styles/terry/iconManAT_ca.paa b/addons/main/UI/icon_styles/terry/iconManAT_ca.paa similarity index 100% rename from mod/UI/icon_styles/terry/iconManAT_ca.paa rename to addons/main/UI/icon_styles/terry/iconManAT_ca.paa diff --git a/mod/UI/icon_styles/terry/iconManEngineer_ca.paa b/addons/main/UI/icon_styles/terry/iconManEngineer_ca.paa similarity index 100% rename from mod/UI/icon_styles/terry/iconManEngineer_ca.paa rename to addons/main/UI/icon_styles/terry/iconManEngineer_ca.paa diff --git a/mod/UI/icon_styles/terry/iconManExplosive_ca.paa b/addons/main/UI/icon_styles/terry/iconManExplosive_ca.paa similarity index 100% rename from mod/UI/icon_styles/terry/iconManExplosive_ca.paa rename to addons/main/UI/icon_styles/terry/iconManExplosive_ca.paa diff --git a/mod/UI/icon_styles/terry/iconManLeader_ca.paa b/addons/main/UI/icon_styles/terry/iconManLeader_ca.paa similarity index 100% rename from mod/UI/icon_styles/terry/iconManLeader_ca.paa rename to addons/main/UI/icon_styles/terry/iconManLeader_ca.paa diff --git a/mod/UI/icon_styles/terry/iconManMG_ca.paa b/addons/main/UI/icon_styles/terry/iconManMG_ca.paa similarity index 100% rename from mod/UI/icon_styles/terry/iconManMG_ca.paa rename to addons/main/UI/icon_styles/terry/iconManMG_ca.paa diff --git a/mod/UI/icon_styles/terry/iconManMedic_ca.paa b/addons/main/UI/icon_styles/terry/iconManMedic_ca.paa similarity index 100% rename from mod/UI/icon_styles/terry/iconManMedic_ca.paa rename to addons/main/UI/icon_styles/terry/iconManMedic_ca.paa diff --git a/mod/UI/icon_styles/terry/iconManOfficer_ca.paa b/addons/main/UI/icon_styles/terry/iconManOfficer_ca.paa similarity index 100% rename from mod/UI/icon_styles/terry/iconManOfficer_ca.paa rename to addons/main/UI/icon_styles/terry/iconManOfficer_ca.paa diff --git a/mod/UI/icon_styles/terry/iconMan_ca.paa b/addons/main/UI/icon_styles/terry/iconMan_ca.paa similarity index 100% rename from mod/UI/icon_styles/terry/iconMan_ca.paa rename to addons/main/UI/icon_styles/terry/iconMan_ca.paa diff --git a/addons/main/XEH_PREP.hpp b/addons/main/XEH_PREP.hpp new file mode 100644 index 0000000..f613683 --- /dev/null +++ b/addons/main/XEH_PREP.hpp @@ -0,0 +1,2 @@ +PREP(canHudBeShown); +PREP(toHex); \ No newline at end of file diff --git a/addons/main/XEH_postInit.sqf b/addons/main/XEH_postInit.sqf new file mode 100644 index 0000000..ca1ce24 --- /dev/null +++ b/addons/main/XEH_postInit.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +if (is3DEN || !hasInterface) exitWith {}; diff --git a/addons/main/XEH_preInit.sqf b/addons/main/XEH_preInit.sqf new file mode 100644 index 0000000..b667790 --- /dev/null +++ b/addons/main/XEH_preInit.sqf @@ -0,0 +1,138 @@ +#include "script_component.hpp" +ADDON = false; +#include "XEH_PREP.hpp" + +#include "\a3\ui_f\hpp\defineDIKCodes.inc" +#define CBA_SETTINGS_CAT localize "STR_dui_mod" + " - Main" + +GVAR(toggled_off) = false; +GVAR(inFeatureCamera) = false; + +private _curCat = localize "STR_dui_cat_general"; + +private _availableFonts = [ + "PuristaBold", + "PuristaLight", + "PuristaMedium", + "PuristaSemibold", + "RobotoCondensed", + "RobotoCondensedBold", + "RobotoCondensedLight", + "EtelkaMonospacePro", + // "EtelkaMonospaceProBold", + // "EtelkaNarrowMediumPro", + "LCD14" + // "TahomaB" +]; + +[ + "diwako_dui_font" + ,"LIST" + ,[localize "STR_dui_font", localize "STR_dui_font_desc"] + ,[CBA_SETTINGS_CAT, _curCat] + ,[ + _availableFonts, + _availableFonts, + 4 + ] + ,false + ,{ + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; + } +] call CBA_Settings_fnc_init; + +#include "include\getIconStyles.sqf" +[ + "diwako_dui_icon_style" + ,"LIST" + ,[localize "STR_dui_icon", localize "STR_dui_icon_desc"] + ,[CBA_SETTINGS_CAT, _curCat] + ,[ + _iconIdent, + _iconNames, + 0 + ] + ,false +] call CBA_Settings_fnc_init; + +#include "include\getColorStyles.sqf" +[ + "diwako_dui_colors" + ,"LIST" + ,[localize "STR_dui_color", localize "STR_dui_color_desc"] + ,[CBA_SETTINGS_CAT, _curCat] + ,[ + _colorIdent, + _colorNames, + 0 + ] + ,false +] call CBA_Settings_fnc_init; + +if (isClass(configfile >> "CfgPatches" >> "ace_interact_menu")) then { + [ + "diwako_dui_ace_hide_interaction" + ,"CHECKBOX" + ,[localize "STR_dui_ace_hide_interaction", localize "STR_dui_ace_hide_interaction_desc"] + ,[CBA_SETTINGS_CAT, _curCat] + ,true + ,false + ] call CBA_Settings_fnc_init; +} else { + diwako_dui_ace_hide_interaction = false; +}; + +if !(hasInterface) exitWith {}; + +// cba eh for hiding the hud when in certain camera modes +["featureCamera", { + params ["_player", "_featureCamera"]; + GVAR(inFeatureCamera) = !(_featureCamera isEqualTo ""); +}, true] call CBA_fnc_addPlayerEventHandler; + +// player remote controls another unit or changes avatar +// mainly used for the change in avatar / switch unit part as displays will be closed +["unit", { + params ["_newPlayerUnit", "_oldPlayerUnit"]; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; +}, true] call CBA_fnc_addPlayerEventHandler; + +if (isClass (configfile >> "CfgPatches" >> "ace_nametags")) then { + ["CBA_SettingChanged", { + params ["_setting", "_value"]; + switch (_setting) do { + case "ace_nametags_nametagColorMain": { + EGVAR(main,colors_ace) setVariable ["main_compass", _value select [0, 3]]; + EGVAR(main,colors_ace) setVariable ["main", [(_value select 0) * 255,(_value select 1) * 255,(_value select 2) * 255] call EFUNC(main,toHex)]; + }; + case "ace_nametags_nametagColorRed": { + EGVAR(main,colors_ace) setVariable ["red_compass", _value select [0, 3]]; + EGVAR(main,colors_ace) setVariable ["red", [(_value select 0) * 255,(_value select 1) * 255,(_value select 2) * 255] call EFUNC(main,toHex)]; + }; + case "ace_nametags_nametagColorGreen": { + EGVAR(main,colors_ace) setVariable ["green_compass", _value select [0, 3]]; + EGVAR(main,colors_ace) setVariable ["green", [(_value select 0) * 255,(_value select 1) * 255,(_value select 2) * 255] call EFUNC(main,toHex)]; + }; + case "ace_nametags_nametagColorBlue": { + EGVAR(main,colors_ace) setVariable ["blue_compass", _value select [0, 3]]; + EGVAR(main,colors_ace) setVariable ["blue", [(_value select 0) * 255,(_value select 1) * 255,(_value select 2) * 255] call EFUNC(main,toHex)]; + }; + case "ace_nametags_nametagColorYellow": { + EGVAR(main,colors_ace) setVariable ["yellow_compass", _value select [0, 3]]; + EGVAR(main,colors_ace) setVariable ["yellow", [(_value select 0) * 255,(_value select 1) * 255,(_value select 2) * 255] call EFUNC(main,toHex)]; + }; + default { }; + }; + }] call CBA_fnc_addEventHandler; +}; + +// keybind to toggle whole UI +[CBA_SETTINGS_CAT, "diwako_dui_button_toggle_ui", localize "STR_dui_key_toggle", { + GVAR(toggled_off) = !GVAR(toggled_off); + [QGVAR(hudToggled), [GVAR(toggled_off)]] call CBA_fnc_localEvent; + true +}, +{false}, +[DIK_MULTIPLY, [false, true, false]], false] call CBA_fnc_addKeybind; + +ADDON = true; diff --git a/addons/main/XEH_preStart.sqf b/addons/main/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/main/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/main/config.cpp b/addons/main/config.cpp new file mode 100644 index 0000000..087c22a --- /dev/null +++ b/addons/main/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" +class CfgPatches { + class ADDON { + name = COMPONENT; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"cba_main"}; + author[] = {"diwako"}; + authorUrl = "https://github.com/diwako/diwako_dui"; + license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike"; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgColorStyles.hpp" +#include "CfgIconStyles.hpp" diff --git a/addons/main/functions/fnc_canHudBeShown.sqf b/addons/main/functions/fnc_canHudBeShown.sqf new file mode 100644 index 0000000..967eaeb --- /dev/null +++ b/addons/main/functions/fnc_canHudBeShown.sqf @@ -0,0 +1,12 @@ +#include "script_component.hpp" +params ["_player"]; +!( + visibleMap || + {GVAR(toggled_off) || + {!alive _player || + {(_player getVariable ["ace_spectator_isSet", false]) || + {dialog || + {diwako_dui_ace_hide_interaction && {missionNamespace getVariable ["ace_interact_menu_openedMenuType",-1] > -1} || + {!isnull (missionNamespace getVariable ["ace_arsenal_camera", objNull]) || + {GVAR(inFeatureCamera)}}}}}}} +) diff --git a/addons/main/functions/fnc_toHex.sqf b/addons/main/functions/fnc_toHex.sqf new file mode 100644 index 0000000..33ebea7 --- /dev/null +++ b/addons/main/functions/fnc_toHex.sqf @@ -0,0 +1,31 @@ +#include "script_component.hpp" +/** + * Function written original by commy2 and PabstMirror, used in ACE + * Donated to DUI by commmy2, thanks! + */ +params [["_red",0,[0]],["_green",0,[0]],["_blue",0,[0]]]; + +private _hex = [ +"00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F", +"10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F", +"20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F", +"30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F", +"40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F", +"50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F", +"60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F", +"70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F", +"80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F", +"90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F", +"A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF", +"B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF", +"C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF", +"D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF", +"E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF", +"F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF" +]; + +_red = ((round abs _red) max 0) min 255; +_green = ((round abs _green) max 0) min 255; +_blue = ((round abs _blue) max 0) min 255; + +format ["#%1%2%3", _hex select _red, _hex select _green, _hex select _blue] diff --git a/addons/main/functions/script_component.hpp b/addons/main/functions/script_component.hpp new file mode 100644 index 0000000..8fea1d8 --- /dev/null +++ b/addons/main/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\diwako_dui\addons\main\script_component.hpp" \ No newline at end of file diff --git a/addons/main/include/getColorStyles.sqf b/addons/main/include/getColorStyles.sqf new file mode 100644 index 0000000..84a5bcd --- /dev/null +++ b/addons/main/include/getColorStyles.sqf @@ -0,0 +1,68 @@ +private _configs = "true" configClasses (configFile >> "diwako_dui_colors"); +private _missionConfigs = "true" configClasses (missionConfigFile >> "diwako_dui_colors"); +if (isNil "_missionConfigs") then { + _missionConfigs = []; +}; + +private _colorNames = []; +private _colorIdent = []; + +private _getColorFromHex = { + params ["_key", "_hex"]; + _hex = toArray _hex; + _hex deleteAt 0; //remove the '#' at the beginning + private _nums = toArray "0123456789ABCDEF"; //for converting hex nibbles to base 10 equivalents + + private _r = (_nums find (_hex select 0)) * 16 + (_nums find (_hex select 1)); + private _g = (_nums find (_hex select 2)) * 16 + (_nums find (_hex select 3)); + private _b = (_nums find (_hex select 4)) * 16 + (_nums find (_hex select 5)); + + _namespace setVariable [format ["%1_compass",_key], [(_r/255),(_g/255),(_b/255)]]; +}; + +{ + private _namespace = [] call CBA_fnc_createNamespace; + private _configName = configName _x; + _colorIdent pushBack _configName; + _colorNames pushback getText (_x >> "name"); + + _namespace setVariable ["main", getText (_x >> "white")]; + ["main", _namespace getVariable "main"] call _getColorFromHex; + _namespace setVariable ["red", getText (_x >> "red")]; + ["red", _namespace getVariable "red"] call _getColorFromHex; + _namespace setVariable ["green", getText (_x >> "green")]; + ["green", _namespace getVariable "green"] call _getColorFromHex; + _namespace setVariable ["blue", getText (_x >> "blue")]; + ["blue", _namespace getVariable "blue"] call _getColorFromHex; + _namespace setVariable ["yellow", getText (_x >> "yellow")]; + ["yellow", _namespace getVariable "yellow"] call _getColorFromHex; + + missionNamespace setVariable [format[QGVAR(colors_%1), _configName], _namespace] +} forEach (_configs + _missionConfigs); + +if (isClass (configfile >> "CfgPatches" >> "ace_nametags")) then { + // ace nametags is also loaded, provide ace nametag colors as well + _namespace = missionNamespace getVariable QGVAR(colors_ace); + if (isNil "_namespace") then { + _namespace = [] call CBA_fnc_createNamespace; + _colorIdent pushBack "ace"; + _colorNames pushBack "ACE 3"; + missionNamespace setVariable [QGVAR(colors_ace), _namespace]; + }; + private _main = ["ace_nametags_nametagColorMain"] call CBA_settings_fnc_get; + private _red = ["ace_nametags_nametagColorRed"] call CBA_settings_fnc_get; + private _green = ["ace_nametags_nametagColorGreen"] call CBA_settings_fnc_get; + private _blue = ["ace_nametags_nametagColorBlue"] call CBA_settings_fnc_get; + private _yellow = ["ace_nametags_nametagColorYellow"] call CBA_settings_fnc_get; + + _namespace setVariable ["main_compass", _main select [0, 3]]; + _namespace setVariable ["red_compass", _red select [0, 3]]; + _namespace setVariable ["green_compass", _green select [0, 3]]; + _namespace setVariable ["blue_compass", _blue select [0, 3]]; + _namespace setVariable ["yellow_compass", _yellow select [0, 3]]; + _namespace setVariable ["main", [(_main select 0) * 255,(_main select 1) * 255,(_main select 2) * 255] call EFUNC(main,toHex)]; + _namespace setVariable ["red", [(_red select 0) * 255,(_red select 1) * 255,(_red select 2) * 255] call EFUNC(main,toHex)]; + _namespace setVariable ["green", [(_green select 0) * 255,(_green select 1) * 255,(_green select 2) * 255] call EFUNC(main,toHex)]; + _namespace setVariable ["blue", [(_blue select 0) * 255,(_blue select 1) * 255,(_blue select 2) * 255] call EFUNC(main,toHex)]; + _namespace setVariable ["yellow", [(_yellow select 0) * 255,(_yellow select 1) * 255,(_yellow select 2) * 255] call EFUNC(main,toHex)]; +}; diff --git a/addons/main/include/getIconStyles.sqf b/addons/main/include/getIconStyles.sqf new file mode 100644 index 0000000..52c2205 --- /dev/null +++ b/addons/main/include/getIconStyles.sqf @@ -0,0 +1,39 @@ +private _configs = "true" configClasses (configFile >> "diwako_dui_icon_style"); +private _missionConfigs = "true" configClasses (missionConfigFile >> "diwako_dui_icon_style"); +if (isNil "_missionConfigs") then { + _missionConfigs = []; +}; + +private _iconNames = []; +private _iconIdent = []; + +{ + private _namespace = [] call CBA_fnc_createNamespace; + _iconNames pushback getText (_x >> "name"); + private _configName = configName _x; + _iconIdent pushBack _configName; + + _namespace setVariable ["sql", getText (_x >> "sql")]; + _namespace setVariable ["medic", getText (_x >> "medic")]; + _namespace setVariable ["auto_rifleman", getText (_x >> "auto_rifleman")]; + _namespace setVariable ["at_gunner", getText (_x >> "at_gunner")]; + _namespace setVariable ["engineer", getText (_x >> "engineer")]; + _namespace setVariable ["explosive_specialist", getText (_x >> "explosive_specialist")]; + _namespace setVariable ["rifleman", getText (_x >> "rifleman")]; + _namespace setVariable ["vehicle_cargo", getText (_x >> "vehicle_cargo")]; + _namespace setVariable ["vehicle_driver", getText (_x >> "vehicle_driver")]; + _namespace setVariable ["fire_from_vehicle", getText (_x >> "fire_from_vehicle")]; + _namespace setVariable ["vehicle_gunner", getText (_x >> "vehicle_gunner")]; + _namespace setVariable ["vehicle_commander", getText (_x >> "vehicle_commander")]; + _namespace setVariable ["PRIVATE", getText (_x >> "rank_private")]; + _namespace setVariable ["CORPORAL", getText (_x >> "rank_corporal")]; + _namespace setVariable ["SERGEANT", getText (_x >> "rank_sergeant")]; + _namespace setVariable ["LIEUTENANT", getText (_x >> "rank_lieutenant")]; + _namespace setVariable ["CAPTAIN", getText (_x >> "rank_captain")]; + _namespace setVariable ["MAJOR", getText (_x >> "rank_major")]; + _namespace setVariable ["COLONEL", getText (_x >> "rank_colonel")]; + _namespace setVariable ["buddy", getText (_x >> "buddy")]; + _namespace setVariable ["buddy_compass", getText (_x >> "buddy_compass")]; + + missionNamespace setVariable [format[QGVAR(icon_%1), _configName], _namespace] +} forEach (_configs + _missionConfigs); diff --git a/addons/main/script_component.hpp b/addons/main/script_component.hpp new file mode 100644 index 0000000..d8c910d --- /dev/null +++ b/addons/main/script_component.hpp @@ -0,0 +1,14 @@ +#define COMPONENT main +#include "\z\diwako_dui\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_MAIN + #define DEBUG_MODE_FULL +#endif +#ifdef DEBUG_SETTINGS_MAIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN +#endif + +#include "\z\diwako_dui\addons\main\script_macros.hpp" diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp new file mode 100644 index 0000000..34d55fe --- /dev/null +++ b/addons/main/script_macros.hpp @@ -0,0 +1,9 @@ +#include "\x\cba\addons\main\script_macros_common.hpp" +#define DFUNC(var1) TRIPLES(ADDON,fnc,var1) +#ifdef DISABLE_COMPILE_CACHE + #undef PREP + #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf) +#else + #undef PREP + #define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction +#endif diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp new file mode 100644 index 0000000..01f9599 --- /dev/null +++ b/addons/main/script_mod.hpp @@ -0,0 +1,9 @@ +#define MAINPREFIX z +#define PREFIX diwako_dui + +#include "script_version.hpp" + +#define VERSION MAJOR.MINOR.PATCHLVL.BUILD +#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD + +#define REQUIRED_VERSION 1.88 diff --git a/addons/main/script_version.hpp b/addons/main/script_version.hpp new file mode 100644 index 0000000..7ec0a0f --- /dev/null +++ b/addons/main/script_version.hpp @@ -0,0 +1,4 @@ +#define MAJOR 1 +#define MINOR 4 +#define PATCHLVL 0 +#define BUILD 8 diff --git a/mod/stringtable.xml b/addons/main/stringtable.xml similarity index 93% rename from mod/stringtable.xml rename to addons/main/stringtable.xml index f960cea..ee18cec 100644 --- a/mod/stringtable.xml +++ b/addons/main/stringtable.xml @@ -756,5 +756,65 @@ レイアウト エディタを使用して位置を変更します。 Usa a posição definida no editor de layout do jogo ao invés da posição padrão + + Occlusion Fade Time + + + Okklusionsüberblendzeit + + + + + + + Sets the time it takes for icons to fade away on the radar + + + Stellt die Zeit ein wie lange es dauert, bis ein Icon vom Radar verschwindet + + + + + + + Tracking Color + + + Tracking-Farbe + + + + + + + Special tracked objects appear in this color on the radar. Be warned the alpha value will do nothing! + + + Spezielle getrackte Objekte erscheinen in dieser Farbe auf dem Radar. Achtung, der Alpha-Wert wird nicht verwendet! + + + + + + + Vertical Padding Modifier + + + Vertikaler Padding Modifikator + + + + + + + Sets the vertical padding of single unit entries in the namelist + + + Setzt das vertikale Padding der einzelnen Einheiteneinträge in der Namensliste + + + + + diff --git a/addons/radar/$PBOPREFIX$ b/addons/radar/$PBOPREFIX$ new file mode 100644 index 0000000..171d1f1 --- /dev/null +++ b/addons/radar/$PBOPREFIX$ @@ -0,0 +1 @@ +z\diwako_dui\addons\radar diff --git a/addons/radar/CfgCompassStyles.hpp b/addons/radar/CfgCompassStyles.hpp new file mode 100644 index 0000000..fd4ea43 --- /dev/null +++ b/addons/radar/CfgCompassStyles.hpp @@ -0,0 +1,61 @@ +class diwako_dui_compass_style { + class standard { + name = "Standard"; + full = QPATHTO_T(UI\compass_styles\standard\compass.paa); + limited = QPATHTO_T(UI\compass_styles\standard\compass_limited.paa); + }; + + class bohemia { + name = "Bohemia Interactive"; + full = QPATHTO_T(UI\compass_styles\bi\compass.paa); + limited = QPATHTO_T(UI\compass_styles\bi\compass_limited.paa); + }; + + class pizza { + name = "Pizza Time"; + full = QPATHTO_T(UI\compass_styles\pizza\compass.paa); + limited = QPATHTO_T(UI\compass_styles\pizza\compass_limited.paa); + }; + + class olde { + name = "Ye Olde Times"; + full = QPATHTO_T(UI\compass_styles\olde\full.paa); + limited = QPATHTO_T(UI\compass_styles\olde\limited.paa); + }; + + class clock { + name = "Clock"; + full = QPATHTO_T(UI\compass_styles\clock\full.paa); + limited = QPATHTO_T(UI\compass_styles\clock\limited.paa); + }; + + class classic { + name = "Classic"; + full = QPATHTO_T(UI\compass_styles\classic\full.paa); + limited = QPATHTO_T(UI\compass_styles\classic\limited.paa); + }; + + class xeno_red { + name = "Xeno - Red"; + full = QPATHTO_T(UI\compass_styles\xeno\redf.paa); + limited = QPATHTO_T(UI\compass_styles\xeno\red.paa); + }; + + class xeno_green { + name = "Xeno - Green"; + full = QPATHTO_T(UI\compass_styles\xeno\greenf.paa); + limited = QPATHTO_T(UI\compass_styles\xeno\green.paa); + }; + + class xeno_blue { + name = "Xeno - Blue"; + full = QPATHTO_T(UI\compass_styles\xeno\bluef.paa); + limited = QPATHTO_T(UI\compass_styles\xeno\blue.paa); + }; + + class milint { + name = "Military Interface"; + full = QPATHTO_T(UI\compass_styles\milint\full.paa); + limited = QPATHTO_T(UI\compass_styles\milint\limited.paa); + }; +}; diff --git a/addons/radar/CfgEventHandlers.hpp b/addons/radar/CfgEventHandlers.hpp new file mode 100644 index 0000000..e90bed4 --- /dev/null +++ b/addons/radar/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/mod/CfgUIGrids.hpp b/addons/radar/CfgUIGrids.hpp similarity index 94% rename from mod/CfgUIGrids.hpp rename to addons/radar/CfgUIGrids.hpp index 03da065..ee0c430 100644 --- a/mod/CfgUIGrids.hpp +++ b/addons/radar/CfgUIGrids.hpp @@ -1,47 +1,47 @@ -class CfgUIGrids { - class IGUI { - class Presets { - class Arma3 { - class Variables { - diwako_dui_namelist[] = { - { - "0.5 + (pixelW * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) / 2 + 10))", - "safeZoneY + safeZoneH - (pixelH * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) + 10))", - "0.5 * safeZoneW - (pixelW * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) / 2 + 10))", - "pixelH * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) + 10)" - }, - "0.5*(((safezoneW / safezoneH) min 1.2)/ 40)", - "0.5*((((safezoneW / safezoneH) min 1.2)/ 1.2)/ 25)" - }; - diwako_dui_compass[] = { - { - "((0.5) * safezoneW + safezoneX) - (pixelW * 64 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1]))", - "safeZoneY + safeZoneH - (pixelH * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) + 10))", - "pixelW * (128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1]))", - "pixelH * (128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1]))" - }, - "0.5*(((safezoneW / safezoneH) min 1.2)/ 40)", - "0.5*((((safezoneW / safezoneH) min 1.2)/ 1.2)/ 25)" - }; - }; - }; - }; - - class Variables { - class diwako_dui_namelist { - displayName = "$STR_dui_cat_namelist"; - description = "$STR_dui_cat_namelist_desc"; - preview = "#(argb,8,8,3)color(0,0,0,0.75)"; - saveToProfile[] = {0,1}; - canResize = 0; - }; - class diwako_dui_compass { - displayName = "$STR_dui_cat_compass"; - description = "$STR_dui_cat_compass_desc"; - preview = "diwako_dui\UI\compass_styles\standard\compass.paa"; - saveToProfile[] = {0,1}; - canResize = 0; - }; - }; - }; -}; \ No newline at end of file +class CfgUIGrids { + class IGUI { + class Presets { + class Arma3 { + class Variables { + diwako_dui_namelist[] = { + { + "0.5 + (pixelW * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) / 2 + 10))", + "safeZoneY + safeZoneH - (pixelH * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) + 10))", + "0.5 * safeZoneW - (pixelW * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) / 2 + 10))", + "pixelH * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) + 10)" + }, + "0.5*(((safezoneW / safezoneH) min 1.2)/ 40)", + "0.5*((((safezoneW / safezoneH) min 1.2)/ 1.2)/ 25)" + }; + diwako_dui_compass[] = { + { + "((0.5) * safezoneW + safezoneX) - (pixelW * 64 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1]))", + "safeZoneY + safeZoneH - (pixelH * ((128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) + 10))", + "pixelW * (128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1]))", + "pixelH * (128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1]))" + }, + "0.5*(((safezoneW / safezoneH) min 1.2)/ 40)", + "0.5*((((safezoneW / safezoneH) min 1.2)/ 1.2)/ 25)" + }; + }; + }; + }; + + class Variables { + class diwako_dui_namelist { + displayName = "$STR_dui_cat_namelist"; + description = "$STR_dui_cat_namelist_desc"; + preview = "#(argb,8,8,3)color(0,0,0,0.75)"; + saveToProfile[] = {0,1}; + canResize = 0; + }; + class diwako_dui_compass { + displayName = "$STR_dui_cat_compass"; + description = "$STR_dui_cat_compass_desc"; + preview = QPATHTO_T(UI\compass_styles\standard\compass.paa); + saveToProfile[] = {0,1}; + canResize = 0; + }; + }; + }; +}; diff --git a/mod/RscCommon.hpp b/addons/radar/RscCommon.hpp similarity index 95% rename from mod/RscCommon.hpp rename to addons/radar/RscCommon.hpp index e5ba073..f74326b 100644 --- a/mod/RscCommon.hpp +++ b/addons/radar/RscCommon.hpp @@ -1,268 +1,268 @@ -// Control types -#define CT_STATIC 0 -#define CT_BUTTON 1 -#define CT_EDIT 2 -#define CT_SLIDER 3 -#define CT_COMBO 4 -#define CT_LISTBOX 5 -#define CT_TOOLBOX 6 -#define CT_CHECKBOXES 7 -#define CT_PROGRESS 8 -#define CT_HTML 9 -#define CT_STATIC_SKEW 10 -#define CT_ACTIVETEXT 11 -#define CT_TREE 12 -#define CT_STRUCTURED_TEXT 13 -#define CT_CONTEXT_MENU 14 -#define CT_CONTROLS_GROUP 15 -#define CT_SHORTCUTBUTTON 16 -#define CT_HITZONES 17 -#define CT_XKEYDESC 40 -#define CT_XBUTTON 41 -#define CT_XLISTBOX 42 -#define CT_XSLIDER 43 -#define CT_XCOMBO 44 -#define CT_ANIMATED_TEXTURE 45 -#define CT_OBJECT 80 -#define CT_OBJECT_ZOOM 81 -#define CT_OBJECT_CONTAINER 82 -#define CT_OBJECT_CONT_ANIM 83 -#define CT_LINEBREAK 98 -#define CT_USER 99 -#define CT_MAP 100 -#define CT_MAP_MAIN 101 -#define CT_LISTNBOX 102 -#define CT_ITEMSLOT 103 -#define CT_CHECKBOX 77 - -// Static styles -#define ST_POS 0x0F -#define ST_HPOS 0x03 -#define ST_VPOS 0x0C -#define ST_LEFT 0x00 -#define ST_RIGHT 0x01 -#define ST_CENTER 0x02 -#define ST_DOWN 0x04 -#define ST_UP 0x08 -#define ST_VCENTER 0x0C - -#define ST_TYPE 0xF0 -#define ST_SINGLE 0x00 -#define ST_MULTI 0x10 -#define ST_TITLE_BAR 0x20 -#define ST_PICTURE 0x30 -#define ST_FRAME 0x40 -#define ST_BACKGROUND 0x50 -#define ST_GROUP_BOX 0x60 -#define ST_GROUP_BOX2 0x70 -#define ST_HUD_BACKGROUND 0x80 -#define ST_TILE_PICTURE 0x90 -#define ST_WITH_RECT 0xA0 -#define ST_LINE 0xB0 -#define ST_UPPERCASE 0xC0 -#define ST_LOWERCASE 0xD0 - -#define ST_SHADOW 0x100 -#define ST_NO_RECT 0x200 -#define ST_KEEP_ASPECT_RATIO 0x800 - -// Slider styles -#define SL_DIR 0x400 -#define SL_VERT 0 -#define SL_HORZ 0x400 - -#define SL_TEXTURES 0x10 - -// progress bar -#define ST_VERTICAL 0x01 -#define ST_HORIZONTAL 0 - -// Listbox styles -#define LB_TEXTURES 0x10 -#define LB_MULTI 0x20 - -// Tree styles -#define TR_SHOWROOT 1 -#define TR_AUTOCOLLAPSE 2 - -// Default grid -#define GUI_GRID_WAbs ((safezoneW / safezoneH) min 1.2) -#define GUI_GRID_HAbs (GUI_GRID_WAbs / 1.2) -#define GUI_GRID_W (GUI_GRID_WAbs / 40) -#define GUI_GRID_H (GUI_GRID_HAbs / 25) -#define GUI_GRID_X (safezoneX) -#define GUI_GRID_Y (safezoneY + safezoneH - GUI_GRID_HAbs) - -// Default text sizes -#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8) -#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1) -#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2) - -class ScrollBar; -class RscObject; -class RscText; -class RscTextSmall; -class RscTitle; -class RscProgress; -class RscProgressNotFreeze; -class RscPicture; -class RscLadderPicture; -class RscPictureKeepAspect; -class RscHTML; -class RscButton; -class RscShortcutButton; -class RscButtonSmall; -class RscEdit; -class RscCombo; -class RscListBox; -class RscListNBox; -class RscXListBox; -class RscTree; -class RscSlider; -class RscSliderH; -class RscXSliderH; -class RscActiveText; -class RscStructuredText; -class RscControlsGroup; -class RscToolbox; -class RscMapControl; -class RscCheckBox; -class RscFrame; -class ctrlDefault; -class ctrlControlsGroup; -class ctrlDefaultText; -class ctrlDefaultButton; -class RscBackgroundStripeTop; -class RscBackgroundStripeBottom; -class RscIGText; -class RscIGProgress; -class RscListBoxKeys; -class RscControlsGroupNoScrollbars; -class RscControlsGroupNoHScrollbars; -class RscControlsGroupNoVScrollbars; -class RscLine; -class RscActivePicture; -class RscButtonTextOnly; -class RscShortcutButtonMain; -class RscButtonEditor; -class RscIGUIShortcutButton; -class RscGearShortcutButton; -class RscButtonMenu; -class RscButtonMenuOK; -class RscButtonMenuCancel; -class RscButtonMenuSteam; -class RscLoadingText; -class RscIGUIListBox; -class RscIGUIListNBox; -class RscBackground; -class RscBackgroundGUI; -class RscBackgroundGUILeft; -class RscBackgroundGUIRight; -class RscBackgroundGUIBottom; -class RscBackgroundGUITop; -class RscBackgroundGUIDark; -class RscBackgroundLogo; -class RscMapControlEmpty; -class RscVignette; -class CA_Mainback; -class CA_Back; -class CA_Title_Back; -class CA_Black_Back; -class CA_Title; -class CA_Logo; -class CA_Logo_Small; -class CA_RscButton; -class CA_RscButton_dialog; -class CA_Ok; -class CA_Ok_image; -class CA_Ok_image2; -class CA_Ok_text; -class ctrlCheckbox; -class ctrlCheckboxBaseline; -class ctrlStatic; -class ctrlControlsGroupNoScrollbars; -class ctrlStructuredText; -class RscTextMulti; -class RscTreeSearch; -class RscVideo; -class RscVideoKeepAspect; -class RscActivePictureKeepAspect; -class RscEditMulti; -class RscMapSignalBackground; -class RscMapSignalPicture; -class RscMapSignalText; -class RscColorPicker; -class RscInterlacingScreen; -class RscFeedback; -class RscTrafficLight; -class RscButtonSearch; -class RscIGUIText; -class RscOpticsText; -class RscOpticsValue; -class RscIGUIValue; -class RscButtonMenuMain; -class RscButtonTestCentered; -class RscDisplaySingleMission_ChallengeOverviewGroup; -class RscDisplayDebriefing_RscTextMultiline; -class RscDisplayDebriefing_ListGroup; -class RscButtonArsenal; -class RscTextNoShadow; -class RscButtonNoColor; -class RscToolboxButton; -class ctrlStaticPicture; -class ctrlStaticPictureKeepAspect; -class ctrlStaticPictureTile; -class ctrlStaticFrame; -class ctrlStaticLine; -class ctrlStaticMulti; -class ctrlStaticBackground; -class ctrlStaticOverlay; -class ctrlStaticTitle; -class ctrlStaticFooter; -class ctrlStaticBackgroundDisable; -class ctrlStaticBackgroundDisableTiles; -class ctrlButton; -class ctrlButtonPicture; -class ctrlButtonPictureKeepAspect; -class ctrlButtonOK; -class ctrlButtonCancel; -class ctrlButtonClose; -class ctrlButtonToolbar; -class ctrlButtonSearch; -class ctrlButtonExpandAll; -class ctrlButtonCollapseAll; -class ctrlButtonFilter; -class ctrlEdit; -class ctrlEditMulti; -class ctrlSliderV; -class ctrlSliderH; -class ctrlCombo; -class ctrlComboToolbar; -class ctrlListbox; -class ctrlToolbox; -class ctrlToolboxPicture; -class ctrlToolboxPictureKeepAspect; -class ctrlCheckboxes; -class ctrlCheckboxesCheckbox; -class ctrlProgress; -class ctrlHTML; -class ctrlActiveText; -class ctrlActivePicture; -class ctrlActivePictureKeepAspect; -class ctrlTree; -class ctrlControlsGroupNoHScrollbars; -class ctrlControlsGroupNoVScrollbars; -class ctrlShortcutButton; -class ctrlShortcutButtonOK; -class ctrlShortcutButtonCancel; -class ctrlShortcutButtonSteam; -class ctrlXListbox; -class ctrlXSliderV; -class ctrlXSliderH; -class ctrlMenu; -class ctrlMenuStrip; -class ctrlMap; -class ctrlMapEmpty; -class ctrlMapMain; -class ctrlListNBox; -class ctrlCheckboxToolbar; \ No newline at end of file +// Control types +#define CT_STATIC 0 +#define CT_BUTTON 1 +#define CT_EDIT 2 +#define CT_SLIDER 3 +#define CT_COMBO 4 +#define CT_LISTBOX 5 +#define CT_TOOLBOX 6 +#define CT_CHECKBOXES 7 +#define CT_PROGRESS 8 +#define CT_HTML 9 +#define CT_STATIC_SKEW 10 +#define CT_ACTIVETEXT 11 +#define CT_TREE 12 +#define CT_STRUCTURED_TEXT 13 +#define CT_CONTEXT_MENU 14 +#define CT_CONTROLS_GROUP 15 +#define CT_SHORTCUTBUTTON 16 +#define CT_HITZONES 17 +#define CT_XKEYDESC 40 +#define CT_XBUTTON 41 +#define CT_XLISTBOX 42 +#define CT_XSLIDER 43 +#define CT_XCOMBO 44 +#define CT_ANIMATED_TEXTURE 45 +#define CT_OBJECT 80 +#define CT_OBJECT_ZOOM 81 +#define CT_OBJECT_CONTAINER 82 +#define CT_OBJECT_CONT_ANIM 83 +#define CT_LINEBREAK 98 +#define CT_USER 99 +#define CT_MAP 100 +#define CT_MAP_MAIN 101 +#define CT_LISTNBOX 102 +#define CT_ITEMSLOT 103 +#define CT_CHECKBOX 77 + +// Static styles +#define ST_POS 0x0F +#define ST_HPOS 0x03 +#define ST_VPOS 0x0C +#define ST_LEFT 0x00 +#define ST_RIGHT 0x01 +#define ST_CENTER 0x02 +#define ST_DOWN 0x04 +#define ST_UP 0x08 +#define ST_VCENTER 0x0C + +#define ST_TYPE 0xF0 +#define ST_SINGLE 0x00 +#define ST_MULTI 0x10 +#define ST_TITLE_BAR 0x20 +#define ST_PICTURE 0x30 +#define ST_FRAME 0x40 +#define ST_BACKGROUND 0x50 +#define ST_GROUP_BOX 0x60 +#define ST_GROUP_BOX2 0x70 +#define ST_HUD_BACKGROUND 0x80 +#define ST_TILE_PICTURE 0x90 +#define ST_WITH_RECT 0xA0 +#define ST_LINE 0xB0 +#define ST_UPPERCASE 0xC0 +#define ST_LOWERCASE 0xD0 + +#define ST_SHADOW 0x100 +#define ST_NO_RECT 0x200 +#define ST_KEEP_ASPECT_RATIO 0x800 + +// Slider styles +#define SL_DIR 0x400 +#define SL_VERT 0 +#define SL_HORZ 0x400 + +#define SL_TEXTURES 0x10 + +// progress bar +#define ST_VERTICAL 0x01 +#define ST_HORIZONTAL 0 + +// Listbox styles +#define LB_TEXTURES 0x10 +#define LB_MULTI 0x20 + +// Tree styles +#define TR_SHOWROOT 1 +#define TR_AUTOCOLLAPSE 2 + +// Default grid +#define GUI_GRID_WAbs ((safezoneW / safezoneH) min 1.2) +#define GUI_GRID_HAbs (GUI_GRID_WAbs / 1.2) +#define GUI_GRID_W (GUI_GRID_WAbs / 40) +#define GUI_GRID_H (GUI_GRID_HAbs / 25) +#define GUI_GRID_X (safezoneX) +#define GUI_GRID_Y (safezoneY + safezoneH - GUI_GRID_HAbs) + +// Default text sizes +#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8) +#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1) +#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2) + +class ScrollBar; +class RscObject; +class RscText; +class RscTextSmall; +class RscTitle; +class RscProgress; +class RscProgressNotFreeze; +class RscPicture; +class RscLadderPicture; +class RscPictureKeepAspect; +class RscHTML; +class RscButton; +class RscShortcutButton; +class RscButtonSmall; +class RscEdit; +class RscCombo; +class RscListBox; +class RscListNBox; +class RscXListBox; +class RscTree; +class RscSlider; +class RscSliderH; +class RscXSliderH; +class RscActiveText; +class RscStructuredText; +class RscControlsGroup; +class RscToolbox; +class RscMapControl; +class RscCheckBox; +class RscFrame; +class ctrlDefault; +class ctrlControlsGroup; +class ctrlDefaultText; +class ctrlDefaultButton; +class RscBackgroundStripeTop; +class RscBackgroundStripeBottom; +class RscIGText; +class RscIGProgress; +class RscListBoxKeys; +class RscControlsGroupNoScrollbars; +class RscControlsGroupNoHScrollbars; +class RscControlsGroupNoVScrollbars; +class RscLine; +class RscActivePicture; +class RscButtonTextOnly; +class RscShortcutButtonMain; +class RscButtonEditor; +class RscIGUIShortcutButton; +class RscGearShortcutButton; +class RscButtonMenu; +class RscButtonMenuOK; +class RscButtonMenuCancel; +class RscButtonMenuSteam; +class RscLoadingText; +class RscIGUIListBox; +class RscIGUIListNBox; +class RscBackground; +class RscBackgroundGUI; +class RscBackgroundGUILeft; +class RscBackgroundGUIRight; +class RscBackgroundGUIBottom; +class RscBackgroundGUITop; +class RscBackgroundGUIDark; +class RscBackgroundLogo; +class RscMapControlEmpty; +class RscVignette; +class CA_Mainback; +class CA_Back; +class CA_Title_Back; +class CA_Black_Back; +class CA_Title; +class CA_Logo; +class CA_Logo_Small; +class CA_RscButton; +class CA_RscButton_dialog; +class CA_Ok; +class CA_Ok_image; +class CA_Ok_image2; +class CA_Ok_text; +class ctrlCheckbox; +class ctrlCheckboxBaseline; +class ctrlStatic; +class ctrlControlsGroupNoScrollbars; +class ctrlStructuredText; +class RscTextMulti; +class RscTreeSearch; +class RscVideo; +class RscVideoKeepAspect; +class RscActivePictureKeepAspect; +class RscEditMulti; +class RscMapSignalBackground; +class RscMapSignalPicture; +class RscMapSignalText; +class RscColorPicker; +class RscInterlacingScreen; +class RscFeedback; +class RscTrafficLight; +class RscButtonSearch; +class RscIGUIText; +class RscOpticsText; +class RscOpticsValue; +class RscIGUIValue; +class RscButtonMenuMain; +class RscButtonTestCentered; +class RscDisplaySingleMission_ChallengeOverviewGroup; +class RscDisplayDebriefing_RscTextMultiline; +class RscDisplayDebriefing_ListGroup; +class RscButtonArsenal; +class RscTextNoShadow; +class RscButtonNoColor; +class RscToolboxButton; +class ctrlStaticPicture; +class ctrlStaticPictureKeepAspect; +class ctrlStaticPictureTile; +class ctrlStaticFrame; +class ctrlStaticLine; +class ctrlStaticMulti; +class ctrlStaticBackground; +class ctrlStaticOverlay; +class ctrlStaticTitle; +class ctrlStaticFooter; +class ctrlStaticBackgroundDisable; +class ctrlStaticBackgroundDisableTiles; +class ctrlButton; +class ctrlButtonPicture; +class ctrlButtonPictureKeepAspect; +class ctrlButtonOK; +class ctrlButtonCancel; +class ctrlButtonClose; +class ctrlButtonToolbar; +class ctrlButtonSearch; +class ctrlButtonExpandAll; +class ctrlButtonCollapseAll; +class ctrlButtonFilter; +class ctrlEdit; +class ctrlEditMulti; +class ctrlSliderV; +class ctrlSliderH; +class ctrlCombo; +class ctrlComboToolbar; +class ctrlListbox; +class ctrlToolbox; +class ctrlToolboxPicture; +class ctrlToolboxPictureKeepAspect; +class ctrlCheckboxes; +class ctrlCheckboxesCheckbox; +class ctrlProgress; +class ctrlHTML; +class ctrlActiveText; +class ctrlActivePicture; +class ctrlActivePictureKeepAspect; +class ctrlTree; +class ctrlControlsGroupNoHScrollbars; +class ctrlControlsGroupNoVScrollbars; +class ctrlShortcutButton; +class ctrlShortcutButtonOK; +class ctrlShortcutButtonCancel; +class ctrlShortcutButtonSteam; +class ctrlXListbox; +class ctrlXSliderV; +class ctrlXSliderH; +class ctrlMenu; +class ctrlMenuStrip; +class ctrlMap; +class ctrlMapEmpty; +class ctrlMapMain; +class ctrlListNBox; +class ctrlCheckboxToolbar; diff --git a/mod/UI/compass_styles/bi/SquadRadarBackgroundTexture_ca.psd b/addons/radar/UI/compass_styles/bi/SquadRadarBackgroundTexture_ca.psd similarity index 100% rename from mod/UI/compass_styles/bi/SquadRadarBackgroundTexture_ca.psd rename to addons/radar/UI/compass_styles/bi/SquadRadarBackgroundTexture_ca.psd diff --git a/mod/UI/compass_styles/bi/compass.paa b/addons/radar/UI/compass_styles/bi/compass.paa similarity index 100% rename from mod/UI/compass_styles/bi/compass.paa rename to addons/radar/UI/compass_styles/bi/compass.paa diff --git a/mod/UI/compass_styles/bi/compass_limited.paa b/addons/radar/UI/compass_styles/bi/compass_limited.paa similarity index 100% rename from mod/UI/compass_styles/bi/compass_limited.paa rename to addons/radar/UI/compass_styles/bi/compass_limited.paa diff --git a/mod/UI/compass_styles/classic/SquadRadarBackgroundTexture_camod.psd b/addons/radar/UI/compass_styles/classic/SquadRadarBackgroundTexture_camod.psd similarity index 100% rename from mod/UI/compass_styles/classic/SquadRadarBackgroundTexture_camod.psd rename to addons/radar/UI/compass_styles/classic/SquadRadarBackgroundTexture_camod.psd diff --git a/mod/UI/compass_styles/classic/full.paa b/addons/radar/UI/compass_styles/classic/full.paa similarity index 100% rename from mod/UI/compass_styles/classic/full.paa rename to addons/radar/UI/compass_styles/classic/full.paa diff --git a/mod/UI/compass_styles/classic/limited.paa b/addons/radar/UI/compass_styles/classic/limited.paa similarity index 100% rename from mod/UI/compass_styles/classic/limited.paa rename to addons/radar/UI/compass_styles/classic/limited.paa diff --git a/mod/UI/compass_styles/clock/clock.psd b/addons/radar/UI/compass_styles/clock/clock.psd similarity index 100% rename from mod/UI/compass_styles/clock/clock.psd rename to addons/radar/UI/compass_styles/clock/clock.psd diff --git a/mod/UI/compass_styles/clock/full.paa b/addons/radar/UI/compass_styles/clock/full.paa similarity index 100% rename from mod/UI/compass_styles/clock/full.paa rename to addons/radar/UI/compass_styles/clock/full.paa diff --git a/mod/UI/compass_styles/clock/limited.paa b/addons/radar/UI/compass_styles/clock/limited.paa similarity index 100% rename from mod/UI/compass_styles/clock/limited.paa rename to addons/radar/UI/compass_styles/clock/limited.paa diff --git a/mod/UI/compass_styles/milint/compass_milint.psd b/addons/radar/UI/compass_styles/milint/compass_milint.psd similarity index 100% rename from mod/UI/compass_styles/milint/compass_milint.psd rename to addons/radar/UI/compass_styles/milint/compass_milint.psd diff --git a/mod/UI/compass_styles/milint/full.paa b/addons/radar/UI/compass_styles/milint/full.paa similarity index 100% rename from mod/UI/compass_styles/milint/full.paa rename to addons/radar/UI/compass_styles/milint/full.paa diff --git a/mod/UI/compass_styles/milint/limited.paa b/addons/radar/UI/compass_styles/milint/limited.paa similarity index 100% rename from mod/UI/compass_styles/milint/limited.paa rename to addons/radar/UI/compass_styles/milint/limited.paa diff --git a/mod/UI/compass_styles/olde/full.paa b/addons/radar/UI/compass_styles/olde/full.paa similarity index 100% rename from mod/UI/compass_styles/olde/full.paa rename to addons/radar/UI/compass_styles/olde/full.paa diff --git a/mod/UI/compass_styles/olde/limited.paa b/addons/radar/UI/compass_styles/olde/limited.paa similarity index 100% rename from mod/UI/compass_styles/olde/limited.paa rename to addons/radar/UI/compass_styles/olde/limited.paa diff --git a/mod/UI/compass_styles/olde/olde.psd b/addons/radar/UI/compass_styles/olde/olde.psd similarity index 100% rename from mod/UI/compass_styles/olde/olde.psd rename to addons/radar/UI/compass_styles/olde/olde.psd diff --git a/mod/UI/compass_styles/pizza/compass.paa b/addons/radar/UI/compass_styles/pizza/compass.paa similarity index 100% rename from mod/UI/compass_styles/pizza/compass.paa rename to addons/radar/UI/compass_styles/pizza/compass.paa diff --git a/mod/UI/compass_styles/pizza/compass_limited.paa b/addons/radar/UI/compass_styles/pizza/compass_limited.paa similarity index 100% rename from mod/UI/compass_styles/pizza/compass_limited.paa rename to addons/radar/UI/compass_styles/pizza/compass_limited.paa diff --git a/mod/UI/compass_styles/pizza/pie.psd b/addons/radar/UI/compass_styles/pizza/pie.psd similarity index 100% rename from mod/UI/compass_styles/pizza/pie.psd rename to addons/radar/UI/compass_styles/pizza/pie.psd diff --git a/mod/UI/compass_styles/standard/compass.paa b/addons/radar/UI/compass_styles/standard/compass.paa similarity index 100% rename from mod/UI/compass_styles/standard/compass.paa rename to addons/radar/UI/compass_styles/standard/compass.paa diff --git a/mod/UI/compass_styles/standard/compass.psd b/addons/radar/UI/compass_styles/standard/compass.psd similarity index 100% rename from mod/UI/compass_styles/standard/compass.psd rename to addons/radar/UI/compass_styles/standard/compass.psd diff --git a/mod/UI/compass_styles/standard/compass_limited.paa b/addons/radar/UI/compass_styles/standard/compass_limited.paa similarity index 100% rename from mod/UI/compass_styles/standard/compass_limited.paa rename to addons/radar/UI/compass_styles/standard/compass_limited.paa diff --git a/mod/UI/compass_styles/xeno/blue.paa b/addons/radar/UI/compass_styles/xeno/blue.paa similarity index 100% rename from mod/UI/compass_styles/xeno/blue.paa rename to addons/radar/UI/compass_styles/xeno/blue.paa diff --git a/mod/UI/compass_styles/xeno/bluef.paa b/addons/radar/UI/compass_styles/xeno/bluef.paa similarity index 100% rename from mod/UI/compass_styles/xeno/bluef.paa rename to addons/radar/UI/compass_styles/xeno/bluef.paa diff --git a/mod/UI/compass_styles/xeno/green.paa b/addons/radar/UI/compass_styles/xeno/green.paa similarity index 100% rename from mod/UI/compass_styles/xeno/green.paa rename to addons/radar/UI/compass_styles/xeno/green.paa diff --git a/mod/UI/compass_styles/xeno/greenf.paa b/addons/radar/UI/compass_styles/xeno/greenf.paa similarity index 100% rename from mod/UI/compass_styles/xeno/greenf.paa rename to addons/radar/UI/compass_styles/xeno/greenf.paa diff --git a/mod/UI/compass_styles/xeno/red.paa b/addons/radar/UI/compass_styles/xeno/red.paa similarity index 100% rename from mod/UI/compass_styles/xeno/red.paa rename to addons/radar/UI/compass_styles/xeno/red.paa diff --git a/mod/UI/compass_styles/xeno/redf.paa b/addons/radar/UI/compass_styles/xeno/redf.paa similarity index 100% rename from mod/UI/compass_styles/xeno/redf.paa rename to addons/radar/UI/compass_styles/xeno/redf.paa diff --git a/mod/UI/compass_styles/xeno/xeno.psd b/addons/radar/UI/compass_styles/xeno/xeno.psd similarity index 100% rename from mod/UI/compass_styles/xeno/xeno.psd rename to addons/radar/UI/compass_styles/xeno/xeno.psd diff --git a/addons/radar/XEH_PREP.hpp b/addons/radar/XEH_PREP.hpp new file mode 100644 index 0000000..1027d53 --- /dev/null +++ b/addons/radar/XEH_PREP.hpp @@ -0,0 +1,7 @@ +PREP(cacheLoop); +PREP(compass); +PREP(displayUnitOnCompass); +PREP(getIcon); +PREP(pairBuddies); +PREP(rangeButton); +PREP(setCustomCode); diff --git a/addons/radar/XEH_postInit.sqf b/addons/radar/XEH_postInit.sqf new file mode 100644 index 0000000..b4162d2 --- /dev/null +++ b/addons/radar/XEH_postInit.sqf @@ -0,0 +1,64 @@ +#include "script_component.hpp" +if (is3DEN || !hasInterface) exitWith {}; + +GVAR(uiPixels) = DUI_128PX; + +GVAR(a3UiScale) = linearConversion [0.55,0.7,getResolution # 5,1,0.85,false]; +GVAR(windowHeightMod) = linearConversion [1080,1440,getResolution # 1,1,0.75,false]; +GVAR(bearing_size_calc) = diwako_dui_dir_size * GVAR(a3UiScale) * diwako_dui_hudScaling * GVAR(windowHeightMod); +GVAR(vehicleNamespace) = [] call CBA_fnc_createNamespace; + +if !(isNil "ace_nightvision") then { + "ace_nightvision_display" cutFadeOut 0; +}; + +"diwako_dui_compass" cutFadeOut 0; +"diwako_dui_namebox" cutFadeOut 0; + +// start the loop +[] call FUNC(cacheLoop); + +private _labelAdd = localize "STR_dui_buddy_action"; +private _labelRemove = localize "STR_dui_buddy_action_remove"; +private _range = 10; +if (isNil "ace_interact_menu_fnc_createAction") then { + [[_labelAdd, { + [player, cursorObject] call FUNC(pairBuddies); + }, [], -5000, false, true, "", format ["cursorObject distance2d player <= %1 && {cursorObject in (units group player) && {(player getVariable ["QGVAR(buddy)", objNull]) != cursorObject}}", _range]]] call CBA_fnc_addPlayerAction; + + [[_labelRemove, { + [player, cursorObject, false] call FUNC(pairBuddies); + }, [], -5000, false, true, "", format ["cursorObject distance2d player <= %1 && {cursorObject in (units group player) && {(player getVariable ["QGVAR(buddy)", objNull]) == cursorObject}}", _range]]] call CBA_fnc_addPlayerAction; +} else { + private _action = [QGVAR(buddy_action), _labelAdd, "", { + [ace_player, _target] call FUNC(pairBuddies); + },{_target in (units group ace_player) && {(ace_player getVariable [QGVAR(buddy), objNull]) != _target}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction; + + ["CAManBase", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass; + + private _action = [QGVAR(buddy_action_remove), _labelRemove, "", { + [ace_player, _target, false] call FUNC(pairBuddies); + },{_target in (units group ace_player) && {(ace_player getVariable [QGVAR(buddy), objNull]) == _target}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction; + + ["CAManBase", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass; +}; + +[QEGVAR(main,hudToggled), { + params ["_toggledOff"]; + if (_toggledOff) then { + // set position and size for namelist and compass + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; + }; +}] call CBA_fnc_addEventHandler; + +[QEGVAR(main,refreshUI), { + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; +}] call CBA_fnc_addEventHandler; + +[QGVAR(refreshUI), { + GVAR(setCompass) = true; + GVAR(setNamelist) = true; + for "_i" from 0 to (count GVAR(namebox_lists)) do { + ctrlDelete ctrlParentControlsGroup (GVAR(namebox_lists) deleteAt 0); + }; +}] call CBA_fnc_addEventHandler; diff --git a/mod/functions/fn_preinit.sqf b/addons/radar/XEH_preInit.sqf similarity index 65% rename from mod/functions/fn_preinit.sqf rename to addons/radar/XEH_preInit.sqf index 4b827d5..c2abb21 100644 --- a/mod/functions/fn_preinit.sqf +++ b/addons/radar/XEH_preInit.sqf @@ -1,93 +1,18 @@ -#include "\a3\ui_f\hpp\defineDIKCodes.inc" -#include "../script_component.hpp" -#define CBA_SETTINGS_CAT localize "STR_dui_mod" - -diwako_dui_group = []; -diwako_dui_compass_pfHandle = -1; -diwako_dui_namebox_lists = []; -diwako_dui_toggled_off = false; -diwako_dui_showRank = false; -diwako_dui_inFeatureCamera = false; -diwako_dui_setCompass = true; -diwako_dui_setNamelist = true; - -private _curCat = localize "STR_dui_cat_general"; +#include "script_component.hpp" +ADDON = false; +#include "XEH_PREP.hpp" -private _availableFonts = [ - "PuristaBold", - "PuristaLight", - "PuristaMedium", - "PuristaSemibold", - "RobotoCondensed", - "RobotoCondensedBold", - "RobotoCondensedLight", - "EtelkaMonospacePro", - // "EtelkaMonospaceProBold", - // "EtelkaNarrowMediumPro", - "LCD14" - // "TahomaB" -]; - -[ - "diwako_dui_font" - ,"LIST" - ,[localize "STR_dui_font", localize "STR_dui_font_desc"] - ,[CBA_SETTINGS_CAT, _curCat] - ,[ - _availableFonts, - _availableFonts, - 4 - ] - ,false - ,{ - diwako_dui_setCompass = true; - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; - } -] call CBA_Settings_fnc_init; - -// include the sqf file as the compiled cfgfunction is not available during some preinit events -#include "fn_getIconStyles.sqf" -[ - "diwako_dui_icon_style" - ,"LIST" - ,[localize "STR_dui_icon", localize "STR_dui_icon_desc"] - ,[CBA_SETTINGS_CAT, _curCat] - ,[ - _iconIdent, - _iconNames, - 0 - ] - ,false -] call CBA_Settings_fnc_init; +#include "\a3\ui_f\hpp\defineDIKCodes.inc" +#define CBA_SETTINGS_CAT localize "STR_dui_mod" + " - Radar" -#include "fn_getColorStyles.sqf" -[ - "diwako_dui_colors" - ,"LIST" - ,[localize "STR_dui_color", localize "STR_dui_color_desc"] - ,[CBA_SETTINGS_CAT, _curCat] - ,[ - _colorIdent, - _colorNames, - 0 - ] - ,false -] call CBA_Settings_fnc_init; +GVAR(group) = []; +GVAR(compass_pfHandle) = -1; +GVAR(namebox_lists) = []; +GVAR(showRank) = false; +GVAR(setCompass) = true; +GVAR(setNamelist) = true; -if (isClass(configfile >> "CfgPatches" >> "ace_interact_menu")) then { - [ - "diwako_dui_ace_hide_interaction" - ,"CHECKBOX" - ,[localize "STR_dui_ace_hide_interaction", localize "STR_dui_ace_hide_interaction_desc"] - ,[CBA_SETTINGS_CAT, _curCat] - ,true - ,false - ] call CBA_Settings_fnc_init; -} else { - diwako_dui_ace_hide_interaction = false; -}; +private _curCat = localize "STR_dui_cat_general"; [ "diwako_dui_show_squadbar" @@ -146,11 +71,11 @@ private _curCat = localize "STR_dui_cat_compass"; ,[0, 3, 1.25, 2] ,false ,{ - diwako_dui_setCompass = true; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; } ] call CBA_Settings_fnc_init; -#include "fn_getCompassStyles.sqf" +#include "include\getCompassStyles.sqf" [ "diwako_dui_compass_style" ,"LIST" @@ -163,7 +88,7 @@ private _curCat = localize "STR_dui_cat_compass"; ] ,false ,{ - diwako_dui_setCompass = true; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; } ] call CBA_Settings_fnc_init; @@ -185,8 +110,8 @@ private _curCat = localize "STR_dui_cat_compass"; ,false ,{ params ["_value"]; - if (diwako_dui_compass_pfHandle > -1) then { - private _index = CBA_common_PFHhandles param [diwako_dui_compass_pfHandle]; + if (GVAR(compass_pfHandle) > -1) then { + private _index = CBA_common_PFHhandles param [GVAR(compass_pfHandle)]; (CBA_common_perFrameHandlerArray select _index) set [1, _value]; }; } @@ -210,10 +135,19 @@ private _curCat = localize "STR_dui_cat_compass"; ,false ,{ params ["_value"]; - diwako_dui_enable_occlusion_actual_cone = _value / 2; + GVAR(enable_occlusion_actual_cone) = _value / 2; } ] call CBA_Settings_fnc_init; +[ + QGVAR(occlusion_fade_time) + ,"SLIDER" + ,[localize "STR_dui_occlusion_fade_time", localize "STR_dui_occlusion_fade_time_desc"] + ,[CBA_SETTINGS_CAT, _curCat] + ,[2, 60, 10, 1] + ,false +] call CBA_Settings_fnc_init; + [ "diwako_dui_compass_icon_scale" ,"SLIDER" @@ -231,7 +165,7 @@ private _curCat = localize "STR_dui_cat_compass"; ,[0, 1, 1, 2] ,false ,{ - diwako_dui_setCompass = true; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; } ] call CBA_Settings_fnc_init; @@ -262,6 +196,15 @@ private _curCat = localize "STR_dui_cat_compass"; ,false ] call CBA_Settings_fnc_init; +[ + QGVAR(trackingColor) + ,"COLOR" + ,[localize "STR_dui_trackingColor_time", localize "STR_dui_trackingColor_desc"] + ,[CBA_SETTINGS_CAT, _curCat] + ,[0.93, 0.26, 0.93, 1] + ,false +] call CBA_settings_fnc_init; + // todo display to change the position in-game (should reset to center of screen)(0.5,0.5) // todo keydown or option for ^ (or addAction(resets after use)) // save it in profileNamespace @@ -278,7 +221,7 @@ private _curCat = localize "STR_dui_cat_namelist"; ,true ,false ,{ - diwako_dui_setNamelist = true; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; } ] call CBA_Settings_fnc_init; @@ -289,6 +232,9 @@ private _curCat = localize "STR_dui_cat_namelist"; ,[CBA_SETTINGS_CAT, _curCat] ,[0.5, 3, 1, 3] ,false + ,{ + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; + } ] call CBA_Settings_fnc_init; [ @@ -299,9 +245,7 @@ private _curCat = localize "STR_dui_cat_namelist"; ,[0, 1, 0, 2] ,false ,{ - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; } ] call CBA_Settings_fnc_init; @@ -323,12 +267,19 @@ private _curCat = localize "STR_dui_cat_namelist"; ,[100, 500, 215, 0] ,false ,{ - params ["_value"]; - diwako_dui_setNamelist = true; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; + } +] call CBA_Settings_fnc_init; - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; +[ + QGVAR(namelist_vertical_spacing) + ,"SLIDER" + ,[localize "STR_dui_namelist_vertical_spacing", localize "STR_dui_namelist_vertical_spacing_desc"] + ,[CBA_SETTINGS_CAT, _curCat] + ,[0, 5, 1, 3] + ,false + ,{ + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; } ] call CBA_Settings_fnc_init; @@ -348,7 +299,7 @@ private _curCat = localize "STR_dui_cat_namelist"; ] ,false ,{ - diwako_dui_setCompass = true; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; } ] call CBA_Settings_fnc_init; @@ -362,13 +313,9 @@ private _curCat = localize "STR_dui_cat_namelist"; ,false ,{ params ["_value"]; - diwako_dui_setCompass = true; - diwako_dui_setNamelist = true; - diwako_dui_uiPixels = 128 * _value; + GVAR(uiPixels) = 128 * _value; - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; // reset size for arma ui editor profileNamespace setVariable ["igui_diwako_dui_compass_h", nil]; @@ -388,12 +335,7 @@ private _curCat = localize "STR_dui_cat_layout"; ,false ,false ,{ - diwako_dui_setCompass = true; - diwako_dui_setNamelist = true; - - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; } ] call CBA_Settings_fnc_init; @@ -411,62 +353,50 @@ private _curCat = localize "STR_dui_cat_layout"; ["diwako_dui_reset_ui_pos", false, 0, "mission", true] call CBA_settings_fnc_set; ["diwako_dui_reset_ui_pos", false, 0, "client", true] call CBA_settings_fnc_set; profileNamespace setVariable ["igui_diwako_dui_compass_w", nil]; - profileNamespace setVariable ["igui_diwako_dui_compass_x", 0.5 - (pixelW * (diwako_dui_uiPixels / 2))]; - profileNamespace setVariable ["igui_diwako_dui_compass_y", safeZoneY + safeZoneH - (pixelH * (diwako_dui_uiPixels + 10))]; + profileNamespace setVariable ["igui_diwako_dui_compass_x", 0.5 - (pixelW * (GVAR(uiPixels) / 2))]; + profileNamespace setVariable ["igui_diwako_dui_compass_y", safeZoneY + safeZoneH - (pixelH * (GVAR(uiPixels) + 10))]; profileNamespace setVariable ["igui_diwako_dui_compass_h", nil]; profileNamespace setVariable ["igui_diwako_dui_namelist_w", nil]; - profileNamespace setVariable ["igui_diwako_dui_namelist_x", 0.5 + (pixelW * (diwako_dui_uiPixels / 2 + 10))]; - profileNamespace setVariable ["igui_diwako_dui_namelist_y", safeZoneY + safeZoneH - (pixelH * (diwako_dui_uiPixels + 10))]; + profileNamespace setVariable ["igui_diwako_dui_namelist_x", 0.5 + (pixelW * (GVAR(uiPixels) / 2 + 10))]; + profileNamespace setVariable ["igui_diwako_dui_namelist_y", safeZoneY + safeZoneH - (pixelH * (GVAR(uiPixels) + 10))]; profileNamespace setVariable ["igui_diwako_dui_namelist_h", nil]; saveProfileNamespace; - diwako_dui_setCompass = true; - diwako_dui_setNamelist = true; - - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; }; } ] call CBA_Settings_fnc_init; -// keybind to toggle whole UI -[CBA_SETTINGS_CAT, "diwako_dui_button_toggle_ui", localize "STR_dui_key_toggle", { - diwako_dui_toggled_off = !diwako_dui_toggled_off; +if !(hasInterface) exitWith {}; - if (diwako_dui_toggled_off) then { - // set position and size for namelist and compassa gain - diwako_dui_setCompass = true; - diwako_dui_setNamelist = true; - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; - }; - true -}, -{false}, -[DIK_MULTIPLY, [false, true, false]], false] call CBA_fnc_addKeybind; +// Reposition the actual ui elements when layout editor save button was pressed (CBA 3.10) +["CBA_layoutEditorSaved", { + [QGVAR(refreshUI),[]] call CBA_fnc_localEvent; +}, true] call CBA_fnc_addEventHandler; // keybinds for zooming [CBA_SETTINGS_CAT, "diwako_dui_button_increase_range", localize "STR_dui_key_increase_range", { - [true] call diwako_dui_fnc_rangeButton; + [true] call FUNC(rangeButton); true }, {false}, [DIK_NUMPADPLUS, [false, true, false]], false] call CBA_fnc_addKeybind; [CBA_SETTINGS_CAT, "diwako_dui_button_decrease_range", localize "STR_dui_key_decrease_range", { - [false] call diwako_dui_fnc_rangeButton; + [false] call FUNC(rangeButton); true }, {false}, [DIK_NUMPADMINUS, [false, true, false]], false] call CBA_fnc_addKeybind; [CBA_SETTINGS_CAT, "diwako_dui_button_showRank", localize "STR_dui_key_rank", { - diwako_dui_showRank = true; + GVAR(showRank) = true; true }, { - diwako_dui_showRank = false; + GVAR(showRank) = false; true }] call CBA_fnc_addKeybind; + + +ADDON = true; diff --git a/addons/radar/XEH_preStart.sqf b/addons/radar/XEH_preStart.sqf new file mode 100644 index 0000000..a51262a --- /dev/null +++ b/addons/radar/XEH_preStart.sqf @@ -0,0 +1,2 @@ +#include "script_component.hpp" +#include "XEH_PREP.hpp" diff --git a/addons/radar/config.cpp b/addons/radar/config.cpp new file mode 100644 index 0000000..804bcb1 --- /dev/null +++ b/addons/radar/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" +class CfgPatches { + class ADDON { + name = COMPONENT; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"diwako_dui_main"}; + author[] = {"diwako"}; + VERSION_CONFIG; + license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike"; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgUIGrids.hpp" +#include "CfgCompassStyles.hpp" +#include "gui.hpp" diff --git a/addons/radar/functions/fnc_cacheLoop.sqf b/addons/radar/functions/fnc_cacheLoop.sqf new file mode 100644 index 0000000..d25a32c --- /dev/null +++ b/addons/radar/functions/fnc_cacheLoop.sqf @@ -0,0 +1,266 @@ +#include "script_component.hpp" + +// loop +[FUNC(cacheLoop),[],0.5] call CBA_fnc_waitAndExecute; + +// if both compass and namelist are not enabled, just remove the controls if there are any +if !(diwako_dui_enable_compass || diwako_dui_namelist) exitWith { + for "_i" from 0 to (count GVAR(namebox_lists)) do { + ctrlDelete ctrlParentControlsGroup (GVAR(namebox_lists) deleteAt 0); + }; + "diwako_dui_namebox" cutRsc ["diwako_dui_RscNameBox","PLAIN", 0, true]; +}; + +private _player = [] call CBA_fnc_currentUnit; +private _group = units group _player; +if (diwako_dui_compass_hide_blip_alone_group && {(count _group) <= 1}) then { + _group = []; +}; +GVAR(group) = + _group; + +private _uiScale = diwako_dui_hudScaling; +private _uiPixels = GVAR(uiPixels); + +private _colorNameSpace = missionNamespace getVariable format[QEGVAR(main,colors_%1), diwako_dui_colors]; +private _iconNamespace = missionNamespace getVariable format[QEGVAR(main,icon_%1), diwako_dui_icon_style]; + +{ + if (alive _x) then { + _x setVariable [QGVAR(compass_icon), [_x, _iconNamespace, _player, true] call FUNC(getIcon)]; + _x setVariable [QGVAR(icon), [_x, _iconNamespace] call FUNC(getIcon)]; + // when remote controling a an AI assign can return nil + private _assignedTeam = [assignedTeam _x] param [0, "MAIN"]; + + private _color = _colorNameSpace getVariable [_assignedTeam, "#FFFFFF"]; + _x setVariable [QGVAR(color), _color]; + + private _compassColor = _colorNameSpace getVariable [(format ["%1_compass", _assignedTeam]), [1,1,1]]; + _x setVariable [QGVAR(compass_color), _compassColor]; + }; +} forEach _group; + +private _specialTrack = missionNamespace getVariable ["diwako_dui_special_track", []]; +if (_specialTrack isEqualType [] && {!(_specialTrack isEqualTo [])}) then { + private _toTrack = []; + private _vehNamespace = GVAR(vehicleNamespace); + private _trackingcolor = GVAR(trackingColor) select [0, 3]; + { + if !(isNull _x) then { + private _index = _toTrack pushBackUnique _x; + if (_index > -1) then { + _x setVariable [QGVAR(compass_color), _trackingcolor]; + if (_x isKindOf "CAManBase") then { + _x setVariable [QGVAR(compass_icon), [_x, _iconNamespace, _player, true] call FUNC(getIcon)]; + }; + if (_x isKindOf "LandVehicle" || _x isKindOf "Air") then { + private _type = (typeOf _x); + private _picture = _vehNamespace getVariable _type; + if (isNil "_picture") then { + _picture = getText (configfile >> "CfgVehicles" >> _type >> "icon"); + if (isText (configfile >> "CfgVehicleIcons" >> _picture)) then { + _picture = getText (configfile >> "CfgVehicleIcons" >> _picture); + } else { + private _found = (toLower _picture) find ".paa"; + if (_found isEqualTo -1 || {!(((count _picture) - 4) isEqualTo _found)}) then { + _picture = "a3\ui_f\data\Map\VehicleIcons\iconObject_ca.paa"; + }; + }; + _vehNamespace setVariable [_type, _picture]; + }; + _x setVariable [QGVAR(icon_size), [2,1] select (_picture isEqualTo "a3\ui_f\data\Map\VehicleIcons\iconObject_ca.paa")]; + _x setVariable [QGVAR(compass_icon), _picture]; + }; + }; + }; + } forEach _specialTrack; + GVAR(group) = _toTrack + GVAR(group) - [objNull]; +}; + +// start compass if enabeld but not running yet +if (diwako_dui_enable_compass) then { + private _compassDisplay = uiNamespace getVariable ["diwako_dui_RscCompass", displayNull]; + if (GVAR(compass_pfHandle) <= -1 || {isNull _compassDisplay}) then { + [GVAR(compass_pfHandle)] call CBA_fnc_removePerFrameHandler; + "diwako_dui_compass" cutRsc ["diwako_dui_RscCompass","PLAIN", 0, false]; + [] call FUNC(compass); + }; + + private _compassCtrl = _compassDisplay displayCtrl IDC_COMPASS; + _compassCtrl ctrlSetText (diwako_dui_compass_style select ("ItemCompass" in assignedItems _player)); + + if (GVAR(setCompass)) then { + GVAR(setCompass) = false; + private _ctrlHeight = pixelH * _uiPixels; + private _ctrlWidth = pixelW * _uiPixels; + private _ctrlMiddleX = 0.5 - (pixelW * (_uiPixels / 2)); + private _compassY = safeZoneY + safeZoneH - (pixelH * (_uiPixels + 10)); + + private _dirCtrl = _compassDisplay displayCtrl IDC_DIRECTION; + private _grpCtrl = _compassDisplay displayCtrl IDC_COMPASS_CTRLGRP; + + if (diwako_dui_use_layout_editor) then { + _ctrlMiddleX = profileNamespace getVariable ["igui_diwako_dui_compass_x", _ctrlMiddleX]; + _compassY = profileNamespace getVariable ["igui_diwako_dui_compass_y", _compassY]; + }; + + GVAR(bearing_size_calc) = diwako_dui_dir_size * GVAR(a3UiScale) * _uiScale * GVAR(windowHeightMod); + + _compassCtrl ctrlSetPosition [ + _ctrlMiddleX, + _compassY, + _ctrlWidth, + _ctrlHeight + ]; + _compassCtrl ctrlSetTextColor [1 ,1 , 1, diwako_dui_compass_opacity]; + _compassCtrl ctrlCommit 0; + _grpCtrl ctrlSetPosition [ + _ctrlMiddleX, + _compassY, + _ctrlWidth, + _ctrlHeight + ]; + _grpCtrl ctrlCommit 0; + _dirCtrl ctrlSetPosition [ + _ctrlMiddleX, + _compassY - (pixelH * 25 * _uiScale), + // safeZoneY + safeZoneH - (pixelH * (_uiPixels + (55 * _uiScale))), + _ctrlWidth, + pixelH * 70 * _uiScale + ]; + _dirCtrl ctrlSetTextColor [1, 1, 1, 1]; + _dirCtrl ctrlSetFont diwako_dui_font; + _dirCtrl ctrlCommit 0; + }; +}; + +// built name list from here +private _display = uiNamespace getVariable ["diwako_dui_RscNameBox", displayNull]; +if (isNull _display) exitWith { + if (diwako_dui_namelist) then { + "diwako_dui_RscNameBox" cutRsc ["diwako_dui_RscNameBox","PLAIN", 0, false]; + _display = uiNamespace getVariable ["diwako_dui_RscNameBox", displayNull]; + }; +}; + +private _grpCtrl = _display displayCtrl IDC_NAMEBOX_CTRLGRP; +private _lists = GVAR(namebox_lists); + +// delete all name list controls if not active +if !(diwako_dui_namelist) exitWith { + if ((count _lists) > 0) then { + for "_i" from (count _lists) -1 to 0 step -1 do { + ctrlDelete ctrlParentControlsGroup (_lists deleteAt _i); + }; + "diwako_dui_namebox" cutText ["","PLAIN"]; + }; +}; + +if !([_player] call EFUNC(main,canHudBeShown)) exitWith { + _grpCtrl ctrlShow false; +}; + +private _nameList = _display displayCtrl IDC_NAMEBOX; +if (GVAR(setNamelist)) then { + GVAR(setNamelist) = false; + private _xPos = 0.5 + (pixelW * (_uiPixels / 2 + 10)); + private _yPos = safeZoneY + safeZoneH - (pixelH * (_uiPixels + 10)); + if (diwako_dui_use_layout_editor) then { + _xPos = profileNamespace getVariable ["igui_diwako_dui_namelist_x", _xPos]; + _yPos = profileNamespace getVariable ["igui_diwako_dui_namelist_y", _yPos]; + }; + private _nameListPos = [ + _xPos, + _yPos, + 0.5 * safeZoneW - (pixelW * (_uiPixels / 2 + 12)), + pixelH * (_uiPixels + 10) + ]; + _grpCtrl ctrlSetPosition _nameListPos; + _grpCtrl ctrlCommit 0; + _nameList ctrlSetPosition _nameListPos; + _nameList ctrlCommit 0; +}; +ctrlPosition _grpCtrl params ["", "", "", "_height"]; +private _curNameListHeight = (_height / pixelH) - ((15 * _uiScale) max 15); + +// no need to show any names if you are alone in the group +if (count _group <= 1) exitWith { + if ((count _lists) > 0) then { + for "_i" from (count _lists) -1 to 0 step -1 do { + ctrlDelete ctrlParentControlsGroup (_lists deleteAt _i); + }; + }; +}; +if !(ctrlShown _grpCtrl) then { + _grpCtrl ctrlShow true; +}; +private _text = ""; +private _curList = controlNull; + +private _selectedUnits = groupSelectedUnits _player; +private _textSize = diwako_dui_namelist_size * GVAR(a3UiScale); +private _shadow = diwako_dui_namelist_text_shadow; +private _bgOpacity = diwako_dui_namelist_bg; +private _onlyBuddyIcon = diwako_dui_namelist_only_buddy_icon; +private _heightMod = GVAR(windowHeightMod); +private _listWidth = diwako_dui_namelist_width * pixelW * _uiScale; +private _itemHeight = (128 / 5) * diwako_dui_namelist_size * GVAR(namelist_vertical_spacing); +private _columnNo = 0; +private _curColumnHeight = 0; +private _ctrlPosList = [0, 0, _listWidth * 10, _itemHeight * pixelH]; +{ + if ((count _lists) < (_forEachIndex + 1)) then { + private _curGrp = _display ctrlCreate["RscControlsGroupNoScrollbars", -1, _grpCtrl]; + _curGrp ctrlSetPosition [ + (0 * pixelW) * _columnNo + _listWidth * _columnNo, + _curColumnHeight * pixelH, + _listWidth, + _itemHeight * pixelH + ]; + _curGrp ctrlCommit 0; + _curList = _display ctrlCreate ["RscStructuredText", -1, _curGrp]; + _curList ctrlSetFont diwako_dui_font; + _curList ctrlSetBackgroundColor [0,0,0,_bgOpacity]; + _curList ctrlSetPosition _ctrlPosList; + _lists pushBack _curList; + } else { + _curList = _lists select _forEachIndex; + }; + _curColumnHeight = _curColumnHeight + _itemHeight; + if (_curColumnHeight >= _curNameListHeight) then { + _curColumnHeight = 0; + _columnNo = _columnNo + 1; + }; + + private _unit = _x; + private _selected = ""; + if ((count _selectedUnits) > 0 && {_unit != _player}) then { + private _curName = vehicleVarName _unit; + _unit setVehicleVarName ""; + private _defaultIdent = str _unit; + _unit setVehicleVarName _curName; + private _arr = [_defaultIdent, ":"] call CBA_fnc_split; + private _num = if ((count _arr) > 1) then { + (_arr select 1) select [0, 2] + } else { + "" + }; + _selected = format ["%1%2", (["", ">> "] select (_selectedUnits findIf {_x == _unit} > -1)), _num]; + }; + private _buddy = ["", _iconNamespace getVariable ["buddy", DUI_BUDDY]] select (_player == (_unit getVariable [QGVAR(buddy), objNull])); + private _icon = [_unit getVariable [QGVAR(icon), DUI_RIFLEMAN], ""] select (_buddy != "" && {_onlyBuddyIcon}); + _text = format ["%4 %2
", + _icon, // 1 + _unit getVariable ["ACE_Name", name _unit], // 2 + _unit getVariable [QGVAR(color),"#FFFFFF"], // 3 + _selected, // 4 + (_textSize * _heightMod), // 5 + _buddy, // 6 + _shadow]; // 7 + _curList ctrlSetStructuredText parseText _text; + diwako_debug = _text; + _curList ctrlCommit 0; +} forEach _group; + +for "_i" from (count _group) to (count _lists) do { + ctrlDelete ctrlParentControlsGroup (_lists deleteAt (count _group)); +}; diff --git a/mod/functions/fn_compass.sqf b/addons/radar/functions/fnc_compass.sqf similarity index 84% rename from mod/functions/fn_compass.sqf rename to addons/radar/functions/fnc_compass.sqf index f6f62d5..23ee0dc 100644 --- a/mod/functions/fn_compass.sqf +++ b/addons/radar/functions/fnc_compass.sqf @@ -1,87 +1,87 @@ -#include "../script_component.hpp" -if (is3DEN || !hasInterface) exitWith {}; -params [["_display", displayNull]]; -if !(diwako_dui_enable_compass) exitWith {}; - -if (isNull _display) then { - _display = uiNamespace getVariable "diwako_dui_RscCompass"; -}; - -if (isNull _display) exitWith {systemChat "No Display"}; - -private _ctrlGrp = _display displayCtrl IDC_COMPASS_CTRLGRP; -private _compass = _display displayCtrl IDC_COMPASS; -private _dirCtrl = _display displayCtrl IDC_DIRECTION; -diwako_dui_compass_pfHandle = [{ - params ["_args", "_pfhHandle"]; - _args params ["_display", "_compassCtrl", "_dirCtrl", "_ctrlGrp"]; - - if !(diwako_dui_enable_compass) exitWith { - [_pfhHandle] call CBA_fnc_removePerFrameHandler; - "diwako_dui_compass" cutText ["","PLAIN"]; - diwako_dui_compass_pfHandle = -1; - }; - - private _player = [] call CBA_fnc_currentUnit; - private _grp = diwako_dui_group; - - if (diwako_dui_compass_hide_alone_group && {count _grp <= 1}) exitWith { - _compassCtrl ctrlShow false; - _dirCtrl ctrlShow false; - _ctrlGrp ctrlShow false; - }; - - if ([_player] call diwako_dui_fnc_canHudBeShown) then { - if !(ctrlShown _ctrlGrp) then { - _ctrlGrp ctrlShow true; - _compassCtrl ctrlShow true; - _dirCtrl ctrlShow true; - }; - private _camDirVec = positionCameratoWorld [0,0,0] vectorFromTo (positionCameraToWorld [0,0,1]); - private _dir = _camDirVec call CBA_fnc_vectDir; - // private _dir = (getCameraViewDirection _player) call CBA_fnc_vectDir; - private _hasCompass = ("ItemCompass" in assignedItems _player); - - _compassCtrl ctrlSetAngle [[0,-_dir] select _hasCompass, 0.5, 0.5, true]; - - if (_hasCompass && {diwako_dui_enable_compass_dir == 2 || {diwako_dui_enable_compass_dir == 1 && {!(isNull objectParent _player)}}}) then { - if (diwako_dui_dir_showMildot) then { - _dirCtrl ctrlSetStructuredText parseText format ["%1 | %2", (round _dir) mod 360, round (_dir / 0.056250), diwako_dui_bearing_size_calc]; - } else { - _dirCtrl ctrlSetStructuredText parseText format ["%1", (round _dir) mod 360, diwako_dui_bearing_size_calc]; - }; - } else { - _dirCtrl ctrlSetText ""; - }; - - private _usedCtrls = []; - private _ctrls = _ctrlGrp getVariable ["diwako_dui_ctrlArr",[]]; - private _playerDir = getDir _player; - - { - _usedCtrls pushBack ([_x, _display, _dir, _playerDir, _player, _ctrlGrp] call diwako_dui_fnc_displayUnitOnCompass); - } forEach _grp; - - { - ctrlDelete _x; - } forEach (_ctrls - _usedCtrls); - - _ctrlGrp setVariable ["diwako_dui_ctrlArr",_usedCtrls]; - - if !(isNil "diwako_dui_custom_code") then { - /* - Keep in mind this runs EVERY FRAME! - 1. Display of the RscTile - 2. Control of the compass - 3. Control of the bearing indicator - 4. Control group of the units displayed on the compass - 5. All currently shown unit icons on the compass - */ - [_display, _compassCtrl, _dirCtrl, _ctrlGrp, _usedCtrls] call diwako_dui_custom_code; - }; - } else { - _compassCtrl ctrlShow false; - _dirCtrl ctrlShow false; - _ctrlGrp ctrlShow false; - }; -}, diwako_dui_compassRefreshrate, [_display, _compass, _dirCtrl, _ctrlGrp] ] call CBA_fnc_addPerFrameHandler; +#include "script_component.hpp" +if (is3DEN || !hasInterface) exitWith {}; +params [["_display", displayNull]]; +if !(diwako_dui_enable_compass) exitWith {}; + +if (isNull _display) then { + _display = uiNamespace getVariable "diwako_dui_RscCompass"; +}; + +if (isNull _display) exitWith {systemChat "No Display"}; + +private _ctrlGrp = _display displayCtrl IDC_COMPASS_CTRLGRP; +private _compass = _display displayCtrl IDC_COMPASS; +private _dirCtrl = _display displayCtrl IDC_DIRECTION; +GVAR(compass_pfHandle) = [{ + params ["_args", "_pfhHandle"]; + _args params ["_display", "_compassCtrl", "_dirCtrl", "_ctrlGrp"]; + + if !(diwako_dui_enable_compass) exitWith { + [_pfhHandle] call CBA_fnc_removePerFrameHandler; + "diwako_dui_compass" cutText ["","PLAIN"]; + GVAR(compass_pfHandle) = -1; + }; + + private _player = [] call CBA_fnc_currentUnit; + private _grp = GVAR(group); + + if (diwako_dui_compass_hide_alone_group && {count (units group _player) <= 1}) exitWith { + _compassCtrl ctrlShow false; + _dirCtrl ctrlShow false; + _ctrlGrp ctrlShow false; + }; + + if ([_player] call EFUNC(main,canHudBeShown)) then { + if !(ctrlShown _ctrlGrp) then { + _ctrlGrp ctrlShow true; + _compassCtrl ctrlShow true; + _dirCtrl ctrlShow true; + }; + private _camDirVec = positionCameratoWorld [0,0,0] vectorFromTo (positionCameraToWorld [0,0,1]); + private _dir = _camDirVec call CBA_fnc_vectDir; + // private _dir = (getCameraViewDirection _player) call CBA_fnc_vectDir; + private _hasCompass = ("ItemCompass" in assignedItems _player); + + _compassCtrl ctrlSetAngle [[0,-_dir] select _hasCompass, 0.5, 0.5, true]; + + if (_hasCompass && {diwako_dui_enable_compass_dir == 2 || {diwako_dui_enable_compass_dir == 1 && {!(isNull objectParent _player)}}}) then { + if (diwako_dui_dir_showMildot) then { + _dirCtrl ctrlSetStructuredText parseText format ["%1 | %2", (round _dir) mod 360, round (_dir / 0.056250), GVAR(bearing_size_calc)]; + } else { + _dirCtrl ctrlSetStructuredText parseText format ["%1", (round _dir) mod 360, GVAR(bearing_size_calc)]; + }; + } else { + _dirCtrl ctrlSetText ""; + }; + + private _usedCtrls = []; + private _ctrls = _ctrlGrp getVariable ["diwako_dui_ctrlArr",[]]; + private _playerDir = getDir _player; + + { + _usedCtrls pushBack ([_x, _display, _dir, _playerDir, _player, _ctrlGrp] call FUNC(displayUnitOnCompass)); + } forEach _grp; + + { + ctrlDelete _x; + } forEach (_ctrls - _usedCtrls); + + _ctrlGrp setVariable ["diwako_dui_ctrlArr",_usedCtrls]; + + if !(isNil "diwako_dui_custom_code") then { + /* + Keep in mind this runs EVERY FRAME! + 1. Display of the RscTile + 2. Control of the compass + 3. Control of the bearing indicator + 4. Control group of the units displayed on the compass + 5. All currently shown unit icons on the compass + */ + [_display, _compassCtrl, _dirCtrl, _ctrlGrp, _usedCtrls] call diwako_dui_custom_code; + }; + } else { + _compassCtrl ctrlShow false; + _dirCtrl ctrlShow false; + _ctrlGrp ctrlShow false; + }; +}, diwako_dui_compassRefreshrate, [_display, _compass, _dirCtrl, _ctrlGrp] ] call CBA_fnc_addPerFrameHandler; diff --git a/mod/functions/fn_displayUnitOnCompass.sqf b/addons/radar/functions/fnc_displayUnitOnCompass.sqf similarity index 82% rename from mod/functions/fn_displayUnitOnCompass.sqf rename to addons/radar/functions/fnc_displayUnitOnCompass.sqf index c99ea93..31c39b6 100644 --- a/mod/functions/fn_displayUnitOnCompass.sqf +++ b/addons/radar/functions/fnc_displayUnitOnCompass.sqf @@ -1,105 +1,106 @@ -#include "../script_component.hpp" -params [ - ["_unit", objNull], - "_display", - ["_viewDir", 0], - ["_playerDir", 0], - "_player", - "_ctrlGrp" -]; -if (isNull _unit) exitWith {}; - -private _unitID = _unit getVariable ["diwako_dui_unit_id",nil]; -if (isNil "_unitID") then { - _unitID = (missionNamespace getVariable ["diwako_dui_lastID", 0])+1; - missionNamespace setVariable ["diwako_dui_lastID", _unitID]; - _unit setVariable ["diwako_dui_unit_id", _unitID]; -}; - -if (isNil "_player") then { - _player = [] call CBA_fnc_currentUnit; -}; - -private _circleRange = diwako_dui_compassRange; -private _distance = _player distance2d _unit; -private _fade = 0; -private _relDir = 0; -if (_distance <= _circleRange) then { - _fade = linearConversion [_circleRange * 0.90, _circleRange, _distance, diwako_dui_compass_opacity, 0, true]; - _relDir = ((_player getRelDir _unit) - (_viewDir - _playerDir) ) mod 360; -}; - -if (diwako_dui_enable_occlusion && {_fade > 0}) then { - private _lastSeen = _unit getVariable "diwako_dui_lastSeen"; - private _occlude = !isNil "_lastSeen"; - if (_unit getVariable ["diwako_dui_lastChecked", -1] < time) then { - _unit setVariable ["diwako_dui_lastChecked", time + 1]; - private _vis = [vehicle _unit, "VIEW"] checkVisibility [eyePos _player, AGLToASL (_unit modelToWorld (_unit selectionPosition "Spine2"))]; - private _cone = if (_relDir > 180) then { abs (_relDir - 360)} else { abs _relDir}; - if (_vis == 0 || {diwako_dui_enable_occlusion_actual_cone < _cone}) then { - _occlude = true; - } else { - // unit visible - if !(isNil "_lastSeen") then { - _unit setVariable ["diwako_dui_lastSeen", nil]; - }; - _occlude = false; - }; - }; - if (_occlude) then { - // unit not visible anymore - if (isNil "_lastSeen") then { - _lastSeen = time; - _unit setVariable ["diwako_dui_lastSeen", _lastSeen]; - }; - _fade = linearConversion [0, 10, time - _lastSeen, 1, 0, true] min _fade; - }; -}; - -private _ctrl = _ctrlGrp getVariable [format ["diwako_dui_ctrl_unit_%1", _unitID], controlNull]; - -if (_fade <= 0) exitWith { - if (isNull _ctrl) exitWith {controlNull}; - ctrlDelete _ctrl; - controlNull -}; - -private _dir = -(_viewDir - (getDir _unit)) mod 360; -private _divisor = linearConversion [35,50,_circleRange,2.25,2.75,false] / diwako_dui_hudScaling; //2.25; - -if (isNull _ctrl) then { - _ctrl = _display ctrlCreate ["RscPicture", -1, _ctrlGrp]; - _ctrlGrp setVariable [format ["diwako_dui_ctrl_unit_%1", _unitID], _ctrl]; - - private _ctrlArr = _ctrlGrp getVariable ["ctrl_diw_ctrlArr", nil]; - if (isNil "_ctrlArr") then { - _ctrlArr = []; - _ctrlGrp setVariable ["ctrl_diw_ctrlArr", _ctrlArr]; - }; - _ctrlArr pushBack _ctrl; -}; - -ctrlPosition _ctrlGrp params ["_left", "_top", "_width", "_height"]; -private _dist = _distance / linearConversion [15,50,_circleRange,40,145,false]; -private _iconScale = diwako_dui_compass_icon_scale * (_unit getVariable ["diwako_dui_icon_size", 1]); -private _newWidth = (44 * pixelW) /_divisor * _iconScale; -private _newHeight = (44 * pixelH) /_divisor * _iconScale; - -_ctrl ctrlSetPosition [ - _width/2 + _width * (sin _relDir * _dist) - _newWidth/2, - _height/2 - _height * (cos _relDir * _dist) - _newHeight/2, - _newWidth, - _newHeight -]; -_ctrl ctrlSetAngle [_dir,0.5,0.5,false]; -_ctrl ctrlCommit 0; - -private _color = [0.85, 0.4, 0]; -if (_distance > diwako_dui_distanceWarning || {!(isNull objectParent _unit) || {_unit == _player}}) then { - _color = + (_unit getVariable ["diwako_dui_compass_color", [1,1,1]]); -}; -_color pushBack _fade; -_ctrl ctrlSetTextColor _color; -_ctrl ctrlSetText (_unit getVariable ["diwako_dui_compass_icon", DUI_RIFLEMAN]); - -_ctrl +#include "script_component.hpp" +params [ + ["_unit", objNull], + "_display", + ["_viewDir", 0], + ["_playerDir", 0], + "_player", + "_ctrlGrp" +]; +if (isNull _unit) exitWith {}; + +private _unitID = _unit getVariable ["diwako_dui_unit_id",nil]; +if (isNil "_unitID") then { + _unitID = (missionNamespace getVariable ["diwako_dui_lastID", 0])+1; + missionNamespace setVariable ["diwako_dui_lastID", _unitID]; + _unit setVariable ["diwako_dui_unit_id", _unitID]; +}; + +if (isNil "_player") then { + _player = [] call CBA_fnc_currentUnit; +}; + +private _circleRange = diwako_dui_compassRange; +private _distance = _player distance2d _unit; +private _fade = 0; +private _relDir = 0; +if (_distance <= _circleRange) then { + _fade = linearConversion [_circleRange * 0.90, _circleRange, _distance, diwako_dui_compass_opacity, 0, true]; + _relDir = ((_player getRelDir _unit) - (_viewDir - _playerDir) ) mod 360; +}; + +if (diwako_dui_enable_occlusion && {_fade > 0}) then { + private _lastSeen = _unit getVariable QGVAR(lastSeen); + private _occlude = !isNil "_lastSeen"; + if (_unit getVariable ["diwako_dui_lastChecked", -1] < time) then { + _unit setVariable ["diwako_dui_lastChecked", time + 1]; + private _vis = [vehicle _unit, "VIEW"] checkVisibility [eyePos _player, AGLToASL (_unit modelToWorld (_unit selectionPosition "Spine2"))]; + private _cone = if (_relDir > 180) then { abs (_relDir - 360)} else { abs _relDir}; + if (_vis == 0 || {GVAR(enable_occlusion_actual_cone) < _cone}) then { + _occlude = true; + } else { + // unit visible + if !(isNil "_lastSeen") then { + _unit setVariable [QGVAR(lastSeen), nil]; + }; + _occlude = false; + }; + }; + if (_occlude) then { + // unit not visible anymore + if (isNil "_lastSeen") then { + _lastSeen = time; + _unit setVariable [QGVAR(lastSeen), _lastSeen]; + }; + _fade = linearConversion [0, GVAR(occlusion_fade_time), time - _lastSeen, 1, 0, true] min _fade; + }; + _unit setVariable [QGVAR(occlusion_fade), _fade]; +}; + +private _ctrl = _ctrlGrp getVariable [format ["diwako_dui_ctrl_unit_%1", _unitID], controlNull]; + +if (_fade <= 0) exitWith { + if (isNull _ctrl) exitWith {controlNull}; + ctrlDelete _ctrl; + controlNull +}; + +private _dir = -(_viewDir - (getDir _unit)) mod 360; +private _divisor = linearConversion [35,50,_circleRange,2.25,2.75,false] / diwako_dui_hudScaling; //2.25; + +if (isNull _ctrl) then { + _ctrl = _display ctrlCreate ["RscPicture", -1, _ctrlGrp]; + _ctrlGrp setVariable [format ["diwako_dui_ctrl_unit_%1", _unitID], _ctrl]; + + private _ctrlArr = _ctrlGrp getVariable ["ctrl_diw_ctrlArr", nil]; + if (isNil "_ctrlArr") then { + _ctrlArr = []; + _ctrlGrp setVariable ["ctrl_diw_ctrlArr", _ctrlArr]; + }; + _ctrlArr pushBack _ctrl; +}; + +ctrlPosition _ctrlGrp params ["_left", "_top", "_width", "_height"]; +private _dist = _distance / linearConversion [15,50,_circleRange,40,145,false]; +private _iconScale = diwako_dui_compass_icon_scale * (_unit getVariable [QGVAR(icon_size), 1]); +private _newWidth = (44 * pixelW) /_divisor * _iconScale; +private _newHeight = (44 * pixelH) /_divisor * _iconScale; + +_ctrl ctrlSetPosition [ + _width/2 + _width * (sin _relDir * _dist) - _newWidth/2, + _height/2 - _height * (cos _relDir * _dist) - _newHeight/2, + _newWidth, + _newHeight +]; +_ctrl ctrlSetAngle [_dir,0.5,0.5,false]; +_ctrl ctrlCommit 0; + +private _color = [0.85, 0.4, 0]; +if (_distance > diwako_dui_distanceWarning || {!(isNull objectParent _unit) || {_unit == _player}}) then { + _color = + (_unit getVariable [QGVAR(compass_color), [1,1,1]]); +}; +_color pushBack _fade; +_ctrl ctrlSetTextColor _color; +_ctrl ctrlSetText (_unit getVariable [QGVAR(compass_icon), DUI_RIFLEMAN]); + +_ctrl diff --git a/mod/functions/fn_getIcon.sqf b/addons/radar/functions/fnc_getIcon.sqf similarity index 84% rename from mod/functions/fn_getIcon.sqf rename to addons/radar/functions/fnc_getIcon.sqf index 263a01f..f09e6bd 100644 --- a/mod/functions/fn_getIcon.sqf +++ b/addons/radar/functions/fnc_getIcon.sqf @@ -1,78 +1,78 @@ -#include "../script_component.hpp" -params [["_unit", objNull, [objNull]], ["_namespace", (missionNamespace getVariable format["diwako_dui_icon_%1", diwako_dui_icon_style])], ["_player", objNull, [objNull]], ["_forCompass", false]]; - -if (isNull _unit) exitWith {_namespace getVariable ["rifleman", DUI_RIFLEMAN];}; - -if (!_forCompass && {diwako_dui_showRank}) exitWith { - _namespace getVariable [rank _unit, DUI_RANK_PRIVATE]; -}; - -if !(isNull objectParent _unit || {_forCompass}) exitWith { - private _crewInfo = ((fullCrew (vehicle _unit)) select {_x select 0 isEqualTo _unit}) select 0; - _crewInfo params ["", "_role", "_index", "_turretPath", "_isTurret"]; - - // Cargo - if (_role == "cargo") exitWith { - _namespace getVariable ["vehicle_cargo", DUI_VEHICLE_CARGO]; - }; - - // Drivers - if (_role == "driver") exitWith { - _namespace getVariable ["vehicle_driver", DUI_VEHICLE_DRIVER]; - }; - - // FFV - if (_role == "turret" && _isTurret) exitWith { - _namespace getVariable ["fire_from_vehicle", DUI_FIRE_FROM_VEHICLE]; - }; - - // Gunners or Copilots - if (_role == "gunner" || (_role == "turret" && !_isTurret)) exitWith { - _namespace getVariable ["vehicle_gunner", DUI_VEHICLE_GUNNER]; - }; - - // Commander - if (_role == "commander") exitWith { - _namespace getVariable ["vehicle_commander", DUI_VEHICLE_COMMANDER]; - }; -}; - -// Buddy -if (_player == (_unit getVariable ["diwako_dui_buddy", objNull])) exitWith { - _namespace getVariable ["buddy_compass", DUI_BUDDY_COMPASS]; -}; - -// Leader -if ((leader _unit) == _unit) exitWith { - _namespace getVariable ["sql", DUI_SQL]; -}; - -// AR -if (getText(configFile >> "CfgWeapons" >> (primaryWeapon (_unit)) >> "UIPicture") == "\a3\weapons_f\data\ui\icon_mg_ca.paa") exitWith { - _namespace getVariable ["auto_rifleman", DUI_AUTO_RIFLEMAN]; -}; - -// AT -if (getText(configFile >> "CfgWeapons" >> (secondaryWeapon (_unit)) >> "UIPicture") == "\a3\weapons_f\data\ui\icon_at_ca.paa") exitWith { - _namespace getVariable ["at_gunner", DUI_AT_GUNNER]; -}; - -// Medic -if (_unit getVariable ["ace_medical_medicClass", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")] > 0) exitWith { - _namespace getVariable ["medic", DUI_MEDIC]; -}; - -// Engineer -private _isEngineer = _unit getVariable ["ACE_isEngineer", _unit getUnitTrait "engineer"]; -if (_isEngineer isEqualType 0) then {_isEngineer = _isEngineer > 0}; - -if (_isEngineer) exitWith { - _namespace getVariable ["engineer", DUI_ENGINEER]; -}; - -// Explosive Specialist -if (_unit getVariable ["ACE_isEOD", false] || {_unit getUnitTrait "explosiveSpecialist"}) exitWith { - _namespace getVariable ["explosive_specialist", DUI_EXPLOSIVE_SPECIALIST]; -}; - -_namespace getVariable ["rifleman", DUI_RIFLEMAN]; +#include "script_component.hpp" +params [["_unit", objNull, [objNull]], "_namespace", ["_player", objNull, [objNull]], ["_forCompass", false]]; + +if (isNull _unit) exitWith {_namespace getVariable ["rifleman", DUI_RIFLEMAN];}; + +if (!_forCompass && {GVAR(showRank)}) exitWith { + _namespace getVariable [rank _unit, DUI_RANK_PRIVATE]; +}; + +if !(isNull objectParent _unit || {_forCompass}) exitWith { + private _crewInfo = ((fullCrew (vehicle _unit)) select {_x select 0 isEqualTo _unit}) select 0; + _crewInfo params ["", "_role", "_index", "_turretPath", "_isTurret"]; + + // Cargo + if (_role == "cargo") exitWith { + _namespace getVariable ["vehicle_cargo", DUI_VEHICLE_CARGO]; + }; + + // Drivers + if (_role == "driver") exitWith { + _namespace getVariable ["vehicle_driver", DUI_VEHICLE_DRIVER]; + }; + + // FFV + if (_role == "turret" && _isTurret) exitWith { + _namespace getVariable ["fire_from_vehicle", DUI_FIRE_FROM_VEHICLE]; + }; + + // Gunners or Copilots + if (_role == "gunner" || (_role == "turret" && !_isTurret)) exitWith { + _namespace getVariable ["vehicle_gunner", DUI_VEHICLE_GUNNER]; + }; + + // Commander + if (_role == "commander") exitWith { + _namespace getVariable ["vehicle_commander", DUI_VEHICLE_COMMANDER]; + }; +}; + +// Buddy +if (_player == (_unit getVariable [QGVAR(buddy), objNull])) exitWith { + _namespace getVariable ["buddy_compass", DUI_BUDDY_COMPASS]; +}; + +// Leader +if ((leader _unit) == _unit) exitWith { + _namespace getVariable ["sql", DUI_SQL]; +}; + +// AR +if (getText(configFile >> "CfgWeapons" >> (primaryWeapon (_unit)) >> "UIPicture") == "\a3\weapons_f\data\ui\icon_mg_ca.paa") exitWith { + _namespace getVariable ["auto_rifleman", DUI_AUTO_RIFLEMAN]; +}; + +// AT +if (getText(configFile >> "CfgWeapons" >> (secondaryWeapon (_unit)) >> "UIPicture") == "\a3\weapons_f\data\ui\icon_at_ca.paa") exitWith { + _namespace getVariable ["at_gunner", DUI_AT_GUNNER]; +}; + +// Medic +if (_unit getVariable ["ace_medical_medicClass", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")] > 0) exitWith { + _namespace getVariable ["medic", DUI_MEDIC]; +}; + +// Engineer +private _isEngineer = _unit getVariable ["ACE_isEngineer", _unit getUnitTrait "engineer"]; +if (_isEngineer isEqualType 0) then {_isEngineer = _isEngineer > 0}; + +if (_isEngineer) exitWith { + _namespace getVariable ["engineer", DUI_ENGINEER]; +}; + +// Explosive Specialist +if (_unit getVariable ["ACE_isEOD", false] || {_unit getUnitTrait "explosiveSpecialist"}) exitWith { + _namespace getVariable ["explosive_specialist", DUI_EXPLOSIVE_SPECIALIST]; +}; + +_namespace getVariable ["rifleman", DUI_RIFLEMAN]; diff --git a/addons/radar/functions/fnc_pairBuddies.sqf b/addons/radar/functions/fnc_pairBuddies.sqf new file mode 100644 index 0000000..c315d7f --- /dev/null +++ b/addons/radar/functions/fnc_pairBuddies.sqf @@ -0,0 +1,17 @@ +#include "script_component.hpp" +params ["_unit1", "_unit2", ["_assign", true]]; + +if !(isNull (_unit1 getVariable [QGVAR(buddy), objNull])) then { + (_unit1 getVariable [QGVAR(buddy), objNull]) setVariable [QGVAR(buddy), nil, true]; +}; +if !(isNull (_unit2 getVariable [QGVAR(buddy), objNull])) then { + (_unit2 getVariable [QGVAR(buddy), objNull]) setVariable [QGVAR(buddy), nil, true]; +}; + +if (_assign) then { + _unit1 setVariable [QGVAR(buddy), _unit2, true]; + _unit2 setVariable [QGVAR(buddy), _unit1, true]; +} else { + _unit1 setVariable [QGVAR(buddy), nil, true]; + _unit2 setVariable [QGVAR(buddy), nil, true]; +}; diff --git a/mod/functions/fn_rangeButton.sqf b/addons/radar/functions/fnc_rangeButton.sqf similarity index 79% rename from mod/functions/fn_rangeButton.sqf rename to addons/radar/functions/fnc_rangeButton.sqf index 7be83c9..b5b9961 100644 --- a/mod/functions/fn_rangeButton.sqf +++ b/addons/radar/functions/fnc_rangeButton.sqf @@ -1,4 +1,4 @@ -#include "../script_component.hpp" -params [["_increase",true, [true]]]; - -diwako_dui_compassRange = DUI_MAX_RANGE min (diwako_dui_compassRange + ([-5,5] select _increase)) max DUI_MIN_RANGE; +#include "script_component.hpp" +params [["_increase",true, [true]]]; + +diwako_dui_compassRange = DUI_MAX_RANGE min (diwako_dui_compassRange + ([-5,5] select _increase)) max DUI_MIN_RANGE; diff --git a/mod/functions/fn_setCustomCode.sqf b/addons/radar/functions/fnc_setCustomCode.sqf similarity index 95% rename from mod/functions/fn_setCustomCode.sqf rename to addons/radar/functions/fnc_setCustomCode.sqf index ae2099d..5796429 100644 --- a/mod/functions/fn_setCustomCode.sqf +++ b/addons/radar/functions/fnc_setCustomCode.sqf @@ -1,7 +1,7 @@ -params [["_code", {}, [{}]]]; - -if (_code isEqualTo {}) then { - diwako_dui_custom_code = nil; -} else { - diwako_dui_custom_code = _code; -}; +params [["_code", {}, [{}]]]; + +if (_code isEqualTo {}) then { + diwako_dui_custom_code = nil; +} else { + diwako_dui_custom_code = _code; +}; diff --git a/addons/radar/functions/script_component.hpp b/addons/radar/functions/script_component.hpp new file mode 100644 index 0000000..3d47f9f --- /dev/null +++ b/addons/radar/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\diwako_dui\addons\radar\script_component.hpp" \ No newline at end of file diff --git a/mod/gui.hpp b/addons/radar/gui.hpp similarity index 96% rename from mod/gui.hpp rename to addons/radar/gui.hpp index fe3ec52..4efb492 100644 --- a/mod/gui.hpp +++ b/addons/radar/gui.hpp @@ -1,49 +1,49 @@ -#include "RscCommon.hpp" - -class diwako_dui_DialogCompass { - idd = -1; - movingEnable = 1; - duration = 9999999; - fadein = 0; - fadeout = 0; - onLoad = "uiNamespace setVariable [""diwako_dui_DialogCompass"",_this select 0];"; - //onUnload = "[] call diwako_dui_dialogClosedEH"; - - #include "gui_compass_controls.hpp" -}; - -class diwako_dui_DialogNameBox { - idd = -1; - movingEnable = 1; - duration = 9999999; - fadein = 0; - fadeout = 0; - onLoad = "uiNamespace setVariable [""diwako_dui_DialogNameBox"",_this select 0];"; - //onUnload = "[] call diwako_dui_dialogClosedEH"; - - #include "gui_namebox_controls.hpp" -}; - -class RscTitles { - class diwako_dui_RscCompass { - idd = -1; - movingEnable = "true"; - duration = 9999999; - fadein = 0; - fadeout = 0; - onLoad = "uiNamespace setVariable [""diwako_dui_RscCompass"",_this select 0];"; - - #include "gui_compass_controls.hpp" - }; - - class diwako_dui_RscNameBox { - idd = -1; - movingEnable = "true"; - duration = 9999999; - fadein = 0; - fadeout = 0; - onLoad = "uiNamespace setVariable [""diwako_dui_RscNameBox"",_this select 0];"; - - #include "gui_namebox_controls.hpp" - }; -}; +#include "RscCommon.hpp" + +class diwako_dui_DialogCompass { + idd = -1; + movingEnable = 1; + duration = 9999999; + fadein = 0; + fadeout = 0; + onLoad = "uiNamespace setVariable [""diwako_dui_DialogCompass"",_this select 0];"; + //onUnload = "[] call diwako_dui_dialogClosedEH"; + + #include "gui_compass_controls.hpp" +}; + +class diwako_dui_DialogNameBox { + idd = -1; + movingEnable = 1; + duration = 9999999; + fadein = 0; + fadeout = 0; + onLoad = "uiNamespace setVariable [""diwako_dui_DialogNameBox"",_this select 0];"; + //onUnload = "[] call diwako_dui_dialogClosedEH"; + + #include "gui_namebox_controls.hpp" +}; + +class RscTitles { + class diwako_dui_RscCompass { + idd = -1; + movingEnable = "true"; + duration = 9999999; + fadein = 0; + fadeout = 0; + onLoad = "uiNamespace setVariable [""diwako_dui_RscCompass"",_this select 0];"; + + #include "gui_compass_controls.hpp" + }; + + class diwako_dui_RscNameBox { + idd = -1; + movingEnable = "true"; + duration = 9999999; + fadein = 0; + fadeout = 0; + onLoad = "uiNamespace setVariable [""diwako_dui_RscNameBox"",_this select 0];"; + + #include "gui_namebox_controls.hpp" + }; +}; diff --git a/mod/gui_compass_controls.hpp b/addons/radar/gui_compass_controls.hpp similarity index 84% rename from mod/gui_compass_controls.hpp rename to addons/radar/gui_compass_controls.hpp index 7c14bcc..66aa88a 100644 --- a/mod/gui_compass_controls.hpp +++ b/addons/radar/gui_compass_controls.hpp @@ -1,68 +1,63 @@ -class ControlsBackground -{ - class compass - { - idc = IDC_COMPASS; - moving = 1; - type = 0; - style = 48; - x = "0.5 - (pixelW * 64)"; - y = "safeZoneY + safeZoneH - (pixelH * 138)"; - w = "pixelW * 128"; // * 3 / 4; - h = "pixelH * 128"; // * 4 / 3; - font = "EtelkaNarrowMediumPro"; - sizeEx = 1; - colorBackground[] = {1,1,1,0}; - colorText[] = {1,1,1,1}; - text = ""; - lineSpacing = 1; - }; - - class direction:ctrlStructuredText - { - idc = IDC_DIRECTION; - moving = 1; - x = "0.5 - (pixelW * 64)"; - y = "safeZoneY + safeZoneH - (pixelH * 195)"; - w = "pixelW * 128"; - h = "pixelH * 70"; - font = "EtelkaNarrowMediumPro"; - colorBackground[] = {0,0,0,0}; - colorText[] = {1,1,1,1}; - text = ""; - //lineSpacing = 1; - shadow = 2; - }; -}; - -class controls -{ - class group:RscControlsGroupNoScrollbars - { - idc = IDC_COMPASS_CTRLGRP; - x = "0.5 - (pixelW * 64)"; //64 - y = "safeZoneY + safeZoneH - (pixelH * 138)"; - w = "pixelW * 128"; // * 3 / 4; - h = "pixelH * 128"; // * 4 / 3; - shadow=0; - - class VScrollbar - { - - }; - - class HScrollbar - { - - }; - - class ScrollBar - { - - }; - class Controls - { - - }; - }; -}; \ No newline at end of file +class ControlsBackground { + class compass { + idc = IDC_COMPASS; + moving = 1; + type = 0; + style = 48; + x = "0.5 - (pixelW * 64)"; + y = "safeZoneY + safeZoneH - (pixelH * 138)"; + w = "pixelW * 128"; // * 3 / 4; + h = "pixelH * 128"; // * 4 / 3; + font = "EtelkaNarrowMediumPro"; + sizeEx = 1; + colorBackground[] = {1,1,1,0}; + colorText[] = {1,1,1,1}; + text = ""; + lineSpacing = 1; + }; + + class direction:ctrlStructuredText { + idc = IDC_DIRECTION; + moving = 1; + x = "0.5 - (pixelW * 64)"; + y = "safeZoneY + safeZoneH - (pixelH * 195)"; + w = "pixelW * 128"; + h = "pixelH * 70"; + font = "EtelkaNarrowMediumPro"; + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + text = ""; + //lineSpacing = 1; + shadow = 2; + }; +}; + +class controls { + class group:RscControlsGroupNoScrollbars { + idc = IDC_COMPASS_CTRLGRP; + x = "0.5 - (pixelW * 64)"; //64 + y = "safeZoneY + safeZoneH - (pixelH * 138)"; + w = "pixelW * 128"; // * 3 / 4; + h = "pixelH * 128"; // * 4 / 3; + shadow=0; + + class VScrollbar + { + + }; + + class HScrollbar + { + + }; + + class ScrollBar + { + + }; + class Controls + { + + }; + }; +}; diff --git a/mod/gui_namebox_controls.hpp b/addons/radar/gui_namebox_controls.hpp similarity index 63% rename from mod/gui_namebox_controls.hpp rename to addons/radar/gui_namebox_controls.hpp index d4c3795..2baa616 100644 --- a/mod/gui_namebox_controls.hpp +++ b/addons/radar/gui_namebox_controls.hpp @@ -1,45 +1,35 @@ -class ControlsBackground -{ - class box:RscObject - { - idc = IDC_NAMEBOX; - moving = 1; - x = "0.5 + (pixelW * 74)"; - y = "safeZoneY + safeZoneH - (pixelH * 138)"; - w = "(0.5 - (pixelW * 74)) + safeZoneW"; - h = "pixelH * 138"; - colorBackground[] = {0,0,0,0}; - }; -}; - -class controls -{ - class names:RscControlsGroupNoScrollbars - { - idc = IDC_NAMEBOX_CTRLGRP; - x = "0.5 + (pixelW * 74)"; - y = "safeZoneY + safeZoneH - (pixelH * 138)"; - w = "(0.5 - (pixelW * 74)) + safeZoneW"; - h = "pixelH * 138"; - shadow=0; - - class VScrollbar - { - - }; - - class HScrollbar - { - - }; - - class ScrollBar - { - - }; - class Controls - { - - }; - }; -}; \ No newline at end of file +class ControlsBackground { + class box:RscObject { + idc = IDC_NAMEBOX; + moving = 1; + x = "0.5 + (pixelW * 74)"; + y = "safeZoneY + safeZoneH - (pixelH * 138)"; + w = "(0.5 - (pixelW * 74)) + safeZoneW"; + h = "pixelH * 138"; + colorBackground[] = {0,0,0,0}; + }; +}; + +class controls { + class names:RscControlsGroupNoScrollbars { + idc = IDC_NAMEBOX_CTRLGRP; + x = "0.5 + (pixelW * 74)"; + y = "safeZoneY + safeZoneH - (pixelH * 138)"; + w = "(0.5 - (pixelW * 74)) + safeZoneW"; + h = "pixelH * 138"; + shadow=0; + + class VScrollbar { + + }; + class HScrollbar { + + }; + class ScrollBar { + + }; + class Controls { + + }; + }; +}; diff --git a/mod/functions/fn_getCompassStyles.sqf b/addons/radar/include/getCompassStyles.sqf similarity index 66% rename from mod/functions/fn_getCompassStyles.sqf rename to addons/radar/include/getCompassStyles.sqf index 299c445..bc64246 100644 --- a/mod/functions/fn_getCompassStyles.sqf +++ b/addons/radar/include/getCompassStyles.sqf @@ -1,13 +1,13 @@ -private _configs = "true" configClasses (configFile >> "diwako_dui_compass_style"); -private _missionConfigs = "true" configClasses (missionConfigFile >> "diwako_dui_compass_style"); -if (isNil "_missionConfigs") then { - _missionConfigs = []; -}; - -private _compassNames = []; -private _compassPaths = []; - -{ - _compassNames pushback getText (_x >> "name"); - _compassPaths pushBack [getText (_x >> "limited"), getText (_x >> "full")]; -} forEach (_configs + _missionConfigs); +private _configs = "true" configClasses (configFile >> "diwako_dui_compass_style"); +private _missionConfigs = "true" configClasses (missionConfigFile >> "diwako_dui_compass_style"); +if (isNil "_missionConfigs") then { + _missionConfigs = []; +}; + +private _compassNames = []; +private _compassPaths = []; + +{ + _compassNames pushback getText (_x >> "name"); + _compassPaths pushBack [getText (_x >> "limited"), getText (_x >> "full")]; +} forEach (_configs + _missionConfigs); diff --git a/addons/radar/script_component.hpp b/addons/radar/script_component.hpp new file mode 100644 index 0000000..db3ac9d --- /dev/null +++ b/addons/radar/script_component.hpp @@ -0,0 +1,48 @@ +#define COMPONENT radar +#include "\z\diwako_dui\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE + +#ifdef DEBUG_ENABLED_RADAR + #define DEBUG_MODE_FULL +#endif +#ifdef DEBUG_SETTINGS_RADAR + #define DEBUG_SETTINGS DEBUG_SETTINGS_RADAR +#endif + +// UI values +#define IDC_COMPASS 1337001 +#define IDC_DIRECTION 1337002 +#define IDC_COMPASS_CTRLGRP 1337003 +#define IDC_NAMEBOX 1337004 +#define IDC_NAMEBOX_CTRLGRP 1337005 +#define DUI_128PX (128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) + +// Script values +#define DUI_MAX_RANGE 50 +#define DUI_MIN_RANGE 15 + +#define DUI_SQL "a3\ui_f\data\map\vehicleicons\iconManLeader_ca.paa" +#define DUI_MEDIC "a3\ui_f\data\map\vehicleicons\iconManMedic_ca.paa" +#define DUI_AUTO_RIFLEMAN "a3\ui_f\data\map\vehicleicons\iconManMG_ca.paa" +#define DUI_AT_GUNNER "a3\ui_f\data\map\vehicleicons\iconManAT_ca.paa" +#define DUI_ENGINEER "a3\ui_f\data\map\vehicleicons\iconManEngineer_ca.paa" +#define DUI_EXPLOSIVE_SPECIALIST "a3\ui_f\data\map\vehicleicons\iconManExplosive_ca.paa" +#define DUI_RIFLEMAN "a3\ui_f\data\map\vehicleicons\iconMan_ca.paa" +#define DUI_VEHICLE_CARGO "a3\ui_f\data\igui\cfg\commandbar\imagecargo_ca.paa" +#define DUI_VEHICLE_DRIVER "a3\ui_f\data\igui\cfg\commandbar\imagedriver_ca.paa" +#define DUI_FIRE_FROM_VEHICLE "a3\ui_f\data\igui\cfg\simpletasks\types\rifle_ca.paa" +#define DUI_VEHICLE_GUNNER "a3\ui_f\data\igui\cfg\commandbar\imagegunner_ca.paa" +#define DUI_VEHICLE_COMMANDER "a3\ui_f\data\igui\cfg\commandbar\imagecommander_ca.paa" +#define DUI_RANK_PRIVATE "a3\ui_f\data\GUI\Cfg\Ranks\private_gs.paa" +#define DUI_RANK_CORPORAL "a3\ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa" +#define DUI_RANK_SERGEANT "a3\ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa" +#define DUI_RANK_LIEUTENANT "a3\ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa" +#define DUI_RANK_CAPTAIN "a3\ui_f\data\GUI\Cfg\Ranks\captain_gs.paa" +#define DUI_RANK_MAJOR "a3\ui_f\data\GUI\Cfg\Ranks\major_gs.paa" +#define DUI_RANK_COLONEL "a3\ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" +#define DUI_BUDDY "a3\ui_f_curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa" +#define DUI_BUDDY_COMPASS "z\diwako_dui\addons\main\UI\icon_styles\standard\buddy_compass" + +#include "\z\diwako_dui\addons\main\script_macros.hpp" diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..282bf19 --- /dev/null +++ b/build.bat @@ -0,0 +1,5 @@ +hemtt build +MOVE addons\diwako_dui_main.pbo "D:\SteamLibrary\steamapps\common\Arma 3\@diwako_dui\addons\" +MOVE addons\diwako_dui_radar.pbo "D:\SteamLibrary\steamapps\common\Arma 3\@diwako_dui\addons\" +"G:\Program Files (x86)\Steam\steamapps\common\Arma 3 Tools\DSSignFile\DSSignFile.exe" diwako_dui.biprivatekey "D:\SteamLibrary\steamapps\common\Arma 3\@diwako_dui\addons\diwako_dui_main.pbo" +"G:\Program Files (x86)\Steam\steamapps\common\Arma 3 Tools\DSSignFile\DSSignFile.exe" diwako_dui.biprivatekey "D:\SteamLibrary\steamapps\common\Arma 3\@diwako_dui\addons\diwako_dui_radar.pbo" \ No newline at end of file diff --git a/compile.bat b/compile.bat deleted file mode 100644 index bd31e13..0000000 --- a/compile.bat +++ /dev/null @@ -1 +0,0 @@ -armake2 build -x "gui.hpp" -x "CfgFunctions.hpp" -x "CfgUIGrids.hpp" -x "RscCommon.hpp" -x "*_style.hpp" -x "*_controls.hpp" -x "*.tga" -x "*.psd" -x "*.png" -k diwako_dui.biprivatekey -f mod "D:\SteamLibrary\steamapps\common\Arma 3\@diwako_dui\addons\diwako_dui.pbo" \ No newline at end of file diff --git a/compile.sh b/compile.sh deleted file mode 100644 index 99e4aea..0000000 --- a/compile.sh +++ /dev/null @@ -1 +0,0 @@ -armake build -x "gui.hpp" -x "CfgFunctions.hpp" -x "CfgUIGrids.hpp" -x "RscCommon.hpp" -x "*_style.hpp" -x "*_controls.hpp" -x "*.tga" -x "*.psd" -x "*.png" -x "*.biprivatekey" -k "diwako_dui.biprivatekey" -z -f mod/ /mnt/d/SteamLibrary/steamapps/common/Arma\ 3/@diwako_dui/addons/diwako_dui.pbo \ No newline at end of file diff --git a/hemtt.json b/hemtt.json new file mode 100644 index 0000000..7abf1c4 --- /dev/null +++ b/hemtt.json @@ -0,0 +1,13 @@ +{ + "name": "DUI Squad Radar", + "prefix": "diwako_dui", + "author": "Diwako", + "files": [ + "mod.cpp" + ], + "exclude": [ + "*.psd", + "*.png", + "*.tga" + ] +} diff --git a/include/x/cba/addons/main/script_macros_common.hpp b/include/x/cba/addons/main/script_macros_common.hpp new file mode 100644 index 0000000..6df27ee --- /dev/null +++ b/include/x/cba/addons/main/script_macros_common.hpp @@ -0,0 +1,1796 @@ +/* + Header: script_macros_common.hpp + + Description: + A general set of useful macro functions for use by CBA itself or by any module that uses CBA. + + Authors: + Sickboy and Spooner +*/ + +/* **************************************************** + New - Should be exported to general addon + Aim: + - Simplify (shorten) the amount of characters required for repetitive tasks + - Provide a solid structure that can be dynamic and easy editable (Which sometimes means we cannot adhere to Aim #1 ;-) + An example is the path that is built from defines. Some available in this file, others in mods and addons. + + Follows Standard: + Object variables: PREFIX_COMPONENT + Main-object variables: PREFIX_main + Paths: MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\SCRIPTNAME.sqf + e.g: x\six\addons\sys_menu\fDate.sqf + + Usage: + define PREFIX and COMPONENT, then include this file + (Note, you could have a main addon for your mod, define the PREFIX in a macros.hpp, + and include this script_macros_common.hpp file. + Then in your addons, add a component.hpp, define the COMPONENT, + and include your mod's script_macros.hpp + In your scripts you can then include the addon's component.hpp with relative path) + + TODO: + - Try only to use 1 string type " vs ' + - Evaluate double functions, and simplification + - Evaluate naming scheme; current = prototype + - Evaluate "Debug" features.. + - Evaluate "create mini function per precompiled script, that will load the script on first usage, rather than on init" + - Also saw "Namespace" typeName, evaluate which we need :P + - Single/Multi player gamelogics? (Incase of MP, you would want only 1 gamelogic per component, which is pv'ed from server, etc) + */ + +#ifndef MAINPREFIX + #define MAINPREFIX x +#endif + +#ifndef SUBPREFIX + #define SUBPREFIX addons +#endif + +#ifndef MAINLOGIC + #define MAINLOGIC main +#endif + +#ifndef VERSION + #define VERSION 0 +#endif + +#ifndef VERSION_AR + #define VERSION_AR VERSION +#endif + +#ifndef VERSION_CONFIG + #define VERSION_CONFIG version = VERSION; versionStr = QUOTE(VERSION); versionAr[] = {VERSION_AR} +#endif + +#define ADDON DOUBLES(PREFIX,COMPONENT) +#define MAIN_ADDON DOUBLES(PREFIX,main) + +/* ------------------------------------------- +Group: Debugging +------------------------------------------- */ + +/* ------------------------------------------- +Macros: DEBUG_MODE_x + Managing debugging based on debug level. + + According to the *highest* level of debugging that has been defined *before* script_macros_common.hpp is included, + only the appropriate debugging commands will be functional. With no level explicitely defined, assume DEBUG_MODE_NORMAL. + + DEBUG_MODE_FULL - Full debugging output. + DEBUG_MODE_NORMAL - All debugging except and (Default setting if none specified). + DEBUG_MODE_MINIMAL - Only and enabled. + +Examples: + In order to turn on full debugging for a single file, + (begin example) + // Top of individual script file. + #define DEBUG_MODE_FULL + #include "script_component.hpp" + (end) + + In order to force minimal debugging for a single component, + (begin example) + // Top of addons\\script_component.hpp + // Ensure that any FULL and NORMAL setting from the individual files are undefined and MINIMAL is set. + #ifdef DEBUG_MODE_FULL + #undef DEBUG_MODE_FULL + #endif + #ifdef DEBUG_MODE_NORMAL + #undef DEBUG_MODE_NORMAL + #endif + #ifndef DEBUG_MODE_MINIMAL + #define DEBUG_MODE_MINIMAL + #endif + #include "script_macros.hpp" + (end) + + In order to turn on full debugging for a whole addon, + (begin example) + // Top of addons\main\script_macros.hpp + #ifndef DEBUG_MODE_FULL + #define DEBUG_MODE_FULL + #endif + #include "\x\cba\addons\main\script_macros_common.hpp" + (end) + +Author: + Spooner +------------------------------------------- */ + +// If DEBUG_MODE_FULL, then also enable DEBUG_MODE_NORMAL. +#ifdef DEBUG_MODE_FULL +#define DEBUG_MODE_NORMAL +#endif + +// If DEBUG_MODE_NORMAL, then also enable DEBUG_MODE_MINIMAL. +#ifdef DEBUG_MODE_NORMAL +#define DEBUG_MODE_MINIMAL +#endif + +// If no debug modes specified, use DEBUG_MODE_NORMAL (+ DEBUG_MODE_MINIMAL). +#ifndef DEBUG_MODE_MINIMAL +#define DEBUG_MODE_NORMAL +#define DEBUG_MODE_MINIMAL +#endif + +#define LOG_SYS_FORMAT(LEVEL,MESSAGE) format ['[%1] (%2) %3: %4', toUpper 'PREFIX', 'COMPONENT', LEVEL, MESSAGE] + +#ifdef DEBUG_SYNCHRONOUS +#define LOG_SYS(LEVEL,MESSAGE) diag_log text LOG_SYS_FORMAT(LEVEL,MESSAGE) +#else +#define LOG_SYS(LEVEL,MESSAGE) LOG_SYS_FORMAT(LEVEL,MESSAGE) call CBA_fnc_log +#endif + +#define LOG_SYS_FILELINENUMBERS(LEVEL,MESSAGE) LOG_SYS(LEVEL,format [ARR_4('%1 %2:%3',MESSAGE,__FILE__,__LINE__ + 1)]) + +/* ------------------------------------------- +Macro: LOG() + Log a debug message into the RPT log. + + Only run if is defined. + +Parameters: + MESSAGE - Message to record + +Example: + (begin example) + LOG("Initiated clog-dancing simulator."); + (end) + +Author: + Spooner +------------------------------------------- */ +#ifdef DEBUG_MODE_FULL + +#define LOG(MESSAGE) LOG_SYS_FILELINENUMBERS('LOG',MESSAGE) +#define LOG_1(MESSAGE,ARG1) LOG(FORMAT_1(MESSAGE,ARG1)) +#define LOG_2(MESSAGE,ARG1,ARG2) LOG(FORMAT_2(MESSAGE,ARG1,ARG2)) +#define LOG_3(MESSAGE,ARG1,ARG2,ARG3) LOG(FORMAT_3(MESSAGE,ARG1,ARG2,ARG3)) +#define LOG_4(MESSAGE,ARG1,ARG2,ARG3,ARG4) LOG(FORMAT_4(MESSAGE,ARG1,ARG2,ARG3,ARG4)) +#define LOG_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5) LOG(FORMAT_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5)) +#define LOG_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) LOG(FORMAT_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6)) +#define LOG_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) LOG(FORMAT_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7)) +#define LOG_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) LOG(FORMAT_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8)) + +#else + +#define LOG(MESSAGE) /* disabled */ +#define LOG_1(MESSAGE,ARG1) /* disabled */ +#define LOG_2(MESSAGE,ARG1,ARG2) /* disabled */ +#define LOG_3(MESSAGE,ARG1,ARG2,ARG3) /* disabled */ +#define LOG_4(MESSAGE,ARG1,ARG2,ARG3,ARG4) /* disabled */ +#define LOG_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5) /* disabled */ +#define LOG_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) /* disabled */ +#define LOG_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) /* disabled */ +#define LOG_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) /* disabled */ + +#endif + +/* ------------------------------------------- +Macro: INFO() + Record a message without file and line number in the RPT log. + +Parameters: + MESSAGE - Message to record + +Example: + (begin example) + INFO("Mod X is loaded, do Y"); + (end) + +Author: + commy2 +------------------------------------------- */ +#define INFO(MESSAGE) LOG_SYS('INFO',MESSAGE) +#define INFO_1(MESSAGE,ARG1) INFO(FORMAT_1(MESSAGE,ARG1)) +#define INFO_2(MESSAGE,ARG1,ARG2) INFO(FORMAT_2(MESSAGE,ARG1,ARG2)) +#define INFO_3(MESSAGE,ARG1,ARG2,ARG3) INFO(FORMAT_3(MESSAGE,ARG1,ARG2,ARG3)) +#define INFO_4(MESSAGE,ARG1,ARG2,ARG3,ARG4) INFO(FORMAT_4(MESSAGE,ARG1,ARG2,ARG3,ARG4)) +#define INFO_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5) INFO(FORMAT_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5)) +#define INFO_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) INFO(FORMAT_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6)) +#define INFO_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) INFO(FORMAT_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7)) +#define INFO_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) INFO(FORMAT_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8)) + +/* ------------------------------------------- +Macro: WARNING() + Record a non-critical error in the RPT log. + + Only run if or higher is defined. + +Parameters: + MESSAGE - Message to record + +Example: + (begin example) + WARNING("This function has been deprecated. Please don't use it in future!"); + (end) + +Author: + Spooner +------------------------------------------- */ +#ifdef DEBUG_MODE_NORMAL + +#define WARNING(MESSAGE) LOG_SYS_FILELINENUMBERS('WARNING',MESSAGE) +#define WARNING_1(MESSAGE,ARG1) WARNING(FORMAT_1(MESSAGE,ARG1)) +#define WARNING_2(MESSAGE,ARG1,ARG2) WARNING(FORMAT_2(MESSAGE,ARG1,ARG2)) +#define WARNING_3(MESSAGE,ARG1,ARG2,ARG3) WARNING(FORMAT_3(MESSAGE,ARG1,ARG2,ARG3)) +#define WARNING_4(MESSAGE,ARG1,ARG2,ARG3,ARG4) WARNING(FORMAT_4(MESSAGE,ARG1,ARG2,ARG3,ARG4)) +#define WARNING_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5) WARNING(FORMAT_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5)) +#define WARNING_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) WARNING(FORMAT_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6)) +#define WARNING_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) WARNING(FORMAT_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7)) +#define WARNING_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) WARNING(FORMAT_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8)) + +#else + +#define WARNING(MESSAGE) /* disabled */ +#define WARNING_1(MESSAGE,ARG1) /* disabled */ +#define WARNING_2(MESSAGE,ARG1,ARG2) /* disabled */ +#define WARNING_3(MESSAGE,ARG1,ARG2,ARG3) /* disabled */ +#define WARNING_4(MESSAGE,ARG1,ARG2,ARG3,ARG4) /* disabled */ +#define WARNING_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5) /* disabled */ +#define WARNING_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) /* disabled */ +#define WARNING_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) /* disabled */ +#define WARNING_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) /* disabled */ + +#endif + +/* ------------------------------------------- +Macro: ERROR() + Record a critical error in the RPT log. + +Parameters: + MESSAGE - Message to record + +Example: + (begin example) + ERROR("value of frog not found in config ...yada...yada..."); + (end) + +Author: + Spooner +------------------------------------------- */ +#define ERROR(MESSAGE) LOG_SYS_FILELINENUMBERS('ERROR',MESSAGE) +#define ERROR_1(MESSAGE,ARG1) ERROR(FORMAT_1(MESSAGE,ARG1)) +#define ERROR_2(MESSAGE,ARG1,ARG2) ERROR(FORMAT_2(MESSAGE,ARG1,ARG2)) +#define ERROR_3(MESSAGE,ARG1,ARG2,ARG3) ERROR(FORMAT_3(MESSAGE,ARG1,ARG2,ARG3)) +#define ERROR_4(MESSAGE,ARG1,ARG2,ARG3,ARG4) ERROR(FORMAT_4(MESSAGE,ARG1,ARG2,ARG3,ARG4)) +#define ERROR_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5) ERROR(FORMAT_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5)) +#define ERROR_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) ERROR(FORMAT_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6)) +#define ERROR_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) ERROR(FORMAT_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7)) +#define ERROR_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) ERROR(FORMAT_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8)) + +/* ------------------------------------------- +Macro: ERROR_MSG() + Record a critical error in the RPT log and display on screen error message. + + Newlines (\n) in the MESSAGE will be put on separate lines. + +Parameters: + MESSAGE - Message to record + +Example: + (begin example) + ERROR_MSG("value of frog not found in config ...yada...yada..."); + (end) + +Author: + commy2 +------------------------------------------- */ +#define ERROR_MSG(MESSAGE) ['PREFIX', 'COMPONENT', nil, MESSAGE, __FILE__, __LINE__ + 1] call CBA_fnc_error +#define ERROR_MSG_1(MESSAGE,ARG1) ERROR_MSG(FORMAT_1(MESSAGE,ARG1)) +#define ERROR_MSG_2(MESSAGE,ARG1,ARG2) ERROR_MSG(FORMAT_2(MESSAGE,ARG1,ARG2)) +#define ERROR_MSG_3(MESSAGE,ARG1,ARG2,ARG3) ERROR_MSG(FORMAT_3(MESSAGE,ARG1,ARG2,ARG3)) +#define ERROR_MSG_4(MESSAGE,ARG1,ARG2,ARG3,ARG4) ERROR_MSG(FORMAT_4(MESSAGE,ARG1,ARG2,ARG3,ARG4)) +#define ERROR_MSG_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5) ERROR_MSG(FORMAT_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5)) +#define ERROR_MSG_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) ERROR_MSG(FORMAT_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6)) +#define ERROR_MSG_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) ERROR_MSG(FORMAT_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7)) +#define ERROR_MSG_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) ERROR_MSG(FORMAT_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8)) + +/* ------------------------------------------- +Macro: ERROR_WITH_TITLE() + Record a critical error in the RPT log. + + The title can be specified (in the heading is always just "ERROR") + Newlines (\n) in the MESSAGE will be put on separate lines. + +Parameters: + TITLE - Title of error message + MESSAGE - Body of error message + +Example: + (begin example) + ERROR_WITH_TITLE("Value not found","Value of frog not found in config ...yada...yada..."); + (end) + +Author: + Spooner +------------------------------------------- */ +#define ERROR_WITH_TITLE(TITLE,MESSAGE) ['PREFIX', 'COMPONENT', TITLE, MESSAGE, __FILE__, __LINE__ + 1] call CBA_fnc_error +#define ERROR_WITH_TITLE_1(TITLE,MESSAGE,ARG1) ERROR_WITH_TITLE(TITLE,FORMAT_1(MESSAGE,ARG1)) +#define ERROR_WITH_TITLE_2(TITLE,MESSAGE,ARG1,ARG2) ERROR_WITH_TITLE(TITLE,FORMAT_2(MESSAGE,ARG1,ARG2)) +#define ERROR_WITH_TITLE_3(TITLE,MESSAGE,ARG1,ARG2,ARG3) ERROR_WITH_TITLE(TITLE,FORMAT_3(MESSAGE,ARG1,ARG2,ARG3)) +#define ERROR_WITH_TITLE_4(TITLE,MESSAGE,ARG1,ARG2,ARG3,ARG4) ERROR_WITH_TITLE(TITLE,FORMAT_4(MESSAGE,ARG1,ARG2,ARG3,ARG4)) +#define ERROR_WITH_TITLE_5(TITLE,MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5) ERROR_WITH_TITLE(TITLE,FORMAT_5(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5)) +#define ERROR_WITH_TITLE_6(TITLE,MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) ERROR_WITH_TITLE(TITLE,FORMAT_6(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6)) +#define ERROR_WITH_TITLE_7(TITLE,MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) ERROR_WITH_TITLE(TITLE,FORMAT_7(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7)) +#define ERROR_WITH_TITLE_8(TITLE,MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) ERROR_WITH_TITLE(TITLE,FORMAT_8(MESSAGE,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8)) + +/* ------------------------------------------- +Macro: MESSAGE_WITH_TITLE() + Record a single line in the RPT log. + +Parameters: + TITLE - Title of log message + MESSAGE - Body of message + +Example: + (begin example) + MESSAGE_WITH_TITLE("Value found","Value of frog found in config "); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define MESSAGE_WITH_TITLE(TITLE,MESSAGE) LOG_SYS_FILELINENUMBERS(TITLE,MESSAGE) + +/* ------------------------------------------- +Macro: RETDEF() + If a variable is undefined, return the default value. Otherwise, return the + variable itself. + +Parameters: + VARIABLE - the variable to check + DEFAULT_VALUE - the default value to use if variable is undefined + +Example: + (begin example) + // _var is undefined + hintSilent format ["_var=%1", RETDEF(_var,5)]; // "_var=5" + _var = 7; + hintSilent format ["_var=%1", RETDEF(_var,5)]; // "_var=7" + (end example) +Author: + 654wak654 +------------------------------------------- */ +#define RETDEF(VARIABLE,DEFAULT_VALUE) (if (isNil {VARIABLE}) then [{DEFAULT_VALUE}, {VARIABLE}]) + +/* ------------------------------------------- +Macro: RETNIL() + If a variable is undefined, return the value nil. Otherwise, return the + variable itself. + +Parameters: + VARIABLE - the variable to check + +Example: + (begin example) + // _var is undefined + hintSilent format ["_var=%1", RETNIL(_var)]; // "_var=any" + (end example) + +Author: + Alef (see CBA issue #8514) +------------------------------------------- */ +#define RETNIL(VARIABLE) RETDEF(VARIABLE,nil) + +/* ------------------------------------------- +Macros: TRACE_n() + Log a message and 1-8 variables to the RPT log. + + Only run if is defined. + + TRACE_1(MESSAGE,A) - Log 1 variable. + TRACE_2(MESSAGE,A,B) - Log 2 variables. + TRACE_3(MESSAGE,A,B,C) - Log 3 variables. + TRACE_4(MESSAGE,A,B,C,D) - Log 4 variables. + TRACE_5(MESSAGE,A,B,C,D,E) - Log 5 variables. + TRACE_6(MESSAGE,A,B,C,D,E,F) - Log 6 variables. + TRACE_7(MESSAGE,A,B,C,D,E,F,G) - Log 7 variables. + TRACE_8(MESSAGE,A,B,C,D,E,F,G,H) - Log 8 variables. + TRACE_9(MESSAGE,A,B,C,D,E,F,G,H,I) - Log 9 variables. + +Parameters: + MESSAGE - Message to add to the trace [String] + A..H - Variable names to log values of [Any] + +Example: + (begin example) + TRACE_3("After takeoff",_vehicle player,getPos (_vehicle player), getPosASL (_vehicle player)); + (end) + +Author: + Spooner +------------------------------------------- */ +#define PFORMAT_1(MESSAGE,A) \ + format ['%1: A=%2', MESSAGE, RETNIL(A)] + +#define PFORMAT_2(MESSAGE,A,B) \ + format ['%1: A=%2, B=%3', MESSAGE, RETNIL(A), RETNIL(B)] + +#define PFORMAT_3(MESSAGE,A,B,C) \ + format ['%1: A=%2, B=%3, C=%4', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C)] + +#define PFORMAT_4(MESSAGE,A,B,C,D) \ + format ['%1: A=%2, B=%3, C=%4, D=%5', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D)] + +#define PFORMAT_5(MESSAGE,A,B,C,D,E) \ + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E)] + +#define PFORMAT_6(MESSAGE,A,B,C,D,E,F) \ + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F)] + +#define PFORMAT_7(MESSAGE,A,B,C,D,E,F,G) \ + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G)] + +#define PFORMAT_8(MESSAGE,A,B,C,D,E,F,G,H) \ + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H)] + +#define PFORMAT_9(MESSAGE,A,B,C,D,E,F,G,H,I) \ + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I)] + + +#ifdef DEBUG_MODE_FULL +#define TRACE_1(MESSAGE,A) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_1(str diag_frameNo + ' ' + (MESSAGE),A)) +#define TRACE_2(MESSAGE,A,B) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_2(str diag_frameNo + ' ' + (MESSAGE),A,B)) +#define TRACE_3(MESSAGE,A,B,C) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_3(str diag_frameNo + ' ' + (MESSAGE),A,B,C)) +#define TRACE_4(MESSAGE,A,B,C,D) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_4(str diag_frameNo + ' ' + (MESSAGE),A,B,C,D)) +#define TRACE_5(MESSAGE,A,B,C,D,E) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_5(str diag_frameNo + ' ' + (MESSAGE),A,B,C,D,E)) +#define TRACE_6(MESSAGE,A,B,C,D,E,F) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_6(str diag_frameNo + ' ' + (MESSAGE),A,B,C,D,E,F)) +#define TRACE_7(MESSAGE,A,B,C,D,E,F,G) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_7(str diag_frameNo + ' ' + (MESSAGE),A,B,C,D,E,F,G)) +#define TRACE_8(MESSAGE,A,B,C,D,E,F,G,H) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_8(str diag_frameNo + ' ' + (MESSAGE),A,B,C,D,E,F,G,H)) +#define TRACE_9(MESSAGE,A,B,C,D,E,F,G,H,I) LOG_SYS_FILELINENUMBERS('TRACE',PFORMAT_9(str diag_frameNo + ' ' + (MESSAGE),A,B,C,D,E,F,G,H,I)) +#else +#define TRACE_1(MESSAGE,A) /* disabled */ +#define TRACE_2(MESSAGE,A,B) /* disabled */ +#define TRACE_3(MESSAGE,A,B,C) /* disabled */ +#define TRACE_4(MESSAGE,A,B,C,D) /* disabled */ +#define TRACE_5(MESSAGE,A,B,C,D,E) /* disabled */ +#define TRACE_6(MESSAGE,A,B,C,D,E,F) /* disabled */ +#define TRACE_7(MESSAGE,A,B,C,D,E,F,G) /* disabled */ +#define TRACE_8(MESSAGE,A,B,C,D,E,F,G,H) /* disabled */ +#define TRACE_9(MESSAGE,A,B,C,D,E,F,G,H,I) /* disabled */ +#endif + +/* ------------------------------------------- +Group: General +------------------------------------------- */ + +// ************************************* +// Internal Functions +#define DOUBLES(var1,var2) ##var1##_##var2 +#define TRIPLES(var1,var2,var3) ##var1##_##var2##_##var3 +#define QUOTE(var1) #var1 + +#ifdef MODULAR + #define COMPONENT_T DOUBLES(t,COMPONENT) + #define COMPONENT_M DOUBLES(m,COMPONENT) + #define COMPONENT_S DOUBLES(s,COMPONENT) + #define COMPONENT_C DOUBLES(c,COMPONENT) + #define COMPONENT_F COMPONENT_C +#else + #define COMPONENT_T COMPONENT + #define COMPONENT_M COMPONENT + #define COMPONENT_S COMPONENT + #define COMPONENT_F COMPONENT + #define COMPONENT_C COMPONENT +#endif + +/* ------------------------------------------- +Macro: INC() + +Description: + Increase a number by one. + +Parameters: + VAR - Variable to increment [Number] + +Example: + (begin example) + _counter = 0; + INC(_counter); + // _counter => 1 + (end) + +Author: + Spooner +------------------------------------------- */ +#define INC(var) var = (var) + 1 + +/* ------------------------------------------- +Macro: DEC() + +Description: + Decrease a number by one. + +Parameters: + VAR - Variable to decrement [Number] + +Example: + (begin example) + _counter = 99; + DEC(_counter); + // _counter => 98 + (end) + +Author: + Spooner +------------------------------------------- */ +#define DEC(var) var = (var) - 1 + +/* ------------------------------------------- +Macro: ADD() + +Description: + Add a value to a variable. Variable and value should be both Numbers or both Strings. + +Parameters: + VAR - Variable to add to [Number or String] + VALUE - Value to add [Number or String] + +Examples: + (begin example) + _counter = 2; + ADD(_counter,3); + // _counter => 5 + (end) + (begin example) + _str = "hello"; + ADD(_str," "); + ADD(_str,"Fred"); + // _str => "hello Fred" + (end) + +Author: + Sickboy +------------------------------------------- */ +#define ADD(var1,var2) var1 = (var1) + (var2) + +/* ------------------------------------------- +Macro: SUB() + +Description: + Subtract a value from a number variable. VAR and VALUE should both be Numbers. + +Parameters: + VAR - Variable to subtract from [Number] + VALUE - Value to subtract [Number] + +Examples: + (begin example) + _numChickens = 2; + SUB(_numChickens,3); + // _numChickens => -1 + (end) +------------------------------------------- */ +#define SUB(var1,var2) var1 = (var1) - (var2) + +/* ------------------------------------------- +Macro: REM() + +Description: + Remove an element from an array each time it occurs. + + This recreates the entire array, so use BIS_fnc_removeIndex if modification of the original array is required + or if only one of the elements that matches ELEMENT needs to be removed. + +Parameters: + ARRAY - Array to modify [Array] + ELEMENT - Element to remove [Any] + +Examples: + (begin example) + _array = [1, 2, 3, 4, 3, 8]; + REM(_array,3); + // _array = [1, 2, 4, 8]; + (end) + +Author: + Spooner +------------------------------------------- */ +#define REM(var1,var2) SUB(var1,[var2]) + +/* ------------------------------------------- +Macro: PUSH() + +Description: + Appends a single value onto the end of an ARRAY. Change is made to the ARRAY itself, not creating a new array. + +Parameters: + ARRAY - Array to push element onto [Array] + ELEMENT - Element to push [Any] + +Examples: + (begin example) + _fish = ["blue", "green", "smelly"]; + PUSH(_fish,"monkey-flavoured"); + // _fish => ["blue", "green", "smelly", "monkey-flavoured"] + (end) + +Author: + Spooner +------------------------------------------- */ +#define PUSH(var1,var2) (var1) pushBack (var2) + +/* ------------------------------------------- +Macro: MAP() +Description: + Applies given code to each element of the array, then assigns the + resulting array to the original +Parameters: + ARRAY - Array to be modified + CODE - Code that'll be applied to each element of the array. +Example: + (begin example) + _array = [1, 2, 3, 4, 3, 8]; + MAP(_array,_x + 1); + // _array is now [2, 3, 4, 5, 4, 9]; + (end) +Author: + 654wak654 +------------------------------------------- */ +#define MAP(ARR,CODE) ARR = ARR apply {CODE} + +/* ------------------------------------------- +Macro: FILTER() +Description: + Filters an array based on given code, then assigns the resulting array + to the original +Parameters: + ARRAY - Array to be filtered + CODE - Condition to pick elements +Example: + (begin example) + _array = [1, 2, 3, 4, 3, 8]; + FILTER(_array,_x % 2 == 0) + // _array is now [2, 4, 8]; + (end) +Author: + Commy2 +------------------------------------------- */ +#define FILTER(ARR,CODE) ARR = ARR select {CODE} + +/* ------------------------------------------- +Macro: UNIQUE() +Description: + Removes duplicate values in given array +Parameters: + ARRAY - The array to be modified +Example: + (begin example) + _someArray = [4, 4, 5, 5, 5, 2]; + UNIQUE(_someArray); + // _someArray is now [4, 5, 2] + (end) +Author: + Commy2 +------------------------------------------- */ +#define UNIQUE(ARR) ARR = ARR arrayIntersect ARR + +/* ------------------------------------------- +Macro: INTERSECTION() +Description: + Finds unique common elements between two arrays and assigns them + to the first array +Parameters: + ARRAY0 - The array to be modified + ARRAY1 - The array to find intersections with +Example: + (begin example) + _someArray = [1, 2, 3, 4, 5, 5]; + _anotherArray = [4, 5, 6, 7]; + INTERSECTION(_someArray,_anotherArray); + // _someArray is now [4, 5] + (end) +Author: + 654wak654 +------------------------------------------- */ +#define INTERSECTION(ARG0,ARG1) ARG0 = ARG0 arrayIntersect (ARG1) + +/* ------------------------------------------- +Macro: ISNILS() + +Description: + Sets a variable with a value, but only if it is undefined. + +Parameters: + VARIABLE - Variable to set [Any, not nil] + DEFAULT_VALUE - Value to set VARIABLE to if it is undefined [Any, not nil] + +Examples: + (begin example) + // _fish is undefined + ISNILS(_fish,0); + // _fish => 0 + (end) + (begin example) + _fish = 12; + // ...later... + ISNILS(_fish,0); + // _fish => 12 + (end) + +Author: + Sickboy +------------------------------------------- */ +#define ISNILS(VARIABLE,DEFAULT_VALUE) if (isNil #VARIABLE) then { ##VARIABLE = ##DEFAULT_VALUE } +#define ISNILS2(var1,var2,var3,var4) ISNILS(TRIPLES(var1,var2,var3),var4) +#define ISNILS3(var1,var2,var3) ISNILS(DOUBLES(var1,var2),var3) +#define ISNIL(var1,var2) ISNILS2(PREFIX,COMPONENT,var1,var2) +#define ISNILMAIN(var1,var2) ISNILS3(PREFIX,var1,var2) + +#define CREATELOGICS(var1,var2) ##var1##_##var2## = ([sideLogic] call CBA_fnc_getSharedGroup) createUnit ["LOGIC", [0, 0, 0], [], 0, "NONE"] +#define CREATELOGICLOCALS(var1,var2) ##var1##_##var2## = "LOGIC" createVehicleLocal [0, 0, 0] +#define CREATELOGICGLOBALS(var1,var2) ##var1##_##var2## = ([sideLogic] call CBA_fnc_getSharedGroup) createUnit ["LOGIC", [0, 0, 0], [], 0, "NONE"]; publicVariable QUOTE(DOUBLES(var1,var2)) +#define CREATELOGICGLOBALTESTS(var1,var2) ##var1##_##var2## = ([sideLogic] call CBA_fnc_getSharedGroup) createUnit [QUOTE(DOUBLES(ADDON,logic)), [0, 0, 0], [], 0, "NONE"] + +#define GETVARS(var1,var2,var3) (##var1##_##var2 getVariable #var3) +#define GETVARMAINS(var1,var2) GETVARS(var1,MAINLOGIC,var2) + +#ifndef PATHTO_SYS + #define PATHTO_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\##var2\##var3.sqf +#endif +#ifndef PATHTOF_SYS + #define PATHTOF_SYS(var1,var2,var3) \MAINPREFIX\##var1\SUBPREFIX\##var2\##var3 +#endif + +#ifndef PATHTOF2_SYS + #define PATHTOF2_SYS(var1,var2,var3) MAINPREFIX\##var1\SUBPREFIX\##var2\##var3 +#endif + +#define PATHTO_R(var1) PATHTOF2_SYS(PREFIX,COMPONENT_C,var1) +#define PATHTO_T(var1) PATHTOF_SYS(PREFIX,COMPONENT_T,var1) +#define PATHTO_M(var1) PATHTOF_SYS(PREFIX,COMPONENT_M,var1) +#define PATHTO_S(var1) PATHTOF_SYS(PREFIX,COMPONENT_S,var1) +#define PATHTO_C(var1) PATHTOF_SYS(PREFIX,COMPONENT_C,var1) +#define PATHTO_F(var1) PATHTO_SYS(PREFIX,COMPONENT_F,var1) + +// Already quoted "" +#define QPATHTO_R(var1) QUOTE(PATHTO_R(var1)) +#define QPATHTO_T(var1) QUOTE(PATHTO_T(var1)) +#define QPATHTO_M(var1) QUOTE(PATHTO_M(var1)) +#define QPATHTO_S(var1) QUOTE(PATHTO_S(var1)) +#define QPATHTO_C(var1) QUOTE(PATHTO_C(var1)) +#define QPATHTO_F(var1) QUOTE(PATHTO_F(var1)) + +// This only works for binarized configs after recompiling the pbos +// TODO: Reduce amount of calls / code.. +#define COMPILE_FILE2_CFG_SYS(var1) compile preprocessFileLineNumbers var1 +#define COMPILE_FILE2_SYS(var1) COMPILE_FILE2_CFG_SYS(var1) + +#define COMPILE_FILE_SYS(var1,var2,var3) COMPILE_FILE2_SYS('PATHTO_SYS(var1,var2,var3)') +#define COMPILE_FILE_CFG_SYS(var1,var2,var3) COMPILE_FILE2_CFG_SYS('PATHTO_SYS(var1,var2,var3)') + +#define SETVARS(var1,var2) ##var1##_##var2 setVariable +#define SETVARMAINS(var1) SETVARS(var1,MAINLOGIC) +#define GVARMAINS(var1,var2) ##var1##_##var2## +#define CFGSETTINGSS(var1,var2) configFile >> "CfgSettings" >> #var1 >> #var2 +//#define SETGVARS(var1,var2,var3) ##var1##_##var2##_##var3 = +//#define SETGVARMAINS(var1,var2) ##var1##_##var2 = + +// Compile-Once, JIT: On first use. +// #define PREPMAIN_SYS(var1,var2,var3) ##var1##_fnc_##var3 = { ##var1##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3)); if (isNil "_this") then { call ##var1##_fnc_##var3 } else { _this call ##var1##_fnc_##var3 } } +// #define PREP_SYS(var1,var2,var3) ##var1##_##var2##_fnc_##var3 = { ##var1##_##var2##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3)); if (isNil "_this") then { call ##var1##_##var2##_fnc_##var3 } else { _this call ##var1##_##var2##_fnc_##var3 } } +// #define PREP_SYS2(var1,var2,var3,var4) ##var1##_##var2##_fnc_##var4 = { ##var1##_##var2##_fnc_##var4 = COMPILE_FILE_SYS(var1,var3,DOUBLES(fnc,var4)); if (isNil "_this") then { call ##var1##_##var2##_fnc_##var4 } else { _this call ##var1##_##var2##_fnc_##var4 } } + +// Compile-Once, at Macro. As opposed to Compile-Once, on first use. +#define PREPMAIN_SYS(var1,var2,var3) ##var1##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3)) +#define PREP_SYS(var1,var2,var3) ##var1##_##var2##_fnc_##var3 = COMPILE_FILE_SYS(var1,var2,DOUBLES(fnc,var3)) +#define PREP_SYS2(var1,var2,var3,var4) ##var1##_##var2##_fnc_##var4 = COMPILE_FILE_SYS(var1,var3,DOUBLES(fnc,var4)) + +#define LSTR(var1) TRIPLES(ADDON,STR,var1) + +#ifndef DEBUG_SETTINGS + #define DEBUG_SETTINGS [false, true, false] +#endif + +#define MSG_INIT QUOTE(Initializing: ADDON version: VERSION) + +// ************************************* +// User Functions +#define CFGSETTINGS CFGSETTINGSS(PREFIX,COMPONENT) +#define PATHTO(var1) PATHTO_SYS(PREFIX,COMPONENT_F,var1) +#define PATHTOF(var1) PATHTOF_SYS(PREFIX,COMPONENT,var1) +#define PATHTOEF(var1,var2) PATHTOF_SYS(PREFIX,var1,var2) +#define QPATHTOF(var1) QUOTE(PATHTOF(var1)) +#define QPATHTOEF(var1,var2) QUOTE(PATHTOEF(var1,var2)) + +#define COMPILE_FILE(var1) COMPILE_FILE_SYS(PREFIX,COMPONENT_F,var1) +#define COMPILE_FILE_CFG(var1) COMPILE_FILE_CFG_SYS(PREFIX,COMPONENT_F,var1) +#define COMPILE_FILE2(var1) COMPILE_FILE2_SYS('var1') +#define COMPILE_FILE2_CFG(var1) COMPILE_FILE2_CFG_SYS('var1') + + +#define VERSIONING_SYS(var1) class CfgSettings \ +{ \ + class CBA \ + { \ + class Versioning \ + { \ + class var1 \ + { \ + }; \ + }; \ + }; \ +}; + +#define VERSIONING VERSIONING_SYS(PREFIX) + +/* ------------------------------------------- +Macro: GVAR() + Get full variable identifier for a global variable owned by this component. + +Parameters: + VARIABLE - Partial name of global variable owned by this component [Any]. + +Example: + (begin example) + GVAR(frog) = 12; + // In SPON_FrogDancing component, equivalent to SPON_FrogDancing_frog = 12 + (end) + +Author: + Sickboy +------------------------------------------- */ +#define GVAR(var1) DOUBLES(ADDON,var1) +#define EGVAR(var1,var2) TRIPLES(PREFIX,var1,var2) +#define QGVAR(var1) QUOTE(GVAR(var1)) +#define QEGVAR(var1,var2) QUOTE(EGVAR(var1,var2)) +#define QQGVAR(var1) QUOTE(QGVAR(var1)) +#define QQEGVAR(var1,var2) QUOTE(QEGVAR(var1,var2)) + +/* ------------------------------------------- +Macro: GVARMAIN() + Get full variable identifier for a global variable owned by this addon. + +Parameters: + VARIABLE - Partial name of global variable owned by this addon [Any]. + +Example: + (begin example) + GVARMAIN(frog) = 12; + // In SPON_FrogDancing component, equivalent to SPON_frog = 12 + (end) + +Author: + Sickboy +------------------------------------------- */ +#define GVARMAIN(var1) GVARMAINS(PREFIX,var1) +#define QGVARMAIN(var1) QUOTE(GVARMAIN(var1)) +#define QQGVARMAIN(var1) QUOTE(QGVARMAIN(var1)) +// TODO: What's this? +#define SETTINGS DOUBLES(PREFIX,settings) +#define CREATELOGIC CREATELOGICS(PREFIX,COMPONENT) +#define CREATELOGICGLOBAL CREATELOGICGLOBALS(PREFIX,COMPONENT) +#define CREATELOGICGLOBALTEST CREATELOGICGLOBALTESTS(PREFIX,COMPONENT) +#define CREATELOGICLOCAL CREATELOGICLOCALS(PREFIX,COMPONENT) +#define CREATELOGICMAIN CREATELOGICS(PREFIX,MAINLOGIC) +#define GETVAR(var1) GETVARS(PREFIX,COMPONENT,var1) +#define SETVAR SETVARS(PREFIX,COMPONENT) +#define SETVARMAIN SETVARMAINS(PREFIX) +#define IFCOUNT(var1,var2,var3) if (count ##var1 > ##var2) then { ##var3 = ##var1 select ##var2 }; + +/* ------------------------------------------- +Macro: PREP() + +Description: + Defines a function. + + Full file path: + '\MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\fnc_.sqf' + + Resulting function name: + 'PREFIX_COMPONENT_' + + The PREP macro should be placed in a script run by a XEH preStart and XEH preInit event. + + The PREP macro allows for CBA function caching, which drastically speeds up load times. + Beware though that function caching is enabled by default and as such to disable it, you need to + #define DISABLE_COMPILE_CACHE above your #include "script_components.hpp" include! + + The function will be defined in ui and mission namespace. It can not be overwritten without + a mission restart. + +Parameters: + FUNCTION NAME - Name of the function, unquoted + +Examples: + (begin example) + PREP(banana); + call FUNC(banana); + (end) + +Author: + dixon13 + ------------------------------------------- */ +//#define PREP(var1) PREP_SYS(PREFIX,COMPONENT_F,var1) + +#ifdef DISABLE_COMPILE_CACHE + #define PREP(var1) TRIPLES(ADDON,fnc,var1) = compile preProcessFileLineNumbers 'PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))' + #define PREPMAIN(var1) TRIPLES(PREFIX,fnc,var1) = compile preProcessFileLineNumbers 'PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))' +#else + #define PREP(var1) ['PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))', 'TRIPLES(ADDON,fnc,var1)'] call SLX_XEH_COMPILE_NEW + #define PREPMAIN(var1) ['PATHTO_SYS(PREFIX,COMPONENT_F,DOUBLES(fnc,var1))', 'TRIPLES(PREFIX,fnc,var1)'] call SLX_XEH_COMPILE_NEW +#endif + +/* ------------------------------------------- +Macro: PATHTO_FNC() + +Description: + Defines a function inside CfgFunctions. + + Full file path in addons: + '\MAINPREFIX\PREFIX\SUBPREFIX\COMPONENT\fnc_.sqf' + Define 'RECOMPILE' to enable recompiling. + +Parameters: + FUNCTION NAME - Name of the function, unquoted + +Examples: + (begin example) + // file name: fnc_addPerFrameHandler.sqf + class CfgFunctions { + class CBA { + class Misc { + PATHTO_FNC(addPerFrameHandler); + }; + }; + }; + // -> CBA_fnc_addPerFrameHandler + (end) + +Author: + dixon13, commy2 + ------------------------------------------- */ +#ifdef RECOMPILE + #undef RECOMPILE + #define RECOMPILE recompile = 1 +#else + #define RECOMPILE recompile = 0 +#endif + +#define PATHTO_FNC(func) class func {\ + file = QPATHTOF(DOUBLES(fnc,func).sqf);\ + RECOMPILE;\ +} + +#define FUNC(var1) TRIPLES(ADDON,fnc,var1) +#define FUNCMAIN(var1) TRIPLES(PREFIX,fnc,var1) +#define FUNC_INNER(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2) +#define EFUNC(var1,var2) FUNC_INNER(var1,var2) +#define QFUNC(var1) QUOTE(FUNC(var1)) +#define QFUNCMAIN(var1) QUOTE(FUNCMAIN(var1)) +#define QFUNC_INNER(var1,var2) QUOTE(FUNC_INNER(var1,var2)) +#define QEFUNC(var1,var2) QUOTE(EFUNC(var1,var2)) +#define QQFUNC(var1) QUOTE(QFUNC(var1)) +#define QQFUNCMAIN(var1) QUOTE(QFUNCMAIN(var1)) +#define QQFUNC_INNER(var1,var2) QUOTE(QFUNC_INNER(var1,var2)) +#define QQEFUNC(var1,var2) QUOTE(QEFUNC(var1,var2)) + +#ifndef PRELOAD_ADDONS + #define PRELOAD_ADDONS class CfgAddons \ +{ \ + class PreloadAddons \ + { \ + class ADDON \ + { \ + list[]={ QUOTE(ADDON) }; \ + }; \ + }; \ +} +#endif + +/* ------------------------------------------- +Macros: ARG_#() + Select from list of array arguments + +Parameters: + VARIABLE(1-8) - elements for the list + +Author: + Rommel +------------------------------------------- */ +#define ARG_1(A,B) ((A) select (B)) +#define ARG_2(A,B,C) (ARG_1(ARG_1(A,B),C)) +#define ARG_3(A,B,C,D) (ARG_1(ARG_2(A,B,C),D)) +#define ARG_4(A,B,C,D,E) (ARG_1(ARG_3(A,B,C,D),E)) +#define ARG_5(A,B,C,D,E,F) (ARG_1(ARG_4(A,B,C,D,E),F)) +#define ARG_6(A,B,C,D,E,F,G) (ARG_1(ARG_5(A,B,C,D,E,F),G)) +#define ARG_7(A,B,C,D,E,F,G,H) (ARG_1(ARG_6(A,B,C,D,E,E,F,G),H)) +#define ARG_8(A,B,C,D,E,F,G,H,I) (ARG_1(ARG_7(A,B,C,D,E,E,F,G,H),I)) + +/* ------------------------------------------- +Macros: ARR_#() + Create list from arguments. Useful for working around , in macro parameters. + 1-8 arguments possible. + +Parameters: + VARIABLE(1-8) - elements for the list + +Author: + Nou +------------------------------------------- */ +#define ARR_1(ARG1) ARG1 +#define ARR_2(ARG1,ARG2) ARG1, ARG2 +#define ARR_3(ARG1,ARG2,ARG3) ARG1, ARG2, ARG3 +#define ARR_4(ARG1,ARG2,ARG3,ARG4) ARG1, ARG2, ARG3, ARG4 +#define ARR_5(ARG1,ARG2,ARG3,ARG4,ARG5) ARG1, ARG2, ARG3, ARG4, ARG5 +#define ARR_6(ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 +#define ARR_7(ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7 +#define ARR_8(ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7, ARG8 + +/* ------------------------------------------- +Macros: FORMAT_#(STR, ARG1) + Format - Useful for working around , in macro parameters. + 1-8 arguments possible. + +Parameters: + STRING - string used by format + VARIABLE(1-8) - elements for usage in format + +Author: + Nou & Sickboy +------------------------------------------- */ +#define FORMAT_1(STR,ARG1) format[STR, ARG1] +#define FORMAT_2(STR,ARG1,ARG2) format[STR, ARG1, ARG2] +#define FORMAT_3(STR,ARG1,ARG2,ARG3) format[STR, ARG1, ARG2, ARG3] +#define FORMAT_4(STR,ARG1,ARG2,ARG3,ARG4) format[STR, ARG1, ARG2, ARG3, ARG4] +#define FORMAT_5(STR,ARG1,ARG2,ARG3,ARG4,ARG5) format[STR, ARG1, ARG2, ARG3, ARG4, ARG5] +#define FORMAT_6(STR,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6) format[STR, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6] +#define FORMAT_7(STR,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7) format[STR, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7] +#define FORMAT_8(STR,ARG1,ARG2,ARG3,ARG4,ARG5,ARG6,ARG7,ARG8) format[STR, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7, ARG8] + +// CONTROL(46) 12 +#define DISPLAY(A) (findDisplay A) +#define CONTROL(A) DISPLAY(A) displayCtrl + +/* ------------------------------------------- +Macros: IS_x() + Checking the data types of variables. + + IS_ARRAY() - Array + IS_BOOL() - Boolean + IS_BOOLEAN() - UI display handle(synonym for ) + IS_CODE() - Code block (i.e a compiled function) + IS_CONFIG() - Configuration + IS_CONTROL() - UI control handle. + IS_DISPLAY() - UI display handle. + IS_FUNCTION() - A compiled function (synonym for ) + IS_GROUP() - Group. + IS_INTEGER() - Is a number a whole number? + IS_LOCATION() - World location. + IS_NUMBER() - A floating point number (synonym for ) + IS_OBJECT() - World object. + IS_SCALAR() - Floating point number. + IS_SCRIPT() - A script handle (as returned by execVM and spawn commands). + IS_SIDE() - Game side. + IS_STRING() - World object. + IS_TEXT() - Structured text. + +Parameters: + VARIABLE - Variable to check if it is of a particular type [Any, not nil] + +Author: + Spooner +------------------------------------------- */ +#define IS_META_SYS(VAR,TYPE) (if (isNil {VAR}) then {false} else {(VAR) isEqualType TYPE}) +#define IS_ARRAY(VAR) IS_META_SYS(VAR,[]) +#define IS_BOOL(VAR) IS_META_SYS(VAR,false) +#define IS_CODE(VAR) IS_META_SYS(VAR,{}) +#define IS_CONFIG(VAR) IS_META_SYS(VAR,configNull) +#define IS_CONTROL(VAR) IS_META_SYS(VAR,controlNull) +#define IS_DISPLAY(VAR) IS_META_SYS(VAR,displayNull) +#define IS_GROUP(VAR) IS_META_SYS(VAR,grpNull) +#define IS_OBJECT(VAR) IS_META_SYS(VAR,objNull) +#define IS_SCALAR(VAR) IS_META_SYS(VAR,0) +#define IS_SCRIPT(VAR) IS_META_SYS(VAR,scriptNull) +#define IS_SIDE(VAR) IS_META_SYS(VAR,west) +#define IS_STRING(VAR) IS_META_SYS(VAR,"STRING") +#define IS_TEXT(VAR) IS_META_SYS(VAR,text "") +#define IS_LOCATION(VAR) IS_META_SYS(VAR,locationNull) + +#define IS_BOOLEAN(VAR) IS_BOOL(VAR) +#define IS_FUNCTION(VAR) IS_CODE(VAR) +#define IS_INTEGER(VAR) (if (IS_SCALAR(VAR)) then {floor (VAR) == (VAR)} else {false}) +#define IS_NUMBER(VAR) IS_SCALAR(VAR) + +#define FLOAT_TO_STRING(num) (if (_this == 0) then {"0"} else {str parseNumber (str (_this % _this) + str floor abs _this) + "." + (str (abs _this - floor abs _this) select [2]) + "0"}) + +/* ------------------------------------------- +Macro: SCRIPT() + Sets name of script (relies on PREFIX and COMPONENT values being #defined). + +Parameters: + NAME - Name of script [Indentifier] + +Example: + (begin example) + SCRIPT(eradicateMuppets); + (end) + +Author: + Spooner +------------------------------------------- */ +#define SCRIPT(NAME) \ + scriptName 'PREFIX\COMPONENT\NAME' + +/* ------------------------------------------- +Macros: EXPLODE_n() + DEPRECATED - Use param/params commands added in Arma 3 1.48 + + Splitting an ARRAY into a number of variables (A, B, C, etc). + + Note that this NOT does make the created variables private. + _PVT variants do. + + EXPLODE_1(ARRAY,A,B) - Split a 1-element array into separate variable. + EXPLODE_2(ARRAY,A,B) - Split a 2-element array into separate variables. + EXPLODE_3(ARRAY,A,B,C) - Split a 3-element array into separate variables. + EXPLODE_4(ARRAY,A,B,C,D) - Split a 4-element array into separate variables. + EXPLODE_5(ARRAY,A,B,C,D,E) - Split a 5-element array into separate variables. + EXPLODE_6(ARRAY,A,B,C,D,E,F) - Split a 6-element array into separate variables. + EXPLODE_7(ARRAY,A,B,C,D,E,F,G) - Split a 7-element array into separate variables. + EXPLODE_8(ARRAY,A,B,C,D,E,F,G,H) - Split a 8-element array into separate variables. + EXPLODE_9(ARRAY,A,B,C,D,E,F,G,H,I) - Split a 9-element array into separate variables. + +Parameters: + ARRAY - Array to read from [Array] + A..H - Names of variables to set from array [Identifier] + +Example: + (begin example) + _array = ["fred", 156.8, 120.9]; + EXPLODE_3(_array,_name,_height,_weight); + (end) + +Author: + Spooner +------------------------------------------- */ +#define EXPLODE_1_SYS(ARRAY,A) A = ARRAY param [0] +#define EXPLODE_1(ARRAY,A) EXPLODE_1_SYS(ARRAY,A); TRACE_1("EXPLODE_1, " + QUOTE(ARRAY),A) +#define EXPLODE_1_PVT(ARRAY,A) ARRAY params [#A]; TRACE_1("EXPLODE_1, " + QUOTE(ARRAY),A) + +#define EXPLODE_2_SYS(ARRAY,A,B) EXPLODE_1_SYS(ARRAY,A); B = ARRAY param [1] +#define EXPLODE_2(ARRAY,A,B) EXPLODE_2_SYS(ARRAY,A,B); TRACE_2("EXPLODE_2, " + QUOTE(ARRAY),A,B) +#define EXPLODE_2_PVT(ARRAY,A,B) ARRAY params [#A,#B]; TRACE_2("EXPLODE_2, " + QUOTE(ARRAY),A,B) + +#define EXPLODE_3_SYS(ARRAY,A,B,C) EXPLODE_2_SYS(ARRAY,A,B); C = ARRAY param [2] +#define EXPLODE_3(ARRAY,A,B,C) EXPLODE_3_SYS(ARRAY,A,B,C); TRACE_3("EXPLODE_3, " + QUOTE(ARRAY),A,B,C) +#define EXPLODE_3_PVT(ARRAY,A,B,C) ARRAY params [#A,#B,#C]; TRACE_3("EXPLODE_3, " + QUOTE(ARRAY),A,B,C) + +#define EXPLODE_4_SYS(ARRAY,A,B,C,D) EXPLODE_3_SYS(ARRAY,A,B,C); D = ARRAY param [3] +#define EXPLODE_4(ARRAY,A,B,C,D) EXPLODE_4_SYS(ARRAY,A,B,C,D); TRACE_4("EXPLODE_4, " + QUOTE(ARRAY),A,B,C,D) +#define EXPLODE_4_PVT(ARRAY,A,B,C,D) ARRAY params [#A,#B,#C,#D]; TRACE_4("EXPLODE_4, " + QUOTE(ARRAY),A,B,C,D) + +#define EXPLODE_5_SYS(ARRAY,A,B,C,D,E) EXPLODE_4_SYS(ARRAY,A,B,C,D); E = ARRAY param [4] +#define EXPLODE_5(ARRAY,A,B,C,D,E) EXPLODE_5_SYS(ARRAY,A,B,C,D,E); TRACE_5("EXPLODE_5, " + QUOTE(ARRAY),A,B,C,D,E) +#define EXPLODE_5_PVT(ARRAY,A,B,C,D,E) ARRAY params [#A,#B,#C,#D,#E]; TRACE_5("EXPLODE_5, " + QUOTE(ARRAY),A,B,C,D,E) + +#define EXPLODE_6_SYS(ARRAY,A,B,C,D,E,F) EXPLODE_5_SYS(ARRAY,A,B,C,D,E); F = ARRAY param [5] +#define EXPLODE_6(ARRAY,A,B,C,D,E,F) EXPLODE_6_SYS(ARRAY,A,B,C,D,E,F); TRACE_6("EXPLODE_6, " + QUOTE(ARRAY),A,B,C,D,E,F) +#define EXPLODE_6_PVT(ARRAY,A,B,C,D,E,F) ARRAY params [#A,#B,#C,#D,#E,#F]; TRACE_6("EXPLODE_6, " + QUOTE(ARRAY),A,B,C,D,E,F) + +#define EXPLODE_7_SYS(ARRAY,A,B,C,D,E,F,G) EXPLODE_6_SYS(ARRAY,A,B,C,D,E,F); G = ARRAY param [6] +#define EXPLODE_7(ARRAY,A,B,C,D,E,F,G) EXPLODE_7_SYS(ARRAY,A,B,C,D,E,F,G); TRACE_7("EXPLODE_7, " + QUOTE(ARRAY),A,B,C,D,E,F,G) +#define EXPLODE_7_PVT(ARRAY,A,B,C,D,E,F,G) ARRAY params [#A,#B,#C,#D,#E,#F,#G]; TRACE_7("EXPLODE_7, " + QUOTE(ARRAY),A,B,C,D,E,F,G) + +#define EXPLODE_8_SYS(ARRAY,A,B,C,D,E,F,G,H) EXPLODE_7_SYS(ARRAY,A,B,C,D,E,F,G); H = ARRAY param [7] +#define EXPLODE_8(ARRAY,A,B,C,D,E,F,G,H) EXPLODE_8_SYS(ARRAY,A,B,C,D,E,F,G,H); TRACE_8("EXPLODE_8, " + QUOTE(ARRAY),A,B,C,D,E,F,G,H) +#define EXPLODE_8_PVT(ARRAY,A,B,C,D,E,F,G,H) ARRAY params [#A,#B,#C,#D,#E,#F,#G,#H]; TRACE_8("EXPLODE_8, " + QUOTE(ARRAY),A,B,C,D,E,F,G,H) + +#define EXPLODE_9_SYS(ARRAY,A,B,C,D,E,F,G,H,I) EXPLODE_8_SYS(ARRAY,A,B,C,D,E,F,G,H); I = ARRAY param [8] +#define EXPLODE_9(ARRAY,A,B,C,D,E,F,G,H,I) EXPLODE_9_SYS(ARRAY,A,B,C,D,E,F,G,H,I); TRACE_9("EXPLODE_9, " + QUOTE(ARRAY),A,B,C,D,E,F,G,H,I) +#define EXPLODE_9_PVT(ARRAY,A,B,C,D,E,F,G,H,I) ARRAY params [#A,#B,#C,#D,#E,#F,#G,#H,#I]; TRACE_9("EXPLODE_9, " + QUOTE(ARRAY),A,B,C,D,E,F,G,H,I) + +/* ------------------------------------------- +Macro: xSTRING() + Get full string identifier from a stringtable owned by this component. + +Parameters: + VARIABLE - Partial name of global variable owned by this component [Any]. + +Example: + ADDON is CBA_Balls. + (begin example) + // Localized String (localize command must still be used with it) + LSTRING(Example); // STR_CBA_Balls_Example; + // Config String (note the $) + CSTRING(Example); // $STR_CBA_Balls_Example; + (end) + +Author: + Jonpas +------------------------------------------- */ +#ifndef STRING_MACROS_GUARD +#define STRING_MACROS_GUARD + #define LSTRING(var1) QUOTE(TRIPLES(STR,ADDON,var1)) + #define ELSTRING(var1,var2) QUOTE(TRIPLES(STR,DOUBLES(PREFIX,var1),var2)) + #define CSTRING(var1) QUOTE(TRIPLES($STR,ADDON,var1)) + #define ECSTRING(var1,var2) QUOTE(TRIPLES($STR,DOUBLES(PREFIX,var1),var2)) + + #define LLSTRING(var1) localize QUOTE(TRIPLES(STR,ADDON,var1)) + #define LELSTRING(var1,var2) localize QUOTE(TRIPLES(STR,DOUBLES(PREFIX,var1),var2)) +#endif + + +/* ------------------------------------------- +Group: Managing Function Parameters +------------------------------------------- */ + +/* ------------------------------------------- +Macros: PARAMS_n() + DEPRECATED - Use param/params commands added in Arma 3 1.48 + + Setting variables based on parameters passed to a function. + + Each parameter is defines as private and set to the appropriate value from _this. + + PARAMS_1(A) - Get 1 parameter from the _this array (or _this if it's not an array). + PARAMS_2(A,B) - Get 2 parameters from the _this array. + PARAMS_3(A,B,C) - Get 3 parameters from the _this array. + PARAMS_4(A,B,C,D) - Get 4 parameters from the _this array. + PARAMS_5(A,B,C,D,E) - Get 5 parameters from the _this array. + PARAMS_6(A,B,C,D,E,F) - Get 6 parameters from the _this array. + PARAMS_7(A,B,C,D,E,F,G) - Get 7 parameters from the _this array. + PARAMS_8(A,B,C,D,E,F,G,H) - Get 8 parameters from the _this array. + +Parameters: + A..H - Name of variable to read from _this [Identifier] + +Example: + A function called like this: + (begin example) + [_name,_address,_telephone] call recordPersonalDetails; + (end) + expects 3 parameters and those variables could be initialised at the start of the function definition with: + (begin example) + recordPersonalDetails = { + PARAMS_3(_name,_address,_telephone); + // Rest of function follows... + }; + (end) + +Author: + Spooner +------------------------------------------- */ +#define PARAMS_1(A) EXPLODE_1_PVT(_this,A) +#define PARAMS_2(A,B) EXPLODE_2_PVT(_this,A,B) +#define PARAMS_3(A,B,C) EXPLODE_3_PVT(_this,A,B,C) +#define PARAMS_4(A,B,C,D) EXPLODE_4_PVT(_this,A,B,C,D) +#define PARAMS_5(A,B,C,D,E) EXPLODE_5_PVT(_this,A,B,C,D,E) +#define PARAMS_6(A,B,C,D,E,F) EXPLODE_6_PVT(_this,A,B,C,D,E,F) +#define PARAMS_7(A,B,C,D,E,F,G) EXPLODE_7_PVT(_this,A,B,C,D,E,F,G) +#define PARAMS_8(A,B,C,D,E,F,G,H) EXPLODE_8_PVT(_this,A,B,C,D,E,F,G,H) +#define PARAMS_9(A,B,C,D,E,F,G,H,I) EXPLODE_9_PVT(_this,A,B,C,D,E,F,G,H,I) + +/* ------------------------------------------- +Macro: DEFAULT_PARAM() + DEPRECATED - Use param/params commands added in Arma 3 1.48 + + Getting a default function parameter. This may be used together with to have a mix of required and + optional parameters. + +Parameters: + INDEX - Index of parameter in _this [Integer, 0+] + NAME - Name of the variable to set [Identifier] + DEF_VALUE - Default value to use in case the array is too short or the value at INDEX is nil [Any] + +Example: + A function called with optional parameters: + (begin example) + [_name] call myFunction; + [_name, _numberOfLegs] call myFunction; + [_name, _numberOfLegs, _hasAHead] call myFunction; + (end) + 1 required parameter and 2 optional parameters. Those variables could be initialised at the start of the function + definition with: + (begin example) + myFunction = { + PARAMS_1(_name); + DEFAULT_PARAM(1,_numberOfLegs,2); + DEFAULT_PARAM(2,_hasAHead,true); + // Rest of function follows... + }; + (end) + +Author: + Spooner +------------------------------------------- */ +#define DEFAULT_PARAM(INDEX,NAME,DEF_VALUE) \ + private [#NAME,"_this"]; \ + ISNILS(_this,[]); \ + NAME = _this param [INDEX, DEF_VALUE]; \ + TRACE_3("DEFAULT_PARAM",INDEX,NAME,DEF_VALUE) + +/* ------------------------------------------- +Macro: KEY_PARAM() + Get value from key in _this list, return default when key is not included in list. + +Parameters: + KEY - Key name [String] + NAME - Name of the variable to set [Identifier] + DEF_VALUE - Default value to use in case key not found [ANY] + +Example: + + +Author: + Muzzleflash +------------------------------------------- */ +#define KEY_PARAM(KEY,NAME,DEF_VALUE) \ + private #NAME; \ + NAME = [toLower KEY, toUpper KEY, DEF_VALUE, RETNIL(_this)] call CBA_fnc_getArg; \ + TRACE_3("KEY_PARAM",KEY,NAME,DEF_VALUE) + +/* ------------------------------------------- +Group: Assertions +------------------------------------------- */ + +#define ASSERTION_ERROR(MESSAGE) ERROR_WITH_TITLE("Assertion failed!",MESSAGE) + +/* ------------------------------------------- +Macro: ASSERT_TRUE() + Asserts that a CONDITION is true. When an assertion fails, an error is raised with the given MESSAGE. + +Parameters: + CONDITION - Condition to assert as true [Boolean] + MESSSAGE - Message to display if (A OPERATOR B) is false [String] + +Example: + (begin example) + ASSERT_TRUE(_frogIsDead,"The frog is alive"); + (end) + +Author: + Spooner +------------------------------------------- */ +#define ASSERT_TRUE(CONDITION,MESSAGE) \ + if (not (CONDITION)) then \ + { \ + ASSERTION_ERROR('Assertion (CONDITION) failed!\n\n' + (MESSAGE)); \ + } + +/* ------------------------------------------- +Macro: ASSERT_FALSE() + Asserts that a CONDITION is false. When an assertion fails, an error is raised with the given MESSAGE. + +Parameters: + CONDITION - Condition to assert as false [Boolean] + MESSSAGE - Message to display if (A OPERATOR B) is true [String] + +Example: + (begin example) + ASSERT_FALSE(_frogIsDead,"The frog died"); + (end) + +Author: + Spooner +------------------------------------------- */ +#define ASSERT_FALSE(CONDITION,MESSAGE) \ + if (CONDITION) then \ + { \ + ASSERTION_ERROR('Assertion (not (CONDITION)) failed!\n\n' + (MESSAGE)) \ + } + +/* ------------------------------------------- +Macro: ASSERT_OP() + Asserts that (A OPERATOR B) is true. When an assertion fails, an error is raised with the given MESSAGE. + +Parameters: + A - First value [Any] + OPERATOR - Binary operator to use [Operator] + B - Second value [Any] + MESSSAGE - Message to display if (A OPERATOR B) is false. [String] + +Example: + (begin example) + ASSERT_OP(_fish,>,5,"Too few fish!"); + (end) + +Author: + Spooner +------------------------------------------- */ +#define ASSERT_OP(A,OPERATOR,B,MESSAGE) \ + if (not ((A) OPERATOR (B))) then \ + { \ + ASSERTION_ERROR('Assertion (A OPERATOR B) failed!\n' + 'A: ' + (str (A)) + '\n' + 'B: ' + (str (B)) + "\n\n" + (MESSAGE)); \ + } + +/* ------------------------------------------- +Macro: ASSERT_DEFINED() + Asserts that a VARIABLE is defined. When an assertion fails, an error is raised with the given MESSAGE.. + +Parameters: + VARIABLE - Variable to test if defined [String or Function]. + MESSAGE - Message to display if variable is undefined [String]. + +Examples: + (begin example) + ASSERT_DEFINED("_anUndefinedVar","Too few fish!"); + ASSERT_DEFINED({ obj getVariable "anUndefinedVar" },"Too many fish!"); + (end) + +Author: + Spooner +------------------------------------------- */ +#define ASSERT_DEFINED(VARIABLE,MESSAGE) \ + if (isNil VARIABLE) then \ + { \ + ASSERTION_ERROR('Assertion (VARIABLE is defined) failed!\n\n' + (MESSAGE)); \ + } + +/* ------------------------------------------- +Group: Unit tests +------------------------------------------- */ +#define TEST_SUCCESS(MESSAGE) MESSAGE_WITH_TITLE("Test OK",MESSAGE) +#define TEST_FAIL(MESSAGE) ERROR_WITH_TITLE("Test FAIL",MESSAGE) + +/* ------------------------------------------- +Macro: TEST_TRUE() + Tests that a CONDITION is true. + If the condition is not true, an error is raised with the given MESSAGE. + +Parameters: + CONDITION - Condition to assert as true [Boolean] + MESSSAGE - Message to display if (A OPERATOR B) is false [String] + +Example: + (begin example) + TEST_TRUE(_frogIsDead,"The frog is alive"); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define TEST_TRUE(CONDITION, MESSAGE) \ + if (CONDITION) then \ + { \ + TEST_SUCCESS('(CONDITION)'); \ + } \ + else \ + { \ + TEST_FAIL('(CONDITION) ' + (MESSAGE)); \ + } + +/* ------------------------------------------- +Macro: TEST_FALSE() + Tests that a CONDITION is false. + If the condition is not false, an error is raised with the given MESSAGE. + +Parameters: + CONDITION - Condition to test as false [Boolean] + MESSSAGE - Message to display if (A OPERATOR B) is true [String] + +Example: + (begin example) + TEST_FALSE(_frogIsDead,"The frog died"); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define TEST_FALSE(CONDITION, MESSAGE) \ + if (not (CONDITION)) then \ + { \ + TEST_SUCCESS('(not (CONDITION))'); \ + } \ + else \ + { \ + TEST_FAIL('(not (CONDITION)) ' + (MESSAGE)); \ + } + +/* ------------------------------------------- +Macro: TEST_OP() + Tests that (A OPERATOR B) is true. + If the test fails, an error is raised with the given MESSAGE. + +Parameters: + A - First value [Any] + OPERATOR - Binary operator to use [Operator] + B - Second value [Any] + MESSSAGE - Message to display if (A OPERATOR B) is false. [String] + +Example: + (begin example) + TEST_OP(_fish,>,5,"Too few fish!"); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define TEST_OP(A,OPERATOR,B,MESSAGE) \ + if ((A) OPERATOR (B)) then \ + { \ + TEST_SUCCESS('(A OPERATOR B)') \ + } \ + else \ + { \ + TEST_FAIL('(A OPERATOR B)') \ + }; + +/* ------------------------------------------- +Macro: TEST_DEFINED_AND_OP() + Tests that A and B are defined and (A OPERATOR B) is true. + If the test fails, an error is raised with the given MESSAGE. + +Parameters: + A - First value [Any] + OPERATOR - Binary operator to use [Operator] + B - Second value [Any] + MESSSAGE - Message to display [String] + +Example: + (begin example) + TEST_OP(_fish,>,5,"Too few fish!"); + (end) + +Author: + Killswitch, PabstMirror +------------------------------------------- */ +#define TEST_DEFINED_AND_OP(A,OPERATOR,B,MESSAGE) \ + if (isNil #A) then { \ + TEST_FAIL('(A is not defined) ' + (MESSAGE)); \ + } else { \ + if (isNil #B) then { \ + TEST_FAIL('(B is not defined) ' + (MESSAGE)); \ + } else { \ + if ((A) OPERATOR (B)) then { \ + TEST_SUCCESS('(A OPERATOR B) ' + (MESSAGE)) \ + } else { \ + TEST_FAIL('(A OPERATOR B) ' + (MESSAGE)) \ + }; }; }; + + +/* ------------------------------------------- +Macro: TEST_DEFINED() + Tests that a VARIABLE is defined. + +Parameters: + VARIABLE - Variable to test if defined [String or Function]. + MESSAGE - Message to display if variable is undefined [String]. + +Examples: + (begin example) + TEST_DEFINED("_anUndefinedVar","Too few fish!"); + TEST_DEFINED({ obj getVariable "anUndefinedVar" },"Too many fish!"); + (end) + +Author: + Killswitch +------------------------------------------- */ +#define TEST_DEFINED(VARIABLE,MESSAGE) \ + if (not isNil VARIABLE) then \ + { \ + TEST_SUCCESS('(' + VARIABLE + ' is defined)'); \ + } \ + else \ + { \ + TEST_FAIL('(' + VARIABLE + ' is not defined)' + (MESSAGE)); \ + } + +/* ------------------------------------------- +Group: Managing Deprecation +------------------------------------------- */ + +/* ------------------------------------------- +Macro: DEPRECATE_SYS() + Allow deprecation of a function that has been renamed. + + Replaces an old OLD_FUNCTION (which will have PREFIX_ prepended) with a NEW_FUNCTION + (PREFIX_ prepended) with the intention that the old function will be disabled in the future. + + Shows a warning in RPT each time the deprecated function is used, but runs the new function. + +Parameters: + OLD_FUNCTION - Full name of old function [Identifier for function that does not exist any more] + NEW_FUNCTION - Full name of new function [Function] + +Example: + (begin example) + // After renaming CBA_fnc_frog as CBA_fnc_fish + DEPRECATE_SYS(CBA_fnc_frog,CBA_fnc_fish); + (end) + +Author: + Sickboy +------------------------------------------- */ +#define DEPRECATE_SYS(OLD_FUNCTION,NEW_FUNCTION) \ + OLD_FUNCTION = { \ + WARNING('Deprecated function used: OLD_FUNCTION (new: NEW_FUNCTION) in ADDON'); \ + if (isNil "_this") then { call NEW_FUNCTION } else { _this call NEW_FUNCTION }; \ + } + +/* ------------------------------------------- +Macro: DEPRECATE() + Allow deprecation of a function, in the current component, that has been renamed. + + Replaces an OLD_FUNCTION (which will have PREFIX_ prepended) with a NEW_FUNCTION + (PREFIX_ prepended) with the intention that the old function will be disabled in the future. + + Shows a warning in RPT each time the deprecated function is used, but runs the new function. + +Parameters: + OLD_FUNCTION - Name of old function, assuming PREFIX [Identifier for function that does not exist any more] + NEW_FUNCTION - Name of new function, assuming PREFIX [Function] + +Example: + (begin example) + // After renaming CBA_fnc_frog as CBA_fnc_fish + DEPRECATE(fnc_frog,fnc_fish); + (end) + +Author: + Sickboy +------------------------------------------- */ +#define DEPRECATE(OLD_FUNCTION,NEW_FUNCTION) \ + DEPRECATE_SYS(DOUBLES(PREFIX,OLD_FUNCTION),DOUBLES(PREFIX,NEW_FUNCTION)) + +/* ------------------------------------------- +Macro: OBSOLETE_SYS() + Replace a function that has become obsolete. + + Replace an obsolete OLD_FUNCTION with a simple COMMAND_FUNCTION, with the intention that anyone + using the function should replace it with the simple command, since the function will be disabled in the future. + + Shows a warning in RPT each time the deprecated function is used, and runs the command function. + +Parameters: + OLD_FUNCTION - Full name of old function [Identifier for function that does not exist any more] + COMMAND_CODE - Code to replace the old function [Function] + +Example: + (begin example) + // In Arma2, currentWeapon command made the CBA_fMyWeapon function obsolete: + OBSOLETE_SYS(CBA_fMyWeapon,{ currentWeapon player }); + (end) + +Author: + Spooner +------------------------------------------- */ +#define OBSOLETE_SYS(OLD_FUNCTION,COMMAND_CODE) \ + OLD_FUNCTION = { \ + WARNING('Obsolete function used: (use: OLD_FUNCTION) in ADDON'); \ + if (isNil "_this") then { call COMMAND_CODE } else { _this call COMMAND_CODE }; \ + } + +/* ------------------------------------------- +Macro: OBSOLETE() + Replace a function, in the current component, that has become obsolete. + + Replace an obsolete OLD_FUNCTION (which will have PREFIX_ prepended) with a simple + COMMAND_CODE, with the intention that anyone using the function should replace it with the simple + command. + + Shows a warning in RPT each time the deprecated function is used. + +Parameters: + OLD_FUNCTION - Name of old function, assuming PREFIX [Identifier for function that does not exist any more] + COMMAND_CODE - Code to replace the old function [Function] + +Example: + (begin example) + // In Arma2, currentWeapon command made the CBA_fMyWeapon function obsolete: + OBSOLETE(fMyWeapon,{ currentWeapon player }); + (end) + +Author: + Spooner +------------------------------------------- */ +#define OBSOLETE(OLD_FUNCTION,COMMAND_CODE) \ + OBSOLETE_SYS(DOUBLES(PREFIX,OLD_FUNCTION),COMMAND_CODE) + +#define BWC_CONFIG(NAME) class NAME { \ + units[] = {}; \ + weapons[] = {}; \ + requiredVersion = REQUIRED_VERSION; \ + requiredAddons[] = {}; \ + version = VERSION; \ +} + +// XEH Specific +#define XEH_CLASS CBA_Extended_EventHandlers +#define XEH_CLASS_BASE DOUBLES(XEH_CLASS,base) +#define XEH_DISABLED class EventHandlers { class XEH_CLASS {}; }; SLX_XEH_DISABLED = 1 +#define XEH_ENABLED class EventHandlers { class XEH_CLASS { EXTENDED_EVENTHANDLERS }; }; SLX_XEH_DISABLED = 0 + +// TODO: These are actually outdated; _Once ? +#define XEH_PRE_INIT QUOTE(call COMPILE_FILE(XEH_PreInit_Once)) +#define XEH_PRE_CINIT QUOTE(call COMPILE_FILE(XEH_PreClientInit_Once)) +#define XEH_PRE_SINIT QUOTE(call COMPILE_FILE(XEH_PreServerInit_Once)) + +#define XEH_POST_INIT QUOTE(call COMPILE_FILE(XEH_PostInit_Once)) +#define XEH_POST_CINIT QUOTE(call COMPILE_FILE(XEH_PostClientInit_Once)) +#define XEH_POST_SINIT QUOTE(call COMPILE_FILE(XEH_PostServerInit_Once)) + +/* ------------------------------------------- +Macro: IS_ADMIN + Check if the local machine is an admin in the multiplayer environment. + + Reports 'true' for logged and voted in admins. + +Parameters: + None + +Example: + (begin example) + // print "true" if player is admin + systemChat str IS_ADMIN; + (end) + +Author: + commy2 +------------------------------------------- */ +#define IS_ADMIN serverCommandAvailable '#kick' + +/* ------------------------------------------- +Macro: IS_ADMIN_LOGGED + Check if the local machine is a logged in admin in the multiplayer environment. + + Reports 'false' if the player was voted to be the admin. + +Parameters: + None + +Example: + (begin example) + // print "true" if player is admin and entered in the server password + systemChat str IS_ADMIN_LOGGED; + (end) + +Author: + commy2 +------------------------------------------- */ +#define IS_ADMIN_LOGGED serverCommandAvailable '#shutdown' + +/* ------------------------------------------- +Macro: FILE_EXISTS + Check if a file exists on machines with interface + + Reports "false" if the file does not exist and throws an error in RPT. + +Parameters: + FILE - Path to the file + +Example: + (begin example) + // print "true" if file exists + systemChat str FILE_EXISTS("\A3\ui_f\data\igui\cfg\cursors\weapon_ca.paa"); + (end) + +Author: + commy2 +------------------------------------------- */ +#define FILE_EXISTS(FILE) (call {\ + private _return = false;\ + isNil {\ + private _control = (uiNamespace getVariable ["RscDisplayMain", displayNull]) ctrlCreate ["RscHTML", -1];\ + if (isNull _control) then {\ + _return = loadFile (FILE) != "";\ + } else {\ + _control htmlLoad (FILE);\ + _return = ctrlHTMLLoaded _control;\ + ctrlDelete _control;\ + };\ + };\ + _return\ +}) diff --git a/mod/logosmall.paa b/logosmall.paa similarity index 100% rename from mod/logosmall.paa rename to logosmall.paa diff --git a/mod.cpp b/mod.cpp new file mode 100644 index 0000000..dd6ab1d --- /dev/null +++ b/mod.cpp @@ -0,0 +1,3 @@ +name = "DUI Squad Radar"; +dir = "@dui"; +author = "Diwako"; diff --git a/mod/$PBOPREFIX$ b/mod/$PBOPREFIX$ deleted file mode 100644 index d3f7e86..0000000 --- a/mod/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -diwako_dui \ No newline at end of file diff --git a/mod/CfgFunctions.hpp b/mod/CfgFunctions.hpp deleted file mode 100644 index 5a5706f..0000000 --- a/mod/CfgFunctions.hpp +++ /dev/null @@ -1,16 +0,0 @@ -class cfgFunctions { - class diwako_dui { - class functions { - file = "diwako_dui\functions"; - class postInit {postinit=1;recompile = DUI_RECOMPILE;}; - class compass {recompile = DUI_RECOMPILE;}; - class getIcon {recompile = DUI_RECOMPILE;}; - class displayUnitOnCompass {recompile = DUI_RECOMPILE;}; - class cacheLoop {recompile = DUI_RECOMPILE;}; - class rangeButton {recompile = DUI_RECOMPILE;}; - class canHudBeShown {recompile = DUI_RECOMPILE;}; - class setCustomCode {recompile = DUI_RECOMPILE;}; - class pairBuddies {recompile = DUI_RECOMPILE;}; - }; - }; -}; \ No newline at end of file diff --git a/mod/authors.txt b/mod/authors.txt deleted file mode 100644 index 9f7df84..0000000 --- a/mod/authors.txt +++ /dev/null @@ -1,23 +0,0 @@ -Author: -diwako - -Contributors: -Nigel (Code, UI config) -Terry (Icons [Just The Tip]) -Gordon Weedman (Compass [Pizza Time], Xeno) -cyruz (Compass [BI]) -G4rrus Vakarian (NATO icons, colorblind color schemes, help with translations) -Pilotguy (Ye Olde Times, Clock compass) -Engee (Classic Compass) -classicarma (Added Japanese translation) -Psychodewon (Added French translation) -phreaky (Added Czech translation) -Sheepaay (Added Polish translation) -Aradiel (Added Brazillian Portuguese translation) -Patch (Added Korean translation) - -Special thanks: -alganthe (General Arma modding support) -baermitumlaut (General Arma modding support) -dedmen (General Arma modding support) -commy2 (Code examples / General Arma modding support) diff --git a/mod/compass_style.hpp b/mod/compass_style.hpp deleted file mode 100644 index e228837..0000000 --- a/mod/compass_style.hpp +++ /dev/null @@ -1,72 +0,0 @@ -class diwako_dui_compass_style -{ - class standard - { - name = "Standard"; - full = "diwako_dui\UI\compass_styles\standard\compass.paa"; - limited = "diwako_dui\UI\compass_styles\standard\compass_limited.paa"; - }; - - class bohemia - { - name = "Bohemia Interactive"; - full = "diwako_dui\UI\compass_styles\bi\compass.paa"; - limited = "diwako_dui\UI\compass_styles\bi\compass_limited.paa"; - }; - - class pizza - { - name = "Pizza Time"; - full = "diwako_dui\UI\compass_styles\pizza\compass.paa"; - limited = "diwako_dui\UI\compass_styles\pizza\compass_limited.paa"; - }; - - class olde - { - name = "Ye Olde Times"; - full = "diwako_dui\UI\compass_styles\olde\full.paa"; - limited = "diwako_dui\UI\compass_styles\olde\limited.paa"; - }; - - class clock - { - name = "Clock"; - full = "diwako_dui\UI\compass_styles\clock\full.paa"; - limited = "diwako_dui\UI\compass_styles\clock\limited.paa"; - }; - - class classic - { - name = "Classic"; - full = "diwako_dui\UI\compass_styles\classic\full.paa"; - limited = "diwako_dui\UI\compass_styles\classic\limited.paa"; - }; - - class xeno_red - { - name = "Xeno - Red"; - full = "diwako_dui\UI\compass_styles\xeno\redf.paa"; - limited = "diwako_dui\UI\compass_styles\xeno\red.paa"; - }; - - class xeno_green - { - name = "Xeno - Green"; - full = "diwako_dui\UI\compass_styles\xeno\greenf.paa"; - limited = "diwako_dui\UI\compass_styles\xeno\green.paa"; - }; - - class xeno_blue - { - name = "Xeno - Blue"; - full = "diwako_dui\UI\compass_styles\xeno\bluef.paa"; - limited = "diwako_dui\UI\compass_styles\xeno\blue.paa"; - }; - - class milint - { - name = "Military Interface"; - full = "diwako_dui\UI\compass_styles\milint\full.paa"; - limited = "diwako_dui\UI\compass_styles\milint\limited.paa"; - }; -}; diff --git a/mod/config.cpp b/mod/config.cpp deleted file mode 100644 index 22fc3d8..0000000 --- a/mod/config.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#define REQUIRED_VERSION 1.88 -#define VERSION "1.3.3" - -class CfgPatches { - class diwako_dui { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { - "cba_common" - }; - author[] = {"diwako"}; - authorUrl = "https://github.com/diwako/diwako_dui"; - version = VERSION; - versionStr = VERSION; - license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike"; - }; -}; - -#include "script_component.hpp" -#include "CfgFunctions.hpp" -#include "CfgUIGrids.hpp" -#include "gui.hpp" -#include "compass_style.hpp" -#include "icon_style.hpp" -#include "color_style.hpp" - -class Extended_PreInit_EventHandlers { - class diwako_dui { - init = "call compile preprocessFileLineNumbers 'diwako_dui\functions\fn_preinit.sqf'"; - }; -}; diff --git a/mod/functions/fn_cacheLoop.sqf b/mod/functions/fn_cacheLoop.sqf deleted file mode 100644 index 1b1d35d..0000000 --- a/mod/functions/fn_cacheLoop.sqf +++ /dev/null @@ -1,271 +0,0 @@ -#include "../script_component.hpp" - -// loop -[diwako_dui_fnc_cacheLoop,[],0.5] call CBA_fnc_waitAndExecute; - -// if both compass and namelist are not enabled, just remove the controls if there are any -if !(diwako_dui_enable_compass || diwako_dui_namelist) exitWith { - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; - "diwako_dui_compass" cutRsc ["diwako_dui_RscCompass","PLAIN", 0, false]; -}; - -private _player = [] call CBA_fnc_currentUnit; -_group = units group _player; -if (diwako_dui_compass_hide_blip_alone_group && {(count _group) <= 1}) then { - _group = []; -}; -diwako_dui_group = + _group; - -private _uiScale = diwako_dui_hudScaling; -private _uiPixels = diwako_dui_uiPixels; - -private _colorNameSpace = missionNamespace getVariable format["diwako_dui_colors_%1", diwako_dui_colors]; -private _iconNamespace = missionNamespace getVariable format["diwako_dui_icon_%1", diwako_dui_icon_style]; - -{ - if (alive _x) then { - _x setVariable ["diwako_dui_compass_icon", [_x, _iconNamespace, _player, true] call diwako_dui_fnc_getIcon]; - _x setVariable ["diwako_dui_icon", [_x, _iconNamespace] call diwako_dui_fnc_getIcon]; - // when remote controling a an AI assign can return nil - private _assignedTeam = [assignedTeam _x] param [0, "MAIN"]; - - private _color = _colorNameSpace getVariable [_assignedTeam, "#FFFFFF"]; - _x setVariable ["diwako_dui_color", _color]; - - private _compassColor = _colorNameSpace getVariable [(format ["%1_compass", _assignedTeam]), [1,1,1]]; - _x setVariable ["diwako_dui_compass_color", _compassColor]; - }; -} forEach _group; - -private _specialTrack = missionNamespace getVariable ["diwako_dui_special_track", []]; -if (_specialTrack isEqualType [] && {!(_specialTrack isEqualTo [])}) then { - private _toTrack = []; - private _vehNamespace = diwako_dui_vehicleNamespace; - { - if !(isNull _x) then { - _x setVariable ["diwako_dui_compass_color", (_colorNameSpace getVariable ["tracked_compass", [1,1,1]])]; - if (_x isKindOf "CAManBase") then { - _x setVariable ["diwako_dui_compass_icon", [_x, _iconNamespace, _player, true] call diwako_dui_fnc_getIcon]; - }; - if (_x isKindOf "LandVehicle" || _x isKindOf "Air") then { - private _type = (typeOf _x); - private _picture = _vehNamespace getVariable _type; - if (isNil "_picture") then { - _picture = getText (configfile >> "CfgVehicles" >> _type >> "icon"); - if (isText (configfile >> "CfgVehicleIcons" >> _picture)) then { - _picture = getText (configfile >> "CfgVehicleIcons" >> _picture); - } else { - private _found = (toLower _picture) find ".paa"; - if (_found isEqualTo -1 || {!(((count _picture) - 4) isEqualTo _found)}) then { - _picture = "a3\ui_f\data\Map\VehicleIcons\iconObject_ca.paa"; - }; - }; - _vehNamespace setVariable [_type, _picture]; - }; - _x setVariable ["diwako_dui_icon_size", [2,1] select (_picture isEqualTo "a3\ui_f\data\Map\VehicleIcons\iconObject_ca.paa")]; - _x setVariable ["diwako_dui_compass_icon", _picture]; - }; - _toTrack pushBackUnique _x; - }; - } forEach _specialTrack; - diwako_dui_group = _toTrack + diwako_dui_group - [objNull]; -}; - -// start compass if enabeld but not running yet -if (diwako_dui_enable_compass) then { - private _compassDisplay = uiNamespace getVariable ["diwako_dui_RscCompass", displayNull]; - if (diwako_dui_compass_pfHandle <= -1 || {isNull _compassDisplay}) then { - [diwako_dui_compass_pfHandle] call CBA_fnc_removePerFrameHandler; - "diwako_dui_compass" cutRsc ["diwako_dui_RscCompass","PLAIN", 0, false]; - [] call diwako_dui_fnc_compass; - }; - - private _compassCtrl = _compassDisplay displayCtrl IDC_COMPASS; - _compassCtrl ctrlSetText (diwako_dui_compass_style select ("ItemCompass" in assignedItems _player)); - - if (diwako_dui_setCompass) then { - diwako_dui_setCompass = false; - private _ctrlHeight = pixelH * _uiPixels; - private _ctrlWidth = pixelW * _uiPixels; - private _ctrlMiddleX = 0.5 - (pixelW * (_uiPixels / 2)); - private _compassY = safeZoneY + safeZoneH - (pixelH * (_uiPixels + 10)); - - private _dirCtrl = _compassDisplay displayCtrl IDC_DIRECTION; - private _grpCtrl = _compassDisplay displayCtrl IDC_COMPASS_CTRLGRP; - - if (diwako_dui_use_layout_editor) then { - _ctrlMiddleX = profileNamespace getVariable ["igui_diwako_dui_compass_x", _ctrlMiddleX]; - _compassY = profileNamespace getVariable ["igui_diwako_dui_compass_y", _compassY]; - }; - - diwako_dui_bearing_size_calc = diwako_dui_dir_size * diwako_dui_a3UiScale * diwako_dui_hudScaling * diwako_dui_windowHeightMod; - - _compassCtrl ctrlSetPosition [ - _ctrlMiddleX, - _compassY, - _ctrlWidth, - _ctrlHeight - ]; - _compassCtrl ctrlSetTextColor [1 ,1 , 1, diwako_dui_compass_opacity]; - _compassCtrl ctrlCommit 0; - _grpCtrl ctrlSetPosition [ - _ctrlMiddleX, - _compassY, - _ctrlWidth, - _ctrlHeight - ]; - _grpCtrl ctrlCommit 0; - _dirCtrl ctrlSetPosition [ - _ctrlMiddleX, - _compassY - (pixelH * 25 * _uiScale), - // safeZoneY + safeZoneH - (pixelH * (_uiPixels + (55 * _uiScale))), - _ctrlWidth, - pixelH * 70 * _uiScale - ]; - _dirCtrl ctrlSetTextColor [1, 1, 1, 1]; - _dirCtrl ctrlSetFont diwako_dui_font; - _dirCtrl ctrlCommit 0; - }; -}; - -// built name list from here -private _display = uiNamespace getVariable ["diwako_dui_RscNameBox", displayNull]; -if (isNull _display) exitWith { - if (diwako_dui_namelist) then { - "diwako_dui_namebox" cutRsc ["diwako_dui_RscNameBox","PLAIN", 0, false]; - _display = uiNamespace getVariable ["diwako_dui_RscNameBox", displayNull]; - }; -}; - -private _grpCtrl = _display displayCtrl IDC_NAMEBOX_CTRLGRP; -private _lists = diwako_dui_namebox_lists; - -// delete all name list controls if not active -if !(diwako_dui_namelist) exitWith { - if ((count _lists) > 0) then { - for "_i" from (count _lists) -1 to 0 step -1 do { - ctrlDelete ctrlParentControlsGroup (_lists deleteAt _i); - }; - "diwako_dui_namebox" cutText ["","PLAIN"]; - }; -}; - -if !([_player] call diwako_dui_fnc_canHudBeShown) exitWith { - _grpCtrl ctrlShow false; -}; - -if (diwako_dui_setNamelist) then { - diwako_dui_setNamelist = false; - private _xPos = 0.5 + (pixelW * (_uiPixels / 2 + 10)); - private _yPos = safeZoneY + safeZoneH - (pixelH * (_uiPixels + 10)); - if (diwako_dui_use_layout_editor) then { - _xPos = profileNamespace getVariable ["igui_diwako_dui_namelist_x", _xPos]; - _yPos = profileNamespace getVariable ["igui_diwako_dui_namelist_y", _yPos]; - }; - private _nameList = _display displayCtrl IDC_NAMEBOX; - private _nameListPos = [ - _xPos, - _yPos, - 0.5 * safeZoneW - (pixelW * (_uiPixels / 2 + 10)), - pixelH * (_uiPixels + 10) - ]; - _grpCtrl ctrlSetPosition _nameListPos; - _grpCtrl ctrlCommit 0; - _nameList ctrlSetPosition _nameListPos; - _nameList ctrlCommit 0; -}; - - -// no need to show any names if you are alone in the group -if (count _group <= 1) exitWith { - if ((count _lists) > 0) then { - for "_i" from (count _lists) -1 to 0 step -1 do { - ctrlDelete ctrlParentControlsGroup (_lists deleteAt _i); - }; - }; -}; -if !(ctrlShown _grpCtrl) then { - _grpCtrl ctrlShow true; -}; -private _text = ""; -private _curList = controlNull; -private _listIndex = 0; -private _selectedUnits = groupSelectedUnits _player; -private _a3UiScale = linearConversion [0.55,0.7,getResolution # 5,1,0.85,false]; -private _textSize = diwako_dui_namelist_size * diwako_dui_a3UiScale; -private _listWidth = diwako_dui_namelist_width * pixelW * diwako_dui_hudScaling; -private _listHeight = 128 * pixelH * diwako_dui_hudScaling; -private _ctrlPosList = [0, 0, _listWidth*10, _listHeight]; -private _shadow = diwako_dui_namelist_text_shadow; -private _bgOpacity = diwako_dui_namelist_bg; -private _onlyBuddyIcon = diwako_dui_namelist_only_buddy_icon; -private _heightMod = diwako_dui_windowHeightMod; -{ - if (_forEachIndex mod floor(5/(_textSize*_uiScale)) == 0) then { - if !(isNull _curList) then { - _curList ctrlSetStructuredText parseText _text; - _curList ctrlSetPosition _ctrlPosList; - _curList ctrlCommit 0; - _text = ""; - }; - if (count _lists >= (_listIndex + 1)) then { - _curList = _lists # _listIndex; - } else { - ctrlPosition _grpCtrl params ["_left", "_top", "_width", "_height"]; - // create group - private _curGrp = _display ctrlCreate["RscControlsGroupNoScrollbars", -1, _grpCtrl]; - private _ctrlPos = [ - (0 * pixelW) * _listIndex + _listWidth * _listIndex, - 0, - _listWidth, - _listHeight - ]; - _curGrp ctrlSetPosition _ctrlPos; - _curGrp ctrlCommit 0; - - _curList = _display ctrlCreate ["RscStructuredText", -1, _curGrp]; - _curList ctrlSetFont diwako_dui_font; - _curList ctrlSetBackgroundColor [0,0,0,_bgOpacity]; - _lists pushBack _curList; - _curList ctrlCommit 0; - }; - _listIndex = _listIndex + 1; - }; - private _unit = _x; - private _selected = ""; - if ((count _selectedUnits) > 0 && {_unit != _player}) then { - private _curName = vehicleVarName _unit; - _unit setVehicleVarName ""; - private _defaultIdent = str _unit; - _unit setVehicleVarName _curName; - private _arr = [_defaultIdent, ":"] call CBA_fnc_split; - private _num = if ((count _arr) > 1) then { - (_arr select 1) select [0, 2] - } else { - "" - }; - _selected = format ["%1%2", (["", ">> "] select (_selectedUnits findIf {_x == _unit} > -1)), _num]; - }; - private _buddy = ["", _iconNamespace getVariable ["buddy", DUI_BUDDY]] select (_player == (_unit getVariable ["diwako_dui_buddy", objNull])); - private _icon = [_unit getVariable ["diwako_dui_icon", DUI_RIFLEMAN], ""] select (_buddy != "" && {_onlyBuddyIcon}); - _text = format ["%1%5 %3
", - _text, // 1 - _icon, // 2 - _unit getVariable ["ACE_Name", name _unit], // 3 - _unit getVariable ["diwako_dui_color","#FFFFFF"], // 4 - _selected, // 5 - (_textSize * _heightMod), // 6 - _buddy, // 7 - _shadow]; // 8 -} forEach _group; - -if !(isNull _curList) then { - _curList ctrlSetStructuredText parseText _text; - _curList ctrlSetPosition _ctrlPosList; - _curList ctrlCommit 0; -}; -for "_i" from (count _lists) -1 to _listIndex step -1 do { - ctrlDelete ctrlParentControlsGroup (_lists deleteAt _i); -}; diff --git a/mod/functions/fn_canHudBeShown.sqf b/mod/functions/fn_canHudBeShown.sqf deleted file mode 100644 index c7d5b34..0000000 --- a/mod/functions/fn_canHudBeShown.sqf +++ /dev/null @@ -1,11 +0,0 @@ -params ["_player"]; -!( - visibleMap || - {diwako_dui_toggled_off || - {!alive _player || - {(_player getVariable ["ace_spectator_isSet", false]) || - {dialog || - {diwako_dui_ace_hide_interaction && {missionNamespace getVariable ["ace_interact_menu_openedMenuType",-1] > -1} || - {!isnull (missionNamespace getVariable ["ace_arsenal_camera", objNull]) || - {diwako_dui_inFeatureCamera}}}}}}} -) diff --git a/mod/functions/fn_getColorStyles.sqf b/mod/functions/fn_getColorStyles.sqf deleted file mode 100644 index f5f5818..0000000 --- a/mod/functions/fn_getColorStyles.sqf +++ /dev/null @@ -1,43 +0,0 @@ -private _configs = "true" configClasses (configFile >> "diwako_dui_colors"); -private _missionConfigs = "true" configClasses (missionConfigFile >> "diwako_dui_colors"); -if (isNil "_missionConfigs") then { - _missionConfigs = []; -}; - -private _colorNames = []; -private _colorIdent = []; - -private _getColorFromHex = { - params ["_key", "_hex"]; - _hex = toArray _hex; - _hex deleteAt 0; //remove the '#' at the beginning - private _nums = toArray "0123456789ABCDEF"; //for converting hex nibbles to base 10 equivalents - - private _r = (_nums find (_hex select 0)) * 16 + (_nums find (_hex select 1)); - private _g = (_nums find (_hex select 2)) * 16 + (_nums find (_hex select 3)); - private _b = (_nums find (_hex select 4)) * 16 + (_nums find (_hex select 5)); - - _namespace setVariable [format ["%1_compass",_key], [(_r/255),(_g/255),(_b/255)]]; -}; - -{ - private _namespace = [] call CBA_fnc_createNamespace; - private _configName = configName _x; - _colorIdent pushBack _configName; - _colorNames pushback getText (_x >> "name"); - - _namespace setVariable ["main", getText (_x >> "white")]; - ["main", _namespace getVariable "main"] call _getColorFromHex; - _namespace setVariable ["red", getText (_x >> "red")]; - ["red", _namespace getVariable "red"] call _getColorFromHex; - _namespace setVariable ["green", getText (_x >> "green")]; - ["green", _namespace getVariable "green"] call _getColorFromHex; - _namespace setVariable ["blue", getText (_x >> "blue")]; - ["blue", _namespace getVariable "blue"] call _getColorFromHex; - _namespace setVariable ["yellow", getText (_x >> "yellow")]; - ["yellow", _namespace getVariable "yellow"] call _getColorFromHex; - _namespace setVariable ["tracked", getText (_x >> "tracked")]; - ["tracked", _namespace getVariable "tracked"] call _getColorFromHex; - - missionNamespace setVariable [format["diwako_dui_colors_%1", _configName], _namespace] -} forEach (_configs + _missionConfigs); diff --git a/mod/functions/fn_getIconStyles.sqf b/mod/functions/fn_getIconStyles.sqf deleted file mode 100644 index a3a119e..0000000 --- a/mod/functions/fn_getIconStyles.sqf +++ /dev/null @@ -1,39 +0,0 @@ -private _configs = "true" configClasses (configFile >> "diwako_dui_icon_style"); -private _missionConfigs = "true" configClasses (missionConfigFile >> "diwako_dui_icon_style"); -if (isNil "_missionConfigs") then { - _missionConfigs = []; -}; - -private _iconNames = []; -private _iconIdent = []; - -{ - private _namespace = [] call CBA_fnc_createNamespace; - _iconNames pushback getText (_x >> "name"); - private _configName = configName _x; - _iconIdent pushBack _configName; - - _namespace setVariable ["sql", getText (_x >> "sql")]; - _namespace setVariable ["medic", getText (_x >> "medic")]; - _namespace setVariable ["auto_rifleman", getText (_x >> "auto_rifleman")]; - _namespace setVariable ["at_gunner", getText (_x >> "at_gunner")]; - _namespace setVariable ["engineer", getText (_x >> "engineer")]; - _namespace setVariable ["explosive_specialist", getText (_x >> "explosive_specialist")]; - _namespace setVariable ["rifleman", getText (_x >> "rifleman")]; - _namespace setVariable ["vehicle_cargo", getText (_x >> "vehicle_cargo")]; - _namespace setVariable ["vehicle_driver", getText (_x >> "vehicle_driver")]; - _namespace setVariable ["fire_from_vehicle", getText (_x >> "fire_from_vehicle")]; - _namespace setVariable ["vehicle_gunner", getText (_x >> "vehicle_gunner")]; - _namespace setVariable ["vehicle_commander", getText (_x >> "vehicle_commander")]; - _namespace setVariable ["PRIVATE", getText (_x >> "rank_private")]; - _namespace setVariable ["CORPORAL", getText (_x >> "rank_corporal")]; - _namespace setVariable ["SERGEANT", getText (_x >> "rank_sergeant")]; - _namespace setVariable ["LIEUTENANT", getText (_x >> "rank_lieutenant")]; - _namespace setVariable ["CAPTAIN", getText (_x >> "rank_captain")]; - _namespace setVariable ["MAJOR", getText (_x >> "rank_major")]; - _namespace setVariable ["COLONEL", getText (_x >> "rank_colonel")]; - _namespace setVariable ["buddy", getText (_x >> "buddy")]; - _namespace setVariable ["buddy_compass", getText (_x >> "buddy_compass")]; - - missionNamespace setVariable [format["diwako_dui_icon_%1", _configName], _namespace] -} forEach (_configs + _missionConfigs); diff --git a/mod/functions/fn_pairBuddies.sqf b/mod/functions/fn_pairBuddies.sqf deleted file mode 100644 index fb51f5e..0000000 --- a/mod/functions/fn_pairBuddies.sqf +++ /dev/null @@ -1,16 +0,0 @@ -params ["_unit1", "_unit2", ["_assign", true]]; - -if !(isNull (_unit1 getVariable ["diwako_dui_buddy", objNull])) then { - (_unit1 getVariable ["diwako_dui_buddy", objNull]) setVariable ["diwako_dui_buddy", nil, true]; -}; -if !(isNull (_unit2 getVariable ["diwako_dui_buddy", objNull])) then { - (_unit2 getVariable ["diwako_dui_buddy", objNull]) setVariable ["diwako_dui_buddy", nil, true]; -}; - -if (_assign) then { - _unit1 setVariable ["diwako_dui_buddy", _unit2, true]; - _unit2 setVariable ["diwako_dui_buddy", _unit1, true]; -} else { - _unit1 setVariable ["diwako_dui_buddy", nil, true]; - _unit2 setVariable ["diwako_dui_buddy", nil, true]; -}; diff --git a/mod/functions/fn_postInit.sqf b/mod/functions/fn_postInit.sqf deleted file mode 100644 index 6f5d20d..0000000 --- a/mod/functions/fn_postInit.sqf +++ /dev/null @@ -1,62 +0,0 @@ -#include "../script_component.hpp" -if (is3DEN || !hasInterface) exitWith {}; - -diwako_dui_uiPixels = DUI_128PX; - -diwako_dui_a3UiScale = linearConversion [0.55,0.7,getResolution # 5,1,0.85,false]; -diwako_dui_windowHeightMod = linearConversion [1080,1440,getResolution # 1,1,0.75,false]; -diwako_dui_bearing_size_calc = diwako_dui_dir_size * diwako_dui_a3UiScale * diwako_dui_hudScaling * diwako_dui_windowHeightMod; -diwako_dui_vehicleNamespace = [] call CBA_fnc_createNamespace; - -if !(isNil "ace_nightvision") then { - "ace_nightvision_display" cutFadeOut 0; -}; - -"diwako_dui_compass" cutFadeOut 0; -"diwako_dui_namebox" cutFadeOut 0; - -// start the loop -[] call diwako_dui_fnc_cacheLoop; - -private _labelAdd = localize "STR_dui_buddy_action"; -private _labelRemove = localize "STR_dui_buddy_action_remove"; -private _range = 10; -if (isNil "ace_interact_menu_fnc_createAction") then { - [[_labelAdd, { - [player, cursorObject] call diwako_dui_fnc_pairBuddies; - }, [], -5000, false, true, "", format ["cursorObject distance2d player <= %1 && {cursorObject in (units group player) && {(player getVariable [""diwako_dui_buddy"", objNull]) != cursorObject}}", _range]]] call CBA_fnc_addPlayerAction; - - [[_labelRemove, { - [player, cursorObject, false] call diwako_dui_fnc_pairBuddies; - }, [], -5000, false, true, "", format ["cursorObject distance2d player <= %1 && {cursorObject in (units group player) && {(player getVariable [""diwako_dui_buddy"", objNull]) == cursorObject}}", _range]]] call CBA_fnc_addPlayerAction; -} else { - private _action = ["diwako_dui_buddy_action", _labelAdd, "", { - [ace_player, _target] call diwako_dui_fnc_pairBuddies; - },{_target in (units group ace_player) && {(ace_player getVariable ["diwako_dui_buddy", objNull]) != _target}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction; - - ["CAManBase", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass; - - private _action = ["diwako_dui_buddy_action", _labelRemove, "", { - [ace_player, _target, false] call diwako_dui_fnc_pairBuddies; - },{_target in (units group ace_player) && {(ace_player getVariable ["diwako_dui_buddy", objNull]) == _target}},{},[], [0,0,0], _range] call ace_interact_menu_fnc_createAction; - - ["CAManBase", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass; -}; - -// cba eh for hiding the hud when in certain camera modes -["featureCamera", { - params ["_player", "_featureCamera"]; - diwako_dui_inFeatureCamera = !(_featureCamera isEqualTo ""); -}, true] call CBA_fnc_addPlayerEventHandler; - -// player remote controls another unit or changes avatar -// mainly used for the change in avatar / switch unit part as displays will be closed -["unit", { - params ["_newPlayerUnit", "_oldPlayerUnit"]; - diwako_dui_setCompass = true; - diwako_dui_setNamelist = true; - for "_i" from 0 to (count diwako_dui_namebox_lists) do { - ctrlDelete ctrlParentControlsGroup (diwako_dui_namebox_lists deleteAt 0); - }; -}, true] call CBA_fnc_addPlayerEventHandler; - diff --git a/mod/license.txt b/mod/license.txt deleted file mode 100644 index c5b6068..0000000 --- a/mod/license.txt +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2019 diwako - -This work (diwako_dui or the like) uses the license Arma Public License Share Alike (APL-SA) - -https://www.bohemia.net/community/licenses/arma-public-license-share-alike - -For your Steam accounts safety, do not reupload it to the workshop as it violates Steam Subscriber Agreement section 6D. diff --git a/mod/script_component.hpp b/mod/script_component.hpp deleted file mode 100644 index 1cfaebf..0000000 --- a/mod/script_component.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// DEV stuff -#define DUI_RECOMPILE 0 -#define DUI_DEBUG 0 - -// UI values -#define IDC_COMPASS 1337001 -#define IDC_DIRECTION 1337002 -#define IDC_COMPASS_CTRLGRP 1337003 -#define IDC_NAMEBOX 1337004 -#define IDC_NAMEBOX_CTRLGRP 1337005 -#define DUI_128PX (128 * (missionNamespace getVariable ['diwako_dui_hudScaling', 1])) - -// Script values -#define DUI_MAX_RANGE 50 -#define DUI_MIN_RANGE 15 - -#define DUI_SQL "\A3\ui_f\data\map\vehicleicons\iconManLeader_ca.paa" -#define DUI_MEDIC "\A3\ui_f\data\map\vehicleicons\iconManMedic_ca.paa" -#define DUI_AUTO_RIFLEMAN "\A3\ui_f\data\map\vehicleicons\iconManMG_ca.paa" -#define DUI_AT_GUNNER "\A3\ui_f\data\map\vehicleicons\iconManAT_ca.paa" -#define DUI_ENGINEER "\A3\ui_f\data\map\vehicleicons\iconManEngineer_ca.paa" -#define DUI_EXPLOSIVE_SPECIALIST "\A3\ui_f\data\map\vehicleicons\iconManExplosive_ca.paa" -#define DUI_RIFLEMAN "\A3\ui_f\data\map\vehicleicons\iconMan_ca.paa" -#define DUI_VEHICLE_CARGO "a3\ui_f\data\igui\cfg\commandbar\imagecargo_ca.paa" -#define DUI_VEHICLE_DRIVER "a3\ui_f\data\igui\cfg\commandbar\imagedriver_ca.paa" -#define DUI_FIRE_FROM_VEHICLE "a3\ui_f\data\igui\cfg\simpletasks\types\rifle_ca.paa" -#define DUI_VEHICLE_GUNNER "a3\ui_f\data\igui\cfg\commandbar\imagegunner_ca.paa" -#define DUI_VEHICLE_COMMANDER "a3\ui_f\data\igui\cfg\commandbar\imagecommander_ca.paa" -#define DUI_RANK_PRIVATE "a3\ui_f\data\GUI\Cfg\Ranks\private_gs.paa" -#define DUI_RANK_CORPORAL "a3\ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa" -#define DUI_RANK_SERGEANT "a3\ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa" -#define DUI_RANK_LIEUTENANT "a3\ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa" -#define DUI_RANK_CAPTAIN "a3\ui_f\data\GUI\Cfg\Ranks\captain_gs.paa" -#define DUI_RANK_MAJOR "a3\ui_f\data\GUI\Cfg\Ranks\major_gs.paa" -#define DUI_RANK_COLONEL "a3\ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" -#define DUI_BUDDY "a3\ui_f_curator\Data\Displays\RscDisplayCurator\modeUnits_ca.paa" -#define DUI_BUDDY_COMPASS "diwako_dui\UI\icon_styles\standard\buddy_compass"