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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Sat Jan 8 13:34:41 CET 2011


Revision: 55164
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55164&view=rev
Author:   bgk
Date:     2011-01-08 12:34:41 +0000 (Sat, 08 Jan 2011)

Log Message:
-----------
MOHAWK: Changed Myst intro stack to behave like the original. ie fully skippable intro.

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/myst.cpp
    scummvm/trunk/engines/mohawk/myst.h
    scummvm/trunk/engines/mohawk/myst_areas.cpp
    scummvm/trunk/engines/mohawk/myst_areas.h
    scummvm/trunk/engines/mohawk/myst_stacks/demo.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/demo.h
    scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/intro.h

Modified: scummvm/trunk/engines/mohawk/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst.cpp	2011-01-08 12:28:47 UTC (rev 55163)
+++ scummvm/trunk/engines/mohawk/myst.cpp	2011-01-08 12:34:41 UTC (rev 55164)
@@ -292,7 +292,6 @@
 
 	// Set the cursor
 	_cursor->setCursor(_currentCursor);
-	_cursor->showCursor();
 
 	Common::Event event;
 	while (!shouldQuit()) {
@@ -371,6 +370,40 @@
 	return Common::kNoError;
 }
 
+bool MohawkEngine_Myst::skippableWait(uint32 duration) {
+	uint32 end = _system->getMillis() + duration;
+	bool skipped = false;
+
+	while (_system->getMillis() < end && !skipped) {
+		Common::Event event;
+		while (_system->getEventManager()->pollEvent(event)) {
+			switch (event.type) {
+			case Common::EVENT_LBUTTONUP:
+				skipped = true;
+				break;
+			case Common::EVENT_KEYDOWN:
+				switch (event.kbd.keycode) {
+				case Common::KEYCODE_SPACE:
+					pauseGame();
+					break;
+				case Common::KEYCODE_ESCAPE:
+					skipped = true;
+					break;
+				default:
+					break;
+			}
+			default:
+				break;
+			}
+		}
+
+		// Cut down on CPU usage
+		_system->delayMillis(10);
+	}
+
+	return skipped;
+}
+
 void MohawkEngine_Myst::changeToStack(uint16 stack, uint16 card, uint16 linkSrcSound, uint16 linkDstSound) {
 	debug(2, "changeToStack(%d)", stack);
 

Modified: scummvm/trunk/engines/mohawk/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst.h	2011-01-08 12:28:47 UTC (rev 55163)
+++ scummvm/trunk/engines/mohawk/myst.h	2011-01-08 12:34:41 UTC (rev 55164)
@@ -162,6 +162,7 @@
 	uint16 getMainCursor() { return _mainCursor; }
 	void checkCursorHints();
 	MystResource *updateCurrentResource();
+	bool skippableWait(uint32 duration);
 
 	MystVar *_varStore;
 

Modified: scummvm/trunk/engines/mohawk/myst_areas.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.cpp	2011-01-08 12:28:47 UTC (rev 55163)
+++ scummvm/trunk/engines/mohawk/myst_areas.cpp	2011-01-08 12:34:41 UTC (rev 55164)
@@ -216,6 +216,16 @@
 		playMovie();
 }
 
