diff --git a/addons/microdagr/$PBOPREFIX$ b/addons/microdagr/$PBOPREFIX$
new file mode 100644
index 0000000000..e2de546eaf
--- /dev/null
+++ b/addons/microdagr/$PBOPREFIX$
@@ -0,0 +1 @@
+z\ace\addons\microdagr
\ No newline at end of file
diff --git a/addons/microdagr/CfgEventHandlers.hpp b/addons/microdagr/CfgEventHandlers.hpp
new file mode 100644
index 0000000000..6d1d3b6dfb
--- /dev/null
+++ b/addons/microdagr/CfgEventHandlers.hpp
@@ -0,0 +1,11 @@
+class Extended_PreInit_EventHandlers {
+ class ADDON {
+ init = QUOTE(call COMPILE_FILE(XEH_preInit));
+ };
+};
+
+class Extended_PostInit_EventHandlers {
+ class ADDON {
+ clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) );
+ };
+};
diff --git a/addons/microdagr/CfgVehicles.hpp b/addons/microdagr/CfgVehicles.hpp
new file mode 100644
index 0000000000..f892c9aaab
--- /dev/null
+++ b/addons/microdagr/CfgVehicles.hpp
@@ -0,0 +1,58 @@
+class CfgVehicles {
+ class Man;
+ class CAManBase: Man {
+ class ACE_SelfActions {
+ class ACE_Equipment {
+ class GVAR(openMicroDAGR) {
+ displayName = "$STR_ACE_microdagr_openUnit";
+ condition = QUOTE(('ACE_microDAGR' in (items _player)));
+ statement = QUOTE([] call FUNC(openDisplay));
+ showDisabled = 0;
+ priority = 0.1;
+ icon = QUOTE(PATHTOF(data\icon_microDAGR.paa));
+ hotkey = "G";
+ };
+ class GVAR(closeMicroDAGR) {
+ displayName = "$STR_ACE_microdagr_closeUnit";
+ condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_CLOSED);
+ statement = QUOTE([DISPLAY_MODE_CLOSED] call FUNC(openDisplay));
+ showDisabled = 0;
+ priority = 0;
+ icon = QUOTE(PATHTOF(data\icon_microDAGR.paa));
+ // hotkey = "G";
+ };
+ };
+ };
+ };
+
+ class Logic;
+ class Module_F: Logic {
+ class ArgumentsBaseUnits {};
+ class ModuleDescription {};
+ };
+ class GVAR(dagrModule): Module_F {
+ author = "$STR_ACE_Common_ACETeam";
+ category = "ACE";
+ displayName = "MicroDAGR Map Fill";
+ function = QFUNC(moduleMapFill);
+ scope = 2;
+ isGlobal = 1;
+ // icon = QUOTE(PATHTOF(ui\IconLock_ca.paa));
+ functionPriority = 0;
+ class Arguments {
+ class MapDataAvailable {
+ displayName = "MicroDAGR Map Fill"; // Argument label
+ description = "How much map data is filled on MicroDAGRs "; // Tooltip description
+ typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
+ class values {
+ class None {name = "Full Satellite + Buildings"; value = MAP_DETAIL_SAT; default = 1;};
+ class Side {name = "Topographical + Roads"; value = MAP_DETAIL_TOPOROADS;};
+ class Unique {name = "None (Cannot use map view)"; value = MAP_DETAIL_NONE;};
+ };
+ };
+ };
+ class ModuleDescription: ModuleDescription {
+ description = "Controls how muchdata is filled in the microDAGR items. Less data restricts the map view to show less on the minimap.
Source: microDAGR.pbo";
+ };
+ };
+};
diff --git a/addons/microdagr/CfgWeapons.hpp b/addons/microdagr/CfgWeapons.hpp
new file mode 100644
index 0000000000..73615ea6b6
--- /dev/null
+++ b/addons/microdagr/CfgWeapons.hpp
@@ -0,0 +1,15 @@
+class CfgWeapons {
+ class ACE_ItemCore;
+ class InventoryItem_Base_F;
+
+ class ACE_microDAGR: ACE_ItemCore {
+ author = "$STR_ACE_Common_ACETeam";
+ scope = 2;
+ displayName = "$STR_ACE_microdagr_itemName";
+ descriptionShort = "$STR_ACE_microdagr_itemDescription";
+ picture = QUOTE(PATHTOF(images\microDAGR_item.paa));
+ class ItemInfo: InventoryItem_Base_F {
+ mass = 2;
+ };
+ };
+};
diff --git a/addons/microdagr/XEH_clientInit.sqf b/addons/microdagr/XEH_clientInit.sqf
new file mode 100644
index 0000000000..347c1b01de
--- /dev/null
+++ b/addons/microdagr/XEH_clientInit.sqf
@@ -0,0 +1,74 @@
+//XEH_clientInit.sqf
+#include "script_component.hpp"
+
+if (!hasInterface) exitWith {};
+
+//Add Keybinds:
+["ACE3", QGVAR(openGPS), (localize "STR_ACE_microdagr_openUnit"),
+{
+ // Conditions: canInteract
+ _exceptions = [];
+ if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
+ // Conditions: specific
+ if (!("ACE_microDAGR" in (items ace_player))) exitWith {false};
+ [] call FUNC(openDisplay);
+ true;
+},
+{false},
+[0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key
+
+["ACE3", QGVAR(closeGPS), (localize "STR_ACE_microdagr_closeUnit"),
+{
+ // Conditions: canInteract
+ _exceptions = [];
+ if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
+ // Conditions: specific
+ if (!("ACE_microDAGR" in (items ace_player))) exitWith {false};
+ if (GVAR(currentShowMode) == DISPLAY_MODE_CLOSED) exitWith {false};
+
+ [DISPLAY_MODE_CLOSED] call FUNC(openDisplay);
+ true;
+},
+{false},
+[0xC7, [false, true, false]], false] call cba_fnc_addKeybind; //CTRL + Home Key
+
+//Add Eventhandler:
+["RangerfinderData", {_this call FUNC(recieveRangefinderData)}] call EFUNC(common,addEventHandler);
+
+//Global Variables to default:
+GVAR(gpsPositionASL) = [0,0,0];
+GVAR(mapAutoTrackPosition) = true;
+GVAR(mapShowTexture) = false;
+GVAR(mapPosition) = [-999, -999];
+GVAR(mapZoom) = 0.075;
+GVAR(currentApplicationPage) = APP_MODE_NULL;
+GVAR(currentShowMode) = DISPLAY_MODE_CLOSED;
+
+//User Settings
+GVAR(settingUseMils) = false;
+GVAR(settingShowAllWaypointsOnMap) = true;
+
+GVAR(newWaypointPosition) = [];
+GVAR(currentWaypoint) = -1;
+GVAR(rangeFinderPositionASL) = [];
+
+
+GVAR(mapAltitude) = getNumber (configFile >> "CfgWorlds" >> worldName >> "elevationOffset");
+
+//Calculate the map's MGRS:
+_worldMapLong = getNumber (configFile >> "CfgWorlds" >> worldName >> "longitude");
+_worldMapLat = getNumber (configFile >> "CfgWorlds" >> worldName >> "latitude");
+//Pull UTM grid from world's long/lat
+_zone = 1 + (floor ((_worldMapLong + 180) / 6));
+_band = "Z";
+if (_worldMapLat <= -80) then {
+ _band = "A";
+} else {
+ if (_worldMapLat < 84) then {
+ _band = "CDEFGHJKLMNPQRSTUVWXX" select [(floor ((_worldMapLat / 8) + 10)), 1];
+ };
+};
+//calculating square ID from long/lat is a pain in the ass, just fake it unless someone wants to actualy do this
+_squareID = if ((count worldName) > 2) then {toUpper(worldName select [0,2])} else {"XG"};
+GVAR(mgrsGridZoneDesignator) = format ["%1%2 %3", _zone, _band, _squareID];
+
diff --git a/addons/microdagr/XEH_preInit.sqf b/addons/microdagr/XEH_preInit.sqf
new file mode 100644
index 0000000000..a0ea1a538e
--- /dev/null
+++ b/addons/microdagr/XEH_preInit.sqf
@@ -0,0 +1,25 @@
+#include "script_component.hpp"
+
+ADDON = false;
+
+PREP(appMarkKeypadEntry);
+PREP(appMenuButtonConnectRangefinder);
+PREP(appSettingsLBClick);
+PREP(appWaypointsButtonDeleteWP);
+PREP(appWaypointsButtonSetWP);
+PREP(canShow);
+PREP(deviceAddWaypoint);
+PREP(deviceDeleteWaypoint);
+PREP(deviceGetWaypoints);
+PREP(dialogClosedEH);
+PREP(mapDoubleTapEH);
+PREP(mapOnDrawEH);
+PREP(modeMapButtons);
+PREP(moduleMapFill);
+PREP(openDisplay);
+PREP(recieveRangefinderData);
+PREP(saveCurrentAndSetNewMode);
+PREP(showApplicationPage);
+PREP(updateDisplay);
+
+ADDON = true;
diff --git a/addons/microdagr/config.cpp b/addons/microdagr/config.cpp
new file mode 100644
index 0000000000..39380d7a2e
--- /dev/null
+++ b/addons/microdagr/config.cpp
@@ -0,0 +1,26 @@
+#include "script_component.hpp"
+
+class CfgPatches {
+ class ADDON {
+ units[] = {};
+ weapons[] = {};
+ requiredVersion = REQUIRED_VERSION;
+ requiredAddons[] = {"ace_common"};
+ author[] = {"PabstMirror"};
+ authorUrl = "https://github.com/PabstMirror/";
+ VERSION_CONFIG;
+ };
+};
+
+#include "CfgEventHandlers.hpp"
+#include "CfgWeapons.hpp"
+#include "CfgVehicles.hpp"
+#include "gui.hpp"
+
+class ACE_Settings {
+ class GVAR(MapDataAvailable) {
+ value = 2;
+ typeName = "SCALAR";
+ isClientSetable = 0;
+ };
+};
diff --git a/addons/microdagr/data/icon_microDAGR.paa b/addons/microdagr/data/icon_microDAGR.paa
new file mode 100644
index 0000000000..04307ec581
Binary files /dev/null and b/addons/microdagr/data/icon_microDAGR.paa differ
diff --git a/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf b/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf
new file mode 100644
index 0000000000..066b44508d
--- /dev/null
+++ b/addons/microdagr/functions/fnc_appMarkKeypadEntry.sqf
@@ -0,0 +1,57 @@
+/*
+ * Author: PabstMirror
+ * Handles the keypad entries from the "Mark" Application
+ *
+ * Arguments:
+ * 0: String version of Keypad entry ["ok","del","1",...]
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * ["ok"] call ace_microdagr_fnc_appMarkKeypadEntry
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+private ["_display", "_editText", "_gridPosTuple", "_actualPos"];
+PARAMS_1(_keypadButton);
+
+disableSerialization;
+_display = displayNull;
+if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then {
+ _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]);
+} else {
+ _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]);
+};
+if (isNull _display) exitWith {ERROR("No Display");};
+
+if (GVAR(currentApplicationPage) != APP_MODE_MARK) exitWith {};
+
+_editText = ctrlText (_display displayCtrl IDC_MODEMARK_CORDSEDIT);
+
+switch (_keypadButton) do {
+case ("ok"): {
+ if ((count GVAR(newWaypointPosition)) == 0) then {
+ _gridPosTuple = [_editText] call BIS_fnc_gridToPos;
+ _actualPos = [(((_gridPosTuple select 0) select 0) + 0.5 * ((_gridPosTuple select 1) select 0)), (((_gridPosTuple select 0) select 1) + 0.5 * ((_gridPosTuple select 1) select 1))];
+ _actualPos set [2, (getTerrainHeightASL _actualPos)];
+ GVAR(newWaypointPosition) = _actualPos;
+ [APP_MODE_MARK] call FUNC(saveCurrentAndSetNewMode);
+ } else {
+ [_editText, GVAR(newWaypointPosition)] call FUNC(deviceAddWaypoint);
+ [APP_MODE_WAYPOINTS] call FUNC(saveCurrentAndSetNewMode);
+ };
+ };
+case ("del"): {
+ _editText = _editText select [0, (((count _editText) - 1) max 0)];
+ (_display displayCtrl IDC_MODEMARK_CORDSEDIT) ctrlSetText _editText;
+ ctrlSetFocus (_display displayCtrl IDC_MODEMARK_CORDSEDIT);
+ };
+ default {
+ _editText = _editText + _keypadButton;
+ (_display displayCtrl IDC_MODEMARK_CORDSEDIT) ctrlSetText _editText;
+ ctrlSetFocus (_display displayCtrl IDC_MODEMARK_CORDSEDIT);
+ };
+};
diff --git a/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf b/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf
new file mode 100644
index 0000000000..1cf81963f5
--- /dev/null
+++ b/addons/microdagr/functions/fnc_appMenuButtonConnectRangefinder.sqf
@@ -0,0 +1,20 @@
+/*
+ * Author: PabstMirror
+ * Handles the "Connect To" button from the menu application
+ *
+ * Arguments:
+ * Nothing
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * [] call ace_microdagr_fnc_appMenuButtonConnectRangefinder
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+GVAR(currentWaypoint) = if (GVAR(currentWaypoint) == -2) then {-1} else {-2};
+GVAR(rangeFinderPositionASL) = [];
+[APP_MODE_INFODISPLAY] call FUNC(saveCurrentAndSetNewMode);
diff --git a/addons/microdagr/functions/fnc_appSettingsLBClick.sqf b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf
new file mode 100644
index 0000000000..bc6779c10a
--- /dev/null
+++ b/addons/microdagr/functions/fnc_appSettingsLBClick.sqf
@@ -0,0 +1,27 @@
+/*
+ * Author: PabstMirror
+ * Handles double clicking on the setting listbox
+ *
+ * Arguments:
+ * 0: Setting List box (not used)
+ * 1: Index
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * [settingList, 1] call ace_microdagr_fnc_appSettingsLBClick
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+disableSerialization;
+PARAMS_2(_control,_itemClicked);
+
+switch (_itemClicked) do {
+ case (0): { GVAR(settingUseMils) = ! GVAR(settingUseMils)};
+ case (1): { GVAR(settingShowAllWaypointsOnMap) = ! GVAR(settingShowAllWaypointsOnMap)};
+};
+
+[] call FUNC(updateDisplay);
diff --git a/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf b/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf
new file mode 100644
index 0000000000..1acd936370
--- /dev/null
+++ b/addons/microdagr/functions/fnc_appWaypointsButtonDeleteWP.sqf
@@ -0,0 +1,37 @@
+/*
+ * Author: PabstMirror
+ * Handles clicking the delete button from the waypoint application
+ *
+ * Arguments:
+ * Nothing
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * [] call ace_microdagr_fnc_appWaypointsButtonDeleteWP
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+private ["_display", "_wpIndex"];
+
+disableSerialization;
+_display = displayNull;
+if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then {
+ _display = (uiNamespace getVariable [QGVAR(DialogDisplay), displayNull]);
+} else {
+ _display = (uiNamespace getVariable [QGVAR(RscTitleDisplay), displayNull]);
+};
+if (isNull _display) exitWith {ERROR("No Display");};
+
+_wpIndex = lbCurSel (_display displayCtrl IDC_MODEWAYPOINTS_LISTOFWAYPOINTS);
+
+//If it's our currentWP then deactivate
+if (GVAR(currentWaypoint) == _wpIndex) then {GVAR(currentWaypoint) = -1};
+
+//Delete from list:
+[_wpIndex] call FUNC(deviceDeleteWaypoint);
+//Update list now:
+[] call FUNC(updateDisplay);
diff --git a/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf b/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf
new file mode 100644
index 0000000000..1836e50da2
--- /dev/null
+++ b/addons/microdagr/functions/fnc_appWaypointsButtonSetWP.sqf
@@ -0,0 +1,33 @@
+/*
+ * Author: PabstMirror
+ * Handles clicking the setWP button from the waypoint application
+ *
+ * Arguments:
+ * The "SetWP" button
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * [] call ace_microdagr_fnc_appWaypointsButtonSetWP
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+private ["_wpListBox", "_newWpIndex", "_waypoints"];
+
+disableSerialization;
+PARAMS_1(_wpButton);
+
+_wpListBox = (ctrlParent _wpButton) displayCtrl 144501;
+_newWpIndex = lbCurSel _wpListBox;
+_waypoints = [] call FUNC(deviceGetWaypoints);
+
+if ((_newWpIndex < 0) || (_newWpIndex > ((count _waypoints) - 1))) exitWith {
+ GVAR(currentWaypoint) = -1;
+ ERROR("out of bounds wp");
+};
+
+GVAR(currentWaypoint) = _newWpIndex;
+[APP_MODE_COMPASS] call FUNC(saveCurrentAndSetNewMode);
diff --git a/addons/microdagr/functions/fnc_canShow.sqf b/addons/microdagr/functions/fnc_canShow.sqf
new file mode 100644
index 0000000000..62fb7f01ed
--- /dev/null
+++ b/addons/microdagr/functions/fnc_canShow.sqf
@@ -0,0 +1,29 @@
+/*
+ * Author: PabstMirror
+ * Tests if the dagr can be shown in a mode
+ *
+ * Arguments:
+ * The display mode to test showing
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * [] call ace_microdagr_fnc_canShow
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+PARAMS_1(_showType);
+
+//Can always do closed or hidden
+if (_showType in [DISPLAY_MODE_CLOSED, DISPLAY_MODE_HIDDEN]) exitWith {true};
+
+//Can't interact then hide gps: TODO: any exceptions?
+if (!([ACE_player, objNull, []] call EGVAR(common,canInteractWith))) exitWith {false};
+
+ //Can't have minimap up while zoomed in
+if ((_showType == DISPLAY_MODE_DISPLAY) && {cameraview == "GUNNER"}) exitWith {false};
+
+true
diff --git a/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf b/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf
new file mode 100644
index 0000000000..6912810f58
--- /dev/null
+++ b/addons/microdagr/functions/fnc_deviceAddWaypoint.sqf
@@ -0,0 +1,24 @@
+/*
+ * Author: PabstMirror
+ * Adds a waypoint to the "device"
+ * Device saving not implemented yet, just save to player object
+ *
+ * Arguments:
+ * 0: Waypoint name
+ * 1: Waypoint Position ASL
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * ["Hill 55", [41,324, 12]] call ace_microdagr_fnc_deviceAddWaypoint
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+PARAMS_2(_waypointName,_waypointPosASL);
+
+_waypoints = ace_player getVariable [QGVAR(waypoints), []];
+_waypoints pushBack [_waypointName, _waypointPosASL];
+ace_player setVariable [QGVAR(waypoints), _waypoints];
diff --git a/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf b/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf
new file mode 100644
index 0000000000..3d1e8ec852
--- /dev/null
+++ b/addons/microdagr/functions/fnc_deviceDeleteWaypoint.sqf
@@ -0,0 +1,26 @@
+/*
+ * Author: PabstMirror
+ * Deletes a waypoint from the "device"
+ * Device saving not implemented yet, just save to player object
+ *
+ * Arguments:
+ * 0: Waypoint Index
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * ["Hill 55", [41,324, 12]] call ace_microdagr_fnc_deviceDeleteWaypoint
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+PARAMS_1(_wpIndex);
+
+_waypoints = ace_player getVariable [QGVAR(waypoints), []];
+
+if ((_wpIndex < 0) || (_wpIndex > ((count _waypoints) - 1))) exitWith {ERROR("out of bounds wp");};
+
+_waypoints deleteAt _wpIndex;
+ace_player setVariable [QGVAR(waypoints), _waypoints];
diff --git a/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf b/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf
new file mode 100644
index 0000000000..f90ecb06be
--- /dev/null
+++ b/addons/microdagr/functions/fnc_deviceGetWaypoints.sqf
@@ -0,0 +1,19 @@
+/*
+ * Author: PabstMirror
+ * Gets all waypoints from the "device"
+ * Device saving not implemented yet, just save to player object
+ *
+ * Arguments:
+ * Nothing
+ *
+ * Return Value:
+ * Waypoints
+ *
+ * Example:
+ * [["Hill 55", [41,324, 12]]] = [] call ace_microdagr_fnc_deviceGetWaypoint
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+(ace_player getVariable [QGVAR(waypoints), []])
diff --git a/addons/microdagr/functions/fnc_dialogClosedEH.sqf b/addons/microdagr/functions/fnc_dialogClosedEH.sqf
new file mode 100644
index 0000000000..0a7e5e5115
--- /dev/null
+++ b/addons/microdagr/functions/fnc_dialogClosedEH.sqf
@@ -0,0 +1,21 @@
+/*
+ * Author: PabstMirror
+ * Handles the dialog closeing, switches back to display mode
+ *
+ * Arguments:
+ * Nothing
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * [] call ace_microdagr_fnc_dialogClosedEH
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+if (GVAR(currentShowMode) == DISPLAY_MODE_DIALOG) then {
+ [-1] call FUNC(saveCurrentAndSetNewMode);
+ [DISPLAY_MODE_DISPLAY] call FUNC(openDisplay);
+};
diff --git a/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf b/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf
new file mode 100644
index 0000000000..1fd4c4c4d2
--- /dev/null
+++ b/addons/microdagr/functions/fnc_mapDoubleTapEH.sqf
@@ -0,0 +1,30 @@
+/*
+ * Author: PabstMirror
+ * Handles the double tapping either of the 2 mini-maps
+ *
+ * Arguments:
+ * 0: The Map
+ * 1: MouseButton
+ * 2: MousePosX
+ * 3: MousePosY
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * [minimap,0,0.5,0.5] call ace_microdagr_fnc_mapOnDrawEH
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+PARAMS_4(_theMap,_mouseButton,_xPos,_yPos);
+
+//Only handle LMB
+if (_mouseButton != 0) exitWith {};
+
+_worldPos = _theMap ctrlMapScreenToWorld [_xPos, _yPos];
+_worldPos set [2, (getTerrainHeightASL _worldPos)];
+
+GVAR(newWaypointPosition) = _worldPos;
+[APP_MODE_MARK] call FUNC(saveCurrentAndSetNewMode);
diff --git a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf
new file mode 100644
index 0000000000..3acf3e889c
--- /dev/null
+++ b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf
@@ -0,0 +1,65 @@
+/*
+ * Author: PabstMirror
+ * Handles the draw event from all 3 maps (compass + 2 minimaps)
+ *
+ * Arguments:
+ * 0: The Map
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * [compassMap] call ace_microdagr_fnc_mapOnDrawEH
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+PARAMS_1(_theMap);
+
+_theMap = _this select 0;
+_mapSize = (ctrlPosition _theMap) select 3;
+
+_waypoints = [] call FUNC(deviceGetWaypoints);
+
+if (GVAR(currentApplicationPage) == 1) then {
+ _theMap ctrlMapAnimAdd [0, DUMMY_ZOOM, DUMMY_POS];
+ ctrlMapAnimCommit _theMap;
+ _size = 412 * _mapSize;
+ _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (getDir ace_player)), '', 0 ];
+ _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [0.533,0.769,0.76,1], DUMMY_POS, _size, _size, 0, '', 0 ];
+
+ if (GVAR(currentWaypoint) != -1) then {
+ _targetPos = [];
+ if (GVAR(currentWaypoint) == -2) then {
+ if ((count GVAR(rangeFinderPositionASL)) == 3) then {
+ _targetPos = GVAR(rangeFinderPositionASL);
+ };
+ } else {
+ if (GVAR(currentWaypoint) < (count _waypoints)) then {
+ _targetPos = (_waypoints select GVAR(currentWaypoint)) select 1;
+ };
+ };
+ if ((count _targetPos) == 3) then {
+ _relBearing = [ace_player, _targetPos] call BIS_fnc_relativeDirTo;
+ _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [1,0.564,0.564,1], DUMMY_POS, _size, _size, _relBearing, '', 0 ];
+ };
+ };
+
+} else { //Map Mode:
+ if (GVAR(mapAutoTrackPosition)) then {
+ _theMap ctrlMapAnimAdd [0, (GVAR(mapZoom)/_mapSize), GVAR(gpsPositionASL)];
+ ctrlMapAnimCommit _theMap;
+ };
+ _size = 48 * _mapSize;
+ _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], GVAR(gpsPositionASL), _size, _size, (getDir ace_player), '', 0 ];
+
+ if (GVAR(settingShowAllWaypointsOnMap)) then {
+ _size = 32 * _mapSize;
+ {
+ EXPLODE_2_PVT(_x,_wpName,_wpPos);
+ _alpha = if (_forEachIndex == GVAR(currentWaypoint)) then {1} else {0.5};
+ _theMap drawIcon [QUOTE(PATHTO_R(images\icon_mapWaypoints.paa)), [1,1,1,_alpha], _wpPos, _size, _size, 0, '', 0 ];
+ } forEach _waypoints;
+ };
+};
diff --git a/addons/microdagr/functions/fnc_modeMapButtons.sqf b/addons/microdagr/functions/fnc_modeMapButtons.sqf
new file mode 100644
index 0000000000..5de4bf9ca7
--- /dev/null
+++ b/addons/microdagr/functions/fnc_modeMapButtons.sqf
@@ -0,0 +1,31 @@
+/*
+ * Author: PabstMirror
+ * Takes some arguments and returns something or other.
+ *
+ * Arguments:
+ * 0: String of the map button pressed
+ *
+ * Return Value:
+ * Nothing
+ *
+ * Example:
+ * ["autotrack"] call ace_microdagr_fnc_modeMapButtons
+ *
+ * Public: No
+ */
+#include "script_component.hpp"
+
+PARAMS_1(_mode);
+
+[-1] call FUNC(saveCurrentAndSetNewMode); //backup current draw pos/zoom
+
+if (_mode == "autotrack") then {
+ GVAR(mapAutoTrackPosition) = !GVAR(mapAutoTrackPosition);
+} else {
+ if (_mode == "zoomin") then {
+ GVAR(mapZoom) = GVAR(mapZoom) * (10/11);
+ } else {
+ GVAR(mapZoom) = GVAR(mapZoom) * (11/10);
+ };
+};
+[] call FUNC(showApplicationPage);
diff --git a/addons/microdagr/functions/fnc_moduleMapFill.sqf b/addons/microdagr/functions/fnc_moduleMapFill.sqf
new file mode 100644
index 0000000000..d07b0bc518
--- /dev/null
+++ b/addons/microdagr/functions/fnc_moduleMapFill.sqf
@@ -0,0 +1,26 @@
+/*
+ * Author: PabstMirror
+ * Function for the module (handles the map fill level)
+ *
+ * Arguments:
+ * 0: logic