- added a C_ClearMessages function for the console and fixed game restart after death.

Fixes #322
This commit is contained in:
Christoph Oelckers 2020-09-04 22:23:38 +02:00
parent 1eb99f69c2
commit 2e8b808683
5 changed files with 13 additions and 5 deletions

View file

@ -47,6 +47,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "messages.h" #include "messages.h"
#include "nnexts.h" #include "nnexts.h"
#include "gstrings.h" #include "gstrings.h"
#include "gamestate.h"
BEGIN_BLD_NS BEGIN_BLD_NS
@ -1369,7 +1370,7 @@ void ProcessInput(PLAYER *pPlayer)
playerReset(pPlayer); playerReset(pPlayer);
if (gGameOptions.nGameType == 0 && numplayers == 1) if (gGameOptions.nGameType == 0 && numplayers == 1)
{ {
DeferedStartGame(currentLevel, -1); gameaction = ga_autoloadgame;
} }
else else
playerStart(pPlayer->nPlayer); playerStart(pPlayer->nPlayer);

View file

@ -57,6 +57,7 @@ extern constate_e ConsoleState;
void C_InitConsole (int width, int height, bool ingame); void C_InitConsole (int width, int height, bool ingame);
void C_DeinitConsole (); void C_DeinitConsole ();
void C_InitConback(); void C_InitConback();
void C_ClearMessages();
// Adjust the console for a new screen mode // Adjust the console for a new screen mode
void C_NewModeAdjust (void); void C_NewModeAdjust (void);

View file

@ -935,6 +935,11 @@ int PrintString (int iprintlevel, const char *outline)
return 0; // Don't waste time on calculating this if nothing at all was printed... return 0; // Don't waste time on calculating this if nothing at all was printed...
} }
void C_ClearMessages()
{
NotifyStrings.Clear();
}
int VPrintf (int printlevel, const char *format, va_list parms) int VPrintf (int printlevel, const char *format, va_list parms)
{ {
FString outline; FString outline;

View file

@ -136,12 +136,11 @@ static void GameTicker()
case ga_autoloadgame: case ga_autoloadgame:
// todo: for now just handle the restart case // todo: for now just handle the restart case
g_nextmap = currentLevel; g_nextmap = currentLevel;
g_nextskill = -1;
FX_StopAllSounds(); FX_StopAllSounds();
FX_SetReverb(0); FX_SetReverb(0);
gi->FreeLevelData(); gi->FreeLevelData();
gamestate = GS_LEVEL; C_ClearMessages();
gi->NextLevel(g_nextmap, -1); gi->NewGame(g_nextmap, -1);
break; break;
case ga_completed: case ga_completed:
@ -168,6 +167,7 @@ static void GameTicker()
FX_StopAllSounds(); FX_StopAllSounds();
FX_SetReverb(0); FX_SetReverb(0);
gi->FreeLevelData(); gi->FreeLevelData();
C_ClearMessages();
gamestate = GS_LEVEL; gamestate = GS_LEVEL;
gi->NewGame(g_nextmap, g_nextskill); gi->NewGame(g_nextmap, g_nextskill);
break; break;

View file

@ -54,6 +54,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "menu.h" #include "menu.h"
#include "gstrings.h" #include "gstrings.h"
#include "raze_music.h" #include "raze_music.h"
#include "gamestate.h"
BEGIN_SW_NS BEGIN_SW_NS
@ -6661,7 +6662,7 @@ void DoPlayerDeathCheckKeys(PLAYERp pp)
} }
else else
{ {
DeferedStartGame(currentLevel, -1); gameaction = ga_autoloadgame;
} }
DoPlayerFireOutDeath(pp); DoPlayerFireOutDeath(pp);