+bool MystResourceType6::isPlaying() {
+	if (_videoRunning) {
+		VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+		if (handle != NULL_VID_HANDLE)
+			return !_vm->_video->endOfVideo(handle);
+	}
+
+	return false;
+}
+
 MystResourceType7::MystResourceType7(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResource(vm, rlstStream, parent) {
 	_var7 = rlstStream->readUint16LE();
 	_numSubResources = rlstStream->readUint16LE();

Modified: scummvm/trunk/engines/mohawk/myst_areas.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.h	2011-01-08 12:28:47 UTC (rev 55163)
+++ scummvm/trunk/engines/mohawk/myst_areas.h	2011-01-08 12:34:41 UTC (rev 55164)
@@ -106,6 +106,7 @@
 	MystResourceType6(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent);
 	void playMovie();
 	void handleCardChange();
+	bool isPlaying();
 
 protected:
 	static Common::String convertMystVideoName(Common::String name);

Modified: scummvm/trunk/engines/mohawk/myst_stacks/demo.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/demo.cpp	2011-01-08 12:28:47 UTC (rev 55163)
+++ scummvm/trunk/engines/mohawk/myst_stacks/demo.cpp	2011-01-08 12:34:41 UTC (rev 55164)
@@ -49,6 +49,7 @@
 
 void MystScriptParser_Demo::setupOpcodes() {
 	// "Stack-Specific" Opcodes
+	OVERRIDE_OPCODE(100, opcode_100);
 	OPCODE(101, opcode_101);
 	OPCODE(102, opcode_102);
 
@@ -78,6 +79,10 @@
 	}
 }
 
+void MystScriptParser_Demo::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	// TODO: Fill in Function...
+}
+
 void MystScriptParser_Demo::opcode_101(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	varUnusedCheck(op, var);
 

Modified: scummvm/trunk/engines/mohawk/myst_stacks/demo.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/demo.h	2011-01-08 12:28:47 UTC (rev 55163)
+++ scummvm/trunk/engines/mohawk/myst_stacks/demo.h	2011-01-08 12:34:41 UTC (rev 55164)
@@ -48,6 +48,7 @@
 private:
 	void setupOpcodes();
 
+	DECLARE_OPCODE(opcode_100);
 	DECLARE_OPCODE(opcode_101);
 	DECLARE_OPCODE(opcode_102);
 

Modified: scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp	2011-01-08 12:28:47 UTC (rev 55163)
+++ scummvm/trunk/engines/mohawk/myst_stacks/intro.cpp	2011-01-08 12:34:41 UTC (rev 55164)
@@ -50,18 +50,25 @@
 
 	// "Init" Opcodes
 	OPCODE(200, o_playIntroMovies);
-	OPCODE(201, opcode_201);
+	OPCODE(201, o_mystLinkBook_init);
 
 	// "Exit" Opcodes
-	OPCODE(300, opcode_300);
+	OPCODE(300, NOP);
 }
 
 #undef OPCODE
 
 void MystScriptParser_Intro::disablePersistentScripts() {
+	_introMoviesRunning = false;
+	_linkBookRunning = false;
 }
 
 void MystScriptParser_Intro::runPersistentScripts() {
+	if (_introMoviesRunning)
+		introMovies_run();
+
+	if (_linkBookRunning)
+		mystLinkBook_run();
 }
 
 uint16 MystScriptParser_Intro::getVar(uint16 var) {
@@ -89,54 +96,77 @@
 	_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) {
-	varUnusedCheck(op, var);
+void MystScriptParser_Intro::introMovies_run() {
+	// Play Intro Movies..
+	if (_introStep == 0) {
+		_introStep = 1;
 
-	// TODO:  Clicking during the intro movies does not stop them and change to Card 5.
-	//        This is due to the movies playing blocking, but making them non-blocking causes
-	//        the card change here to prevent them playing. Need to move the following to the
-	//        opcode_200_run process and wait for all movies to finish playing before the card
-	//        change is performed.
+		if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh) {
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("mattel", kIntroStack));
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("presto", kIntroStack));
+		} else
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("broder", kIntroStack));
+	} else if (_introStep == 1) {
+		VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+		if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle))
+			_introStep = 2;
+	} else if (_introStep == 2) {
+		_introStep = 3;
 
-	// Play Intro Movies..
-	if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh) {
-		_vm->_video->playMovieCentered(_vm->wrapMovieFilename("mattel", kIntroStack));
-		_vm->_video->playMovieCentered(_vm->wrapMovieFilename("presto", kIntroStack));
-	} else
-		_vm->_video->playMovieCentered(_vm->wrapMovieFilename("broder", kIntroStack));
+		_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("cyanlogo", kIntroStack));
+	} else if (_introStep == 3) {
+		VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+		if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle))
+			_introStep = 4;
+	}  else if (_introStep == 4) {
+		_introStep = 5;
 
-	_vm->_video->playMovieCentered(_vm->wrapMovieFilename("cyanlogo", kIntroStack));
-
-	if (!(_vm->getFeatures() & GF_DEMO)) { // The demo doesn't have the intro video
-		if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh)
-			// intro.mov uses Sorenson, introc uses Cinepak. Otherwise, they're the same.
-			_vm->_video->playMovieCentered(_vm->wrapMovieFilename("introc", kIntroStack));
-		else
-			_vm->_video->playMovieCentered(_vm->wrapMovieFilename("intro", kIntroStack));
+		if (!(_vm->getFeatures() & GF_DEMO)) { // The demo doesn't have the intro video
+			if ((_vm->getFeatures() & GF_ME) && _vm->getPlatform() == Common::kPlatformMacintosh)
+				// intro.mov uses Sorenson, introc uses Cinepak. Otherwise, they're the same.
+				_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("introc", kIntroStack));
+			else
+				_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("intro", kIntroStack));
+		}
+	} else if (_introStep == 5) {
+		VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+		if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle))
+			_introStep = 6;
+	} else {
+		if (_vm->getFeatures() & GF_DEMO) {
+			_vm->changeToCard(2001, true);
+		} else {
+			_vm->changeToCard(2, true);
+		}
 	}
