mirror of
https://github.com/acemod/ACE3.git
synced 2025-07-25 12:52:41 +00:00
addMapEventHandler helper
This commit is contained in:
@ -26,6 +26,12 @@ class Extended_DisplayLoad_EventHandlers {
|
||||
class RscUnitInfo {
|
||||
ADDON = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;);
|
||||
};
|
||||
class RscDiary {
|
||||
ADDON = QUOTE([ARR_2('RscDiary', _this # 0)] call (uiNamespace getVariable 'FUNC(addMapEventHandler_init)'));
|
||||
};
|
||||
class RscCustomInfoMiniMap {
|
||||
ADDON = QUOTE([ARR_2('RscCustomInfoMiniMap', _this # 0)] call (uiNamespace getVariable 'FUNC(addMapEventHandler_init)'));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_InitPost_EventHandlers {
|
||||
|
@ -10,6 +10,8 @@ PREP(readSettingsFromParamsArray);
|
||||
PREP(actionKeysNamesConverted);
|
||||
PREP(addCanInteractWithCondition);
|
||||
PREP(addLineToDebugDraw);
|
||||
PREP(addMapEventHandler);
|
||||
PREP(addMapEventHandler_init);
|
||||
PREP(addToInventory);
|
||||
PREP(assignedItemFix);
|
||||
PREP(assignObjectsInList);
|
||||
|
@ -73,3 +73,15 @@ class ACE_Tests {
|
||||
vehicleTransportInventory = QPATHTOF(dev\test_vehicleInventory.sqf);
|
||||
mapConfigs = QPATHTOF(dev\test_mapConfigs.sqf);
|
||||
};
|
||||
|
||||
class RscDisplayMainMap {
|
||||
EGVAR(mapEventHandlers,IDCs)[] = {51};
|
||||
EGVAR(mapEventHandlers,type) = QEGVAR(mapEventHandlers,main);
|
||||
};
|
||||
class RscDisplayGetReady: RscDisplayMainMap {
|
||||
EGVAR(mapEventHandlers,type) = QEGVAR(mapEventHandlers,briefing);
|
||||
};
|
||||
class RscCustomInfoMiniMap {
|
||||
EGVAR(mapEventHandlers,IDCs)[] = {101};
|
||||
EGVAR(mapEventHandlers,type) = QEGVAR(mapEventHandlers,gps);
|
||||
};
|
||||
|
41
addons/common/functions/fnc_addMapEventHandler.sqf
Normal file
41
addons/common/functions/fnc_addMapEventHandler.sqf
Normal file
@ -0,0 +1,41 @@
|
||||
#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Helper for adding event handlers code to maps. Save/Load compatible.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Event Type <STRING>
|
||||
* 1: Code for a draw EH (map ctrl will be arg 0) <CODE>
|
||||
* 2: Draw on Main Map <BOOL><OPTIONAL>
|
||||
* 3: Draw on Briefing Map <BOOL><OPTIONAL>
|
||||
* 4: Draw on GPS Maps (ItemGPS and MicroDagr) <BOOL><OPTIONAL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["Draw", {}, true] call ace_common_fnc_addMapEventHandler
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
params [["_type", "", [""]], ["_func", {}, [{}]], ["_drawOnMainMap", false, [false]], ["_drawOnBriefingMap", false, [false]],["_drawOnGPS", false, [false]]];
|
||||
TRACE_5("addMapEventHandler",_type,_func isEqualTo {},_drawOnMainMap,_drawOnBriefingMap,_drawOnGPS);
|
||||
|
||||
if ((ADDMAPEVENTHANDLER_EVENTS findIf {_x == _type}) == -1) exitWith { ERROR_1("amEH enum - %1",_this); };
|
||||
|
||||
private _mapVarNames = [];
|
||||
|
||||
if (_drawOnMainMap) then { _mapVarNames pushBack QEGVAR(mapEventHandlers,main); };
|
||||
if (_drawOnBriefingMap) then { _mapVarNames pushBack QEGVAR(mapEventHandlers,briefing); };
|
||||
if (_drawOnGPS) then { _mapVarNames pushBack QEGVAR(mapEventHandlers,gps); };
|
||||
|
||||
{
|
||||
private _varName = format ["%1%2", _x, _type];
|
||||
private _array = missionNamespace getVariable [_varName, []];
|
||||
_array pushBack _func;
|
||||
missionNamespace setVariable [_varName, _array];
|
||||
} forEach _mapVarNames;
|
52
addons/common/functions/fnc_addMapEventHandler_init.sqf
Normal file
52
addons/common/functions/fnc_addMapEventHandler_init.sqf
Normal file
@ -0,0 +1,52 @@
|
||||
#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Handles DisplayLoaded event for various map displays. Save/Load compatible.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: DisplayType <STRING>
|
||||
* 1: Display <DISPLAY>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* ["RscDisplayMainMap", findDisplay 12] call ace_common_fnc_addMapEventHandler_init
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_className", "_display"];
|
||||
TRACE_2("addMapEventHandler_init",_className,_display);
|
||||
|
||||
if (_display getVariable [QGVAR(mapEventHandlers_init), false]) exitWith { WARNING("map already init"); };
|
||||
|
||||
if (_className == "RscDiary") then {
|
||||
_className = switch (ctrlIDD _display) do {
|
||||
case 12: { "RscDisplayMainMap" };
|
||||
case 37: { "RscDisplayGetReady" };
|
||||
case 52: { "RscDisplayServerGetReady" };
|
||||
case 53: { "RscDisplayClientGetReady" };
|
||||
default { "" };
|
||||
};
|
||||
};
|
||||
|
||||
private _eventVar = getText (configFile >> _className >> QEGVAR(mapEventHandlers,type));
|
||||
private _mapIDCS = getArray (configFile >> _className >> QEGVAR(mapEventHandlers,IDCs));
|
||||
if ((_eventVar == "") || {_mapIDCS isEqualTo []}) exitWith {
|
||||
ERROR_2("addMapEventHandler_init - unknown display %1-%2",_this,_className);
|
||||
};
|
||||
|
||||
TRACE_3("adding EHs",_className,_eventVar,_mapIDCS);
|
||||
{
|
||||
private _mapCtrl = _display displayCtrl _x;
|
||||
if (isNull _mapCtrl) exitWith {ERROR_2("map is null %1-%2",_className,_x);};
|
||||
{
|
||||
private _code = format ['if ((_this#0) getVariable ["ace_mapEventHandlers_active", true]) then { {call _x} forEach (missionNamespace getVariable ["%1%2", []]) }', _eventVar, _x];
|
||||
private _ret = _mapCtrl ctrlAddEventHandler [_x, _code];
|
||||
TRACE_3("x",_x,_code,_ret);
|
||||
} forEach ADDMAPEVENTHANDLER_EVENTS;
|
||||
} forEach _mapIDCS;
|
||||
|
||||
_display setVariable [QGVAR(mapEventHandlers_init), true];
|
@ -30,3 +30,5 @@
|
||||
]
|
||||
|
||||
#define DIG_SURFACE_WHITELIST ["grass", "grasstall_exp", "forest_exp"]
|
||||
|
||||
#define ADDMAPEVENTHANDLER_EVENTS ["Draw", "MouseMoving", "MouseButtonDown", "MouseButtonUp", "MouseMoving", "MouseHolding"]
|
||||
|
@ -18,9 +18,6 @@ class Extended_PostInit_EventHandlers {
|
||||
};
|
||||
|
||||
class Extended_DisplayLoad_EventHandlers {
|
||||
class RscDiary {
|
||||
ADDON = QUOTE(call COMPILE_FILE(XEH_displayLoad));
|
||||
};
|
||||
class RscDisplayInterrupt {
|
||||
ADDON = QUOTE(_this call FUNC(handleEscapeMenu));
|
||||
};
|
||||
|
@ -112,3 +112,5 @@ format ["%1 (%2)", (localize LSTRING(SelfInteractKey)), localize ELSTRING(common
|
||||
if (_menuBackgroundSetting == 1) exitWith {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
|
||||
if (_menuBackgroundSetting == 2) exitWith {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
["Draw", {call FUNC(render)}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
@ -1,9 +0,0 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
disableSerialization;
|
||||
|
||||
params ["_display"];
|
||||
|
||||
if (ctrlIDD _display == 12) then { // RscDisplayMainMap
|
||||
(_display displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(render)}];
|
||||
};
|
@ -25,6 +25,7 @@ class CfgWeapons {
|
||||
};
|
||||
class ItemMap;
|
||||
class ace_TopographicMap: ItemMap {
|
||||
GVAR(MapTypeIDC) = IDC_MAP_TOPO;
|
||||
displayName = "Topo test";
|
||||
};
|
||||
};
|
||||
|
@ -60,21 +60,23 @@ call FUNC(determineZoom);
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
||||
// hide clock on map if player has no watch
|
||||
GVAR(hasWatch) = true;
|
||||
|
||||
GVAR(updateActiveMap) = true;
|
||||
GVAR(activeMapTypeIDC) = 51;
|
||||
["loadout", {
|
||||
params ["_unit"];
|
||||
if (isNull _unit) exitWith {
|
||||
GVAR(hasWatch) = true;
|
||||
GVAR(activeMapTypeIDC) = 51;
|
||||
};
|
||||
GVAR(hasWatch) = false;
|
||||
{
|
||||
if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;};
|
||||
false
|
||||
} count (assignedItems _unit);
|
||||
GVAR(hasWatch) = ((assignedItems _unit) findIf {_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]}) != -1;
|
||||
GVAR(activeMapTypeIDC) = 51 max getNumber (configFile >> "CfgWeapons" >> ((assignedItems _unit) param [0, ""]) >> QGVAR(MapTypeIDC));
|
||||
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
["visibleMap", { GVAR(updateActiveMap) = true; }] call CBA_fnc_addPlayerEventHandler;
|
||||
addMissionEventHandler ["Loaded", { GVAR(updateActiveMap) = true; }];
|
||||
|
||||
// Vehicle map lighting:
|
||||
GVAR(vehicleLightCondition) = {true};
|
||||
@ -115,3 +117,44 @@ GVAR(vehicleLightColor) = [1,1,1,0];
|
||||
};
|
||||
};
|
||||
}, true] call CBA_fnc_addPlayerEventHandler;
|
||||
|
||||
// Draw map effects
|
||||
["Draw", {call FUNC(onDrawMap)}, true] call EFUNC(common,addMapEventHandler);
|
||||
["Draw", {call FUNC(updateMapEffects)}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
["MouseMoving", {
|
||||
params ["_control", "_x", "_y"];
|
||||
if (GVAR(isShaking) && {count GVAR(rightMouseButtonLastPos) == 2}) then {
|
||||
private _lastPos = _control ctrlMapScreenToWorld GVAR(rightMouseButtonLastPos);
|
||||
private _newPos = _control ctrlMapScreenToWorld [_x, _y];
|
||||
GVAR(lastStillPosition) set [0, (GVAR(lastStillPosition) select 0) + (_lastPos select 0) - (_newPos select 0)];
|
||||
GVAR(lastStillPosition) set [1, (GVAR(lastStillPosition) select 1) + (_lastPos select 1) - (_newPos select 1)];
|
||||
GVAR(rightMouseButtonLastPos) = [_x, _y];
|
||||
TRACE_3("Mouse Move",_lastPos,_newPos,GVAR(rightMouseButtonLastPos));
|
||||
};
|
||||
}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
["MouseButtonDown", {
|
||||
params ["", "_button", "_x", "_y"];
|
||||
if (_button == 1) then {
|
||||
GVAR(rightMouseButtonLastPos) = [_x, _y];
|
||||
};
|
||||
}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
["MouseButtonUp", {
|
||||
params ["", "_button"];
|
||||
if (_button == 1) then {
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
};
|
||||
}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
//get mouse position on map
|
||||
["MouseMoving", {
|
||||
params ["_control", "_x", "_y"];
|
||||
GVAR(mousePos) = _control ctrlMapScreenToWorld [_x, _y];
|
||||
}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
["MouseHolding", {
|
||||
params ["_control", "_x", "_y"];
|
||||
GVAR(mousePos) = _control ctrlMapScreenToWorld [_x, _y];
|
||||
}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
@ -69,7 +69,7 @@ class RscMapControl {
|
||||
// Topographic Map:
|
||||
class ctrlMap;
|
||||
class GVAR(topographicCtrl): ctrlMap {
|
||||
idc = 9051;
|
||||
idc = IDC_MAP_TOPO;
|
||||
|
||||
// scaleMin = 0.005;
|
||||
// scaleMax = 10; //Lets the mini display zoom out far enough
|
||||
@ -126,6 +126,13 @@ class GVAR(topographicCtrl): ctrlMap {
|
||||
colorBackground[] = {0.906000, 0.901000, 0.880000, 0.5};
|
||||
color[] = {0, 0, 0, 0.75};
|
||||
};
|
||||
class LineMarker { // make line-drawings visable (but still can't draw our own?)
|
||||
textureComboBoxColor = "#(argb,8,8,3)color(1,1,1,1)";
|
||||
lineWidthThin = 0.008;
|
||||
lineWidthThick = 0.014;
|
||||
lineDistanceMin = 3e-005;
|
||||
lineLengthMin = 5;
|
||||
};
|
||||
};
|
||||
|
||||
class RscMap;
|
||||
@ -146,10 +153,10 @@ class RscDisplayArcadeMap_Layout_6: RscMap { //"Streamlined" Editor:
|
||||
|
||||
// REGULAR MAP
|
||||
class RscDisplayMainMap {
|
||||
EGVAR(mapEventHandlers,IDCs)[] = {IDC_MAP_MAIN, IDC_MAP_TOPO};
|
||||
// Tweak map styling
|
||||
class controlsBackground {
|
||||
class CA_Map: RscMapControl {
|
||||
onDraw = QUOTE([ctrlParent (_this select 0)] call DFUNC(onDrawMap));
|
||||
#include "MapTweaks.hpp"
|
||||
};
|
||||
class ACE_topoMap: GVAR(topographicCtrl) {};
|
||||
@ -204,9 +211,9 @@ class RscDisplayGetReady: RscDisplayMainMap {
|
||||
// Tweak map styling
|
||||
class controlsBackground {
|
||||
class CA_Map: RscMapControl {
|
||||
onDraw = QUOTE([ctrlParent (_this select 0)] call DFUNC(onDrawMap));
|
||||
#include "MapTweaks.hpp"
|
||||
};
|
||||
class ACE_topoMap: GVAR(topographicCtrl) {};
|
||||
};
|
||||
// get rid of the "center to player position" - button (as it works even on elite)
|
||||
class controls {
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "\a3\ui_f\hpp\defineResincl.inc"
|
||||
|
||||
params ["_display"];
|
||||
TRACE_1("initMainMap",_display);
|
||||
if (ctrlIDD _display != IDD_MAIN_MAP) exitWith {};
|
||||
|
||||
private _control = _display displayCtrl IDC_MAP;
|
||||
@ -22,41 +23,3 @@ GVAR(mousePos) = [0.5, 0.5];
|
||||
|
||||
//Allow panning the lastStillPosition while mapShake is active
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
|
||||
_control ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapEffects)}];
|
||||
_control ctrlAddEventHandler ["MouseMoving", {
|
||||
params ["_control", "_x", "_y"];
|
||||
if (GVAR(isShaking) && {count GVAR(rightMouseButtonLastPos) == 2}) then {
|
||||
private _lastPos = _control ctrlMapScreenToWorld GVAR(rightMouseButtonLastPos);
|
||||
private _newPos = _control ctrlMapScreenToWorld [_x, _y];
|
||||
GVAR(lastStillPosition) set [0, (GVAR(lastStillPosition) select 0) + (_lastPos select 0) - (_newPos select 0)];
|
||||
GVAR(lastStillPosition) set [1, (GVAR(lastStillPosition) select 1) + (_lastPos select 1) - (_newPos select 1)];
|
||||
GVAR(rightMouseButtonLastPos) = [_x, _y];
|
||||
TRACE_3("Mouse Move",_lastPos,_newPos,GVAR(rightMouseButtonLastPos));
|
||||
};
|
||||
}];
|
||||
|
||||
_control ctrlAddEventHandler ["MouseButtonDown", {
|
||||
params ["", "_button", "_x", "_y"];
|
||||
if (_button == 1) then {
|
||||
GVAR(rightMouseButtonLastPos) = [_x, _y];
|
||||
};
|
||||
}];
|
||||
|
||||
_control ctrlAddEventHandler ["MouseButtonUp", {
|
||||
params ["", "_button"];
|
||||
if (_button == 1) then {
|
||||
GVAR(rightMouseButtonLastPos) = [];
|
||||
};
|
||||
}];
|
||||
|
||||
//get mouse position on map
|
||||
_control ctrlAddEventHandler ["MouseMoving", {
|
||||
params ["_control", "_x", "_y"];
|
||||
GVAR(mousePos) = _control ctrlMapScreenToWorld [_x, _y];
|
||||
}];
|
||||
|
||||
_control ctrlAddEventHandler ["MouseHolding", {
|
||||
params ["_control", "_x", "_y"];
|
||||
GVAR(mousePos) = _control ctrlMapScreenToWorld [_x, _y];
|
||||
}];
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* On map main draw (may be any of the map controls)
|
||||
*
|
||||
* Arguments:
|
||||
* Something
|
||||
* 0: Map control <CONTROL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -15,40 +15,39 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params ["_display"];
|
||||
params ["_mapCtrl"];
|
||||
private _display = ctrlParent _mapCtrl;
|
||||
|
||||
(_display displayCtrl 1016) ctrlShow GVAR(mapShowCursorCoordinates);
|
||||
|
||||
// hide clock when no watch in inventory, or whatever never ever
|
||||
(_display displayCtrl 101) ctrlShow GVAR(hasWatch);
|
||||
|
||||
|
||||
private _hasAceTopo = ((assignedItems ace_player) param [0, ""]) == "ace_TopographicMap";
|
||||
private _ctrlTopoMap = _display displayCtrl 9051;
|
||||
private _ctrlMap = _display displayCtrl 51;
|
||||
|
||||
if (!((ctrlShown _ctrlTopoMap) isEqualTo _hasAceTopo)) then {
|
||||
TRACE_1("updating ctrls",_hasAceTopo);
|
||||
_ctrlMap ctrlShow false;
|
||||
_ctrlMap ctrlCommit 0;
|
||||
_ctrlTopoMap ctrlShow false;
|
||||
_ctrlTopoMap ctrlCommit 0;
|
||||
|
||||
_ctrlTopoMap ctrlSetPosition ctrlPosition _ctrlMap;
|
||||
|
||||
_ctrlMap ctrlShow true;
|
||||
_ctrlMap ctrlCommit 0;
|
||||
_ctrlTopoMap ctrlShow _hasAceTopo;
|
||||
_ctrlTopoMap ctrlCommit 0;
|
||||
if (GVAR(updateActiveMap)) then {
|
||||
{
|
||||
TRACE_2("update",GVAR(activeMapTypeIDC),_x);
|
||||
private _ctrlMap = _display displayCtrl _x;
|
||||
if (_x == GVAR(activeMapTypeIDC)) then {
|
||||
_ctrlMap ctrlShow true;
|
||||
_ctrlMap setVariable [QEGVAR(mapEventHandlers,active), true];
|
||||
} else {
|
||||
_ctrlMap ctrlShow false;
|
||||
_ctrlMap setVariable [QEGVAR(mapEventHandlers,active), false];
|
||||
};
|
||||
} forEach getArray (configFile >> "RscDisplayMainMap" >> QEGVAR(mapEventHandlers,IDCs));
|
||||
GVAR(updateActiveMap) = false;
|
||||
};
|
||||
if (_hasAceTopo) then {
|
||||
if (ctrlMapAnimDone _ctrlMap) then {
|
||||
// update old map to the new maps position and scale
|
||||
private _ctrlPos = ctrlPosition _ctrlMap;
|
||||
|
||||
if (GVAR(activeMapTypeIDC) != 51) then {
|
||||
// update default map to the new maps position and scale to ensure marker placement works
|
||||
private _ctrlVanillaMap = _display displayCtrl 51;
|
||||
private _ctrlActiveMap = _display displayCtrl GVAR(activeMapTypeIDC); // the currently active map
|
||||
if (ctrlMapAnimDone _ctrlVanillaMap) then {
|
||||
private _ctrlPos = ctrlPosition _ctrlVanillaMap;
|
||||
private _centerScreen = [_ctrlPos#0 + _ctrlPos#2 / 2, _ctrlPos#1 + _ctrlPos#3 / 2];
|
||||
private _centerPos = _ctrlTopoMap ctrlMapScreenToWorld _centerScreen;
|
||||
private _scale = ctrlMapScale _ctrlTopoMap;
|
||||
_ctrlMap ctrlMapAnimAdd [0.01, _scale, _centerPos];
|
||||
ctrlMapAnimCommit _ctrlMap;
|
||||
private _centerPos = _ctrlActiveMap ctrlMapScreenToWorld _centerScreen;
|
||||
private _scale = ctrlMapScale _ctrlActiveMap;
|
||||
_ctrlVanillaMap ctrlMapAnimAdd [0.01, _scale, _centerPos];
|
||||
ctrlMapAnimCommit _ctrlVanillaMap;
|
||||
};
|
||||
};
|
||||
|
@ -4,7 +4,7 @@
|
||||
* On map draw, updates the effects
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
* 0: Map Control <CONTROL>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
|
@ -21,3 +21,6 @@
|
||||
#define MARKERNAME_MAPTOOL_ROTATINGSMALL "ACE_MapToolRotatingSmall"
|
||||
|
||||
#define DEFAULT_FLASHLIGHT_SIZE 2.75
|
||||
|
||||
#define IDC_MAP_MAIN 51
|
||||
#define IDC_MAP_TOPO 95101
|
||||
|
@ -8,10 +8,10 @@ if (!hasInterface) exitWith {};
|
||||
|
||||
["ace_settingsInitialized", {
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
|
||||
// This will set QEGVAR(common,playerOwner) var on player objects
|
||||
[] call EFUNC(common,setPlayerOwner);
|
||||
|
||||
|
||||
GVAR(pointPosition) = [0,0,0];
|
||||
|
||||
[QGVAR(syncPos), {
|
||||
|
@ -50,7 +50,7 @@ params ["_mapHandle"];
|
||||
};
|
||||
|
||||
TRACE_2("",_colorMap,_color);
|
||||
|
||||
|
||||
// Render icon and player name
|
||||
_mapHandle drawIcon ["\a3\ui_f\data\gui\cfg\Hints\icon_text\group_1_ca.paa", _color, _pos, ICON_RENDER_SIZE, ICON_RENDER_SIZE, ICON_ANGLE, "", ICON_SHADOW, TEXT_SIZE, TEXT_FONT, ICON_TEXT_ALIGN];
|
||||
_mapHandle drawIcon ["#(argb,8,8,3)color(0,0,0,0)", GVAR(nameTextColor), _pos, TEXT_ICON_RENDER_SIZE, TEXT_ICON_RENDER_SIZE, ICON_ANGLE, name _x, TEXT_SHADOW, TEXT_SIZE, TEXT_FONT, ICON_TEXT_ALIGN];
|
||||
|
@ -15,12 +15,9 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
TRACE_1("receiverInit",_this);
|
||||
|
||||
ACE_player setVariable [QGVAR(Transmit), false, true];
|
||||
GVAR(EnableTransmit) = false;
|
||||
|
||||
if (!isNil QGVAR(DrawMapHandlerID)) then {
|
||||
(findDisplay 12 displayCtrl 51) ctrlRemoveEventHandler ["Draw", GVAR(DrawMapHandlerID)];
|
||||
GVAR(DrawMapHandlerID) = nil;
|
||||
};
|
||||
GVAR(DrawMapHandlerID) = findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {call FUNC(drawMapGestures)}];
|
||||
findDisplay 12 displayCtrl 9051 ctrlAddEventHandler ["Draw", {call FUNC(drawMapGestures)}]; // #TopoHack
|
||||
["Draw", {call FUNC(drawMapGestures)}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
@ -15,34 +15,23 @@
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
disableSerialization;
|
||||
|
||||
private _mapCtrl = findDisplay 12 displayCtrl 51;
|
||||
TRACE_1("transmitterInit",_this);
|
||||
|
||||
// MouseMoving EH.
|
||||
if (!isNil QGVAR(MouseMoveHandlerID)) then {
|
||||
_mapCtrl ctrlRemoveEventHandler ["MouseMoving", GVAR(MouseMoveHandlerID)];
|
||||
GVAR(MouseMoveHandlerID) = nil;
|
||||
};
|
||||
GVAR(MouseMoveHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseMoving", {
|
||||
["MouseMoving", {
|
||||
// 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 {};
|
||||
|
||||
params ["_control", "_posX", "_posY"];
|
||||
|
||||
if (!(ACE_player getVariable QGVAR(Transmit))) then {
|
||||
ACE_player setVariable [QGVAR(Transmit), true, true];
|
||||
};
|
||||
|
||||
GVAR(pointPosition) = _control ctrlMapScreenToWorld [_posX, _posY];
|
||||
}];
|
||||
}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
// MouseDown EH
|
||||
if (!isNil QGVAR(MouseDownHandlerID)) then {
|
||||
_mapCtrl ctrlRemoveEventHandler ["MouseButtonDown",GVAR(MouseDownHandlerID)];
|
||||
GVAR(MouseDownHandlerID) = nil;
|
||||
};
|
||||
GVAR(MouseDownHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseButtonDown", {
|
||||
["MouseButtonDown", {
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
params ["", "_button", "_x", "_y", "_shift", "_ctrl", "_alt"];
|
||||
@ -50,14 +39,10 @@ GVAR(MouseDownHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseButtonDown", {
|
||||
if (_button == 0 && {[_shift, _ctrl, _alt] isEqualTo [false, false, false]}) then {
|
||||
call FUNC(initTransmit);
|
||||
};
|
||||
}];
|
||||
}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
// MouseUp EH
|
||||
if (!isNil QGVAR(MouseUpHandlerID)) then {
|
||||
_mapCtrl ctrlRemoveEventHandler ["MouseButtonUp", GVAR(MouseUpHandlerID)];
|
||||
GVAR(MouseUpHandlerID) = nil;
|
||||
};
|
||||
GVAR(MouseUpHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseButtonUp", {
|
||||
["MouseButtonUp", {
|
||||
if (!GVAR(enabled)) exitWith {};
|
||||
|
||||
params ["", "_button"];
|
||||
@ -65,4 +50,4 @@ GVAR(MouseUpHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseButtonUp", {
|
||||
if (_button == 0) then {
|
||||
call FUNC(endTransmit);
|
||||
};
|
||||
}];
|
||||
}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
@ -15,14 +15,10 @@ GVAR(mapTool_isDragging) = false;
|
||||
GVAR(mapTool_isRotating) = false;
|
||||
|
||||
//Install the event handers for the map tools on the main in-game map
|
||||
[{!isNull findDisplay 12},
|
||||
{
|
||||
((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", {call FUNC(updateMapToolMarkers); call FUNC(openMapGpsUpdate);}];
|
||||
((findDisplay 12) displayCtrl 9051) ctrlAddEventHandler ["Draw", {call FUNC(updateMapToolMarkers);}]; // #TopoHack
|
||||
}, []] call CBA_fnc_waitUntilAndExecute;
|
||||
["Draw", {call FUNC(updateMapToolMarkers); call FUNC(openMapGpsUpdate);}, true] call EFUNC(common,addMapEventHandler);
|
||||
["MouseMoving", {call FUNC(handleMouseMove);}, true] call EFUNC(common,addMapEventHandler);
|
||||
["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}, true] call EFUNC(common,addMapEventHandler);
|
||||
["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
["visibleMap", {
|
||||
params ["", "_mapOn"];
|
||||
@ -35,4 +31,3 @@ GVAR(mapTool_isRotating) = false;
|
||||
|
||||
GVAR(freeDrawingData) = [];
|
||||
GVAR(freedrawing) = false;
|
||||
|
||||
|
@ -12,7 +12,13 @@ if (isMultiplayer && {!isServer} && {hasInterface}) then {
|
||||
[QGVAR(sendMarkersJIP), CBA_clientID] call CBA_fnc_serverEvent;
|
||||
};
|
||||
|
||||
GVAR(mapDisplaysWithDrawEHs) = [];
|
||||
// Run MapDrawEH on main and briefing maps
|
||||
["Draw", {call FUNC(mapDrawEH)}, true, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
// movable markers (add on main and briefing maps)
|
||||
["MouseButtonDown", {_this call FUNC(onMouseButtonDown)}, true, true] call EFUNC(common,addMapEventHandler);
|
||||
["MouseButtonUp", {_this call FUNC(onMouseButtonUp)}, true, true] call EFUNC(common,addMapEventHandler);
|
||||
|
||||
GVAR(currentMarkerPosition) = [];
|
||||
GVAR(currentMarkerAngle) = 0;
|
||||
GVAR(currentMarkerColorConfigName) = "";
|
||||
|
@ -62,14 +62,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////
|
||||
// Install MapDrawEH on current map
|
||||
if !((ctrlIDD _mapDisplay) in GVAR(mapDisplaysWithDrawEHs)) then {
|
||||
GVAR(mapDisplaysWithDrawEHs) pushBack (ctrlIDD _mapDisplay);
|
||||
_mapCtrl ctrlAddEventHandler ["Draw", {_this call FUNC(mapDrawEH)}]; // @todo check if persistent
|
||||
(_mapDisplay displayCtrl 9051) ctrlAddEventHandler ["Draw", {_this call FUNC(mapDrawEH)}]; // #TopoHack
|
||||
};
|
||||
|
||||
////////////////////
|
||||
// Calculate center position of the marker placement ctrl
|
||||
if !(GVAR(editingMarker) isEqualTo "") then {
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
params ["_display"];
|
||||
TRACE_1("params",_display);
|
||||
TRACE_1("mapDisplayInitEH",_display);
|
||||
|
||||
private _bisShapeLB = _display displayctrl 1091;
|
||||
private _curSelShape = missionNamespace getVariable [QGVAR(curSelMarkerShape), 0];
|
||||
@ -30,8 +30,3 @@ private _curSelColor = missionNamespace getVariable [QGVAR(curSelMarkerColor), 0
|
||||
TRACE_2("color",_bisColorLB,_curSelColor);
|
||||
_bisColorLB ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedColor)}];
|
||||
_bisColorLB lbSetCurSel _curSelColor;
|
||||
|
||||
// movable markers
|
||||
private _ctrlMap = _display displayCtrl 51;
|
||||
_ctrlMap ctrlAddEventHandler ["MouseButtonDown", {_this call FUNC(onMouseButtonDown)}];
|
||||
_ctrlMap ctrlAddEventHandler ["MouseButtonUp", {_this call FUNC(onMouseButtonUp)}];
|
||||
|
@ -19,7 +19,6 @@ class RscEdit;
|
||||
class RscButton;
|
||||
class RscListBox;
|
||||
|
||||
|
||||
class GVAR(RscActiveTextPicture): RscActiveText {
|
||||
style = 48;
|
||||
colorText[] = {1,1,1,1};
|
||||
@ -46,12 +45,14 @@ class GVAR(RscText): RscText {
|
||||
#define H_PART(num) QUOTE((num) * (safeZoneH / 36))
|
||||
|
||||
class GVAR(TheDialog) {
|
||||
EGVAR(mapEventHandlers,IDCs)[] = {IDC_MAPPLAIN, IDC_MAPDETAILS};
|
||||
EGVAR(mapEventHandlers,type) = QEGVAR(mapEventHandlers,gps);
|
||||
idd = -1;
|
||||
movingEnable = 1;
|
||||
duration = 9999999;
|
||||
fadein = 0;
|
||||
fadeout = 0;
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(DialogDisplay)),_this select 0)];);
|
||||
onLoad = QUOTE([ARR_2(QUOTE(QGVAR(TheDialog)), _this # 0)] call EFUNC(common,addMapEventHandler_init); uiNamespace setVariable [ARR_2(QUOTE(QGVAR(DialogDisplay)),_this # 0)];);
|
||||
onUnload = QUOTE([] call FUNC(dialogClosedEH));
|
||||
|
||||
#include "gui_controls.hpp"
|
||||
@ -81,7 +82,7 @@ class RscTitles {
|
||||
duration = 9999999;
|
||||
fadein = 0;
|
||||
fadeout = 0;
|
||||
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RscTitleDisplay)),_this select 0)];);
|
||||
onLoad = QUOTE([ARR_2(QUOTE(QGVAR(TheDialog)), _this # 0)] call EFUNC(common,addMapEventHandler_init); uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RscTitleDisplay)),_this # 0)];);
|
||||
|
||||
#include "gui_controls.hpp"
|
||||
};
|
||||
|
Reference in New Issue
Block a user