From b9e13d2f178d89006ff6645e0d73168e42652205 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Mon, 20 Jul 2020 05:06:57 +0200 Subject: [PATCH] Make switching from Radiant to game work the game was frozen (the main menu and console worked though) when switching from the Radiant to the engine (with F2 or that button). Turned out common->ActivateTool( false ) must be called if the game window has forcus, so idSessionLocal::Frame() doesn't return early (and thus not run the game code). Furthermore, there was no sound when switching from Radiant to the game, because the SoundWorld was set to sth editor-specific. Fixed that as well. --- neo/sys/events.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/neo/sys/events.cpp b/neo/sys/events.cpp index 92b175df..8abd0b06 100644 --- a/neo/sys/events.cpp +++ b/neo/sys/events.cpp @@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms #include "idlib/Heap.h" #include "framework/Common.h" #include "framework/KeyInput.h" +#include "framework/Session.h" #include "renderer/RenderSystem.h" #include "renderer/tr_local.h" @@ -440,7 +441,13 @@ sysEvent_t Sys_GetEvent() { SDL_SetModState((SDL_Keymod)newmod); } // new context because visual studio complains about newmod and currentmod not initialized because of the case SDL_WINDOWEVENT_FOCUS_LOST - GLimp_GrabInput(GRAB_ENABLE | GRAB_REENABLE | GRAB_HIDECURSOR); + + common->ActivateTool( false ); + GLimp_GrabInput(GRAB_ENABLE | GRAB_REENABLE | GRAB_HIDECURSOR); // FIXME: not sure this is still needed after the ActivateTool()-call + + // start playing the game sound world again (when coming from editor) + session->SetPlayingSoundWorld(); + break; case SDL_WINDOWEVENT_FOCUS_LOST: GLimp_GrabInput(0);