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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Mon Nov 29 21:56:22 CET 2010


Revision: 54619
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54619&view=rev
Author:   bgk
Date:     2010-11-29 20:56:21 +0000 (Mon, 29 Nov 2010)

Log Message:
-----------
MOHAWK: More Myst common opcodes checking / renaming

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/myst.h
    scummvm/trunk/engines/mohawk/myst_scripts.cpp
    scummvm/trunk/engines/mohawk/myst_scripts.h
    scummvm/trunk/engines/mohawk/myst_scripts_myst.cpp
    scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp

Modified: scummvm/trunk/engines/mohawk/myst.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst.h	2010-11-29 20:56:04 UTC (rev 54618)
+++ scummvm/trunk/engines/mohawk/myst.h	2010-11-29 20:56:21 UTC (rev 54619)
@@ -178,6 +178,7 @@
 	uint16 getCurCard() { return _curCard; }
 	uint16 getCurStack() { return _curStack; }
 	void setMainCursor(uint16 cursor);
+	uint16 getMainCursor() { return _mainCursor; }
 
 	MystVar *_varStore;
 

Modified: scummvm/trunk/engines/mohawk/myst_scripts.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts.cpp	2010-11-29 20:56:04 UTC (rev 54618)
+++ scummvm/trunk/engines/mohawk/myst_scripts.cpp	2010-11-29 20:56:21 UTC (rev 54619)
@@ -77,6 +77,8 @@
 MystScriptParser::MystScriptParser(MohawkEngine_Myst *vm) : _vm(vm) {
 	setupOpcodes();
 	_invokingResource = NULL;
+	_savedCardId = 0;
+	_savedCursorId = 0;
 }
 
 MystScriptParser::~MystScriptParser() {
@@ -94,9 +96,9 @@
 		OPCODE(3, takePage),
 		OPCODE(4, opcode_4),
 		// Opcode 5 Not Present
-		OPCODE(6, o_6_changeCard),
-		OPCODE(7, o_6_changeCard),
-		OPCODE(8, o_6_changeCard),
+		OPCODE(6, o_6_goToDest),
+		OPCODE(7, o_6_goToDest),
+		OPCODE(8, o_6_goToDest),
 		OPCODE(9, o_9_triggerMovie),
 		OPCODE(10, o_10_toggleVarNoRedraw),
 		// Opcode 11 Not Present
@@ -110,7 +112,7 @@
 		OPCODE(19, o_19_enableAreas),
 		OPCODE(20, o_20_disableAreas),
 		OPCODE(21, o_21_directionalUpdate),
-		OPCODE(22, o_6_changeCard),
+		OPCODE(22, o_6_goToDest),
 		OPCODE(23, o_23_toggleAreasActivation),
 		OPCODE(24, o_24_playSound),
 		// Opcode 25 Not Present, original calls replaceSound
@@ -119,22 +121,22 @@
 		OPCODE(28, o_28_restoreDefaultRect),
 		OPCODE(29, o_29_33_blitRect),
 		OPCODE(30, opcode_30),
-		OPCODE(31, opcode_31),
-		OPCODE(32, opcode_32),
+		OPCODE(31, o_31_soundPlaySwitch),
+		OPCODE(32, o_32_soundResumeBackground),
 		OPCODE(33, o_29_33_blitRect),
 		OPCODE(34, opcode_34),
 		OPCODE(35, opcode_35),
-		OPCODE(36, changeCursor),
-		OPCODE(37, hideCursor),
-		OPCODE(38, showCursor),
-		OPCODE(39, opcode_39),
-		OPCODE(40, changeStack),
+		OPCODE(36, o_36_changeMainCursor),
+		OPCODE(37, o_37_hideCursor),
+		OPCODE(38, o_38_showCursor),
+		OPCODE(39, o_39_delay),
+		OPCODE(40, o_40_changeStack),
 		OPCODE(41, opcode_41),
 		OPCODE(42, opcode_42),
-		OPCODE(43, opcode_43),
-		OPCODE(44, opcode_44),
+		OPCODE(43, o_43_saveMainCursor),
+		OPCODE(44, o_44_restoreMainCursor),
 		// Opcode 45 Not Present
-		OPCODE(46, opcode_46),
+		OPCODE(46, o_46_soundWaitStop),
 		// Opcodes 47 to 99 Not Present
 
 		OPCODE(0xFFFF, NOP)
@@ -325,7 +327,7 @@
 		unknown(op, var, argc, argv);
 }
 
