[Scummvm-cvs-logs] SF.net SVN: scummvm:[47726] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jan 30 20:08:01 CET 2010


Revision: 47726
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47726&view=rev
Author:   fingolfin
Date:     2010-01-30 19:08:00 +0000 (Sat, 30 Jan 2010)

Log Message:
-----------
SCI: Don't mess with save_slot just to be able to decide whether we already honored a load request or not

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-01-30 19:06:24 UTC (rev 47725)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-01-30 19:08:00 UTC (rev 47726)
@@ -46,6 +46,7 @@
 //#define VM_DEBUG_SEND
 
 ScriptState scriptState;	// FIXME: Avoid non-const global vars
+int g_loadFromLauncher;	// FIXME: Avoid non-const global vars
 
 int script_abort_flag = 0; // Set to 1 to abort execution. Set to 2 to force a replay afterwards	// FIXME: Avoid non-const global vars
 int script_step_counter = 0; // Counts the number of steps executed	// FIXME: Avoid non-const global vars
@@ -543,11 +544,6 @@
 	reg_t r_temp; // Temporary register
 	StackPtr s_temp; // Temporary stack pointer
 	int16 opparams[4]; // opcode parameters
-	bool loadFromLauncher = ConfMan.hasKey("save_slot") ? true : false;
-	if (loadFromLauncher) {
-		if (ConfMan.getInt("save_slot") < 0)
-			loadFromLauncher = false;	// already loaded
-	}
 
 	scriptState.restAdjust = s->restAdjust;
 	// &rest adjusts the parameter count by this value
@@ -1042,13 +1038,11 @@
 						//warning("callk %s", kfun.orig_name.c_str());
 
 						// TODO: SCI2/SCI2.1+ equivalent, once saving/loading works in SCI2/SCI2.1+
-						if (loadFromLauncher && opparams[0] == 0x8) {
+						if (g_loadFromLauncher >= 0 && opparams[0] == 0x8) {
 							// A game is being loaded from the launcher, and kDisplay is called, all initialization has taken
 							// place (i.e. menus have been constructed etc). Therefore, inject a kRestoreGame call
 							// here, instead of the requested function.
-							int saveSlot = ConfMan.getInt("save_slot");
-							ConfMan.setInt("save_slot", -1);	// invalidate slot
-							loadFromLauncher = false;
+							int saveSlot = g_loadFromLauncher;
 
 							if (saveSlot < 0)
 								error("Requested to load invalid save slot");	// should never happen, really

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-01-30 19:06:24 UTC (rev 47725)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-01-30 19:08:00 UTC (rev 47726)
@@ -50,6 +50,8 @@
 
 namespace Sci {
 
+extern int g_loadFromLauncher;
+
 class GfxDriver;
 
 SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc)
@@ -215,6 +217,13 @@
 
 	debug("Emulating SCI version %s\n", getSciVersionDesc(getSciVersion()).c_str());
 
+	// Check whether loading a savestate was requested
+	if (ConfMan.hasKey("save_slot")) {
+		g_loadFromLauncher = ConfMan.getInt("save_slot");
+	} else {
+		g_loadFromLauncher = -1;
+	}
+
 	game_run(&_gamestate); // Run the game
 
 	game_exit(_gamestate);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list