Progress on Map

This commit is contained in:
PabstMirror 2015-01-15 03:51:18 -06:00
parent e52457bfbc
commit f4c84182d4
40 changed files with 682 additions and 667 deletions

1
addons/map/$PBOPREFIX$ Normal file
View File

@ -0,0 +1 @@
z\ace\Addons\map

View File

@ -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) );
};
};

67
addons/map/CfgMarkers.hpp Normal file
View File

@ -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;
};
};

159
addons/map/CfgVehicles.hpp Normal file
View File

@ -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; };
};
};
};
};
};

15
addons/map/CfgWeapons.hpp Normal file
View File

@ -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;
};
};
};

View File

@ -1,4 +1,4 @@
class controls { class controls {
class ButtonPlayer: RscActiveText { class ButtonPlayer: RscActiveText {
text = ""; text = "";
w = 0; w = 0;
@ -84,4 +84,4 @@
colorFocused[] = {1,1,1,1}; colorFocused[] = {1,1,1,1};
onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorWhite""]"; onButtonClick = "missionNamespace setVariable [""AGM_Map_drawColor"", ""ColorWhite""]";
}; };
}; };

View File

@ -13,13 +13,13 @@
#define Y_gps safeZoneY + safeZoneH - 1.2 * H_gps #define Y_gps safeZoneY + safeZoneH - 1.2 * H_gps
class RscTitles { class RscTitles {
class RscAGM_MapGps { class RscACE_MapGps {
idd = 9855; idd = 9855;
movingEnable = 1; movingEnable = 1;
duration = 3600; duration = 3600;
fadein = 0; fadein = 0;
fadeout = 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"; //onUnLoad = "_this call onRscLoad";
class controls { class controls {
class back:RscPicture { class back:RscPicture {
@ -27,7 +27,7 @@ class RscTitles {
y = Y_gps; y = Y_gps;
w = W_gps; w = W_gps;
h = H_gps; h = H_gps;
text = "\AGM_Map\UI\mapGps.paa"; text = PATHTOF(\UI\mapGps.paa);
colorBackground[] = {1, 1, 1, 1}; colorBackground[] = {1, 1, 1, 1};
}; };
class heading: RscText{ class heading: RscText{

View File

@ -55,18 +55,18 @@ if (!hasInterface) exitWith{};
[] spawn { [] spawn {
// Init variables // Init variables
AGM_Map_mapToolsShown = 0; GVAR(mapToolsShown) = 0;
AGM_Map_pos = [0,0]; AGM_Map_pos = [0,0];
AGM_Map_angle = 0; AGM_Map_angle = 0;
AGM_Map_dragging = false; GVAR(mapToolDragging) = false;
AGM_Map_rotating = false; GVAR(mapToolRotating) = false;
AGM_Map_mapGpsShow = true; AGM_Map_mapGpsShow = true;
AGM_Map_drawing = false; GVAR(drawing) = false;
AGM_Map_tempLineMarker = []; GVAR(tempLineMarker) = [];
AGM_Map_lineMarkers = []; GVAR(lineMarkers) = [];
AGM_Map_drawColor = "ColorBlack"; 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 = { AGM_Map_fnc_installEvents = {
_d = _this; _d = _this;
@ -86,7 +86,7 @@ if (!hasInterface) exitWith{};
if (isNull findDisplay 12) then { if (isNull findDisplay 12) then {
// Install event handlers on the map control of the briefing screen (control = 51) // 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 { if (!isNull findDisplay 52) then {
52 call AGM_Map_fnc_installEvents; 52 call AGM_Map_fnc_installEvents;
} else { } else {
@ -98,16 +98,16 @@ if (!hasInterface) exitWith{};
}; };
} else { } else {
// Briefing screen was skipped; the player is JIP, create the markers defined during the briefing // 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; _x call FUNC(addLineMarker);
} forEach AGM_Map_serverLineMarkers; } forEach GVAR(serverLineMarkers);
}; };
// Wait until the main map display is detected (display = 12) // Wait until the main map display is detected (display = 12)
waitUntil { !isNull findDisplay 12 }; waitUntil { !isNull findDisplay 12 };
// Install event handlers on the map control and display (control = 51) // Install event handlers on the map control and display (control = 51)
AGM_Map_syncMarkers = false; GVAR(syncMarkers) = false;
12 call AGM_Map_fnc_installEvents; 12 call AGM_Map_fnc_installEvents;
// Update the size and rotation of map tools // Update the size and rotation of map tools
@ -125,11 +125,11 @@ if (!hasInterface) exitWith{};
[] spawn { [] spawn {
while {visibleMap} do { while {visibleMap} do {
// Show/Hide draw buttons // Show/Hide draw buttons
if ("AGM_MapTools" in items player) then { if ("ACE_MapTools" in items player) then {
{ ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach AGM_Map_drawingControls; { ((finddisplay 12) displayctrl _x) ctrlShow true; } forEach GVAR(drawing)Controls;
} else { } else {
{ ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach AGM_Map_drawingControls; { ((finddisplay 12) displayctrl _x) ctrlShow false; } forEach GVAR(drawing)Controls;
if (AGM_Map_drawing) then { if (GVAR(drawing)) then {
call AGM_Map_fnc_cancelDrawing; call AGM_Map_fnc_cancelDrawing;
}; };
}; };
@ -142,10 +142,10 @@ if (!hasInterface) exitWith{};
// Hide GPS // Hide GPS
[false] call AGM_Map_fnc_openMapGps; [false] call AGM_Map_fnc_openMapGps;
// Hide Map tools // Hide Map tools
deleteMarkerLocal "AGM_MapToolFixed"; deleteMarkerLocal MARKERNAME_MAPTOOL_FIXED;
deleteMarkerLocal "AGM_MapToolRotatingNormal"; deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGNORMAL;
deleteMarkerLocal "AGM_MapToolRotatingSmall"; deleteMarkerLocal MARKERNAME_MAPTOOL_ROTATINGSMALL;
AGM_Map_mapToolFixed = nil; GVAR(mapToolFixed) = nil;
AGM_Map_mapToolRotatingNormal = nil; AGM_Map_mapToolRotatingNormal = nil;
AGM_Map_mapToolRotatingSmall = nil; AGM_Map_mapToolRotatingSmall = nil;
// Cancel drawing // Cancel drawing

View File

@ -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);

View File

@ -0,0 +1,4 @@
// by CAA-Picard
GVAR(serverLineMarkers) = [];
publicVariable QGVAR(serverLineMarkers);

View File

@ -1,229 +1,12 @@
class CfgPatches { class CfgPatches {
class AGM_Map { class ADDON {
units[] = {}; units[] = {};
weapons[] = {"AGM_MapTools"}; weapons[] = {"ACE_MapTools"};
requiredVersion = 0.60; requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {AGM_Core, AGM_Interaction}; requiredAddons[] = {"ace_common", "ace_interaction"};
version = "0.95";
versionStr = "0.95";
versionAr[] = {0,95,0};
author[] = {"KoffeinFlummi","CAA-Picard"}; author[] = {"KoffeinFlummi","CAA-Picard"};
authorUrl = "https://github.com/KoffeinFlummi/"; authorUrl = "https://github.com/KoffeinFlummi/";
}; VERSION_CONFIG;
};
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; };
};
};
};
}; };
}; };
@ -238,6 +21,22 @@ class RscButtonMenuCancel;
class RscButtonMenu; class RscButtonMenu;
class RscEdit; 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 { class RscMapControl {
sizeExGrid = 0.032; 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"

View File

@ -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.";
};

View File

@ -1,4 +0,0 @@
// by CAA-Picard
(missionNameSpace getVariable ["AGM_Map_syncMarkers", true] && {AGM_Map_EveryoneCanDrawOnBriefing}) ||
{(!isNull player) && {"AGM_MapTools" in items player}}

View File

@ -1,5 +0,0 @@
// by CAA-Picard
visibleMap &&
{alive player} &&
{"ItemGPS" in assignedItems player}

View File

@ -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}

View File

@ -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 = [];

View File

@ -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

View File

@ -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;

View File

@ -32,9 +32,9 @@ if (_mag > 0) then {
_name setMarkerDirLocal 0; _name setMarkerDirLocal 0;
}; };
AGM_Map_lineMarkers pushBack (+_this); GVAR(lineMarkers) pushBack (+_this);
if (isServer && AGM_Map_syncMarkers) then { if (isServer && GVAR(syncMarkers)) then {
AGM_Map_serverLineMarkers pushBack (+_this); GVAR(serverLineMarkers) pushBack (+_this);
publicVariable "AGM_Map_serverLineMarkers"; publicVariable QGVAR(serverLineMarkers);
}; };

View File

@ -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:
};

View File

@ -0,0 +1,4 @@
// by CAA-Picard
(missionNameSpace getVariable [QGVAR(syncMarkers), true] && {GVAR(EveryoneCanDrawOnBriefing)}) ||
{(!isNull player) && {"ACE_MapTools" in items player}}

View File

@ -0,0 +1,5 @@
// by CAA-Picard
visibleMap &&
{alive ACE_player} &&
{"ItemGPS" in (assignedItems ACE_player)}

View File

@ -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)}

View File

@ -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) = [];

View File

@ -15,7 +15,7 @@ _lineMarkers = _this;
{ {
_marker = _x; _marker = _x;
if (({(_x select 0) == (_marker select 0)} count AGM_Map_lineMarkers) == 0) then { if (({(_x select 0) == (_marker select 0)} count GVAR(lineMarkers)) == 0) then {
_marker call AGM_Map_fnc_addLineMarker; _marker call FUNC(addLineMarker);
}; };
} forEach _lineMarkers; } forEach _lineMarkers;

View File

@ -28,21 +28,21 @@ _handled = false;
// If pressed Esc while drawing // If pressed Esc while drawing
if (_code == DIK_ESCAPE) exitWith { if (_code == DIK_ESCAPE) exitWith {
if (AGM_Map_drawing) then { if (GVAR(drawing)) then {
call AGM_Map_fnc_cancelDrawing; call AGM_Map_fnc_cancelDrawing;
_handled = true; _handled = true;
}; };
}; };
if (_code == DIK_DELETE) exitWith { if (_code == DIK_DELETE) exitWith {
if (AGM_Map_drawing) then { if (GVAR(drawing)) then {
call AGM_Map_fnc_cancelDrawing; call AGM_Map_fnc_cancelDrawing;
_handled = true; _handled = true;
} else { } else {
// Check if a line marker needs to be deleted // 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); _diffVector = (_x select 2) vectorDiff (_x select 1);
_magDiffVector = vectorMagnitude _diffVector; _magDiffVector = vectorMagnitude _diffVector;
if (_magDiffVector == 0) then { if (_magDiffVector == 0) then {
@ -57,16 +57,16 @@ if (_code == DIK_DELETE) exitWith {
_lambdaTrasAbs = vectorMagnitude (_relPos vectorDiff (_diffVector vectorMultiply _lambdaLong)); _lambdaTrasAbs = vectorMagnitude (_relPos vectorDiff (_diffVector vectorMultiply _lambdaLong));
if (_lambdaLong >= 0 && _lambdaLong <= _magDiffVector && _lambdaTrasAbs <= 5) exitWith { if (_lambdaLong >= 0 && _lambdaLong <= _magDiffVector && _lambdaTrasAbs <= 5) exitWith {
// Delete the line marker // 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; [[_x select 0], "AGM_Map_fnc_removeLineMarker", 2] call AGM_Core_fnc_execRemoteFnc;
} else { } else {
deleteMarkerLocal (_x select 0); deleteMarkerLocal (_x select 0);
AGM_Map_lineMarkers = AGM_Map_lineMarkers - [_x]; GVAR(lineMarkers) = GVAR(lineMarkers) - [_x];
}; };
_handled = true; _handled = true;
}; };
} forEach AGM_Map_lineMarkers; } forEach GVAR(lineMarkers);
}; };
}; };

View File

@ -27,9 +27,9 @@ _handled = false;
if (_button != 0) exitWith {}; if (_button != 0) exitWith {};
// If releasing // If releasing
if (_dir != 1 && (AGM_Map_dragging or AGM_Map_rotating)) exitWith { if (_dir != 1 && (GVAR(mapToolDragging) or GVAR(mapToolRotating))) exitWith {
AGM_Map_dragging = false; GVAR(mapToolDragging) = false;
AGM_Map_rotating = false; GVAR(mapToolRotating) = false;
_handled = true; _handled = true;
_handled _handled
}; };
@ -37,44 +37,44 @@ if (_dir != 1 && (AGM_Map_dragging or AGM_Map_rotating)) exitWith {
// If clicking // If clicking
if (_dir == 1) exitWith { 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 // Transform mouse screen position to coordinates
_pos = _control ctrlMapScreenToWorld _screenPos; _pos = _control ctrlMapScreenToWorld _screenPos;
_pos set [count _pos, 0]; _pos set [count _pos, 0];
if (AGM_Map_drawing) exitWith { if (GVAR(drawing)) exitWith {
// Already drawing -> Add tempLineMarker to permanent list // Already drawing -> Add tempLineMarker to permanent list
if (AGM_Map_syncMarkers) then { if (GVAR(syncMarkers)) then {
deleteMarkerLocal (AGM_Map_tempLineMarker select 0); deleteMarkerLocal (GVAR(tempLineMarker) select 0);
[AGM_Map_tempLineMarker, "AGM_Map_fnc_addLineMarker", 2] call AGM_Core_fnc_execRemoteFnc; [GVAR(tempLineMarker), "FUNC(addLineMarker)", 2] call AGM_Core_fnc_execRemoteFnc;
// Log who drew on the briefing screen // 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; (text format ["[AGM] Server: Player %1 drew on the briefing screen", name player]) call AGM_Core_fnc_serverLog;
} else { } else {
AGM_Map_tempLineMarker call AGM_Map_fnc_updateLineMarker; GVAR(tempLineMarker) call AGM_Map_fnc_updateLineMarker;
AGM_Map_lineMarkers pushBack (+AGM_Map_tempLineMarker); GVAR(lineMarkers) pushBack (+GVAR(tempLineMarker));
}; };
AGM_Map_tempLineMarker = []; GVAR(tempLineMarker) = [];
AGM_Map_drawing = false; GVAR(drawing) = false;
_handled = true; _handled = true;
}; };
if (_altKey) exitWith { if (_altKey) exitWith {
// Start drawing // Start drawing
AGM_Map_drawing = true; GVAR(drawing) = true;
// Create tempLineMarker // Create tempLineMarker
_gui = format ["%1%2%3%4", random (100), random (100), random (100), random (100)]; _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]]; _marker = createMarkerLocal [_gui, [0,0]];
AGM_Map_tempLineMarker call AGM_Map_fnc_updateLineMarker; GVAR(tempLineMarker) call AGM_Map_fnc_updateLineMarker;
_handled = true; _handled = true;
}; };
AGM_Map_dragging = false; GVAR(mapToolDragging) = false;
AGM_Map_rotating = false; GVAR(mapToolRotating) = false;
// If no map tool marker then exit // 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 // Check if clicking the maptool
if (_pos call AGM_Map_fnc_isInsideMapTool) exitWith { if (_pos call AGM_Map_fnc_isInsideMapTool) exitWith {
@ -86,10 +86,10 @@ if (_dir == 1) exitWith {
AGM_Map_startAngle = + AGM_Map_angle; 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); 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 // Start rotating
AGM_Map_rotating = true; GVAR(mapToolRotating) = true;
} else { } else {
// Start dragging // Start dragging
AGM_Map_dragging = true; GVAR(mapToolDragging) = true;
}; };
_handled = true; _handled = true;
}; };

