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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Sun Jan 9 11:14:41 CET 2011


Revision: 55180
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55180&view=rev
Author:   bgk
Date:     2011-01-09 10:14:40 +0000 (Sun, 09 Jan 2011)

Log Message:
-----------
MOHAWK: Implement minimal D'ni stack. Lacking movie control.

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

Modified: scummvm/trunk/engines/mohawk/myst_stacks/dni.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/dni.cpp	2011-01-09 00:32:26 UTC (rev 55179)
+++ scummvm/trunk/engines/mohawk/myst_stacks/dni.cpp	2011-01-09 10:14:40 UTC (rev 55180)
@@ -24,19 +24,19 @@
  */
 
 #include "mohawk/myst.h"
+#include "mohawk/cursors.h"
 #include "mohawk/graphics.h"
 #include "mohawk/myst_areas.h"
 #include "mohawk/sound.h"
 #include "mohawk/video.h"
 #include "mohawk/myst_stacks/dni.h"
 
-#include "gui/message.h"
-
 namespace Mohawk {
 
 MystScriptParser_Dni::MystScriptParser_Dni(MohawkEngine_Myst *vm) :
-		MystScriptParser(vm), _state(_vm->_gameState->_dni) {
+		MystScriptParser(vm) {
 	setupOpcodes();
+	_notSeenAtrus = true;
 }
 
 MystScriptParser_Dni::~MystScriptParser_Dni() {
@@ -47,10 +47,10 @@
 void MystScriptParser_Dni::setupOpcodes() {
 	// "Stack-Specific" Opcodes
 	OPCODE(100, opcode_100);
-	OPCODE(101, opcode_101);
+	OPCODE(101, o_handPage);
 
 	// "Init" Opcodes
-	OPCODE(200, opcode_200);
+	OPCODE(200, o_atrus_init);
 
 	// "Exit" Opcodes
 	OPCODE(300, opcode_300);
@@ -59,81 +59,92 @@
 #undef OPCODE
 
 void MystScriptParser_Dni::disablePersistentScripts() {
+	_atrusRunning = false;
 }
 
 void MystScriptParser_Dni::runPersistentScripts() {
+	if (_atrusRunning)
+		atrus_run();
 }
 
 uint16 MystScriptParser_Dni::getVar(uint16 var) {
 	switch(var) {
-//	case 0: // Atrus Gone (from across room)
-//		return 0; // Present
-//		return 1; // Absent
-//	case 1: // Myst Book Status
-//		return 0; // Not Usuable
-//		return 1; // Openable, but not linkable (Atrus Gone?)
-//		return 2; // Linkable
-//	case 2: // Music Type
-//		return 0;
-//		return 1;
-//		return 2;
-//	case 106: // Atrus Static Image State
-//		return 0; // Initial State
-//		return 1; // Holding Out Hand for Page
-//		return 2; // Gone, Book Open
-//		return 3; // Back #1
-//		return 4; // Back #2
+	case 0: // Atrus Gone (from across room)
+		return _globals.ending == 2;
+	case 1: // Myst Book Status
+		if (_globals.ending != 4)
+			return _globals.ending == 3;
+		else
+			return 2; // Linkable
+	case 2: // Music Type
+		if (_notSeenAtrus) {
+			_notSeenAtrus = false;
+			return _globals.ending != 4 && _globals.heldPage != 13;
+		} else
+			return 2;
 	default:
 		return MystScriptParser::getVar(var);
 	}
 }
 
 void MystScriptParser_Dni::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	// Used in Card 5022 (Rocks)
-	varUnusedCheck(op, var);
-
-	if (argc == 0) {
-		debugC(kDebugScript, "Opcode %d: Unknown Function", op);
-
-		// TODO: Fill in Logic.
-	} else
-		unknown(op, var, argc, argv);
+	// Used in Card 5014 (Atrus)
+	debugC(kDebugScript, "Opcode %d: Stop persistent scripts", op);
+	// TODO: Stop persistent scripts
 }
 
-void MystScriptParser_Dni::opcode_101(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+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)
-	// Hotspot Resource Used to hand Page to Atrus...
-	varUnusedCheck(op, var);
-	// TODO: Fill in Logic.
+	if (_globals.ending == 1) {
+		_globals.ending = 2;
+		_globals.heldPage = 0;
+		_vm->_cursor->setCursor(kDefaultMystCursor);
+
+		// TODO: Complete, play movie end
+	}
 }
 
-void MystScriptParser_Dni::opcode_200(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-	// Used on Card 5014
+void MystScriptParser_Dni::atrus_run() {
+	if (_globals.ending == 2) {
+		VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+		if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle)) {
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrus2", kDniStack), 215, 77);
+			_globals.ending = 4;
+			_globals.bluePagesInBook = 63;
+			_globals.redPagesInBook = 63;
+		}
+		// 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);
+			_globals.ending = 1;
 
-	// TODO: Logic for Atrus Reactions and Movies
-	if (false) {
-		// Var 0 used for Atrus Gone (from across room) 0 = Present, 1 = Not Present
-		// Var 1 used for Myst Book Status 0 = Not Usuable
-		//                                 1 = Openable, but not linkable (Atrus Gone?)
-		//                                 2 = Linkable
-		// Var 2 used for Music Type 0 to 2..
-		// Var 106 used for Atrus Static Image State 0 = Initial State
-		//                                           1 = Holding Out Hand for Page
-		//                                           2 = Gone, Book Open
-		//                                           3 = Back #1
-		//                                           4 = Back #2
-		_vm->_video->playMovie(_vm->wrapMovieFilename("atr1nopg", kDniStack), 215, 77);
-		_vm->_video->playMovie(_vm->wrapMovieFilename("atr1page", kDniStack), 215, 77);
-		_vm->_video->playMovie(_vm->wrapMovieFilename("atrus2", kDniStack), 215, 77);
-		_vm->_video->playMovie(_vm->wrapMovieFilename("atrwrite", kDniStack), 215, 77);
+			// TODO: Complete, movie control / looping
+		} else {
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atr1nopg", kDniStack), 215, 77);
+			_globals.ending = 3;
+
+			// TODO: Complete, movie control / looping
+		}
+	} else {
+		VideoHandle handle = _vm->_video->findVideoHandle(0xFFFF);
+		if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle))
+			_vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrwrite", kDniStack), 215, 77, true);
 	}
 }
 