-void MystScriptParser::o_6_changeCard(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+void MystScriptParser::o_6_goToDest(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	varUnusedCheck(op, var);
 
 	if (argc == 0) {
@@ -400,8 +402,6 @@
 // TODO: The purpose of the optional argv[1] on Opcode 17 and argv[0]
 // on Opcode 18 which are always 4, 5 or 6 is unknown.
 
-static uint16 opcode_17_18_cardId = 0;
-
 void MystScriptParser::o_17_changeCardPush(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	varUnusedCheck(op, var);
 
@@ -414,9 +414,9 @@
 		uint16 u0 = argv[1]; // TODO
 		debugC(kDebugScript, "\tu0: %d", u0);
 
-		opcode_17_18_cardId = _vm->getCurCard();
+		_savedCardId = _vm->getCurCard();
 
-		debugC(kDebugScript, "\tCurrent CardId: %d", opcode_17_18_cardId);
+		debugC(kDebugScript, "\tCurrent CardId: %d", _savedCardId);
 
 		_vm->changeToCard(cardId);
 	} else
@@ -428,12 +428,12 @@
 
 	if (argc == 1) {
 		debugC(kDebugScript, "Opcode %d: Return To Stored Card Id", op);
-		debugC(kDebugScript, "\tCardId: %d", opcode_17_18_cardId);
+		debugC(kDebugScript, "\tCardId: %d", _savedCardId);
 
 		uint16 u0 = argv[0];
 		debugC(kDebugScript, "\tu0: %d", u0);
 
-		_vm->changeToCard(opcode_17_18_cardId);
+		_vm->changeToCard(_savedCardId);
 	} else
 		unknown(op, var, argc, argv);
 }
@@ -730,7 +730,7 @@
 	soundListVolume = NULL;
 }
 
-void MystScriptParser::opcode_31(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+void MystScriptParser::o_31_soundPlaySwitch(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	debugC(kDebugScript, "Opcode %d: Switch Choice of Play Sound", op);
 
 	uint16 value = getVar(var);
@@ -744,21 +744,9 @@
 	}
 }
 
-void MystScriptParser::opcode_32(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-
-	// Used on Channelwood Card 3503 (Door to Sirrus' Room)
-	// Used on Myst Card 4188 (Door to Cabin)
-	// Used on Myst Card 4363 (Red Book Open)
-	// Used on Myst Card 4371 (Blue Book Open)
-	if (argc == 0) {
-		debugC(kDebugScript, "Opcode %d: Unknown...", op);
-		// TODO: Implement function...
-		// Set Resource 0 Enabled?
-		// or Trigger Movie?
-		// Set resource flag to Enabled?
-	} else
-		unknown(op, var, argc, argv);
+void MystScriptParser::o_32_soundResumeBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: soundResumeBackground", op);
+	//_vm->_sound->resumeBackground();
 }
 
 void MystScriptParser::opcode_34(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -800,57 +788,39 @@
 		unknown(op, var, argc, argv);
 }
 
-void MystScriptParser::changeCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser::o_36_changeMainCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Change main cursor", op);
 
-	if (argc == 1) {
-		debugC(kDebugScript, "Opcode %d: Change Cursor", op);
-		debugC(kDebugScript, "Cursor: %d", argv[0]);
+	uint16 cursorId = argv[0];
 
-		// TODO: Not sure if this needs to change mainCursor or similar...
-		_vm->_cursor->setCursor(argv[0]);
-	} else
-		unknown(op, var, argc, argv);
+	debugC(kDebugScript, "Cursor: %d", cursorId);
+
+	_vm->setMainCursor(cursorId);
+	_vm->_cursor->setCursor(cursorId);
 }
 
-void MystScriptParser::hideCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-
-	if (argc == 0) {
-		debugC(kDebugScript, "Opcode %d: Hide Cursor", op);
-		_vm->_cursor->hideCursor();
-	} else
-		unknown(op, var, argc, argv);
+void MystScriptParser::o_37_hideCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Hide Cursor", op);
+	_vm->_cursor->hideCursor();
 }
 