View File

@ -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

View File

@ -20,7 +20,7 @@ diag_log _this;
_handled = false; _handled = false;
// If drawing, change line color // 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}; 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 { if (AGM_Map_drawColor >= count AGM_Map_drawColors) then {
AGM_Map_drawColor = AGM_Map_drawColor - count AGM_Map_drawColors; 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 { if (AGM_Map_drawColor < 0) then {
AGM_Map_drawColor = AGM_Map_drawColor + count AGM_Map_drawColors; AGM_Map_drawColor = AGM_Map_drawColor + count AGM_Map_drawColors;
}; };
AGM_Map_tempLineMarker set [3, AGM_Map_drawColor]; GVAR(tempLineMarker) set [3, AGM_Map_drawColor];
AGM_Map_tempLineMarker call AGM_Map_fnc_updateLineMarker; GVAR(tempLineMarker) call AGM_Map_fnc_updateLineMarker;
_handled = true; _handled = true;
}; };

View File

@ -16,8 +16,8 @@
#define DIST_TOP_TO_CENTER_PERC 0.65 #define DIST_TOP_TO_CENTER_PERC 0.65
#define DIST_LEFT_TO_CENTER_PERC 0.30 #define DIST_LEFT_TO_CENTER_PERC 0.30
if (AGM_Map_mapToolsShown == 0) exitWith {false}; if (GVAR(mapToolsShown) == 0) exitWith {false};
_textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (AGM_Map_mapToolsShown - 1); _textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (GVAR(mapToolsShown) - 1);
_pos = [_this select 0, _this select 1, 0]; _pos = [_this select 0, _this select 1, 0];
_relPos = _pos vectorDiff [AGM_Map_pos select 0, AGM_Map_pos select 1, 0]; _relPos = _pos vectorDiff [AGM_Map_pos select 0, AGM_Map_pos select 1, 0];

