aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBastien Bouclet2010-11-29 20:56:21 +0000
committerBastien Bouclet2010-11-29 20:56:21 +0000
commit0cff3be66f7a289120326c907e5d10e017b0bb9c (patch)
treec1690db34e2240193979e594052a70b633b84ba9 /engines
parentc7e488c20168d5c2ec9245ac0bc8711abe209db3 (diff)
downloadscummvm-rg350-0cff3be66f7a289120326c907e5d10e017b0bb9c.tar.gz
scummvm-rg350-0cff3be66f7a289120326c907e5d10e017b0bb9c.tar.bz2
scummvm-rg350-0cff3be66f7a289120326c907e5d10e017b0bb9c.zip
MOHAWK: More Myst common opcodes checking / renaming
svn-id: r54619
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/myst.h1
-rw-r--r--engines/mohawk/myst_scripts.cpp170
-rw-r--r--engines/mohawk/myst_scripts.h25
-rw-r--r--engines/mohawk/myst_scripts_myst.cpp28
-rw-r--r--engines/mohawk/myst_scripts_selenitic.cpp28
5 files changed, 100 insertions, 152 deletions
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index dc578eecd7..ab1c6f5d6b 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -178,6 +178,7 @@ public:
uint16 getCurCard() { return _curCard; }
uint16 getCurStack() { return _curStack; }
void setMainCursor(uint16 cursor);
+ uint16 getMainCursor() { return _mainCursor; }
MystVar *_varStore;
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 06f683604f..0191a36a8f 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -77,6 +77,8 @@ const uint16 MystScriptParser::start_card[8] = {
MystScriptParser::MystScriptParser(MohawkEngine_Myst *vm) : _vm(vm) {
setupOpcodes();
_invokingResource = NULL;
+ _savedCardId = 0;
+ _savedCursorId = 0;
}
MystScriptParser::~MystScriptParser() {
@@ -94,9 +96,9 @@ void MystScriptParser::setupOpcodes() {
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 @@ void MystScriptParser::setupOpcodes() {
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 @@ void MystScriptParser::setupOpcodes() {
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 @@ void MystScriptParser::opcode_4(uint16 op, uint16 var, uint16 argc, uint16 *argv
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 @@ void MystScriptParser::o_16_changeCardDirectional(uint16 op, uint16 var, uint16
// 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 @@ void MystScriptParser::o_17_changeCardPush(uint16 op, uint16 var, uint16 argc, u
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 @@ void MystScriptParser::o_18_changeCardPop(uint16 op, uint16 var, uint16 argc, ui
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 @@ void MystScriptParser::opcode_30(uint16 op, uint16 var, uint16 argc, uint16 *arg
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_31(uint16 op, uint16 var, uint16 argc, uint16 *arg
}
}
-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 @@ void MystScriptParser::opcode_35(uint16 op, uint16 var, uint16 argc, uint16 *arg
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);
-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);
+ _vm->setMainCursor(cursorId);
+ _vm->_cursor->setCursor(cursorId);
}
-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_37_hideCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Hide Cursor", op);
+ _vm->_cursor->hideCursor();
}
-void MystScriptParser::opcode_39(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
- varUnusedCheck(op, var);
+void MystScriptParser::o_38_showCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
+ debugC(kDebugScript, "Opcode %d: Show Cursor", op);
+ _vm->_cursor->showCursor();
+}
- if (argc == 1) {
- // Used on Mechanical Card 6327 (Elevator)
- debugC(kDebugScript, "Opcode %d: Delay?", op);
+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);
- 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 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg
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
diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h
index 4fd96a826c..4d8dbbbd74 100644
--- a/engines/mohawk/myst_scripts.h
+++ b/engines/mohawk/myst_scripts.h
@@ -83,7 +83,7 @@ public:
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 @@ public:
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 @@ protected:
static const uint8 stack_map[];
static const uint16 start_card[];
+ uint16 _savedCardId;
+ uint16 _savedCursorId;
+
void varUnusedCheck(uint16 op, uint16 var);
diff --git a/engines/mohawk/myst_scripts_myst.cpp b/engines/mohawk/myst_scripts_myst.cpp
index c705a6f80e..7043992ce5 100644
--- a/engines/mohawk/myst_scripts_myst.cpp
+++ b/engines/mohawk/myst_scripts_myst.cpp
@@ -59,9 +59,9 @@ void MystScriptParser_Myst::setupOpcodes() {
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 @@ void MystScriptParser_Myst::setupOpcodes() {
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 @@ void MystScriptParser_Myst::setupOpcodes() {
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
diff --git a/engines/mohawk/myst_scripts_selenitic.cpp b/engines/mohawk/myst_scripts_selenitic.cpp
index dd00f54e5b..7e28984fc7 100644
--- a/engines/mohawk/myst_scripts_selenitic.cpp
+++ b/engines/mohawk/myst_scripts_selenitic.cpp
@@ -59,9 +59,9 @@ void MystScriptParser_Selenitic::setupOpcodes() {
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 @@ void MystScriptParser_Selenitic::setupOpcodes() {
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 @@ void MystScriptParser_Selenitic::setupOpcodes() {
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