aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-05-15 17:12:27 -1000
committerPaul Gilbert2019-05-15 17:12:27 -1000
commit0325c9315cdeb30d2124fbb9dcc3c36687d34da8 (patch)
tree034d2975739f06ee127dfb29b8eca44be48cdb6c /engines/glk
parent68ef5ebfd6f842b152a8bb03ade5be0b6b526fd8 (diff)
downloadscummvm-rg350-0325c9315cdeb30d2124fbb9dcc3c36687d34da8.tar.gz
scummvm-rg350-0325c9315cdeb30d2124fbb9dcc3c36687d34da8.tar.bz2
scummvm-rg350-0325c9315cdeb30d2124fbb9dcc3c36687d34da8.zip
GLK: HUGO: Support loading savegames from launcher
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/hugo/hemisc.cpp7
-rw-r--r--engines/glk/hugo/herun.cpp22
-rw-r--r--engines/glk/hugo/hugo.cpp4
-rw-r--r--engines/glk/hugo/hugo.h1
4 files changed, 31 insertions, 3 deletions
diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp
index 03a62c56d5..880305076d 100644
--- a/engines/glk/hugo/hemisc.cpp
+++ b/engines/glk/hugo/hemisc.cpp
@@ -1071,6 +1071,9 @@ void Hugo::InitGame() {
}
}
+#if defined (GLK)
+ if (_savegameSlot == -1) {
+#endif
#if defined (DEBUGGER)
for (i=0; i<MAXLOCALS; i++) strcpy(localname[i], "");
window[VIEW_LOCALS].count = current_locals = 0;
@@ -1081,7 +1084,9 @@ void Hugo::InitGame() {
PassLocals(0);
RunRoutine((long)initaddr*address_scale);
#endif
-
+#if defined (GLK)
+ }
+#endif
ret = 0;
retflag = 0;
var[actor] = var[player];
diff --git a/engines/glk/hugo/herun.cpp b/engines/glk/hugo/herun.cpp
index 8659544d2e..56e27c55bf 100644
--- a/engines/glk/hugo/herun.cpp
+++ b/engines/glk/hugo/herun.cpp
@@ -177,10 +177,19 @@ RestartDebugger:
Start:
stack_depth = 0;
-
strcpy(errbuf, "");
strcpy(oops, "");
+#if defined (GLK)
+ // Handle any savegame selected directly from the ScummVM launcher
+ if (_savegameSlot != -1) {
+ if (loadGameState(_savegameSlot).getCode() != Common::kNoError) {
+ GUIErrorMessage("Loading failed");
+ _savegameSlot = -1;
+ }
+ }
+#endif
+
do
{
if (xverb==0)
@@ -261,7 +270,16 @@ FreshInput:
debugger_has_stepped_back = false;
window[VIEW_LOCALS].changed = true;
#endif
- if (!playback)
+#if defined (GLK)
+ if (_savegameSlot != -1) {
+ // Trigger a "look" command so that players will get some initial text
+ // after loading a savegame directly from the launcher
+ _savegameSlot = -1;
+ strcpy(buffer, "look");
+ }
+ else
+#endif
+ if (!playback)
{
GetCommand();
}
diff --git a/engines/glk/hugo/hugo.cpp b/engines/glk/hugo/hugo.cpp
index c15a843fbf..cd4660d0ef 100644
--- a/engines/glk/hugo/hugo.cpp
+++ b/engines/glk/hugo/hugo.cpp
@@ -21,6 +21,7 @@
*/
#include "glk/hugo/hugo.h"
+#include "common/config-manager.h"
namespace Glk {
namespace Hugo {
@@ -116,6 +117,9 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam
// heset
game_title[0] = '\0';
+ // Miscellaneous
+ _savegameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
+
#ifdef DEBUGGER
debug_line[0] = '\0';
Common::fill(&objectname[0], &objectname[MAX_OBJECT], (char *)nullptr);
diff --git a/engines/glk/hugo/hugo.h b/engines/glk/hugo/hugo.h
index 882917c38a..f2d83b895b 100644
--- a/engines/glk/hugo/hugo.h
+++ b/engines/glk/hugo/hugo.h
@@ -39,6 +39,7 @@ namespace Hugo {
*/
class Hugo : public GlkAPI, public HTokens, public StringFunctions {
private:
+ int _savegameSlot;
winid_t mainwin, currentwin;
winid_t secondwin, auxwin;
bool runtime_warnings;