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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Tue Aug 24 11:00:54 CEST 2010


Revision: 52318
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52318&view=rev
Author:   m_kiewitz
Date:     2010-08-24 09:00:53 +0000 (Tue, 24 Aug 2010)

Log Message:
-----------
SCI: now pausing/unpausing music in replaced restore dialog

dialog will not get replaced in sci32, nor in mother goose. Enable by adding "scireplacedialog" inside scummvm section of scummvm.ini file. Note: this feature is experimental

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

Modified: scummvm/trunk/engines/sci/engine/kfile.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kfile.cpp	2010-08-24 08:31:57 UTC (rev 52317)
+++ scummvm/trunk/engines/sci/engine/kfile.cpp	2010-08-24 09:00:53 UTC (rev 52318)
@@ -632,6 +632,7 @@
 reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
 	Common::String game_id = !argv[0].isNull() ? s->_segMan->getString(argv[0]) : "";
 	int16 savegameId = argv[1].toSint16();
+	bool pausedMusic = false;
 
 	debug(3, "kRestoreGame(%s,%d)", game_id.c_str(), savegameId);
 
@@ -639,14 +640,18 @@
 		// Direct call, either from launcher or from a patched Game::restore call
 		if (savegameId == -1) {
 			// we are supposed to show a dialog for the user and let him choose a saved game
+			g_sci->_soundCmd->pauseAll(true); // pause music
 			const EnginePlugin *plugin = NULL;
 			EngineMan.findGame(g_sci->getGameIdStr(), &plugin);
 			GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore");
 			dialog->setSaveMode(false);
 			savegameId = dialog->runModal(plugin, ConfMan.getActiveDomainName());
 			delete dialog;
-			if (savegameId < 0)
+			if (savegameId < 0) {
+				g_sci->_soundCmd->pauseAll(false); // unpause music
 				return s->r_acc;
+			}
+			pausedMusic = true;
 		}
 		// don't adjust ID of the saved game, it's already correct
 	} else {
@@ -658,34 +663,41 @@
 		savegameId -= SAVEGAMEID_OFFICIALRANGE_START;
 	}
 
+	s->r_acc = NULL_REG; // signals success
+
 	Common::Array<SavegameDesc> saves;
 	listSavegames(saves);
 	if (findSavegame(saves, savegameId) == -1) {
+		s->r_acc = TRUE_REG;
 		warning("Savegame ID %d not found", savegameId);
-		return TRUE_REG;
-	}
+	} else {
+		Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
+		Common::String filename = g_sci->getSavegameName(savegameId);
+		Common::SeekableReadStream *in;
+		if ((in = saveFileMan->openForLoading(filename))) {
+			// found a savegame file
 
-	Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
-	Common::String filename = g_sci->getSavegameName(savegameId);
-	Common::SeekableReadStream *in;
-	if ((in = saveFileMan->openForLoading(filename))) {
-		// found a savegame file
+			gamestate_restore(s, in);
+			delete in;
 
-		gamestate_restore(s, in);
-		delete in;
-
-		if (g_sci->getGameId() == GID_MOTHERGOOSE256) {
-			// WORKAROUND: Mother Goose SCI1/SCI1.1 does some weird things for
-			//  saving a previously restored game.
-			// We set the current savedgame-id directly and remove the script
-			//  code concerning this via script patch.
-			s->variables[VAR_GLOBAL][0xB3].offset = SAVEGAMEID_OFFICIALRANGE_START + savegameId;
+			if (g_sci->getGameId() == GID_MOTHERGOOSE256) {
+				// WORKAROUND: Mother Goose SCI1/SCI1.1 does some weird things for
+				//  saving a previously restored game.
+				// We set the current savedgame-id directly and remove the script
+				//  code concerning this via script patch.
+				s->variables[VAR_GLOBAL][0xB3].offset = SAVEGAMEID_OFFICIALRANGE_START + savegameId;
+			}
+		} else {
+			s->r_acc = TRUE_REG;
+			warning("Savegame #%d not found", savegameId);
 		}
-		return s->r_acc;
 	}
 
-	s->r_acc = TRUE_REG;
-	warning("Savegame #%d not found", savegameId);
+	if (!s->r_acc.isNull()) {
+		// no success?
+		if (pausedMusic)
+			g_sci->_soundCmd->pauseAll(false); // unpause music
+	}
 
 	return s->r_acc;
 }

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-08-24 08:31:57 UTC (rev 52317)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-08-24 09:00:53 UTC (rev 52318)
@@ -708,7 +708,7 @@
 	sync_SavegameMetadata(ser, meta);
 
 	if (fh->eos()) {
-		s->r_acc = make_reg(0, 1);	// signal failure
+		s->r_acc = TRUE_REG;	// signal failure
 		return;
 	}
 
@@ -723,7 +723,7 @@
 
 		showScummVMDialog("The format of this saved game is obsolete, unable to load it");
 
-		s->r_acc = make_reg(0, 1);	// signal failure
+		s->r_acc = TRUE_REG;	// signal failure
 		return;
 	}
 
@@ -734,7 +734,7 @@
 
 			showScummVMDialog("This saved game was created with a different version of the game, unable to load it");
 
-			s->r_acc = make_reg(0, 1);	// signal failure
+			s->r_acc = TRUE_REG;	// signal failure
 			return;
 		}
 	}

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-08-24 08:31:57 UTC (rev 52317)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-08-24 09:00:53 UTC (rev 52318)
@@ -347,9 +347,21 @@
 	const uint16 kernelCount = _kernel->getKernelNamesSize();
 	byte kernelIdRestore = 0;
 
-	// DISABLE NEXT LINE FOR REPLACING SIERRA GAME RESTORE DIALOG WITH SCUMMVM RESTORE
-	return;
+	// this feature is currently not supported on SCI32
+	if (getSciVersion() >= SCI_VERSION_2)
+		return;
 
+	switch (_gameId) {
+	case GID_MOTHERGOOSE256: // mother goose saves/restores directly and has no save/restore dialogs
+		return;
+	default:
+		break;
+	}
+
+	Common::String replaceDialogOption = ConfMan.get("scireplacedialog", Common::ConfigManager::kApplicationDomain);
+	if (replaceDialogOption == "")
+		return;
+
 	for (uint16 kernelNr = 0; kernelNr < kernelCount; kernelNr++) {
 		Common::String kernelName = _kernel->getKernelName(kernelNr);
 		if (kernelName == "RestoreGame")


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