Skip to content

Commit

Permalink
Fix lingering messages in HUD after loading savegame
Browse files Browse the repository at this point in the history
If you save, you get a message like "Game Saved..." which goes away
after a few seconds. This happens at the very end of idPlayer::Save():
    if ( hud ) {
        hud->SetStateString( "message", /* .. left out .. */ );
        hud->HandleNamedEvent( "Message" );
    }
And handled in hud.gui, "onNamedEvent Message { ..."

However, if you save again before it's gone, it'll be shown after
loading the savegame and not go away until you save again..
This works around that issue by setting an empty message after loading
a savegame.

The underlying problem (which is not fixed!) seems to be that the
transition GUI command (that's executed when hud.gui handles the
"Message" event that's used to show this message) is probably not
properly saved/restored so fading out the message isn't continued
after loading.
  • Loading branch information
DanielGibson authored and IvanTheB committed Apr 29, 2023
1 parent e8a7d83 commit 6cda0d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions d3xp/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3451,6 +3451,13 @@ void idPlayer::Restore( idRestoreGame *savefile ) {
savefile->ReadFloat( bloomSpeed );
savefile->ReadFloat( bloomIntensity );
#endif

// DG: workaround for lingering messages that are shown forever after loading a savegame
// (one way to get them is saving again, while the message from first save is still
// shown, and then load)
if ( hud ) {
hud->SetStateString( "message", "" );
}
}

/*
Expand Down
7 changes: 7 additions & 0 deletions game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2063,6 +2063,13 @@ void idPlayer::Restore( idRestoreGame *savefile ) {

// create combat collision hull for exact collision detection
SetCombatModel();

// DG: workaround for lingering messages that are shown forever after loading a savegame
// (one way to get them is saving again, while the message from first save is still
// shown, and then load)
if ( hud ) {
hud->SetStateString( "message", "" );
}
}

/*
Expand Down

0 comments on commit 6cda0d4

Please sign in to comment.