From bad9c08c3f04d63ce7f0b968886f9f808e5367ab Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 17 Mar 2024 04:03:27 +0100 Subject: [PATCH] Make Sys_SetInteractiveIngameGuiActive() work better it could happen that UIs are added to the internal list twice, and also that the last UI wasn't removed from the list when a new one was focused fast enough. That should work better now, I hope I didn't break anything.. --- d3xp/Player.cpp | 5 +++++ game/Player.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/d3xp/Player.cpp b/d3xp/Player.cpp index 718a8cc..df2fbd2 100644 --- a/d3xp/Player.cpp +++ b/d3xp/Player.cpp @@ -5526,6 +5526,11 @@ void idPlayer::UpdateFocus( void ) { if ( focusGUIent && focusUI ) { if ( !oldFocus || oldFocus != focusGUIent ) { + // DG: tell the old UI it isn't focused anymore + if ( oldFocus != NULL && oldUI != NULL ) { + command = oldUI->Activate( false, gameLocal.time ); + // TODO: HandleGuiCommands( oldFocus, command ); ? + } // DG end command = focusUI->Activate( true, gameLocal.time ); HandleGuiCommands( focusGUIent, command ); StartSound( "snd_guienter", SND_CHANNEL_ANY, 0, false, NULL ); diff --git a/game/Player.cpp b/game/Player.cpp index 45c9f8d..8308c96 100644 --- a/game/Player.cpp +++ b/game/Player.cpp @@ -4545,6 +4545,11 @@ void idPlayer::UpdateFocus( void ) { if ( focusGUIent && focusUI ) { if ( !oldFocus || oldFocus != focusGUIent ) { + // DG: tell the old UI it isn't focused anymore + if ( oldFocus != NULL && oldUI != NULL ) { + command = oldUI->Activate( false, gameLocal.time ); + // TODO: HandleGuiCommands( oldFocus, command ); ? + } // DG end command = focusUI->Activate( true, gameLocal.time ); HandleGuiCommands( focusGUIent, command ); StartSound( "snd_guienter", SND_CHANNEL_ANY, 0, false, NULL );