diff --git a/addons/maptools/CfgVehicles.hpp b/addons/maptools/CfgVehicles.hpp index 2e5663e251..5ab3eac165 100644 --- a/addons/maptools/CfgVehicles.hpp +++ b/addons/maptools/CfgVehicles.hpp @@ -5,14 +5,14 @@ class CfgVehicles { class ACE_MapGpsShow { displayName = CSTRING(MapGpsShow); condition = QUOTE((!GVAR(mapGpsShow)) && {call FUNC(canUseMapGPS)}); - statement = QUOTE(GVAR(mapGpsShow) = true; [GVAR(mapGpsShow)] call FUNC(openMapGps)); + statement = QUOTE(GVAR(mapGpsShow) = true;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 0; }; class ACE_MapGpsHide { displayName = CSTRING(MapGpsHide); condition = QUOTE((GVAR(mapGpsShow)) && {call FUNC(canUseMapGPS)}); - statement = QUOTE(GVAR(mapGpsShow) = false; [GVAR(mapGpsShow)] call FUNC(openMapGps)); + statement = QUOTE(GVAR(mapGpsShow) = false;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 0; }; diff --git a/addons/maptools/MapGpsUI.hpp b/addons/maptools/MapGpsUI.hpp deleted file mode 100644 index cd0a418465..0000000000 --- a/addons/maptools/MapGpsUI.hpp +++ /dev/null @@ -1,80 +0,0 @@ -#define GUI_GRID_X (0) -#define GUI_GRID_Y (0) -#define GUI_GRID_W (0.025) -#define GUI_GRID_H (0.04) - -#define ST_LEFT 0x00 -#define ST_RIGHT 0x01 -#define ST_CENTER 0x02 - -#define W_gps 0.4025 -#define H_gps 0.25 -#define X_gps safeZoneX + safeZoneW - 1.1 * W_gps -#define Y_gps safeZoneY + safeZoneH - 1.2 * H_gps - -class RscTitles { - class RscACE_MapGps { - idd = 9855; - movingEnable = 1; - duration = 3600; - fadein = 0; - fadeout = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(ui_mapGpsDisplay)), _this select 0)];); - class controls { - class back:RscPicture { - x = X_gps; - y = Y_gps; - w = W_gps; - h = H_gps; - text = QPATHTOF(UI\mapGps.paa); - colorBackground[] = {1, 1, 1, 1}; - }; - class heading: RscText{ - idc = 913590; - x = X_gps + W_gps * 0.225; - y = Y_gps + H_gps * 0.12; - w = W_gps * 0.2; - h = H_gps * 0.16; - style = ST_LEFT; - text = "225"; - colorBackground[] = {0,0,0,0}; - colorText[] = {0.247,0.251,0.157,1}; - shadowColo[] = {0,0,0,0}; - // EtelkaNarrowMediumPro broke with 1.72 hotfix, can revert back to that font if fixed (following 3 uses of PuristaSemibold) - font = "PuristaSemibold"; - shadow = 0; - sizeEx = 0.042; - }; - class altitude: RscText{ - idc = 913591; - x = X_gps + W_gps * 0.575; - y = Y_gps + H_gps * 0.12; - w = W_gps * 0.2; - h = H_gps * 0.16; - style = ST_RIGHT; - text = "55 m"; - colorBackground[] = {0,0,0,0}; - colorText[] = {0.247,0.251,0.157,1}; - shadowColo[] = {0,0,0,0}; - font = "PuristaSemibold"; - shadow = 0; - sizeEx = 0.042; - }; - class coordinates: RscText{ - idc = 913592; - x = X_gps + W_gps * 0.15; - y = Y_gps + H_gps * 0.33; - w = W_gps * 0.7; - h = H_gps * 0.35; - style = ST_CENTER; - text = "012.3 115.1"; - colorBackground[] = {0,0,0,0}; - colorText[] = {0.247,0.251,0.157,1}; - shadowColo[] = {0,0,0,0}; - font = "PuristaSemibold"; - shadow = 0; - sizeEx = 0.1; - }; - }; - }; -}; diff --git a/addons/maptools/RscDisplayMainMap.hpp b/addons/maptools/RscDisplayMainMap.hpp new file mode 100644 index 0000000000..db54ab6bf8 --- /dev/null +++ b/addons/maptools/RscDisplayMainMap.hpp @@ -0,0 +1,89 @@ +class RscDisplayMainMap { + class objects { + class GVAR(MapGpsDisplay): RscObject { + show = 0; + idc = 913589; + type = 82; + model = QPATHTOF(data\MapGpsDisplay.p3d); + /* + 1.000 - normal model + memory - has 4 points in selection "deviceScreen" and then those 4 as individual "deviceScreen tl", "deviceScreen br", "deviceScreen b'", "deviceScreen br" + geometry - has a simpe box with a name selection component01 (needed to make it dragable) + */ + scale = 0.333; + direction[] = {0,1,0}; + up[] = {0,0,-1}; + x = 0.9; + y = 0.9; + z = 0.2; + xBack = 0.9; + yBack = 0.9; + zBack = 0.3; + inBack = 1; + enableZoom = 1; + zoomDuration = 0.001; + class Areas { + class deviceScreen { + selection = "deviceScreen"; + class controls { + class Picture: RscPicture { + text = QPATHTOF(UI\MapGpsDisplay_background_ca.paa); + // gets displayed in game a little bit washed out depending on rotation angle + x = 0; + y = 0; + w = 1; + h = 0.77; + }; + + class heading: RscText { + idc = 913590; + x = 0.15; + y = 0; + w = 0.35; + h = 0.2; + style = 0; // ST_LEFT + text = "225"; + colorBackground[] = {0,0,0,0}; + colorText[] = {0.1235,0.1255,0.0785,1}; + shadowColor[] = {0,0,0,0}; + // EtelkaNarrowMediumPro broke with 1.72 hotfix, can revert back to that font if fixed (following 3 uses of PuristaSemibold) [ still broken ] + font = "PuristaSemibold"; + shadow = 0; + sizeEx = 0.18; + }; + class altitude: RscText{ + idc = 913591; + x = 0.5; + y = 0; + w = 0.35; + h = 0.2; + style = 1; // ST_RIGHT + text = "55 m"; + colorBackground[] = {0,0,0,0}; + colorText[] = {0.1235,0.1255,0.0785,1}; + shadowColor[] = {0,0,0,0}; + font = "PuristaSemibold"; + shadow = 0; + sizeEx = 0.18; + }; + class coordinates: RscText{ + idc = 913592; + x = 0; + y = 0.225; + w = 1; + h = 0.35; + style = 2; // ST_CENTER + text = "12345 12345"; + colorBackground[] = {0,0,0,0}; + colorText[] = {0.1235,0.1255,0.0785,1}; + shadowColor[] = {0,0,0,0}; + font = "PuristaSemibold"; + shadow = 0; + sizeEx = 0.333; + }; + }; + }; + }; + }; + }; +}; diff --git a/addons/maptools/UI/MapGpsDisplay_background_ca.paa b/addons/maptools/UI/MapGpsDisplay_background_ca.paa new file mode 100644 index 0000000000..fedae61df5 Binary files /dev/null and b/addons/maptools/UI/MapGpsDisplay_background_ca.paa differ diff --git a/addons/maptools/UI/mapGps.paa b/addons/maptools/UI/mapGps.paa deleted file mode 100644 index defcdbc63b..0000000000 Binary files a/addons/maptools/UI/mapGps.paa and /dev/null differ diff --git a/addons/maptools/XEH_PREP.hpp b/addons/maptools/XEH_PREP.hpp index eac6947431..cf193698e5 100644 --- a/addons/maptools/XEH_PREP.hpp +++ b/addons/maptools/XEH_PREP.hpp @@ -5,6 +5,5 @@ PREP(drawLinesOnRoamer); PREP(handleMouseButton); PREP(handleMouseMove); PREP(isInsideMapTool); -PREP(openMapGps); PREP(openMapGpsUpdate); PREP(updateMapToolMarkers); diff --git a/addons/maptools/XEH_postInitClient.sqf b/addons/maptools/XEH_postInitClient.sqf index ddde7063cc..c7dceacd75 100644 --- a/addons/maptools/XEH_postInitClient.sqf +++ b/addons/maptools/XEH_postInitClient.sqf @@ -6,6 +6,7 @@ if (!hasInterface) exitWith {}; // Init variables GVAR(mapGpsShow) = true; +GVAR(mapGpsNextUpdate) = -1; GVAR(mapTool_Shown) = 0; GVAR(mapTool_pos) = [0,0]; @@ -19,18 +20,12 @@ GVAR(mapTool_isRotating) = false; ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}]; ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}]; ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}]; - ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {call FUNC(updateMapToolMarkers); call FUNC(openMapGpsUpdate);}]; }, []] call CBA_fnc_waitUntilAndExecute; ["visibleMap", { params ["", "_mapOn"]; - if (_mapOn) then { - // Show GPS if required - [GVAR(mapGpsShow)] call FUNC(openMapGps); - } else { - // Hide GPS - [false] call FUNC(openMapGps); - + if (!_mapOn) then { // Handle closing map in middle of line drawing (it's never created) GVAR(freedrawing) = false; }; diff --git a/addons/maptools/config.cpp b/addons/maptools/config.cpp index e94ec2edcd..40d532a0c1 100644 --- a/addons/maptools/config.cpp +++ b/addons/maptools/config.cpp @@ -26,7 +26,7 @@ class RscButtonMenu; class RscEdit; #include "ACE_Settings.hpp" -#include "MapGpsUI.hpp" #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "RscDisplayMainMap.hpp" diff --git a/addons/maptools/data/MapGpsDisplay.p3d b/addons/maptools/data/MapGpsDisplay.p3d new file mode 100644 index 0000000000..b6cc1b3a71 Binary files /dev/null and b/addons/maptools/data/MapGpsDisplay.p3d differ diff --git a/addons/maptools/functions/fnc_canUseMapGPS.sqf b/addons/maptools/functions/fnc_canUseMapGPS.sqf index 80f2541cab..5de3546d9c 100644 --- a/addons/maptools/functions/fnc_canUseMapGPS.sqf +++ b/addons/maptools/functions/fnc_canUseMapGPS.sqf @@ -10,7 +10,7 @@ * Boolean * * Example: - * call ACE_map_fnc_canUseMapGPS + * call ACE_maptools_fnc_canUseMapGPS * * Public: No */ diff --git a/addons/maptools/functions/fnc_openMapGps.sqf b/addons/maptools/functions/fnc_openMapGps.sqf deleted file mode 100644 index 96be3f6bd2..0000000000 --- a/addons/maptools/functions/fnc_openMapGps.sqf +++ /dev/null @@ -1,28 +0,0 @@ -#include "script_component.hpp" -/* - * Author: esteldunedain - * Opens or closes the gps on the map screen, showing coordinates - * - * Arguments: - * 0: Open GPS? - * - * Return Value: - * None - * - * Example: - * [true] call ACE_maptools_fnc_openMapGps - * - * Public: No - */ - -params ["_shouldOpenGps"]; - -private _isOpen = !(isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull])); - -if (_shouldOpenGps && {"ItemGPS" in assignedItems ACE_player} && {!_isOpen}) then { - ("RscACE_MapGps" call BIS_fnc_rscLayer) cutRsc ["RscACE_MapGps","PLAIN"]; - - [FUNC(openMapGpsUpdate), 0.5, []] call CBA_fnc_addPerFrameHandler; //update bearing/altitude every 0.5 sec (ticktime) -} else { - ("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; -}; diff --git a/addons/maptools/functions/fnc_openMapGpsUpdate.sqf b/addons/maptools/functions/fnc_openMapGpsUpdate.sqf index 84cb3f17a4..646b5df2e0 100644 --- a/addons/maptools/functions/fnc_openMapGpsUpdate.sqf +++ b/addons/maptools/functions/fnc_openMapGpsUpdate.sqf @@ -1,30 +1,34 @@ #include "script_component.hpp" /* - * Author: esteldunedain - * update gps display + * Author: esteldunedain, PabstMirror + * update gps display, called from main map's draw * * Arguments: - * Something + * 0: Map ctrl * * Return Value: * None * * Example: - * call ACE_maptools_fnc_openMapGpsUpdate + * [findDisplay 12 displayCtrl 51] call ACE_maptools_fnc_openMapGpsUpdate; * * Public: No */ -if ((!("ItemGPS" in assigneditems ACE_player)) || {isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull])}) exitWith { - ("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; // Close GPS RSC - [(_this select 1)] call CBA_fnc_removePerFrameHandler; // Remove frameHandler -}; -disableSerialization; +params ["_mapCtrl"]; +private _mapDisplay = ctrlParent _mapCtrl; -private _mapGpsDisplay = uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull]; -private _ctrl = _mapGpsDisplay displayCtrl 913590; +if ((!GVAR(mapGpsShow)) || {!(call FUNC(canUseMapGPS))}) exitWith { + (_mapDisplay displayCtrl 913589) ctrlShow false; +}; +(_mapDisplay displayCtrl 913589) ctrlShow true; + +if (CBA_missionTime < GVAR(mapGpsNextUpdate)) exitWith {}; +GVAR(mapGpsNextUpdate) = CBA_missionTime + 0.5; + +private _ctrl = _mapDisplay displayCtrl 913590; _ctrl ctrlSetText str (round (getDir ACE_player)); // Set Heading -_ctrl = _mapGpsDisplay displayCtrl 913591; +_ctrl = _mapDisplay displayCtrl 913591; _ctrl ctrlSetText str (round ((getPosASL ACE_player) select 2) + EGVAR(common,mapAltitude)); // Set Altitude -_ctrl = _mapGpsDisplay displayCtrl 913592; +_ctrl = _mapDisplay displayCtrl 913592; _ctrl ctrlSetText mapGridPosition ACE_player; // Set grid cords