+}
 
-	_vm->changeToCard(2, true);
+void MystScriptParser_Intro::o_playIntroMovies(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	_introMoviesRunning = true;
+	_introStep = 0;
 }
 
-void MystScriptParser_Intro::opcode_201(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser_Intro::mystLinkBook_run() {
+	if (_startTime == 1) {
+		_startTime = 0;
 
-	_vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
-	_vm->_system->updateScreen();
-	_vm->_system->delayMillis(4 * 1000);
-	_vm->_gfx->copyImageToBackBuffer(4, Common::Rect(544, 333));
-	_vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
-	_vm->_system->updateScreen();
-
-	MystResourceType6 *resource = static_cast<MystResourceType6 *>(_invokingResource);
-	resource->playMovie();
-	// TODO: Complete / Fix
+		if (!_vm->skippableWait(5000)) {
+			_linkBookMovie->playMovie();
+			_vm->_gfx->copyImageToBackBuffer(4, Common::Rect(544, 333));
+			_vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
+		}
+	} else {
+		if (!_linkBookMovie->isPlaying())
+			_vm->changeToCard(5, true);
+	}
 }
 
-void MystScriptParser_Intro::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-	// In the original engine, this opcode stopped Intro Movies if playing,
-	// upon card change, but this behavior is now default in this engine.
+void MystScriptParser_Intro::o_mystLinkBook_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Myst link book init", op);
+
+	_linkBookMovie = static_cast<MystResourceType6 *>(_invokingResource);
+	_startTime = 1;
+	_linkBookRunning = true;
 }
 
 } // End of namespace Mohawk

Modified: scummvm/trunk/engines/mohawk/myst_stacks/intro.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/intro.h	2011-01-08 12:28:47 UTC (rev 55163)
+++ scummvm/trunk/engines/mohawk/myst_stacks/intro.h	2011-01-08 12:34:41 UTC (rev 55164)
@@ -35,6 +35,7 @@
 #define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, uint16 argc, uint16 *argv)
 
 class MohawkEngine_Myst;
+class MystResourceType6;
 struct MystScriptEntry;
 
 class MystScriptParser_Intro : public MystScriptParser {
@@ -52,9 +53,16 @@
 	DECLARE_OPCODE(o_useLinkBook);
 
 	DECLARE_OPCODE(o_playIntroMovies);
-	DECLARE_OPCODE(opcode_201);
+	DECLARE_OPCODE(o_mystLinkBook_init);
 
-	DECLARE_OPCODE(opcode_300);
+	void introMovies_run();
+	void mystLinkBook_run();
+
+	bool _introMoviesRunning;
+	uint16 _introStep;
+
+	bool _linkBookRunning;
+	MystResourceType6 *_linkBookMovie;
 };
 
 } // End of namespace Mohawk


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