[Scummvm-cvs-logs] SF.net SVN: scummvm:[55152] scummvm/trunk/engines/mohawk

bgk at users.sourceforge.net bgk at users.sourceforge.net
Fri Jan 7 20:26:31 CET 2011


Revision: 55152
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55152&view=rev
Author:   bgk
Date:     2011-01-07 19:26:31 +0000 (Fri, 07 Jan 2011)

Log Message:
-----------
MOHAWK: Merge Myst intro opcode 100 with generic opcode 40 into engine method changeStack

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/console.cpp
    scummvm/trunk/engines/mohawk/myst.cpp
    scummvm/trunk/engines/mohawk/myst.h
    scummvm/trunk/engines/mohawk/myst_scripts.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp
    scummvm/trunk/engines/mohawk/myst_state.cpp

Modified: scummvm/trunk/engines/mohawk/console.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/console.cpp	2011-01-07 18:25:38 UTC (rev 55151)
+++ scummvm/trunk/engines/mohawk/console.cpp	2011-01-07 19:26:31 UTC (rev 55152)
@@ -152,13 +152,14 @@
 	// as the next card could continue playing it if it.
 	_vm->_sound->stopSound();
 
-	_vm->changeToStack(stackNum - 1);
-
+	uint16 card = 0;
 	if (argc == 3)
-		_vm->changeToCard((uint16)atoi(argv[2]), true);
+		card = (uint16)atoi(argv[2]);
 	else
-		_vm->changeToCard(default_start_card[stackNum - 1], true);
+		card = default_start_card[stackNum - 1];
 
+	_vm->changeToStack(stackNum - 1, card, 0, 0);
+
 	return false;
 }
 

Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp	2011-01-07 18:25:38 UTC (rev 55151)
+++ scummvm/trunk/engines/mohawk/myst.cpp	2011-01-07 19:26:31 UTC (rev 55152)
@@ -272,16 +272,11 @@
 	} else {
 		// Start us on the first stack.
 		if (getGameType() == GType_MAKINGOF)
-			changeToStack(kMakingOfStack);
+			changeToStack(kMakingOfStack, 1, 0, 0);
 		else if (getFeatures() & GF_DEMO)
-			changeToStack(kDemoStack);
+			changeToStack(kDemoStack, 2000, 0, 0);
 		else
-			changeToStack(kIntroStack);
-	
-		if (getFeatures() & GF_DEMO)
-			changeToCard(2000, true);
-		else
-			changeToCard(1, true);
+			changeToStack(kIntroStack, 1, 0, 0);
 	}
 
 	// Load Help System (Masterpiece Edition Only)
@@ -376,11 +371,16 @@
 	return Common::kNoError;
 }
 
