From 1e29c0286f78afc0f6403e8593ed09e6007b2276 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 30 Dec 2015 01:07:55 -0600 Subject: [PATCH] Remove Keybinds/Events for Zeus now handeld in CBA Close #2937 --- addons/common/XEH_postInit.sqf | 28 +++++++++++----------- addons/interact_menu/XEH_clientInit.sqf | 31 ------------------------- 2 files changed, 14 insertions(+), 45 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index ce75ad5187..69d28e3cab 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -1,7 +1,7 @@ // ACE - Common +// #define ENABLE_PERFORMANCE_COUNTERS #include "script_component.hpp" -// #define ENABLE_PERFORMANCE_COUNTERS ////////////////////////////////////////////////// // PFHs @@ -293,6 +293,17 @@ enableCamShake true; // Set up numerous eventhanders for player controlled units ////////////////////////////////////////////////// +//CBA has events for zeus's display onLoad and onUnload (Need to delay a frame for display to be ready) +private _zeusDisplayChangedFNC = { + [{ + private _data = !(isNull findDisplay 312); + ["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent); + }, []] call FUNC(execNextFrame); +}; +["CBA_curatorOpened", _zeusDisplayChangedFNC] call CBA_fnc_addEventHandler; +["CBA_curatorClosed", _zeusDisplayChangedFNC] call CBA_fnc_addEventHandler; + + // default variables GVAR(OldPlayerVehicle) = vehicle objNull; GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex); @@ -302,7 +313,6 @@ GVAR(OldPlayerVisionMode) = currentVisionMode objNull; GVAR(OldCameraView) = ""; GVAR(OldVisibleMap) = false; GVAR(OldInventoryDisplayIsOpen) = nil; //@todo check this -GVAR(OldZeusDisplayIsOpen) = false; GVAR(OldIsCamera) = false; // clean up playerChanged eventhandler from preinit and put it in the same PFH as the other events to reduce overhead and guarantee advantageous execution order @@ -314,13 +324,11 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { // PFH to raise varios events [{ BEGIN_COUNTER(stateChecker); - private "_data"; // reuse one variable to reduce number of variables that have to be set to private each frame // "playerChanged" event - _data = call FUNC(player); + private _data = call FUNC(player); // reuse one variable to reduce number of variables that have to be set to private each frame if !(_data isEqualTo ACE_player) then { - private "_oldPlayer"; - _oldPlayer = ACE_player; + private _oldPlayer = ACE_player; ACE_player = _data; uiNamespace setVariable ["ACE_player", _data]; @@ -393,14 +401,6 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { ["inventoryDisplayChanged", [ACE_player, _data]] call FUNC(localEvent); }; - // "zeusDisplayChanged" event - _data = !(isNull findDisplay 312); - if !(_data isEqualTo GVAR(OldZeusDisplayIsOpen)) then { - // Raise ACE event locally - GVAR(OldZeusDisplayIsOpen) = _data; - ["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent); - }; - // "activeCameraChanged" event _data = call FUNC(isfeatureCameraActive); if !(_data isEqualTo GVAR(OldIsCamera)) then { diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index 59fb01a353..37df771785 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -77,37 +77,6 @@ GVAR(ParsedTextCached) = []; if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;}; }] call EFUNC(common,addEventHandler); -// Let key work with zeus open (not perfect, contains workaround to prevent other CBA keybindings) -["zeusDisplayChanged",{ - if (_this select 1) then { - (finddisplay 312) displayAddEventHandler ["KeyUp", { - _key = ["ACE3 Common","ace_interact_menu_InteractKey"] call CBA_fnc_getKeybind; - _key = _key select 5; - _dik = _key select 0; - _mods = _key select 1; - - if ((_this select 1) == _dik) then { - if ((_this select [2,3]) isEqualTo _mods) then { - [_this,'keyup'] call CBA_events_fnc_keyHandler - }; - }; - }]; - (finddisplay 312) displayAddEventHandler ["KeyDown", { - _key = ["ACE3 Common","ace_interact_menu_InteractKey"] call CBA_fnc_getKeybind; - _key = _key select 5; - _dik = _key select 0; - _mods = _key select 1; - - if ((_this select 1) == _dik) then { - if ((_this select [2,3]) isEqualTo _mods) then { - [_this,'keydown'] call CBA_events_fnc_keyHandler - }; - }; - }]; - }; -}] call EFUNC(common,addEventHandler); - - //Debug to help end users identify mods that break CBA's XEH [{ private ["_badClassnames"];