From d6cc14a39d20afbd4734ab4c90ddfdbde63cee12 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Thu, 6 Aug 2015 00:52:39 +0100 Subject: [PATCH] Add zeus support to spectator UI Can only use zeus while alive, so it won't work using the respawn template. However it's useful for communities usign custom frameworks --- .../functions/fnc_handleInterface.sqf | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index fdd84ee5ef..defe5332ba 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -225,6 +225,10 @@ switch (toLower _mode) do { case "onkeydown": { _args params ["_display","_dik","_shift","_ctrl","_alt"]; + if ((alive player) && {_dik in (actionKeys "curatorInterface")} && {!isNull (getAssignedCuratorLogic player)}) exitWith { + ["zeus", [_display]] call FUNC(handleInterface); + }; + // Handle held keys (prevent repeat calling) if (_dik in GVAR(heldKeys)) exitwith {}; // Exclude movement keys so that speed can be adjusted on fly @@ -457,7 +461,7 @@ switch (toLower _mode) do { }; } forEach GVAR(unitList); }; - // Break from interface for escape menu + // Break from interface for eexternal events case "escape": { _args params ["_display"]; private "_dlg"; @@ -511,6 +515,38 @@ switch (toLower _mode) do { [_this select 1] call CBA_fnc_removePerFrameHandler; },0] call CBA_fnc_addPerFrameHandler; + }; + case "zeus": { + _args params ["_display"]; + + // Kill display + _display closeDisplay 0; + + // Reset cam/UI vars + GVAR(camBoom) = 0; + GVAR(camDolly) = [0,0]; + + GVAR(ctrlKey) = false; + GVAR(heldKeys) = []; + GVAR(mouse) = [false,false]; + GVAR(mousePos) = [0.5,0.5]; + + openCuratorInterface; + + [{ + // PFH to re-open display when menu closes + [{ + if !((isNull curatorCamera) && {isNull (GETMVAR(bis_fnc_moduleRemoteControl_unit,objNull))}) exitWith {}; + + // If still a spectator then re-enter the interface + if (GVAR(isSet)) then { + createDialog QGVAR(interface); + [] call FUNC(transitionCamera); + }; + + [_this select 1] call CBA_fnc_removePerFrameHandler; + },0] call CBA_fnc_addPerFrameHandler; + },[],5] call EFUNC(common,waitAndExecute); true };