From f548573c8d4d78ead153e9a9b145511ce873c298 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Sun, 6 Sep 2020 04:49:18 +0200 Subject: [PATCH] Fix lingering messages in HUD after loading savegame 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. --- d3xp/Player.cpp | 7 +++++++ game/Player.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/d3xp/Player.cpp b/d3xp/Player.cpp index 160a63b..7ad5243 100644 --- a/d3xp/Player.cpp +++ b/d3xp/Player.cpp @@ -2543,6 +2543,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", "" ); + } } /* diff --git a/game/Player.cpp b/game/Player.cpp index e3878fa..45c9f8d 100644 --- a/game/Player.cpp +++ b/game/Player.cpp @@ -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", "" ); + } } /*