diff --git a/addons/spectator/XEH_preInit.sqf b/addons/spectator/XEH_preInit.sqf index a77d731478..3b317ba904 100644 --- a/addons/spectator/XEH_preInit.sqf +++ b/addons/spectator/XEH_preInit.sqf @@ -38,7 +38,7 @@ GVAR(camUnit) = objNull; GVAR(camVision) = -2; GVAR(camZoom) = 1.25; -SETUVAR(GVAR(display),nil); +GVAR(open) = false; GVAR(showComp) = true; GVAR(showHelp) = true; diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 2fa0d1439c..114f4e163b 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -23,7 +23,8 @@ switch (toLower _mode) do { // Safely open/close the interface case "open": { // Prevent reopening - if !(isNull (GETUVAR(GVAR(display),displayNull))) exitWith {}; + if (GVAR(open)) exitWith {}; + GVAR(open) = true; // Initalize camera variables GVAR(camBoom) = 0; @@ -57,13 +58,13 @@ switch (toLower _mode) do { }; case "close": { // Can't close a second time - if (isNull (GETUVAR(GVAR(display),displayNull))) exitWith {}; + if !(GVAR(open)) exitWith {}; + GVAR(open) = false; // Terminate interface while {dialog} do { closeDialog 0; }; - GETUVAR(GVAR(display),displayNull) closeDisplay 0; // Terminate camera GVAR(camera) cameraEffect ["terminate", "back"]; @@ -95,8 +96,6 @@ switch (toLower _mode) do { case "onload": { _args params ["_display"]; - SETUVAR(GVAR(display),_display); - // Always show interface and hide map upon opening [_display,nil,nil,!GVAR(showInterface),GVAR(showMap)] call FUNC(toggleInterface); @@ -149,8 +148,7 @@ switch (toLower _mode) do { //_display displayAddEventHandler ["KeyDown", {[_this,'keydown'] call CBA_events_fnc_keyHandler}]; }; case "onunload": { - SETUVAR(GVAR(display),nil); - + // Kill GUI PFHs GVAR(camHandler) = nil; GVAR(compHandler) = nil; GVAR(iconHandler) = nil;