mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-22 20:51:20 +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
0d4405bbe6
commit
27aeda205c
4 changed files with 16 additions and 2 deletions
|
@ -5539,6 +5539,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 );
|
||||
|
|
|
@ -4559,6 +4559,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 );
|
||||
|
|
|
@ -1038,7 +1038,9 @@ void Sys_SetInteractiveIngameGuiActive( bool active, idUserInterface* ui )
|
|||
if ( sessLocal.GetActiveMenu() == NULL && active ) {
|
||||
// add ui to lastuis, if it has been activated and no proper menu
|
||||
// (like main menu) is currently open
|
||||
if ( idx == -1 ) {
|
||||
lastuis.Append( ui );
|
||||
}
|
||||
} else if ( idx != -1 ) {
|
||||
// if the UI is in lastuis and has been deactivated, or there
|
||||
// is a proper menu opened, remove it from the list.
|
||||
|
@ -1049,7 +1051,8 @@ void Sys_SetInteractiveIngameGuiActive( bool active, idUserInterface* ui )
|
|||
// And because it's possible that we have an ingame UI focussed while opening
|
||||
// the multiplayer-main-menu, we keep a list of lastuis, instead of just one,
|
||||
// so D3_IN_interactiveIngameGuiActive remains true in that case
|
||||
// (the ingame UI is still in the list)
|
||||
// (the ingame UI is still in the list); the lastuis list is also needed
|
||||
// for the case of opening the PDA while an ingame GUI is focused
|
||||
|
||||
lastuis.RemoveIndex( idx );
|
||||
}
|
||||
|
|
|
@ -251,6 +251,7 @@ void Sys_GrabMouseCursor( bool grabIt );
|
|||
// DG: added this for an ungodly hack for gamepad support
|
||||
// active = true means "currently a GUI with a cursor is active/focused"
|
||||
// active = false means "that GUI is not active anymore"
|
||||
// ui == NULL means "clear all currently remembered GUIs"
|
||||
class idUserInterface;
|
||||
void Sys_SetInteractiveIngameGuiActive( bool active, idUserInterface* ui );
|
||||
|
||||
|
|
Loading…
Reference in a new issue