2020-06-19 15:35:57 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
|
|
|
* Author: Dslyecxi, MikeMatrix, joko // Jonas
|
|
|
|
* Bind all required EventHandlers to Player map.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* _mapCtrl call ace_map_gestures_fnc_initDisplayDiary
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
params ["_mapCtrl"];
|
|
|
|
TRACE_1("initDisplayDiary",_mapCtrl);
|
|
|
|
|
2020-08-18 17:44:16 +00:00
|
|
|
_mapCtrl ctrlAddEventHandler ["Draw", {
|
|
|
|
if (!GVAR(enabled)) exitWith {};
|
|
|
|
if (getClientStateNumber < 10) then {
|
|
|
|
[_this select 0, GVAR(briefingMode)] call FUNC(drawMapGestures);
|
|
|
|
} else {
|
|
|
|
[_this select 0, [[ACE_player, GVAR(maxRange)]]] call FUNC(drawMapGestures);
|
|
|
|
};
|
|
|
|
}];
|
2020-06-19 15:35:57 +00:00
|
|
|
|
|
|
|
// MouseMoving EH.
|
|
|
|
_mapCtrl ctrlAddEventHandler ["MouseMoving", {
|
|
|
|
if (!GVAR(enabled)) exitWith {};
|
|
|
|
params ["_control", "_posX", "_posY"];
|
2020-08-18 17:44:16 +00:00
|
|
|
GVAR(cursorPosition) = _control ctrlMapScreenToWorld [_posX, _posY];
|
|
|
|
|
2020-06-19 15:35:57 +00:00
|
|
|
// Don't transmit any data if we're using the map tools
|
|
|
|
if (!GVAR(EnableTransmit) || {(["ace_maptools"] call EFUNC(common,isModLoaded)) && {EGVAR(maptools,mapTool_isDragging) || EGVAR(maptools,mapTool_isRotating)}}) exitWith {};
|
2020-08-18 17:44:16 +00:00
|
|
|
if (GVAR(cursorPosition) distance2D (ACE_player getVariable [QGVAR(pointPosition), [0, 0, 0]]) >= 1) then {
|
|
|
|
[ACE_player, QGVAR(pointPosition), GVAR(cursorPosition), GVAR(interval)] call EFUNC(common,setVariablePublic);
|
2020-06-19 15:35:57 +00:00
|
|
|
};
|
|
|
|
}];
|
|
|
|
|
|
|
|
// MouseDown EH
|
|
|
|
_mapCtrl ctrlAddEventHandler ["MouseButtonDown", {
|
|
|
|
if (!GVAR(enabled)) exitWith {};
|
|
|
|
params ["", "_button", "_x", "_y", "_shift", "_ctrl", "_alt"];
|
|
|
|
if (_button == 0 && {[_shift, _ctrl, _alt] isEqualTo [false, false, false]}) then {
|
|
|
|
GVAR(EnableTransmit) = true;
|
2020-08-18 17:44:16 +00:00
|
|
|
[ACE_player, QGVAR(pointPosition), GVAR(cursorPosition), GVAR(interval)] call EFUNC(common,setVariablePublic);
|
2020-06-19 15:35:57 +00:00
|
|
|
};
|
|
|
|
}];
|
|
|
|
|
|
|
|
// MouseUp EH
|
|
|
|
_mapCtrl ctrlAddEventHandler ["MouseButtonUp", {
|
|
|
|
if (!GVAR(enabled)) exitWith {};
|
|
|
|
params ["", "_button"];
|
|
|
|
if (_button == 0) then {
|
|
|
|
GVAR(EnableTransmit) = false;
|
|
|
|
ACE_player setVariable [QGVAR(pointPosition), nil, true]; // Instantly transmit nil to stop drawing icon
|
|
|
|
};
|
|
|
|
}];
|