-void MystScriptParser::showCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-
-	if (argc == 0) {
-		debugC(kDebugScript, "Opcode %d: Show Cursor", op);
-		_vm->_cursor->showCursor();
-	} else
-		unknown(op, var, argc, argv);
+void MystScriptParser::o_38_showCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Show Cursor", op);
+	_vm->_cursor->showCursor();
 }
 
-void MystScriptParser::opcode_39(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser::o_39_delay(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	// Used on Mechanical Card 6327 (Elevator)
+	debugC(kDebugScript, "Opcode %d: Delay", op);
 
-	if (argc == 1) {
-		// Used on Mechanical Card 6327 (Elevator)
-		debugC(kDebugScript, "Opcode %d: Delay?", op);
+	uint16 time = argv[0];
 
-		uint16 time = argv[0];
+	debugC(kDebugScript, "\tTime: %d", time);
 
-		debugC(kDebugScript, "\tTime: %d", time);
-
-		// TODO: Fill in Function...
-		// May actually be related to movie control.. not sure.
-	} else
-		unknown(op, var, argc, argv);
+	_vm->_system->delayMillis(time);
 }
 
-void MystScriptParser::changeStack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+void MystScriptParser::o_40_changeStack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
 	Audio::SoundHandle *handle;
 	varUnusedCheck(op, var);
 
@@ -1104,51 +1074,25 @@
 		unknown(op, var, argc, argv);
 }
 
-// TODO: Are Opcode 43 and 44 enable / disable paired commands?
+void MystScriptParser::o_43_saveMainCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Save main cursor", op);
 
-void MystScriptParser::opcode_43(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
-
-	if (argc == 0) {
-		debugC(kDebugScript, "Opcode %d: Unknown Function", op);
-
-		// TODO: Function Unknown
-		// Used on Stoneship Card 2154 (Bottom of Lighthouse)
-		// Used on Stoneship Card 2138 (Lighthouse Floating Chest Closeup)
-	} else
-		unknown(op, var, argc, argv);
+	_savedCursorId = _vm->getMainCursor();
 }
 
-void MystScriptParser::opcode_44(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser::o_44_restoreMainCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	debugC(kDebugScript, "Opcode %d: Restore main cursor", op);
 
-	if (argc == 0) {
-		debugC(kDebugScript, "Opcode %d: Unknown Function", op);
-
-		// TODO: Function Unknown
-		// Used on Stoneship Card 2154 (Bottom of Lighthouse)
-		// Used on Stoneship Card 2138 (Lighthouse Floating Chest Closeup)
-	} else
-		unknown(op, var, argc, argv);
+	_vm->setMainCursor(_savedCursorId);
 }
 
-void MystScriptParser::opcode_46(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
-	varUnusedCheck(op, var);
+void MystScriptParser::o_46_soundWaitStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+	// Used on Selenitic Card 1191 (Maze Runner)
+	// Used on Mechanical Card 6267 (Code Lock)
+	// Used when Button is pushed...
+	debugC(kDebugScript, "Opcode %d: Wait for foreground sound to finish", op);
 
-	if (argc == 0) {
-		// Used on Selenitic Card 1191 (Maze Runner)
-		// Used on Mechanical Card 6267 (Code Lock)
-		// Used when Button is pushed...
-		debugC(kDebugScript, "Opcode %d: Conditional Code Jump?", op);
-		// TODO: Function Unknown - Fill in...
-		// Logic looks like this is some kind of Conditional Code
-		// Jump Point.
-		// The Logic for the Mechanical Code Lock Seems to be in this
-		// opcode with it being present twice delimiting the start
-		// of the incorrect code and correct code action blocks...
-		// Not sure how a general case can be made for this..
-	} else
-		unknown(op, var, argc, argv);
+	//TODO: Implement
 }
 
 } // End of namespace Mohawk

Modified: scummvm/trunk/engines/mohawk/myst_scripts.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts.h	2010-11-29 20:56:04 UTC (rev 54618)
+++ scummvm/trunk/engines/mohawk/myst_scripts.h	2010-11-29 20:56:21 UTC (rev 54619)
@@ -83,7 +83,7 @@
 	DECLARE_OPCODE(o_2_changeCardSwitch);
 	DECLARE_OPCODE(takePage);
 	DECLARE_OPCODE(opcode_4);
