mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Store spectator display in a uiNamespace variable
This allows me to explicitly close the right display and hopefully fix the interface staying open upon mission end. @Commy2's theory is that perhaps the main display `46` is killed upon mission end, meaning that `findDisplay` can't find the spectator display to close it because the game thinks it doesn't exist.
This commit is contained in:
parent
cd23228fbc
commit
65e981373b
@ -10,4 +10,4 @@
|
|||||||
}] call EFUNC(common,addEventHandler);
|
}] call EFUNC(common,addEventHandler);
|
||||||
|
|
||||||
// Should prevent unending spectator on mission end
|
// Should prevent unending spectator on mission end
|
||||||
addMissionEventHandler ["Ended",{ [false] call FUNC(setSpectator) }];
|
addMissionEventHandler ["Ended",{ [QGVAR(EndMission)] call FUNC(interrupt) }];
|
||||||
|
@ -25,6 +25,9 @@ PREP(updateSpectatableSides);
|
|||||||
PREP(updateUnits);
|
PREP(updateUnits);
|
||||||
PREP(updateVisionModes);
|
PREP(updateVisionModes);
|
||||||
|
|
||||||
|
// Reset the stored display
|
||||||
|
SETUVAR(GVAR(interface),displayNull);
|
||||||
|
|
||||||
// Permanent variables
|
// Permanent variables
|
||||||
GVAR(availableModes) = [0,1,2];
|
GVAR(availableModes) = [0,1,2];
|
||||||
GVAR(availableSides) = [west,east,resistance,civilian];
|
GVAR(availableSides) = [west,east,resistance,civilian];
|
||||||
|
@ -22,6 +22,7 @@ params ["_mode",["_args",[]]];
|
|||||||
switch (toLower _mode) do {
|
switch (toLower _mode) do {
|
||||||
case "onload": {
|
case "onload": {
|
||||||
_args params ["_display"];
|
_args params ["_display"];
|
||||||
|
SETUVAR(GVAR(interface),_display);
|
||||||
|
|
||||||
// Always show interface and hide map upon opening
|
// Always show interface and hide map upon opening
|
||||||
[_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface);
|
[_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface);
|
||||||
@ -451,13 +452,13 @@ switch (toLower _mode) do {
|
|||||||
|
|
||||||
// PFH to re-open display when menu closes
|
// 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
|
// If still a spectator then re-enter the interface
|
||||||
[QGVAR(escape),false] call FUNC(interrupt);
|
[QGVAR(escape),false] call FUNC(interrupt);
|
||||||
|
|
||||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||||
},0] call CBA_fnc_addPerFrameHandler;
|
},0,_dlg] call CBA_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
||||||
case "zeus": {
|
case "zeus": {
|
||||||
openCuratorInterface;
|
openCuratorInterface;
|
||||||
|
@ -29,16 +29,16 @@ if (_interrupt) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(interrupts) isEqualTo []) then {
|
if (GVAR(interrupts) isEqualTo []) then {
|
||||||
if (isNull (findDisplay 12249)) then {
|
if (isNull (GETUVAR(GVAR(interface),displayNull))) then {
|
||||||
createDialog QGVAR(interface);
|
(findDisplay 46) createDisplay QGVAR(interface);
|
||||||
[] call FUNC(transitionCamera);
|
[] call FUNC(transitionCamera);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if !(isNull (findDisplay 12249)) then {
|
if !(isNull (GETUVAR(GVAR(interface),displayNull))) then {
|
||||||
while {dialog} do {
|
while {dialog} do {
|
||||||
closeDialog 0;
|
closeDialog 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
(findDisplay 12249) closeDisplay 0;
|
(GETUVAR(GVAR(interface),displayNull)) closeDisplay 0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
params [["_set",true,[true]], ["_force",true,[true]]];
|
params [["_set",true,[true]], ["_force",true,[true]]];
|
||||||
|
|
||||||
// Only clients can be spectators
|
// Only clients can be spectators
|
||||||
if (!hasInterface) exitWith {};
|
if !(hasInterface) exitWith {};
|
||||||
|
|
||||||
// Exit if no change
|
// Exit if no change
|
||||||
if (_set isEqualTo GVAR(isSet)) exitWith {};
|
if (_set isEqualTo GVAR(isSet)) exitWith {};
|
||||||
@ -76,12 +76,13 @@ if (_set) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
[{
|
[{
|
||||||
|
disableSerialization;
|
||||||
// Create the display
|
// Create the display
|
||||||
(findDisplay 46) createDisplay QGVAR(interface);
|
_display = (findDisplay 46) createDisplay QGVAR(interface);
|
||||||
|
|
||||||
// If not forced, make esc end spectator
|
// If not forced, make esc end spectator
|
||||||
if (_this) then {
|
if (_this) then {
|
||||||
(findDisplay 12249) displayAddEventHandler ["KeyDown", {
|
_display displayAddEventHandler ["KeyDown", {
|
||||||
if (_this select 1 == 1) then {
|
if (_this select 1 == 1) then {
|
||||||
[false] call ace_spectator_fnc_setSpectator;
|
[false] call ace_spectator_fnc_setSpectator;
|
||||||
true
|
true
|
||||||
@ -101,9 +102,9 @@ if (_set) then {
|
|||||||
while {dialog} do {
|
while {dialog} do {
|
||||||
closeDialog 0;
|
closeDialog 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Kill the display
|
// Kill the display
|
||||||
(findDisplay 12249) closeDisplay 0;
|
(GETUVAR(GVAR(interface),displayNull)) closeDisplay 0;
|
||||||
|
|
||||||
// Terminate camera
|
// Terminate camera
|
||||||
GVAR(freeCamera) cameraEffect ["terminate", "back"];
|
GVAR(freeCamera) cameraEffect ["terminate", "back"];
|
||||||
|
Loading…
Reference in New Issue
Block a user