diff --git a/addons/maptools/CfgVehicles.hpp b/addons/maptools/CfgVehicles.hpp index 5c3266d2d6..063f88f38b 100644 --- a/addons/maptools/CfgVehicles.hpp +++ b/addons/maptools/CfgVehicles.hpp @@ -14,7 +14,7 @@ class CfgVehicles { class ACE_MapToolsHide { displayName = CSTRING(MapToolsHide); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0})); - statement = QUOTE(GVAR(mapTool_Shown) = 0; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_Shown) = 0;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 5; @@ -22,7 +22,7 @@ class CfgVehicles { class ACE_MapToolsShowNormal { displayName = CSTRING(MapToolsShowNormal); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 1})); - statement = QUOTE(GVAR(mapTool_Shown) = 1; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_Shown) = 1;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 4; @@ -30,7 +30,7 @@ class CfgVehicles { class ACE_MapToolsShowSmall { displayName = CSTRING(MapToolsShowSmall); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 2})); - statement = QUOTE(GVAR(mapTool_Shown) = 2; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_Shown) = 2;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 3; @@ -38,7 +38,7 @@ class CfgVehicles { class ACE_MapToolsAlignNorth { displayName = CSTRING(MapToolsAlignNorth); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0})); - statement = QUOTE(GVAR(mapTool_angle) = 0; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_angle) = 0;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 2; @@ -46,7 +46,7 @@ class CfgVehicles { class ACE_MapToolsAlignCompass { displayName = CSTRING(MapToolsAlignCompass); condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0} && {('ItemCompass' in assigneditems ACE_player) || {'ItemCompass' in assigneditems ACE_player}})); - statement = QUOTE(GVAR(mapTool_angle) = getDir ACE_player; [] call FUNC(updateMapToolMarkers)); + statement = QUOTE(GVAR(mapTool_angle) = getDir ACE_player;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 1; diff --git a/addons/maptools/XEH_postInitClient.sqf b/addons/maptools/XEH_postInitClient.sqf index 34c0a9e750..1e428f71b7 100644 --- a/addons/maptools/XEH_postInitClient.sqf +++ b/addons/maptools/XEH_postInitClient.sqf @@ -64,9 +64,6 @@ GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737]; // Install event handlers on the map control and display (control = 51) GVAR(drawing_syncMarkers) = false; 12 call _fnc_installMapEvents; - - // Update the size and rotation of map tools - [] call FUNC(updateMapToolMarkers); }; ["mapOpened", { diff --git a/addons/maptools/functions/fnc_handleKeyDown.sqf b/addons/maptools/functions/fnc_handleKeyDown.sqf index 297c87e789..a83522ac91 100644 --- a/addons/maptools/functions/fnc_handleKeyDown.sqf +++ b/addons/maptools/functions/fnc_handleKeyDown.sqf @@ -16,10 +16,11 @@ #include "script_component.hpp" params ["", "_code"]; +TRACE_1("params",_code); private ["_handled", "_relPos", "_diffVector", "_magDiffVector", "_lambdaLong", "_lambdaTrasAbs"]; -_handled = false; +_handled = false; #define DIK_ESCAPE 0x01 #define DIK_DELETE 0xD3 diff --git a/addons/maptools/functions/fnc_handleMouseButton.sqf b/addons/maptools/functions/fnc_handleMouseButton.sqf index ec0d1264fc..442ec4d50e 100644 --- a/addons/maptools/functions/fnc_handleMouseButton.sqf +++ b/addons/maptools/functions/fnc_handleMouseButton.sqf @@ -14,6 +14,7 @@ params ["_dir", "_params"]; _params params ["_control", "_button", "_screenPosX", "_screenPosY", "_shiftKey", "_ctrlKey", "_altKey"]; +TRACE_2("params",_dir,_params); private["_gui", "_handled", "_marker", "_pos"]; @@ -23,16 +24,14 @@ _handled = false; if (_button != 0) exitWith {_handled}; // If releasing -if ((_dir != 1) && {(GVAR(mapTool_isDragging) || GVAR(mapTool_isRotating))}) exitWith { - GVAR(mapTool_isDragging) = false; - GVAR(mapTool_isRotating) = false; - _handled = true; - _handled -}; - -// If clicking -if (_dir == 1) exitWith { - +if (_dir != 1) then { + if (GVAR(mapTool_isDragging) || GVAR(mapTool_isRotating)) then { + GVAR(mapTool_isDragging) = false; + GVAR(mapTool_isRotating) = false; + _handled = true; + }; +} else { + // If clicking if !(call FUNC(canDraw)) exitWith {_handled = false;}; // Transform mouse screen position to coordinates @@ -43,7 +42,6 @@ if (_dir == 1) exitWith { // Already drawing -> Add tempLineMarker to permanent list if (GVAR(drawing_syncMarkers)) then { deleteMarkerLocal (GVAR(drawing_tempLineMarker) select 0); - // [GVAR(drawing_tempLineMarker), "FUNC(addLineMarker)", 2] call EFUNC(common,execRemoteFnc); ["drawing_addLineMarker", GVAR(drawing_tempLineMarker)] call EFUNC(common,globalEvent); // Log who drew on the briefing screen (text format ["[ACE] Server: Player %1 drew on the briefing screen", profileName]) call EFUNC(common,serverLog); @@ -90,8 +88,9 @@ if (_dir == 1) exitWith { }; _handled = true; }; - _handled }; +diag_log text format ["HJa %1", _handled]; + _handled diff --git a/addons/maptools/functions/fnc_handleMouseMove.sqf b/addons/maptools/functions/fnc_handleMouseMove.sqf index 7e2883382b..b27087290b 100644 --- a/addons/maptools/functions/fnc_handleMouseMove.sqf +++ b/addons/maptools/functions/fnc_handleMouseMove.sqf @@ -13,6 +13,7 @@ #include "script_component.hpp" params ["_control", "_mousePosX", "_mousePosY"]; +TRACE_3("params",_control,_mousePosX,_mousePosY); private ["_control", "_pos"]; @@ -31,6 +32,7 @@ if !(call FUNC(canDraw)) exitWith { // Handle drawing if (GVAR(drawing_isDrawing)) exitWith { GVAR(drawing_tempLineMarker) set [2, GVAR(mousePosition)]; + TRACE_1("updating line pos",GVAR(mousePosition)); GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker); false }; @@ -43,8 +45,6 @@ if (GVAR(mapTool_isDragging)) exitWith { GVAR(mapTool_pos) set [0, (GVAR(mapTool_startPos) select 0) + (GVAR(mousePosition) select 0) - (GVAR(mapTool_startDragPos) select 0)]; GVAR(mapTool_pos) set [1, (GVAR(mapTool_startPos) select 1) + (GVAR(mousePosition) select 1) - (GVAR(mapTool_startDragPos) select 1)]; - // Update the size and rotation of the maptool - [] call FUNC(updateMapToolMarkers); true }; @@ -55,8 +55,6 @@ if (GVAR(mapTool_isRotating)) exitWith { _angle = (180 + ((GVAR(mousePosition) select 0) - (GVAR(mapTool_startPos) select 0)) atan2 ((GVAR(mousePosition) select 1) - (GVAR(mapTool_startPos) select 1)) mod 360); GVAR(mapTool_angle) = GVAR(mapTool_startAngle) + _angle - GVAR(mapTool_startDragAngle); - // Update the size and rotation of the maptool - [] call FUNC(updateMapToolMarkers); true }; diff --git a/addons/maptools/functions/fnc_updateLineMarker.sqf b/addons/maptools/functions/fnc_updateLineMarker.sqf index 6400d02461..12aee5b1df 100644 --- a/addons/maptools/functions/fnc_updateLineMarker.sqf +++ b/addons/maptools/functions/fnc_updateLineMarker.sqf @@ -14,6 +14,7 @@ #include "script_component.hpp" params ["_name", "_startPos", "_endPos", "_color"]; +TRACE_4("params",_name,_startPos,_endPos,_color); private ["_difPos", "_mag"]; diff --git a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf index c4f2f6f1dc..5c88d907b8 100644 --- a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf +++ b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf @@ -21,7 +21,7 @@ params ["_theMap"]; private ["_rotatingTexture", "_textureWidth", "_scale", "_xPos", "_yPos"]; // Show/Hide draw buttons -if ("ACE_MapTools" in items ACE_player) then { +if ([] call FUNC(canDraw)) then { { ((findDisplay 12) displayCtrl _x) ctrlShow true; } forEach GVAR(drawing_controls); } else { { ((findDisplay 12) displayCtrl _x) ctrlShow false; } forEach GVAR(drawing_controls);