+void MystScriptParser_Dni::o_atrus_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Atrus init", op);
+
+	_atrusRunning = true;
+}
+
 void MystScriptParser_Dni::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	// Used in Card 5014 (Atrus Writing)
-	varUnusedCheck(op, var);
-	// TODO: Fill in Logic.
+	// 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-09 00:32:26 UTC (rev 55179)
+++ scummvm/trunk/engines/mohawk/myst_stacks/dni.h	2011-01-09 10:14:40 UTC (rev 55180)
@@ -49,14 +49,17 @@
 	void setupOpcodes();
 	uint16 getVar(uint16 var);
 
+	void atrus_run();
+
 	DECLARE_OPCODE(opcode_100);
-	DECLARE_OPCODE(opcode_101);
+	DECLARE_OPCODE(o_handPage);
 
-	DECLARE_OPCODE(opcode_200);
+	DECLARE_OPCODE(o_atrus_init);
 
 	DECLARE_OPCODE(opcode_300);
 
-	MystGameState::Dni &_state;
+	bool _atrusRunning;
+	bool _notSeenAtrus; // 56
 };
 
 } // End of namespace Mohawk

Modified: scummvm/trunk/engines/mohawk/myst_state.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_state.cpp	2011-01-09 00:32:26 UTC (rev 55179)
+++ scummvm/trunk/engines/mohawk/myst_state.cpp	2011-01-09 10:14:40 UTC (rev 55180)
@@ -40,7 +40,6 @@
 	memset(&_mechanical, 0, sizeof(_mechanical));
 	memset(&_selenitic, 0, sizeof(_selenitic));
 	memset(&_stoneship, 0, sizeof(_stoneship));
-	memset(&_dni, 0, sizeof(_dni));
 
 	// Unknown
 	_globals.u0 = 2;
