2015-03-24 04:18:00 +00:00
|
|
|
// by esteldunedain
|
2015-03-14 19:58:05 +00:00
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
if (!hasInterface) exitWith {};
|
|
|
|
|
|
|
|
// Init variables
|
|
|
|
GVAR(mapVisableLastFrame) = false;
|
|
|
|
GVAR(mapGpsShow) = true;
|
|
|
|
|
|
|
|
GVAR(mapTool_Shown) = 0;
|
|
|
|
GVAR(mapTool_pos) = [0,0];
|
|
|
|
GVAR(mapTool_angle) = 0;
|
|
|
|
GVAR(mapTool_isDragging) = false;
|
|
|
|
GVAR(mapTool_isRotating) = false;
|
|
|
|
|
|
|
|
GVAR(drawing_isDrawing) = false;
|
|
|
|
GVAR(drawing_tempLineMarker) = [];
|
|
|
|
GVAR(drawing_lineMarkers) = [];
|
|
|
|
GVAR(drawing_drawColor) = "ColorBlack";
|
|
|
|
GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737];
|
|
|
|
|
2015-03-14 20:15:28 +00:00
|
|
|
// This spawn is probably worth keeping, as pfh don't work natively on the briefing screen and IDK how reliable the hack we implemented for them is.
|
|
|
|
// The thread dies as soon as the mission start, so it's not really compiting for scheduler space.
|
2015-03-14 19:58:05 +00:00
|
|
|
[] spawn {
|
2015-03-14 20:15:28 +00:00
|
|
|
_fnc_installMapEvents = {
|
2015-04-17 23:13:09 +00:00
|
|
|
private "_d";
|
2015-03-14 20:15:28 +00:00
|
|
|
_d = _this;
|
2015-08-18 02:51:40 +00:00
|
|
|
((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}];
|
|
|
|
((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}];
|
|
|
|
((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}];
|
|
|
|
((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}];
|
|
|
|
(findDisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}];
|
2015-03-14 20:15:28 +00:00
|
|
|
};
|
2015-03-14 19:58:05 +00:00
|
|
|
|
2015-03-14 20:15:28 +00:00
|
|
|
// Wait until the briefing map is detected
|
|
|
|
// display = 37 for SP
|
|
|
|
// display = 52 for host server on MP;
|
|
|
|
// display = 53 for MP clients)
|
|
|
|
waitUntil {(!isNull findDisplay 37) || (!isNull findDisplay 52) || (!isNull findDisplay 53) || (!isNull findDisplay 12)};
|
2015-03-14 19:58:05 +00:00
|
|
|
|
2015-03-14 20:15:28 +00:00
|
|
|
if (isNull findDisplay 12) then {
|
|
|
|
// Install event handlers on the map control of the briefing screen (control = 51)
|
|
|
|
GVAR(drawing_syncMarkers) = true;
|
|
|
|
if (!isNull findDisplay 52) then {
|
|
|
|
52 call _fnc_installMapEvents;
|
|
|
|
} else {
|
|
|
|
if (!isNull findDisplay 53) then {
|
|
|
|
53 call _fnc_installMapEvents;
|
|
|
|
} else {
|
|
|
|
37 call _fnc_installMapEvents;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
// Briefing screen was skipped; the player is JIP, create the markers defined during the briefing
|
|
|
|
GVAR(drawing_syncMarkers) = false;
|
|
|
|
{
|
|
|
|
_x call FUNC(addLineMarker);
|
|
|
|
} forEach GVAR(drawing_serverLineMarkers);
|
|
|
|
};
|
2015-03-14 19:58:05 +00:00
|
|
|
|
2015-03-14 20:15:28 +00:00
|
|
|
// Wait until the main map display is detected (display = 12)
|
|
|
|
waitUntil { !isNull findDisplay 12 };
|
|
|
|
// Install event handlers on the map control and display (control = 51)
|
|
|
|
GVAR(drawing_syncMarkers) = false;
|
|
|
|
12 call _fnc_installMapEvents;
|
2015-03-14 19:58:05 +00:00
|
|
|
};
|
2015-06-28 18:08:47 +00:00
|
|
|
|
2015-08-30 20:26:43 +00:00
|
|
|
["visibleMapChanged", {
|
|
|
|
params ["", "_mapOn"];
|
|
|
|
if (_mapOn) then {
|
|
|
|
// Show GPS if required
|
|
|
|
[GVAR(mapGpsShow)] call FUNC(openMapGps);
|
|
|
|
} else {
|
|
|
|
// Hide GPS
|
|
|
|
[false] call FUNC(openMapGps);
|
|
|
|
// Cancel drawing
|
|
|
|
call FUNC(cancelDrawing);
|
|
|
|
};
|
2015-06-28 18:08:47 +00:00
|
|
|
}] call EFUNC(common,addEventHandler);
|