mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Maptools - Make GPS display a real 3d object (#7086)
* Maptools - Make GPS display a real 3d object * Fix header * Apply suggestions from code review Co-Authored-By: commy2 <commy-2@gmx.de>
This commit is contained in:
parent
edd5c44853
commit
daa4581fe9
@ -5,14 +5,14 @@ class CfgVehicles {
|
|||||||
class ACE_MapGpsShow {
|
class ACE_MapGpsShow {
|
||||||
displayName = CSTRING(MapGpsShow);
|
displayName = CSTRING(MapGpsShow);
|
||||||
condition = QUOTE((!GVAR(mapGpsShow)) && {call FUNC(canUseMapGPS)});
|
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"};
|
exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"};
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
};
|
};
|
||||||
class ACE_MapGpsHide {
|
class ACE_MapGpsHide {
|
||||||
displayName = CSTRING(MapGpsHide);
|
displayName = CSTRING(MapGpsHide);
|
||||||
condition = QUOTE((GVAR(mapGpsShow)) && {call FUNC(canUseMapGPS)});
|
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"};
|
exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"};
|
||||||
showDisabled = 0;
|
showDisabled = 0;
|
||||||
};
|
};
|
||||||
|
@ -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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
89
addons/maptools/RscDisplayMainMap.hpp
Normal file
89
addons/maptools/RscDisplayMainMap.hpp
Normal file
@ -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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
BIN
addons/maptools/UI/MapGpsDisplay_background_ca.paa
Normal file
BIN
addons/maptools/UI/MapGpsDisplay_background_ca.paa
Normal file
Binary file not shown.
Binary file not shown.
@ -5,6 +5,5 @@ PREP(drawLinesOnRoamer);
|
|||||||
PREP(handleMouseButton);
|
PREP(handleMouseButton);
|
||||||
PREP(handleMouseMove);
|
PREP(handleMouseMove);
|
||||||
PREP(isInsideMapTool);
|
PREP(isInsideMapTool);
|
||||||
PREP(openMapGps);
|
|
||||||
PREP(openMapGpsUpdate);
|
PREP(openMapGpsUpdate);
|
||||||
PREP(updateMapToolMarkers);
|
PREP(updateMapToolMarkers);
|
||||||
|
@ -6,6 +6,7 @@ if (!hasInterface) exitWith {};
|
|||||||
|
|
||||||
// Init variables
|
// Init variables
|
||||||
GVAR(mapGpsShow) = true;
|
GVAR(mapGpsShow) = true;
|
||||||
|
GVAR(mapGpsNextUpdate) = -1;
|
||||||
|
|
||||||
GVAR(mapTool_Shown) = 0;
|
GVAR(mapTool_Shown) = 0;
|
||||||
GVAR(mapTool_pos) = [0,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 ["MouseMoving", {_this call FUNC(handleMouseMove);}];
|
||||||
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}];
|
((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 ["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;
|
}, []] call CBA_fnc_waitUntilAndExecute;
|
||||||
|
|
||||||
["visibleMap", {
|
["visibleMap", {
|
||||||
params ["", "_mapOn"];
|
params ["", "_mapOn"];
|
||||||
if (_mapOn) then {
|
if (!_mapOn) then {
|
||||||
// Show GPS if required
|
|
||||||
[GVAR(mapGpsShow)] call FUNC(openMapGps);
|
|
||||||
} else {
|
|
||||||
// Hide GPS
|
|
||||||
[false] call FUNC(openMapGps);
|
|
||||||
|
|
||||||
// Handle closing map in middle of line drawing (it's never created)
|
// Handle closing map in middle of line drawing (it's never created)
|
||||||
GVAR(freedrawing) = false;
|
GVAR(freedrawing) = false;
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ class RscButtonMenu;
|
|||||||
class RscEdit;
|
class RscEdit;
|
||||||
|
|
||||||
#include "ACE_Settings.hpp"
|
#include "ACE_Settings.hpp"
|
||||||
#include "MapGpsUI.hpp"
|
|
||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
#include "CfgVehicles.hpp"
|
#include "CfgVehicles.hpp"
|
||||||
#include "CfgWeapons.hpp"
|
#include "CfgWeapons.hpp"
|
||||||
|
#include "RscDisplayMainMap.hpp"
|
||||||
|
BIN
addons/maptools/data/MapGpsDisplay.p3d
Normal file
BIN
addons/maptools/data/MapGpsDisplay.p3d
Normal file
Binary file not shown.
@ -10,7 +10,7 @@
|
|||||||
* Boolean <BOOL>
|
* Boolean <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ACE_map_fnc_canUseMapGPS
|
* call ACE_maptools_fnc_canUseMapGPS
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
@ -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? <BOOL>
|
|
||||||
*
|
|
||||||
* 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"];
|
|
||||||
};
|
|
@ -1,30 +1,34 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: esteldunedain
|
* Author: esteldunedain, PabstMirror
|
||||||
* update gps display
|
* update gps display, called from main map's draw
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* Something
|
* 0: Map ctrl <CONTROL>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* call ACE_maptools_fnc_openMapGpsUpdate
|
* [findDisplay 12 displayCtrl 51] call ACE_maptools_fnc_openMapGpsUpdate;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((!("ItemGPS" in assigneditems ACE_player)) || {isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull])}) exitWith {
|
params ["_mapCtrl"];
|
||||||
("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; // Close GPS RSC
|
private _mapDisplay = ctrlParent _mapCtrl;
|
||||||
[(_this select 1)] call CBA_fnc_removePerFrameHandler; // Remove frameHandler
|
|
||||||
};
|
|
||||||
disableSerialization;
|
|
||||||
|
|
||||||
private _mapGpsDisplay = uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull];
|
if ((!GVAR(mapGpsShow)) || {!(call FUNC(canUseMapGPS))}) exitWith {
|
||||||
private _ctrl = _mapGpsDisplay displayCtrl 913590;
|
(_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 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 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
|
_ctrl ctrlSetText mapGridPosition ACE_player; // Set grid cords
|
||||||
|
Loading…
Reference in New Issue
Block a user