From f4c84182d42d9745f638bdf28b9e338a56758545 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 15 Jan 2015 03:51:18 -0600 Subject: [PATCH] Progress on Map --- addons/map/$PBOPREFIX$ | 1 + addons/map/CfgEventHandlers.hpp | 12 + addons/map/CfgMarkers.hpp | 67 ++++ addons/map/CfgVehicles.hpp | 159 +++++++++ addons/map/CfgWeapons.hpp | 15 + addons/map/MapControls.hpp | 174 +++++----- addons/map/MapGpsUI.hpp | 6 +- ...{clientInit.sqf => XEH_postInitClient.sqf} | 40 +-- addons/map/XEH_preInit.sqf | 20 ++ addons/map/XEH_preInitServer.sqf | 4 + addons/map/config.cpp | 322 ++---------------- addons/map/functions/fn_blueForceTracking.sqf | 29 -- addons/map/functions/fn_canDraw.sqf | 4 - addons/map/functions/fn_canUseMapGPS.sqf | 5 - addons/map/functions/fn_canUseMapTools.sqf | 8 - addons/map/functions/fn_cancelDrawing.sqf | 17 - addons/map/functions/fn_handleMouseMove.sqf | 61 ---- .../map/functions/fn_updateMapToolMarkers.sqf | 71 ---- ...ddLineMarker.sqf => fnc_addLineMarker.sqf} | 8 +- .../map/functions/fnc_blueForceTracking.sqf | 32 ++ ...MapScale.sqf => fnc_calculateMapScale.sqf} | 0 addons/map/functions/fnc_canDraw.sqf | 4 + addons/map/functions/fnc_canUseMapGPS.sqf | 5 + addons/map/functions/fnc_canUseMapTools.sqf | 8 + addons/map/functions/fnc_cancelDrawing.sqf | 17 + ...yMapMarkers.sqf => fnc_copyMapMarkers.sqf} | 4 +- ...andleKeyDown.sqf => fnc_handleKeyDown.sqf} | 12 +- ...seButton.sqf => fnc_handleMouseButton.sqf} | 40 +-- addons/map/functions/fnc_handleMouseMove.sqf | 61 ++++ ...hanged.sqf => fnc_handleMouseZChanged.sqf} | 6 +- ...ideMapTool.sqf => fnc_isInsideMapTool.sqf} | 4 +- .../{fn_openMapGps.sqf => fnc_openMapGps.sqf} | 0 ...ineMarker.sqf => fnc_removeLineMarker.sqf} | 12 +- ...dMapMarkers.sqf => fnc_sendMapMarkers.sqf} | 2 +- ...ineMarker.sqf => fnc_updateLineMarker.sqf} | 0 .../functions/fnc_updateMapToolMarkers.sqf | 71 ++++ addons/map/functions/script_component.hpp | 1 + addons/map/script_component.hpp | 17 + addons/map/serverInit.sqf | 4 - addons/map/stringtable.xml | 26 +- 40 files changed, 682 insertions(+), 667 deletions(-) create mode 100644 addons/map/$PBOPREFIX$ create mode 100644 addons/map/CfgEventHandlers.hpp create mode 100644 addons/map/CfgMarkers.hpp create mode 100644 addons/map/CfgVehicles.hpp create mode 100644 addons/map/CfgWeapons.hpp rename addons/map/{clientInit.sqf => XEH_postInitClient.sqf} (84%) create mode 100644 addons/map/XEH_preInit.sqf create mode 100644 addons/map/XEH_preInitServer.sqf delete mode 100644 addons/map/functions/fn_blueForceTracking.sqf delete mode 100644 addons/map/functions/fn_canDraw.sqf delete mode 100644 addons/map/functions/fn_canUseMapGPS.sqf delete mode 100644 addons/map/functions/fn_canUseMapTools.sqf delete mode 100644 addons/map/functions/fn_cancelDrawing.sqf delete mode 100644 addons/map/functions/fn_handleMouseMove.sqf delete mode 100644 addons/map/functions/fn_updateMapToolMarkers.sqf rename addons/map/functions/{fn_addLineMarker.sqf => fnc_addLineMarker.sqf} (82%) create mode 100644 addons/map/functions/fnc_blueForceTracking.sqf rename addons/map/functions/{fn_calculateMapScale.sqf => fnc_calculateMapScale.sqf} (100%) create mode 100644 addons/map/functions/fnc_canDraw.sqf create mode 100644 addons/map/functions/fnc_canUseMapGPS.sqf create mode 100644 addons/map/functions/fnc_canUseMapTools.sqf create mode 100644 addons/map/functions/fnc_cancelDrawing.sqf rename addons/map/functions/{fn_copyMapMarkers.sqf => fnc_copyMapMarkers.sqf} (62%) rename addons/map/functions/{fn_handleKeyDown.sqf => fnc_handleKeyDown.sqf} (87%) rename addons/map/functions/{fn_handleMouseButton.sqf => fnc_handleMouseButton.sqf} (68%) create mode 100644 addons/map/functions/fnc_handleMouseMove.sqf rename addons/map/functions/{fn_handleMouseZChanged.sqf => fnc_handleMouseZChanged.sqf} (83%) rename addons/map/functions/{fn_isInsideMapTool.sqf => fnc_isInsideMapTool.sqf} (93%) rename addons/map/functions/{fn_openMapGps.sqf => fnc_openMapGps.sqf} (100%) rename addons/map/functions/{fn_removeLineMarker.sqf => fnc_removeLineMarker.sqf} (50%) rename addons/map/functions/{fn_sendMapMarkers.sqf => fnc_sendMapMarkers.sqf} (60%) rename addons/map/functions/{fn_updateLineMarker.sqf => fnc_updateLineMarker.sqf} (100%) create mode 100644 addons/map/functions/fnc_updateMapToolMarkers.sqf create mode 100644 addons/map/functions/script_component.hpp create mode 100644 addons/map/script_component.hpp delete mode 100644 addons/map/serverInit.sqf diff --git a/addons/map/$PBOPREFIX$ b/addons/map/$PBOPREFIX$ new file mode 100644 index 0000000000..11a24a58d8 --- /dev/null +++ b/addons/map/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\Addons\map \ No newline at end of file diff --git a/addons/map/CfgEventHandlers.hpp b/addons/map/CfgEventHandlers.hpp new file mode 100644 index 0000000000..23d60e02da --- /dev/null +++ b/addons/map/CfgEventHandlers.hpp @@ -0,0 +1,12 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + serverInit = QUOTE( call COMPILE_FILE(XEH_preInitServer) ); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) ); + }; +}; diff --git a/addons/map/CfgMarkers.hpp b/addons/map/CfgMarkers.hpp new file mode 100644 index 0000000000..ced9dfb0f2 --- /dev/null +++ b/addons/map/CfgMarkers.hpp @@ -0,0 +1,67 @@ +// MARKERS +class CfgMarkers { + class Flag; + + // Reenable NATO symbols ... + class b_unknown: Flag {scope = 2;}; + + // ... and disable all the useless ones + // If you think that some of these are needed, create an issue; But until + // there's a better way to place markers, there should be only the most + // important markers here. + // Keep in mind that all of these can still be placed in the editor. + class b_hq: b_unknown {scope = 1;}; + class b_installation: b_unknown {scope = 1;}; + class b_maint: b_unknown {scope = 1;}; + class b_med: b_unknown {scope = 1;}; + class b_service: b_unknown {scope = 1;}; + class b_support: b_unknown {scope = 1;}; + + class n_unknown: b_unknown {}; + class n_hq: n_unknown {scope = 1;}; + class n_installation: n_unknown {scope = 1;}; + class u_installation: n_unknown {scope = 1;}; // i have no idea... + class n_maint: n_unknown {scope = 1;}; + class n_med: n_unknown {scope = 1;}; + class n_service: n_unknown {scope = 1;}; + class n_support: n_unknown {scope = 1;}; + + class o_unknown: b_unknown {}; + class o_hq: o_unknown {scope = 1;}; + class o_installation: o_unknown {scope = 1;}; + class o_maint: o_unknown {scope = 1;}; + class o_med: o_unknown {scope = 1;}; + class o_service: o_unknown {scope = 1;}; + class o_support: o_unknown {scope = 1;}; + + // disable all civy markers (harbor etc.) + class c_unknown: b_unknown {scope = 1;}; + + // disable quantity indicators (fire team/squad/platoon ...) + class group_0: b_unknown {scope = 1;}; + + + class ACE_MapToolFixed { + name = "MapToolFixed"; + icon = PATHTOF(\data\mapToolFixed.paa); + scope = 0; + color[] = {1,1,1,1}; + size = 32; + }; + + class ACE_MapToolRotatingNormal { + name = "MapToolRotating"; + icon = PATHTOF(\data\mapToolRotatingNormal.paa); + scope = 0; + color[] = {1,1,1,1}; + size = 32; + }; + + class ACE_MapToolRotatingSmall { + name = "MapToolRotating"; + icon = PATHTOF(\data\mapToolRotatingSmall.paa); + scope = 0; + color[] = {1,1,1,1}; + size = 32; + }; +}; diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp new file mode 100644 index 0000000000..637ceac70f --- /dev/null +++ b/addons/map/CfgVehicles.hpp @@ -0,0 +1,159 @@ +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + + class ACE_MapTools { + displayName = "$STR_ACE_Map_MapTools_Menu"; + condition = "(call ACE_Map_fnc_canUseMapTools) || (call ACE_Map_fnc_canUseMapGPS)"; + statement = ""; + exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"}; + showDisabled = 0; + priority = 100; + subMenu[] = {"ACE_MapTools", 1}; + enableInside = 1; + + class ACE_MapToolsHide { + displayName = "$STR_ACE_Map_MapToolsHide"; + condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapToolsShown > 0}"; + statement = "ACE_Map_mapToolsShown = 0; [] call ACE_Map_fnc_updateMapToolMarkers"; + exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"}; + showDisabled = 1; + priority = 5; + enableInside = 1; + }; + class ACE_MapToolsShowNormal { + displayName = "$STR_ACE_Map_MapToolsShowNormal"; + condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapToolsShown != 1}"; + statement = "ACE_Map_mapToolsShown = 1; [] call ACE_Map_fnc_updateMapToolMarkers"; + exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"}; + showDisabled = 1; + priority = 4; + enableInside = 1; + }; + class ACE_MapToolsShowSmall { + displayName = "$STR_ACE_Map_MapToolsShowSmall"; + condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapToolsShown != 2}"; + statement = "ACE_Map_mapToolsShown = 2; [] call ACE_Map_fnc_updateMapToolMarkers"; + exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"}; + showDisabled = 1; + priority = 3; + enableInside = 1; + }; + class ACE_MapToolsAlignNorth { + displayName = "$STR_ACE_Map_MapToolsAlignNorth"; + condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapToolsShown != 0}"; + statement = "ACE_Map_angle = 0; [] call ACE_Map_fnc_updateMapToolMarkers"; + exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"}; + showDisabled = 1; + priority = 2; + enableInside = 1; + }; + class ACE_MapToolsAlignCompass { + displayName = "$STR_ACE_Map_MapToolsAlignCompass"; + condition = "(call ACE_Map_fnc_canUseMapTools) && {ACE_Map_mapToolsShown != 0} && {(""ItemCompass"" in assignedItems player) || {""ItemGPS"" in assignedItems player}}"; + statement = "ACE_Map_angle = getDir player; [] call ACE_Map_fnc_updateMapToolMarkers"; + exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"}; + showDisabled = 1; + priority = 1; + enableInside = 1; + }; + class ACE_MapGpsShow { + displayName = "$STR_ACE_Map_MapGpsShow"; + condition = "(call ACE_Map_fnc_canUseMapGPS) && {!ACE_Map_mapGpsShow}"; + statement = "ACE_Map_mapGpsShow = true; [ACE_Map_mapGpsShow] call ACE_Map_fnc_openMapGps"; + exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"}; + showDisabled = 0; + priority = 0; + enableInside = 1; + }; + class ACE_MapGpsHide { + displayName = "$STR_ACE_Map_MapGpsHide"; + condition = "(call ACE_Map_fnc_canUseMapGPS) && ACE_Map_mapGpsShow"; + statement = "ACE_Map_mapGpsShow = false; [ACE_Map_mapGpsShow] call ACE_Map_fnc_openMapGps"; + exceptions[] = {"ACE_Drag_isNotDragging", "ACE_Core_notOnMap"}; + showDisabled = 0; + priority = 0; + enableInside = 1; + }; + }; + }; + + class ACE_Actions { + class ACE_CopyMap { + displayName = "$STR_ACE_Map_CopyMap"; + condition = "isPlayer ACE_Interaction_Target && {""ItemMap"" in assignedItems player} && {""ACE_MapTools"" in items player} && {""ItemMap"" in assignedItems ACE_Interaction_Target}"; + statement = "[player, ""ACE_Map_fnc_sendMapMarkers"", ACE_Interaction_Target] call ACE_Core_fnc_execRemoteFnc"; + showDisabled = 0; + priority = -1; + }; + }; + }; + + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class FIA_Box_Base_F; + + class Box_NATO_Support_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_MapTools,12) + }; + }; + + class Box_East_Support_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_MapTools,12) + }; + }; + + class Box_IND_Support_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_MapTools,12) + }; + }; + + class Box_FIA_Support_F: FIA_Box_Base_F { + class TransportItems { + MACRO_ADDITEM(ACE_MapTools,12) + }; + }; + + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_MapTools,12) + }; + }; + + class Module_F; + class ACE_ModuleBlueForceTracking: Module_F { + author = "ACE Team"; + category = "ACE"; + displayName = "Blue Force Tracking"; + function = "ACE_Map_fnc_blueForceTracking"; + scope = 2; + isGlobal = 1; + icon = "\ACE_Map\UI\IconBFTracking_ca.paa"; + class Arguments { + class Interval { + displayName = "Interval"; + description = "How often the markers should be refreshed (in seconds)"; + defaultValue = 1; + }; + class HideAiGroups { + displayName = "Hide AI groups?"; + description = "Hide markers for 'AI only' groups?"; + typeName = "BOOL"; + class values { + class Yes { name = "Yes"; value = 1; }; + class No { name = "No"; value = 0; default = 1; }; + }; + }; + }; + }; +}; diff --git a/addons/map/CfgWeapons.hpp b/addons/map/CfgWeapons.hpp new file mode 100644 index 0000000000..e3d5d95c4b --- /dev/null +++ b/addons/map/CfgWeapons.hpp @@ -0,0 +1,15 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_MapTools: ACE_ItemCore { + displayName = "$STR_ACE_MapTools_Name"; + descriptionShort = "$STR_ACE_MapTools_Description"; + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + picture = PATHTOF(\UI\maptool_item.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; + }; +}; diff --git a/addons/map/MapControls.hpp b/addons/map/MapControls.hpp index 69e41098c8..77c6e268a6 100644 --- a/addons/map/MapControls.hpp +++ b/addons/map/MapControls.hpp @@ -1,87 +1,87 @@ - class controls { - class ButtonPlayer: RscActiveText { - text = ""; - w = 0; - h = 0; - sizeEx = 0; - onButtonClick = ""; - }; - class CA_PlayerName: RscText { - x = "2 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - }; - class ProfilePicture: RscPicture { - x = "13.5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - }; - class ProfileBackground: RscText { - x = "13.3 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - }; - class Separator1: RscPicture { - x = "14.5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - }; - class ColorBlack: RscButton { - idc = 36732; - x = "0 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.2,0.2,0.2,1}; - colorBackgroundActive[] = {0,0,0,1}; - colorFocused[] = {0,0,0,1}; - onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorBlack""]"; - }; - class ColorRed: RscButton { - idc = 36733; - x = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.8,0.2,0.2,1}; - colorBackgroundActive[] = {1,0,0,1}; - colorFocused[] = {1,0,0,1}; - onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorRed""]"; - }; - class ColorGreen: RscButton { - idc = 36734; - x = "0.6 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.2,0.8,0.2,1}; - colorBackgroundActive[] = {0,1,0,1}; - colorFocused[] = {0,1,0,1}; - onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorGreen""]"; - }; - class ColorBlue: RscButton { - idc = 36735; - x = "0.9 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.2,0.2,0.8,1}; - colorBackgroundActive[] = {0,0,1,1}; - colorFocused[] = {0,0,1,1}; - onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorBlue""]"; - }; - class ColorYellow: RscButton { - idc = 36736; - x = "1.2 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.8,0.8,0.2,1}; - colorBackgroundActive[] = {1,1,0,1}; - colorFocused[] = {1,1,0,1}; - onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorYellow""]"; - }; - class ColorWhite: RscButton { - idc = 36737; - x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.8,0.8,0.8,1}; - colorBackgroundActive[] = {1,1,1,1}; - colorFocused[] = {1,1,1,1}; - onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorWhite""]"; - }; - }; +class controls { + class ButtonPlayer: RscActiveText { + text = ""; + w = 0; + h = 0; + sizeEx = 0; + onButtonClick = ""; + }; + class CA_PlayerName: RscText { + x = "2 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + }; + class ProfilePicture: RscPicture { + x = "13.5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + }; + class ProfileBackground: RscText { + x = "13.3 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + }; + class Separator1: RscPicture { + x = "14.5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + }; + class ColorBlack: RscButton { + idc = 36732; + x = "0 * (((safezoneW / safezoneH) min 1.2) / 40)"; + y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + colorBackground[] = {0.2,0.2,0.2,1}; + colorBackgroundActive[] = {0,0,0,1}; + colorFocused[] = {0,0,0,1}; + onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorBlack""]"; + }; + class ColorRed: RscButton { + idc = 36733; + x = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; + y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + colorBackground[] = {0.8,0.2,0.2,1}; + colorBackgroundActive[] = {1,0,0,1}; + colorFocused[] = {1,0,0,1}; + onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorRed""]"; + }; + class ColorGreen: RscButton { + idc = 36734; + x = "0.6 * (((safezoneW / safezoneH) min 1.2) / 40)"; + y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + colorBackground[] = {0.2,0.8,0.2,1}; + colorBackgroundActive[] = {0,1,0,1}; + colorFocused[] = {0,1,0,1}; + onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorGreen""]"; + }; + class ColorBlue: RscButton { + idc = 36735; + x = "0.9 * (((safezoneW / safezoneH) min 1.2) / 40)"; + y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + colorBackground[] = {0.2,0.2,0.8,1}; + colorBackgroundActive[] = {0,0,1,1}; + colorFocused[] = {0,0,1,1}; + onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorBlue""]"; + }; + class ColorYellow: RscButton { + idc = 36736; + x = "1.2 * (((safezoneW / safezoneH) min 1.2) / 40)"; + y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + colorBackground[] = {0.8,0.8,0.2,1}; + colorBackgroundActive[] = {1,1,0,1}; + colorFocused[] = {1,1,0,1}; + onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorYellow""]"; + }; + class ColorWhite: RscButton { + idc = 36737; + x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + colorBackground[] = {0.8,0.8,0.8,1}; + colorBackgroundActive[] = {1,1,1,1}; + colorFocused[] = {1,1,1,1}; + onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorWhite""]"; + }; +}; diff --git a/addons/map/MapGpsUI.hpp b/addons/map/MapGpsUI.hpp index 9bbc4f0d5a..cd59f5d73e 100644 --- a/addons/map/MapGpsUI.hpp +++ b/addons/map/MapGpsUI.hpp @@ -13,13 +13,13 @@ #define Y_gps safeZoneY + safeZoneH - 1.2 * H_gps class RscTitles { - class RscAGM_MapGps { + class RscACE_MapGps { idd = 9855; movingEnable = 1; duration = 3600; fadein = 0; fadeout = 0; - onLoad = "uiNamespace setVariable ['AGM_Map_mapGpsDisplay', _this select 0];"; + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QGVAR(mapGpsDisplay), _this select 0)];); //onUnLoad = "_this call onRscLoad"; class controls { class back:RscPicture { @@ -27,7 +27,7 @@ class RscTitles { y = Y_gps; w = W_gps; h = H_gps; - text = "\AGM_Map\UI\mapGps.paa"; + text = PATHTOF(\UI\mapGps.paa); colorBackground[] = {1, 1, 1, 1}; }; class heading: RscText{ diff --git a/addons/map/clientInit.sqf b/addons/map/XEH_postInitClient.sqf similarity index 84% rename from addons/map/clientInit.sqf rename to addons/map/XEH_postInitClient.sqf index 66a5d7a110..9364591a9b 100644 --- a/addons/map/clientInit.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -55,18 +55,18 @@ if (!hasInterface) exitWith{}; [] spawn { // Init variables - AGM_Map_mapToolsShown = 0; + GVAR(mapToolsShown) = 0; AGM_Map_pos = [0,0]; AGM_Map_angle = 0; - AGM_Map_dragging = false; - AGM_Map_rotating = false; + GVAR(mapToolDragging) = false; + GVAR(mapToolRotating) = false; AGM_Map_mapGpsShow = true; - AGM_Map_drawing = false; - AGM_Map_tempLineMarker = []; - AGM_Map_lineMarkers = []; + GVAR(drawing) = false; + GVAR(tempLineMarker) = []; + GVAR(lineMarkers) = []; AGM_Map_drawColor = "ColorBlack"; - AGM_Map_drawingControls = [36732, 36733, 36734, 36735, 36736, 36737]; + GVAR(drawing)Controls = [36732, 36733, 36734, 36735, 36736, 36737]; AGM_Map_fnc_installEvents = { _d = _this; @@ -86,7 +86,7 @@ if (!hasInterface) exitWith{}; if (isNull findDisplay 12) then { // Install event handlers on the map control of the briefing screen (control = 51) - AGM_Map_syncMarkers = true; + GVAR(syncMarkers) = true; if (!isNull findDisplay 52) then { 52 call AGM_Map_fnc_installEvents; } else { @@ -98,16 +98,16 @@ if (!hasInterface) exitWith{}; }; } else { // Briefing screen was skipped; the player is JIP, create the markers defined during the briefing - AGM_Map_syncMarkers = false; + GVAR(syncMarkers) = false; { - _x call AGM_Map_fnc_addLineMarker; - } forEach AGM_Map_serverLineMarkers; + _x call FUNC(addLineMarker); + } forEach GVAR(serverLineMarkers); }; // Wait until the main map display is detected (display = 12) waitUntil { !isNull findDisplay 12 }; // Install event handlers on the map control and display (control = 51) - AGM_Map_syncMarkers = false; + GVAR(syncMarkers) = false; 12 call AGM_Map_fnc_installEvents; // Update the size and rotation of map tools @@ -125,11 +125,11 @@ if (!hasInterface) exitWith{}; [] spawn { while {visibleMap} do { // Show/Hide draw buttons - if ("AGM_MapTools" in items player) then { - { ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach AGM_Map_drawingControls; + if ("ACE_MapTools" in items player) then { + { ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach GVAR(drawing)Controls; } else { - { ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach AGM_Map_drawingControls; - if (AGM_Map_drawing) then { + { ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach GVAR(drawing)Controls; + if (GVAR(drawing)) then { call AGM_Map_fnc_cancelDrawing; }; }; @@ -142,10 +142,10 @@ if (!hasInterface) exitWith{}; // Hide GPS [false] call AGM_Map_fnc_openMapGps; // Hide Map tools - deleteMarkerLocal "AGM_MapToolFixed"; - deleteMarkerLocal "AGM_MapToolRotatingNormal"; - deleteMarkerLocal "AGM_MapToolRotatingSmall"; - AGM_Map_mapToolFixed = nil; + deleteMarkerLocal MARKERNAME_MAPTOOL_FIXED; + deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGNORMAL; + deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGSMALL; + GVAR(mapToolFixed) = nil; AGM_Map_mapToolRotatingNormal = nil; AGM_Map_mapToolRotatingSmall = nil; // Cancel drawing diff --git a/addons/map/XEH_preInit.sqf b/addons/map/XEH_preInit.sqf new file mode 100644 index 0000000000..87b7d4294a --- /dev/null +++ b/addons/map/XEH_preInit.sqf @@ -0,0 +1,20 @@ +#include "script_component.hpp" + +PREP(addLineMarker); +PREP(blueForceTracking); +PREP(calculateMapScale); +PREP(cancelDrawing); +PREP(canDraw); +PREP(canUseMapTools); +PREP(canUseMapGPS); +PREP(copyMapMarkers); +PREP(handleKeyDown); +PREP(handleMouseButton); +PREP(handleMouseMove); +PREP(handleMouseZChanged); +PREP(isInsideMapTool); +PREP(openMapGps); +PREP(removeLineMarker); +PREP(sendMapMarkers); +PREP(updateMapToolMarkers); +PREP(updateLineMarker); diff --git a/addons/map/XEH_preInitServer.sqf b/addons/map/XEH_preInitServer.sqf new file mode 100644 index 0000000000..68ce8e536a --- /dev/null +++ b/addons/map/XEH_preInitServer.sqf @@ -0,0 +1,4 @@ +// by CAA-Picard + +GVAR(serverLineMarkers) = []; +publicVariable QGVAR(serverLineMarkers); diff --git a/addons/map/config.cpp b/addons/map/config.cpp index b136849ea3..0d9293cb2a 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -1,229 +1,12 @@ class CfgPatches { - class AGM_Map { + class ADDON { units[] = {}; - weapons[] = {"AGM_MapTools"}; - requiredVersion = 0.60; - requiredAddons[] = {AGM_Core, AGM_Interaction}; - version = "0.95"; - versionStr = "0.95"; - versionAr[] = {0,95,0}; + weapons[] = {"ACE_MapTools"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common", "ace_interaction"}; author[] = {"KoffeinFlummi","CAA-Picard"}; authorUrl = "https://github.com/KoffeinFlummi/"; - }; -}; - -class CfgFunctions { - class AGM_Map { - class AGM_Map { - file = "AGM_Map\functions"; - class addLineMarker; - class blueForceTracking; - class calculateMapScale; - class cancelDrawing; - class canDraw; - class canUseMapTools; - class canUseMapGPS; - class copyMapMarkers; - class handleKeyDown; - class handleMouseButton; - class handleMouseMove; - class handleMouseZChanged; - class isInsideMapTool; - class openMapGps; - class removeLineMarker; - class sendMapMarkers; - class updateMapToolMarkers; - class updateLineMarker; - }; - }; -}; - -class Extended_PreInit_EventHandlers { - class AGM_Map { - serverInit = "call compile preprocessFileLineNumbers '\AGM_Map\serverInit.sqf'"; - }; -}; - -class Extended_PostInit_EventHandlers { - class AGM_Map { - clientInit = "call compile preprocessFileLineNumbers 'AGM_Map\clientInit.sqf'"; - }; -}; - -class CfgWeapons { - class AGM_ItemCore; - class InventoryItem_Base_F; - - class AGM_MapTools: AGM_ItemCore { - displayName = "$STR_AGM_MapTools_Name"; - descriptionShort = "$STR_AGM_MapTools_Description"; - model = "\A3\weapons_F\ammo\mag_univ.p3d"; - picture = "\AGM_Map\UI\maptool_item.paa"; - scope = 2; - class ItemInfo: InventoryItem_Base_F { - mass = 1; - }; - }; -}; - -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -}; - -class CfgVehicles { - - class Man; - class CAManBase: Man { - class AGM_SelfActions { - - class AGM_MapTools { - displayName = "$STR_AGM_Map_MapTools_Menu"; - condition = "(call AGM_Map_fnc_canUseMapTools) || (call AGM_Map_fnc_canUseMapGPS)"; - statement = ""; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Core_notOnMap"}; - showDisabled = 0; - priority = 100; - subMenu[] = {"AGM_MapTools", 1}; - enableInside = 1; - - class AGM_MapToolsHide { - displayName = "$STR_AGM_Map_MapToolsHide"; - condition = "(call AGM_Map_fnc_canUseMapTools) && {AGM_Map_mapToolsShown > 0}"; - statement = "AGM_Map_mapToolsShown = 0; [] call AGM_Map_fnc_updateMapToolMarkers"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Core_notOnMap"}; - showDisabled = 1; - priority = 5; - enableInside = 1; - }; - class AGM_MapToolsShowNormal { - displayName = "$STR_AGM_Map_MapToolsShowNormal"; - condition = "(call AGM_Map_fnc_canUseMapTools) && {AGM_Map_mapToolsShown != 1}"; - statement = "AGM_Map_mapToolsShown = 1; [] call AGM_Map_fnc_updateMapToolMarkers"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Core_notOnMap"}; - showDisabled = 1; - priority = 4; - enableInside = 1; - }; - class AGM_MapToolsShowSmall { - displayName = "$STR_AGM_Map_MapToolsShowSmall"; - condition = "(call AGM_Map_fnc_canUseMapTools) && {AGM_Map_mapToolsShown != 2}"; - statement = "AGM_Map_mapToolsShown = 2; [] call AGM_Map_fnc_updateMapToolMarkers"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Core_notOnMap"}; - showDisabled = 1; - priority = 3; - enableInside = 1; - }; - class AGM_MapToolsAlignNorth { - displayName = "$STR_AGM_Map_MapToolsAlignNorth"; - condition = "(call AGM_Map_fnc_canUseMapTools) && {AGM_Map_mapToolsShown != 0}"; - statement = "AGM_Map_angle = 0; [] call AGM_Map_fnc_updateMapToolMarkers"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Core_notOnMap"}; - showDisabled = 1; - priority = 2; - enableInside = 1; - }; - class AGM_MapToolsAlignCompass { - displayName = "$STR_AGM_Map_MapToolsAlignCompass"; - condition = "(call AGM_Map_fnc_canUseMapTools) && {AGM_Map_mapToolsShown != 0} && {(""ItemCompass"" in assignedItems player) || {""ItemGPS"" in assignedItems player}}"; - statement = "AGM_Map_angle = getDir player; [] call AGM_Map_fnc_updateMapToolMarkers"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Core_notOnMap"}; - showDisabled = 1; - priority = 1; - enableInside = 1; - }; - class AGM_MapGpsShow { - displayName = "$STR_AGM_Map_MapGpsShow"; - condition = "(call AGM_Map_fnc_canUseMapGPS) && {!AGM_Map_mapGpsShow}"; - statement = "AGM_Map_mapGpsShow = true; [AGM_Map_mapGpsShow] call AGM_Map_fnc_openMapGps"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Core_notOnMap"}; - showDisabled = 0; - priority = 0; - enableInside = 1; - }; - class AGM_MapGpsHide { - displayName = "$STR_AGM_Map_MapGpsHide"; - condition = "(call AGM_Map_fnc_canUseMapGPS) && AGM_Map_mapGpsShow"; - statement = "AGM_Map_mapGpsShow = false; [AGM_Map_mapGpsShow] call AGM_Map_fnc_openMapGps"; - exceptions[] = {"AGM_Drag_isNotDragging", "AGM_Core_notOnMap"}; - showDisabled = 0; - priority = 0; - enableInside = 1; - }; - }; - }; - - class AGM_Actions { - class AGM_CopyMap { - displayName = "$STR_AGM_Map_CopyMap"; - condition = "isPlayer AGM_Interaction_Target && {""ItemMap"" in assignedItems player} && {""AGM_MapTools"" in items player} && {""ItemMap"" in assignedItems AGM_Interaction_Target}"; - statement = "[player, ""AGM_Map_fnc_sendMapMarkers"", AGM_Interaction_Target] call AGM_Core_fnc_execRemoteFnc"; - showDisabled = 0; - priority = -1; - }; - }; - }; - - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class FIA_Box_Base_F; - - class Box_NATO_Support_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_MapTools,12) - }; - }; - - class Box_East_Support_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_MapTools,12) - }; - }; - - class Box_IND_Support_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(AGM_MapTools,12) - }; - }; - - class Box_FIA_Support_F: FIA_Box_Base_F { - class TransportItems { - MACRO_ADDITEM(AGM_MapTools,12) - }; - }; - - class AGM_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(AGM_MapTools,12) - }; - }; - - class Module_F; - class AGM_ModuleBlueForceTracking: Module_F { - author = "AGM Team"; - category = "AGM"; - displayName = "Blue Force Tracking"; - function = "AGM_Map_fnc_blueForceTracking"; - scope = 2; - isGlobal = 1; - icon = "\AGM_Map\UI\IconBFTracking_ca.paa"; - class Arguments { - class Interval { - displayName = "Interval"; - description = "How often the markers should be refreshed (in seconds)"; - defaultValue = 1; - }; - class HideAiGroups { - displayName = "Hide AI groups?"; - description = "Hide markers for 'AI only' groups?"; - typeName = "BOOL"; - class values { - class Yes { name = "Yes"; value = 1; }; - class No { name = "No"; value = 0; default = 1; }; - }; - }; - }; + VERSION_CONFIG; }; }; @@ -238,6 +21,22 @@ class RscButtonMenuCancel; class RscButtonMenu; class RscEdit; +class ACE_Parameters_Numeric { + GVAR(BFT_Interval) = 1; +}; +class ACE_Parameters_Boolean { + GVAR(EveryoneCanDrawOnBriefing) = 1; + GVAR(BFT_Enabled) = 0; + GVAR(BFT_HideAiGroups) = 0; +}; + +#include "MapGpsUI.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgMarkers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" + + class RscMapControl { sizeExGrid = 0.032; }; @@ -342,82 +141,3 @@ class RscDisplayServerGetReady: RscDisplayGetReady { }; }; }; - -// MARKERS -class CfgMarkers { - class Flag; - - // Reenable NATO symbols ... - class b_unknown: Flag {scope = 2;}; - - // ... and disable all the useless ones - // If you think that some of these are needed, create an issue; But until - // there's a better way to place markers, there should be only the most - // important markers here. - // Keep in mind that all of these can still be placed in the editor. - class b_hq: b_unknown {scope = 1;}; - class b_installation: b_unknown {scope = 1;}; - class b_maint: b_unknown {scope = 1;}; - class b_med: b_unknown {scope = 1;}; - class b_service: b_unknown {scope = 1;}; - class b_support: b_unknown {scope = 1;}; - - class n_unknown: b_unknown {}; - class n_hq: n_unknown {scope = 1;}; - class n_installation: n_unknown {scope = 1;}; - class u_installation: n_unknown {scope = 1;}; // i have no idea... - class n_maint: n_unknown {scope = 1;}; - class n_med: n_unknown {scope = 1;}; - class n_service: n_unknown {scope = 1;}; - class n_support: n_unknown {scope = 1;}; - - class o_unknown: b_unknown {}; - class o_hq: o_unknown {scope = 1;}; - class o_installation: o_unknown {scope = 1;}; - class o_maint: o_unknown {scope = 1;}; - class o_med: o_unknown {scope = 1;}; - class o_service: o_unknown {scope = 1;}; - class o_support: o_unknown {scope = 1;}; - - // disable all civy markers (harbor etc.) - class c_unknown: b_unknown {scope = 1;}; - - // disable quantity indicators (fire team/squad/platoon ...) - class group_0: b_unknown {scope = 1;}; - - - class AGM_MapToolFixed { - name = "MapToolFixed"; - icon = "\AGM_Map\data\mapToolFixed.paa"; - scope = 0; - color[] = {1,1,1,1}; - size = 32; - }; - - class AGM_MapToolRotatingNormal { - name = "MapToolRotating"; - icon = "\AGM_Map\data\mapToolRotatingNormal.paa"; - scope = 0; - color[] = {1,1,1,1}; - size = 32; - }; - - class AGM_MapToolRotatingSmall { - name = "MapToolRotating"; - icon = "\AGM_Map\data\mapToolRotatingSmall.paa"; - scope = 0; - color[] = {1,1,1,1}; - size = 32; - }; -}; - -class AGM_Parameters_Numeric { - AGM_Map_BFT_Interval = 1; -}; -class AGM_Parameters_Boolean { - AGM_Map_EveryoneCanDrawOnBriefing = 1; - AGM_Map_BFT_Enabled = 0; - AGM_Map_BFT_HideAiGroups = 0; -}; - -#include "MapGpsUI.hpp" diff --git a/addons/map/functions/fn_blueForceTracking.sqf b/addons/map/functions/fn_blueForceTracking.sqf deleted file mode 100644 index efef0ac96c..0000000000 --- a/addons/map/functions/fn_blueForceTracking.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Author: KoffeinFlummi - * - * Initializes the blue force tracking module. - * - * Arguments: - * Whatever the module provides. (I dunno.) - * - * Return Value: - * None - */ - -if !(hasInterface) exitWith {}; - -_logic = _this select 0; -_units = _this select 1; -_activated = _this select 2; - -if !(_activated) exitWith {}; - -_logic spawn { - waitUntil {alive player}; - - AGM_Map_BFT_Enabled = true; - [_this, "AGM_Map_BFT_Interval", "Interval"] call AGM_Core_fnc_readNumericParameterFromModule; - [_this, "AGM_Map_BFT_HideAiGroups", "HideAiGroups"] call AGM_Core_fnc_readBooleanParameterFromModule; - - diag_log text "[AGM]: Blue Force Tracking Module initialized."; -}; diff --git a/addons/map/functions/fn_canDraw.sqf b/addons/map/functions/fn_canDraw.sqf deleted file mode 100644 index 088252a7e1..0000000000 --- a/addons/map/functions/fn_canDraw.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by CAA-Picard - -(missionNameSpace getVariable ["AGM_Map_syncMarkers", true] && {AGM_Map_EveryoneCanDrawOnBriefing}) || -{(!isNull player) && {"AGM_MapTools" in items player}} diff --git a/addons/map/functions/fn_canUseMapGPS.sqf b/addons/map/functions/fn_canUseMapGPS.sqf deleted file mode 100644 index 344ab3b8c7..0000000000 --- a/addons/map/functions/fn_canUseMapGPS.sqf +++ /dev/null @@ -1,5 +0,0 @@ -// by CAA-Picard - -visibleMap && -{alive player} && -{"ItemGPS" in assignedItems player} diff --git a/addons/map/functions/fn_canUseMapTools.sqf b/addons/map/functions/fn_canUseMapTools.sqf deleted file mode 100644 index 5a5562261b..0000000000 --- a/addons/map/functions/fn_canUseMapTools.sqf +++ /dev/null @@ -1,8 +0,0 @@ -// by CAA-Picard - -visibleMap && -{alive player} && -{"ItemMap" in assignedItems player} && -{"AGM_MapTools" in items player} && -{!AGM_Map_dragging} && -{!AGM_Map_rotating} diff --git a/addons/map/functions/fn_cancelDrawing.sqf b/addons/map/functions/fn_cancelDrawing.sqf deleted file mode 100644 index 053dfd9f51..0000000000 --- a/addons/map/functions/fn_cancelDrawing.sqf +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Author: CAA-Picard - * - * Cancel the drawing of the current line marker - * - * Argument: - * None - * - * Return value: - * Nothing - */ - -AGM_Map_drawing = false; -if (count AGM_Map_tempLineMarker > 0) then { - deleteMarkerLocal (AGM_Map_tempLineMarker select 0); -}; -AGM_Map_tempLineMarker = []; diff --git a/addons/map/functions/fn_handleMouseMove.sqf b/addons/map/functions/fn_handleMouseMove.sqf deleted file mode 100644 index 7fcb7c8046..0000000000 --- a/addons/map/functions/fn_handleMouseMove.sqf +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Author: CAA-Picard - * - * Handle mouse movement over the map tool. - * - * Argument: - * 0: Map Control - * 1: Mouse position on screen coordinates - * - * Return value: - * Boolean, true if event was handled - */ - -private ["_control", "_pos"]; - -_control = _this select 0; -_pos = [_this select 1, _this select 2]; -AGM_Map_mousePos = _control ctrlMapScreenToWorld _pos; -AGM_Map_mousePos set [count AGM_Map_mousePos, 0]; - -// If cannot draw then exit -if !(call AGM_Map_fnc_canDraw) exitWith { - // If was drawing, cancel - if (AGM_Map_drawing) then { - call AGM_Map_fnc_cancelDrawing; - }; - false -}; - -// Handle drawing -if (AGM_Map_drawing) exitWith { - AGM_Map_tempLineMarker set [2, AGM_Map_mousePos]; - AGM_Map_tempLineMarker call AGM_Map_fnc_updateLineMarker; - false -}; - -// Handle Map tools -if (isNil "AGM_Map_mapToolFixed") exitWith {false}; - -// Translation -if (AGM_Map_dragging) exitWith { - AGM_Map_pos set [0, (AGM_Map_startPos select 0) + (AGM_Map_mousePos select 0) - (AGM_Map_startDragPos select 0)]; - AGM_Map_pos set [1, (AGM_Map_startPos select 1) + (AGM_Map_mousePos select 1) - (AGM_Map_startDragPos select 1)]; - - // Update the size and rotation of the maptool - [] call AGM_Map_fnc_updateMapToolMarkers; - true -}; - -// Rotation -if (AGM_Map_rotating) exitWith { - // Get new angle - _angle = (180 + ((AGM_Map_mousePos select 0) - (AGM_Map_startPos select 0)) atan2 ((AGM_Map_mousePos select 1) - (AGM_Map_startPos select 1)) mod 360); - AGM_Map_angle = AGM_Map_startAngle + _angle - AGM_Map_startDragAngle; - - // Update the size and rotation of the maptool - [] call AGM_Map_fnc_updateMapToolMarkers; - true -}; - -false diff --git a/addons/map/functions/fn_updateMapToolMarkers.sqf b/addons/map/functions/fn_updateMapToolMarkers.sqf deleted file mode 100644 index 25f9cf0691..0000000000 --- a/addons/map/functions/fn_updateMapToolMarkers.sqf +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Author: CAA-Picard - * - * Update the map tool markers, position, size, rotation and visibility. - * - * Argument: - * None - * - * Return value: - * Nothing - */ - -#define TEXTURE_WIDTH_IN_M 6205 -#define CENTER_OFFSET_Y_PERC 0.1606 -#define CONSTANT_SCALE 0.2 - -// If markers exist and they should'nt, delete them -if (!("AGM_MapTools" in items player) || {AGM_Map_mapToolsShown == 0}) then { - // If markers exist, delete them - if (!isNil "AGM_Map_mapToolFixed") then { - deleteMarkerLocal "AGM_MapToolFixed"; - AGM_Map_mapToolFixed = nil; - }; -}; -if (!("AGM_MapTools" in items player) || {AGM_Map_mapToolsShown != 1}) then { - if (!isNil "AGM_Map_mapToolRotatingNormal") then { - deleteMarkerLocal "AGM_MapToolRotatingNormal"; - AGM_Map_mapToolRotatingNormal = nil; - }; -}; -if (!("AGM_MapTools" in items player) || {AGM_Map_mapToolsShown != 2}) then { - if (!isNil "AGM_Map_mapToolRotatingSmall") then { - deleteMarkerLocal "AGM_MapToolRotatingSmall"; - AGM_Map_mapToolRotatingSmall = nil; - }; -}; - -if (!("AGM_MapTools" in items player)|| {AGM_Map_mapToolsShown == 0}) exitWith {}; - -// If markers don't exist and should, create them -if (isNil "AGM_Map_mapToolFixed") then { - AGM_Map_mapToolFixed = createMarkerLocal ["AGM_MapToolFixed", AGM_Map_pos]; - "AGM_MapToolFixed" setMarkerType "AGM_MapToolFixed"; -}; -if ((isNil "AGM_Map_mapToolRotatingNormal") && {AGM_Map_mapToolsShown == 1}) then { - AGM_Map_mapToolRotatingNormal = createMarkerLocal ["AGM_MapToolRotatingNormal", AGM_Map_pos]; - "AGM_MapToolRotatingNormal" setMarkerType "AGM_MapToolRotatingNormal"; -}; -if ((isNil "AGM_Map_mapToolRotatingSmall") && {AGM_Map_mapToolsShown == 2}) then { - AGM_Map_mapToolRotatingSmall = createMarkerLocal ["AGM_MapToolRotatingSmall", AGM_Map_pos]; - "AGM_MapToolRotatingSmall" setMarkerType "AGM_MapToolRotatingSmall"; -}; - -_rotatingMarker = ["AGM_MapToolRotatingNormal", "AGM_MapToolRotatingSmall"] select (AGM_Map_mapToolsShown - 1); -_textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (AGM_Map_mapToolsShown - 1); - -// Update scale of both parts -_scale = _textureWidth * CONSTANT_SCALE * (call AGM_Map_fnc_calculateMapScale); -"AGM_MapToolFixed" setMarkerSizeLocal [_scale,_scale]; -_rotatingMarker setMarkerSizeLocal [_scale,_scale]; - -// Position of the fixed part -_xPos = AGM_Map_pos select 0; -_yPos = (AGM_Map_pos select 1) + _textureWidth * CENTER_OFFSET_Y_PERC; -"AGM_MapToolFixed" setMarkerPosLocal [_xPos,_yPos]; - -// Position and rotation of the rotating part -_xPos = (AGM_Map_pos select 0) + sin(AGM_Map_angle) * _textureWidth * CENTER_OFFSET_Y_PERC; -_yPos = (AGM_Map_pos select 1) + cos(AGM_Map_angle) * _textureWidth * CENTER_OFFSET_Y_PERC; -_rotatingMarker setMarkerPosLocal [_xPos,_yPos]; -_rotatingMarker setMarkerDirLocal AGM_Map_angle; diff --git a/addons/map/functions/fn_addLineMarker.sqf b/addons/map/functions/fnc_addLineMarker.sqf similarity index 82% rename from addons/map/functions/fn_addLineMarker.sqf rename to addons/map/functions/fnc_addLineMarker.sqf index 7d2d5edea2..2f1f03ab2c 100644 --- a/addons/map/functions/fn_addLineMarker.sqf +++ b/addons/map/functions/fnc_addLineMarker.sqf @@ -32,9 +32,9 @@ if (_mag > 0) then { _name setMarkerDirLocal 0; }; -AGM_Map_lineMarkers pushBack (+_this); +GVAR(lineMarkers) pushBack (+_this); -if (isServer && AGM_Map_syncMarkers) then { - AGM_Map_serverLineMarkers pushBack (+_this); - publicVariable "AGM_Map_serverLineMarkers"; +if (isServer && GVAR(syncMarkers)) then { + GVAR(serverLineMarkers) pushBack (+_this); + publicVariable QGVAR(serverLineMarkers); }; diff --git a/addons/map/functions/fnc_blueForceTracking.sqf b/addons/map/functions/fnc_blueForceTracking.sqf new file mode 100644 index 0000000000..95b22ad3a8 --- /dev/null +++ b/addons/map/functions/fnc_blueForceTracking.sqf @@ -0,0 +1,32 @@ +/* + * Author: KoffeinFlummi + * + * Initializes the blue force tracking module. + * + * Arguments: + * Whatever the module provides. (I dunno.) + * + * Return Value: + * None + */ + +if !(hasInterface) exitWith {}; + +_logic = _this select 0; +_units = _this select 1; +_activated = _this select 2; + +if !(_activated) exitWith {}; + +_logic spawn { + waitUntil {alive player}; + + GVAR(BFT_Enabled) = true; + [_this, QGVAR(BFT_Interval), "Interval"] call AGM_Core_fnc_readNumericParameterFromModule; + [_this, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call AGM_Core_fnc_readBooleanParameterFromModule; + + diag_log text "[ACE]: Blue Force Tracking Module initialized."; + TRACE_2("[ACE]: Blue Force Tracking Module initialized.",GVAR(BFT_Interval), GVAR(BFT_HideAiGroups)); + + //@toDo start BFT here: +}; diff --git a/addons/map/functions/fn_calculateMapScale.sqf b/addons/map/functions/fnc_calculateMapScale.sqf similarity index 100% rename from addons/map/functions/fn_calculateMapScale.sqf rename to addons/map/functions/fnc_calculateMapScale.sqf diff --git a/addons/map/functions/fnc_canDraw.sqf b/addons/map/functions/fnc_canDraw.sqf new file mode 100644 index 0000000000..b68e208012 --- /dev/null +++ b/addons/map/functions/fnc_canDraw.sqf @@ -0,0 +1,4 @@ +// by CAA-Picard + +(missionNameSpace getVariable [QGVAR(syncMarkers), true] && {GVAR(EveryoneCanDrawOnBriefing)}) || +{(!isNull player) && {"ACE_MapTools" in items player}} diff --git a/addons/map/functions/fnc_canUseMapGPS.sqf b/addons/map/functions/fnc_canUseMapGPS.sqf new file mode 100644 index 0000000000..692907fb55 --- /dev/null +++ b/addons/map/functions/fnc_canUseMapGPS.sqf @@ -0,0 +1,5 @@ +// by CAA-Picard + +visibleMap && +{alive ACE_player} && +{"ItemGPS" in (assignedItems ACE_player)} diff --git a/addons/map/functions/fnc_canUseMapTools.sqf b/addons/map/functions/fnc_canUseMapTools.sqf new file mode 100644 index 0000000000..4e6dd84042 --- /dev/null +++ b/addons/map/functions/fnc_canUseMapTools.sqf @@ -0,0 +1,8 @@ +// by CAA-Picard + +visibleMap && +{alive player} && +{"ItemMap" in (assignedItems ACE_player)} && +{"ACE_MapTools" in (items ACE_player)} && +{!GVAR(mapToolDragging)} && +{!GVAR(mapToolRotating)} diff --git a/addons/map/functions/fnc_cancelDrawing.sqf b/addons/map/functions/fnc_cancelDrawing.sqf new file mode 100644 index 0000000000..5f758a8360 --- /dev/null +++ b/addons/map/functions/fnc_cancelDrawing.sqf @@ -0,0 +1,17 @@ +/* + * Author: CAA-Picard + * + * Cancel the drawing of the current line marker + * + * Argument: + * None + * + * Return value: + * Nothing + */ + +GVAR(drawing) = false; +if (count GVAR(tempLineMarker) > 0) then { + deleteMarkerLocal (GVAR(tempLineMarker) select 0); +}; +GVAR(tempLineMarker) = []; diff --git a/addons/map/functions/fn_copyMapMarkers.sqf b/addons/map/functions/fnc_copyMapMarkers.sqf similarity index 62% rename from addons/map/functions/fn_copyMapMarkers.sqf rename to addons/map/functions/fnc_copyMapMarkers.sqf index d3b62fa9cb..f3ea414efe 100644 --- a/addons/map/functions/fn_copyMapMarkers.sqf +++ b/addons/map/functions/fnc_copyMapMarkers.sqf @@ -15,7 +15,7 @@ _lineMarkers = _this; { _marker = _x; - if (({(_x select 0) == (_marker select 0)} count AGM_Map_lineMarkers) == 0) then { - _marker call AGM_Map_fnc_addLineMarker; + if (({(_x select 0) == (_marker select 0)} count GVAR(lineMarkers)) == 0) then { + _marker call FUNC(addLineMarker); }; } forEach _lineMarkers; diff --git a/addons/map/functions/fn_handleKeyDown.sqf b/addons/map/functions/fnc_handleKeyDown.sqf similarity index 87% rename from addons/map/functions/fn_handleKeyDown.sqf rename to addons/map/functions/fnc_handleKeyDown.sqf index aa831bbbbf..32ed08dda5 100644 --- a/addons/map/functions/fn_handleKeyDown.sqf +++ b/addons/map/functions/fnc_handleKeyDown.sqf @@ -28,21 +28,21 @@ _handled = false; // If pressed Esc while drawing if (_code == DIK_ESCAPE) exitWith { - if (AGM_Map_drawing) then { + if (GVAR(drawing)) then { call AGM_Map_fnc_cancelDrawing; _handled = true; }; }; if (_code == DIK_DELETE) exitWith { - if (AGM_Map_drawing) then { + if (GVAR(drawing)) then { call AGM_Map_fnc_cancelDrawing; _handled = true; } else { // Check if a line marker needs to be deleted { - _relPos = AGM_Map_mousePos vectorDiff (_x select 1); + _relPos = GVAR(mousePosition) vectorDiff (_x select 1); _diffVector = (_x select 2) vectorDiff (_x select 1); _magDiffVector = vectorMagnitude _diffVector; if (_magDiffVector == 0) then { @@ -57,16 +57,16 @@ if (_code == DIK_DELETE) exitWith { _lambdaTrasAbs = vectorMagnitude (_relPos vectorDiff (_diffVector vectorMultiply _lambdaLong)); if (_lambdaLong >= 0 && _lambdaLong <= _magDiffVector && _lambdaTrasAbs <= 5) exitWith { // Delete the line marker - if (AGM_Map_syncMarkers) then { + if (GVAR(syncMarkers)) then { [[_x select 0], "AGM_Map_fnc_removeLineMarker", 2] call AGM_Core_fnc_execRemoteFnc; } else { deleteMarkerLocal (_x select 0); - AGM_Map_lineMarkers = AGM_Map_lineMarkers - [_x]; + GVAR(lineMarkers) = GVAR(lineMarkers) - [_x]; }; _handled = true; }; - } forEach AGM_Map_lineMarkers; + } forEach GVAR(lineMarkers); }; }; diff --git a/addons/map/functions/fn_handleMouseButton.sqf b/addons/map/functions/fnc_handleMouseButton.sqf similarity index 68% rename from addons/map/functions/fn_handleMouseButton.sqf rename to addons/map/functions/fnc_handleMouseButton.sqf index 05e957f6ba..111249e698 100644 --- a/addons/map/functions/fn_handleMouseButton.sqf +++ b/addons/map/functions/fnc_handleMouseButton.sqf @@ -27,9 +27,9 @@ _handled = false; if (_button != 0) exitWith {}; // If releasing -if (_dir != 1 && (AGM_Map_dragging or AGM_Map_rotating)) exitWith { - AGM_Map_dragging = false; - AGM_Map_rotating = false; +if (_dir != 1 && (GVAR(mapToolDragging) or GVAR(mapToolRotating))) exitWith { + GVAR(mapToolDragging) = false; + GVAR(mapToolRotating) = false; _handled = true; _handled }; @@ -37,44 +37,44 @@ if (_dir != 1 && (AGM_Map_dragging or AGM_Map_rotating)) exitWith { // If clicking if (_dir == 1) exitWith { - if !(call AGM_Map_fnc_canDraw) exitWith {_handled = false;}; + if !(call FUNC(canDraw)) exitWith {_handled = false;}; // Transform mouse screen position to coordinates _pos = _control ctrlMapScreenToWorld _screenPos; _pos set [count _pos, 0]; - if (AGM_Map_drawing) exitWith { + if (GVAR(drawing)) exitWith { // Already drawing -> Add tempLineMarker to permanent list - if (AGM_Map_syncMarkers) then { - deleteMarkerLocal (AGM_Map_tempLineMarker select 0); - [AGM_Map_tempLineMarker, "AGM_Map_fnc_addLineMarker", 2] call AGM_Core_fnc_execRemoteFnc; + if (GVAR(syncMarkers)) then { + deleteMarkerLocal (GVAR(tempLineMarker) select 0); + [GVAR(tempLineMarker), "FUNC(addLineMarker)", 2] call AGM_Core_fnc_execRemoteFnc; // Log who drew on the briefing screen (text format ["[AGM] Server: Player %1 drew on the briefing screen", name player]) call AGM_Core_fnc_serverLog; } else { - AGM_Map_tempLineMarker call AGM_Map_fnc_updateLineMarker; - AGM_Map_lineMarkers pushBack (+AGM_Map_tempLineMarker); + GVAR(tempLineMarker) call AGM_Map_fnc_updateLineMarker; + GVAR(lineMarkers) pushBack (+GVAR(tempLineMarker)); }; - AGM_Map_tempLineMarker = []; - AGM_Map_drawing = false; + GVAR(tempLineMarker) = []; + GVAR(drawing) = false; _handled = true; }; if (_altKey) exitWith { // Start drawing - AGM_Map_drawing = true; + GVAR(drawing) = true; // Create tempLineMarker _gui = format ["%1%2%3%4", random (100), random (100), random (100), random (100)]; - AGM_Map_tempLineMarker = [_gui, + _pos, + _pos, AGM_Map_drawColor]; + GVAR(tempLineMarker) = [_gui, + _pos, + _pos, AGM_Map_drawColor]; _marker = createMarkerLocal [_gui, [0,0]]; - AGM_Map_tempLineMarker call AGM_Map_fnc_updateLineMarker; + GVAR(tempLineMarker) call AGM_Map_fnc_updateLineMarker; _handled = true; }; - AGM_Map_dragging = false; - AGM_Map_rotating = false; + GVAR(mapToolDragging) = false; + GVAR(mapToolRotating) = false; // If no map tool marker then exit - if (isNil "AGM_Map_mapToolFixed") exitWith {_handled = false;}; + if (isNil QGVAR(mapToolFixed)) exitWith {_handled = false;}; // Check if clicking the maptool if (_pos call AGM_Map_fnc_isInsideMapTool) exitWith { @@ -86,10 +86,10 @@ if (_dir == 1) exitWith { AGM_Map_startAngle = + AGM_Map_angle; AGM_Map_startDragAngle = (180 + ((AGM_Map_startDragPos select 0) - (AGM_Map_startPos select 0)) atan2 ((AGM_Map_startDragPos select 1) - (AGM_Map_startPos select 1)) mod 360); // Start rotating - AGM_Map_rotating = true; + GVAR(mapToolRotating) = true; } else { // Start dragging - AGM_Map_dragging = true; + GVAR(mapToolDragging) = true; }; _handled = true; }; diff --git a/addons/map/functions/fnc_handleMouseMove.sqf b/addons/map/functions/fnc_handleMouseMove.sqf new file mode 100644 index 0000000000..8a4e3df0cb --- /dev/null +++ b/addons/map/functions/fnc_handleMouseMove.sqf @@ -0,0 +1,61 @@ +/* + * Author: CAA-Picard + * + * Handle mouse movement over the map tool. + * + * Argument: + * 0: Map Control + * 1: Mouse position on screen coordinates + * + * Return value: + * Boolean, true if event was handled + */ + +private ["_control", "_pos"]; + +_control = _this select 0; +_pos = [_this select 1, _this select 2]; +GVAR(mousePosition) = _control ctrlMapScreenToWorld _pos; +GVAR(mousePosition) set [2, 0]; //convert 2d pos to 3d + +// If cannot draw then exit +if !(call FUNC(canDraw)) exitWith { + // If was drawing, cancel + if (GVAR(drawing)) then { + call AGM_Map_fnc_cancelDrawing; + }; + false +}; + +// Handle drawing +if (GVAR(drawing)) exitWith { + GVAR(tempLineMarker) set [2, GVAR(mousePosition)]; + GVAR(tempLineMarker) call AGM_Map_fnc_updateLineMarker; + false +}; + +// Handle Map tools +if (isNil QGVAR(mapToolFixed)) exitWith {false}; + +// Translation +if (GVAR(mapToolDragging)) exitWith { + AGM_Map_pos set [0, (AGM_Map_startPos select 0) + (GVAR(mousePosition) select 0) - (AGM_Map_startDragPos select 0)]; + AGM_Map_pos set [1, (AGM_Map_startPos select 1) + (GVAR(mousePosition) select 1) - (AGM_Map_startDragPos select 1)]; + + // Update the size and rotation of the maptool + [] call AGM_Map_fnc_updateMapToolMarkers; + true +}; + +// Rotation +if (GVAR(mapToolRotating)) exitWith { + // Get new angle + _angle = (180 + ((GVAR(mousePosition) select 0) - (AGM_Map_startPos select 0)) atan2 ((GVAR(mousePosition) select 1) - (AGM_Map_startPos select 1)) mod 360); + AGM_Map_angle = AGM_Map_startAngle + _angle - AGM_Map_startDragAngle; + + // Update the size and rotation of the maptool + [] call AGM_Map_fnc_updateMapToolMarkers; + true +}; + +false diff --git a/addons/map/functions/fn_handleMouseZChanged.sqf b/addons/map/functions/fnc_handleMouseZChanged.sqf similarity index 83% rename from addons/map/functions/fn_handleMouseZChanged.sqf rename to addons/map/functions/fnc_handleMouseZChanged.sqf index 2eadfe124b..cfbba07837 100644 --- a/addons/map/functions/fn_handleMouseZChanged.sqf +++ b/addons/map/functions/fnc_handleMouseZChanged.sqf @@ -20,7 +20,7 @@ diag_log _this; _handled = false; // If drawing, change line color -if (count AGM_Map_tempLineMarker > 0) then { +if (count GVAR(tempLineMarker) > 0) then { AGM_Map_drawColor = if (_dir > 0) then {AGM_Map_drawColor + 1} else {AGM_Map_drawColor - 1}; if (AGM_Map_drawColor >= count AGM_Map_drawColors) then { AGM_Map_drawColor = AGM_Map_drawColor - count AGM_Map_drawColors; @@ -28,8 +28,8 @@ if (count AGM_Map_tempLineMarker > 0) then { if (AGM_Map_drawColor < 0) then { AGM_Map_drawColor = AGM_Map_drawColor + count AGM_Map_drawColors; }; - AGM_Map_tempLineMarker set [3, AGM_Map_drawColor]; - AGM_Map_tempLineMarker call AGM_Map_fnc_updateLineMarker; + GVAR(tempLineMarker) set [3, AGM_Map_drawColor]; + GVAR(tempLineMarker) call AGM_Map_fnc_updateLineMarker; _handled = true; }; diff --git a/addons/map/functions/fn_isInsideMapTool.sqf b/addons/map/functions/fnc_isInsideMapTool.sqf similarity index 93% rename from addons/map/functions/fn_isInsideMapTool.sqf rename to addons/map/functions/fnc_isInsideMapTool.sqf index 2015eb2f5b..194287c32c 100644 --- a/addons/map/functions/fn_isInsideMapTool.sqf +++ b/addons/map/functions/fnc_isInsideMapTool.sqf @@ -16,8 +16,8 @@ #define DIST_TOP_TO_CENTER_PERC 0.65 #define DIST_LEFT_TO_CENTER_PERC 0.30 -if (AGM_Map_mapToolsShown == 0) exitWith {false}; -_textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (AGM_Map_mapToolsShown - 1); +if (GVAR(mapToolsShown) == 0) exitWith {false}; +_textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (GVAR(mapToolsShown) - 1); _pos = [_this select 0, _this select 1, 0]; _relPos = _pos vectorDiff [AGM_Map_pos select 0, AGM_Map_pos select 1, 0]; diff --git a/addons/map/functions/fn_openMapGps.sqf b/addons/map/functions/fnc_openMapGps.sqf similarity index 100% rename from addons/map/functions/fn_openMapGps.sqf rename to addons/map/functions/fnc_openMapGps.sqf diff --git a/addons/map/functions/fn_removeLineMarker.sqf b/addons/map/functions/fnc_removeLineMarker.sqf similarity index 50% rename from addons/map/functions/fn_removeLineMarker.sqf rename to addons/map/functions/fnc_removeLineMarker.sqf index 5985e6a53e..5f6109e82d 100644 --- a/addons/map/functions/fn_removeLineMarker.sqf +++ b/addons/map/functions/fnc_removeLineMarker.sqf @@ -15,15 +15,15 @@ deleteMarkerLocal _name; { if ((_x select 0) == _name) exitWith { - AGM_Map_lineMarkers = AGM_Map_lineMarkers - [_x]; + GVAR(lineMarkers) = GVAR(lineMarkers) - [_x]; }; -} forEach AGM_Map_lineMarkers; +} forEach GVAR(lineMarkers); -if (isServer && AGM_Map_syncMarkers) then { +if (isServer && GVAR(syncMarkers)) then { { if ((_x select 0) == _name) exitWith { - AGM_Map_serverLineMarkers = AGM_Map_serverLineMarkers - [_x]; - publicVariable "AGM_Map_serverLineMarkers"; + GVAR(serverLineMarkers) = GVAR(serverLineMarkers) - [_x]; + publicVariable "GVAR(serverLineMarkers)"; }; - } forEach AGM_Map_serverLineMarkers; + } forEach GVAR(serverLineMarkers); }; diff --git a/addons/map/functions/fn_sendMapMarkers.sqf b/addons/map/functions/fnc_sendMapMarkers.sqf similarity index 60% rename from addons/map/functions/fn_sendMapMarkers.sqf rename to addons/map/functions/fnc_sendMapMarkers.sqf index 4bc3f9a97a..cd8c07bac2 100644 --- a/addons/map/functions/fn_sendMapMarkers.sqf +++ b/addons/map/functions/fnc_sendMapMarkers.sqf @@ -10,4 +10,4 @@ * Return */ -[AGM_Map_lineMarkers, "AGM_Map_fnc_copyMapMarkers", _this] call AGM_Core_fnc_execRemoteFnc; +[GVAR(lineMarkers), "AGM_Map_fnc_copyMapMarkers", _this] call AGM_Core_fnc_execRemoteFnc; diff --git a/addons/map/functions/fn_updateLineMarker.sqf b/addons/map/functions/fnc_updateLineMarker.sqf similarity index 100% rename from addons/map/functions/fn_updateLineMarker.sqf rename to addons/map/functions/fnc_updateLineMarker.sqf diff --git a/addons/map/functions/fnc_updateMapToolMarkers.sqf b/addons/map/functions/fnc_updateMapToolMarkers.sqf new file mode 100644 index 0000000000..c0a9f93cb6 --- /dev/null +++ b/addons/map/functions/fnc_updateMapToolMarkers.sqf @@ -0,0 +1,71 @@ +/* + * Author: CAA-Picard + * + * Update the map tool markers, position, size, rotation and visibility. + * + * Argument: + * None + * + * Return value: + * Nothing + */ + +#define TEXTURE_WIDTH_IN_M 6205 +#define CENTER_OFFSET_Y_PERC 0.1606 +#define CONSTANT_SCALE 0.2 + +// If markers exist and they should'nt, delete them +if (!("ACE_MapTools" in items player) || {GVAR(mapToolsShown) == 0}) then { + // If markers exist, delete them + if (!isNil QGVAR(mapToolFixed)) then { + deleteMarkerLocal MARKERNAME_MAPTOOL_FIXED; + GVAR(mapToolFixed) = nil; + }; +}; +if (!("ACE_MapTools" in items player) || {GVAR(mapToolsShown) != 1}) then { + if (!isNil "AGM_Map_mapToolRotatingNormal") then { + deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGNORMAL; + AGM_Map_mapToolRotatingNormal = nil; + }; +}; +if (!("ACE_MapTools" in items player) || {GVAR(mapToolsShown) != 2}) then { + if (!isNil "AGM_Map_mapToolRotatingSmall") then { + deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGSMALL; + AGM_Map_mapToolRotatingSmall = nil; + }; +}; + +if (!("ACE_MapTools" in items player)|| {GVAR(mapToolsShown) == 0}) exitWith {}; + +// If markers don't exist and should, create them +if (isNil QGVAR(mapToolFixed)) then { + GVAR(mapToolFixed) = createMarkerLocal [MARKERNAME_MAPTOOL_FIXED, AGM_Map_pos]; + MARKERNAME_MAPTOOL_FIXED setMarkerType MARKERNAME_MAPTOOL_FIXED; +}; +if ((isNil "AGM_Map_mapToolRotatingNormal") && {GVAR(mapToolsShown) == 1}) then { + AGM_Map_mapToolRotatingNormal = createMarkerLocal [MARKERNAME_MAPTOOL_ROTATINGNORMAL, AGM_Map_pos]; + MARKERNAME_MAPTOOL_ROTATINGNORMAL setMarkerType MARKERNAME_MAPTOOL_ROTATINGNORMAL; +}; +if ((isNil "AGM_Map_mapToolRotatingSmall") && {GVAR(mapToolsShown) == 2}) then { + AGM_Map_mapToolRotatingSmall = createMarkerLocal [MARKERNAME_MAPTOOL_ROTATINGSMALL, AGM_Map_pos]; + MARKERNAME_MAPTOOL_ROTATINGSMALL setMarkerType MARKERNAME_MAPTOOL_ROTATINGSMALL; +}; + +_rotatingMarker = [MARKERNAME_MAPTOOL_ROTATINGNORMAL, MARKERNAME_MAPTOOL_ROTATINGSMALL] select (GVAR(mapToolsShown) - 1); +_textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (GVAR(mapToolsShown) - 1); + +// Update scale of both parts +_scale = _textureWidth * CONSTANT_SCALE * (call AGM_Map_fnc_calculateMapScale); +MARKERNAME_MAPTOOL_FIXED setMarkerSizeLocal [_scale,_scale]; +_rotatingMarker setMarkerSizeLocal [_scale,_scale]; + +// Position of the fixed part +_xPos = AGM_Map_pos select 0; +_yPos = (AGM_Map_pos select 1) + _textureWidth * CENTER_OFFSET_Y_PERC; +MARKERNAME_MAPTOOL_FIXED setMarkerPosLocal [_xPos,_yPos]; + +// Position and rotation of the rotating part +_xPos = (AGM_Map_pos select 0) + sin(AGM_Map_angle) * _textureWidth * CENTER_OFFSET_Y_PERC; +_yPos = (AGM_Map_pos select 1) + cos(AGM_Map_angle) * _textureWidth * CENTER_OFFSET_Y_PERC; +_rotatingMarker setMarkerPosLocal [_xPos,_yPos]; +_rotatingMarker setMarkerDirLocal AGM_Map_angle; diff --git a/addons/map/functions/script_component.hpp b/addons/map/functions/script_component.hpp new file mode 100644 index 0000000000..a9d4b1f265 --- /dev/null +++ b/addons/map/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\map\script_component.hpp" diff --git a/addons/map/script_component.hpp b/addons/map/script_component.hpp new file mode 100644 index 0000000000..6bfe108de2 --- /dev/null +++ b/addons/map/script_component.hpp @@ -0,0 +1,17 @@ +#define COMPONENT map +#include "\z\ace\Addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_MAP + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MAP + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAP +#endif + +#include "\z\ace\Addons\main\script_macros.hpp" + + +#define MARKERNAME_MAPTOOL_FIXED "ACE_MapToolFixed" +#define MARKERNAME_MAPTOOL_ROTATINGNORMAL "ACE_MapToolRotatingNormal" +#define MARKERNAME_MAPTOOL_ROTATINGSMALL "ACE_MapToolRotatingSmall" \ No newline at end of file diff --git a/addons/map/serverInit.sqf b/addons/map/serverInit.sqf deleted file mode 100644 index 842e311dc9..0000000000 --- a/addons/map/serverInit.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by CAA-Picard - -AGM_Map_serverLineMarkers = []; -publicVariable "AGM_Map_serverLineMarkers"; diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index c70a07c64e..afc6c2cec2 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -1,8 +1,8 @@  - + - + Map Tools Herramientas de mapa Outils de navigation @@ -14,7 +14,7 @@ Térképészeti eszközök Инструменты карты - + The Map Tools allow you to measure distances and angles on the map. Las herramientas de mapa permiten medir distancias y ángulos en el mapa. Les outils de navigation permettent de mesurer des distances et des angles sur la carte. @@ -26,7 +26,7 @@ A térképészeti eszközökkel távolságokat és szögeket tud mérni a térképen. Картографические инструменты позволяют измерять расстояния и углы на карте. - + Map Tools >> Herramientas de mapa >> Outils de navigation >> @@ -38,7 +38,7 @@ Térképészeti eszközök >> Инструменты карты >> - + Hide Map Tool Verstecke Kartenwerkzeug Ocultar herr. de mapa @@ -50,7 +50,7 @@ Schovat pomůcku k mapě Скрыть инструменты - + Show Normal Map Tool Zeige Kartenwerkzeug (normal) Mostrar herr. de mapa normal @@ -62,7 +62,7 @@ Zobrazit normální pomůcku k mapě Показать инструменты (средн. размер) - + Show Small Map Tool Zeige Kartenwerkzeug (klein) Mostrar herr. de mapa pequeñas @@ -74,7 +74,7 @@ Zobrazit malou pomůcku k mapě Показать инструменты (малый размер) - + Align Map Tool to North Kartenwerkzeug nach Norden ausrichten Alinear herr. de mapa al norte @@ -86,7 +86,7 @@ Srovnat pomůcku k mapě na sever Выровнять инструменты на север - + Align Map Tool to Compass Kartenwerkzeug am Kompass ausrichten Alinear herr. de mapa a la brújula @@ -98,7 +98,7 @@ Srovnat pomůcku k mapě ke kompasu Выровнять инструменты по компасу - + Show GPS on Map Zeige GPS auf der Karte Mostrar el GPS sobre el mapa @@ -110,7 +110,7 @@ Zobrazit GPS na mapě Показать GPS на карте - + Hide GPS on Map Verstecke GPS auf der Karte Ocultar el GPS del mapa @@ -122,7 +122,7 @@ Schovat GPS na mapě Скрыть GPS на карте - + Copy Map Karte kopieren Copiar mapa @@ -134,7 +134,7 @@ Térkép másolása Copiar Mapa - + Direction: %1° Drehung: %1° Direction: %1°