-void MohawkEngine_Myst::changeToStack(uint16 stack) {
+void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound) {
 	debug(2, "changeToStack(%d)", stack);
 
 	_curStack = stack;
 
+	_sound->stopSound();
+	_sound->stopBackground();
+	if (linkSrcSound)
+		_sound->playSoundBlocking(linkSrcSound);
+
 	// Delete the previous stack and move the current stack to the previous one
 	// There's probably a better way to do this, but the script classes shouldn't
 	// take up much memory.
@@ -454,7 +454,57 @@
 	// Clear the resource cache and the image cache
 	_cache.clear();
 	_gfx->clearCache();
-	_sound->stopBackground();
+
+	// Play Flyby Entry Movie on Masterpiece Edition. The Macintosh version is currently hooked
+	// up to the Cinepak versions of the video (the 'c' suffix) until the SVQ1 decoder is completed.
+	const char *flyby = 0;
+	if (getFeatures() & GF_ME) {
+		switch (_curStack) {
+		case kSeleniticStack:
+			if (getPlatform() == Common::kPlatformMacintosh)
+				flyby = "FLY_SEc";
+			else
+				flyby = "selenitic flyby";
+			break;
+		case kStoneshipStack:
+			if (getPlatform() == Common::kPlatformMacintosh)
+				flyby = "FLY_STc";
+			else
+				flyby = "stoneship flyby";
+			break;
+		// Myst Flyby Movie not used in Original Masterpiece Edition Engine
+		case kMystStack:
+			if (_tweaksEnabled) {
+				if (getPlatform() == Common::kPlatformMacintosh)
+					flyby = "FLY_MYc";
+				else
+					flyby = "myst flyby";
+			}
+			break;
+		case kMechanicalStack:
+			if (getPlatform() == Common::kPlatformMacintosh)
+				flyby = "FLY_MEc";
+			else
+				flyby = "mech age flyby";
+			break;
+		case kChannelwoodStack:
+			if (getPlatform() == Common::kPlatformMacintosh)
+				flyby = "FLY_CHc";
+			else
+				flyby = "channelwood flyby";
+			break;
+		default:
+			break;
+		}
+
+		if (flyby)
+			_video->playMovieCentered(wrapMovieFilename(flyby, kMasterpieceOnly));
+	}
+
+	changeToCard(card, true);
+
+	if (linkDstSound)
+		_sound->playSoundBlocking(linkDstSound);
 }
 
 uint16 MohawkEngine_Myst::getCardBackgroundId() {

Modified: scummvm/trunk/engines/mohawk/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst.h	2011-01-07 18:25:38 UTC (rev 55151)
+++ scummvm/trunk/engines/mohawk/myst.h	2011-01-07 19:26:31 UTC (rev 55152)
@@ -154,7 +154,7 @@
 	void runLoadDialog();
 	void runSaveDialog();
 
-	void changeToStack(uint16 stack);
+	void changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound);
 	void changeToCard(uint16 card, bool updateScreen);
 	uint16 getCurCard() { return _curCard; }
 	uint16 getCurStack() { return _curStack; }

Modified: scummvm/trunk/engines/mohawk/myst_scripts.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts.cpp	2011-01-07 18:25:38 UTC (rev 55151)
+++ scummvm/trunk/engines/mohawk/myst_scripts.cpp	2011-01-07 19:26:31 UTC (rev 55152)
@@ -203,7 +203,7 @@
 		MystScriptEntry &entry = script->operator[](i);
 		entry.type = type;
 
-		// u0 only exists in INIT and EXIT scripts
+		// Resource ID only exists in INIT and EXIT scripts
 		if (type != kMystScriptNormal)
 			entry.resourceId = stream->readUint16LE();
 
@@ -827,63 +827,27 @@
 }
 
 void MystScriptParser::o_changeStack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	Audio::SoundHandle *handle;
-	varUnusedCheck(op, var);
+	debugC(kDebugScript, "Opcode %d: changeStack", op);
 
