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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Fri Jan 14 22:42:35 CET 2011


Revision: 55245
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55245&view=rev
Author:   bgk
Date:     2011-01-14 21:42:33 +0000 (Fri, 14 Jan 2011)

Log Message:
-----------
MOHAWK: Implement Atrus videos in D'ni

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/myst_stacks/dni.cpp
    scummvm/trunk/engines/mohawk/myst_stacks/dni.h

Modified: scummvm/trunk/engines/mohawk/myst_stacks/dni.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/dni.cpp	2011-01-14 20:08:27 UTC (rev 55244)
+++ scummvm/trunk/engines/mohawk/myst_stacks/dni.cpp	2011-01-14 21:42:33 UTC (rev 55245)
@@ -46,25 +46,33 @@
 
 void MystScriptParser_Dni::setupOpcodes() {
 	// "Stack-Specific" Opcodes
-	OPCODE(100, opcode_100);
+	OPCODE(100, NOP);
 	OPCODE(101, o_handPage);
 
 	// "Init" Opcodes
 	OPCODE(200, o_atrus_init);
 
 	// "Exit" Opcodes
-	OPCODE(300, opcode_300);
+	OPCODE(300, NOP);
 }
 
 #undef OPCODE
 
 void MystScriptParser_Dni::disablePersistentScripts() {
 	_atrusRunning = false;
+	_waitForLoop = false;
+	_atrusLeft = false;
 }
 
 void MystScriptParser_Dni::runPersistentScripts() {
 	if (_atrusRunning)
 		atrus_run();
+
+	if (_waitForLoop)
+		loopVideo_run();
+
+	if (_atrusLeft)
+		atrusLeft_run();
 }
 
 uint16 MystScriptParser_Dni::getVar(uint16 var) {
@@ -87,46 +95,93 @@
 	}
 }
 
-void MystScriptParser_Dni::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	// Used in Card 5014 (Atrus)
-	debugC(kDebugScript, "Opcode %d: Stop persistent scripts", op);
-	// TODO: Stop persistent scripts
-}
-
 void MystScriptParser_Dni::o_handPage(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Hand page to Atrus", op);
 	// Used in Card 5014 (Atrus)
-	if (_globals.ending == 1) {
+
+	// Find Atrus movie
+	VideoHandle atrus = _vm->_video->findVideoHandle(_video);
+
+	// Good ending and Atrus asked to give page
+	if (_globals.ending == 1 && _vm->_video->getElapsedTime(atrus) > Graphics::VideoTimestamp(6801, 600).getUnitsInScale(1000)) {
 		_globals.ending = 2;
 		_globals.heldPage = 0;
 		_vm->_cursor->setCursor(kDefaultMystCursor);
 
-		// TODO: Complete, play movie end
+		// Play movie end (atrus leaving)
+		_vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(14813, 600), Graphics::VideoTimestamp(0xFFFFFFFF));
+		_vm->_video->setVideoLooping(atrus, false);
+
+		_atrusLeft = true;
+		_waitForLoop = false;
+		_atrusLeftTime = _vm->_system->getMillis();
 	}
 }
 
+void MystScriptParser_Dni::atrusLeft_run() {
+	if (_vm->_system->getMillis() > _atrusLeftTime + 63333) {
+		_video = _vm->wrapMovieFilename("atrus2", kDniStack);
+		VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77);
+		_vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(98000, 600));
+
+		_waitForLoop = true;
+		_loopStart = 73095;
+		_loopEnd = 98000;
+
+		// Good ending
+		_globals.ending = 4;
+		_globals.bluePagesInBook = 63;
+		_globals.redPagesInBook = 63;
+
+		_atrusLeft = false;
+	}
+}
+
+void MystScriptParser_Dni::loopVideo_run() {
+	if (!_vm->_video->isVideoPlaying()) {
+		VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77);
+		_vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(_loopStart, 600), Graphics::VideoTimestamp(_loopEnd, 600));
+		_vm->_video->setVideoLooping(atrus, true);
+
+		_waitForLoop = false;
+	}
+}
+
 void MystScriptParser_Dni::atrus_run() {
 	if (_globals.ending == 2) {
+		// Wait for atrus to come back
+		_atrusLeft = true;
+	} else if (_globals.ending == 1) {
+		// Atrus asking for page
 		if (!_vm->_video->isVideoPlaying()) {
-			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrus2", kDniStack), 215, 77);
-			_globals.ending = 4;
-			_globals.bluePagesInBook = 63;
-			_globals.redPagesInBook = 63;
+			_video = _vm->wrapMovieFilename("atr1page", kDniStack);
+			VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77, true);
+			_vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(7388, 600), Graphics::VideoTimestamp(14700, 600));
 		}
-		// TODO: Complete/fix
-	} else if (_globals.ending == 1) {
-		// TODO: Complete, loop atr1page end
 	} else if (_globals.ending != 3 && _globals.ending != 4) {
 		if (_globals.heldPage == 13) {
-			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atr1page", kDniStack), 215, 77);
+			_video = _vm->wrapMovieFilename("atr1page", kDniStack);
+			VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77);
+			_vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(14700, 600));
+
+			_waitForLoop = true;
+			_loopStart = 7388;
+			_loopEnd = 14700;
+
+			// Wait for page
 			_globals.ending = 1;
 
-			// TODO: Complete, movie control/looping
 		} else {
-			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atr1nopg", kDniStack), 215, 77);
+			_video = _vm->wrapMovieFilename("atr1nopg", kDniStack);
+			VideoHandle atrus = _vm->_video->playBackgroundMovie(_video, 215, 77);
+			_vm->_video->setVideoBounds(atrus, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(46175, 600));
+
+			_waitForLoop = true;
+			_loopStart = 30656;
+			_loopEnd = 46175;
+
+			// Bad ending
 			_globals.ending = 3;
-
-			// TODO: Complete, movie control/looping
 		}
 	} else if (!_vm->_video->isVideoPlaying()) {
 		_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrwrite", kDniStack), 215, 77, true);
@@ -139,9 +194,4 @@
 	_atrusRunning = true;
 }
 
-void MystScriptParser_Dni::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	// Used in Card 5014 (Atrus Writing)
-	// TODO: Stop persistent scripts
-}
-
 } // End of namespace Mohawk

Modified: scummvm/trunk/engines/mohawk/myst_stacks/dni.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/dni.h	2011-01-14 20:08:27 UTC (rev 55244)
+++ scummvm/trunk/engines/mohawk/myst_stacks/dni.h	2011-01-14 21:42:33 UTC (rev 55245)
@@ -50,16 +50,21 @@
 	uint16 getVar(uint16 var);
 
 	void atrus_run();
+	void loopVideo_run();
+	void atrusLeft_run();
 
-	DECLARE_OPCODE(opcode_100);
 	DECLARE_OPCODE(o_handPage);
 
 	DECLARE_OPCODE(o_atrus_init);
 
-	DECLARE_OPCODE(opcode_300);
-
 	bool _atrusRunning;
 	bool _notSeenAtrus; // 56
+	uint32 _atrusLeftTime; // 60
+	Common::String _video; // 64
+	bool _waitForLoop;
+	uint32 _loopStart; // 72
+	uint32 _loopEnd; // 76
+	bool _atrusLeft; // 80
 };
 
 } // 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