[Scummvm-git-logs] scummvm master -> 0325c9315cdeb30d2124fbb9dcc3c36687d34da8

dreammaster paulfgilbert at gmail.com
Thu May 16 05:12:42 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0325c9315c GLK: HUGO: Support loading savegames from launcher


Commit: 0325c9315cdeb30d2124fbb9dcc3c36687d34da8
    https://github.com/scummvm/scummvm/commit/0325c9315cdeb30d2124fbb9dcc3c36687d34da8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-05-15T17:12:27-10:00

Commit Message:
GLK: HUGO: Support loading savegames from launcher

Changed paths:
    engines/glk/hugo/hemisc.cpp
    engines/glk/hugo/herun.cpp
    engines/glk/hugo/hugo.cpp
    engines/glk/hugo/hugo.h


diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp
index 03a62c5..8803050 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 8659544..56e27c5 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 c15a843..cd4660d 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 882917c..f2d83b8 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;





More information about the Scummvm-git-logs mailing list