diff options
author | Paul Gilbert | 2019-06-15 14:28:56 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-06-15 22:31:50 -0700 |
commit | acc90002f6937896e1f8063227b0423a653da0d2 (patch) | |
tree | b3d51ccee65bc253c6cae12a67e6242239923a1b /engines | |
parent | f80c11cf34d2db5e098955fe473b847bfc137d93 (diff) | |
download | scummvm-rg350-acc90002f6937896e1f8063227b0423a653da0d2.tar.gz scummvm-rg350-acc90002f6937896e1f8063227b0423a653da0d2.tar.bz2 scummvm-rg350-acc90002f6937896e1f8063227b0423a653da0d2.zip |
GLK: ADVSYS: Added code for loading savegames from launcher
Diffstat (limited to 'engines')
-rw-r--r-- | engines/glk/advsys/advsys.cpp | 11 | ||||
-rw-r--r-- | engines/glk/advsys/glk_interface.cpp | 5 | ||||
-rw-r--r-- | engines/glk/advsys/glk_interface.h | 5 | ||||
-rw-r--r-- | engines/glk/advsys/vm.cpp | 4 |
4 files changed, 21 insertions, 4 deletions
diff --git a/engines/glk/advsys/advsys.cpp b/engines/glk/advsys/advsys.cpp index 26f298dd00..ad8412843f 100644 --- a/engines/glk/advsys/advsys.cpp +++ b/engines/glk/advsys/advsys.cpp @@ -22,11 +22,15 @@ #include "glk/advsys/advsys.h" #include "common/translation.h" +#include "common/config-manager.h" namespace Glk { namespace AdvSys { void AdvSys::runGame() { + // Check for savegame + _saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1; + if (!initialize()) { GUIErrorMessage(_("Could not start AdvSys game")); return; @@ -37,6 +41,13 @@ void AdvSys::runGame() { // Run game startup execute(_initCodeOffset); + if (_saveSlot != -1) { + Common::ErrorCode err = loadGameState(_saveSlot).getCode(); + _saveSlot = -1; + if (err != Common::kNoError) + print(_("Sorry, the savegame couldn't be restored")); + } + // Gameplay loop while (!shouldQuit() && !shouldRestart()) { // Run update code diff --git a/engines/glk/advsys/glk_interface.cpp b/engines/glk/advsys/glk_interface.cpp index 01abd2fae3..20f9f4d3a1 100644 --- a/engines/glk/advsys/glk_interface.cpp +++ b/engines/glk/advsys/glk_interface.cpp @@ -31,7 +31,10 @@ bool GlkInterface::initialize() { } void GlkInterface::print(const Common::String &msg) { - glk_put_string_stream(glk_window_get_stream(_window), msg.c_str()); + // Don't print out text if loading a savegame directly from the launcher, since we don't + // want any of the intro text displayed by the startup code to show + if (_saveSlot == -1) + glk_put_string_stream(glk_window_get_stream(_window), msg.c_str()); } void GlkInterface::print(int number) { diff --git a/engines/glk/advsys/glk_interface.h b/engines/glk/advsys/glk_interface.h index 95dcfa8fc5..9048818020 100644 --- a/engines/glk/advsys/glk_interface.h +++ b/engines/glk/advsys/glk_interface.h @@ -36,6 +36,8 @@ class GlkInterface : public GlkAPI { private: winid_t _window; protected: + int _saveSlot; +protected: /** * GLK initialization */ @@ -61,7 +63,8 @@ public: /** * Constructor */ - GlkInterface(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc) {} + GlkInterface(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc), + _saveSlot(-1) {} }; } // End of namespace AdvSys diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp index 8c6072c73e..33712bc525 100644 --- a/engines/glk/advsys/vm.cpp +++ b/engines/glk/advsys/vm.cpp @@ -310,12 +310,12 @@ void VM::opYORN() { void VM::opSAVE() { if (saveGame().getCode() != Common::kNoError) - print("Sorry, the savegame couldn't be created"); + print(_("Sorry, the savegame couldn't be created")); } void VM::opRESTORE() { if (saveGame().getCode() != Common::kNoError) - print("Sorry, the savegame couldn't be restored"); + print(_("Sorry, the savegame couldn't be restored")); } void VM::opARG() { |