@@ -140,7 +139,7 @@
 	s.syncAsUint16LE(_globals.heldPage);
 	s.syncAsUint16LE(_globals.u1);
 	s.syncAsUint16LE(_globals.transitions);
-	s.syncAsUint16LE(_globals.ending);
+	s.syncAsUint16LE(_globals.zipMode);
 	s.syncAsUint16LE(_globals.redPagesInBook);
 	s.syncAsUint16LE(_globals.bluePagesInBook);
 
@@ -289,37 +288,27 @@
 		s.syncAsUint16LE(_stoneship.generatorPowerLevel[i]);
 
 	// D'ni
-	s.syncAsUint16LE(_dni.outcomeState);
+	s.syncAsUint16LE(_globals.ending);
 
 	// Reading unknown region...
 	// When Zero Value regions are included, these are 5 blocks of
 	// 41 uint16 values.
 
-	for (byte i = 0; i < 31; i++)
-		s.syncAsUint16LE(unknownMyst[i]);
+	for (byte i = 0; i < 41; i++)
+		s.syncAsUint16LE(mystReachableZipDests[i]);
 
-	s.skip(20);
+	for (byte i = 0; i < 41; i++)
+		s.syncAsUint16LE(channelwoodReachableZipDests[i]);
 
-	for (byte i = 0; i < 37; i++)
-		s.syncAsUint16LE(unknownChannelwood[i]);
+	for (byte i = 0; i < 41; i++)
+		s.syncAsUint16LE(mechReachableZipDests[i]);
 
-	s.skip(8);
+	for (byte i = 0; i < 41; i++)
+		s.syncAsUint16LE(seleniticReachableZipDests[i]);
 
-	for (byte i = 0; i < 18; i++)
-		s.syncAsUint16LE(unknownMech[i]);
+	for (byte i = 0; i < 41; i++)
+		s.syncAsUint16LE(stoneshipReachableZipDests[i]);
 
-	s.skip(46);
-
-	for (byte i = 0; i < 30; i++)
-		s.syncAsUint16LE(unknownSelenitic[i]);
-
-	s.skip(22);
-
-	for (byte i = 0; i < 22; i++)
-		s.syncAsUint16LE(unknownStoneship[i]);
-
-	s.skip(38);
-
 	if ((isME && s.bytesSynced() != 664) || (!isME && s.bytesSynced() != 601))
 		warning("Unexpected File Position 0x%03X At End of Save/Load", s.bytesSynced());
 }

Modified: scummvm/trunk/engines/mohawk/myst_state.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_state.h	2011-01-09 00:32:26 UTC (rev 55179)
+++ scummvm/trunk/engines/mohawk/myst_state.h	2011-01-09 10:14:40 UTC (rev 55180)
@@ -64,9 +64,10 @@
 		uint16 heldPage;
 		uint16 u1;
 		uint16 transitions;
-		uint16 ending;
+		uint16 zipMode;
 		uint16 redPagesInBook;
 		uint16 bluePagesInBook;
+		uint16 ending;
 	} _globals;
 
 	/* 50 Myst Specific Variables :
@@ -268,24 +269,17 @@
 		uint16 generatorPowerLevel[5];
 	} _stoneship;
 
-	/* 1 Dunny Specific Variable :
-	    0 = Outcome State
-	*/
-	struct Dni {
-		uint16 outcomeState;
-	} _dni;
+	// The values in these regions are lists of VIEW resources
+	// which correspond to visited zip destinations
+	uint16 mystReachableZipDests[41];
 
-	// The values in these regions seem to be lists of resource IDs
-	// which correspond to VIEW resources i.e. cards
-	uint16 unknownMyst[31];
+	uint16 channelwoodReachableZipDests[41];
 
-	uint16 unknownChannelwood[37];
+	uint16 mechReachableZipDests[41];
 
-	uint16 unknownMech[18];
+	uint16 seleniticReachableZipDests[41];
 
-	uint16 unknownSelenitic[30];
-
-	uint16 unknownStoneship[22];
+	uint16 stoneshipReachableZipDests[41];
 private:
 	void syncGameState(Common::Serializer &s, bool isME);
 


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