- 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)
This commit is contained in:
Randy Heit 2011-04-17 17:27:31 +00:00
parent 2effba9504
commit dc1f5f0220
5 changed files with 24 additions and 11 deletions

View file

@ -62,6 +62,7 @@ typedef enum
ga_newgame,
ga_newgame2,
ga_loadgame,
ga_loadgamehidecon,
ga_autoloadgame,
ga_savegame,
ga_autosave,

View file

@ -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)
{

View file

@ -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);

View file

@ -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);

View file

@ -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];