From dc1f5f02209e5f1f38902a5a3f941290f7035f9d Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 17 Apr 2011 17:27:31 +0000 Subject: [PATCH] - Add more information when trying to load old savegames. - When loading a game from the menu, do not hide the fullscreen console until we know we can load the save. Otherwise, the gamestate goes invalid if the save is no good. SVN r3187 (trunk) --- src/d_event.h | 1 + src/d_main.cpp | 2 +- src/g_game.cpp | 22 +++++++++++++++++++--- src/g_game.h | 2 +- src/menu/loadsavemenu.cpp | 8 ++------ 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/d_event.h b/src/d_event.h index 513ea10b43..12257e2c2b 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -62,6 +62,7 @@ typedef enum ga_newgame, ga_newgame2, ga_loadgame, + ga_loadgamehidecon, ga_autoloadgame, ga_savegame, ga_autosave, diff --git a/src/d_main.cpp b/src/d_main.cpp index 3cfd3081ce..10e3e1c199 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2290,7 +2290,7 @@ void D_DoomMain (void) G_LoadGame (file); } - if (gameaction != ga_loadgame) + if (gameaction != ga_loadgame && gameaction != ga_loadgamehidecon) { if (autostart || netgame) { diff --git a/src/g_game.cpp b/src/g_game.cpp index 1c2a6e5162..6c07d618e5 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1015,6 +1015,7 @@ void G_Ticker () G_DoNewGame (); break; case ga_loadgame: + case ga_loadgamehidecon: case ga_autoloadgame: G_DoLoadGame (); break; @@ -1631,12 +1632,12 @@ void G_ScreenShot (char *filename) // G_InitFromSavegame // Can be called by the startup code or the menu task. // -void G_LoadGame (const char* name) +void G_LoadGame (const char* name, bool hidecon) { if (name != NULL) { savename = name; - gameaction = ga_loadgame; + gameaction = !hidecon ? ga_loadgame : ga_loadgamehidecon; } } @@ -1696,11 +1697,13 @@ void G_DoLoadGame () char sigcheck[20]; char *text = NULL; char *map; + bool hidecon; if (gameaction != ga_autoloadgame) { demoplayback = false; } + hidecon = gameaction == ga_loadgamehidecon; gameaction = ga_nothing; FILE *stdfile = fopen (savename.GetChars(), "rb"); @@ -1746,13 +1749,19 @@ void G_DoLoadGame () delete[] engine; } + SaveVersion = 0; if (!M_GetPNGText (png, "ZDoom Save Version", sigcheck, 20) || 0 != strncmp (sigcheck, SAVESIG, 9) || // ZDOOMSAVE is the first 9 chars (SaveVersion = atoi (sigcheck+9)) < MINSAVEVER) { - Printf ("Savegame is from an incompatible version\n"); delete png; fclose (stdfile); + Printf ("Savegame is from an incompatible version"); + if (SaveVersion != 0) + { + Printf(": %d (%d is the oldest supported)", SaveVersion, MINSAVEVER); + } + Printf("\n"); return; } @@ -1770,6 +1779,13 @@ void G_DoLoadGame () return; } + // Now that it looks like we can load this save, hide the fullscreen console if it was up + // when the game was selected from the menu. + if (hidecon && gamestate == GS_FULLCONSOLE) + { + gamestate = GS_HIDECONSOLE; + } + // Read intermission data for hubs G_ReadHubInfo(png); diff --git a/src/g_game.h b/src/g_game.h index a9f5f0afba..65ae77563e 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -36,7 +36,7 @@ void G_DeferedPlayDemo (const char* demo); // Can be called by the startup code or M_Responder, // calls P_SetupLevel or W_EnterWorld. -void G_LoadGame (const char* name); +void G_LoadGame (const char* name, bool hidecon=false); void G_DoLoadGame (void); diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index fd0d87f1f5..78bdadf59e 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -553,7 +553,7 @@ void DLoadSaveMenu::Drawer () bool didSeeSelected = false; // Draw picture area - if (gameaction == ga_loadgame || gameaction == ga_savegame) + if (gameaction == ga_loadgame || gameaction == ga_loadgamehidecon || gameaction == ga_savegame) { return; } @@ -1094,11 +1094,7 @@ bool DLoadMenu::MenuEvent (int mkey, bool fromcontroller) if (mkey == MKEY_Enter) { - G_LoadGame (SaveGames[Selected]->Filename.GetChars()); - if (gamestate == GS_FULLCONSOLE) - { - gamestate = GS_HIDECONSOLE; - } + G_LoadGame (SaveGames[Selected]->Filename.GetChars(), true); if (quickSaveSlot == (FSaveGameNode*)1) { quickSaveSlot = SaveGames[Selected];