Merge pull request #3155 from acemod/spectatorFix

Fix some spectator errors
This commit is contained in:
SilentSpike 2016-01-15 15:43:45 +00:00
commit dbcf94153d
5 changed files with 16 additions and 12 deletions

View File

@ -16,4 +16,4 @@ if (isServer) then {
};
// Should prevent unending spectator on mission end
addMissionEventHandler ["Ended",{ [false] call FUNC(setSpectator) }];
addMissionEventHandler ["Ended",{ [QGVAR(EndMission)] call FUNC(interrupt) }];

View File

@ -25,6 +25,9 @@ PREP(updateSpectatableSides);
PREP(updateUnits);
PREP(updateVisionModes);
// Reset the stored display
SETUVAR(GVAR(interface),displayNull);
// Permanent variables
GVAR(availableModes) = [0,1,2];
GVAR(availableSides) = [west,east,resistance,civilian];

View File

@ -22,6 +22,7 @@ params ["_mode",["_args",[]]];
switch (toLower _mode) do {
case "onload": {
_args params ["_display"];
SETUVAR(GVAR(interface),_display);
// Always show interface and hide map upon opening
[_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface);
@ -454,13 +455,13 @@ switch (toLower _mode) do {
// PFH to re-open display when menu closes
[{
if !(isNull (findDisplay 49)) exitWith {};
if !(isNull (_this select 0)) exitWith {};
// If still a spectator then re-enter the interface
[QGVAR(escape),false] call FUNC(interrupt);
[_this select 1] call CBA_fnc_removePerFrameHandler;
},0] call CBA_fnc_addPerFrameHandler;
},0,_dlg] call CBA_fnc_addPerFrameHandler;
};
case "zeus": {
openCuratorInterface;

View File

@ -29,16 +29,16 @@ if (_interrupt) then {
};
if (GVAR(interrupts) isEqualTo []) then {
if (isNull (findDisplay 12249)) then {
createDialog QGVAR(interface);
if (isNull (GETUVAR(GVAR(interface),displayNull))) then {
(findDisplay 46) createDisplay QGVAR(interface);
[] call FUNC(transitionCamera);
};
} else {
if !(isNull (findDisplay 12249)) then {
if !(isNull (GETUVAR(GVAR(interface),displayNull))) then {
while {dialog} do {
closeDialog 0;
};
(findDisplay 12249) closeDisplay 0;
(GETUVAR(GVAR(interface),displayNull)) closeDisplay 0;
};
};

View File

@ -24,7 +24,7 @@
params [["_set",true,[true]], ["_force",true,[true]]];
// Only clients can be spectators
if (!hasInterface) exitWith {};
if !(hasInterface) exitWith {};
// Exit if no change
if (_set isEqualTo GVAR(isSet)) exitWith {};
@ -84,12 +84,13 @@ if (_set) then {
};
[{
disableSerialization;
// Create the display
(findDisplay 46) createDisplay QGVAR(interface);
_display = (findDisplay 46) createDisplay QGVAR(interface);
// If not forced, make esc end spectator
if (_this) then {
(findDisplay 12249) displayAddEventHandler ["KeyDown", {
_display displayAddEventHandler ["KeyDown", {
if (_this select 1 == 1) then {
[false] call ace_spectator_fnc_setSpectator;
true
@ -111,7 +112,7 @@ if (_set) then {
};
// Kill the display
(findDisplay 12249) closeDisplay 0;
(GETUVAR(GVAR(interface),displayNull)) closeDisplay 0;
// Terminate camera
GVAR(freeCamera) cameraEffect ["terminate", "back"];
@ -147,7 +148,6 @@ if (_set) then {
//Kill these PFEH handlers now because the PFEH can run before the `onunload` event is handled
GVAR(camHandler) = nil;
GVAR(compHandler) = nil;
GVAR(iconHandler) = nil;
GVAR(toolHandler) = nil;
// Cleanup display variables