mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-21 12:11:07 +00:00
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..
This commit is contained in:
parent
b3558f550d
commit
bad9c08c3f
2 changed files with 10 additions and 0 deletions
|
@ -5526,6 +5526,11 @@ void idPlayer::UpdateFocus( void ) {
|
||||||
|
|
||||||
if ( focusGUIent && focusUI ) {
|
if ( focusGUIent && focusUI ) {
|
||||||
if ( !oldFocus || oldFocus != focusGUIent ) {
|
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 );
|
command = focusUI->Activate( true, gameLocal.time );
|
||||||
HandleGuiCommands( focusGUIent, command );
|
HandleGuiCommands( focusGUIent, command );
|
||||||
StartSound( "snd_guienter", SND_CHANNEL_ANY, 0, false, NULL );
|
StartSound( "snd_guienter", SND_CHANNEL_ANY, 0, false, NULL );
|
||||||
|
|
|
@ -4545,6 +4545,11 @@ void idPlayer::UpdateFocus( void ) {
|
||||||
|
|
||||||
if ( focusGUIent && focusUI ) {
|
if ( focusGUIent && focusUI ) {
|
||||||
if ( !oldFocus || oldFocus != focusGUIent ) {
|
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 );
|
command = focusUI->Activate( true, gameLocal.time );
|
||||||
HandleGuiCommands( focusGUIent, command );
|
HandleGuiCommands( focusGUIent, command );
|
||||||
StartSound( "snd_guienter", SND_CHANNEL_ANY, 0, false, NULL );
|
StartSound( "snd_guienter", SND_CHANNEL_ANY, 0, false, NULL );
|
||||||
|
|
Loading…
Reference in a new issue