-	DECLARE_OPCODE(o_6_changeCard);
+	DECLARE_OPCODE(o_6_goToDest);
 	DECLARE_OPCODE(o_9_triggerMovie);
 	DECLARE_OPCODE(o_10_toggleVarNoRedraw);
 	DECLARE_OPCODE(o_14_drawAreaState);
@@ -101,20 +101,20 @@
 	DECLARE_OPCODE(o_28_restoreDefaultRect);
 	DECLARE_OPCODE(o_29_33_blitRect);
 	DECLARE_OPCODE(opcode_30);
-	DECLARE_OPCODE(opcode_31);
-	DECLARE_OPCODE(opcode_32);
+	DECLARE_OPCODE(o_31_soundPlaySwitch);
+	DECLARE_OPCODE(o_32_soundResumeBackground);
 	DECLARE_OPCODE(opcode_34);
 	DECLARE_OPCODE(opcode_35);
-	DECLARE_OPCODE(changeCursor);
-	DECLARE_OPCODE(hideCursor);
-	DECLARE_OPCODE(showCursor);
-	DECLARE_OPCODE(opcode_39);
-	DECLARE_OPCODE(changeStack);
+	DECLARE_OPCODE(o_36_changeMainCursor);
+	DECLARE_OPCODE(o_37_hideCursor);
+	DECLARE_OPCODE(o_38_showCursor);
+	DECLARE_OPCODE(o_39_delay);
+	DECLARE_OPCODE(o_40_changeStack);
 	DECLARE_OPCODE(opcode_41);
 	DECLARE_OPCODE(opcode_42);
-	DECLARE_OPCODE(opcode_43);
-	DECLARE_OPCODE(opcode_44);
-	DECLARE_OPCODE(opcode_46);
+	DECLARE_OPCODE(o_43_saveMainCursor);
+	DECLARE_OPCODE(o_44_restoreMainCursor);
+	DECLARE_OPCODE(o_46_soundWaitStop);
 
 	DECLARE_OPCODE(NOP);
 
@@ -137,6 +137,9 @@
 	static const uint8 stack_map[];
 	static const uint16 start_card[];
 
+	uint16 _savedCardId;
+	uint16 _savedCursorId;
+
 	void varUnusedCheck(uint16 op, uint16 var);
 
 

Modified: scummvm/trunk/engines/mohawk/myst_scripts_myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts_myst.cpp	2010-11-29 20:56:04 UTC (rev 54618)
+++ scummvm/trunk/engines/mohawk/myst_scripts_myst.cpp	2010-11-29 20:56:21 UTC (rev 54619)
@@ -59,9 +59,9 @@
 		OPCODE(3, takePage),
 		OPCODE(4, opcode_4),
 		// TODO: Opcode 5 Not Present
-		OPCODE(6, o_6_changeCard),
-		OPCODE(7, o_6_changeCard),
-		OPCODE(8, o_6_changeCard),
+		OPCODE(6, o_6_goToDest),
+		OPCODE(7, o_6_goToDest),
+		OPCODE(8, o_6_goToDest),
 		OPCODE(9, o_9_triggerMovie),
 		OPCODE(10, o_10_toggleVarNoRedraw),
 		// TODO: Opcode 10 to 11 Not Present
@@ -75,7 +75,7 @@
 		OPCODE(19, o_19_enableAreas),
 		OPCODE(20, o_20_disableAreas),
 		OPCODE(21, o_21_directionalUpdate),
-		OPCODE(22, o_6_changeCard),
+		OPCODE(22, o_6_goToDest),
 		OPCODE(23, o_23_toggleAreasActivation),
 		OPCODE(24, o_24_playSound),
 		// TODO: Opcode 25 Not Present
@@ -84,22 +84,22 @@
 		OPCODE(28, o_28_restoreDefaultRect),
 		OPCODE(29, o_29_33_blitRect),
 		OPCODE(30, opcode_30),
