diff options
author | Torbjörn Andersson | 2009-12-30 07:14:09 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2009-12-30 07:14:09 +0000 |
commit | 1a66ad80a4b9bec6440060c5f941ca5f53833703 (patch) | |
tree | 04394653e5951dde6c9b4cc09dc202e57aa62ce7 /engines/mohawk | |
parent | 516495a4a1a66e907257e8545dd668a1613d61f2 (diff) | |
download | scummvm-rg350-1a66ad80a4b9bec6440060c5f941ca5f53833703.tar.gz scummvm-rg350-1a66ad80a4b9bec6440060c5f941ca5f53833703.tar.bz2 scummvm-rg350-1a66ad80a4b9bec6440060c5f941ca5f53833703.zip |
Re-indentet switch() blocks to follow ScummVM indentation style. (I've always
found this style a bit unusual, but I value consistency.)
svn-id: r46734
Diffstat (limited to 'engines/mohawk')
-rw-r--r-- | engines/mohawk/bitmap.cpp | 24 | ||||
-rw-r--r-- | engines/mohawk/dialogs.cpp | 44 | ||||
-rw-r--r-- | engines/mohawk/graphics.cpp | 210 | ||||
-rw-r--r-- | engines/mohawk/livingbooks.cpp | 38 | ||||
-rw-r--r-- | engines/mohawk/myst.cpp | 212 | ||||
-rw-r--r-- | engines/mohawk/myst_scripts.cpp | 5008 | ||||
-rw-r--r-- | engines/mohawk/myst_vars.cpp | 268 | ||||
-rw-r--r-- | engines/mohawk/riven.cpp | 106 | ||||
-rw-r--r-- | engines/mohawk/riven_external.cpp | 80 | ||||
-rw-r--r-- | engines/mohawk/riven_saveload.cpp | 64 | ||||
-rw-r--r-- | engines/mohawk/sound.cpp | 214 |
11 files changed, 3134 insertions, 3134 deletions
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index 6d4ab84930..4f178b2d75 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -84,18 +84,18 @@ ImageData *MohawkBitmap::decodeImage(Common::SeekableReadStream *stream) { byte MohawkBitmap::getBitsPerPixel() { switch (_header.format & kBitsPerPixelMask) { - case kBitsPerPixel1: - return 1; - case kBitsPerPixel4: - return 4; - case kBitsPerPixel8: - return 8; - case kBitsPerPixel16: - return 16; - case kBitsPerPixel24: - return 24; - default: - error ("Unknown bits per pixel"); + case kBitsPerPixel1: + return 1; + case kBitsPerPixel4: + return 4; + case kBitsPerPixel8: + return 8; + case kBitsPerPixel16: + return 16; + case kBitsPerPixel24: + return 24; + default: + error ("Unknown bits per pixel"); } return 0; diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp index 8757a613fa..f63fb44c45 100644 --- a/engines/mohawk/dialogs.cpp +++ b/engines/mohawk/dialogs.cpp @@ -97,17 +97,17 @@ void MystOptionsDialog::open() { void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { - case kZipCmd: - _vm->_zipMode = _zipModeCheckbox->getState(); - break; - case kTransCmd: - _vm->_transitionsEnabled = _transistionsCheckbox->getState(); - break; - case kCloseCmd: - close(); - break; - default: - GUI::OptionsDialog::handleCommand(sender, cmd, data); + case kZipCmd: + _vm->_zipMode = _zipModeCheckbox->getState(); + break; + case kTransCmd: + _vm->_transitionsEnabled = _transistionsCheckbox->getState(); + break; + case kCloseCmd: + close(); + break; + default: + GUI::OptionsDialog::handleCommand(sender, cmd, data); } } @@ -131,17 +131,17 @@ void RivenOptionsDialog::open() { void RivenOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { switch (cmd) { - case kZipCmd: - *_vm->matchVarToString("azip") = _zipModeCheckbox->getState() ? 1 : 0; - break; - case kWaterCmd: - *_vm->matchVarToString("waterenabled") = _waterEffectCheckbox->getState() ? 1 : 0; - break; - case kCloseCmd: - close(); - break; - default: - GUI::OptionsDialog::handleCommand(sender, cmd, data); + case kZipCmd: + *_vm->matchVarToString("azip") = _zipModeCheckbox->getState() ? 1 : 0; + break; + case kWaterCmd: + *_vm->matchVarToString("waterenabled") = _waterEffectCheckbox->getState() ? 1 : 0; + break; + case kCloseCmd: + close(); + break; + default: + GUI::OptionsDialog::handleCommand(sender, cmd, data); } } diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp index ee9fe702de..df912564b7 100644 --- a/engines/mohawk/graphics.cpp +++ b/engines/mohawk/graphics.cpp @@ -463,27 +463,27 @@ void RivenGraphics::runScheduledTransition() { // transitions were found by hacking scripts. switch (_scheduledTransition) { - case 12: // Pan Left - warning ("STUB: Pan left"); - break; - case 13: // Pan Right - warning ("STUB: Pan right"); - break; - case 14: // Pan Up - warning ("STUB: Pan up"); - break; - case 15: // Pan Down - warning ("STUB: Pan down"); - break; - case 16: // Dissolve - case 17: // Dissolve (tspit CARD 155) - warning ("STUB: Dissolve"); - break; - default: - if (_scheduledTransition < 12) - error ("Found unused transition %d", _scheduledTransition); - else - error ("Found unknown transition %d", _scheduledTransition); + case 12: // Pan Left + warning ("STUB: Pan left"); + break; + case 13: // Pan Right + warning ("STUB: Pan right"); + break; + case 14: // Pan Up + warning ("STUB: Pan up"); + break; + case 15: // Pan Down + warning ("STUB: Pan down"); + break; + case 16: // Dissolve + case 17: // Dissolve (tspit CARD 155) + warning ("STUB: Dissolve"); + break; + default: + if (_scheduledTransition < 12) + error ("Found unused transition %d", _scheduledTransition); + else + error ("Found unknown transition %d", _scheduledTransition); } // For now, just copy the image to screen without doing any transition. @@ -498,90 +498,90 @@ void RivenGraphics::changeCursor(uint16 num) { // All of Riven's cursors are hardcoded. See riven_cursors.h for these definitions. switch (num) { - case 1002: - // Zip Mode - CursorMan.replaceCursor(zipModeCursor, 16, 16, 8, 8, 0); - CursorMan.replaceCursorPalette(zipModeCursorPalette, 1, ARRAYSIZE(zipModeCursorPalette) / 4); - break; - case 2003: - // Hand Over Object - CursorMan.replaceCursor(objectHandCursor, 16, 16, 8, 8, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 2004: - // Grabbing/Using Object - CursorMan.replaceCursor(grabbingHandCursor, 13, 13, 6, 6, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 3000: - // Standard Hand - CursorMan.replaceCursor(standardHandCursor, 15, 16, 6, 0, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 3001: - // Pointing Left - CursorMan.replaceCursor(pointingLeftCursor, 15, 13, 0, 3, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 3002: - // Pointing Right - CursorMan.replaceCursor(pointingRightCursor, 15, 13, 14, 3, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 3003: - // Pointing Down (Palm Up) - CursorMan.replaceCursor(pointingDownCursorPalmUp, 13, 16, 3, 15, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 3004: - // Pointing Up (Palm Up) - CursorMan.replaceCursor(pointingUpCursorPalmUp, 13, 16, 3, 0, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 3005: - // Pointing Left (Curved) - CursorMan.replaceCursor(pointingLeftCursorBent, 15, 13, 0, 5, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 3006: - // Pointing Right (Curved) - CursorMan.replaceCursor(pointingRightCursorBent, 15, 13, 14, 5, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 3007: - // Pointing Down (Palm Down) - CursorMan.replaceCursor(pointingDownCursorPalmDown, 15, 16, 7, 15, 0); - CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); - break; - case 4001: - // Red Marble - break; - case 4002: - // Orange Marble - break; - case 4003: - // Yellow Marble - break; - case 4004: - // Green Marble - break; - case 4005: - // Blue Marble - break; - case 4006: - // Purple Marble - break; - case 5000: - // Pellet - CursorMan.replaceCursor(pelletCursor, 8, 8, 4, 4, 0); - CursorMan.replaceCursorPalette(pelletCursorPalette, 1, ARRAYSIZE(pelletCursorPalette) / 4); - break; - case 9000: - // Hide Cursor - CursorMan.showMouse(false); - break; - default: - error ("Cursor %d does not exist!", num); + case 1002: + // Zip Mode + CursorMan.replaceCursor(zipModeCursor, 16, 16, 8, 8, 0); + CursorMan.replaceCursorPalette(zipModeCursorPalette, 1, ARRAYSIZE(zipModeCursorPalette) / 4); + break; + case 2003: + // Hand Over Object + CursorMan.replaceCursor(objectHandCursor, 16, 16, 8, 8, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 2004: + // Grabbing/Using Object + CursorMan.replaceCursor(grabbingHandCursor, 13, 13, 6, 6, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 3000: + // Standard Hand + CursorMan.replaceCursor(standardHandCursor, 15, 16, 6, 0, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 3001: + // Pointing Left + CursorMan.replaceCursor(pointingLeftCursor, 15, 13, 0, 3, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 3002: + // Pointing Right + CursorMan.replaceCursor(pointingRightCursor, 15, 13, 14, 3, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 3003: + // Pointing Down (Palm Up) + CursorMan.replaceCursor(pointingDownCursorPalmUp, 13, 16, 3, 15, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 3004: + // Pointing Up (Palm Up) + CursorMan.replaceCursor(pointingUpCursorPalmUp, 13, 16, 3, 0, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 3005: + // Pointing Left (Curved) + CursorMan.replaceCursor(pointingLeftCursorBent, 15, 13, 0, 5, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 3006: + // Pointing Right (Curved) + CursorMan.replaceCursor(pointingRightCursorBent, 15, 13, 14, 5, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 3007: + // Pointing Down (Palm Down) + CursorMan.replaceCursor(pointingDownCursorPalmDown, 15, 16, 7, 15, 0); + CursorMan.replaceCursorPalette(handCursorPalette, 1, ARRAYSIZE(handCursorPalette) / 4); + break; + case 4001: + // Red Marble + break; + case 4002: + // Orange Marble + break; + case 4003: + // Yellow Marble + break; + case 4004: + // Green Marble + break; + case 4005: + // Blue Marble + break; + case 4006: + // Purple Marble + break; + case 5000: + // Pellet + CursorMan.replaceCursor(pelletCursor, 8, 8, 4, 4, 0); + CursorMan.replaceCursorPalette(pelletCursorPalette, 1, ARRAYSIZE(pelletCursorPalette) / 4); + break; + case 9000: + // Hide Cursor + CursorMan.showMouse(false); + break; + default: + error ("Cursor %d does not exist!", num); } if (num != 9000) // Show Cursor diff --git a/engines/mohawk/livingbooks.cpp b/engines/mohawk/livingbooks.cpp index 390a40cea9..4d77b23ddf 100644 --- a/engines/mohawk/livingbooks.cpp +++ b/engines/mohawk/livingbooks.cpp @@ -77,29 +77,29 @@ Common::Error MohawkEngine_LivingBooks::run() { while (!shouldQuit()) { while (_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_MOUSEMOVE: - break; - case Common::EVENT_LBUTTONUP: - break; - case Common::EVENT_LBUTTONDOWN: - break; - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_d: - if (event.kbd.flags & Common::KBD_CTRL) { - _console->attach(); - _console->onFrame(); - } - break; - case Common::KEYCODE_SPACE: - pauseGame(); - break; - default: - break; + case Common::EVENT_MOUSEMOVE: + break; + case Common::EVENT_LBUTTONUP: + break; + case Common::EVENT_LBUTTONDOWN: + break; + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_d: + if (event.kbd.flags & Common::KBD_CTRL) { + _console->attach(); + _console->onFrame(); } break; + case Common::KEYCODE_SPACE: + pauseGame(); + break; default: break; + } + break; + default: + break; } } diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 6ae7d97479..1143db721e 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -118,34 +118,34 @@ Common::String MohawkEngine_Myst::wrapMovieFilename(Common::String movieName, ui const char* prefix; switch (stack) { - case kIntroStack: - prefix = "intro/"; - break; - case kChannelwoodStack: - // The Windmill videos like to hide in a different folder - if (movieName.contains("wmill")) - prefix = "channel2/"; - else - prefix = "channel/"; - break; - case kDniStack: - prefix = "dunny/"; - break; - case kMechanicalStack: - prefix = "mech/"; - break; - case kMystStack: - prefix = "myst/"; - break; - case kSeleniticStack: - prefix = "selen/"; - break; - case kStoneshipStack: - prefix = "stone/"; - break; - default: - prefix = ""; // Masterpiece Edition Only Movies - break; + case kIntroStack: + prefix = "intro/"; + break; + case kChannelwoodStack: + // The Windmill videos like to hide in a different folder + if (movieName.contains("wmill")) + prefix = "channel2/"; + else + prefix = "channel/"; + break; + case kDniStack: + prefix = "dunny/"; + break; + case kMechanicalStack: + prefix = "mech/"; + break; + case kMystStack: + prefix = "myst/"; + break; + case kSeleniticStack: + prefix = "selen/"; + break; + case kStoneshipStack: + prefix = "stone/"; + break; + default: + prefix = ""; // Masterpiece Edition Only Movies + break; } if ((getFeatures() & GF_ME) && getPlatform() == Common::kPlatformMacintosh) @@ -243,52 +243,52 @@ Common::Error MohawkEngine_Myst::run() { while (_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_MOUSEMOVE: - _mousePos = event.mouse; - _needsUpdate = true; - checkCurrentResource(); - break; - case Common::EVENT_LBUTTONUP: - if (_curResource >= 0) { - debug(2, "Sending mouse up event to resource %d\n", _curResource); - _resources[_curResource]->handleMouseUp(); - } + case Common::EVENT_MOUSEMOVE: + _mousePos = event.mouse; + _needsUpdate = true; + checkCurrentResource(); + break; + case Common::EVENT_LBUTTONUP: + if (_curResource >= 0) { + debug(2, "Sending mouse up event to resource %d\n", _curResource); + _resources[_curResource]->handleMouseUp(); + } - for (uint16 i = 0; i < _resources.size(); i++) - if (_resources[i]->isEnabled()) - _resources[i]->drawDataToScreen(); - break; - case Common::EVENT_LBUTTONDOWN: - if (_curResource >= 0) { - debug(2, "Sending mouse up event to resource %d\n", _curResource); - _resources[_curResource]->handleMouseDown(); - } - break; - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_d: - if (event.kbd.flags & Common::KBD_CTRL) { - _console->attach(); - _console->onFrame(); - } - break; - case Common::KEYCODE_SPACE: - pauseGame(); - break; - case Common::KEYCODE_F4: - _showResourceRects = !_showResourceRects; - if (_showResourceRects) - drawResourceRects(); - break; - case Common::KEYCODE_F5: - runDialog(*_optionsDialog); - break; - default: - break; + for (uint16 i = 0; i < _resources.size(); i++) + if (_resources[i]->isEnabled()) + _resources[i]->drawDataToScreen(); + break; + case Common::EVENT_LBUTTONDOWN: + if (_curResource >= 0) { + debug(2, "Sending mouse up event to resource %d\n", _curResource); + _resources[_curResource]->handleMouseDown(); + } + break; + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_d: + if (event.kbd.flags & Common::KBD_CTRL) { + _console->attach(); + _console->onFrame(); } break; + case Common::KEYCODE_SPACE: + pauseGame(); + break; + case Common::KEYCODE_F4: + _showResourceRects = !_showResourceRects; + if (_showResourceRects) + drawResourceRects(); + break; + case Common::KEYCODE_F5: + runDialog(*_optionsDialog); + break; default: break; + } + break; + default: + break; } } @@ -527,18 +527,18 @@ void MohawkEngine_Myst::loadCard() { debugC(kDebugView, "\t\t Type: %d", _view.scriptResources[i].type); switch (_view.scriptResources[i].type) { - case 1: - debugC(kDebugView, "\t\t\t\t= Image"); - break; - case 2: - debugC(kDebugView, "\t\t\t\t= Sound"); - break; - case 3: - debugC(kDebugView, "\t\t\t\t= Resource List"); - break; - default: - debugC(kDebugView, "\t\t\t\t= Unknown"); - break; + case 1: + debugC(kDebugView, "\t\t\t\t= Image"); + break; + case 2: + debugC(kDebugView, "\t\t\t\t= Sound"); + break; + case 3: + debugC(kDebugView, "\t\t\t\t= Resource List"); + break; + default: + debugC(kDebugView, "\t\t\t\t= Unknown"); + break; } if (_view.scriptResources[i].type == 3) { @@ -839,31 +839,31 @@ static MystResource *loadResource(MohawkEngine_Myst *vm, Common::SeekableReadStr debugC(kDebugResource, "\tSub_Record: %d", (parent == NULL) ? 0 : 1); switch (type) { - case kMystForwardResource: - case kMystLeftResource: - case kMystRightResource: - case kMystDownResource: - case kMystUpResource: - case 14: // TODO: kMystBackwardResource? - return new MystResource(vm, rlstStream, parent); - case kMystActionResource: - return new MystResourceType5(vm, rlstStream, parent); - case kMystVideoResource: - return new MystResourceType6(vm, rlstStream, parent); - case kMystSwitchResource: - return new MystResourceType7(vm, rlstStream, parent); - case 8: - return new MystResourceType8(vm, rlstStream, parent); - case 10: - return new MystResourceType10(vm, rlstStream, parent); - case 11: - return new MystResourceType11(vm, rlstStream, parent); - case 12: - return new MystResourceType12(vm, rlstStream, parent); - case 13: - return new MystResourceType13(vm, rlstStream, parent); - default: - error ("Unknown/Unhandled MystResource type %d", type); + case kMystForwardResource: + case kMystLeftResource: + case kMystRightResource: + case kMystDownResource: + case kMystUpResource: + case 14: // TODO: kMystBackwardResource? + return new MystResource(vm, rlstStream, parent); + case kMystActionResource: + return new MystResourceType5(vm, rlstStream, parent); + case kMystVideoResource: + return new MystResourceType6(vm, rlstStream, parent); + case kMystSwitchResource: + return new MystResourceType7(vm, rlstStream, parent); + case 8: + return new MystResourceType8(vm, rlstStream, parent); + case 10: + return new MystResourceType10(vm, rlstStream, parent); + case 11: + return new MystResourceType11(vm, rlstStream, parent); + case 12: + return new MystResourceType12(vm, rlstStream, parent); + case 13: + return new MystResourceType13(vm, rlstStream, parent); + default: + error ("Unknown/Unhandled MystResource type %d", type); } } diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index 51e961bbbd..64de638b44 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -645,16 +645,16 @@ void MystScriptParser::opcode_23(uint16 op, uint16 var, uint16 argc, uint16 *arg for (byte i = 0; i < argc; i++) { debugC(kDebugScript, "\tResource %d Enable set to %d", i, argv[i]); switch (argv[i]) { - case 0: - _vm->setResourceEnabled(i, false); - break; - case 1: - _vm->setResourceEnabled(i, true); - break; - default: - warning("Opcode %d u%d non-boolean", op, i); - _vm->setResourceEnabled(i, true); - break; + case 0: + _vm->setResourceEnabled(i, false); + break; + case 1: + _vm->setResourceEnabled(i, true); + break; + default: + warning("Opcode %d u%d non-boolean", op, i); + _vm->setResourceEnabled(i, true); + break; } } } else @@ -1108,21 +1108,21 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg debugCN(kDebugScript, "\tupdateDirection: %d = ", updateDirection); switch (updateDirection) { - case 0: - debugC(kDebugScript, "Left to Right"); - break; - case 1: - debugC(kDebugScript, "Right to Left"); - break; - case 5: - debugC(kDebugScript, "Top to Bottom"); - break; - case 6: - debugC(kDebugScript, "Bottom to Top"); - break; - default: - warning("Unknown Update Direction"); - break; + case 0: + debugC(kDebugScript, "Left to Right"); + break; + case 1: + debugC(kDebugScript, "Right to Left"); + break; + case 5: + debugC(kDebugScript, "Top to Bottom"); + break; + case 6: + debugC(kDebugScript, "Bottom to Top"); + break; + default: + warning("Unknown Update Direction"); + break; } debugC(kDebugScript, "\tu2: %d", u2); // TODO: Speed / Delay of Update? @@ -1142,21 +1142,21 @@ void MystScriptParser::opcode_41(uint16 op, uint16 var, uint16 argc, uint16 *arg debugCN(kDebugScript, "\tupdateDirection2: %d = ", updateDirection2); switch (updateDirection2) { - case 0: - debugC(kDebugScript, "Left to Right"); - break; - case 1: - debugC(kDebugScript, "Right to Left"); - break; - case 5: - debugC(kDebugScript, "Top to Bottom"); - break; - case 6: - debugC(kDebugScript, "Bottom to Top"); - break; - default: - warning("Unknown Update Direction"); - break; + case 0: + debugC(kDebugScript, "Left to Right"); + break; + case 1: + debugC(kDebugScript, "Right to Left"); + break; + case 5: + debugC(kDebugScript, "Top to Bottom"); + break; + case 6: + debugC(kDebugScript, "Bottom to Top"); + break; + default: + warning("Unknown Update Direction"); + break; } debugC(kDebugScript, "\tu3: %d", u3); // TODO: Speed / Delay of Update? @@ -1205,21 +1205,21 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg debugCN(kDebugScript, "\tupdateDirection: %d = ", updateDirection); switch (updateDirection) { - case 0: - debugC(kDebugScript, "Left to Right"); - break; - case 1: - debugC(kDebugScript, "Right to Left"); - break; - case 5: - debugC(kDebugScript, "Top to Bottom"); - break; - case 6: - debugC(kDebugScript, "Bottom to Top"); - break; - default: - warning("Unknown Update Direction"); - break; + case 0: + debugC(kDebugScript, "Left to Right"); + break; + case 1: + debugC(kDebugScript, "Right to Left"); + break; + case 5: + debugC(kDebugScript, "Top to Bottom"); + break; + case 6: + debugC(kDebugScript, "Bottom to Top"); + break; + default: + warning("Unknown Update Direction"); + break; } debugC(kDebugScript, "\tu2: %d", u2); // TODO: Speed / Delay of Update? @@ -1239,21 +1239,21 @@ void MystScriptParser::opcode_42(uint16 op, uint16 var, uint16 argc, uint16 *arg debugCN(kDebugScript, "\tupdateDirection2: %d = ", updateDirection2); switch (updateDirection2) { - case 0: - debugC(kDebugScript, "Left to Right"); - break; - case 1: - debugC(kDebugScript, "Right to Left"); - break; - case 5: - debugC(kDebugScript, "Top to Bottom"); - break; - case 6: - debugC(kDebugScript, "Bottom to Top"); - break; - default: - warning("Unknown Update Direction"); - break; + case 0: + debugC(kDebugScript, "Left to Right"); + break; + case 1: + debugC(kDebugScript, "Right to Left"); + break; + case 5: + debugC(kDebugScript, "Top to Bottom"); + break; + case 6: + debugC(kDebugScript, "Bottom to Top"); + break; + default: + warning("Unknown Update Direction"); + break; } debugC(kDebugScript, "\tu3: %d", u3); // TODO: Speed / Delay of Update? @@ -1318,532 +1318,532 @@ void MystScriptParser::opcode_100(uint16 op, uint16 var, uint16 argc, uint16 *ar const uint16 soundIdLinkSrc = 5; switch (_vm->getCurStack()) { - case kIntroStack: - debugC(kDebugScript, "Opcode %d: ChangeStack", op); - debugC(kDebugScript, "\tvar: %d", var); + case kIntroStack: + debugC(kDebugScript, "Opcode %d: ChangeStack", op); + debugC(kDebugScript, "\tvar: %d", var); - // TODO: Merge with changeStack (Opcode 40) Implementation? - if (_vm->_varStore->getVar(var) == 5 || _vm->_varStore->getVar(var) > 7) { - // TODO: Dead Book i.e. Released Sirrus/Achenar - } else { - // Play Linking Sound, blocking... - _vm->_sound->stopSound(); - Audio::SoundHandle *handle = _vm->_sound->playSound(soundIdLinkSrc); - while (_vm->_mixer->isSoundHandleActive(*handle)) - _vm->_system->delayMillis(10); + // TODO: Merge with changeStack (Opcode 40) Implementation? + if (_vm->_varStore->getVar(var) == 5 || _vm->_varStore->getVar(var) > 7) { + // TODO: Dead Book i.e. Released Sirrus/Achenar + } else { + // Play Linking Sound, blocking... + _vm->_sound->stopSound(); + Audio::SoundHandle *handle = _vm->_sound->playSound(soundIdLinkSrc); + while (_vm->_mixer->isSoundHandleActive(*handle)) + _vm->_system->delayMillis(10); - // Play Flyby Entry Movie on Masterpiece Edition.. - if ((_vm->getFeatures() & GF_ME)) { - switch (stack_map[_vm->_varStore->getVar(var)]) { - case kSeleniticStack: - _vm->_video->playMovieCentered(_vm->wrapMovieFilename("selenitic flyby", kMasterpieceOnly)); - break; - case kStoneshipStack: - _vm->_video->playMovieCentered(_vm->wrapMovieFilename("stoneship flyby", kMasterpieceOnly)); - break; - // Myst Flyby Movie not used in Original Masterpiece Edition Engine - case kMystStack: - if (_vm->_tweaksEnabled) - _vm->_video->playMovieCentered(_vm->wrapMovieFilename("myst flyby", kMasterpieceOnly)); - break; - case kMechanicalStack: - _vm->_video->playMovieCentered(_vm->wrapMovieFilename("mech age flyby", kMasterpieceOnly)); - break; - case kChannelwoodStack: - _vm->_video->playMovieCentered(_vm->wrapMovieFilename("channelwood flyby", kMasterpieceOnly)); - break; - default: - break; - } + // Play Flyby Entry Movie on Masterpiece Edition.. + if ((_vm->getFeatures() & GF_ME)) { + switch (stack_map[_vm->_varStore->getVar(var)]) { + case kSeleniticStack: + _vm->_video->playMovieCentered(_vm->wrapMovieFilename("selenitic flyby", kMasterpieceOnly)); + break; + case kStoneshipStack: + _vm->_video->playMovieCentered(_vm->wrapMovieFilename("stoneship flyby", kMasterpieceOnly)); + break; + // Myst Flyby Movie not used in Original Masterpiece Edition Engine + case kMystStack: + if (_vm->_tweaksEnabled) + _vm->_video->playMovieCentered(_vm->wrapMovieFilename("myst flyby", kMasterpieceOnly)); + break; + case kMechanicalStack: + _vm->_video->playMovieCentered(_vm->wrapMovieFilename("mech age flyby", kMasterpieceOnly)); + break; + case kChannelwoodStack: + _vm->_video->playMovieCentered(_vm->wrapMovieFilename("channelwood flyby", kMasterpieceOnly)); + break; + default: + break; } + } - uint16 varValue = _vm->_varStore->getVar(var); - _vm->changeToStack(stack_map[varValue]); - _vm->changeToCard(start_card[varValue]); + uint16 varValue = _vm->_varStore->getVar(var); + _vm->changeToStack(stack_map[varValue]); + _vm->changeToCard(start_card[varValue]); - // TODO: No soundIdLinkDst for Opcode 100 link? Check Original. - } - break; - case kStoneshipStack: - // Used for Cards 2185 (Water Pump) - varUnusedCheck(op, var); + // TODO: No soundIdLinkDst for Opcode 100 link? Check Original. + } + break; + case kStoneshipStack: + // Used for Cards 2185 (Water Pump) + varUnusedCheck(op, var); - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown Function", op); + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown Function", op); - // TODO: Called when Water Pump Button is pressed? Animation? - } else - unknown(op, var, argc, argv); - break; - case kDniStack: - // Used in Card 5022 (Rocks) - varUnusedCheck(op, var); + // TODO: Called when Water Pump Button is pressed? Animation? + } else + unknown(op, var, argc, argv); + break; + case kDniStack: + // Used in Card 5022 (Rocks) + varUnusedCheck(op, var); - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown Function", op); + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown Function", op); - // TODO: Fill in Logic. - } else - unknown(op, var, argc, argv); - break; - case kCreditsStack: - case kMakingOfStack: - _vm->_system->quit(); - break; - case kDemoSlidesStack: - // TODO: Change to changeStack call? - _vm->changeToStack(kDemoStack); - _vm->changeToCard(2001); - break; - default: + // TODO: Fill in Logic. + } else unknown(op, var, argc, argv); - break; + break; + case kCreditsStack: + case kMakingOfStack: + _vm->_system->quit(); + break; + case kDemoSlidesStack: + // TODO: Change to changeStack call? + _vm->changeToStack(kDemoStack); + _vm->changeToCard(2001); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_101(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kSeleniticStack: - varUnusedCheck(op, var); - - if (argc == 0) { - // Used on Card 1191 (Maze Runner) - // Called when Red Warning Button is pushed + case kSeleniticStack: + varUnusedCheck(op, var); - debugC(kDebugScript, "Opcode %d: Repeat Buzzer Sound?", op); + if (argc == 0) { + // Used on Card 1191 (Maze Runner) + // Called when Red Warning Button is pushed - // TODO: Fill in logic... - // Repeat buzzer sound - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - varUnusedCheck(op, var); + debugC(kDebugScript, "Opcode %d: Repeat Buzzer Sound?", op); - if (argc == 6) { - // Used by Door Buttons to Brothers' Rooms - // Cards 2294, 2255 - Common::Rect u0_rect = Common::Rect(argv[0], argv[1], argv[2], argv[3]); - uint16 u1 = argv[3]; - uint16 u2 = argv[2]; - - debugC(kDebugScript, "Opcode %d: Unknown", op); - debugC(kDebugScript, "u0_rect.left: %d", u0_rect.left); - debugC(kDebugScript, "u0_rect.top: %d", u0_rect.top); - debugC(kDebugScript, "u0_rect.right: %d", u0_rect.right); - debugC(kDebugScript, "u0_rect.bottom: %d", u0_rect.bottom); - debugC(kDebugScript, "u1: %d", u1); - debugC(kDebugScript, "u2: %d", u2); - - // TODO: Fill in logic... - } else - unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - case kMystStack: - debugC(kDebugScript, "Opcode %d: Decrement Variable", op); - if (argc == 0) { - debugC(kDebugScript, "\tvar: %d", var); - uint16 varValue = _vm->_varStore->getVar(var); - // Logic to prevent decrement to negative - if (varValue != 0) - _vm->_varStore->setVar(var, varValue - 1); - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - varUnusedCheck(op, var); + // TODO: Fill in logic... + // Repeat buzzer sound + } else + unknown(op, var, argc, argv); + break; + case kStoneshipStack: + varUnusedCheck(op, var); + + if (argc == 6) { + // Used by Door Buttons to Brothers' Rooms + // Cards 2294, 2255 + Common::Rect u0_rect = Common::Rect(argv[0], argv[1], argv[2], argv[3]); + uint16 u1 = argv[3]; + uint16 u2 = argv[2]; + + debugC(kDebugScript, "Opcode %d: Unknown", op); + debugC(kDebugScript, "u0_rect.left: %d", u0_rect.left); + debugC(kDebugScript, "u0_rect.top: %d", u0_rect.top); + debugC(kDebugScript, "u0_rect.right: %d", u0_rect.right); + debugC(kDebugScript, "u0_rect.bottom: %d", u0_rect.bottom); + debugC(kDebugScript, "u1: %d", u1); + debugC(kDebugScript, "u2: %d", u2); + + // TODO: Fill in logic... + } else + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + case kMystStack: + debugC(kDebugScript, "Opcode %d: Decrement Variable", op); + if (argc == 0) { + debugC(kDebugScript, "\tvar: %d", var); + uint16 varValue = _vm->_varStore->getVar(var); + // Logic to prevent decrement to negative + if (varValue != 0) + _vm->_varStore->setVar(var, varValue - 1); + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + varUnusedCheck(op, var); - if (argc == 1) { - debugC(kDebugScript, "Opcode %d: Play Pipe Movie and Sound", op); + if (argc == 1) { + debugC(kDebugScript, "Opcode %d: Play Pipe Movie and Sound", op); - uint16 soundId = argv[0]; - debugC(kDebugScript, "\tsoundId: %d", soundId); + uint16 soundId = argv[0]; + debugC(kDebugScript, "\tsoundId: %d", soundId); - _vm->_sound->playSound(soundId); + _vm->_sound->playSound(soundId); - // TODO: Get Movie Location from Invoking Resource Rect, rather than - // hardcoded 267, 170 ? - - // TODO: Need version of playMovie blocking which allows selection - // of start and finish points. - if (!_vm->_varStore->getVar(6)) { - // Play Pipe Extending i.e. 0 to 1/2 way through file - _vm->_video->playMovie(_vm->wrapMovieFilename("pipebrid", kChannelwoodStack), 267, 170); - } else { - // Play Pipe Retracting i.e. 1/2 way to end of file - _vm->_video->playMovie(_vm->wrapMovieFilename("pipebrid", kChannelwoodStack), 267, 170); - } - } else - unknown(op, var, argc, argv); - break; - case kDniStack: - // Used in Card 5014 (Atrus) - // Hotspot Resource Used to hand Page to Atrus... - varUnusedCheck(op, var); - // TODO: Fill in Logic. - break; - case kDemoStack: - varUnusedCheck(op, var); + // TODO: Get Movie Location from Invoking Resource Rect, rather than + // hardcoded 267, 170 ? - // Used on Card 2000, 2002 and 2003 - // Triggered by Click - if (argc == 0) { - // TODO: Fill in Logic.. Fade in? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Need version of playMovie blocking which allows selection + // of start and finish points. + if (!_vm->_varStore->getVar(6)) { + // Play Pipe Extending i.e. 0 to 1/2 way through file + _vm->_video->playMovie(_vm->wrapMovieFilename("pipebrid", kChannelwoodStack), 267, 170); + } else { + // Play Pipe Retracting i.e. 1/2 way to end of file + _vm->_video->playMovie(_vm->wrapMovieFilename("pipebrid", kChannelwoodStack), 267, 170); + } + } else + unknown(op, var, argc, argv); + break; + case kDniStack: + // Used in Card 5014 (Atrus) + // Hotspot Resource Used to hand Page to Atrus... + varUnusedCheck(op, var); + // TODO: Fill in Logic. + break; + case kDemoStack: + varUnusedCheck(op, var); + + // Used on Card 2000, 2002 and 2003 + // Triggered by Click + if (argc == 0) { + // TODO: Fill in Logic.. Fade in? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_102(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kStoneshipStack: - varUnusedCheck(op, var); + case kStoneshipStack: + varUnusedCheck(op, var); - if (argc == 2) { - debugC(kDebugScript, "Opcode %d: Play Book Room Movie", op); + if (argc == 2) { + debugC(kDebugScript, "Opcode %d: Play Book Room Movie", op); - uint16 startTime = argv[0]; - uint16 endTime = argv[1]; + uint16 startTime = argv[0]; + uint16 endTime = argv[1]; - debugC(kDebugScript, "\tstartTime: %d", startTime); - debugC(kDebugScript, "\tendTime: %d", endTime); + debugC(kDebugScript, "\tstartTime: %d", startTime); + debugC(kDebugScript, "\tendTime: %d", endTime); - printf("TODO: Opcode %d Movie Time Index %d to %d\n", op, startTime, endTime); - // TODO: Need version of playMovie blocking which allows selection - // of start and finish points. - _vm->_video->playMovie(_vm->wrapMovieFilename("bkroom", kStoneshipStack), 159, 99); - } else - unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - case kMystStack: - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Increment Variable", op); - debugC(kDebugScript, "\tvar: %d", var); + printf("TODO: Opcode %d Movie Time Index %d to %d\n", op, startTime, endTime); + // TODO: Need version of playMovie blocking which allows selection + // of start and finish points. + _vm->_video->playMovie(_vm->wrapMovieFilename("bkroom", kStoneshipStack), 159, 99); + } else + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + case kMystStack: + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Increment Variable", op); + debugC(kDebugScript, "\tvar: %d", var); - // AFAIK no logic to put ceiling on increment at least in this opcode - _vm->_varStore->setVar(var, _vm->_varStore->getVar(var) + 1); - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - varUnusedCheck(op, var); + // AFAIK no logic to put ceiling on increment at least in this opcode + _vm->_varStore->setVar(var, _vm->_varStore->getVar(var) + 1); + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + varUnusedCheck(op, var); - if (argc == 2 || argc == 3) { - debugC(kDebugScript, "Opcode %d: Draw Full Screen Image, Optional Delay and Change Card", op); + if (argc == 2 || argc == 3) { + debugC(kDebugScript, "Opcode %d: Draw Full Screen Image, Optional Delay and Change Card", op); - uint16 imageId = argv[0]; - uint16 cardId = argv[1]; - uint16 delay = 0; - - if (argc == 3) - delay = argv[2]; // TODO: Not sure about purpose of this parameter... + uint16 imageId = argv[0]; + uint16 cardId = argv[1]; + uint16 delay = 0; - debugC(kDebugScript, "\timageId: %d", imageId); - debugC(kDebugScript, "\tcardId: %d", cardId); - debugC(kDebugScript, "\tdelay: %d", delay); + if (argc == 3) + delay = argv[2]; // TODO: Not sure about purpose of this parameter... - _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); - _vm->_system->delayMillis(delay / 100); - _vm->changeToCard(cardId); - } else - unknown(op, var, argc, argv); - break; - case kDemoStack: - varUnusedCheck(op, var); + debugC(kDebugScript, "\timageId: %d", imageId); + debugC(kDebugScript, "\tcardId: %d", cardId); + debugC(kDebugScript, "\tdelay: %d", delay); - // Used on Card 2002 and 2003 - // Triggered by Click - if (argc == 0) { - // TODO: Fill in Logic.. Fade out? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); + _vm->_system->delayMillis(delay / 100); + _vm->changeToCard(cardId); + } else + unknown(op, var, argc, argv); + break; + case kDemoStack: + varUnusedCheck(op, var); + + // Used on Card 2002 and 2003 + // Triggered by Click + if (argc == 0) { + // TODO: Fill in Logic.. Fade out? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_103(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kStoneshipStack: - varUnusedCheck(op, var); + case kStoneshipStack: + varUnusedCheck(op, var); - if (argc == 1) { - // Used on Card 2197 (Sirrus' Room Drawers) - debugC(kDebugScript, "Opcode %d: Unknown", op); + if (argc == 1) { + // Used on Card 2197 (Sirrus' Room Drawers) + debugC(kDebugScript, "Opcode %d: Unknown", op); - uint16 u0 = argv[0]; + uint16 u0 = argv[0]; - debugC(kDebugScript, "\tu0: %d", u0); - // TODO: Fill in Logic... - } else - unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - case kMystStack: - // Used on Myst Card 4162 (Fireplace Grid) - if (argc == 1) { - debugC(kDebugScript, "Opcode %d: Toggle Variable with Bitmask", op); + debugC(kDebugScript, "\tu0: %d", u0); + // TODO: Fill in Logic... + } else + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + case kMystStack: + // Used on Myst Card 4162 (Fireplace Grid) + if (argc == 1) { + debugC(kDebugScript, "Opcode %d: Toggle Variable with Bitmask", op); - uint16 bitmask = argv[0]; - uint16 varValue = _vm->_varStore->getVar(var); + uint16 bitmask = argv[0]; + uint16 varValue = _vm->_varStore->getVar(var); - debugC(kDebugScript, "\tvar: %d", var); - debugC(kDebugScript, "\tbitmask: 0x%02X", bitmask); + debugC(kDebugScript, "\tvar: %d", var); + debugC(kDebugScript, "\tbitmask: 0x%02X", bitmask); - if (varValue & bitmask) - _vm->_varStore->setVar(var, varValue & ~bitmask); - else - _vm->_varStore->setVar(var, varValue | bitmask); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + if (varValue & bitmask) + _vm->_varStore->setVar(var, varValue & ~bitmask); + else + _vm->_varStore->setVar(var, varValue | bitmask); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_104(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kStoneshipStack: - varUnusedCheck(op, var); + case kStoneshipStack: + varUnusedCheck(op, var); - // Used for Card 2004 (Achenar's Room Drawers) - // Used for Closeup of Torn Note? - if (argc == 1) { - debugC(kDebugScript, "Opcode %d: Unknown Function", op); - - uint16 u0 = argv[0]; - debugC(kDebugScript, "\tu0: %d", u0); + // Used for Card 2004 (Achenar's Room Drawers) + // Used for Closeup of Torn Note? + if (argc == 1) { + debugC(kDebugScript, "Opcode %d: Unknown Function", op); - // TODO: Fill in Function... - // Does u0 correspond to a resource Id? Enable? Disable? - // Similar to Opcode 111 (Stoneship Version).. But does this also - // draw closeup image of note / change to closeup card? - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - varUnusedCheck(op, var); + uint16 u0 = argv[0]; + debugC(kDebugScript, "\tu0: %d", u0); - // Used on Myst Card 4162 and 4166 (Fireplace Puzzle Rotation Movies) - if (argc == 1) { - debugC(kDebugScript, "Opcode %d: Play Fireplace Puzzle Rotation Movies", op); + // TODO: Fill in Function... + // Does u0 correspond to a resource Id? Enable? Disable? + // Similar to Opcode 111 (Stoneship Version).. But does this also + // draw closeup image of note / change to closeup card? + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + varUnusedCheck(op, var); - uint16 movieNum = argv[0]; - debugC(kDebugScript, "\tmovieNum: %d", movieNum); + // Used on Myst Card 4162 and 4166 (Fireplace Puzzle Rotation Movies) + if (argc == 1) { + debugC(kDebugScript, "Opcode %d: Play Fireplace Puzzle Rotation Movies", op); - if (movieNum == 0) - _vm->_video->playMovie(_vm->wrapMovieFilename("fpin", kMystStack), 167, 5); - if (movieNum == 1) - _vm->_video->playMovie(_vm->wrapMovieFilename("fpout", kMystStack), 167, 5); - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - varUnusedCheck(op, var); + uint16 movieNum = argv[0]; + debugC(kDebugScript, "\tmovieNum: %d", movieNum); - // Used on Mechanical Card 6043 (Weapons Rack with Snake Box) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Trigger Playing Of Snake Movie", op); + if (movieNum == 0) + _vm->_video->playMovie(_vm->wrapMovieFilename("fpin", kMystStack), 167, 5); + if (movieNum == 1) + _vm->_video->playMovie(_vm->wrapMovieFilename("fpout", kMystStack), 167, 5); + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + varUnusedCheck(op, var); - // TODO: Trigger Type 6 To Play Snake Movie.. Resource #3 on card. - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - varUnusedCheck(op, var); + // Used on Mechanical Card 6043 (Weapons Rack with Snake Box) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Trigger Playing Of Snake Movie", op); - // Used on Channelwood Card 3280 - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Open Animation", op); - Common::Rect rect = _invokingResource->getRect(); + // TODO: Trigger Type 6 To Play Snake Movie.. Resource #3 on card. + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + varUnusedCheck(op, var); + + // Used on Channelwood Card 3280 + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Open Animation", op); + Common::Rect rect = _invokingResource->getRect(); + + // TODO: Need to load the image ids from Script Resources structure of VIEW + for (uint16 imageId = 3595; imageId <= 3601; imageId++) { + _vm->_gfx->copyImageToScreen(imageId, rect); + _vm->_system->delayMillis(50); + } - // TODO: Need to load the image ids from Script Resources structure of VIEW - for (uint16 imageId = 3595; imageId <= 3601; imageId++) { - _vm->_gfx->copyImageToScreen(imageId, rect); - _vm->_system->delayMillis(50); - } - - // TODO: Is 8 gotten from var7 of calling hotspot, rather than hardcoded? - _vm->_varStore->setVar(8, 1); - _vm->_varStore->setVar(19, 1); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Is 8 gotten from var7 of calling hotspot, rather than hardcoded? + _vm->_varStore->setVar(8, 1); + _vm->_varStore->setVar(19, 1); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_105(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kSeleniticStack: - if (argc == 1) { - uint16 soundId = argv[0]; + case kSeleniticStack: + if (argc == 1) { + uint16 soundId = argv[0]; - debugC(kDebugScript, "Opcode %d: Sound Receiver Water Button", op); - debugC(kDebugScript, "\tvar: %d", var); + debugC(kDebugScript, "Opcode %d: Sound Receiver Water Button", op); + debugC(kDebugScript, "\tvar: %d", var); - // TODO: Complete Function including Var Change? - _vm->_sound->playSound(soundId); - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - if (argc == 1) { - varUnusedCheck(op, var); + // TODO: Complete Function including Var Change? + _vm->_sound->playSound(soundId); + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + if (argc == 1) { + varUnusedCheck(op, var); - uint16 soundId = argv[0]; - uint16 boxValue = 0; - Audio::SoundHandle *handle; + uint16 soundId = argv[0]; + uint16 boxValue = 0; + Audio::SoundHandle *handle; - debugC(kDebugScript, "Opcode %d: Ship Puzzle Logic", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); + debugC(kDebugScript, "Opcode %d: Ship Puzzle Logic", op); + debugC(kDebugScript, "\tsoundId: %d", soundId); - // Logic for Myst Ship Box Puzzle Solution - for (byte i = 0; i < 8; i++) - boxValue |= _vm->_varStore->getVar(i + 26) ? (1 << i) : 0; + // Logic for Myst Ship Box Puzzle Solution + for (byte i = 0; i < 8; i++) + boxValue |= _vm->_varStore->getVar(i + 26) ? (1 << i) : 0; - uint16 var10 = _vm->_varStore->getVar(10); + uint16 var10 = _vm->_varStore->getVar(10); - if (boxValue == 0x32 && var10 == 0) { - handle = _vm->_sound->playSound(soundId); + if (boxValue == 0x32 && var10 == 0) { + handle = _vm->_sound->playSound(soundId); - while (_vm->_mixer->isSoundHandleActive(*handle)) - _vm->_system->delayMillis(10); + while (_vm->_mixer->isSoundHandleActive(*handle)) + _vm->_system->delayMillis(10); - _vm->_varStore->setVar(10, 1); - } else if (boxValue != 0x32 && var10 == 1) { - handle = _vm->_sound->playSound(soundId); + _vm->_varStore->setVar(10, 1); + } else if (boxValue != 0x32 && var10 == 1) { + handle = _vm->_sound->playSound(soundId); - while (_vm->_mixer->isSoundHandleActive(*handle)) - _vm->_system->delayMillis(10); + while (_vm->_mixer->isSoundHandleActive(*handle)) + _vm->_system->delayMillis(10); - _vm->_varStore->setVar(10, 0); - } - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - varUnusedCheck(op, var); + _vm->_varStore->setVar(10, 0); + } + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + varUnusedCheck(op, var); - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Play Stairs Movement Movie", op); + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Play Stairs Movement Movie", op); - if (_vm->_varStore->getVar(10)) { - // TODO: Play Movie from 0 to 1/2 way... - _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack), 174, 222); - } else { - // TODO: Play Movie from 1/2 way to end... - _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack), 174, 222); - } + if (_vm->_varStore->getVar(10)) { + // TODO: Play Movie from 0 to 1/2 way... + _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack), 174, 222); + } else { + // TODO: Play Movie from 1/2 way to end... + _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack), 174, 222); } - break; - default: - unknown(op, var, argc, argv); - break; + } + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_106(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kSeleniticStack: - if (argc == 1) { - uint16 soundId = argv[0]; + case kSeleniticStack: + if (argc == 1) { + uint16 soundId = argv[0]; - debugC(kDebugScript, "Opcode %d: Sound Receiver Volcanic Crack Button", op); - debugC(kDebugScript, "\tvar: %d", var); + debugC(kDebugScript, "Opcode %d: Sound Receiver Volcanic Crack Button", op); + debugC(kDebugScript, "\tvar: %d", var); - // TODO: Complete Function including Var Change? - _vm->_sound->playSound(soundId); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Complete Function including Var Change? + _vm->_sound->playSound(soundId); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_107(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kSeleniticStack: - if (argc == 1) { - uint16 soundId = argv[0]; + case kSeleniticStack: + if (argc == 1) { + uint16 soundId = argv[0]; - debugC(kDebugScript, "Opcode %d: Sound Receiver Clock Button", op); - debugC(kDebugScript, "\tvar: %d", var); + debugC(kDebugScript, "Opcode %d: Sound Receiver Clock Button", op); + debugC(kDebugScript, "\tvar: %d", var); - // TODO: Complete Function including Var Change? - _vm->_sound->playSound(soundId); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Complete Function including Var Change? + _vm->_sound->playSound(soundId); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_108(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kSeleniticStack: - if (argc == 1) { - uint16 soundId = argv[0]; + case kSeleniticStack: + if (argc == 1) { + uint16 soundId = argv[0]; - debugC(kDebugScript, "Opcode %d: Sound Receiver Crystal Rocks Button", op); - debugC(kDebugScript, "\tvar: %d", var); + debugC(kDebugScript, "Opcode %d: Sound Receiver Crystal Rocks Button", op); + debugC(kDebugScript, "\tvar: %d", var); - // TODO: Complete Function including Var Change? - _vm->_sound->playSound(soundId); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Complete Function including Var Change? + _vm->_sound->playSound(soundId); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_109(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kSeleniticStack: - if (argc == 1) { - uint16 soundId = argv[0]; + case kSeleniticStack: + if (argc == 1) { + uint16 soundId = argv[0]; - debugC(kDebugScript, "Opcode %d: Sound Receiver Wind Button", op); - debugC(kDebugScript, "\tvar: %d", var); + debugC(kDebugScript, "Opcode %d: Sound Receiver Wind Button", op); + debugC(kDebugScript, "\tvar: %d", var); - // TODO: Complete Function including Var Change? - _vm->_sound->playSound(soundId); - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - if (argc == 1) { - int16 signedValue = argv[0]; + // TODO: Complete Function including Var Change? + _vm->_sound->playSound(soundId); + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + if (argc == 1) { + int16 signedValue = argv[0]; - debugC(kDebugScript, "Opcode %d: Add Signed Value to Var", op); - debugC(kDebugScript, "\tVar: %d", var); - debugC(kDebugScript, "\tsignedValue: %d", signedValue); + debugC(kDebugScript, "Opcode %d: Add Signed Value to Var", op); + debugC(kDebugScript, "\tVar: %d", var); + debugC(kDebugScript, "\tsignedValue: %d", signedValue); - _vm->_varStore->setVar(var, _vm->_varStore->getVar(var) + signedValue); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + _vm->_varStore->setVar(var, _vm->_varStore->getVar(var) + signedValue); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -1851,47 +1851,47 @@ void MystScriptParser::opcode_110(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kSeleniticStack: - if (argc == 15) { - // Used for Selenitic Maze Runner Exit Logic - uint16 CardIdEntry = argv[0]; - uint16 CardIdExit = argv[1]; - uint16 u0 = argv[2]; - Common::Rect rect1 = Common::Rect(argv[3], argv[4], argv[5], argv[6]); - uint16 rect1UpdateDirection = argv[7]; - uint16 u1 = argv[8]; - Common::Rect rect2 = Common::Rect(argv[9], argv[10], argv[11], argv[12]); - uint16 rect2UpdateDirection = argv[13]; - uint16 u2 = argv[14]; - - debugC(kDebugScript, "Opcode %d: Maze Runner Exit Logic and Door Open Animation", op); - debugC(kDebugScript, "\tExit Card: %d", CardIdEntry); - debugC(kDebugScript, "\tEntry Card: %d", CardIdExit); - debugC(kDebugScript, "\tu0 (Exit Var?): %d", u0); - - debugC(kDebugScript, "\trect1.left: %d", rect1.left); - debugC(kDebugScript, "\trect1.top: %d", rect1.top); - debugC(kDebugScript, "\trect1.right: %d", rect1.right); - debugC(kDebugScript, "\trect1.bottom: %d", rect1.bottom); - debugC(kDebugScript, "\trect1 updateDirection: %d", rect1UpdateDirection); - debugC(kDebugScript, "\tu1: %d", u1); - - debugC(kDebugScript, "\trect2.left: %d", rect2.left); - debugC(kDebugScript, "\trect2.top: %d", rect2.top); - debugC(kDebugScript, "\trect2.right: %d", rect2.right); - debugC(kDebugScript, "\trect2.bottom: %d", rect2.bottom); - debugC(kDebugScript, "\trect2 updateDirection: %d", rect2UpdateDirection); - debugC(kDebugScript, "\tu2: %d", u2); - - // TODO: Finish Implementing Logic... - // HACK: Bypass Higher Logic for now... - _vm->changeToCard(argv[1]); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kSeleniticStack: + if (argc == 15) { + // Used for Selenitic Maze Runner Exit Logic + uint16 CardIdEntry = argv[0]; + uint16 CardIdExit = argv[1]; + uint16 u0 = argv[2]; + Common::Rect rect1 = Common::Rect(argv[3], argv[4], argv[5], argv[6]); + uint16 rect1UpdateDirection = argv[7]; + uint16 u1 = argv[8]; + Common::Rect rect2 = Common::Rect(argv[9], argv[10], argv[11], argv[12]); + uint16 rect2UpdateDirection = argv[13]; + uint16 u2 = argv[14]; + + debugC(kDebugScript, "Opcode %d: Maze Runner Exit Logic and Door Open Animation", op); + debugC(kDebugScript, "\tExit Card: %d", CardIdEntry); + debugC(kDebugScript, "\tEntry Card: %d", CardIdExit); + debugC(kDebugScript, "\tu0 (Exit Var?): %d", u0); + + debugC(kDebugScript, "\trect1.left: %d", rect1.left); + debugC(kDebugScript, "\trect1.top: %d", rect1.top); + debugC(kDebugScript, "\trect1.right: %d", rect1.right); + debugC(kDebugScript, "\trect1.bottom: %d", rect1.bottom); + debugC(kDebugScript, "\trect1 updateDirection: %d", rect1UpdateDirection); + debugC(kDebugScript, "\tu1: %d", u1); + + debugC(kDebugScript, "\trect2.left: %d", rect2.left); + debugC(kDebugScript, "\trect2.top: %d", rect2.top); + debugC(kDebugScript, "\trect2.right: %d", rect2.right); + debugC(kDebugScript, "\trect2.bottom: %d", rect2.bottom); + debugC(kDebugScript, "\trect2 updateDirection: %d", rect2UpdateDirection); + debugC(kDebugScript, "\tu2: %d", u2); + + // TODO: Finish Implementing Logic... + // HACK: Bypass Higher Logic for now... + _vm->changeToCard(argv[1]); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -1899,63 +1899,63 @@ void MystScriptParser::opcode_111(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kSeleniticStack: - if (argc == 0) { - // Used on Card 1245 (Sound Receiver) - // Used by Source Selection Buttons... + case kSeleniticStack: + if (argc == 0) { + // Used on Card 1245 (Sound Receiver) + // Used by Source Selection Buttons... - debugC(kDebugScript, "Opcode %d: Unknown", op); - // TODO: Fill in Function... - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - if (argc == 1) { - // Used for Card 2004 (Achenar's Room Drawers) - // Used by Drawers Hotspots... + debugC(kDebugScript, "Opcode %d: Unknown", op); + // TODO: Fill in Function... + } else + unknown(op, var, argc, argv); + break; + case kStoneshipStack: + if (argc == 1) { + // Used for Card 2004 (Achenar's Room Drawers) + // Used by Drawers Hotspots... - debugC(kDebugScript, "Opcode %d: Unknown Function", op); + debugC(kDebugScript, "Opcode %d: Unknown Function", op); - uint16 u0 = argv[0]; - debugC(kDebugScript, "\tu0: %d", u0); + uint16 u0 = argv[0]; + debugC(kDebugScript, "\tu0: %d", u0); - // TODO: Fill in Function... - // Does u0 correspond to a resource Id? Enable? Disable? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Fill in Function... + // Does u0 correspond to a resource Id? Enable? Disable? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_112(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kStoneshipStack: - // Used for Card 2013 (Achenar's Rose-Skull Hologram) - if (argc == 3) { - debugC(kDebugScript, "Opcode %d: Rose-Skull Hologram Playback", op); + case kStoneshipStack: + // Used for Card 2013 (Achenar's Rose-Skull Hologram) + if (argc == 3) { + debugC(kDebugScript, "Opcode %d: Rose-Skull Hologram Playback", op); - uint16 varValue = _vm->_varStore->getVar(var); + uint16 varValue = _vm->_varStore->getVar(var); - debugC(kDebugScript, "\tVar: %d = %d", var, varValue); + debugC(kDebugScript, "\tVar: %d = %d", var, varValue); - uint16 startPoint = argv[0]; - uint16 endPoint = argv[1]; - uint16 u0 = argv[2]; + uint16 startPoint = argv[0]; + uint16 endPoint = argv[1]; + uint16 u0 = argv[2]; - debugC(kDebugScript, "\tstartPoint: %d", startPoint); - debugC(kDebugScript, "\tendPoint: %d", endPoint); - debugC(kDebugScript, "\tu0: %d", u0); + debugC(kDebugScript, "\tstartPoint: %d", startPoint); + debugC(kDebugScript, "\tendPoint: %d", endPoint); + debugC(kDebugScript, "\tu0: %d", u0); - // TODO: Fill in Function... - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Fill in Function... + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -1963,52 +1963,52 @@ void MystScriptParser::opcode_113(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used on Myst 4143 (Dock near Marker Switch) - if (argc == 9) { - uint16 soundId = argv[0]; + case kMystStack: + // Used on Myst 4143 (Dock near Marker Switch) + if (argc == 9) { + uint16 soundId = argv[0]; - uint16 u0 = argv[1]; - uint16 u1 = argv[2]; + uint16 u0 = argv[1]; + uint16 u1 = argv[2]; - Common::Rect rect = Common::Rect(argv[3], argv[4], argv[5], argv[6]); + Common::Rect rect = Common::Rect(argv[3], argv[4], argv[5], argv[6]); - uint16 updateDirection = argv[7]; - uint16 u2 = argv[8]; + uint16 updateDirection = argv[7]; + uint16 u2 = argv[8]; - debugC(kDebugScript, "Opcode %d: Vault Open Logic", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - debugC(kDebugScript, "\tu0: %d", u0); - debugC(kDebugScript, "\tu1: %d", u1); - - debugC(kDebugScript, "\trect.left: %d", rect.left); - debugC(kDebugScript, "\trect.top: %d", rect.top); - debugC(kDebugScript, "\trect.right: %d", rect.right); - debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); - debugC(kDebugScript, "\trect updateDirection: %d", updateDirection); - debugC(kDebugScript, "\tu2: %d", u2); - - if ((_vm->_varStore->getVar(2) == 1) && - (_vm->_varStore->getVar(3) == 1) && - (_vm->_varStore->getVar(4) == 0) && - (_vm->_varStore->getVar(5) == 1) && - (_vm->_varStore->getVar(6) == 1) && - (_vm->_varStore->getVar(7) == 1) && - (_vm->_varStore->getVar(8) == 1) && - (_vm->_varStore->getVar(9) == 1)) { - // TODO: Implement correct function... - // Blit Image in Left to Right Vertical stripes i.e. transistion - // like door opening - _vm->_sound->playSound(soundId); - // TODO: Set 41 to 1 if page already present in hand. - _vm->_varStore->setVar(41, 2); - } - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + debugC(kDebugScript, "Opcode %d: Vault Open Logic", op); + debugC(kDebugScript, "\tsoundId: %d", soundId); + debugC(kDebugScript, "\tu0: %d", u0); + debugC(kDebugScript, "\tu1: %d", u1); + + debugC(kDebugScript, "\trect.left: %d", rect.left); + debugC(kDebugScript, "\trect.top: %d", rect.top); + debugC(kDebugScript, "\trect.right: %d", rect.right); + debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); + debugC(kDebugScript, "\trect updateDirection: %d", updateDirection); + debugC(kDebugScript, "\tu2: %d", u2); + + if ((_vm->_varStore->getVar(2) == 1) && + (_vm->_varStore->getVar(3) == 1) && + (_vm->_varStore->getVar(4) == 0) && + (_vm->_varStore->getVar(5) == 1) && + (_vm->_varStore->getVar(6) == 1) && + (_vm->_varStore->getVar(7) == 1) && + (_vm->_varStore->getVar(8) == 1) && + (_vm->_varStore->getVar(9) == 1)) { + // TODO: Implement correct function... + // Blit Image in Left to Right Vertical stripes i.e. transistion + // like door opening + _vm->_sound->playSound(soundId); + // TODO: Set 41 to 1 if page already present in hand. + _vm->_varStore->setVar(41, 2); + } + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2016,135 +2016,135 @@ void MystScriptParser::opcode_114(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used on Myst 4143 (Dock near Marker Switch) - if (argc == 9) { - uint16 soundId = argv[0]; + case kMystStack: + // Used on Myst 4143 (Dock near Marker Switch) + if (argc == 9) { + uint16 soundId = argv[0]; - uint16 u0 = argv[1]; - uint16 u1 = argv[2]; + uint16 u0 = argv[1]; + uint16 u1 = argv[2]; - Common::Rect rect = Common::Rect(argv[3], argv[4], argv[5], argv[6]); + Common::Rect rect = Common::Rect(argv[3], argv[4], argv[5], argv[6]); - uint16 updateDirection = argv[7]; - uint16 u2 = argv[8]; - - debugC(kDebugScript, "Opcode %d: Vault Close Logic", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - debugC(kDebugScript, "\tu0: %d", u0); - debugC(kDebugScript, "\tu1: %d", u1); - - debugC(kDebugScript, "\trect.left: %d", rect.left); - debugC(kDebugScript, "\trect.top: %d", rect.top); - debugC(kDebugScript, "\trect.right: %d", rect.right); - debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); - debugC(kDebugScript, "\tupdateDirection: %d", updateDirection); - debugC(kDebugScript, "\tu2: %d", u2); - - if ((_vm->_varStore->getVar(2) == 1) && - (_vm->_varStore->getVar(3) == 1) && - (_vm->_varStore->getVar(4) == 1) && - (_vm->_varStore->getVar(5) == 1) && - (_vm->_varStore->getVar(6) == 1) && - (_vm->_varStore->getVar(7) == 1) && - (_vm->_varStore->getVar(8) == 1) && - (_vm->_varStore->getVar(9) == 1)) { - // TODO: Implement correct function... - // Blit Image in Right to Left Vertical stripes i.e. transistion - // like door closing - _vm->_sound->playSound(soundId); - _vm->_varStore->setVar(41, 0); - } - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + uint16 updateDirection = argv[7]; + uint16 u2 = argv[8]; + + debugC(kDebugScript, "Opcode %d: Vault Close Logic", op); + debugC(kDebugScript, "\tsoundId: %d", soundId); + debugC(kDebugScript, "\tu0: %d", u0); + debugC(kDebugScript, "\tu1: %d", u1); + + debugC(kDebugScript, "\trect.left: %d", rect.left); + debugC(kDebugScript, "\trect.top: %d", rect.top); + debugC(kDebugScript, "\trect.right: %d", rect.right); + debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); + debugC(kDebugScript, "\tupdateDirection: %d", updateDirection); + debugC(kDebugScript, "\tu2: %d", u2); + + if ((_vm->_varStore->getVar(2) == 1) && + (_vm->_varStore->getVar(3) == 1) && + (_vm->_varStore->getVar(4) == 1) && + (_vm->_varStore->getVar(5) == 1) && + (_vm->_varStore->getVar(6) == 1) && + (_vm->_varStore->getVar(7) == 1) && + (_vm->_varStore->getVar(8) == 1) && + (_vm->_varStore->getVar(9) == 1)) { + // TODO: Implement correct function... + // Blit Image in Right to Left Vertical stripes i.e. transistion + // like door closing + _vm->_sound->playSound(soundId); + _vm->_varStore->setVar(41, 0); + } + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_115(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kSeleniticStack: - varUnusedCheck(op, var); + case kSeleniticStack: + varUnusedCheck(op, var); - if (argc == 11) { - // Used for Selenitic Card 1147 (Musical Door Lock Button) - uint16 imageIdClose = argv[0]; // TODO: Sound Id? - uint16 imageIdOpen = argv[1]; // TODO: Sound Id? + if (argc == 11) { + // Used for Selenitic Card 1147 (Musical Door Lock Button) + uint16 imageIdClose = argv[0]; // TODO: Sound Id? + uint16 imageIdOpen = argv[1]; // TODO: Sound Id? - uint16 cardIdOpen = argv[2]; + uint16 cardIdOpen = argv[2]; - uint16 u0 = argv[3]; - uint16 u1 = argv[4]; + uint16 u0 = argv[3]; + uint16 u1 = argv[4]; - Common::Rect rect = Common::Rect(argv[5], argv[6], argv[7], argv[8]); + Common::Rect rect = Common::Rect(argv[5], argv[6], argv[7], argv[8]); - uint16 updateDirection = argv[9]; - uint16 u2 = argv[10]; + uint16 updateDirection = argv[9]; + uint16 u2 = argv[10]; - debugC(kDebugScript, "Music Door Lock Logic..."); - debugC(kDebugScript, "\timageId (Close): %d", imageIdClose); - debugC(kDebugScript, "\timageId (Open): %d", imageIdOpen); - debugC(kDebugScript, "\tcardId (Open): %d", cardIdOpen); - debugC(kDebugScript, "\tu0: %d", u0); - debugC(kDebugScript, "\tu1: %d", u1); + debugC(kDebugScript, "Music Door Lock Logic..."); + debugC(kDebugScript, "\timageId (Close): %d", imageIdClose); + debugC(kDebugScript, "\timageId (Open): %d", imageIdOpen); + debugC(kDebugScript, "\tcardId (Open): %d", cardIdOpen); + debugC(kDebugScript, "\tu0: %d", u0); + debugC(kDebugScript, "\tu1: %d", u1); - debugC(kDebugScript, "\trect.left: %d", rect.left); - debugC(kDebugScript, "\trect.top: %d", rect.top); - debugC(kDebugScript, "\trect.right: %d", rect.right); - debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); - debugC(kDebugScript, "\trect updateDirection: %d", updateDirection); - debugC(kDebugScript, "\tu2: %d", u2); + debugC(kDebugScript, "\trect.left: %d", rect.left); + debugC(kDebugScript, "\trect.top: %d", rect.top); + debugC(kDebugScript, "\trect.right: %d", rect.right); + debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); + debugC(kDebugScript, "\trect updateDirection: %d", updateDirection); + debugC(kDebugScript, "\tu2: %d", u2); - // TODO: Fix Logic... - // HACK: Bypass Door Lock For Now - _vm->changeToCard(cardIdOpen); - } else - unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - case kMystStack: - if (argc == 3) { - uint16 cardIdLose = argv[0]; - uint16 cardIdBookCover = argv[1]; - uint16 soundIdAddPage = argv[2]; - - debugC(kDebugScript, "Opcode %d: Red and Blue Book/Page Interaction", op); - debugC(kDebugScript, "Var: %d", var); - debugC(kDebugScript, "Card Id (Lose): %d", cardIdLose); - debugC(kDebugScript, "Card Id (Book Cover): %d", cardIdBookCover); - debugC(kDebugScript, "SoundId (Add Page): %d", soundIdAddPage); - - // TODO: if holding page for this book, play SoundIdAddPage - if (false) { // TODO: Should be access to mainCursor... - _vm->_sound->playSound(soundIdAddPage); - // TODO: Code for updating variables based on adding page - } + // TODO: Fix Logic... + // HACK: Bypass Door Lock For Now + _vm->changeToCard(cardIdOpen); + } else + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + case kMystStack: + if (argc == 3) { + uint16 cardIdLose = argv[0]; + uint16 cardIdBookCover = argv[1]; + uint16 soundIdAddPage = argv[2]; + + debugC(kDebugScript, "Opcode %d: Red and Blue Book/Page Interaction", op); + debugC(kDebugScript, "Var: %d", var); + debugC(kDebugScript, "Card Id (Lose): %d", cardIdLose); + debugC(kDebugScript, "Card Id (Book Cover): %d", cardIdBookCover); + debugC(kDebugScript, "SoundId (Add Page): %d", soundIdAddPage); + + // TODO: if holding page for this book, play SoundIdAddPage + if (false) { // TODO: Should be access to mainCursor... + _vm->_sound->playSound(soundIdAddPage); + // TODO: Code for updating variables based on adding page + } - // TODO: Add Tweak to improve original logic by denying - // lose until all red / blue pages collected, rather - // than allowing shortcut based on 1 fireplace page? + // TODO: Add Tweak to improve original logic by denying + // lose until all red / blue pages collected, rather + // than allowing shortcut based on 1 fireplace page? - // If holding last page for this book i.e. var 24/25 - // Then trigger Trapped in Book Losing Ending - if ((var == 100 && !_vm->_varStore->getVar(25)) || - (var == 101 && !_vm->_varStore->getVar(24))) { - // TODO: Clear mainCursor back to nominal.. - _vm->changeToCard(cardIdLose); - } else - _vm->changeToCard(cardIdBookCover); - - // TODO: Is this logic here? - // i.e. If was holding page, wait then auto open and play book... + // If holding last page for this book i.e. var 24/25 + // Then trigger Trapped in Book Losing Ending + if ((var == 100 && !_vm->_varStore->getVar(25)) || + (var == 101 && !_vm->_varStore->getVar(24))) { + // TODO: Clear mainCursor back to nominal.. + _vm->changeToCard(cardIdLose); } else - unknown(op, var, argc, argv); - break; - default: - varUnusedCheck(op, var); - unknown(op, var, argc, argv); - break; + _vm->changeToCard(cardIdBookCover); + + // TODO: Is this logic here? + // i.e. If was holding page, wait then auto open and play book... + } else + unknown(op, var, argc, argv); + break; + default: + varUnusedCheck(op, var); + unknown(op, var, argc, argv); + break; } } @@ -2152,181 +2152,181 @@ void MystScriptParser::opcode_116(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kStoneshipStack: - varUnusedCheck(op, var); + case kStoneshipStack: + varUnusedCheck(op, var); - if (argc == 1) { - // Used on Card 2111 (Compass Rose) - // Called when Button Clicked. - uint16 correctButton = argv[0]; - - if (correctButton) { - // Correct Button -> Light On Logic - // TODO: Deal with if main power on? - _vm->_varStore->setVar(16, 1); - _vm->_varStore->setVar(30, 0); - } else { - // Wrong Button -> Power Failure Logic - // TODO: Fill in Alarm - _vm->_varStore->setVar(16, 0); - _vm->_varStore->setVar(30, 2); - _vm->_varStore->setVar(33, 0); - } - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - if (argc == 1) { - // Used on Card 4006 (Clock Tower Time Controls) - uint16 soundId = argv[0]; + if (argc == 1) { + // Used on Card 2111 (Compass Rose) + // Called when Button Clicked. + uint16 correctButton = argv[0]; + + if (correctButton) { + // Correct Button -> Light On Logic + // TODO: Deal with if main power on? + _vm->_varStore->setVar(16, 1); + _vm->_varStore->setVar(30, 0); + } else { + // Wrong Button -> Power Failure Logic + // TODO: Fill in Alarm + _vm->_varStore->setVar(16, 0); + _vm->_varStore->setVar(30, 2); + _vm->_varStore->setVar(33, 0); + } + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + if (argc == 1) { + // Used on Card 4006 (Clock Tower Time Controls) + uint16 soundId = argv[0]; - debugC(kDebugScript, "Opcode %d: Clock Tower Bridge Puzzle Execute Button", op); + debugC(kDebugScript, "Opcode %d: Clock Tower Bridge Puzzle Execute Button", op); - uint16 bridgeState = _vm->_varStore->getVar(12); - uint16 currentTime = _vm->_varStore->getVar(43); + uint16 bridgeState = _vm->_varStore->getVar(12); + uint16 currentTime = _vm->_varStore->getVar(43); - const uint16 correctTime = 32; // 2:40 i.e. From 12 Noon in 5 min increments + const uint16 correctTime = 32; // 2:40 i.e. From 12 Noon in 5 min increments - if (!bridgeState && currentTime == correctTime) { - _vm->_sound->playSound(soundId); + if (!bridgeState && currentTime == correctTime) { + _vm->_sound->playSound(soundId); - // TODO: Play only 1st half of movie i.e. gears rise up - _vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 36); + // TODO: Play only 1st half of movie i.e. gears rise up + _vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 36); - bridgeState = 1; - _vm->_varStore->setVar(12, bridgeState); - } else if (bridgeState && currentTime != correctTime) { - _vm->_sound->playSound(soundId); + bridgeState = 1; + _vm->_varStore->setVar(12, bridgeState); + } else if (bridgeState && currentTime != correctTime) { + _vm->_sound->playSound(soundId); - // TODO: Play only 2nd half of movie i.e. gears sink down - _vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 36); + // TODO: Play only 2nd half of movie i.e. gears sink down + _vm->_video->playMovie(_vm->wrapMovieFilename("gears", kMystStack), 305, 36); - bridgeState = 0; - _vm->_varStore->setVar(12, bridgeState); - } - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + bridgeState = 0; + _vm->_varStore->setVar(12, bridgeState); + } + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_117(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kStoneshipStack: - varUnusedCheck(op, var); + case kStoneshipStack: + varUnusedCheck(op, var); + + if (argc == 0) { + // Used on Card 2132 (Chest at Bottom of Lighthouse) + // Called when Valve Hotspot Clicked. + // TODO: Fill in Function to play right section of movie + // based on valve state and water in chest.. + _vm->_video->playMovie(_vm->wrapMovieFilename("ligspig", kStoneshipStack), 97, 267); + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + if (argc == 2) { + // Used by Myst Imager Control Button + uint16 varValue = _vm->_varStore->getVar(var); + + if (varValue) + _vm->_sound->playSound(argv[1]); + else + _vm->_sound->playSound(argv[0]); - if (argc == 0) { - // Used on Card 2132 (Chest at Bottom of Lighthouse) - // Called when Valve Hotspot Clicked. - // TODO: Fill in Function to play right section of movie - // based on valve state and water in chest.. - _vm->_video->playMovie(_vm->wrapMovieFilename("ligspig", kStoneshipStack), 97, 267); - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - if (argc == 2) { - // Used by Myst Imager Control Button - uint16 varValue = _vm->_varStore->getVar(var); - - if (varValue) - _vm->_sound->playSound(argv[1]); - else - _vm->_sound->playSound(argv[0]); - - _vm->_varStore->setVar(var, !varValue); - // TODO: Change Var 45 "Dock Forechamber Imager Water Effect Enabled" here? - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - varUnusedCheck(op, var); + _vm->_varStore->setVar(var, !varValue); + // TODO: Change Var 45 "Dock Forechamber Imager Water Effect Enabled" here? + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + varUnusedCheck(op, var); - if (argc == 1) { - // Used on Card 3012 (Temple Hologram Monitor) - uint16 button = argv[0]; // 0 to 3 - _vm->_varStore->setVar(17, button); - switch (button) { - case 0: - _vm->_video->playMovie(_vm->wrapMovieFilename("monalgh", kChannelwoodStack), 227, 71); - break; - case 1: - _vm->_video->playMovie(_vm->wrapMovieFilename("monamth", kChannelwoodStack), 227, 71); - break; - case 2: - _vm->_video->playMovie(_vm->wrapMovieFilename("monasirs", kChannelwoodStack), 227, 71); - break; - case 3: - _vm->_video->playMovie(_vm->wrapMovieFilename("monsmsg", kChannelwoodStack), 227, 71); - break; - default: - warning("Opcode %d Control Variable Out of Range", op); - break; - } - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + if (argc == 1) { + // Used on Card 3012 (Temple Hologram Monitor) + uint16 button = argv[0]; // 0 to 3 + _vm->_varStore->setVar(17, button); + switch (button) { + case 0: + _vm->_video->playMovie(_vm->wrapMovieFilename("monalgh", kChannelwoodStack), 227, 71); + break; + case 1: + _vm->_video->playMovie(_vm->wrapMovieFilename("monamth", kChannelwoodStack), 227, 71); + break; + case 2: + _vm->_video->playMovie(_vm->wrapMovieFilename("monasirs", kChannelwoodStack), 227, 71); + break; + case 3: + _vm->_video->playMovie(_vm->wrapMovieFilename("monsmsg", kChannelwoodStack), 227, 71); + break; + default: + warning("Opcode %d Control Variable Out of Range", op); + break; + } + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_118(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kStoneshipStack: - if (argc == 0) { - // Used on Card 2126 (Lighthouse Looking Along Plank) - // Called when Exit Resource is clicked - - // TODO: Implement Function... - // If holding Key to Lamp Room Trapdoor, drop to bottom of - // Lighthouse... - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - varUnusedCheck(op, var); - - if (argc == 5) { - // Used by Card 4709 (Myst Imager Control Panel Red Button) + case kStoneshipStack: + if (argc == 0) { + // Used on Card 2126 (Lighthouse Looking Along Plank) + // Called when Exit Resource is clicked + + // TODO: Implement Function... + // If holding Key to Lamp Room Trapdoor, drop to bottom of + // Lighthouse... + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + varUnusedCheck(op, var); - debugC(kDebugScript, "Opcode %d: Imager Change Value", op); + if (argc == 5) { + // Used by Card 4709 (Myst Imager Control Panel Red Button) - uint16 soundIdBeepLo = argv[0]; - uint16 soundIdBeepHi = argv[1]; - uint16 soundIdBwapp = argv[2]; - uint16 soundIdBeepTune = argv[3]; // 5 tones.. - uint16 soundIdPanelSlam = argv[4]; + debugC(kDebugScript, "Opcode %d: Imager Change Value", op); - debugC(kDebugScript, "\tsoundIdBeepLo: %d", soundIdBeepLo); - debugC(kDebugScript, "\tsoundIdBeepHi: %d", soundIdBeepHi); - debugC(kDebugScript, "\tsoundIdBwapp: %d", soundIdBwapp); - debugC(kDebugScript, "\tsoundIdBeepTune: %d", soundIdBeepTune); - debugC(kDebugScript, "\tsoundIdPanelSlam: %d", soundIdPanelSlam); + uint16 soundIdBeepLo = argv[0]; + uint16 soundIdBeepHi = argv[1]; + uint16 soundIdBwapp = argv[2]; + uint16 soundIdBeepTune = argv[3]; // 5 tones.. + uint16 soundIdPanelSlam = argv[4]; - _vm->_sound->playSound(soundIdBeepLo); + debugC(kDebugScript, "\tsoundIdBeepLo: %d", soundIdBeepLo); + debugC(kDebugScript, "\tsoundIdBeepHi: %d", soundIdBeepHi); + debugC(kDebugScript, "\tsoundIdBwapp: %d", soundIdBwapp); + debugC(kDebugScript, "\tsoundIdBeepTune: %d", soundIdBeepTune); + debugC(kDebugScript, "\tsoundIdPanelSlam: %d", soundIdPanelSlam); - // TODO: Complete Logic... - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - varUnusedCheck(op, var); + _vm->_sound->playSound(soundIdBeepLo); - if (argc == 0) { - // Used on Card 3318 (Sirrus' Room Nightstand Drawer) - // Triggered when clicked on drawer - // TODO: Implement function... - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Complete Logic... + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + varUnusedCheck(op, var); + + if (argc == 0) { + // Used on Card 3318 (Sirrus' Room Nightstand Drawer) + // Triggered when clicked on drawer + // TODO: Implement function... + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2334,57 +2334,57 @@ void MystScriptParser::opcode_119(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kStoneshipStack: - if (argc == 0) { - // Used on Card 2143 (Lighthouse Trapdoor) - // Called when Lock Hotspot Clicked while holding key. - _vm->_video->playMovie(_vm->wrapMovieFilename("openloc", kStoneshipStack), 187, 72); - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - if (argc == 1) { - // Used on Card 4383 and 4451 (Tower Elevator) - switch (argv[0]) { - case 0: - _vm->_video->playMovie(_vm->wrapMovieFilename("libdown", kMystStack), 216, 78); - break; - case 1: - _vm->_video->playMovie(_vm->wrapMovieFilename("libup", kMystStack), 214, 75); - break; - default: - break; - } - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - if (argc == 0) { - // Used on Card 3333 (Temple Hologram) - // TODO: Not 100% sure about movie position... - switch (_vm->_varStore->getVar(17)) { - case 0: - _vm->_video->playMovie(_vm->wrapMovieFilename("holoalgh", kChannelwoodStack), 126, 74); - break; - case 1: - _vm->_video->playMovie(_vm->wrapMovieFilename("holoamth", kChannelwoodStack), 126, 74); - break; - case 2: - _vm->_video->playMovie(_vm->wrapMovieFilename("holoasir", kChannelwoodStack), 126, 74); - break; - case 3: - _vm->_video->playMovie(_vm->wrapMovieFilename("holosmsg", kChannelwoodStack), 126, 74); - break; - default: - warning("Opcode %d Control Variable Out of Range", op); - break; - } - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kStoneshipStack: + if (argc == 0) { + // Used on Card 2143 (Lighthouse Trapdoor) + // Called when Lock Hotspot Clicked while holding key. + _vm->_video->playMovie(_vm->wrapMovieFilename("openloc", kStoneshipStack), 187, 72); + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + if (argc == 1) { + // Used on Card 4383 and 4451 (Tower Elevator) + switch (argv[0]) { + case 0: + _vm->_video->playMovie(_vm->wrapMovieFilename("libdown", kMystStack), 216, 78); + break; + case 1: + _vm->_video->playMovie(_vm->wrapMovieFilename("libup", kMystStack), 214, 75); + break; + default: + break; + } + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + if (argc == 0) { + // Used on Card 3333 (Temple Hologram) + // TODO: Not 100% sure about movie position... + switch (_vm->_varStore->getVar(17)) { + case 0: + _vm->_video->playMovie(_vm->wrapMovieFilename("holoalgh", kChannelwoodStack), 126, 74); + break; + case 1: + _vm->_video->playMovie(_vm->wrapMovieFilename("holoamth", kChannelwoodStack), 126, 74); + break; + case 2: + _vm->_video->playMovie(_vm->wrapMovieFilename("holoasir", kChannelwoodStack), 126, 74); + break; + case 3: + _vm->_video->playMovie(_vm->wrapMovieFilename("holosmsg", kChannelwoodStack), 126, 74); + break; + default: + warning("Opcode %d Control Variable Out of Range", op); + break; + } + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2394,96 +2394,96 @@ void MystScriptParser::opcode_120(uint16 op, uint16 var, uint16 argc, uint16 *ar MystResource *_top; switch (_vm->getCurStack()) { - case kStoneshipStack: - if (argc == 1) { - // Used for Cards 2285, 2289, 2247, 2251 (Side Doors in Tunnels Down To Brothers Rooms) - uint16 movieId = argv[0]; - - debugC(kDebugScript, "Opcode %d: Play Side Door Movies", op); - debugC(kDebugScript, "\tmovieId: %d", movieId); - - switch (movieId) { - case 0: - // Card 2251 - _vm->_video->playMovie(_vm->wrapMovieFilename("tunaup", kStoneshipStack), 149, 161); - break; - case 1: - // Card 2247 - _vm->_video->playMovie(_vm->wrapMovieFilename("tunadown", kStoneshipStack), 218, 150); - break; - case 2: - // Card 2289 - _vm->_video->playMovie(_vm->wrapMovieFilename("tuncup", kStoneshipStack), 259, 161); - break; - case 3: - // Card 2285 - _vm->_video->playMovie(_vm->wrapMovieFilename("tuncdown", kStoneshipStack), 166, 150); - break; - default: - warning("Opcode 120 MovieId Out Of Range"); - break; - } - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - // Used for Card 4297 (Generator Puzzle Buttons) - debugC(kDebugScript, "Opcode %d: Toggle Var8 of Invoking Resource", op); - _top = _invokingResource; + case kStoneshipStack: + if (argc == 1) { + // Used for Cards 2285, 2289, 2247, 2251 (Side Doors in Tunnels Down To Brothers Rooms) + uint16 movieId = argv[0]; + + debugC(kDebugScript, "Opcode %d: Play Side Door Movies", op); + debugC(kDebugScript, "\tmovieId: %d", movieId); + + switch (movieId) { + case 0: + // Card 2251 + _vm->_video->playMovie(_vm->wrapMovieFilename("tunaup", kStoneshipStack), 149, 161); + break; + case 1: + // Card 2247 + _vm->_video->playMovie(_vm->wrapMovieFilename("tunadown", kStoneshipStack), 218, 150); + break; + case 2: + // Card 2289 + _vm->_video->playMovie(_vm->wrapMovieFilename("tuncup", kStoneshipStack), 259, 161); + break; + case 3: + // Card 2285 + _vm->_video->playMovie(_vm->wrapMovieFilename("tuncdown", kStoneshipStack), 166, 150); + break; + default: + warning("Opcode 120 MovieId Out Of Range"); + break; + } + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + // Used for Card 4297 (Generator Puzzle Buttons) + debugC(kDebugScript, "Opcode %d: Toggle Var8 of Invoking Resource", op); + _top = _invokingResource; - while(_top->_parent != NULL) - _top = _top->_parent; - - if (argc == 0) { - uint16 var8 = _top->getType8Var(); - if (var8 != 0xFFFF) - _vm->_varStore->setVar(var8, !_vm->_varStore->getVar(var8)); - else - warning("Opcode 120: No invoking Resource Var 8 found!"); - } else - unknown(op, var, argc, argv); - break; - default: + while(_top->_parent != NULL) + _top = _top->_parent; + + if (argc == 0) { + uint16 var8 = _top->getType8Var(); + if (var8 != 0xFFFF) + _vm->_varStore->setVar(var8, !_vm->_varStore->getVar(var8)); + else + warning("Opcode 120: No invoking Resource Var 8 found!"); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_121(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kMystStack: - // Used on Card 4100 (Cabin Safe Buttons) - // Correct Solution (724) -> Var 67=2, 68=7, 69=5 - // Jump to Card 4103 when solution correct and handle pulled... - if (argc == 0) { - uint16 varValue = _vm->_varStore->getVar(var); - if (varValue == 0) - varValue = 9; - else - varValue--; - _vm->_varStore->setVar(var, varValue); - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - varUnusedCheck(op, var); - - if (argc == 2) { - uint16 startTime = argv[0]; - uint16 endTime = argv[1]; - - printf("TODO: Opcode %d Movie Time Index %d to %d\n", op, startTime, endTime); - // TODO: Need version of playMovie blocking which allows selection - // of start and finish points. - _vm->_video->playMovie(_vm->wrapMovieFilename("ewindow", kMechanicalStack), 253, 0); - } else - unknown(op, var, argc, argv); - break; - default: - varUnusedCheck(op, var); + case kMystStack: + // Used on Card 4100 (Cabin Safe Buttons) + // Correct Solution (724) -> Var 67=2, 68=7, 69=5 + // Jump to Card 4103 when solution correct and handle pulled... + if (argc == 0) { + uint16 varValue = _vm->_varStore->getVar(var); + if (varValue == 0) + varValue = 9; + else + varValue--; + _vm->_varStore->setVar(var, varValue); + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + varUnusedCheck(op, var); + + if (argc == 2) { + uint16 startTime = argv[0]; + uint16 endTime = argv[1]; + + printf("TODO: Opcode %d Movie Time Index %d to %d\n", op, startTime, endTime); + // TODO: Need version of playMovie blocking which allows selection + // of start and finish points. + _vm->_video->playMovie(_vm->wrapMovieFilename("ewindow", kMechanicalStack), 253, 0); + } else + unknown(op, var, argc, argv); + break; + default: + varUnusedCheck(op, var); - unknown(op, var, argc, argv); - break; + unknown(op, var, argc, argv); + break; } } @@ -2491,36 +2491,36 @@ void MystScriptParser::opcode_122(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kChannelwoodStack: - // Used on Channelwood Card 3280 - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Close Animation", op); - Common::Rect rect = _invokingResource->getRect(); - - // TODO: Need to load the image ids from Script Resources structure of VIEW - for (uint16 imageId = 3601; imageId >= 3595; imageId--) { - _vm->_gfx->copyImageToScreen(imageId, rect); - _vm->_system->delayMillis(50); - } + case kChannelwoodStack: + // Used on Channelwood Card 3280 + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Close Animation", op); + Common::Rect rect = _invokingResource->getRect(); + + // TODO: Need to load the image ids from Script Resources structure of VIEW + for (uint16 imageId = 3601; imageId >= 3595; imageId--) { + _vm->_gfx->copyImageToScreen(imageId, rect); + _vm->_system->delayMillis(50); + } - // TODO: Is 8 gotten from var7 of calling hotspot, rather than hard-coded? - _vm->_varStore->setVar(8, 0); - _vm->_varStore->setVar(19, 0); - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - if (argc == 0) { - // Used on Card 6120 (Elevator) - // Called when Exit Midde Button Pressed + // TODO: Is 8 gotten from var7 of calling hotspot, rather than hard-coded? + _vm->_varStore->setVar(8, 0); + _vm->_varStore->setVar(19, 0); + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + if (argc == 0) { + // Used on Card 6120 (Elevator) + // Called when Exit Midde Button Pressed - // TODO: hcelev? Movie of Elevator? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: hcelev? Movie of Elevator? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2528,23 +2528,23 @@ void MystScriptParser::opcode_123(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMechanicalStack: - if (argc == 2) { - // Used on Card 6154 - uint16 start_time = argv[0]; - uint16 end_time = argv[1]; - - printf("TODO: Opcode %d Movie Time Index %d to %d\n", op, start_time, end_time); - // TODO: Need version of playMovie blocking which allows selection - // of start and finish points. - // TODO: Not 100% sure about movie position - _vm->_video->playMovie(_vm->wrapMovieFilename("hcelev", kMechanicalStack), 205, 40); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMechanicalStack: + if (argc == 2) { + // Used on Card 6154 + uint16 start_time = argv[0]; + uint16 end_time = argv[1]; + + printf("TODO: Opcode %d Movie Time Index %d to %d\n", op, start_time, end_time); + // TODO: Need version of playMovie blocking which allows selection + // of start and finish points. + // TODO: Not 100% sure about movie position + _vm->_video->playMovie(_vm->wrapMovieFilename("hcelev", kMechanicalStack), 205, 40); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2552,48 +2552,48 @@ void MystScriptParser::opcode_124(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMechanicalStack: - if (argc == 0) { - // Used by Card 6156 (Fortress Rotation Controls) - // Called when Red Exit Button Pressed to raise Elevator + case kMechanicalStack: + if (argc == 0) { + // Used by Card 6156 (Fortress Rotation Controls) + // Called when Red Exit Button Pressed to raise Elevator - // TODO: Fill in Code... - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Fill in Code... + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_125(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kStoneshipStack: - if (argc == 1) { - // Used on Card 2197 (Sirrus' Room Drawers) - debugC(kDebugScript, "Opcode %d: Unknown uses Var %d", op, var); - - uint16 u0 = argv[0]; + case kStoneshipStack: + if (argc == 1) { + // Used on Card 2197 (Sirrus' Room Drawers) + debugC(kDebugScript, "Opcode %d: Unknown uses Var %d", op, var); - debugC(kDebugScript, "\tu0: %d", u0); - // TODO: Fill in Logic... - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - if (argc == 0) { - // Used on Card 6267 (Code Lock) - // Called by Red Execute Button... - debugC(kDebugScript, "Opcode %d: Code Lock Execute...", op); + uint16 u0 = argv[0]; - // TODO: Fill in Logic For Code Lock... - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + debugC(kDebugScript, "\tu0: %d", u0); + // TODO: Fill in Logic... + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + if (argc == 0) { + // Used on Card 6267 (Code Lock) + // Called by Red Execute Button... + debugC(kDebugScript, "Opcode %d: Code Lock Execute...", op); + + // TODO: Fill in Logic For Code Lock... + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2601,19 +2601,19 @@ void MystScriptParser::opcode_126(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMechanicalStack: - if (argc == 0) { - // Used by Card 6120 (Fortress Elevator) - // Called when Red Exit Button Pressed to raise Elevator and - // exit is clicked... + case kMechanicalStack: + if (argc == 0) { + // Used by Card 6120 (Fortress Elevator) + // Called when Red Exit Button Pressed to raise Elevator and + // exit is clicked... - // TODO: Fill in Code... - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Fill in Code... + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2621,31 +2621,31 @@ void MystScriptParser::opcode_127(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kChannelwoodStack: - if (argc == 2) { - // Used by Card 3262 (Elevator) - debugC(kDebugScript, "Opcode %d: Unknown...", op); + case kChannelwoodStack: + if (argc == 2) { + // Used by Card 3262 (Elevator) + debugC(kDebugScript, "Opcode %d: Unknown...", op); - uint16 u0 = argv[0]; - uint16 u1 = argv[1]; + uint16 u0 = argv[0]; + uint16 u1 = argv[1]; - debugC(kDebugScript, "\tu0: %d", u0); - debugC(kDebugScript, "\tu1: %d", u1); + debugC(kDebugScript, "\tu0: %d", u0); + debugC(kDebugScript, "\tu1: %d", u1); - // TODO: Fill in Code... - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - if (argc == 0) { - // Used for Mech Card 6226 (3 Crystals) - _vm->_varStore->setVar(20, 1); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Fill in Code... + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + if (argc == 0) { + // Used for Mech Card 6226 (3 Crystals) + _vm->_varStore->setVar(20, 1); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2653,16 +2653,16 @@ void MystScriptParser::opcode_128(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMechanicalStack: - if (argc == 0) { - // Used for Mech Card 6226 (3 Crystals) - _vm->_varStore->setVar(20, 0); - } else - unknown(op, var, argc, argv); - break; - default: + case kMechanicalStack: + if (argc == 0) { + // Used for Mech Card 6226 (3 Crystals) + _vm->_varStore->setVar(20, 0); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2670,30 +2670,30 @@ void MystScriptParser::opcode_129(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kChannelwoodStack: - if (argc == 1) { - // Used by Card 3262 (Elevator) - debugC(kDebugScript, "Opcode %d: Unknown...", op); + case kChannelwoodStack: + if (argc == 1) { + // Used by Card 3262 (Elevator) + debugC(kDebugScript, "Opcode %d: Unknown...", op); - uint16 cardId = argv[0]; + uint16 cardId = argv[0]; - debugC(kDebugScript, "\tcardId: %d", cardId); + debugC(kDebugScript, "\tcardId: %d", cardId); - // TODO: Fill in Code... - _vm->changeToCard(cardId); - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - if (argc == 0) { - // Used for Mech Card 6226 (3 Crystals) - _vm->_varStore->setVar(21, 1); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Fill in Code... + _vm->changeToCard(cardId); + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + if (argc == 0) { + // Used for Mech Card 6226 (3 Crystals) + _vm->_varStore->setVar(21, 1); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2701,16 +2701,16 @@ void MystScriptParser::opcode_130(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMechanicalStack: - if (argc == 0) { - // Used for Mech Card 6226 (3 Crystals) - _vm->_varStore->setVar(21, 0); - } else - unknown(op, var, argc, argv); - break; - default: + case kMechanicalStack: + if (argc == 0) { + // Used for Mech Card 6226 (3 Crystals) + _vm->_varStore->setVar(21, 0); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2718,16 +2718,16 @@ void MystScriptParser::opcode_131(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMechanicalStack: - if (argc == 0) { - // Used for Mech Card 6226 (3 Crystals) - _vm->_varStore->setVar(22, 1); - } else - unknown(op, var, argc, argv); - break; - default: + case kMechanicalStack: + if (argc == 0) { + // Used for Mech Card 6226 (3 Crystals) + _vm->_varStore->setVar(22, 1); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2735,16 +2735,16 @@ void MystScriptParser::opcode_132(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMechanicalStack: - if (argc == 0) { - // Used for Mech Card 6226 (3 Crystals) - _vm->_varStore->setVar(22, 0); - } else - unknown(op, var, argc, argv); - break; - default: + case kMechanicalStack: + if (argc == 0) { + // Used for Mech Card 6226 (3 Crystals) + _vm->_varStore->setVar(22, 0); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2752,23 +2752,23 @@ void MystScriptParser::opcode_133(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used on Card 4500 (Stellar Observatory Controls) - if (argc == 1) { - // Called by Telescope Slew Button - uint16 soundId = argv[0]; + case kMystStack: + // Used on Card 4500 (Stellar Observatory Controls) + if (argc == 1) { + // Called by Telescope Slew Button + uint16 soundId = argv[0]; - // TODO: Function to change variables controlling telescope view - // etc. + // TODO: Function to change variables controlling telescope view + // etc. - // TODO: Sound seems to be stuck looping? - _vm->_sound->playSound(soundId); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Sound seems to be stuck looping? + _vm->_sound->playSound(soundId); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2776,16 +2776,16 @@ void MystScriptParser::opcode_147(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - if (argc == 0) { - // TODO: Extra Logic to do this in INIT process watching cursor and var 98? - _vm->_varStore->setVar(98, 0); - } else - unknown(op, var, argc, argv); - break; - default: + case kMystStack: + if (argc == 0) { + // TODO: Extra Logic to do this in INIT process watching cursor and var 98? + _vm->_varStore->setVar(98, 0); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2793,15 +2793,15 @@ void MystScriptParser::opcode_164(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used on Card 4530 (Rocketship Music Slider Controls) - // TODO: Finish Implementation... - // Var 105 is used to set between 0 to 2 = No Function, Movie Playback and Linkable... - // This is called when Var 105 = 1 i.e. this plays back Movie... - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used on Card 4530 (Rocketship Music Slider Controls) + // TODO: Finish Implementation... + // Var 105 is used to set between 0 to 2 = No Function, Movie Playback and Linkable... + // This is called when Var 105 = 1 i.e. this plays back Movie... + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2809,13 +2809,13 @@ void MystScriptParser::opcode_169(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used on Card 4099 (In Cabin, Looking Out Door) - // TODO: Finish Implementation... - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used on Card 4099 (In Cabin, Looking Out Door) + // TODO: Finish Implementation... + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2823,15 +2823,15 @@ void MystScriptParser::opcode_181(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - if (argc == 0) { - // TODO: Logic for lighting the match - } else - unknown(op, var, argc, argv); - break; - default: + case kMystStack: + if (argc == 0) { + // TODO: Logic for lighting the match + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2839,15 +2839,15 @@ void MystScriptParser::opcode_182(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - if (argc == 0) { - // TODO: Logic for lighting the match - } else - unknown(op, var, argc, argv); - break; - default: + case kMystStack: + if (argc == 0) { + // TODO: Logic for lighting the match + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2855,16 +2855,16 @@ void MystScriptParser::opcode_183(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - if (argc == 0) { - // Used for Myst Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes) - _vm->_varStore->setVar(105, 1); - } else - unknown(op, var, argc, argv); - break; - default: + case kMystStack: + if (argc == 0) { + // Used for Myst Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes) + _vm->_varStore->setVar(105, 1); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2872,16 +2872,16 @@ void MystScriptParser::opcode_184(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - if (argc == 0) { - // Used for Myst Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes) - _vm->_varStore->setVar(105, 0); - } else - unknown(op, var, argc, argv); - break; - default: + case kMystStack: + if (argc == 0) { + // Used for Myst Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes) + _vm->_varStore->setVar(105, 0); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2889,17 +2889,17 @@ void MystScriptParser::opcode_185(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - if (argc == 0) { - // Used for Myst Card 4098 (Cabin Boiler Pilot Light) - // TODO: Extra Logic to do this in INIT process watching cursor and var 98? - _vm->_varStore->setVar(98, 1); - } else - unknown(op, var, argc, argv); - break; - default: + case kMystStack: + if (argc == 0) { + // Used for Myst Card 4098 (Cabin Boiler Pilot Light) + // TODO: Extra Logic to do this in INIT process watching cursor and var 98? + _vm->_varStore->setVar(98, 1); + } else unknown(op, var, argc, argv); - break; + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2907,14 +2907,14 @@ void MystScriptParser::opcode_196(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kDemoPreviewStack: - // Used on Card ... - // TODO: Finish Implementation... - // Voice Over and Card Advance? - break; - default: - unknown(op, var, argc, argv); - break; + case kDemoPreviewStack: + // Used on Card ... + // TODO: Finish Implementation... + // Voice Over and Card Advance? + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2922,14 +2922,14 @@ void MystScriptParser::opcode_197(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kDemoPreviewStack: - // Used on Card ... - // TODO: Finish Implementation... - // Voice Over and Card Advance? - break; - default: - unknown(op, var, argc, argv); - break; + case kDemoPreviewStack: + // Used on Card ... + // TODO: Finish Implementation... + // Voice Over and Card Advance? + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2938,50 +2938,50 @@ void MystScriptParser::opcode_198(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kDemoPreviewStack: - if (argc == 0) { - // Nuh-uh! No leaving the library in the demo! - GUI::MessageDialog dialog("You can't leave the library in the demo."); - dialog.runModal(); - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - // Used on Card 4143 (Dock near Marker Switch, facing Cogs) - if (argc == 9) { - uint16 soundId = argv[0]; - uint16 u0 = argv[1]; - uint16 u1 = argv[2]; - Common::Rect rect = Common::Rect(argv[3], argv[4], argv[5], argv[6]); - uint16 updateDirection = argv[7]; - uint16 u2 = argv[8]; - - debugC(kDebugScript, "Opcode %d: Close Dock Marker Switch Vault", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - debugC(kDebugScript, "\tu0: %d", u0); - debugC(kDebugScript, "\tu1: %d", u1); - - debugC(kDebugScript, "\trect.left: %d", rect.left); - debugC(kDebugScript, "\trect.top: %d", rect.top); - debugC(kDebugScript, "\trect.right: %d", rect.right); - debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); - debugC(kDebugScript, "\tupdateDirection: %d", updateDirection); - debugC(kDebugScript, "\tu2: %d", u2); - - Audio::SoundHandle *handle; - if (_vm->_varStore->getVar(41) != 0) { - handle = _vm->_sound->playSound(soundId); - - while (_vm->_mixer->isSoundHandleActive(*handle)) - _vm->_system->delayMillis(10); - // TODO: Do Image Blit - } - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kDemoPreviewStack: + if (argc == 0) { + // Nuh-uh! No leaving the library in the demo! + GUI::MessageDialog dialog("You can't leave the library in the demo."); + dialog.runModal(); + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + // Used on Card 4143 (Dock near Marker Switch, facing Cogs) + if (argc == 9) { + uint16 soundId = argv[0]; + uint16 u0 = argv[1]; + uint16 u1 = argv[2]; + Common::Rect rect = Common::Rect(argv[3], argv[4], argv[5], argv[6]); + uint16 updateDirection = argv[7]; + uint16 u2 = argv[8]; + + debugC(kDebugScript, "Opcode %d: Close Dock Marker Switch Vault", op); + debugC(kDebugScript, "\tsoundId: %d", soundId); + debugC(kDebugScript, "\tu0: %d", u0); + debugC(kDebugScript, "\tu1: %d", u1); + + debugC(kDebugScript, "\trect.left: %d", rect.left); + debugC(kDebugScript, "\trect.top: %d", rect.top); + debugC(kDebugScript, "\trect.right: %d", rect.right); + debugC(kDebugScript, "\trect.bottom: %d", rect.bottom); + debugC(kDebugScript, "\tupdateDirection: %d", updateDirection); + debugC(kDebugScript, "\tu2: %d", u2); + + Audio::SoundHandle *handle; + if (_vm->_varStore->getVar(41) != 0) { + handle = _vm->_sound->playSound(soundId); + + while (_vm->_mixer->isSoundHandleActive(*handle)) + _vm->_system->delayMillis(10); + // TODO: Do Image Blit + } + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -2989,47 +2989,47 @@ void MystScriptParser::opcode_199(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Myst Imager Control Execute Button Logic", op); + case kMystStack: + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Myst Imager Control Execute Button Logic", op); - uint16 numericSelection = (_vm->_varStore->getVar(36) + 1) % 10; - numericSelection += ((_vm->_varStore->getVar(35) + 1) % 10) * 10; - - debugC(kDebugScript, "\tImager Selection: %d", numericSelection); - - switch (numericSelection) { - case 40: - _vm->_varStore->setVar(51, 1); // Mountain - break; - case 67: - _vm->_varStore->setVar(51, 2); // Water - break; - case 47: - _vm->_varStore->setVar(51, 4); // Marker Switch - break; - case 8: - _vm->_varStore->setVar(51, 3); // Atrus - break; - default: - _vm->_varStore->setVar(51, 0); // Blank - break; - } + uint16 numericSelection = (_vm->_varStore->getVar(36) + 1) % 10; + numericSelection += ((_vm->_varStore->getVar(35) + 1) % 10) * 10; - // TODO: Fill in Logic - //{ 34, 2, "Dock Forechamber Imager State" }, // 0 to 2 = Off, Mountain, Water - //{ 310, 0, "Dock Forechamber Imager Control Temp Value?" } - } else - unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - // Used on Card ... - // TODO: Finish Implementation... - // Voice Over and Card Advance? - break; - default: - unknown(op, var, argc, argv); - break; + debugC(kDebugScript, "\tImager Selection: %d", numericSelection); + + switch (numericSelection) { + case 40: + _vm->_varStore->setVar(51, 1); // Mountain + break; + case 67: + _vm->_varStore->setVar(51, 2); // Water + break; + case 47: + _vm->_varStore->setVar(51, 4); // Marker Switch + break; + case 8: + _vm->_varStore->setVar(51, 3); // Atrus + break; + default: + _vm->_varStore->setVar(51, 0); // Blank + break; + } + + // TODO: Fill in Logic + //{ 34, 2, "Dock Forechamber Imager State" }, // 0 to 2 = Off, Mountain, Water + //{ 310, 0, "Dock Forechamber Imager Control Temp Value?" } + } else + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + // Used on Card ... + // TODO: Finish Implementation... + // Voice Over and Card Advance? + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -3094,80 +3094,80 @@ void MystScriptParser::opcode_200_run() { if (g_opcode200Parameters.enabled) { switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used on Card 1191 (Maze Runner) + case kSeleniticStack: + // Used on Card 1191 (Maze Runner) - // TODO: Implementation Movie Function.. - if (false) { - _vm->_video->playMovie(_vm->wrapMovieFilename(kHCMovPathSelenitic[0], kSeleniticStack), 201, 26); - } - break; - case kStoneshipStack: - // Used for Card 2013 (Achenar's Rose-Skull Hologram) + // TODO: Implementation Movie Function.. + if (false) { + _vm->_video->playMovie(_vm->wrapMovieFilename(kHCMovPathSelenitic[0], kSeleniticStack), 201, 26); + } + break; + case kStoneshipStack: + // Used for Card 2013 (Achenar's Rose-Skull Hologram) - // TODO: Implement Function... - break; - case kDemoPreviewStack: - case kMystStack: - curImageIndex = _vm->_varStore->getVar(g_opcode200Parameters.var); + // TODO: Implement Function... + break; + case kDemoPreviewStack: + case kMystStack: + curImageIndex = _vm->_varStore->getVar(g_opcode200Parameters.var); - if (curImageIndex >= g_opcode200Parameters.imageCount) { - curImageIndex = g_opcode200Parameters.imageCount - 1; - _vm->_varStore->setVar(g_opcode200Parameters.var, curImageIndex); - } + if (curImageIndex >= g_opcode200Parameters.imageCount) { + curImageIndex = g_opcode200Parameters.imageCount - 1; + _vm->_varStore->setVar(g_opcode200Parameters.var, curImageIndex); + } - // HACK: Think these images are centered on screen (when smaller than full screen), - // and since no _gfx call for image size, hack this to deal with this case for now... - if (_vm->getCurCard() == 4059) - rect = Common::Rect(157, 115, 544, 333); - else - rect = Common::Rect(0, 0, 544, 333); + // HACK: Think these images are centered on screen (when smaller than full screen), + // and since no _gfx call for image size, hack this to deal with this case for now... + if (_vm->getCurCard() == 4059) + rect = Common::Rect(157, 115, 544, 333); + else + rect = Common::Rect(0, 0, 544, 333); - _vm->_gfx->copyImageToScreen(g_opcode200Parameters.imageBaseId + curImageIndex, rect); + _vm->_gfx->copyImageToScreen(g_opcode200Parameters.imageBaseId + curImageIndex, rect); - // TODO: Comparison with original engine shows that this simple solution - // may not be the correct one and the choice of which sound - // may be more complicated or even random.. - if (curImageIndex < lastImageIndex && g_opcode200Parameters.soundDecrement != 0) - _vm->_sound->playSound(g_opcode200Parameters.soundDecrement); - else if (curImageIndex > lastImageIndex && g_opcode200Parameters.soundIncrement != 0) - _vm->_sound->playSound(g_opcode200Parameters.soundIncrement); + // TODO: Comparison with original engine shows that this simple solution + // may not be the correct one and the choice of which sound + // may be more complicated or even random.. + if (curImageIndex < lastImageIndex && g_opcode200Parameters.soundDecrement != 0) + _vm->_sound->playSound(g_opcode200Parameters.soundDecrement); + else if (curImageIndex > lastImageIndex && g_opcode200Parameters.soundIncrement != 0) + _vm->_sound->playSound(g_opcode200Parameters.soundIncrement); - lastImageIndex = curImageIndex; - break; - case kCreditsStack: - curImageIndex = _vm->_varStore->getVar(g_opcode200Parameters.var); + lastImageIndex = curImageIndex; + break; + case kCreditsStack: + curImageIndex = _vm->_varStore->getVar(g_opcode200Parameters.var); - if (_vm->_system->getMillis() - g_opcode200Parameters.lastCardTime >= 7 * 1000) { - // After the 6th image has shown, it's time to quit - if (curImageIndex == 7) - _vm->_system->quit(); + if (_vm->_system->getMillis() - g_opcode200Parameters.lastCardTime >= 7 * 1000) { + // After the 6th image has shown, it's time to quit + if (curImageIndex == 7) + _vm->_system->quit(); - // Note: The modulus by 6 is because the 6th image is the one at imageBaseId - _vm->_gfx->copyImageToScreen(g_opcode200Parameters.imageBaseId + curImageIndex % 6, Common::Rect(0, 0, 544, 333)); + // Note: The modulus by 6 is because the 6th image is the one at imageBaseId + _vm->_gfx->copyImageToScreen(g_opcode200Parameters.imageBaseId + curImageIndex % 6, Common::Rect(0, 0, 544, 333)); - _vm->_varStore->setVar(g_opcode200Parameters.var, curImageIndex + 1); - g_opcode200Parameters.lastCardTime = _vm->_system->getMillis(); - } - break; - case kMechanicalStack: - // Used on Card 6238 (Sirrus' Throne) and Card 6027 (Achenar's Throne) - // g_opcode200Parameters.var == 0 for Achenar - // g_opcode200Parameters.var == 1 for Sirrus + _vm->_varStore->setVar(g_opcode200Parameters.var, curImageIndex + 1); + g_opcode200Parameters.lastCardTime = _vm->_system->getMillis(); + } + break; + case kMechanicalStack: + // Used on Card 6238 (Sirrus' Throne) and Card 6027 (Achenar's Throne) + // g_opcode200Parameters.var == 0 for Achenar + // g_opcode200Parameters.var == 1 for Sirrus - // TODO: Fill in Function... - // Variable indicates that this is related to Secret Panel State - break; - case kDemoStack: - // Used on Card 2000 + // TODO: Fill in Function... + // Variable indicates that this is related to Secret Panel State + break; + case kDemoStack: + // Used on Card 2000 - // TODO: Fill in Function... - break; - case kDemoSlidesStack: - // Used on Cards... - if (_vm->_system->getMillis() - g_opcode200Parameters.lastCardTime >= 2 * 1000) - _vm->changeToCard(g_opcode200Parameters.cardId); - break; + // TODO: Fill in Function... + break; + case kDemoSlidesStack: + // Used on Cards... + if (_vm->_system->getMillis() - g_opcode200Parameters.lastCardTime >= 2 * 1000) + _vm->changeToCard(g_opcode200Parameters.cardId); + break; } } } @@ -3183,106 +3183,106 @@ void MystScriptParser::opcode_200_disable() { void MystScriptParser::opcode_200(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kIntroStack: - varUnusedCheck(op, var); + case kIntroStack: + varUnusedCheck(op, var); - // TODO: Play Intro Movies.. - // and then _vm->changeToCard(2); - unknown(op, var, argc, argv); - break; - case kSeleniticStack: - varUnusedCheck(op, var); + // TODO: Play Intro Movies.. + // and then _vm->changeToCard(2); + unknown(op, var, argc, argv); + break; + case kSeleniticStack: + varUnusedCheck(op, var); - // Used for Card 1191 (Maze Runner) - if (argc == 0) { - g_opcode200Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - varUnusedCheck(op, var); + // Used for Card 1191 (Maze Runner) + if (argc == 0) { + g_opcode200Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kStoneshipStack: + varUnusedCheck(op, var); - // Used for Card 2013 (Achenar's Rose-Skull Hologram) - if (argc == 0) { - g_opcode200Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - case kMystStack: - if (argc == 4) { - g_opcode200Parameters.var = var; - g_opcode200Parameters.imageCount = argv[0]; - g_opcode200Parameters.imageBaseId = argv[1]; - g_opcode200Parameters.soundDecrement = argv[2]; - g_opcode200Parameters.soundIncrement = argv[3]; - g_opcode200Parameters.enabled = true; - - _vm->_varStore->setVar(var, 0); - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - // Used on Card 6238 (Sirrus' Throne) and Card 6027 (Achenar's Throne) - if (argc == 0) { - g_opcode200Parameters.var = var; - g_opcode200Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kDniStack: - varUnusedCheck(op, var); - // Used on Card 5014 + // Used for Card 2013 (Achenar's Rose-Skull Hologram) + if (argc == 0) { + g_opcode200Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + case kMystStack: + if (argc == 4) { + g_opcode200Parameters.var = var; + g_opcode200Parameters.imageCount = argv[0]; + g_opcode200Parameters.imageBaseId = argv[1]; + g_opcode200Parameters.soundDecrement = argv[2]; + g_opcode200Parameters.soundIncrement = argv[3]; + g_opcode200Parameters.enabled = true; - // 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); - } - break; - case kCreditsStack: - if (argc == 0) { - g_opcode200Parameters.var = var; - // TODO: Pass ImageCount, rather than hardcoded in run process? - g_opcode200Parameters.imageBaseId = _vm->getCurCard(); - g_opcode200Parameters.lastCardTime = _vm->_system->getMillis(); - g_opcode200Parameters.enabled = true; + _vm->_varStore->setVar(var, 0); + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + // Used on Card 6238 (Sirrus' Throne) and Card 6027 (Achenar's Throne) + if (argc == 0) { + g_opcode200Parameters.var = var; + g_opcode200Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kDniStack: + varUnusedCheck(op, var); + // Used on Card 5014 - _vm->_varStore->setVar(var, 1); - } else - unknown(op, var, argc, argv); - break; - case kDemoStack: - // Used on Card 2000 - if (argc == 0) { - g_opcode200Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kDemoSlidesStack: - // Used on Cards... - if (argc == 1) { - g_opcode200Parameters.cardId = argv[0]; - g_opcode200Parameters.lastCardTime = _vm->_system->getMillis(); - g_opcode200Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // 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); + } + break; + case kCreditsStack: + if (argc == 0) { + g_opcode200Parameters.var = var; + // TODO: Pass ImageCount, rather than hardcoded in run process? + g_opcode200Parameters.imageBaseId = _vm->getCurCard(); + g_opcode200Parameters.lastCardTime = _vm->_system->getMillis(); + g_opcode200Parameters.enabled = true; + + _vm->_varStore->setVar(var, 1); + } else + unknown(op, var, argc, argv); + break; + case kDemoStack: + // Used on Card 2000 + if (argc == 0) { + g_opcode200Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kDemoSlidesStack: + // Used on Cards... + if (argc == 1) { + g_opcode200Parameters.cardId = argv[0]; + g_opcode200Parameters.lastCardTime = _vm->_system->getMillis(); + g_opcode200Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -3302,36 +3302,36 @@ void MystScriptParser::opcode_201_run() { if (g_opcode201Parameters.enabled) { switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1191 (Maze Runner) + case kSeleniticStack: + // Used for Card 1191 (Maze Runner) - // TODO: Fill in Function... - break; - case kStoneshipStack: - // Used for Card 2013 (Achenar's Rose-Skull Hologram) + // TODO: Fill in Function... + break; + case kStoneshipStack: + // Used for Card 2013 (Achenar's Rose-Skull Hologram) - // TODO: Fill in Function... - break; - case kMystStack: - var105 = _vm->_varStore->getVar(105); - if (var105 && !g_opcode201Parameters.lastVar105) - _vm->_sound->playSound(g_opcode201Parameters.soundId); - g_opcode201Parameters.lastVar105 = var105; - break; - case kMechanicalStack: - // Used for Card 6159 (Facing Corridor to Fortress Elevator) + // TODO: Fill in Function... + break; + case kMystStack: + var105 = _vm->_varStore->getVar(105); + if (var105 && !g_opcode201Parameters.lastVar105) + _vm->_sound->playSound(g_opcode201Parameters.soundId); + g_opcode201Parameters.lastVar105 = var105; + break; + case kMechanicalStack: + // Used for Card 6159 (Facing Corridor to Fortress Elevator) - // g_opcode201Parameters.u0 - // g_opcode201Parameters.u1 - // g_opcode201Parameters.u2 + // g_opcode201Parameters.u0 + // g_opcode201Parameters.u1 + // g_opcode201Parameters.u2 - // TODO: Fill in Function... - break; - case kDemoStack: - // Used on Card 2001, 2002 and 2003 + // TODO: Fill in Function... + break; + case kDemoStack: + // Used on Card 2001, 2002 and 2003 - // TODO: Fill in Function... - break; + // TODO: Fill in Function... + break; } } } @@ -3346,80 +3346,80 @@ void MystScriptParser::opcode_201(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kIntroStack: - _vm->_system->delayMillis(4 * 1000); - _vm->_gfx->copyImageToScreen(4, Common::Rect(0, 0, 544, 333)); - break; - case kSeleniticStack: - // Used for Card 1191 (Maze Runner) + case kIntroStack: + _vm->_system->delayMillis(4 * 1000); + _vm->_gfx->copyImageToScreen(4, Common::Rect(0, 0, 544, 333)); + break; + case kSeleniticStack: + // Used for Card 1191 (Maze Runner) + + if (argc == 0) { + g_opcode201Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kStoneshipStack: + varUnusedCheck(op, var); - if (argc == 0) { - g_opcode201Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - varUnusedCheck(op, var); + // Used for Card 2013 (Achenar's Rose-Skull Hologram) + if (argc == 0) { + g_opcode201Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + // Used for Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes) + if (argc == 1) { + g_opcode201Parameters.soundId = argv[0]; + g_opcode201Parameters.lastVar105 = 0; + g_opcode201Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + // Used for Card 6159 (Facing Corridor to Fortress Elevator) + if (argc == 3) { + g_opcode201Parameters.u0 = argv[0]; + g_opcode201Parameters.u1 = argv[1]; + g_opcode201Parameters.u2 = argv[2]; + + g_opcode201Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + // Used for Card 3247 (Elevator #1 Movement), 3161 (Bridge Movement), 3259 (Elevator #3 Movement) and 3252 (Elevator #2 Movement) + if (argc == 0) { + // TODO: Fill in Function. Video Playback? Rect from invoking hotspot resource... + if (false) { + // Card 3161 + _vm->_video->playMovie(_vm->wrapMovieFilename("bridge", kChannelwoodStack), 292, 204); - // Used for Card 2013 (Achenar's Rose-Skull Hologram) - if (argc == 0) { - g_opcode201Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - // Used for Cards 4257, 4260, 4263, 4266, 4269, 4272, 4275 and 4278 (Ship Puzzle Boxes) - if (argc == 1) { - g_opcode201Parameters.soundId = argv[0]; - g_opcode201Parameters.lastVar105 = 0; - g_opcode201Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - // Used for Card 6159 (Facing Corridor to Fortress Elevator) - if (argc == 3) { - g_opcode201Parameters.u0 = argv[0]; - g_opcode201Parameters.u1 = argv[1]; - g_opcode201Parameters.u2 = argv[2]; + // Card 3247 + _vm->_video->playMovie(_vm->wrapMovieFilename("welev1dn", kChannelwoodStack), 214, 107); + _vm->_video->playMovie(_vm->wrapMovieFilename("welev1up", kChannelwoodStack), 214, 107); - g_opcode201Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - // Used for Card 3247 (Elevator #1 Movement), 3161 (Bridge Movement), 3259 (Elevator #3 Movement) and 3252 (Elevator #2 Movement) - if (argc == 0) { - // TODO: Fill in Function. Video Playback? Rect from invoking hotspot resource... - if (false) { - // Card 3161 - _vm->_video->playMovie(_vm->wrapMovieFilename("bridge", kChannelwoodStack), 292, 204); - - // Card 3247 - _vm->_video->playMovie(_vm->wrapMovieFilename("welev1dn", kChannelwoodStack), 214, 107); - _vm->_video->playMovie(_vm->wrapMovieFilename("welev1up", kChannelwoodStack), 214, 107); - - // Card 3252 - _vm->_video->playMovie(_vm->wrapMovieFilename("welev2dn", kChannelwoodStack), 215, 118); - _vm->_video->playMovie(_vm->wrapMovieFilename("welev2up", kChannelwoodStack), 215, 118); - - // Card 3259 - _vm->_video->playMovie(_vm->wrapMovieFilename("welev3dn", kChannelwoodStack), 213, 99); - _vm->_video->playMovie(_vm->wrapMovieFilename("welev3up", kChannelwoodStack), 213, 99); - } - } else - unknown(op, var, argc, argv); - break; - case kDemoStack: - // Used on Card 2001, 2002 and 2003 - if (argc == 0) { - g_opcode201Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // Card 3252 + _vm->_video->playMovie(_vm->wrapMovieFilename("welev2dn", kChannelwoodStack), 215, 118); + _vm->_video->playMovie(_vm->wrapMovieFilename("welev2up", kChannelwoodStack), 215, 118); + + // Card 3259 + _vm->_video->playMovie(_vm->wrapMovieFilename("welev3dn", kChannelwoodStack), 213, 99); + _vm->_video->playMovie(_vm->wrapMovieFilename("welev3up", kChannelwoodStack), 213, 99); + } + } else + unknown(op, var, argc, argv); + break; + case kDemoStack: + // Used on Card 2001, 2002 and 2003 + if (argc == 0) { + g_opcode201Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -3431,163 +3431,163 @@ static struct { void MystScriptParser::opcode_202_run(void) { if (g_opcode202Parameters.enabled) { switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1191 (Maze Runner) + case kSeleniticStack: + // Used for Card 1191 (Maze Runner) - // TODO: Fill in function... - break; - case kDemoPreviewStack: - case kMystStack: - // Used for Card 4378 (Library Tower Rotation Map) - // TODO: Fill in.. Code for Tower Rotation Angle etc.. - // Var 0, 3, 4, 5, 6, 7, 8, 9 used for Type 8 Image Display - // Type 11 Hotspot for control.. - // Var 304 controls presence of Myst Library Image - break; - case kMechanicalStack: - // Used for Card 6220 (Sirrus' Mechanical Bird) - // TODO: Fill in Function - break; - case kChannelwoodStack: - // Used for Cards 3328, 3691, 3731, 3809, 3846 etc. (Water Valves) - - // Code for Water Flow Logic - // Var 8 = "Water Tank Valve State" - // Controls - // Var 19 = "Water Flowing to First Water Valve" - // Code for this in Opcode 104 / 122 - - // Var 19 = "Water Flowing to First Water Valve" - // and - // Var 9 = "First Water Valve State" - // Controls - // Var 20 = "Water Flowing to Second (L) Water Valve" - // Var 3 = "Water Flowing (R) to Pump for Upper Walkway to Temple Elevator" - uint16 var9 = _vm->_varStore->getVar(9); - if (_vm->_varStore->getVar(19)) { - _vm->_varStore->setVar(20, !var9); - _vm->_varStore->setVar(3, var9); - } else { - // No water into Valve - _vm->_varStore->setVar(20, 0); - _vm->_varStore->setVar(3, 0); - } + // TODO: Fill in function... + break; + case kDemoPreviewStack: + case kMystStack: + // Used for Card 4378 (Library Tower Rotation Map) + // TODO: Fill in.. Code for Tower Rotation Angle etc.. + // Var 0, 3, 4, 5, 6, 7, 8, 9 used for Type 8 Image Display + // Type 11 Hotspot for control.. + // Var 304 controls presence of Myst Library Image + break; + case kMechanicalStack: + // Used for Card 6220 (Sirrus' Mechanical Bird) + // TODO: Fill in Function + break; + case kChannelwoodStack: + // Used for Cards 3328, 3691, 3731, 3809, 3846 etc. (Water Valves) - // Var 20 = "Water Flowing to Second (L) Water Valve" - // and - // Var 10 = "Second (L) Water Valve State" - // Controls - // Var 24 = "Water Flowing to Third (L, L) Water Valve" - // Var 21 = "Water Flowing to Third (L, R) Water Valve" - uint16 var10 = _vm->_varStore->getVar(10); - if (_vm->_varStore->getVar(20)) { - _vm->_varStore->setVar(24, !var10); - _vm->_varStore->setVar(21, var10); - } else { - // No water into Valve - _vm->_varStore->setVar(24, 0); - _vm->_varStore->setVar(21, 0); - } + // Code for Water Flow Logic + // Var 8 = "Water Tank Valve State" + // Controls + // Var 19 = "Water Flowing to First Water Valve" + // Code for this in Opcode 104 / 122 + + // Var 19 = "Water Flowing to First Water Valve" + // and + // Var 9 = "First Water Valve State" + // Controls + // Var 20 = "Water Flowing to Second (L) Water Valve" + // Var 3 = "Water Flowing (R) to Pump for Upper Walkway to Temple Elevator" + uint16 var9 = _vm->_varStore->getVar(9); + if (_vm->_varStore->getVar(19)) { + _vm->_varStore->setVar(20, !var9); + _vm->_varStore->setVar(3, var9); + } else { + // No water into Valve + _vm->_varStore->setVar(20, 0); + _vm->_varStore->setVar(3, 0); + } - // Var 21 = "Water Flowing to Third (L, R) Water Valve" - // and - // Var 11 = "Third (L, R) Water Valve State" - // Controls - // Var 23 = "Water Flowing to Fourth (L, R, L) Water Valve" - // Var 22 = "Water Flowing to Fourth (L, R, R) Water Valve" - uint16 var11 = _vm->_varStore->getVar(11); - if (_vm->_varStore->getVar(21)) { - _vm->_varStore->setVar(23, !var11); - _vm->_varStore->setVar(22, var11); - } else { - // No water into Valve - _vm->_varStore->setVar(23, 0); - _vm->_varStore->setVar(22, 0); - } + // Var 20 = "Water Flowing to Second (L) Water Valve" + // and + // Var 10 = "Second (L) Water Valve State" + // Controls + // Var 24 = "Water Flowing to Third (L, L) Water Valve" + // Var 21 = "Water Flowing to Third (L, R) Water Valve" + uint16 var10 = _vm->_varStore->getVar(10); + if (_vm->_varStore->getVar(20)) { + _vm->_varStore->setVar(24, !var10); + _vm->_varStore->setVar(21, var10); + } else { + // No water into Valve + _vm->_varStore->setVar(24, 0); + _vm->_varStore->setVar(21, 0); + } - // Var 24 = "Water Flowing to Third (L, L) Water Valve" - // and - // Var 14 = "Third (L, L) Water Valve State" - // Controls - // Var 29 = "Water Flowing to Pipe In Water (L, L, L)" - // Var 28 = "Water Flowing to Join and Pump Bridge (L, L, R)" - uint16 var14 = _vm->_varStore->getVar(14); - if (_vm->_varStore->getVar(24)) { - _vm->_varStore->setVar(29, !var14); - _vm->_varStore->setVar(28, var14); - } else { - // No water into Valve - _vm->_varStore->setVar(29, 0); - _vm->_varStore->setVar(28, 0); - } + // Var 21 = "Water Flowing to Third (L, R) Water Valve" + // and + // Var 11 = "Third (L, R) Water Valve State" + // Controls + // Var 23 = "Water Flowing to Fourth (L, R, L) Water Valve" + // Var 22 = "Water Flowing to Fourth (L, R, R) Water Valve" + uint16 var11 = _vm->_varStore->getVar(11); + if (_vm->_varStore->getVar(21)) { + _vm->_varStore->setVar(23, !var11); + _vm->_varStore->setVar(22, var11); + } else { + // No water into Valve + _vm->_varStore->setVar(23, 0); + _vm->_varStore->setVar(22, 0); + } - // Var 22 = "Water Flowing to Fourth (L, R, R) Water Valve" - // and - // Var 12 = "Fourth (L, R, R) Water Valve State" - // Controls - // Var 25 = "Water Flowing to Pipe Bridge (L, R, R, L)" - // Var 15 = "Water Flowing (L, R, R, R) to Pump for Lower Walkway to Upper Walkway Elevator" - uint16 var12 = _vm->_varStore->getVar(12); - if (_vm->_varStore->getVar(22)) { - _vm->_varStore->setVar(25, !var12); - _vm->_varStore->setVar(15, var12); - } else { - // No water into Valve - _vm->_varStore->setVar(25, 0); - _vm->_varStore->setVar(15, 0); - } + // Var 24 = "Water Flowing to Third (L, L) Water Valve" + // and + // Var 14 = "Third (L, L) Water Valve State" + // Controls + // Var 29 = "Water Flowing to Pipe In Water (L, L, L)" + // Var 28 = "Water Flowing to Join and Pump Bridge (L, L, R)" + uint16 var14 = _vm->_varStore->getVar(14); + if (_vm->_varStore->getVar(24)) { + _vm->_varStore->setVar(29, !var14); + _vm->_varStore->setVar(28, var14); + } else { + // No water into Valve + _vm->_varStore->setVar(29, 0); + _vm->_varStore->setVar(28, 0); + } - // Var 23 = "Water Flowing to Fourth (L, R, L) Water Valve" - // and - // Var 13 = "Fourth (L, R, L) Water Valve State" - // Controls - // Var 27 = "Water Flowing to Join and Pump Bridge (L, R, L, L)" - // Var 26 = "Water Flowing to Pipe At Entry Point (L, R, L, R)" - uint16 var13 = _vm->_varStore->getVar(13); - if (_vm->_varStore->getVar(23)) { - _vm->_varStore->setVar(27, !var13); - _vm->_varStore->setVar(26, var13); - } else { - // No water into Valve - _vm->_varStore->setVar(27, 0); - _vm->_varStore->setVar(26, 0); - } + // Var 22 = "Water Flowing to Fourth (L, R, R) Water Valve" + // and + // Var 12 = "Fourth (L, R, R) Water Valve State" + // Controls + // Var 25 = "Water Flowing to Pipe Bridge (L, R, R, L)" + // Var 15 = "Water Flowing (L, R, R, R) to Pump for Lower Walkway to Upper Walkway Elevator" + uint16 var12 = _vm->_varStore->getVar(12); + if (_vm->_varStore->getVar(22)) { + _vm->_varStore->setVar(25, !var12); + _vm->_varStore->setVar(15, var12); + } else { + // No water into Valve + _vm->_varStore->setVar(25, 0); + _vm->_varStore->setVar(15, 0); + } - // TODO: Not sure that original had OR logic for water flow at Join... - // Var 27 = "Water Flowing to Join and Pump Bridge (L, R, L, L)" - // Or - // Var 28 = "Water Flowing to Join and Pump Bridge (L, L, R)" - // Controls - // Var 31 = "Water Flowing to Join (L, L, R)" // 0 to 2 = Stop Sound, Background, Background with Water Flow - // Var 7 = "Bridge Pump Running" - // TODO: Not sure about control of Var 31 which is tristate... - if (_vm->_varStore->getVar(27) || _vm->_varStore->getVar(28)) { - _vm->_varStore->setVar(31, 2); // Background with Water Flow - _vm->_varStore->setVar(7, 1); - } else { - // No water into Valve - _vm->_varStore->setVar(31, 1); // Background - _vm->_varStore->setVar(7, 0); - } + // Var 23 = "Water Flowing to Fourth (L, R, L) Water Valve" + // and + // Var 13 = "Fourth (L, R, L) Water Valve State" + // Controls + // Var 27 = "Water Flowing to Join and Pump Bridge (L, R, L, L)" + // Var 26 = "Water Flowing to Pipe At Entry Point (L, R, L, R)" + uint16 var13 = _vm->_varStore->getVar(13); + if (_vm->_varStore->getVar(23)) { + _vm->_varStore->setVar(27, !var13); + _vm->_varStore->setVar(26, var13); + } else { + // No water into Valve + _vm->_varStore->setVar(27, 0); + _vm->_varStore->setVar(26, 0); + } - // TODO: Code for this shouldn't be here... - // Move to Opcodes called by Pipe Extension... - // Var 25 = "Water Flowing to Pipe Bridge (L, R, R, L)" - // and - // Var 6 = "Pipe Bridge Extended" - // Controls - // Var 32 = "Water Flowing (L, R, R, L, Pipe) State" }, // 0 to 2 = Stop Sound, Background, Background with Water Flow - // Var 4 = "Water Flowing (L, R, R, L, Pipe Extended) to Pump for Book Room Elevator" - // TODO: Not sure about control of Var 32 which is tristate... - if (_vm->_varStore->getVar(25) && _vm->_varStore->getVar(6)) { - _vm->_varStore->setVar(32, 2); // Background with Water Flow - _vm->_varStore->setVar(4, 1); - } else { - // No water into Valve - _vm->_varStore->setVar(32, 1); // Background - _vm->_varStore->setVar(4, 0); - } - break; + // TODO: Not sure that original had OR logic for water flow at Join... + // Var 27 = "Water Flowing to Join and Pump Bridge (L, R, L, L)" + // Or + // Var 28 = "Water Flowing to Join and Pump Bridge (L, L, R)" + // Controls + // Var 31 = "Water Flowing to Join (L, L, R)" // 0 to 2 = Stop Sound, Background, Background with Water Flow + // Var 7 = "Bridge Pump Running" + // TODO: Not sure about control of Var 31 which is tristate... + if (_vm->_varStore->getVar(27) || _vm->_varStore->getVar(28)) { + _vm->_varStore->setVar(31, 2); // Background with Water Flow + _vm->_varStore->setVar(7, 1); + } else { + // No water into Valve + _vm->_varStore->setVar(31, 1); // Background + _vm->_varStore->setVar(7, 0); + } + + // TODO: Code for this shouldn't be here... + // Move to Opcodes called by Pipe Extension... + // Var 25 = "Water Flowing to Pipe Bridge (L, R, R, L)" + // and + // Var 6 = "Pipe Bridge Extended" + // Controls + // Var 32 = "Water Flowing (L, R, R, L, Pipe) State" }, // 0 to 2 = Stop Sound, Background, Background with Water Flow + // Var 4 = "Water Flowing (L, R, R, L, Pipe Extended) to Pump for Book Room Elevator" + // TODO: Not sure about control of Var 32 which is tristate... + if (_vm->_varStore->getVar(25) && _vm->_varStore->getVar(6)) { + _vm->_varStore->setVar(32, 2); // Background with Water Flow + _vm->_varStore->setVar(4, 1); + } else { + // No water into Valve + _vm->_varStore->setVar(32, 1); // Background + _vm->_varStore->setVar(4, 0); + } + break; } } } @@ -3598,54 +3598,54 @@ void MystScriptParser::opcode_202_disable(void) { void MystScriptParser::opcode_202(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kSeleniticStack: - varUnusedCheck(op, var); - - // Used for Card 1191 (Maze Runner) - if (argc == 0) { - g_opcode202Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - varUnusedCheck(op, var); + case kSeleniticStack: + varUnusedCheck(op, var); - // Used for Card 2160 (Lighthouse Battery Pack Closeup) - // TODO: Implement Code... - // Not Sure of Purpose - Update of Light / Discharge? + // Used for Card 1191 (Maze Runner) + if (argc == 0) { + g_opcode202Parameters.enabled = true; + } else unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - case kMystStack: - varUnusedCheck(op, var); + break; + case kStoneshipStack: + varUnusedCheck(op, var); - // Used for Card 4378 (Library Tower Rotation Map) - if (argc == 1) { - // TODO: Figure Out argv[0] purpose.. number of image resources? - g_opcode202Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - // Used for Card 6220 (Sirrus' Mechanical Bird) - if (argc == 0) { - g_opcode202Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - // Used for Cards 3328, 3691, 3731, 3809, 3846 etc. (Water Valves) - if (argc == 0) { - g_opcode202Parameters.var = var; - g_opcode202Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - varUnusedCheck(op, var); + // Used for Card 2160 (Lighthouse Battery Pack Closeup) + // TODO: Implement Code... + // Not Sure of Purpose - Update of Light / Discharge? + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + case kMystStack: + varUnusedCheck(op, var); - unknown(op, var, argc, argv); - break; + // Used for Card 4378 (Library Tower Rotation Map) + if (argc == 1) { + // TODO: Figure Out argv[0] purpose.. number of image resources? + g_opcode202Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + // Used for Card 6220 (Sirrus' Mechanical Bird) + if (argc == 0) { + g_opcode202Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + // Used for Cards 3328, 3691, 3731, 3809, 3846 etc. (Water Valves) + if (argc == 0) { + g_opcode202Parameters.var = var; + g_opcode202Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + varUnusedCheck(op, var); + + unknown(op, var, argc, argv); + break; } } @@ -3656,24 +3656,24 @@ static struct { void MystScriptParser::opcode_203_run(void) { if (g_opcode203Parameters.enabled) { switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1245 (Sound Receiver) - // TODO: Fill in Logic to Change Viewer Display etc.? - break; - case kMystStack: - // Used for Card 4138 (Dock Forechamber Door) - // TODO: Fill in Logic.. - break; - case kMechanicalStack: - // Used for Card 6043 (Weapons Rack with Snake Box) - // TODO: Fill in Logic for Snake Box... - break; - case kChannelwoodStack: - // Used for Card 3310 (Sirrus' Room Right Bed Drawer), - // Card 3307 (Sirrus' Room Left Bed Drawer) - // and Card 3318 (Sirrus' Room Nightstand Drawer) - // TODO: Fill in Logic... - break; + case kSeleniticStack: + // Used for Card 1245 (Sound Receiver) + // TODO: Fill in Logic to Change Viewer Display etc.? + break; + case kMystStack: + // Used for Card 4138 (Dock Forechamber Door) + // TODO: Fill in Logic.. + break; + case kMechanicalStack: + // Used for Card 6043 (Weapons Rack with Snake Box) + // TODO: Fill in Logic for Snake Box... + break; + case kChannelwoodStack: + // Used for Card 3310 (Sirrus' Room Right Bed Drawer), + // Card 3307 (Sirrus' Room Left Bed Drawer) + // and Card 3318 (Sirrus' Room Nightstand Drawer) + // TODO: Fill in Logic... + break; } } } @@ -3689,64 +3689,64 @@ void MystScriptParser::opcode_203(uint16 op, uint16 var, uint16 argc, uint16 *ar uint16 imageIdDarkDoorClosed = 0; switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1245 (Sound Receiver) - if (argc == 0) { - g_opcode203Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - // Used for all/most Cards in Tunnels Down To Brothers Rooms + case kSeleniticStack: + // Used for Card 1245 (Sound Receiver) + if (argc == 0) { + g_opcode203Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kStoneshipStack: + // Used for all/most Cards in Tunnels Down To Brothers Rooms - // TODO: Duplicate or similar function to Opcode 203? - if (argc == 2 || argc == 4) { - debugC(kDebugScript, "Opcode %d: %d Arguments", op, argc); + // TODO: Duplicate or similar function to Opcode 203? + if (argc == 2 || argc == 4) { + debugC(kDebugScript, "Opcode %d: %d Arguments", op, argc); - uint16 u0 = argv[0]; - if (argc == 4) { - imageIdDarkDoorOpen = argv[1]; - imageIdDarkDoorClosed = argv[2]; - } - uint16 soundIdAlarm = argv[argc - 1]; + uint16 u0 = argv[0]; + if (argc == 4) { + imageIdDarkDoorOpen = argv[1]; + imageIdDarkDoorClosed = argv[2]; + } + uint16 soundIdAlarm = argv[argc - 1]; - debugC(kDebugScript, "\tu0: %d", u0); - if (argc == 4) { - debugC(kDebugScript, "\timageIdDarkDoorOpen: %d", imageIdDarkDoorOpen); - debugC(kDebugScript, "\tsoundIdDarkDoorClosed: %d", imageIdDarkDoorClosed); - } - debugC(kDebugScript, "\tsoundIdAlarm: %d", soundIdAlarm); + debugC(kDebugScript, "\tu0: %d", u0); + if (argc == 4) { + debugC(kDebugScript, "\timageIdDarkDoorOpen: %d", imageIdDarkDoorOpen); + debugC(kDebugScript, "\tsoundIdDarkDoorClosed: %d", imageIdDarkDoorClosed); + } + debugC(kDebugScript, "\tsoundIdAlarm: %d", soundIdAlarm); - // TODO: Fill in Correct Function for Lights - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - // Used for Card 4138 (Dock Forechamber Door) - if (argc == 0) { - g_opcode203Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - // Used for Card 6043 (Weapons Rack with Snake Box) - if (argc == 0) { - g_opcode203Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kChannelwoodStack: - // Used for Card 3310 (Sirrus' Room Right Bed Drawer), - // Card 3307 (Sirrus' Room Left Bed Drawer) - // and Card 3318 (Sirrus' Room Nightstand Drawer) - if (argc == 0) { - g_opcode203Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Fill in Correct Function for Lights + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + // Used for Card 4138 (Dock Forechamber Door) + if (argc == 0) { + g_opcode203Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + // Used for Card 6043 (Weapons Rack with Snake Box) + if (argc == 0) { + g_opcode203Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kChannelwoodStack: + // Used for Card 3310 (Sirrus' Room Right Bed Drawer), + // Card 3307 (Sirrus' Room Left Bed Drawer) + // and Card 3318 (Sirrus' Room Nightstand Drawer) + if (argc == 0) { + g_opcode203Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -3758,23 +3758,23 @@ static struct { void MystScriptParser::opcode_204_run(void) { if (g_opcode204Parameters.enabled) { switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1147 (Sound Code Lock) - // TODO: Fill in code for Sound Lock... - break; - case kMystStack: - // Used for Card 4134 and 4149 (Dock) - // TODO: Fill in.. - break; - case kMechanicalStack: - // TODO: Fill in Logic. - // Var 12 holds Large Cog Position in range 0 to 5 - // - For animation - // Var 11 holds C position in range 0 to 9 - // - 4 for Correct Answer - // C Movement Sound - //_vm->_sound->playSound(g_opcode204Parameters.soundId); - break; + case kSeleniticStack: + // Used for Card 1147 (Sound Code Lock) + // TODO: Fill in code for Sound Lock... + break; + case kMystStack: + // Used for Card 4134 and 4149 (Dock) + // TODO: Fill in.. + break; + case kMechanicalStack: + // TODO: Fill in Logic. + // Var 12 holds Large Cog Position in range 0 to 5 + // - For animation + // Var 11 holds C position in range 0 to 9 + // - 4 for Correct Answer + // C Movement Sound + //_vm->_sound->playSound(g_opcode204Parameters.soundId); + break; } } } @@ -3787,47 +3787,47 @@ void MystScriptParser::opcode_204(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1147 (Sound Code Lock) - if (argc == 0) { - g_opcode204Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - // Used for Card 2160 (Lighthouse Battery Pack Closeup) - if (argc == 0) { - // TODO: Implement Code For Battery Meter Level - // Overwrite _vm->_resources[1]->_subImages[0].rect.bottom 1 to 80 - // Add accessor functions for this... - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - // Used for Card 4134 and 4149 (Dock) - // TODO: Fill in logic.. Unsure of exact function to trigger and location on screen.. - if (false) { - // Card 4134 - _vm->_video->playMovie(_vm->wrapMovieFilename("birds1", kMystStack), 416, 0); - - // Card 4149 - _vm->_video->playMovie(_vm->wrapMovieFilename("birds2", kMystStack), 433, 0); - - // Unsure... - _vm->_video->playMovie(_vm->wrapMovieFilename("birds3", kMystStack), 0, 0); - } - break; - case kMechanicalStack: - // Used for Card 6180 (Lower Elevator Puzzle) - if (argc == 1) { - g_opcode204Parameters.soundId = argv[0]; - g_opcode204Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kSeleniticStack: + // Used for Card 1147 (Sound Code Lock) + if (argc == 0) { + g_opcode204Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kStoneshipStack: + // Used for Card 2160 (Lighthouse Battery Pack Closeup) + if (argc == 0) { + // TODO: Implement Code For Battery Meter Level + // Overwrite _vm->_resources[1]->_subImages[0].rect.bottom 1 to 80 + // Add accessor functions for this... + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + // Used for Card 4134 and 4149 (Dock) + // TODO: Fill in logic.. Unsure of exact function to trigger and location on screen.. + if (false) { + // Card 4134 + _vm->_video->playMovie(_vm->wrapMovieFilename("birds1", kMystStack), 416, 0); + + // Card 4149 + _vm->_video->playMovie(_vm->wrapMovieFilename("birds2", kMystStack), 433, 0); + + // Unsure... + _vm->_video->playMovie(_vm->wrapMovieFilename("birds3", kMystStack), 0, 0); + } + break; + case kMechanicalStack: + // Used for Card 6180 (Lower Elevator Puzzle) + if (argc == 1) { + g_opcode204Parameters.soundId = argv[0]; + g_opcode204Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -3840,19 +3840,19 @@ static struct { void MystScriptParser::opcode_205_run(void) { if (g_opcode205Parameters.enabled) { switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1191 (Maze Runner) - // TODO: Fill in function... - break; - case kMystStack: - // Used for Card 4532 (Rocketship Piano) - // TODO: Fill in function... - break; - case kMechanicalStack: - // Used for Card 6156 (Fortress Rotation Controls) - // TODO: Fill in function... - // g_opcode205Parameters.soundIdPosition[4] - break; + case kSeleniticStack: + // Used for Card 1191 (Maze Runner) + // TODO: Fill in function... + break; + case kMystStack: + // Used for Card 4532 (Rocketship Piano) + // TODO: Fill in function... + break; + case kMechanicalStack: + // Used for Card 6156 (Fortress Rotation Controls) + // TODO: Fill in function... + // g_opcode205Parameters.soundIdPosition[4] + break; } } } @@ -3868,63 +3868,63 @@ void MystScriptParser::opcode_205(uint16 op, uint16 var, uint16 argc, uint16 *ar uint16 imageIdDoorClosed = 0; switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1191 (Maze Runner) + case kSeleniticStack: + // Used for Card 1191 (Maze Runner) - if (argc == 0) { - g_opcode205Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - // Used on Cards 2322, 2285 (Tunnels Down To Brothers Rooms) + if (argc == 0) { + g_opcode205Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kStoneshipStack: + // Used on Cards 2322, 2285 (Tunnels Down To Brothers Rooms) - // TODO: Duplicate or similar function to Opcode 203? - if (argc == 2 || argc == 4) { - debugC(kDebugScript, "Opcode %d: %d Arguments", op, argc); + // TODO: Duplicate or similar function to Opcode 203? + if (argc == 2 || argc == 4) { + debugC(kDebugScript, "Opcode %d: %d Arguments", op, argc); - uint16 u0 = argv[0]; - if (argc == 4) { - imageIdDoorOpen = argv[1]; - imageIdDoorClosed = argv[2]; - } - uint16 soundIdAlarm = argv[argc - 1]; + uint16 u0 = argv[0]; + if (argc == 4) { + imageIdDoorOpen = argv[1]; + imageIdDoorClosed = argv[2]; + } + uint16 soundIdAlarm = argv[argc - 1]; - debugC(kDebugScript, "\tu0: %d", u0); - if (argc == 4) { - debugC(kDebugScript, "\timageIdDoorOpen: %d", imageIdDoorOpen); - debugC(kDebugScript, "\tsoundIdDoorClosed: %d", imageIdDoorClosed); - } - debugC(kDebugScript, "\tsoundIdAlarm: %d", soundIdAlarm); + debugC(kDebugScript, "\tu0: %d", u0); + if (argc == 4) { + debugC(kDebugScript, "\timageIdDoorOpen: %d", imageIdDoorOpen); + debugC(kDebugScript, "\tsoundIdDoorClosed: %d", imageIdDoorClosed); + } + debugC(kDebugScript, "\tsoundIdAlarm: %d", soundIdAlarm); - // TODO: Fill in Correct Function for Lights - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - // Used for Card 4532 (Rocketship Piano) + // TODO: Fill in Correct Function for Lights + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + // Used for Card 4532 (Rocketship Piano) - if (argc == 0) { - g_opcode205Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - // Used for Card 6156 (Fortress Rotation Controls) + if (argc == 0) { + g_opcode205Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + // Used for Card 6156 (Fortress Rotation Controls) - if (argc == 4) { - g_opcode205Parameters.soundIdPosition[0] = argv[0]; - g_opcode205Parameters.soundIdPosition[1] = argv[1]; - g_opcode205Parameters.soundIdPosition[2] = argv[2]; - g_opcode205Parameters.soundIdPosition[3] = argv[3]; + if (argc == 4) { + g_opcode205Parameters.soundIdPosition[0] = argv[0]; + g_opcode205Parameters.soundIdPosition[1] = argv[1]; + g_opcode205Parameters.soundIdPosition[2] = argv[2]; + g_opcode205Parameters.soundIdPosition[3] = argv[3]; - g_opcode205Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + g_opcode205Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -3938,18 +3938,18 @@ static struct { void MystScriptParser::opcode_206_run(void) { if (g_opcode206Parameters.enabled) { switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1191 (Maze Runner) - // TODO: Fill in function... - break; - case kMechanicalStack: - // Used for Card 6044 (Fortress Rotation Simulator) + case kSeleniticStack: + // Used for Card 1191 (Maze Runner) + // TODO: Fill in function... + break; + case kMechanicalStack: + // Used for Card 6044 (Fortress Rotation Simulator) - // g_opcode206Parameters.soundIdStart[2] - // g_opcode206Parameters.soundIdPosition[4] + // g_opcode206Parameters.soundIdStart[2] + // g_opcode206Parameters.soundIdPosition[4] - // TODO: Fill in function... - break; + // TODO: Fill in function... + break; } } } @@ -3962,43 +3962,43 @@ void MystScriptParser::opcode_206(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kSeleniticStack: - // Used for Card 1191 (Maze Runner) + case kSeleniticStack: + // Used for Card 1191 (Maze Runner) - if (argc == 0) { - g_opcode206Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kStoneshipStack: - // Used for Cards 2272 and 2234 (Facing Out of Door) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown, %d Arguments", op, argc); - // TODO: Function Unknown... - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - // Used for Card 4256 (Butterfly Movie Activation) - // TODO: Implement Logic... - break; - case kMechanicalStack: - // Used for Card 6044 (Fortress Rotation Simulator) - if (argc == 6) { - g_opcode206Parameters.soundIdStart[0] = argv[0]; - g_opcode206Parameters.soundIdStart[1] = argv[1]; - g_opcode206Parameters.soundIdPosition[0] = argv[2]; - g_opcode206Parameters.soundIdPosition[1] = argv[3]; - g_opcode206Parameters.soundIdPosition[2] = argv[4]; - g_opcode206Parameters.soundIdPosition[3] = argv[5]; - - g_opcode206Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + if (argc == 0) { + g_opcode206Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kStoneshipStack: + // Used for Cards 2272 and 2234 (Facing Out of Door) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown, %d Arguments", op, argc); + // TODO: Function Unknown... + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + // Used for Card 4256 (Butterfly Movie Activation) + // TODO: Implement Logic... + break; + case kMechanicalStack: + // Used for Card 6044 (Fortress Rotation Simulator) + if (argc == 6) { + g_opcode206Parameters.soundIdStart[0] = argv[0]; + g_opcode206Parameters.soundIdStart[1] = argv[1]; + g_opcode206Parameters.soundIdPosition[0] = argv[2]; + g_opcode206Parameters.soundIdPosition[1] = argv[3]; + g_opcode206Parameters.soundIdPosition[2] = argv[4]; + g_opcode206Parameters.soundIdPosition[3] = argv[5]; + + g_opcode206Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4006,52 +4006,52 @@ void MystScriptParser::opcode_207(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kStoneshipStack: - // Used for Card 2138 (Lighthouse Key/Chest Animation Logic) - // TODO: Fill in function - warning("TODO: Opcode 207 Lighthouse Key/Chest Animation Logic"); - break; - default: - unknown(op, var, argc, argv); - break; + case kStoneshipStack: + // Used for Card 2138 (Lighthouse Key/Chest Animation Logic) + // TODO: Fill in function + warning("TODO: Opcode 207 Lighthouse Key/Chest Animation Logic"); + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_208(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kStoneshipStack: - varUnusedCheck(op, var); + case kStoneshipStack: + varUnusedCheck(op, var); - // Used in Card 2218 (Telescope view) - if (argc == 3) { - debugC(kDebugScript, "Opcode %d: Telescope View", op); - uint16 imagePanorama = argv[0]; - uint16 imageLighthouseOff = argv[1]; - uint16 imageLighthouseOn = argv[2]; + // Used in Card 2218 (Telescope view) + if (argc == 3) { + debugC(kDebugScript, "Opcode %d: Telescope View", op); + uint16 imagePanorama = argv[0]; + uint16 imageLighthouseOff = argv[1]; + uint16 imageLighthouseOn = argv[2]; - debugC(kDebugScript, "Image (Panorama): %d", imagePanorama); - debugC(kDebugScript, "Image (Lighthouse Off): %d", imageLighthouseOff); - debugC(kDebugScript, "Image (Lighthouse On): %d", imageLighthouseOn); + debugC(kDebugScript, "Image (Panorama): %d", imagePanorama); + debugC(kDebugScript, "Image (Lighthouse Off): %d", imageLighthouseOff); + debugC(kDebugScript, "Image (Lighthouse On): %d", imageLighthouseOn); - // TODO: Fill in Logic. - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Imager Function", op); - debugC(kDebugScript, "Var: %d", var); + // TODO: Fill in Logic. + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Imager Function", op); + debugC(kDebugScript, "Var: %d", var); - // TODO: Fill in Correct Function - if (false) { - _vm->_video->playMovie(_vm->wrapMovieFilename("vltmntn", kMystStack), 159, 97); - } - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Fill in Correct Function + if (false) { + _vm->_video->playMovie(_vm->wrapMovieFilename("vltmntn", kMystStack), 159, 97); + } + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4070,29 +4070,29 @@ void MystScriptParser::opcode_209_run(void) { if (g_opcode209Parameters.enabled) { switch (_vm->getCurStack()) { - case kStoneshipStack: - // Used for Card 2004 (Achenar's Room Drawers) + case kStoneshipStack: + // Used for Card 2004 (Achenar's Room Drawers) - // TODO: Implement Function... - // Swap Open Drawers? - break; - case kDemoPreviewStack: - case kMystStack: - // Used for Card 4334 and 4348 (Myst Library Bookcase Door) - if (!enabledLast) - // TODO: If Variable changed... - _vm->_sound->playSound(g_opcode209Parameters.soundId); - - // TODO: Code to trigger Type 6 to play movie... - break; - case kMechanicalStack: - // Used for Card 6044 (Fortress Rotation Simulator) + // TODO: Implement Function... + // Swap Open Drawers? + break; + case kDemoPreviewStack: + case kMystStack: + // Used for Card 4334 and 4348 (Myst Library Bookcase Door) + if (!enabledLast) + // TODO: If Variable changed... + _vm->_sound->playSound(g_opcode209Parameters.soundId); - // TODO: Implement Function For Secret Panel State as - // per Opcode 200 function (Mechanical) - break; - default: - break; + // TODO: Code to trigger Type 6 to play movie... + break; + case kMechanicalStack: + // Used for Card 6044 (Fortress Rotation Simulator) + + // TODO: Implement Function For Secret Panel State as + // per Opcode 200 function (Mechanical) + break; + default: + break; } } @@ -4107,46 +4107,46 @@ void MystScriptParser::opcode_209(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kStoneshipStack: - // Used for Card 2004 (Achenar's Room Drawers) - if (argc == 11) { - g_opcode209Parameters.u0[0] = argv[0]; - g_opcode209Parameters.u0[1] = argv[1]; - g_opcode209Parameters.u0[2] = argv[2]; - g_opcode209Parameters.u0[3] = argv[3]; - g_opcode209Parameters.u0[4] = argv[4]; - - g_opcode209Parameters.u1[0] = argv[5]; - g_opcode209Parameters.u1[1] = argv[6]; - g_opcode209Parameters.u1[2] = argv[7]; - g_opcode209Parameters.u1[3] = argv[8]; - g_opcode209Parameters.u1[4] = argv[9]; - - g_opcode209Parameters.stateVar = argv[10]; - - g_opcode209Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - case kMystStack: - // Used for Card 4334 and 4348 (Myst Library Bookcase Door) - if (argc == 1) { - g_opcode209Parameters.soundId = argv[0]; - g_opcode209Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - case kMechanicalStack: - // Used for Card 6044 (Fortress Rotation Simulator) - if (argc == 0) { - g_opcode209Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kStoneshipStack: + // Used for Card 2004 (Achenar's Room Drawers) + if (argc == 11) { + g_opcode209Parameters.u0[0] = argv[0]; + g_opcode209Parameters.u0[1] = argv[1]; + g_opcode209Parameters.u0[2] = argv[2]; + g_opcode209Parameters.u0[3] = argv[3]; + g_opcode209Parameters.u0[4] = argv[4]; + + g_opcode209Parameters.u1[0] = argv[5]; + g_opcode209Parameters.u1[1] = argv[6]; + g_opcode209Parameters.u1[2] = argv[7]; + g_opcode209Parameters.u1[3] = argv[8]; + g_opcode209Parameters.u1[4] = argv[9]; + + g_opcode209Parameters.stateVar = argv[10]; + + g_opcode209Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + case kMystStack: + // Used for Card 4334 and 4348 (Myst Library Bookcase Door) + if (argc == 1) { + g_opcode209Parameters.soundId = argv[0]; + g_opcode209Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + case kMechanicalStack: + // Used for Card 6044 (Fortress Rotation Simulator) + if (argc == 0) { + g_opcode209Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4239,34 +4239,34 @@ void MystScriptParser::opcode_210(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kStoneshipStack: - varUnusedCheck(op, var); + case kStoneshipStack: + varUnusedCheck(op, var); - // Used in Cards 2205 and 2207 (Cloud Orbs in Sirrus' Room) - if (argc == 2) { - uint16 soundId = argv[0]; - uint16 soundIdStopping = argv[1]; + // Used in Cards 2205 and 2207 (Cloud Orbs in Sirrus' Room) + if (argc == 2) { + uint16 soundId = argv[0]; + uint16 soundIdStopping = argv[1]; - // TODO: Work Out Function i.e. control Var etc. - if (false) { - _vm->_sound->playSound(soundId); - _vm->_sound->playSound(soundIdStopping); - } - } else - unknown(op, var, argc, argv); - break; - case kMystStack: - // Used for Card 4297 (Generator Puzzle) - if (argc == 2) { - // TODO: Work Out 2 parameters meaning... 16, 17 - // Script Resources for Generator Spinup and Spindown Sounds? - g_opcode210Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + // TODO: Work Out Function i.e. control Var etc. + if (false) { + _vm->_sound->playSound(soundId); + _vm->_sound->playSound(soundIdStopping); + } + } else + unknown(op, var, argc, argv); + break; + case kMystStack: + // Used for Card 4297 (Generator Puzzle) + if (argc == 2) { + // TODO: Work Out 2 parameters meaning... 16, 17 + // Script Resources for Generator Spinup and Spindown Sounds? + g_opcode210Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4320,20 +4320,20 @@ void MystScriptParser::opcode_211(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kDemoPreviewStack: - case kMystStack: - // Used for Card 4059 (Fireplace Puzzle) - if (argc == 0) { - for (byte i = 0; i < 6; i++) - _vm->_varStore->setVar(i + 17, 0); - - g_opcode211Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kDemoPreviewStack: + case kMystStack: + // Used for Card 4059 (Fireplace Puzzle) + if (argc == 0) { + for (byte i = 0; i < 6; i++) + _vm->_varStore->setVar(i + 17, 0); + + g_opcode211Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4372,16 +4372,16 @@ void MystScriptParser::opcode_212(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4113 (Clock Tower Cog Puzzle) - if (argc == 0) { - g_opcode212Parameters.enabled = true; - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4113 (Clock Tower Cog Puzzle) + if (argc == 0) { + g_opcode212Parameters.enabled = true; + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4389,17 +4389,17 @@ void MystScriptParser::opcode_213(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4524 (Dockside Facing Towards Ship) - if (argc == 0) { - // TODO: Implement Code... - // Code for Gull Videos? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4524 (Dockside Facing Towards Ship) + if (argc == 0) { + // TODO: Implement Code... + // Code for Gull Videos? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4407,29 +4407,29 @@ void MystScriptParser::opcode_214(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4500 (Stellar Observatory) - if (argc == 5) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - - uint16 u0 = argv[0]; - uint16 u1 = argv[1]; - uint16 u2 = argv[2]; - uint16 u3 = argv[3]; - uint16 u4 = argv[4]; - - debugC(kDebugScript, "\tu0: %d", u0); - debugC(kDebugScript, "\tu1: %d", u1); - debugC(kDebugScript, "\tu2: %d", u2); - debugC(kDebugScript, "\tu3: %d", u3); - debugC(kDebugScript, "\tu4: %d", u4); - // TODO: Complete Implementation... - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4500 (Stellar Observatory) + if (argc == 5) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + + uint16 u0 = argv[0]; + uint16 u1 = argv[1]; + uint16 u2 = argv[2]; + uint16 u3 = argv[3]; + uint16 u4 = argv[4]; + + debugC(kDebugScript, "\tu0: %d", u0); + debugC(kDebugScript, "\tu1: %d", u1); + debugC(kDebugScript, "\tu2: %d", u2); + debugC(kDebugScript, "\tu3: %d", u3); + debugC(kDebugScript, "\tu4: %d", u4); + // TODO: Complete Implementation... + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4437,13 +4437,13 @@ void MystScriptParser::opcode_215(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4134 (Dock Facing Marker Switch) - // TODO: Fill in logic. Logic for Gull Videos? - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4134 (Dock Facing Marker Switch) + // TODO: Fill in logic. Logic for Gull Videos? + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4451,16 +4451,16 @@ void MystScriptParser::opcode_216(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4571 (Channelwood Tree) - if (argc == 0) { - // TODO: Fill in logic for Tree Position From Far... - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4571 (Channelwood Tree) + if (argc == 0) { + // TODO: Fill in logic for Tree Position From Far... + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4468,17 +4468,17 @@ void MystScriptParser::opcode_217(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4601 (Channelwood Tree) - if (argc == 2) { - // TODO: Fill in logic for Tree Position Close Up... - // 2 arguments: 4, 4 - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4601 (Channelwood Tree) + if (argc == 2) { + // TODO: Fill in logic for Tree Position Close Up... + // 2 arguments: 4, 4 + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4486,24 +4486,24 @@ void MystScriptParser::opcode_218(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4097 (Cabin Boiler) - // TODO: Fill in logic - if (false) { - _vm->_video->playMovie(_vm->wrapMovieFilename("cabfirfr", kMystStack), 254, 244); - _vm->_video->playMovie(_vm->wrapMovieFilename("cabcgfar", kMystStack), 254, 138); - } + case kMystStack: + // Used for Card 4097 (Cabin Boiler) + // TODO: Fill in logic + if (false) { + _vm->_video->playMovie(_vm->wrapMovieFilename("cabfirfr", kMystStack), 254, 244); + _vm->_video->playMovie(_vm->wrapMovieFilename("cabcgfar", kMystStack), 254, 138); + } - // Used for Card 4098 (Cabin Boiler) - // TODO: Fill in logic - if (false) { - _vm->_video->playMovie(_vm->wrapMovieFilename("cabfire", kMystStack), 240, 279); - _vm->_video->playMovie(_vm->wrapMovieFilename("cabingau", kMystStack), 243, 97); - } - break; - default: - unknown(op, var, argc, argv); - break; + // Used for Card 4098 (Cabin Boiler) + // TODO: Fill in logic + if (false) { + _vm->_video->playMovie(_vm->wrapMovieFilename("cabfire", kMystStack), 240, 279); + _vm->_video->playMovie(_vm->wrapMovieFilename("cabingau", kMystStack), 243, 97); + } + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4511,29 +4511,29 @@ void MystScriptParser::opcode_219(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4530 (Rocketship Music Puzzle) - if (argc == 5) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - - uint16 u0 = argv[0]; - uint16 u1 = argv[1]; - uint16 u2 = argv[2]; - uint16 u3 = argv[3]; - uint16 u4 = argv[4]; - - debugC(kDebugScript, "\tu0: %d", u0); - debugC(kDebugScript, "\tu1: %d", u1); - debugC(kDebugScript, "\tu2: %d", u2); - debugC(kDebugScript, "\tu3: %d", u3); - debugC(kDebugScript, "\tu4: %d", u4); - // TODO: Fill in logic... - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4530 (Rocketship Music Puzzle) + if (argc == 5) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + + uint16 u0 = argv[0]; + uint16 u1 = argv[1]; + uint16 u2 = argv[2]; + uint16 u3 = argv[3]; + uint16 u4 = argv[4]; + + debugC(kDebugScript, "\tu0: %d", u0); + debugC(kDebugScript, "\tu1: %d", u1); + debugC(kDebugScript, "\tu2: %d", u2); + debugC(kDebugScript, "\tu3: %d", u3); + debugC(kDebugScript, "\tu4: %d", u4); + // TODO: Fill in logic... + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4541,17 +4541,17 @@ void MystScriptParser::opcode_220(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4530 (Rocketship Music Puzzle Video) - // TODO: Fill in logic. - if (false) { - // loop? - _vm->_video->playMovie(_vm->wrapMovieFilename("selenbok", kMystStack), 224, 41); - } - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4530 (Rocketship Music Puzzle Video) + // TODO: Fill in logic. + if (false) { + // loop? + _vm->_video->playMovie(_vm->wrapMovieFilename("selenbok", kMystStack), 224, 41); + } + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4559,24 +4559,24 @@ void MystScriptParser::opcode_221(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4168 (Green Book Movies) - // Movie plays in resource #0 rect - // TODO: Not sure if subsection is looped... - if (!_vm->_varStore->getVar(302)) { - // HACK: Stop Wind Sounds.. Think this is a problem at library entrance. - _vm->_sound->stopSound(); - _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrusbk1", kMystStack), 314, 76); - _vm->_varStore->setVar(302, 1); - } else { - // HACK: Stop Wind Sounds.. Think this is a problem at library entrance. - _vm->_sound->stopSound(); - _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrusbk2", kMystStack), 314, 76); - } - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4168 (Green Book Movies) + // Movie plays in resource #0 rect + // TODO: Not sure if subsection is looped... + if (!_vm->_varStore->getVar(302)) { + // HACK: Stop Wind Sounds.. Think this is a problem at library entrance. + _vm->_sound->stopSound(); + _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrusbk1", kMystStack), 314, 76); + _vm->_varStore->setVar(302, 1); + } else { + // HACK: Stop Wind Sounds.. Think this is a problem at library entrance. + _vm->_sound->stopSound(); + _vm->_video->playBackgroundMovie(_vm->wrapMovieFilename("atrusbk2", kMystStack), 314, 76); + } + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4584,16 +4584,16 @@ void MystScriptParser::opcode_222(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4141 (Myst Dock Facing Sea) - if (argc == 0) { - // TODO: Logic for Gull Videos? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4141 (Myst Dock Facing Sea) + if (argc == 0) { + // TODO: Logic for Gull Videos? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4601,26 +4601,26 @@ void MystScriptParser::opcode_298(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kDemoPreviewStack: - // Used for Card 3000 (Closed Myst Book) - // TODO: Fill in logic. - // Start Voice Over... which controls book opening - _vm->_sound->playSound(3001); + case kDemoPreviewStack: + // Used for Card 3000 (Closed Myst Book) + // TODO: Fill in logic. + // Start Voice Over... which controls book opening + _vm->_sound->playSound(3001); - // then link to Myst - Trigger of Hotspot? then opcode 199/196/197 for voice over continue? - // TODO: Sync Voice and Actions to Original - // TODO: Flash Library Red - // TODO: Move to run process based delay to prevent - // blocking... - _vm->_system->delayMillis(20 * 1000); - for (uint16 imageId = 3001; imageId <= 3012; imageId++) { - _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); - _vm->_system->delayMillis(5 * 1000); - } - break; - default: - unknown(op, var, argc, argv); - break; + // then link to Myst - Trigger of Hotspot? then opcode 199/196/197 for voice over continue? + // TODO: Sync Voice and Actions to Original + // TODO: Flash Library Red + // TODO: Move to run process based delay to prevent + // blocking... + _vm->_system->delayMillis(20 * 1000); + for (uint16 imageId = 3001; imageId <= 3012; imageId++) { + _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); + _vm->_system->delayMillis(5 * 1000); + } + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4628,92 +4628,92 @@ void MystScriptParser::opcode_299(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kDemoPreviewStack: - // Used for Card 3002 (Myst Island Overview) - // TODO: Fill in logic. - // Zoom into Island? - // On this card is a Type 8 controlled by Var 0, which - // can change the Myst Library to Red.. - break; - default: - unknown(op, var, argc, argv); - break; + case kDemoPreviewStack: + // Used for Card 3002 (Myst Island Overview) + // TODO: Fill in logic. + // Zoom into Island? + // On this card is a Type 8 controlled by Var 0, which + // can change the Myst Library to Red.. + break; + default: + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_300(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kIntroStack: - varUnusedCheck(op, var); - // TODO: StopSound? - unknown(op, var, argc, argv); - break; - case kDemoPreviewStack: - case kMystStack: - // Used in Card 4371 (Blue Book) Var = 101 - // and Card 4363 (Red Book) Var = 100 - // TODO: Fill in Logic - debugC(kDebugScript, "Opcode %d: Book Exit Function...", op); - debugC(kDebugScript, "Var: %d", var); - break; - case kStoneshipStack: - // Used in Card 2218 (Telescope view) - varUnusedCheck(op, var); - // TODO: Fill in Logic. Clearing Variable for View? - break; - case kMechanicalStack: - // Used in Card 6156 (Fortress Elevator View) - varUnusedCheck(op, var); - // TODO: Fill in Logic. Clearing Variable for View? - break; - case kChannelwoodStack: - // Used in Card 3012 (Achenar's Holoprojector Control) - varUnusedCheck(op, var); - // TODO: Fill in Logic. Clearing Variable for View? - break; - case kDniStack: - // Used in Card 5014 (Atrus Writing) - varUnusedCheck(op, var); - // TODO: Fill in Logic. - break; - case kDemoStack: - // Used on Card 2000 - varUnusedCheck(op, var); + case kIntroStack: + varUnusedCheck(op, var); + // TODO: StopSound? + unknown(op, var, argc, argv); + break; + case kDemoPreviewStack: + case kMystStack: + // Used in Card 4371 (Blue Book) Var = 101 + // and Card 4363 (Red Book) Var = 100 + // TODO: Fill in Logic + debugC(kDebugScript, "Opcode %d: Book Exit Function...", op); + debugC(kDebugScript, "Var: %d", var); + break; + case kStoneshipStack: + // Used in Card 2218 (Telescope view) + varUnusedCheck(op, var); + // TODO: Fill in Logic. Clearing Variable for View? + break; + case kMechanicalStack: + // Used in Card 6156 (Fortress Elevator View) + varUnusedCheck(op, var); + // TODO: Fill in Logic. Clearing Variable for View? + break; + case kChannelwoodStack: + // Used in Card 3012 (Achenar's Holoprojector Control) + varUnusedCheck(op, var); + // TODO: Fill in Logic. Clearing Variable for View? + break; + case kDniStack: + // Used in Card 5014 (Atrus Writing) + varUnusedCheck(op, var); + // TODO: Fill in Logic. + break; + case kDemoStack: + // Used on Card 2000 + varUnusedCheck(op, var); - // TODO: Fill in Function... - break; - default: - varUnusedCheck(op, var); - unknown(op, var, argc, argv); - break; + // TODO: Fill in Function... + break; + default: + varUnusedCheck(op, var); + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_301(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kDemoPreviewStack: - case kMystStack: - // Used in Card 4080 (Fireplace Book) and Other Myst Library Books - // TODO: Fill in Logic. Clear Variable on Book exit.. or Copy from duplicate.. - _vm->_varStore->setVar(0, 1); - break; - default: - varUnusedCheck(op, var); - unknown(op, var, argc, argv); - break; + case kDemoPreviewStack: + case kMystStack: + // Used in Card 4080 (Fireplace Book) and Other Myst Library Books + // TODO: Fill in Logic. Clear Variable on Book exit.. or Copy from duplicate.. + _vm->_varStore->setVar(0, 1); + break; + default: + varUnusedCheck(op, var); + unknown(op, var, argc, argv); + break; } } void MystScriptParser::opcode_302(uint16 op, uint16 var, uint16 argc, uint16 *argv) { switch (_vm->getCurStack()) { - case kMystStack: - // Used in Card 4113 (Clock Tower Cog Puzzle) - // TODO: Fill in Logic - break; - default: - varUnusedCheck(op, var); - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used in Card 4113 (Clock Tower Cog Puzzle) + // TODO: Fill in Logic + break; + default: + varUnusedCheck(op, var); + unknown(op, var, argc, argv); + break; } } @@ -4721,17 +4721,17 @@ void MystScriptParser::opcode_303(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4141 (Myst Dock Facing Sea) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Clear Dock Forechamber Door Variable", op); - _vm->_varStore->setVar(105, 0); - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4141 (Myst Dock Facing Sea) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Clear Dock Forechamber Door Variable", op); + _vm->_varStore->setVar(105, 0); + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4739,17 +4739,17 @@ void MystScriptParser::opcode_304(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4601 (Channelwood Tree) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - // TODO: Logic for clearing variable? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4601 (Channelwood Tree) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + // TODO: Logic for clearing variable? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4757,17 +4757,17 @@ void MystScriptParser::opcode_305(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4601 (Channelwood Tree) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - // TODO: Logic for clearing variable? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4601 (Channelwood Tree) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + // TODO: Logic for clearing variable? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4775,17 +4775,17 @@ void MystScriptParser::opcode_306(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4098 (Cabin Boiler Puzzle) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - // TODO: Logic for clearing variable? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4098 (Cabin Boiler Puzzle) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + // TODO: Logic for clearing variable? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4793,17 +4793,17 @@ void MystScriptParser::opcode_307(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4299 (Generator Room Controls) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - // TODO: Logic for clearing variable? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4299 (Generator Room Controls) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + // TODO: Logic for clearing variable? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4811,17 +4811,17 @@ void MystScriptParser::opcode_308(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4530 (Rocketship Music Sliders) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - // TODO: Logic for clearing variable? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4530 (Rocketship Music Sliders) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + // TODO: Logic for clearing variable? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4829,17 +4829,17 @@ void MystScriptParser::opcode_309(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4168 (Green D'ni Book Open), Red Book Open and Blue Book Open - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - // TODO: Logic for clearing variable? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4168 (Green D'ni Book Open), Red Book Open and Blue Book Open + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + // TODO: Logic for clearing variable? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } @@ -4847,17 +4847,17 @@ void MystScriptParser::opcode_312(uint16 op, uint16 var, uint16 argc, uint16 *ar varUnusedCheck(op, var); switch (_vm->getCurStack()) { - case kMystStack: - // Used for Card 4698 (Dock Forechamber Imager) - if (argc == 0) { - debugC(kDebugScript, "Opcode %d: Unknown...", op); - // TODO: Logic for clearing variable? - } else - unknown(op, var, argc, argv); - break; - default: - unknown(op, var, argc, argv); - break; + case kMystStack: + // Used for Card 4698 (Dock Forechamber Imager) + if (argc == 0) { + debugC(kDebugScript, "Opcode %d: Unknown...", op); + // TODO: Logic for clearing variable? + } else + unknown(op, var, argc, argv); + break; + default: + unknown(op, var, argc, argv); + break; } } diff --git a/engines/mohawk/myst_vars.cpp b/engines/mohawk/myst_vars.cpp index 46951a4388..f496b52487 100644 --- a/engines/mohawk/myst_vars.cpp +++ b/engines/mohawk/myst_vars.cpp @@ -367,81 +367,81 @@ uint16 MystVar::saveGetVar(uint16 stack, uint16 v) { uint16 i; switch (stack) { - case kIntroStack: - for (i = 0; i < ARRAYSIZE(introVars); i++) { - if (introVars[i].refNum == v) { - value = introVars[i].storage; - desc = introVars[i].description; - break; - } + case kIntroStack: + for (i = 0; i < ARRAYSIZE(introVars); i++) { + if (introVars[i].refNum == v) { + value = introVars[i].storage; + desc = introVars[i].description; + break; } - break; - case kSeleniticStack: - for (i = 0; i < ARRAYSIZE(seleniticVars); i++) { - if (seleniticVars[i].refNum == v) { - value = seleniticVars[i].storage; - desc = seleniticVars[i].description; - break; - } + } + break; + case kSeleniticStack: + for (i = 0; i < ARRAYSIZE(seleniticVars); i++) { + if (seleniticVars[i].refNum == v) { + value = seleniticVars[i].storage; + desc = seleniticVars[i].description; + break; } - break; - case kStoneshipStack: - for (i = 0; i < ARRAYSIZE(stoneshipVars); i++) { - if (stoneshipVars[i].refNum == v) { - value = stoneshipVars[i].storage; - desc = stoneshipVars[i].description; - break; - } + } + break; + case kStoneshipStack: + for (i = 0; i < ARRAYSIZE(stoneshipVars); i++) { + if (stoneshipVars[i].refNum == v) { + value = stoneshipVars[i].storage; + desc = stoneshipVars[i].description; + break; } - break; - case kDemoPreviewStack: - case kMystStack: - for (i = 0; i < ARRAYSIZE(mystVars); i++) { - if (mystVars[i].refNum == v) { - value = mystVars[i].storage; - desc = mystVars[i].description; - break; - } + } + break; + case kDemoPreviewStack: + case kMystStack: + for (i = 0; i < ARRAYSIZE(mystVars); i++) { + if (mystVars[i].refNum == v) { + value = mystVars[i].storage; + desc = mystVars[i].description; + break; } - break; - case kMechanicalStack: - for (i = 0; i < ARRAYSIZE(mechVars); i++) { - if (mechVars[i].refNum == v) { - value = mechVars[i].storage; - desc = mechVars[i].description; - break; - } + } + break; + case kMechanicalStack: + for (i = 0; i < ARRAYSIZE(mechVars); i++) { + if (mechVars[i].refNum == v) { + value = mechVars[i].storage; + desc = mechVars[i].description; + break; } - break; - case kChannelwoodStack: - for (i = 0; i < ARRAYSIZE(channelwoodVars); i++) { - if (channelwoodVars[i].refNum == v) { - value = channelwoodVars[i].storage; - desc = channelwoodVars[i].description; - break; - } + } + break; + case kChannelwoodStack: + for (i = 0; i < ARRAYSIZE(channelwoodVars); i++) { + if (channelwoodVars[i].refNum == v) { + value = channelwoodVars[i].storage; + desc = channelwoodVars[i].description; + break; } - break; - case kDniStack: - for (i = 0; i < ARRAYSIZE(dniVars); i++) { - if (dniVars[i].refNum == v) { - value = dniVars[i].storage; - desc = dniVars[i].description; - break; - } + } + break; + case kDniStack: + for (i = 0; i < ARRAYSIZE(dniVars); i++) { + if (dniVars[i].refNum == v) { + value = dniVars[i].storage; + desc = dniVars[i].description; + break; } - break; - case kCreditsStack: - for (i = 0; i < ARRAYSIZE(creditsVars); i++) { - if (creditsVars[i].refNum == v) { - value = creditsVars[i].storage; - desc = creditsVars[i].description; - break; - } + } + break; + case kCreditsStack: + for (i = 0; i < ARRAYSIZE(creditsVars); i++) { + if (creditsVars[i].refNum == v) { + value = creditsVars[i].storage; + desc = creditsVars[i].description; + break; } - break; - default: - break; + } + break; + default: + break; } if (desc == NULL) { @@ -471,81 +471,81 @@ void MystVar::loadSetVar(uint16 stack, uint16 v, uint16 value) { uint16 i; switch (stack) { - case kIntroStack: - for (i = 0; i < ARRAYSIZE(introVars); i++) { - if (introVars[i].refNum == v) { - introVars[i].storage = value; - desc = introVars[i].description; - break; - } + case kIntroStack: + for (i = 0; i < ARRAYSIZE(introVars); i++) { + if (introVars[i].refNum == v) { + introVars[i].storage = value; + desc = introVars[i].description; + break; } - break; - case kSeleniticStack: - for (i = 0; i < ARRAYSIZE(seleniticVars); i++) { - if (seleniticVars[i].refNum == v) { - seleniticVars[i].storage = value; - desc = seleniticVars[i].description; - break; - } + } + break; + case kSeleniticStack: + for (i = 0; i < ARRAYSIZE(seleniticVars); i++) { + if (seleniticVars[i].refNum == v) { + seleniticVars[i].storage = value; + desc = seleniticVars[i].description; + break; } - break; - case kStoneshipStack: - for (i = 0; i < ARRAYSIZE(stoneshipVars); i++) { - if (stoneshipVars[i].refNum == v) { - stoneshipVars[i].storage = value; - desc = stoneshipVars[i].description; - break; - } + } + break; + case kStoneshipStack: + for (i = 0; i < ARRAYSIZE(stoneshipVars); i++) { + if (stoneshipVars[i].refNum == v) { + stoneshipVars[i].storage = value; + desc = stoneshipVars[i].description; + break; } - break; - case kDemoPreviewStack: - case kMystStack: - for (i = 0; i < ARRAYSIZE(mystVars); i++) { - if (mystVars[i].refNum == v) { - mystVars[i].storage = value; - desc = mystVars[i].description; - break; - } + } + break; + case kDemoPreviewStack: + case kMystStack: + for (i = 0; i < ARRAYSIZE(mystVars); i++) { + if (mystVars[i].refNum == v) { + mystVars[i].storage = value; + desc = mystVars[i].description; + break; } - break; - case kMechanicalStack: - for (i = 0; i < ARRAYSIZE(mechVars); i++) { - if (mechVars[i].refNum == v) { - mechVars[i].storage = value; - desc = mechVars[i].description; - break; - } + } + break; + case kMechanicalStack: + for (i = 0; i < ARRAYSIZE(mechVars); i++) { + if (mechVars[i].refNum == v) { + mechVars[i].storage = value; + desc = mechVars[i].description; + break; } - break; - case kChannelwoodStack: - for (i = 0; i < ARRAYSIZE(channelwoodVars); i++) { - if (channelwoodVars[i].refNum == v) { - channelwoodVars[i].storage = value; - desc = channelwoodVars[i].description; - break; - } + } + break; + case kChannelwoodStack: + for (i = 0; i < ARRAYSIZE(channelwoodVars); i++) { + if (channelwoodVars[i].refNum == v) { + channelwoodVars[i].storage = value; + desc = channelwoodVars[i].description; + break; } - break; - case kDniStack: - for (i = 0; i < ARRAYSIZE(dniVars); i++) { - if (dniVars[i].refNum == v) { - dniVars[i].storage = value; - desc = dniVars[i].description; - break; - } + } + break; + case kDniStack: + for (i = 0; i < ARRAYSIZE(dniVars); i++) { + if (dniVars[i].refNum == v) { + dniVars[i].storage = value; + desc = dniVars[i].description; + break; } - break; - case kCreditsStack: - for (i = 0; i < ARRAYSIZE(creditsVars); i++) { - if (creditsVars[i].refNum == v) { - creditsVars[i].storage = value; - desc = creditsVars[i].description; - break; - } + } + break; + case kCreditsStack: + for (i = 0; i < ARRAYSIZE(creditsVars); i++) { + if (creditsVars[i].refNum == v) { + creditsVars[i].storage = value; + desc = creditsVars[i].description; + break; } - break; - default: - break; + } + break; + default: + break; } if (desc == NULL) { diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index e2f581d75d..8653329fc9 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -104,69 +104,69 @@ Common::Error MohawkEngine_Riven::run() { while (_eventMan->pollEvent(event)) { switch (event.type) { - case Common::EVENT_MOUSEMOVE: - _mousePos = event.mouse; - checkHotspotChange(); + case Common::EVENT_MOUSEMOVE: + _mousePos = event.mouse; + checkHotspotChange(); - // Check to show the inventory - if (_mousePos.y >= 392) - _gfx->showInventory(); - else - _gfx->hideInventory(); + // Check to show the inventory + if (_mousePos.y >= 392) + _gfx->showInventory(); + else + _gfx->hideInventory(); - needsUpdate = true; + needsUpdate = true; + break; + case Common::EVENT_LBUTTONDOWN: + if (_curHotspot >= 0) { + runHotspotScript(_curHotspot, kMouseDownScript); + //scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript); + } + break; + case Common::EVENT_LBUTTONUP: + if (_curHotspot >= 0) { + runHotspotScript(_curHotspot, kMouseUpScript); + //scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript); + } else + checkInventoryClick(); + break; + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_d: + if (event.kbd.flags & Common::KBD_CTRL) { + _console->attach(); + _console->onFrame(); + } + break; + case Common::KEYCODE_SPACE: + pauseGame(); break; - case Common::EVENT_LBUTTONDOWN: - if (_curHotspot >= 0) { - runHotspotScript(_curHotspot, kMouseDownScript); - //scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript); + case Common::KEYCODE_F4: + _showHotspots = !_showHotspots; + if (_showHotspots) { + for (uint16 i = 0; i < _hotspotCount; i++) + _gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled); + needsUpdate = true; + } else { + changeToCard(); } break; - case Common::EVENT_LBUTTONUP: - if (_curHotspot >= 0) { - runHotspotScript(_curHotspot, kMouseUpScript); - //scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript); - } else - checkInventoryClick(); + case Common::KEYCODE_F5: + runDialog(*_optionsDialog); + updateZipMode(); break; - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_d: - if (event.kbd.flags & Common::KBD_CTRL) { - _console->attach(); - _console->onFrame(); - } - break; - case Common::KEYCODE_SPACE: - pauseGame(); - break; - case Common::KEYCODE_F4: - _showHotspots = !_showHotspots; - if (_showHotspots) { - for (uint16 i = 0; i < _hotspotCount; i++) - _gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled); - needsUpdate = true; - } else { - changeToCard(); - } - break; - case Common::KEYCODE_F5: - runDialog(*_optionsDialog); - updateZipMode(); - break; - case Common::KEYCODE_ESCAPE: - if (getFeatures() & GF_DEMO) { - if (_curStack != aspit) - changeToStack(aspit); - changeToCard(1); - } - break; - default: - break; + case Common::KEYCODE_ESCAPE: + if (getFeatures() & GF_DEMO) { + if (_curStack != aspit) + changeToStack(aspit); + changeToCard(1); } break; default: break; + } + break; + default: + break; } } diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index 647f3a35f6..5108fd8867 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -659,35 +659,35 @@ void RivenExternal::xvalvecontrol(uint16 argc, uint16 *argv) { for (;;) { while (_vm->_system->getEventManager()->pollEvent(event)) { switch (event.type) { - case Common::EVENT_MOUSEMOVE: - changeX = event.mouse.x - _vm->_mousePos.x; - changeY = _vm->_mousePos.y - event.mouse.y; - _vm->_system->updateScreen(); - break; - case Common::EVENT_LBUTTONUP: - // FIXME: These values for changes in x/y could be tweaked. - if (*valve == 0 && changeY <= -10) { - *valve = 1; + case Common::EVENT_MOUSEMOVE: + changeX = event.mouse.x - _vm->_mousePos.x; + changeY = _vm->_mousePos.y - event.mouse.y; + _vm->_system->updateScreen(); + break; + case Common::EVENT_LBUTTONUP: + // FIXME: These values for changes in x/y could be tweaked. + if (*valve == 0 && changeY <= -10) { + *valve = 1; + // TODO: Play movie + _vm->changeToCard(); // Refresh + } else if (*valve == 1) { + if (changeX >= 0 && changeY >= 10) { + *valve = 0; // TODO: Play movie _vm->changeToCard(); // Refresh - } else if (*valve == 1) { - if (changeX >= 0 && changeY >= 10) { - *valve = 0; - // TODO: Play movie - _vm->changeToCard(); // Refresh - } else if (changeX <= -10 && changeY <= 10) { - *valve = 2; - // TODO: Play movie - _vm->changeToCard(); // Refresh - } - } else if (*valve == 2 && changeX >= 10) { - *valve = 1; + } else if (changeX <= -10 && changeY <= 10) { + *valve = 2; // TODO: Play movie _vm->changeToCard(); // Refresh } - return; - default: - break; + } else if (*valve == 2 && changeX >= 10) { + *valve = 1; + // TODO: Play movie + _vm->changeToCard(); // Refresh + } + return; + default: + break; } } _vm->_system->delayMillis(10); @@ -1004,22 +1004,22 @@ int RivenExternal::jspitElevatorLoop() { for (;;) { while (_vm->_system->getEventManager()->pollEvent(event)) { switch (event.type) { - case Common::EVENT_MOUSEMOVE: - if (event.mouse.y > (_vm->_mousePos.y + 10)) { - changeLevel = -1; - } else if (event.mouse.y < (_vm->_mousePos.y - 10)) { - changeLevel = 1; - } else { - changeLevel = 0; - } - _vm->_system->updateScreen(); - break; - case Common::EVENT_LBUTTONUP: - _vm->_gfx->changeCursor(kRivenMainCursor); - _vm->_system->updateScreen(); - return changeLevel; - default: - break; + case Common::EVENT_MOUSEMOVE: + if (event.mouse.y > (_vm->_mousePos.y + 10)) { + changeLevel = -1; + } else if (event.mouse.y < (_vm->_mousePos.y - 10)) { + changeLevel = 1; + } else { + changeLevel = 0; + } + _vm->_system->updateScreen(); + break; + case Common::EVENT_LBUTTONUP: + _vm->_gfx->changeCursor(kRivenMainCursor); + _vm->_system->updateScreen(); + return changeLevel; + default: + break; } } _vm->_system->delayMillis(10); diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index c5cdcb6070..9331d034cd 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -46,22 +46,22 @@ Common::StringList RivenSaveLoad::generateSaveGameList() { // so, match them ;) static uint16 mapOldStackIDToNew(uint16 oldID) { switch (oldID) { - case 1: - return ospit; - case 2: - return pspit; - case 3: - return rspit; - case 4: - return tspit; - case 5: - return bspit; - case 6: - return gspit; - case 7: - return jspit; - case 8: - return aspit; + case 1: + return ospit; + case 2: + return pspit; + case 3: + return rspit; + case 4: + return tspit; + case 5: + return bspit; + case 6: + return gspit; + case 7: + return jspit; + case 8: + return aspit; } error ("Unknown old stack ID %d", oldID); return 0; @@ -69,22 +69,22 @@ static uint16 mapOldStackIDToNew(uint16 oldID) { static uint16 mapNewStackIDToOld(uint16 newID) { switch (newID) { - case aspit: - return 8; - case bspit: - return 5; - case gspit: - return 6; - case jspit: - return 7; - case ospit: - return 1; - case pspit: - return 2; - case rspit: - return 3; - case tspit: - return 4; + case aspit: + return 8; + case bspit: + return 5; + case gspit: + return 6; + case jspit: + return 7; + case ospit: + return 1; + case pspit: + return 2; + case rspit: + return 3; + case tspit: + return 4; } error ("Unknown new stack ID %d", newID); return 0; diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index 7426e07084..2c24812826 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -95,43 +95,43 @@ Audio::SoundHandle *Sound::playSound(uint16 id, bool mainSoundFile, byte volume) Audio::AudioStream* audStream = NULL; switch (_vm->getGameType()) { - case GType_MYST: - if (_vm->getFeatures() & GF_ME) { - // Myst ME is a bit more efficient with sound storage than Myst - // Myst has lots of sounds repeated. To overcome this, Myst ME - // has MJMP resources which provide a link to the actual MSND - // resource we're looking for. This saves a lot of space from - // repeated data. - if (_vm->hasResource(ID_MJMP, id)) { - Common::SeekableReadStream *mjmpStream = _vm->getRawData(ID_MJMP, id); - id = mjmpStream->readUint16LE(); - delete mjmpStream; - } - - audStream = Audio::makeWAVStream(_vm->getRawData(ID_MSND, id), true); - } else - audStream = makeMohawkWaveStream(_vm->getRawData(ID_MSND, id)); - break; - case GType_RIVEN: - if (mainSoundFile) - audStream = makeMohawkWaveStream(_rivenSoundFile->getRawData(ID_TWAV, id)); - else - audStream = makeMohawkWaveStream(_vm->getRawData(ID_TWAV, id)); - break; - case GType_ZOOMBINI: - audStream = makeMohawkWaveStream(_vm->getRawData(ID_SND, id)); - break; - case GType_CSAMTRAK: - if (mainSoundFile) - audStream = makeMohawkWaveStream(_vm->getRawData(ID_TWAV, id)); - else - audStream = getCSAmtrakMusic(id); - break; - case GType_OLDLIVINGBOOKS: - audStream = makeOldMohawkWaveStream(_vm->getRawData(ID_WAV, id)); - break; - default: + case GType_MYST: + if (_vm->getFeatures() & GF_ME) { + // Myst ME is a bit more efficient with sound storage than Myst + // Myst has lots of sounds repeated. To overcome this, Myst ME + // has MJMP resources which provide a link to the actual MSND + // resource we're looking for. This saves a lot of space from + // repeated data. + if (_vm->hasResource(ID_MJMP, id)) { + Common::SeekableReadStream *mjmpStream = _vm->getRawData(ID_MJMP, id); + id = mjmpStream->readUint16LE(); + delete mjmpStream; + } + + audStream = Audio::makeWAVStream(_vm->getRawData(ID_MSND, id), true); + } else + audStream = makeMohawkWaveStream(_vm->getRawData(ID_MSND, id)); + break; + case GType_RIVEN: + if (mainSoundFile) + audStream = makeMohawkWaveStream(_rivenSoundFile->getRawData(ID_TWAV, id)); + else audStream = makeMohawkWaveStream(_vm->getRawData(ID_TWAV, id)); + break; + case GType_ZOOMBINI: + audStream = makeMohawkWaveStream(_vm->getRawData(ID_SND, id)); + break; + case GType_CSAMTRAK: + if (mainSoundFile) + audStream = makeMohawkWaveStream(_vm->getRawData(ID_TWAV, id)); + else + audStream = getCSAmtrakMusic(id); + break; + case GType_OLDLIVINGBOOKS: + audStream = makeOldMohawkWaveStream(_vm->getRawData(ID_WAV, id)); + break; + default: + audStream = makeMohawkWaveStream(_vm->getRawData(ID_TWAV, id)); } if (audStream) { @@ -351,79 +351,79 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre tag = stream->readUint32BE(); switch (tag) { - case ID_ADPC: - debug(2, "Found Tag ADPC"); - // Riven ADPCM Sound Only - // NOTE: This is completely useless for us. All of this - // is already in the ADPCM decoder in /sound. - adpc.size = stream->readUint32BE(); - adpc.u0 = stream->readUint16BE(); - adpc.channels = stream->readUint16BE(); - adpc.u1 = stream->readUint32BE(); - + case ID_ADPC: + debug(2, "Found Tag ADPC"); + // Riven ADPCM Sound Only + // NOTE: This is completely useless for us. All of this + // is already in the ADPCM decoder in /sound. + adpc.size = stream->readUint32BE(); + adpc.u0 = stream->readUint16BE(); + adpc.channels = stream->readUint16BE(); + adpc.u1 = stream->readUint32BE(); + + for (uint16 i = 0; i < adpc.channels; i++) + adpc.u2[i] = stream->readUint32BE(); + if (adpc.u0 == 2) { + adpc.u3 = stream->readUint32BE(); for (uint16 i = 0; i < adpc.channels; i++) - adpc.u2[i] = stream->readUint32BE(); - if (adpc.u0 == 2) { - adpc.u3 = stream->readUint32BE(); - for (uint16 i = 0; i < adpc.channels; i++) - adpc.u4[i] = stream->readUint32BE(); - } - break; - case ID_CUE: - debug(2, "Found Tag Cue#"); - // I have not tested this with Myst, but the one Riven test-case, - // pspit tWAV 3, has two cue points: "Beg Loop" and "End Loop". - // So, my guess is that a cue chunk just holds where to loop the - // sound. Some cue chunks even have no point count (such as - // Myst's intro.dat MSND 2. So, my theory is that a cue chunk - // always represents a loop, and if there is a point count, that - // represents the points from which to loop. - // - // This theory is probably not entirely true anymore. I've found - // that the values (which were previously unknown) in the DATA - // chunk are for looping. Since it was only used in Myst, it was - // always 10 0's, Tito just thought it was useless. I'm still not - // sure what purpose this has. + adpc.u4[i] = stream->readUint32BE(); + } + break; + case ID_CUE: + debug(2, "Found Tag Cue#"); + // I have not tested this with Myst, but the one Riven test-case, + // pspit tWAV 3, has two cue points: "Beg Loop" and "End Loop". + // So, my guess is that a cue chunk just holds where to loop the + // sound. Some cue chunks even have no point count (such as + // Myst's intro.dat MSND 2. So, my theory is that a cue chunk + // always represents a loop, and if there is a point count, that + // represents the points from which to loop. + // + // This theory is probably not entirely true anymore. I've found + // that the values (which were previously unknown) in the DATA + // chunk are for looping. Since it was only used in Myst, it was + // always 10 0's, Tito just thought it was useless. I'm still not + // sure what purpose this has. - cue.size = stream->readUint32BE(); - cue.point_count = stream->readUint16BE(); - - if (cue.point_count == 0) - debug (2, "Cue# chunk found with no points!"); - else - debug (2, "Cue# chunk found with %d point(s)!", cue.point_count); - - for (uint16 i = 0; i < cue.point_count; i++) { - cue.cueList[i].position = stream->readUint32BE(); - cue.cueList[i].length = stream->readByte(); - for (byte j = 0; j < cue.cueList[i].length; j++) - cue.cueList[i].name += stream->readByte(); - // Realign to uint16 boundaries... - if (!(cue.cueList[i].length & 1)) - stream->readByte(); - debug (3, "Cue# chunk point %d: %s", i, cue.cueList[i].name.c_str()); - } - break; - case ID_DATA: - debug(2, "Found Tag DATA"); - // We subtract 20 from the actual chunk size, which is the total size - // of the chunk's header - data_chunk.size = stream->readUint32BE() - 20; - data_chunk.sample_rate = stream->readUint16BE(); - data_chunk.sample_count = stream->readUint32BE(); - data_chunk.bitsPerSample = stream->readByte(); - data_chunk.channels = stream->readByte(); - data_chunk.encoding = stream->readUint16BE(); - data_chunk.loop = stream->readUint16BE(); - data_chunk.loopStart = stream->readUint32BE(); - data_chunk.loopEnd = stream->readUint32BE(); - - data_chunk.audio_data = (byte *)malloc(data_chunk.size); - stream->read(data_chunk.audio_data, data_chunk.size); - foundData = true; - break; - default: - error ("Unknown tag found in 'tWAV' chunk -- \'%s\'", tag2str(tag)); + cue.size = stream->readUint32BE(); + cue.point_count = stream->readUint16BE(); + + if (cue.point_count == 0) + debug (2, "Cue# chunk found with no points!"); + else + debug (2, "Cue# chunk found with %d point(s)!", cue.point_count); + + for (uint16 i = 0; i < cue.point_count; i++) { + cue.cueList[i].position = stream->readUint32BE(); + cue.cueList[i].length = stream->readByte(); + for (byte j = 0; j < cue.cueList[i].length; j++) + cue.cueList[i].name += stream->readByte(); + // Realign to uint16 boundaries... + if (!(cue.cueList[i].length & 1)) + stream->readByte(); + debug (3, "Cue# chunk point %d: %s", i, cue.cueList[i].name.c_str()); + } + break; + case ID_DATA: + debug(2, "Found Tag DATA"); + // We subtract 20 from the actual chunk size, which is the total size + // of the chunk's header + data_chunk.size = stream->readUint32BE() - 20; + data_chunk.sample_rate = stream->readUint16BE(); + data_chunk.sample_count = stream->readUint32BE(); + data_chunk.bitsPerSample = stream->readByte(); + data_chunk.channels = stream->readByte(); + data_chunk.encoding = stream->readUint16BE(); + data_chunk.loop = stream->readUint16BE(); + data_chunk.loopStart = stream->readUint32BE(); + data_chunk.loopEnd = stream->readUint32BE(); + + data_chunk.audio_data = (byte *)malloc(data_chunk.size); + stream->read(data_chunk.audio_data, data_chunk.size); + foundData = true; + break; + default: + error ("Unknown tag found in 'tWAV' chunk -- \'%s\'", tag2str(tag)); } } |