diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index f264739a3..c3f9aa61b 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -106,6 +106,7 @@ int oldentertics; int gametic; int intermissiondelay; +FString savename; FString BackupSaveGame; void DoLoadGame(const char* name); @@ -257,6 +258,12 @@ static void GameTicker() savedescription = ""; break; + case ga_loadgame: + case ga_loadgamehidecon: + //case ga_autoloadgame: + G_DoLoadGame(); + break; + case ga_autosave: if (gamestate == GS_LEVEL && !newGameStarted) M_Autosave(); newGameStarted = false; diff --git a/source/core/menu/loadsavemenu.cpp b/source/core/menu/loadsavemenu.cpp index e1e4ddb0a..487114bb8 100644 --- a/source/core/menu/loadsavemenu.cpp +++ b/source/core/menu/loadsavemenu.cpp @@ -114,7 +114,7 @@ void FSavegameManager::ReadSaveStrings() void FSavegameManager::PerformLoadGame(const char *f, bool s) { - G_LoadGame(f); + G_LoadGame(f, s); } void FSavegameManager::PerformSaveGame(const char *f, const char *s) diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index df576bafd..a14f0fa41 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -68,6 +68,7 @@ walltype wallbackup[MAXWALLS]; void WriteSavePic(FileWriter* file, int width, int height); bool WriteZip(const char* filename, TArray& filenames, TArray& content); +extern FString savename; extern FString BackupSaveGame; void SerializeMap(FSerializer &arc); @@ -687,12 +688,27 @@ static int nextquicksave = -1; } - void G_LoadGame(const char *filename) + void G_LoadGame(const char* name, bool hidecon) { + if (name != NULL) + { + savename = name; + gameaction = !hidecon ? ga_loadgame : ga_loadgamehidecon; + } + } + + void G_DoLoadGame() + { + if (gameaction == ga_loadgamehidecon && gamestate == GS_FULLCONSOLE) + { + // does this even do anything anymore? + gamestate = GS_HIDECONSOLE; + } + inputState.ClearAllInput(); gi->FreeLevelData(); - DoLoadGame(filename); - BackupSaveGame = filename; + DoLoadGame(savename); + BackupSaveGame = savename; } extern bool sendsave; diff --git a/source/core/savegamehelp.h b/source/core/savegamehelp.h index 486b8a4fe..65a0fff27 100644 --- a/source/core/savegamehelp.h +++ b/source/core/savegamehelp.h @@ -11,9 +11,10 @@ class FileReader; FString G_BuildSaveName (const char *prefix); int G_ValidateSavegame(FileReader &fr, FString *savetitle, bool formenu); -void G_LoadGame(const char* filename); +void G_LoadGame(const char* filename, bool hidecon = false); void G_SaveGame(const char* fn, const char* desc); void G_DoSaveGame(bool okForQuicksave, bool forceQuicksave, const char* filename, const char* description); +void G_DoLoadGame(); void M_Autosave();