View File

@ -15,15 +15,15 @@
deleteMarkerLocal _name; deleteMarkerLocal _name;
{ {
if ((_x select 0) == _name) exitWith { 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 { if ((_x select 0) == _name) exitWith {
AGM_Map_serverLineMarkers = AGM_Map_serverLineMarkers - [_x]; GVAR(serverLineMarkers) = GVAR(serverLineMarkers) - [_x];
publicVariable "AGM_Map_serverLineMarkers"; publicVariable "GVAR(serverLineMarkers)";
}; };
} forEach AGM_Map_serverLineMarkers; } forEach GVAR(serverLineMarkers);
}; };

View File

@ -10,4 +10,4 @@
* Return * 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;

View File

@ -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;

View File

@ -0,0 +1 @@
#include "\z\ace\addons\map\script_component.hpp"

View File

@ -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"

View File

@ -1,4 +0,0 @@
// by CAA-Picard
AGM_Map_serverLineMarkers = [];
publicVariable "AGM_Map_serverLineMarkers";

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-22 --> <!-- Edited with tabler - 2014-12-22 -->
<Project name="AGM"> <Project name="ACE">
<Package name="Map"> <Package name="Map">
<Key ID="STR_AGM_MapTools_Name"> <Key ID="STR_ACE_MapTools_Name">
<English>Map Tools</English> <English>Map Tools</English>
<Spanish>Herramientas de mapa</Spanish> <Spanish>Herramientas de mapa</Spanish>
<French>Outils de navigation</French> <French>Outils de navigation</French>
@ -14,7 +14,7 @@
<Hungarian>Térképészeti eszközök</Hungarian> <Hungarian>Térképészeti eszközök</Hungarian>
<Russian>Инструменты карты</Russian> <Russian>Инструменты карты</Russian>
</Key> </Key>
<Key ID="STR_AGM_MapTools_Description"> <Key ID="STR_ACE_MapTools_Description">
<English>The Map Tools allow you to measure distances and angles on the map.</English> <English>The Map Tools allow you to measure distances and angles on the map.</English>
<Spanish>Las herramientas de mapa permiten medir distancias y ángulos en el mapa.</Spanish> <Spanish>Las herramientas de mapa permiten medir distancias y ángulos en el mapa.</Spanish>
<French>Les outils de navigation permettent de mesurer des distances et des angles sur la carte.</French> <French>Les outils de navigation permettent de mesurer des distances et des angles sur la carte.</French>
@ -26,7 +26,7 @@
<Hungarian>A térképészeti eszközökkel távolságokat és szögeket tud mérni a térképen.</Hungarian> <Hungarian>A térképészeti eszközökkel távolságokat és szögeket tud mérni a térképen.</Hungarian>
<Russian>Картографические инструменты позволяют измерять расстояния и углы на карте.</Russian> <Russian>Картографические инструменты позволяют измерять расстояния и углы на карте.</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_MapTools_Menu"> <Key ID="STR_ACE_Map_MapTools_Menu">
<English>Map Tools &gt;&gt;</English> <English>Map Tools &gt;&gt;</English>
<Spanish>Herramientas de mapa &gt;&gt;</Spanish> <Spanish>Herramientas de mapa &gt;&gt;</Spanish>
<French>Outils de navigation &gt;&gt;</French> <French>Outils de navigation &gt;&gt;</French>
@ -38,7 +38,7 @@
<Hungarian>Térképészeti eszközök &gt;&gt;</Hungarian> <Hungarian>Térképészeti eszközök &gt;&gt;</Hungarian>
<Russian>Инструменты карты &gt;&gt;</Russian> <Russian>Инструменты карты &gt;&gt;</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_MapToolsHide"> <Key ID="STR_ACE_Map_MapToolsHide">
<English>Hide Map Tool</English> <English>Hide Map Tool</English>
<German>Verstecke Kartenwerkzeug</German> <German>Verstecke Kartenwerkzeug</German>
<Spanish>Ocultar herr. de mapa</Spanish> <Spanish>Ocultar herr. de mapa</Spanish>
@ -50,7 +50,7 @@
<Czech>Schovat pomůcku k mapě</Czech> <Czech>Schovat pomůcku k mapě</Czech>
<Russian>Скрыть инструменты</Russian> <Russian>Скрыть инструменты</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_MapToolsShowNormal"> <Key ID="STR_ACE_Map_MapToolsShowNormal">
<English>Show Normal Map Tool</English> <English>Show Normal Map Tool</English>
<German>Zeige Kartenwerkzeug (normal)</German> <German>Zeige Kartenwerkzeug (normal)</German>
<Spanish>Mostrar herr. de mapa normal</Spanish> <Spanish>Mostrar herr. de mapa normal</Spanish>
@ -62,7 +62,7 @@
<Czech>Zobrazit normální pomůcku k mapě</Czech> <Czech>Zobrazit normální pomůcku k mapě</Czech>
<Russian>Показать инструменты (средн. размер)</Russian> <Russian>Показать инструменты (средн. размер)</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_MapToolsShowSmall"> <Key ID="STR_ACE_Map_MapToolsShowSmall">
<English>Show Small Map Tool</English> <English>Show Small Map Tool</English>
<German>Zeige Kartenwerkzeug (klein)</German> <German>Zeige Kartenwerkzeug (klein)</German>
<Spanish>Mostrar herr. de mapa pequeñas</Spanish> <Spanish>Mostrar herr. de mapa pequeñas</Spanish>
@ -74,7 +74,7 @@
<Czech>Zobrazit malou pomůcku k mapě</Czech> <Czech>Zobrazit malou pomůcku k mapě</Czech>
<Russian>Показать инструменты (малый размер)</Russian> <Russian>Показать инструменты (малый размер)</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_MapToolsAlignNorth"> <Key ID="STR_ACE_Map_MapToolsAlignNorth">
<English>Align Map Tool to North</English> <English>Align Map Tool to North</English>
<German>Kartenwerkzeug nach Norden ausrichten</German> <German>Kartenwerkzeug nach Norden ausrichten</German>
<Spanish>Alinear herr. de mapa al norte</Spanish> <Spanish>Alinear herr. de mapa al norte</Spanish>
@ -86,7 +86,7 @@
<Czech>Srovnat pomůcku k mapě na sever</Czech> <Czech>Srovnat pomůcku k mapě na sever</Czech>
<Russian>Выровнять инструменты на север</Russian> <Russian>Выровнять инструменты на север</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_MapToolsAlignCompass"> <Key ID="STR_ACE_Map_MapToolsAlignCompass">
<English>Align Map Tool to Compass</English> <English>Align Map Tool to Compass</English>
<German>Kartenwerkzeug am Kompass ausrichten</German> <German>Kartenwerkzeug am Kompass ausrichten</German>
<Spanish>Alinear herr. de mapa a la brújula</Spanish> <Spanish>Alinear herr. de mapa a la brújula</Spanish>
@ -98,7 +98,7 @@
<Czech>Srovnat pomůcku k mapě ke kompasu</Czech> <Czech>Srovnat pomůcku k mapě ke kompasu</Czech>
<Russian>Выровнять инструменты по компасу</Russian> <Russian>Выровнять инструменты по компасу</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_MapGpsShow"> <Key ID="STR_ACE_Map_MapGpsShow">
<English>Show GPS on Map</English> <English>Show GPS on Map</English>
<German>Zeige GPS auf der Karte</German> <German>Zeige GPS auf der Karte</German>
<Spanish>Mostrar el GPS sobre el mapa</Spanish> <Spanish>Mostrar el GPS sobre el mapa</Spanish>
@ -110,7 +110,7 @@
<Czech>Zobrazit GPS na mapě</Czech> <Czech>Zobrazit GPS na mapě</Czech>
<Russian>Показать GPS на карте</Russian> <Russian>Показать GPS на карте</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_MapGpsHide"> <Key ID="STR_ACE_Map_MapGpsHide">
<English>Hide GPS on Map</English> <English>Hide GPS on Map</English>
<German>Verstecke GPS auf der Karte</German> <German>Verstecke GPS auf der Karte</German>
<Spanish>Ocultar el GPS del mapa</Spanish> <Spanish>Ocultar el GPS del mapa</Spanish>
@ -122,7 +122,7 @@
<Czech>Schovat GPS na mapě</Czech> <Czech>Schovat GPS na mapě</Czech>
<Russian>Скрыть GPS на карте</Russian> <Russian>Скрыть GPS на карте</Russian>
</Key> </Key>
<Key ID="STR_AGM_Map_CopyMap"> <Key ID="STR_ACE_Map_CopyMap">
<English>Copy Map</English> <English>Copy Map</English>
<German>Karte kopieren</German> <German>Karte kopieren</German>
<Spanish>Copiar mapa</Spanish> <Spanish>Copiar mapa</Spanish>
@ -134,7 +134,7 @@
<Hungarian>Térkép másolása</Hungarian> <Hungarian>Térkép másolása</Hungarian>
<Portuguese>Copiar Mapa</Portuguese> <Portuguese>Copiar Mapa</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Map_MarkerDirection"> <Key ID="STR_ACE_Map_MarkerDirection">
<English>Direction: %1°</English> <English>Direction: %1°</English>
<German>Drehung: %1°</German> <German>Drehung: %1°</German>
<French>Direction: %1°</French> <French>Direction: %1°</French>