-		OPCODE(31, opcode_31),
-		OPCODE(32, opcode_32),
+		OPCODE(31, o_31_soundPlaySwitch),
+		OPCODE(32, o_32_soundResumeBackground),
 		OPCODE(33, o_29_33_blitRect),
 		OPCODE(34, opcode_34),
 		OPCODE(35, opcode_35),
-		OPCODE(36, changeCursor),
-		OPCODE(37, hideCursor),
-		OPCODE(38, showCursor),
-		OPCODE(39, opcode_39),
-		OPCODE(40, changeStack),
+		OPCODE(36, o_36_changeMainCursor),
+		OPCODE(37, o_37_hideCursor),
+		OPCODE(38, o_38_showCursor),
+		OPCODE(39, o_39_delay),
+		OPCODE(40, o_40_changeStack),
 		OPCODE(41, opcode_41),
 		OPCODE(42, opcode_42),
-		OPCODE(43, opcode_43),
-		OPCODE(44, opcode_44),
+		OPCODE(43, o_43_saveMainCursor),
+		OPCODE(44, o_44_restoreMainCursor),
 		// TODO: Opcode 45 Not Present
-		OPCODE(46, opcode_46),
+		OPCODE(46, o_46_soundWaitStop),
 		// TODO: Opcodes 47 to 99 Not Present
 
 		// "Stack-Specific" Opcodes

Modified: scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp	2010-11-29 20:56:04 UTC (rev 54618)
+++ scummvm/trunk/engines/mohawk/myst_scripts_selenitic.cpp	2010-11-29 20:56:21 UTC (rev 54619)
@@ -59,9 +59,9 @@
 		OPCODE(3, takePage),
 		OPCODE(4, opcode_4),
 		// TODO: Opcode 5 Not Present
-		OPCODE(6, o_6_changeCard),
-		OPCODE(7, o_6_changeCard),
-		OPCODE(8, o_6_changeCard),
+		OPCODE(6, o_6_goToDest),
+		OPCODE(7, o_6_goToDest),
+		OPCODE(8, o_6_goToDest),
 		OPCODE(9, o_9_triggerMovie),
 		OPCODE(10, o_10_toggleVarNoRedraw),
 		// TODO: Opcode 10 to 11 Not Present
@@ -75,7 +75,7 @@
 		OPCODE(19, o_19_enableAreas),
 		OPCODE(20, o_20_disableAreas),
 		OPCODE(21, o_21_directionalUpdate),
-		OPCODE(22, o_6_changeCard),
+		OPCODE(22, o_6_goToDest),
 		OPCODE(23, o_23_toggleAreasActivation),
 		OPCODE(24, o_24_playSound),
 		// TODO: Opcode 25 Not Present
@@ -84,22 +84,22 @@
 		OPCODE(28, o_28_restoreDefaultRect),
 		OPCODE(29, o_29_33_blitRect),
 		OPCODE(30, opcode_30),
-		OPCODE(31, opcode_31),
-		OPCODE(32, opcode_32),
+		OPCODE(31, o_31_soundPlaySwitch),
+		OPCODE(32, o_32_soundResumeBackground),
 		OPCODE(33, o_29_33_blitRect),
 		OPCODE(34, opcode_34),
 		OPCODE(35, opcode_35),
-		OPCODE(36, changeCursor),
-		OPCODE(37, hideCursor),
-		OPCODE(38, showCursor),
-		OPCODE(39, opcode_39),
-		OPCODE(40, changeStack),
+		OPCODE(36, o_36_changeMainCursor),
+		OPCODE(37, o_37_hideCursor),
+		OPCODE(38, o_38_showCursor),
+		OPCODE(39, o_39_delay),
+		OPCODE(40, o_40_changeStack),
 		OPCODE(41, opcode_41),
 		OPCODE(42, opcode_42),
-		OPCODE(43, opcode_43),
-		OPCODE(44, opcode_44),
+		OPCODE(43, o_43_saveMainCursor),
+		OPCODE(44, o_44_restoreMainCursor),
 		// TODO: Opcode 45 Not Present
-		OPCODE(46, opcode_46),
+		OPCODE(46, o_46_soundWaitStop),
 		// TODO: Opcodes 47 to 99 Not Present
 
 		// "Stack-Specific" Opcodes


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