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
This commit is contained in:
SilentSpike 2015-08-06 00:52:39 +01:00
parent d1975a593d
commit d6cc14a39d

View File

@ -225,6 +225,10 @@ switch (toLower _mode) do {
case "onkeydown": { case "onkeydown": {
_args params ["_display","_dik","_shift","_ctrl","_alt"]; _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) // Handle held keys (prevent repeat calling)
if (_dik in GVAR(heldKeys)) exitwith {}; if (_dik in GVAR(heldKeys)) exitwith {};
// Exclude movement keys so that speed can be adjusted on fly // Exclude movement keys so that speed can be adjusted on fly
@ -457,7 +461,7 @@ switch (toLower _mode) do {
}; };
} forEach GVAR(unitList); } forEach GVAR(unitList);
}; };
// Break from interface for escape menu // Break from interface for eexternal events
case "escape": { case "escape": {
_args params ["_display"]; _args params ["_display"];
private "_dlg"; private "_dlg";
@ -511,6 +515,38 @@ switch (toLower _mode) do {
[_this select 1] call CBA_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;
},0] call CBA_fnc_addPerFrameHandler; },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 true
}; };