-	if (argc == 3) {
-		debugC(kDebugScript, "Opcode %d: changeStack", op);
+	uint16 targetStack = argv[0];
+	uint16 soundIdLinkSrc = argv[1];
+	uint16 soundIdLinkDst = argv[2];
 
-		uint16 targetStack = argv[0];
-		uint16 soundIdLinkSrc = argv[1];
-		uint16 soundIdLinkDst = argv[2];
+	debugC(kDebugScript, "\tTarget Stack: %d", targetStack);
+	debugC(kDebugScript, "\tSource Stack Link Sound: %d", soundIdLinkSrc);
+	debugC(kDebugScript, "\tDestination Stack Link Sound: %d", soundIdLinkDst);
 
-		debugC(kDebugScript, "\tTarget Stack: %d", targetStack);
-		debugC(kDebugScript, "\tSource Stack Link Sound: %d", soundIdLinkSrc);
-		debugC(kDebugScript, "\tDestination Stack Link Sound: %d", soundIdLinkDst);
+	_vm->_sound->stopSound();
 
-		_vm->_sound->stopSound();
-
-		if (_vm->getFeatures() & GF_DEMO) {
-
-			// The demo has linking sounds too for this, but it just sounds completely
-			// wrong as you're not actually linking when using this opcode. The sounds are only
-			// played for the full game linking.
-			if (!_vm->_tweaksEnabled) {
-				handle= _vm->_sound->replaceSound(soundIdLinkSrc);
-				while (_vm->_mixer->isSoundHandleActive(*handle))
-					_vm->_system->delayMillis(10);
-			}
-
-			// No need to have a table for just this data...
-			if (targetStack == 1) {
-				_vm->changeToStack(kDemoSlidesStack);
-				_vm->changeToCard(1000, true);
-			} else if (targetStack == 2) {
-				_vm->changeToStack(kDemoPreviewStack);
-				_vm->changeToCard(3000, true);
-			}
-
-			if (!_vm->_tweaksEnabled) {
-				handle = _vm->_sound->replaceSound(soundIdLinkDst);
-				while (_vm->_mixer->isSoundHandleActive(*handle))
-					_vm->_system->delayMillis(10);
-			}
-		} else {
-			handle = _vm->_sound->replaceSound(soundIdLinkSrc);
-			while (_vm->_mixer->isSoundHandleActive(*handle))
-				_vm->_system->delayMillis(10);
-
-			// TODO: Play Flyby Entry Movie on Masterpiece Edition..? Only on Myst to Age Link?
-
-			_vm->changeToStack(_stackMap[targetStack]);
-			_vm->changeToCard(_startCard[targetStack], true);
-
-			handle = _vm->_sound->replaceSound(soundIdLinkDst);
-			while (_vm->_mixer->isSoundHandleActive(*handle))
-				_vm->_system->delayMillis(10);
-		}
-	} else
-		unknown(op, var, argc, argv);
+	if (_vm->getFeatures() & GF_DEMO) {
+		// No need to have a table for just this data...
+		if (targetStack == 1)
+			_vm->changeToStack(kDemoSlidesStack, 1000, soundIdLinkSrc, soundIdLinkDst);
+		else if (targetStack == 2)
+			_vm->changeToStack(kDemoPreviewStack, 3000, soundIdLinkSrc, soundIdLinkDst);
+	} else {
+		_vm->changeToStack(_stackMap[targetStack], _startCard[targetStack], soundIdLinkSrc, soundIdLinkDst);
+	}
 }
 
 void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, uint16 argc, uint16 *argv) {

Modified: scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp	2011-01-07 18:25:38 UTC (rev 55151)
+++ scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp	2011-01-07 19:26:31 UTC (rev 55152)
@@ -67,7 +67,10 @@
 uint16 MystScriptParser_Intro::getVar(uint16 var) {
 	switch(var) {
 	case 0:
-		return _vm->_gameState->_globals.currentAge;
+		if (_globals.currentAge == 9 || _globals.currentAge == 10)
+			return 2;
+		else
+			return _globals.currentAge;
 	default:
 		return MystScriptParser::getVar(var);
 	}
@@ -77,68 +80,13 @@
 	// Hard coded SoundId valid only for Intro Stack.
 	// Other stacks use Opcode 40, which takes SoundId values as arguments.
 	const uint16 soundIdLinkSrc = 5;
+	const uint16 soundIdLinkDst[] = { 2282, 3029, 6396, 7122, 3137, 0, 9038, 5134, 0, 4739, 4741 };
 
 	debugC(kDebugScript, "Opcode %d: o_useLinkBook", op);
 	debugC(kDebugScript, "\tvar: %d", var);
 
-	// TODO: Merge with changeStack (Opcode 40) Implementation?
-	if (getVar(var) == 5 || getVar(var) > 7) {
-		// TODO: Dead Book i.e. Released Sirrus/Achenar
-	} else {
-		// Play Linking Sound, blocking...
-		_vm->_sound->stopSound();
-		Audio::SoundHandle *handle = _vm->_sound->replaceSound(soundIdLinkSrc);
-		while (_vm->_mixer->isSoundHandleActive(*handle))
-			_vm->_system->delayMillis(10);
-
-		// Play Flyby Entry Movie on Masterpiece Edition. The Macintosh version is currently hooked
-		// up to the Cinepak versions of the video (the 'c' suffix) until the SVQ1 decoder is completed.
-		if ((_vm->getFeatures() & GF_ME)) {
-			switch (_stackMap[getVar(var)]) {
-			case kSeleniticStack:
-				if (_vm->getPlatform() == Common::kPlatformMacintosh)
-					_vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_SEc", kMasterpieceOnly));
-				else
-					_vm->_video->playMovieCentered(_vm->wrapMovieFilename("selenitic flyby", kMasterpieceOnly));
-				break;
-			case kStoneshipStack:
-				if (_vm->getPlatform() == Common::kPlatformMacintosh)
-					_vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_STc", kMasterpieceOnly));
-				else
-					_vm->_video->playMovieCentered(_vm->wrapMovieFilename("stoneship flyby", kMasterpieceOnly));
-				break;
-			// Myst Flyby Movie not used in Original Masterpiece Edition Engine
-			case kMystStack:
-				if (_vm->_tweaksEnabled) {
-					if (_vm->getPlatform() == Common::kPlatformMacintosh)
-						_vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_MYc", kMasterpieceOnly));
-					else
-						_vm->_video->playMovieCentered(_vm->wrapMovieFilename("myst flyby", kMasterpieceOnly));
-				}
-				break;
-			case kMechanicalStack:
-				if (_vm->getPlatform() == Common::kPlatformMacintosh)
-					_vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_MEc", kMasterpieceOnly));
-				else
-					_vm->_video->playMovieCentered(_vm->wrapMovieFilename("mech age flyby", kMasterpieceOnly));
-				break;
-			case kChannelwoodStack:
-				if (_vm->getPlatform() == Common::kPlatformMacintosh)
-					_vm->_video->playMovieCentered(_vm->wrapMovieFilename("FLY_CHc", kMasterpieceOnly));
-				else
-					_vm->_video->playMovieCentered(_vm->wrapMovieFilename("channelwood flyby", kMasterpieceOnly));
-				break;
-			default:
-				break;
-			}
-		}
-
-		uint16 varValue = getVar(var);
-		_vm->changeToStack(_stackMap[varValue]);
-		_vm->changeToCard(_startCard[varValue], true);
-
-		// TODO: No soundIdLinkDst for Opcode 100 link? Check Original.
-	}
+	// Change to dest stack
+	_vm->changeToStack(_stackMap[_globals.currentAge], _startCard[_globals.currentAge], soundIdLinkSrc, soundIdLinkDst[_globals.currentAge]);
 }
 
 void MystScriptParser_Intro::o_playIntroMovies(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -167,7 +115,7 @@
 			_vm->_video->playMovieCentered(_vm->wrapMovieFilename("intro", kIntroStack));
 	}
 
-	_vm->changeToCard(_vm->getCurCard() + 1, true);
+	_vm->changeToCard(2, true);
 }
 
 void MystScriptParser_Intro::opcode_201(uint16 op, uint16 var, uint16 argc, uint16 *argv) {

Modified: scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp	2011-01-07 18:25:38 UTC (rev 55151)
+++ scummvm/trunk/engines/mohawk/myst_stacks/slides.cpp	2011-01-07 19:26:31 UTC (rev 55152)
@@ -68,9 +68,7 @@
 }
 
 void MystScriptParser_Slides::o_returnToMenu(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	// TODO: Change to changeStack call?
-	_vm->changeToStack(kDemoStack);
-	_vm->changeToCard(2001, true);
+	_vm->changeToStack(kDemoStack, 2001, 0, 0);
 }
 
 void MystScriptParser_Slides::o_setCardSwap(uint16 op, uint16 var, uint16 argc, uint16 *argv) {

Modified: scummvm/trunk/engines/mohawk/myst_state.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_state.cpp	2011-01-07 18:25:38 UTC (rev 55151)
+++ scummvm/trunk/engines/mohawk/myst_state.cpp	2011-01-07 19:26:31 UTC (rev 55152)
@@ -97,9 +97,6 @@
 	syncGameState(s, size == 664);
 	delete loadFile;
 
-	// Switch us back to the intro stack
-	_vm->changeToStack(kIntroStack);
-
 	// Set our default cursor
 	if (_globals.heldPage == 0 || _globals.heldPage > 13)
 		_vm->setMainCursor(kDefaultMystCursor);
@@ -110,8 +107,8 @@
 	else // if (globals.heldPage == 13)
 		_vm->setMainCursor(kWhitePageCursor);
 
-	// Set us to the linking book
-	_vm->changeToCard(5, true);
+	// Switch us back to the intro stack, to the linking book
+	_vm->changeToStack(kIntroStack, 5, 0, 0);
 
 	return true;
 }


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