diff options
25 files changed, 432 insertions, 941 deletions
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index f3caee6150..ce742f3a41 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -28,6 +28,7 @@ #include "mohawk/myst_sound.h" #include "mohawk/video.h" +#include "common/debug-channels.h" #include "common/system.h" #include "common/memstream.h" #include "common/textconsole.h" @@ -100,8 +101,8 @@ void MystScriptParser::setupCommonOpcodes() { OPCODE(4, o_redrawCard); // Opcode 5 Not Present OPCODE(6, o_goToDestForward); - OPCODE(7, o_goToDestLeft); - OPCODE(8, o_goToDestRight); + OPCODE(7, o_goToDestRight); + OPCODE(8, o_goToDestLeft); OPCODE(9, o_triggerMovie); OPCODE(10, o_toggleVarNoRedraw); // Opcode 11 Not Present @@ -150,13 +151,10 @@ void MystScriptParser::setupCommonOpcodes() { #undef OPCODE void MystScriptParser::runScript(MystScript script, MystArea *invokingResource) { - debugC(kDebugScript, "Script Size: %d", script->size()); - _scriptNestingLevel++; for (uint16 i = 0; i < script->size(); i++) { MystScriptEntry &entry = (*script)[i]; - debugC(kDebugScript, "\tOpcode %d: %d", i, entry.opcode); if (entry.type == kMystScriptNormal) _invokingResource = invokingResource; @@ -175,7 +173,11 @@ void MystScriptParser::runOpcode(uint16 op, uint16 var, const ArgumentsArray &ar bool ranOpcode = false; for (uint16 i = 0; i < _opcodes.size(); i++) if (_opcodes[i]->op == op) { - (this->*(_opcodes[i]->proc)) (op, var, args); + if (DebugMan.isDebugChannelEnabled(kDebugScript)) { + debugC(kDebugScript, "Running command: %s", describeCommand(*_opcodes[i], var, args).c_str()); + } + + (this->*(_opcodes[i]->proc)) (var, args); ranOpcode = true; break; } @@ -198,6 +200,22 @@ const Common::String MystScriptParser::getOpcodeDesc(uint16 op) { return Common::String::format("%d", op); } +Common::String MystScriptParser::describeCommand(const MystOpcode &command, uint16 var, const ArgumentsArray &args) { + Common::String desc = Common::String::format("%s(", command.desc); + + if (var != 0) { + desc += Common::String::format("var = %d%s", var, args.size() != 0 ? ", " : ""); + } + + for (uint16 j = 0; j < args.size(); j++) { + desc += Common::String::format("%d", args[j]); + if (j != args.size() - 1) + desc += ", "; + } + desc += ")"; + return desc; +} + MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, MystScriptType type) { assert(stream); assert(type != kMystScriptNone); @@ -280,44 +298,22 @@ void MystScriptParser::animatedUpdate(const ArgumentsArray &args, uint16 delay) } } -void MystScriptParser::unknown(uint16 op, uint16 var, const ArgumentsArray &args) { - warning("Unimplemented opcode 0x%02x (%d)", op, op); - warning("\tUses var %d", var); - warning("\tArg count = %d", args.size()); - - if (!args.empty()) { - Common::String str; - str += Common::String::format("%d", args[0]); - - for (uint16 i = 1; i < args.size(); i++) - str += Common::String::format(", %d", args[i]); - - warning("\tArgs: %s\n", str.c_str()); - } +void MystScriptParser::NOP(uint16 var, const ArgumentsArray &args) { } -void MystScriptParser::NOP(uint16 op, uint16 var, const ArgumentsArray &args) { -} - -void MystScriptParser::o_toggleVar(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Toggle var %d", op, var); - +void MystScriptParser::o_toggleVar(uint16 var, const ArgumentsArray &args) { toggleVar(var); _vm->redrawArea(var); } -void MystScriptParser::o_setVar(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Set var %d: %d", op, var, args[0]); - +void MystScriptParser::o_setVar(uint16 var, const ArgumentsArray &args) { if (setVarValue(var, args[0])) _vm->redrawArea(var); } -void MystScriptParser::o_changeCardSwitch4(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_changeCardSwitch4(uint16 var, const ArgumentsArray &args) { uint16 value = getVar(var); - debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value); - if (value) _vm->changeToCard(args[value -1 ], kTransitionDissolve); else if (_invokingResource != nullptr) @@ -326,11 +322,9 @@ void MystScriptParser::o_changeCardSwitch4(uint16 op, uint16 var, const Argument warning("Missing invokingResource in altDest call"); } -void MystScriptParser::o_changeCardSwitchLtR(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_changeCardSwitchLtR(uint16 var, const ArgumentsArray &args) { uint16 value = getVar(var); - debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value); - if (value) _vm->changeToCard(args[value -1 ], kTransitionLeftToRight); else if (_invokingResource != nullptr) @@ -339,11 +333,9 @@ void MystScriptParser::o_changeCardSwitchLtR(uint16 op, uint16 var, const Argume warning("Missing invokingResource in altDest call"); } -void MystScriptParser::o_changeCardSwitchRtL(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_changeCardSwitchRtL(uint16 var, const ArgumentsArray &args) { uint16 value = getVar(var); - debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value); - if (value) _vm->changeToCard(args[value -1 ], kTransitionRightToLeft); else if (_invokingResource != nullptr) @@ -352,7 +344,7 @@ void MystScriptParser::o_changeCardSwitchRtL(uint16 op, uint16 var, const Argume warning("Missing invokingResource in altDest call"); } -void MystScriptParser::o_takePage(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_takePage(uint16 var, const ArgumentsArray &args) { // In most game releases, the first opcode argument is the new mouse cursor. // However, in the original v1.0 English release this opcode takes no argument. uint16 cursorId; // = args[0]; @@ -375,8 +367,6 @@ void MystScriptParser::o_takePage(uint16 op, uint16 var, const ArgumentsArray &a uint16 oldPage = _globals.heldPage; - debugC(kDebugScript, "Opcode %d: takePage Var %d CursorId %d", op, var, cursorId); - // Take / drop page toggleVar(var); @@ -394,61 +384,48 @@ void MystScriptParser::o_takePage(uint16 op, uint16 var, const ArgumentsArray &a } } -void MystScriptParser::o_redrawCard(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Redraw card", op); - +void MystScriptParser::o_redrawCard(uint16 var, const ArgumentsArray &args) { _vm->drawCardBackground(); _vm->drawResourceImages(); _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); } -void MystScriptParser::o_goToDest(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); - +void MystScriptParser::o_goToDest(uint16 var, const ArgumentsArray &args) { if (_invokingResource != nullptr) _vm->changeToCard(_invokingResource->getDest(), kTransitionCopy); else - warning("Opcode %d: Missing invokingResource", op); + warning("Opcode o_goToDest: Missing invokingResource"); } -void MystScriptParser::o_goToDestForward(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); - +void MystScriptParser::o_goToDestForward(uint16 var, const ArgumentsArray &args) { if (_invokingResource != nullptr) _vm->changeToCard(_invokingResource->getDest(), kTransitionDissolve); else - warning("Opcode %d: Missing invokingResource", op); + warning("Opcode o_goToDestForward: Missing invokingResource"); } -void MystScriptParser::o_goToDestLeft(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); - +void MystScriptParser::o_goToDestRight(uint16 var, const ArgumentsArray &args) { if (_invokingResource != nullptr) _vm->changeToCard(_invokingResource->getDest(), kTransitionPartToRight); else - warning("Opcode %d: Missing invokingResource", op); + warning("Opcode o_goToDestRight: Missing invokingResource"); } -void MystScriptParser::o_goToDestRight(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); - +void MystScriptParser::o_goToDestLeft(uint16 var, const ArgumentsArray &args) { if (_invokingResource != nullptr) _vm->changeToCard(_invokingResource->getDest(), kTransitionPartToLeft); else - warning("Opcode %d: Missing invokingResource", op); + warning("Opcode o_goToDestLeft: Missing invokingResource"); } -void MystScriptParser::o_goToDestUp(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); - +void MystScriptParser::o_goToDestUp(uint16 var, const ArgumentsArray &args) { if (_invokingResource != nullptr) _vm->changeToCard(_invokingResource->getDest(), kTransitionTopToBottom); else - warning("Opcode %d: Missing invokingResource", op); + warning("Opcode o_goToDestUp: Missing invokingResource"); } -void MystScriptParser::o_triggerMovie(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Trigger Type 6 Resource Movie..", op); +void MystScriptParser::o_triggerMovie(uint16 var, const ArgumentsArray &args) { // The original has code to pause the background music before playing the movie, // if the movie has a sound track, as well as code to resume it afterwards. But since // the movie has not yet been loaded at this point, it is impossible to know @@ -458,46 +435,31 @@ void MystScriptParser::o_triggerMovie(uint16 op, uint16 var, const ArgumentsArra if (args.size() == 1) direction = args[0]; - debugC(kDebugScript, "\tDirection: %d", direction); - // Trigger resource 6 movie overriding play direction MystAreaVideo *resource = getInvokingResource<MystAreaVideo>(); resource->setDirection(direction); resource->playMovie(); } -void MystScriptParser::o_toggleVarNoRedraw(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: toggleVarNoRedraw", op); - +void MystScriptParser::o_toggleVarNoRedraw(uint16 var, const ArgumentsArray &args) { toggleVar(var); } -void MystScriptParser::o_drawAreaState(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: drawAreaState, state: %d", op, args[0]); - debugC(kDebugScript, "\tVar: %d", var); - +void MystScriptParser::o_drawAreaState(uint16 var, const ArgumentsArray &args) { MystAreaImageSwitch *parent = static_cast<MystAreaImageSwitch *>(getInvokingResource<MystArea>()->_parent); parent->drawConditionalDataToScreen(args[0]); } -void MystScriptParser::o_redrawAreaForVar(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: redraw area", op); - debugC(kDebugScript, "\tvar: %d", var); - +void MystScriptParser::o_redrawAreaForVar(uint16 var, const ArgumentsArray &args) { _vm->redrawArea(var); } -void MystScriptParser::o_changeCardDirectional(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_changeCardDirectional(uint16 var, const ArgumentsArray &args) { // Used by Channelwood Card 3262 (In Elevator) - debugC(kDebugScript, "Opcode %d: Change Card with optional directional update", op); - uint16 cardId = args[0]; uint16 directionalUpdateDataSize = args[1]; - debugC(kDebugScript, "\tcardId: %d", cardId); - debugC(kDebugScript, "\tdirectonal update data size: %d", directionalUpdateDataSize); - _vm->changeToCard(cardId, kNoTransition); animatedUpdate(ArgumentsArray(args.begin() + 2, directionalUpdateDataSize), 0); @@ -507,24 +469,16 @@ void MystScriptParser::o_changeCardDirectional(uint16 op, uint16 var, const Argu // but with the current cardId stored. // Opcode 18 then "pops" this stored CardId and returns to that card. -void MystScriptParser::o_changeCardPush(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Jump to Card Id, Storing Current Card Id", op); - +void MystScriptParser::o_changeCardPush(uint16 var, const ArgumentsArray &args) { _savedCardId = _vm->getCurCard(); uint16 cardId = args[0]; TransitionType transition = static_cast<TransitionType>(args[1]); - debugC(kDebugScript, "\tCurrent CardId: %d", _savedCardId); - debugC(kDebugScript, "\tJump to CardId: %d", cardId); - _vm->changeToCard(cardId, transition); } -void MystScriptParser::o_changeCardPop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Return To Stored Card Id", op); - debugC(kDebugScript, "\tCardId: %d", _savedCardId); - +void MystScriptParser::o_changeCardPop(uint16 var, const ArgumentsArray &args) { if (_savedCardId == 0) { warning("No pushed card to go back to"); return; @@ -535,14 +489,10 @@ void MystScriptParser::o_changeCardPop(uint16 op, uint16 var, const ArgumentsArr _vm->changeToCard(_savedCardId, transition); } -void MystScriptParser::o_enableAreas(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Enable Hotspots", op); - +void MystScriptParser::o_enableAreas(uint16 var, const ArgumentsArray &args) { uint16 count = args[0]; for (uint16 i = 0; i < count; i++) { - debugC(kDebugScript, "Enable hotspot index %d", args[i + 1]); - MystArea *resource = nullptr; if (args[i + 1] == 0xFFFF) resource = _invokingResource; @@ -556,14 +506,10 @@ void MystScriptParser::o_enableAreas(uint16 op, uint16 var, const ArgumentsArray } } -void MystScriptParser::o_disableAreas(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Disable Hotspots", op); - +void MystScriptParser::o_disableAreas(uint16 var, const ArgumentsArray &args) { uint16 count = args[0]; for (uint16 i = 0; i < count; i++) { - debugC(kDebugScript, "Disable hotspot index %d", args[i + 1]); - MystArea *resource = nullptr; if (args[i + 1] == 0xFFFF) resource = _invokingResource; @@ -577,20 +523,14 @@ void MystScriptParser::o_disableAreas(uint16 op, uint16 var, const ArgumentsArra } } -void MystScriptParser::o_directionalUpdate(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Transition / Directional update", op); - +void MystScriptParser::o_directionalUpdate(uint16 var, const ArgumentsArray &args) { animatedUpdate(args, 0); } -void MystScriptParser::o_toggleAreasActivation(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Toggle areas activation", op); - +void MystScriptParser::o_toggleAreasActivation(uint16 var, const ArgumentsArray &args) { uint16 count = args[0]; for (uint16 i = 0; i < count; i++) { - debugC(kDebugScript, "Enable/Disable hotspot index %d", args[i + 1]); - MystArea *resource = nullptr; if (args[i + 1] == 0xFFFF) resource = _invokingResource; @@ -604,33 +544,24 @@ void MystScriptParser::o_toggleAreasActivation(uint16 op, uint16 var, const Argu } } -void MystScriptParser::o_playSound(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_playSound(uint16 var, const ArgumentsArray &args) { uint16 soundId = args[0]; - debugC(kDebugScript, "Opcode %d: playSound", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - _vm->_sound->playEffect(soundId); } -void MystScriptParser::o_stopSoundBackground(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: stopSoundBackground", op); +void MystScriptParser::o_stopSoundBackground(uint16 var, const ArgumentsArray &args) { _vm->_sound->stopBackground(); } -void MystScriptParser::o_playSoundBlocking(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_playSoundBlocking(uint16 var, const ArgumentsArray &args) { uint16 soundId = args[0]; - debugC(kDebugScript, "Opcode %d: playSoundBlocking", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - _vm->_sound->stopEffect(); _vm->playSoundBlocking(soundId); } -void MystScriptParser::o_copyBackBufferToScreen(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Copy back buffer to screen", op); - +void MystScriptParser::o_copyBackBufferToScreen(uint16 var, const ArgumentsArray &args) { Common::Rect rect; if (args[0] == 0xFFFF) { // Used in Stoneship Card 2111 (Compass Rose) @@ -648,7 +579,7 @@ void MystScriptParser::o_copyBackBufferToScreen(uint16 op, uint16 var, const Arg _vm->_gfx->copyBackBufferToScreen(rect); } -void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_copyImageToBackBuffer(uint16 var, const ArgumentsArray &args) { uint16 imageId = args[0]; // WORKAROUND wrong image id in mechanical staircase @@ -668,8 +599,6 @@ void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, const Argu dstRect.right = dstRect.left + srcRect.width(); dstRect.bottom = dstRect.top + srcRect.height(); - debugC(kDebugScript, "Opcode %d: Copy image to back buffer", op); - debugC(kDebugScript, "\timageId: %d", imageId); debugC(kDebugScript, "\tsrcRect.left: %d", srcRect.left); debugC(kDebugScript, "\tsrcRect.top: %d", srcRect.top); debugC(kDebugScript, "\tsrcRect.right: %d", srcRect.right); @@ -682,11 +611,9 @@ void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, const Argu _vm->_gfx->copyImageSectionToBackBuffer(imageId, srcRect, dstRect); } -void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_changeBackgroundSound(uint16 var, const ArgumentsArray &args) { // Used on Stoneship Card 2080 // Used on Channelwood Card 3225 with argc = 8 i.e. Conditional Sound List - debugC(kDebugScript, "Opcode %d: Process Sound Block", op); - Common::MemoryWriteStreamDynamic writeStream = Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES); for (uint i = 0; i < args.size(); i++) { writeStream.writeUint16LE(args[i]); @@ -698,27 +625,21 @@ void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, const Argu _vm->applySoundBlock(soundBlock); } -void MystScriptParser::o_soundPlaySwitch(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Switch Choice of Play Sound", op); - +void MystScriptParser::o_soundPlaySwitch(uint16 var, const ArgumentsArray &args) { uint16 value = getVar(var); if (value < args.size()) { uint16 soundId = args[value]; - debugC(kDebugScript, "\tvar: %d", var); - debugC(kDebugScript, "\tsoundId: %d", soundId); - if (soundId) _vm->_sound->playEffect(soundId); } } -void MystScriptParser::o_soundResumeBackground(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: soundResumeBackground", op); +void MystScriptParser::o_soundResumeBackground(uint16 var, const ArgumentsArray &args) { _vm->_sound->resumeBackground(); } -void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_copyImageToScreen(uint16 var, const ArgumentsArray &args) { uint16 imageId = args[0]; Common::Rect srcRect = Common::Rect(args[1], args[2], args[3], args[4]); @@ -734,8 +655,6 @@ void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, const Argument dstRect.right = dstRect.left + srcRect.width(); dstRect.bottom = dstRect.top + srcRect.height(); - debugC(kDebugScript, "Opcode %d: Copy image to screen", op); - debugC(kDebugScript, "\timageId: %d", imageId); debugC(kDebugScript, "\tsrcRect.left: %d", srcRect.left); debugC(kDebugScript, "\tsrcRect.top: %d", srcRect.top); debugC(kDebugScript, "\tsrcRect.right: %d", srcRect.right); @@ -748,73 +667,51 @@ void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, const Argument _vm->_gfx->copyImageSectionToScreen(imageId, srcRect, dstRect); } -void MystScriptParser::o_changeCard(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Change Card", op); - +void MystScriptParser::o_changeCard(uint16 var, const ArgumentsArray &args) { uint16 cardId = args[0]; TransitionType transition = static_cast<TransitionType>(args[1]); - debugC(kDebugScript, "\tTarget Card: %d", cardId); - _vm->changeToCard(cardId, transition); } -void MystScriptParser::o_drawImageChangeCard(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Draw Full Screen Image, Delay then Change Card", op); - +void MystScriptParser::o_drawImageChangeCard(uint16 var, const ArgumentsArray &args) { uint16 imageId = args[0]; uint16 cardId = args[1]; TransitionType transition = static_cast<TransitionType>(args[2]); - debugC(kDebugScript, "\timageId: %d", imageId); - debugC(kDebugScript, "\tcardId: %d", cardId); - _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); _vm->wait(200); _vm->changeToCard(cardId, transition); } -void MystScriptParser::o_changeMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Change main cursor", op); - +void MystScriptParser::o_changeMainCursor(uint16 var, const ArgumentsArray &args) { uint16 cursorId = args[0]; - debugC(kDebugScript, "Cursor: %d", cursorId); - _vm->setMainCursor(cursorId); _vm->_cursor->setCursor(cursorId); } -void MystScriptParser::o_hideCursor(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Hide Cursor", op); +void MystScriptParser::o_hideCursor(uint16 var, const ArgumentsArray &args) { _vm->_cursor->hideCursor(); } -void MystScriptParser::o_showCursor(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Show Cursor", op); +void MystScriptParser::o_showCursor(uint16 var, const ArgumentsArray &args) { _vm->_cursor->showCursor(); } -void MystScriptParser::o_delay(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_delay(uint16 var, const ArgumentsArray &args) { // Used on Mechanical Card 6327 (Elevator) - debugC(kDebugScript, "Opcode %d: Delay", op); - uint16 time = args[0]; - debugC(kDebugScript, "\tTime: %d", time); - _vm->wait(time); } -void MystScriptParser::o_changeStack(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: changeStack", op); - +void MystScriptParser::o_changeStack(uint16 var, const ArgumentsArray &args) { uint16 targetStack = args[0]; uint16 soundIdLinkSrc = args[1]; uint16 soundIdLinkDst = args[2]; - debugC(kDebugScript, "\tTarget Stack: %d", targetStack); debugC(kDebugScript, "\tSource Stack Link Sound: %d", soundIdLinkSrc); debugC(kDebugScript, "\tDestination Stack Link Sound: %d", soundIdLinkDst); @@ -831,9 +728,7 @@ void MystScriptParser::o_changeStack(uint16 op, uint16 var, const ArgumentsArray } } -void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Play Sound, Change Card and Directional Update Screen Region", op); - +void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 var, const ArgumentsArray &args) { uint16 cardId = args[0]; uint16 soundId = args[1]; uint16 delayBetweenSteps = args[2]; @@ -852,9 +747,7 @@ void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, c animatedUpdate(ArgumentsArray(args.begin() + 4, dataSize), delayBetweenSteps); } -void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Play Sound and Directional Update Screen Region", op); - +void MystScriptParser::o_directionalUpdatePlaySound(uint16 var, const ArgumentsArray &args) { uint16 soundId = args[0]; uint16 delayBetweenSteps = args[1]; uint16 dataSize = args[2]; @@ -869,29 +762,23 @@ void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, const animatedUpdate(ArgumentsArray(args.begin() + 3, dataSize), delayBetweenSteps); } -void MystScriptParser::o_saveMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Save main cursor", op); - +void MystScriptParser::o_saveMainCursor(uint16 var, const ArgumentsArray &args) { _savedCursorId = _vm->getMainCursor(); } -void MystScriptParser::o_restoreMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Restore main cursor", op); - +void MystScriptParser::o_restoreMainCursor(uint16 var, const ArgumentsArray &args) { _vm->setMainCursor(_savedCursorId); } -void MystScriptParser::o_soundWaitStop(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_soundWaitStop(uint16 var, const ArgumentsArray &args) { // Used on Selenitic Card 1191 (Maze Runner) // Used on Mechanical Card 6267 (Code Lock) // Used when Button is pushed... - debugC(kDebugScript, "Opcode %d: Wait for foreground sound to finish", op); - while (_vm->_sound->isEffectPlaying()) _vm->doFrame(); } -void MystScriptParser::o_quit(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_quit(uint16 var, const ArgumentsArray &args) { _vm->quitGame(); } @@ -902,7 +789,7 @@ void MystScriptParser::showMap() { } } -void MystScriptParser::o_exitMap(uint16 op, uint16 var, const ArgumentsArray &args) { +void MystScriptParser::o_exitMap(uint16 var, const ArgumentsArray &args) { _vm->changeToCard(_savedMapCardId, kTransitionCopy); } diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h index 4ae9fb5f14..ec22fecdac 100644 --- a/engines/mohawk/myst_scripts.h +++ b/engines/mohawk/myst_scripts.h @@ -33,7 +33,7 @@ namespace Mohawk { typedef Common::Array<uint16> ArgumentsArray; -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class MohawkEngine_Myst; class MystArea; @@ -88,8 +88,6 @@ public: void animatedUpdate(const ArgumentsArray &args, uint16 delay); - DECLARE_OPCODE(unknown); - // Common opcodes DECLARE_OPCODE(o_toggleVar); DECLARE_OPCODE(o_setVar); @@ -100,8 +98,8 @@ public: DECLARE_OPCODE(o_redrawCard); DECLARE_OPCODE(o_goToDest); DECLARE_OPCODE(o_goToDestForward); - DECLARE_OPCODE(o_goToDestLeft); DECLARE_OPCODE(o_goToDestRight); + DECLARE_OPCODE(o_goToDestLeft); DECLARE_OPCODE(o_goToDestUp); DECLARE_OPCODE(o_triggerMovie); DECLARE_OPCODE(o_toggleVarNoRedraw); @@ -146,7 +144,7 @@ protected: MohawkEngine_Myst *_vm; MystGameState::Globals &_globals; - typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 op, uint16 var, const ArgumentsArray &args); + typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 var, const ArgumentsArray &args); struct MystOpcode { MystOpcode(uint16 o, OpcodeProcMyst p, const char *d) : op(o), proc(p), desc(d) {} @@ -175,6 +173,8 @@ protected: private: MystArea *_invokingResource; int32 _scriptNestingLevel; + + Common::String describeCommand(const MystOpcode &command, uint16 var, const ArgumentsArray &args); }; template<class T> diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp index 6c56ad5afd..208275d851 100644 --- a/engines/mohawk/myst_stacks/channelwood.cpp +++ b/engines/mohawk/myst_stacks/channelwood.cpp @@ -299,9 +299,7 @@ bool Channelwood::pipeChangeValve(bool open, uint16 mask) { return false; } -void Channelwood::o_bridgeToggle(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Bridge rise / skink video", op); - +void Channelwood::o_bridgeToggle(uint16 var, const ArgumentsArray &args) { VideoEntryPtr bridge = _vm->_video->playMovie(_vm->wrapMovieFilename("bridge", kChannelwoodStack)); if (!bridge) error("Failed to open 'bridge' movie"); @@ -317,9 +315,7 @@ void Channelwood::o_bridgeToggle(uint16 op, uint16 var, const ArgumentsArray &ar _vm->waitUntilMovieEnds(bridge); } -void Channelwood::o_pipeExtend(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Play Pipe Movie and Sound", op); - +void Channelwood::o_pipeExtend(uint16 var, const ArgumentsArray &args) { uint16 soundId = args[0]; debugC(kDebugScript, "\tsoundId: %d", soundId); @@ -340,9 +336,7 @@ void Channelwood::o_pipeExtend(uint16 op, uint16 var, const ArgumentsArray &args _vm->_sound->resumeBackground(); } -void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Draw Full Screen Image, Change Card, and change volume", op); - +void Channelwood::o_drawImageChangeCardAndVolume(uint16 var, const ArgumentsArray &args) { uint16 imageId = args[0]; uint16 cardId = args[1]; @@ -361,8 +355,7 @@ void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, const Ar } -void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Open Animation", op); +void Channelwood::o_waterTankValveOpen(uint16 var, const ArgumentsArray &args) { Common::Rect rect = getInvokingResource<MystArea>()->getRect(); for (uint i = 0; i < 2; i++) @@ -374,18 +367,14 @@ void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, const ArgumentsArr pipeChangeValve(true, 0x80); } -void Channelwood::o_leverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generic lever start move", op); - +void Channelwood::o_leverStartMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(0); _vm->_cursor->setCursor(700); _leverPulled = false; } -void Channelwood::o_leverMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generic lever move", op); - +void Channelwood::o_leverMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); if (lever->pullLeverV()) { @@ -398,9 +387,7 @@ void Channelwood::o_leverMove(uint16 op, uint16 var, const ArgumentsArray &args) } } -void Channelwood::o_leverMoveFail(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generic lever move", op); - +void Channelwood::o_leverMoveFail(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); if (lever->pullLeverV()) { @@ -415,9 +402,7 @@ void Channelwood::o_leverMoveFail(uint16 op, uint16 var, const ArgumentsArray &a } } -void Channelwood::o_leverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generic lever end move", op); - +void Channelwood::o_leverEndMove(uint16 var, const ArgumentsArray &args) { // Get current lever frame MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -431,13 +416,13 @@ void Channelwood::o_leverEndMove(uint16 op, uint16 var, const ArgumentsArray &ar _vm->checkCursorHints(); } -void Channelwood::o_leverEndMoveResumeBackground(uint16 op, uint16 var, const ArgumentsArray &args) { +void Channelwood::o_leverEndMoveResumeBackground(uint16 var, const ArgumentsArray &args) { _vm->_sound->resumeBackground(); - o_leverEndMove(op, var, args); + o_leverEndMove(var, args); } -void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, const ArgumentsArray &args) { - o_leverEndMove(op, var, args); +void Channelwood::o_leverEndMoveWithSound(uint16 var, const ArgumentsArray &args) { + o_leverEndMove(var, args); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); uint16 soundId = lever->getList3(0); @@ -445,22 +430,20 @@ void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, const Arguments _vm->_sound->playEffect(soundId); } -void Channelwood::o_leverElev3StartMove(uint16 op, uint16 var, const ArgumentsArray &args) { +void Channelwood::o_leverElev3StartMove(uint16 var, const ArgumentsArray &args) { _vm->_gfx->copyImageToScreen(3970, Common::Rect(544, 333)); _vm->doFrame(); - o_leverStartMove(op, var, args); + o_leverStartMove(var, args); } -void Channelwood::o_leverElev3EndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - o_leverEndMove(op, var, args); +void Channelwood::o_leverElev3EndMove(uint16 var, const ArgumentsArray &args) { + o_leverEndMove(var, args); _vm->_gfx->copyImageToScreen(3265, Common::Rect(544, 333)); _vm->doFrame(); _vm->_sound->playEffect(5265); } -void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Pump lever move", op); - +void Channelwood::o_pumpLeverMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); if (lever->pullLeverV()) { @@ -472,8 +455,8 @@ void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, const ArgumentsArray &a } } -void Channelwood::o_pumpLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - o_leverEndMove(op, var, args); +void Channelwood::o_pumpLeverEndMove(uint16 var, const ArgumentsArray &args) { + o_leverEndMove(var, args); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); uint16 soundId = lever->getList3(0); @@ -481,9 +464,7 @@ void Channelwood::o_pumpLeverEndMove(uint16 op, uint16 var, const ArgumentsArray _vm->_sound->playBackground(soundId, 36864); } -void Channelwood::o_stairsDoorToggle(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Play stairs door video", op); - +void Channelwood::o_stairsDoorToggle(uint16 var, const ArgumentsArray &args) { MystAreaVideo *movie = getInvokingResource<MystAreaVideo>(); if (_state.stairsUpperDoorState) { @@ -497,9 +478,7 @@ void Channelwood::o_stairsDoorToggle(uint16 op, uint16 var, const ArgumentsArray } } -void Channelwood::o_valveHandleMove1(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Valve handle move", op); - +void Channelwood::o_valveHandleMove1(uint16 var, const ArgumentsArray &args) { MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -513,21 +492,17 @@ void Channelwood::o_valveHandleMove1(uint16 op, uint16 var, const ArgumentsArray } } -void Channelwood::o_valveHandleMoveStart1(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Valve handle move start", op); - +void Channelwood::o_valveHandleMoveStart1(uint16 var, const ArgumentsArray &args) { MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); uint16 soundId = handle->getList1(0); if (soundId) _vm->_sound->playEffect(soundId); _vm->_cursor->setCursor(700); - o_valveHandleMove1(op, var, args); + o_valveHandleMove1(var, args); } -void Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Valve handle move stop", op); - +void Channelwood::o_valveHandleMoveStop(uint16 var, const ArgumentsArray &args) { MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); // Update state with valve position @@ -548,9 +523,7 @@ void Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, const ArgumentsAr _vm->checkCursorHints(); } -void Channelwood::o_valveHandleMove2(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Valve handle move", op); - +void Channelwood::o_valveHandleMove2(uint16 var, const ArgumentsArray &args) { MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -564,21 +537,17 @@ void Channelwood::o_valveHandleMove2(uint16 op, uint16 var, const ArgumentsArray } } -void Channelwood::o_valveHandleMoveStart2(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Valve handle move start", op); - +void Channelwood::o_valveHandleMoveStart2(uint16 var, const ArgumentsArray &args) { MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); uint16 soundId = handle->getList1(0); if (soundId) _vm->_sound->playEffect(soundId); _vm->_cursor->setCursor(700); - o_valveHandleMove2(op, var, args); + o_valveHandleMove2(var, args); } -void Channelwood::o_valveHandleMove3(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Valve handle move", op); - +void Channelwood::o_valveHandleMove3(uint16 var, const ArgumentsArray &args) { MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -592,21 +561,17 @@ void Channelwood::o_valveHandleMove3(uint16 op, uint16 var, const ArgumentsArray } } -void Channelwood::o_valveHandleMoveStart3(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Valve handle move start", op); - +void Channelwood::o_valveHandleMoveStart3(uint16 var, const ArgumentsArray &args) { MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); uint16 soundId = handle->getList1(0); if (soundId) _vm->_sound->playEffect(soundId); _vm->_cursor->setCursor(700); - o_valveHandleMove3(op, var, args); + o_valveHandleMove3(var, args); } -void Channelwood::o_hologramMonitor(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Hologram monitor", op); - +void Channelwood::o_hologramMonitor(uint16 var, const ArgumentsArray &args) { // Used on Card 3012 (Temple Hologram Monitor) uint16 button = args[0]; // 0 to 3 @@ -644,23 +609,19 @@ void Channelwood::o_hologramMonitor(uint16 op, uint16 var, const ArgumentsArray video->moveTo(226, 68); break; default: - warning("Opcode %d Control Variable Out of Range", op); + warning("Opcode o_hologramMonitor Control Variable Out of Range"); break; } } } -void Channelwood::o_drawerOpen(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Open Sirius drawer", op); - +void Channelwood::o_drawerOpen(uint16 var, const ArgumentsArray &args) { _siriusDrawerState = 1; _vm->redrawArea(18, false); _vm->redrawArea(102, false); } -void Channelwood::o_hologramTemple(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Temple hologram", op); - +void Channelwood::o_hologramTemple(uint16 var, const ArgumentsArray &args) { _vm->_sound->pauseBackground(); // Used on Card 3333 (Temple Hologram) @@ -678,22 +639,19 @@ void Channelwood::o_hologramTemple(uint16 op, uint16 var, const ArgumentsArray & _vm->playMovieBlocking(_vm->wrapMovieFilename("holosmsg", kChannelwoodStack), 127, 45); break; default: - warning("Opcode %d Control Variable Out of Range", op); + warning("Opcode o_hologramTemple Control Variable Out of Range"); break; } _vm->_sound->resumeBackground(); } -void Channelwood::o_executeMouseUp(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Execute mouse up", op); - +void Channelwood::o_executeMouseUp(uint16 var, const ArgumentsArray &args) { MystArea *resource = _vm->getViewResource<MystArea>(args[0]); resource->handleMouseUp(); } -void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Close Animation", op); +void Channelwood::o_waterTankValveClose(uint16 var, const ArgumentsArray &args) { Common::Rect rect = getInvokingResource<MystArea>()->getRect(); for (uint i = 0; i < 2; i++) @@ -705,10 +663,8 @@ void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, const ArgumentsAr pipeChangeValve(false, 0x80); } -void Channelwood::o_elevatorMovies(uint16 op, uint16 var, const ArgumentsArray &args) { +void Channelwood::o_elevatorMovies(uint16 var, const ArgumentsArray &args) { // Used by Card 3262 (Elevator) - debugC(kDebugScript, "Opcode %d: Elevator movie", op); - uint16 elevator = args[0]; uint16 direction = args[1]; @@ -750,9 +706,7 @@ void Channelwood::o_elevatorMovies(uint16 op, uint16 var, const ArgumentsArray & _vm->_sound->resumeBackground(); } -void Channelwood::o_soundReplace(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Play sound if not already playing", op); - +void Channelwood::o_soundReplace(uint16 var, const ArgumentsArray &args) { uint16 soundId = args[0]; if (!_vm->_sound->isEffectPlaying()) { @@ -760,18 +714,15 @@ void Channelwood::o_soundReplace(uint16 op, uint16 var, const ArgumentsArray &ar } } -void Channelwood::o_lever_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generic lever init", op); +void Channelwood::o_lever_init(uint16 var, const ArgumentsArray &args) { _leverAction = getInvokingResource<MystArea>(); } -void Channelwood::o_pipeValve_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Water valve init", op); +void Channelwood::o_pipeValve_init(uint16 var, const ArgumentsArray &args) { _valveVar = var; } -void Channelwood::o_drawer_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sirius's drawer init", op); +void Channelwood::o_drawer_init(uint16 var, const ArgumentsArray &args) { _siriusDrawerState = 0; } diff --git a/engines/mohawk/myst_stacks/channelwood.h b/engines/mohawk/myst_stacks/channelwood.h index c6c9be7376..6b8ba9dff7 100644 --- a/engines/mohawk/myst_stacks/channelwood.h +++ b/engines/mohawk/myst_stacks/channelwood.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Channelwood : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/credits.cpp b/engines/mohawk/myst_stacks/credits.cpp index e8c5387528..752e624c68 100644 --- a/engines/mohawk/myst_stacks/credits.cpp +++ b/engines/mohawk/myst_stacks/credits.cpp @@ -90,7 +90,7 @@ uint16 Credits::getVar(uint16 var) { } } -void Credits::o_runCredits(uint16 op, uint16 var, const ArgumentsArray &args) { +void Credits::o_runCredits(uint16 var, const ArgumentsArray &args) { // Activate the credits _creditsRunning = true; _curImage = 0; diff --git a/engines/mohawk/myst_stacks/credits.h b/engines/mohawk/myst_stacks/credits.h index 923f98ba83..bea5381534 100644 --- a/engines/mohawk/myst_stacks/credits.h +++ b/engines/mohawk/myst_stacks/credits.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Credits : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/demo.cpp b/engines/mohawk/myst_stacks/demo.cpp index 84261a8bd5..92c1dc7631 100644 --- a/engines/mohawk/myst_stacks/demo.cpp +++ b/engines/mohawk/myst_stacks/demo.cpp @@ -76,22 +76,18 @@ void Demo::runPersistentScripts() { } } -void Demo::o_stopIntro(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Unk", op); +void Demo::o_stopIntro(uint16 var, const ArgumentsArray &args) { // The original also seems to stop the movies. Not needed with this engine. _vm->_gfx->fadeToBlack(); } -void Demo::o_fadeFromBlack(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Fade from black", op); - +void Demo::o_fadeFromBlack(uint16 var, const ArgumentsArray &args) { // FIXME: This glitches when enabled. The backbuffer is drawn to screen, // and then the fading occurs, causing the background to appear for one frame. // _vm->_gfx->fadeFromBlack(); } -void Demo::o_fadeToBlack(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Fade to black", op); +void Demo::o_fadeToBlack(uint16 var, const ArgumentsArray &args) { _vm->_gfx->fadeToBlack(); } @@ -122,9 +118,7 @@ void Demo::returnToMenu_run() { } } -void Demo::o_returnToMenu_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Return to menu init", op); - +void Demo::o_returnToMenu_init(uint16 var, const ArgumentsArray &args) { // Used on Card 2001, 2002 and 2003 _returnToMenuNextTime = _vm->_system->getMillis() + 5000; _returnToMenuRunning = true; diff --git a/engines/mohawk/myst_stacks/demo.h b/engines/mohawk/myst_stacks/demo.h index c2a8fce10c..337ddaae98 100644 --- a/engines/mohawk/myst_stacks/demo.h +++ b/engines/mohawk/myst_stacks/demo.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Demo : public Intro { public: diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp index bffb61eb79..b0b485b3cc 100644 --- a/engines/mohawk/myst_stacks/dni.cpp +++ b/engines/mohawk/myst_stacks/dni.cpp @@ -95,8 +95,7 @@ uint16 Dni::getVar(uint16 var) { } } -void Dni::o_handPage(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Hand page to Atrus", op); +void Dni::o_handPage(uint16 var, const ArgumentsArray &args) { // Used in Card 5014 (Atrus) // Find Atrus movie @@ -214,9 +213,7 @@ void Dni::atrus_run() { } } -void Dni::o_atrus_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Atrus init", op); - +void Dni::o_atrus_init(uint16 var, const ArgumentsArray &args) { _atrusRunning = true; } diff --git a/engines/mohawk/myst_stacks/dni.h b/engines/mohawk/myst_stacks/dni.h index 75a35ec2e8..9a8b937216 100644 --- a/engines/mohawk/myst_stacks/dni.h +++ b/engines/mohawk/myst_stacks/dni.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Dni : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp index d462a985e9..c4cd2096c4 100644 --- a/engines/mohawk/myst_stacks/intro.cpp +++ b/engines/mohawk/myst_stacks/intro.cpp @@ -79,15 +79,12 @@ uint16 Intro::getVar(uint16 var) { } } -void Intro::o_useLinkBook(uint16 op, uint16 var, const ArgumentsArray &args) { +void Intro::o_useLinkBook(uint16 var, const ArgumentsArray &args) { // Hard coded SoundId valid only for Intro Stack. // Other stacks use Opcode 40, which takes SoundId values as arguments. const uint16 soundIdLinkSrc = 5; const uint16 soundIdLinkDst[] = { 2282, 3029, 6396, 7122, 3137, 0, 9038, 5134, 0, 4739, 4741 }; - debugC(kDebugScript, "Opcode %d: o_useLinkBook", op); - debugC(kDebugScript, "\tvar: %d", var); - // Change to dest stack _vm->changeToStack(_stackMap[_globals.currentAge], _startCard[_globals.currentAge], soundIdLinkSrc, soundIdLinkDst[_globals.currentAge]); } @@ -146,7 +143,7 @@ void Intro::introMovies_run() { } } -void Intro::o_playIntroMovies(uint16 op, uint16 var, const ArgumentsArray &args) { +void Intro::o_playIntroMovies(uint16 var, const ArgumentsArray &args) { _introMoviesRunning = true; _introStep = 0; } @@ -165,9 +162,7 @@ void Intro::mystLinkBook_run() { } } -void Intro::o_mystLinkBook_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Myst link book init", op); - +void Intro::o_mystLinkBook_init(uint16 var, const ArgumentsArray &args) { _linkBookMovie = getInvokingResource<MystAreaVideo>(); _startTime = 1; _linkBookRunning = true; diff --git a/engines/mohawk/myst_stacks/intro.h b/engines/mohawk/myst_stacks/intro.h index 266189b7a5..938a30e691 100644 --- a/engines/mohawk/myst_stacks/intro.h +++ b/engines/mohawk/myst_stacks/intro.h @@ -34,7 +34,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Intro : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/makingof.h b/engines/mohawk/myst_stacks/makingof.h index ab4788b076..cdc64d2991 100644 --- a/engines/mohawk/myst_stacks/makingof.h +++ b/engines/mohawk/myst_stacks/makingof.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class MakingOf : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp index 81fbf7821d..fb109acc17 100644 --- a/engines/mohawk/myst_stacks/mechanical.cpp +++ b/engines/mohawk/myst_stacks/mechanical.cpp @@ -271,15 +271,11 @@ bool Mechanical::setVarValue(uint16 var, uint16 value) { return refresh; } -void Mechanical::o_throneEnablePassage(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Enable throne passage", op); - +void Mechanical::o_throneEnablePassage(uint16 var, const ArgumentsArray &args) { _vm->_resources[args[0]]->setEnabled(getVar(var)); } -void Mechanical::o_birdCrankStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Mechanical bird crank start", op); - +void Mechanical::o_birdCrankStart(uint16 var, const ArgumentsArray &args) { MystAreaDrag *crank = getInvokingResource<MystAreaDrag>(); uint16 crankSoundId = crank->getList2(0); @@ -292,9 +288,7 @@ void Mechanical::o_birdCrankStart(uint16 op, uint16 var, const ArgumentsArray &a crankMovie->playMovie(); } -void Mechanical::o_birdCrankStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Mechanical bird crank stop", op); - +void Mechanical::o_birdCrankStop(uint16 var, const ArgumentsArray &args) { MystAreaDrag *crank = getInvokingResource<MystAreaDrag>(); MystAreaVideo *crankMovie = static_cast<MystAreaVideo *>(crank->getSubResource(0)); @@ -309,16 +303,12 @@ void Mechanical::o_birdCrankStop(uint16 op, uint16 var, const ArgumentsArray &ar _bird->playMovie(); } -void Mechanical::o_snakeBoxTrigger(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Trigger Playing Of Snake Movie", op); - +void Mechanical::o_snakeBoxTrigger(uint16 var, const ArgumentsArray &args) { // Used on Mechanical Card 6043 (Weapons Rack with Snake Box) _snakeBox->playMovie(); } -void Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Play Stairs Movement Movie", op); - +void Mechanical::o_fortressStaircaseMovie(uint16 var, const ArgumentsArray &args) { VideoEntryPtr staircase = _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack)); if (!staircase) error("Failed to open hhstairs movie"); @@ -334,9 +324,7 @@ void Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, const Arguments _vm->waitUntilMovieEnds(staircase); } -void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Elevator rotation lever start", op); - +void Mechanical::o_elevatorRotationStart(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(0); @@ -348,9 +336,7 @@ void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, const ArgumentsA _vm->_cursor->setCursor(700); } -void Mechanical::o_elevatorRotationMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Elevator rotation lever move", op); - +void Mechanical::o_elevatorRotationMove(uint16 var, const ArgumentsArray &args) { const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -366,9 +352,7 @@ void Mechanical::o_elevatorRotationMove(uint16 op, uint16 var, const ArgumentsAr lever->drawFrame(step); } -void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Elevator rotation lever stop", op); - +void Mechanical::o_elevatorRotationStop(uint16 var, const ArgumentsArray &args) { const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -414,18 +398,14 @@ void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, const ArgumentsAr _vm->checkCursorHints(); } -void Mechanical::o_fortressRotationSpeedStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation speed lever start", op); - +void Mechanical::o_fortressRotationSpeedStart(uint16 var, const ArgumentsArray &args) { _vm->_cursor->setCursor(700); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(0); } -void Mechanical::o_fortressRotationSpeedMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation speed lever move", op); - +void Mechanical::o_fortressRotationSpeedMove(uint16 var, const ArgumentsArray &args) { const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -441,9 +421,7 @@ void Mechanical::o_fortressRotationSpeedMove(uint16 op, uint16 var, const Argume lever->drawFrame(step); } -void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation speed lever stop", op); - +void Mechanical::o_fortressRotationSpeedStop(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); // Release lever @@ -457,18 +435,14 @@ void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, const Argume _vm->checkCursorHints(); } -void Mechanical::o_fortressRotationBrakeStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation brake lever start", op); - +void Mechanical::o_fortressRotationBrakeStart(uint16 var, const ArgumentsArray &args) { _vm->_cursor->setCursor(700); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(_fortressRotationBrake); } -void Mechanical::o_fortressRotationBrakeMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation brake lever move", op); - +void Mechanical::o_fortressRotationBrakeMove(uint16 var, const ArgumentsArray &args) { const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -484,27 +458,21 @@ void Mechanical::o_fortressRotationBrakeMove(uint16 op, uint16 var, const Argume lever->drawFrame(step); } -void Mechanical::o_fortressRotationBrakeStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation brake lever stop", op); - +void Mechanical::o_fortressRotationBrakeStop(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(_fortressRotationBrake); _vm->checkCursorHints(); } -void Mechanical::o_fortressSimulationSpeedStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever start", op); - +void Mechanical::o_fortressSimulationSpeedStart(uint16 var, const ArgumentsArray &args) { _vm->_cursor->setCursor(700); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(0); } -void Mechanical::o_fortressSimulationSpeedMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever move", op); - +void Mechanical::o_fortressSimulationSpeedMove(uint16 var, const ArgumentsArray &args) { const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -520,9 +488,7 @@ void Mechanical::o_fortressSimulationSpeedMove(uint16 op, uint16 var, const Argu lever->drawFrame(step); } -void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever stop", op); - +void Mechanical::o_fortressSimulationSpeedStop(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); // Release lever @@ -536,18 +502,14 @@ void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, const Argu _vm->checkCursorHints(); } -void Mechanical::o_fortressSimulationBrakeStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever start", op); - +void Mechanical::o_fortressSimulationBrakeStart(uint16 var, const ArgumentsArray &args) { _vm->_cursor->setCursor(700); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(_fortressSimulationBrake); } -void Mechanical::o_fortressSimulationBrakeMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever move", op); - +void Mechanical::o_fortressSimulationBrakeMove(uint16 var, const ArgumentsArray &args) { const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -563,21 +525,17 @@ void Mechanical::o_fortressSimulationBrakeMove(uint16 op, uint16 var, const Argu lever->drawFrame(step); } -void Mechanical::o_fortressSimulationBrakeStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever stop", op); - +void Mechanical::o_fortressSimulationBrakeStop(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(_fortressSimulationBrake); _vm->checkCursorHints(); } -void Mechanical::o_elevatorWindowMovie(uint16 op, uint16 var, const ArgumentsArray &args) { +void Mechanical::o_elevatorWindowMovie(uint16 var, const ArgumentsArray &args) { uint16 startTime = args[0]; uint16 endTime = args[1]; - debugC(kDebugScript, "Opcode %d Movie Time Index %d to %d", op, startTime, endTime); - VideoEntryPtr window = _vm->_video->playMovie(_vm->wrapMovieFilename("ewindow", kMechanicalStack)); if (!window) error("Failed to open ewindow movie"); @@ -587,9 +545,7 @@ void Mechanical::o_elevatorWindowMovie(uint16 op, uint16 var, const ArgumentsArr _vm->waitUntilMovieEnds(window); } -void Mechanical::o_elevatorGoMiddle(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Elevator go middle from top", op); - +void Mechanical::o_elevatorGoMiddle(uint16 var, const ArgumentsArray &args) { _elevatorTooLate = false; _elevatorTopCounter = 5; _elevatorGoingMiddle = true; @@ -634,7 +590,7 @@ void Mechanical::elevatorGoMiddle_run() { _vm->wait(500); _vm->_sound->playEffect(9120); static uint16 moviePos[2] = { 3540, 5380 }; - o_elevatorWindowMovie(121, 0, ArgumentsArray(moviePos, ARRAYSIZE(moviePos))); + o_elevatorWindowMovie(0, ArgumentsArray(moviePos, ARRAYSIZE(moviePos))); _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); _vm->_sound->playEffect(10120); _vm->_cursor->showCursor(); @@ -647,12 +603,10 @@ void Mechanical::elevatorGoMiddle_run() { } } -void Mechanical::o_elevatorTopMovie(uint16 op, uint16 var, const ArgumentsArray &args) { +void Mechanical::o_elevatorTopMovie(uint16 var, const ArgumentsArray &args) { uint16 startTime = args[0]; uint16 endTime = args[1]; - debugC(kDebugScript, "Opcode %d Movie Time Index %d to %d", op, startTime, endTime); - VideoEntryPtr window = _vm->_video->playMovie(_vm->wrapMovieFilename("hcelev", kMechanicalStack)); if (!window) error("Failed to open hcelev movie"); @@ -662,9 +616,7 @@ void Mechanical::o_elevatorTopMovie(uint16 op, uint16 var, const ArgumentsArray _vm->waitUntilMovieEnds(window); } -void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Set fortress position", op); - +void Mechanical::o_fortressRotationSetPosition(uint16 var, const ArgumentsArray &args) { VideoEntryPtr gears = _fortressRotationGears->getVideo(); uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames(); @@ -676,15 +628,11 @@ void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, const Argu _fortressPosition = (moviePosition + 900) / 1800 % 4; } -void Mechanical::o_mystStaircaseMovie(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Myst book staircase video", op); - +void Mechanical::o_mystStaircaseMovie(uint16 var, const ArgumentsArray &args) { _vm->playMovieBlocking(_vm->wrapMovieFilename("sstairs", kMechanicalStack), 199, 108); } -void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Wait for the elevator to go middle", op); - +void Mechanical::o_elevatorWaitTimeout(uint16 var, const ArgumentsArray &args) { // Wait while the elevator times out while (_elevatorGoingMiddle) { runPersistentScripts(); @@ -692,58 +640,42 @@ void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, const ArgumentsArr } } -void Mechanical::o_crystalEnterYellow(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Crystal enter", op); - +void Mechanical::o_crystalEnterYellow(uint16 var, const ArgumentsArray &args) { _crystalLit = 3; _vm->redrawArea(20); } -void Mechanical::o_crystalEnterGreen(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Crystal enter", op); - +void Mechanical::o_crystalEnterGreen(uint16 var, const ArgumentsArray &args) { _crystalLit = 1; _vm->redrawArea(21); } -void Mechanical::o_crystalEnterRed(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Crystal enter", op); - +void Mechanical::o_crystalEnterRed(uint16 var, const ArgumentsArray &args) { _crystalLit = 2; _vm->redrawArea(22); } -void Mechanical::o_crystalLeaveYellow(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Crystal leave", op); - +void Mechanical::o_crystalLeaveYellow(uint16 var, const ArgumentsArray &args) { _crystalLit = 0; _vm->redrawArea(20); } -void Mechanical::o_crystalLeaveGreen(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Crystal leave", op); - +void Mechanical::o_crystalLeaveGreen(uint16 var, const ArgumentsArray &args) { _crystalLit = 0; _vm->redrawArea(21); } -void Mechanical::o_crystalLeaveRed(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Crystal leave", op); - +void Mechanical::o_crystalLeaveRed(uint16 var, const ArgumentsArray &args) { _crystalLit = 0; _vm->redrawArea(22); } -void Mechanical::o_throne_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Mechanical::o_throne_init(uint16 var, const ArgumentsArray &args) { // Used on Card 6238 (Sirrus' Throne) and Card 6027 (Achenar's Throne) - debugC(kDebugScript, "Opcode %d: Brother throne init", op); - getInvokingResource<MystArea>()->setEnabled(getVar(var)); } -void Mechanical::o_fortressStaircase_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Staircase init", op); - +void Mechanical::o_fortressStaircase_init(uint16 var, const ArgumentsArray &args) { _vm->_resources[args[0]]->setEnabled(!_state.staircaseState); _vm->_resources[args[1]]->setEnabled(!_state.staircaseState); _vm->_resources[args[2]]->setEnabled(_state.staircaseState); @@ -759,17 +691,13 @@ void Mechanical::birdSing_run() { } } -void Mechanical::o_bird_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Mechanical bird init", op); - +void Mechanical::o_bird_init(uint16 var, const ArgumentsArray &args) { _birdSinging = false; _birdSingEndTime = 0; _bird = getInvokingResource<MystAreaVideo>(); } -void Mechanical::o_snakeBox_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Snake box init", op); - +void Mechanical::o_snakeBox_init(uint16 var, const ArgumentsArray &args) { _snakeBox = getInvokingResource<MystAreaVideo>(); } @@ -790,9 +718,7 @@ void Mechanical::elevatorRotation_run() { } } -void Mechanical::o_elevatorRotation_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Elevator rotation init", op); - +void Mechanical::o_elevatorRotation_init(uint16 var, const ArgumentsArray &args) { _elevatorRotationSoundId = args[0]; _elevatorRotationGearPosition = 0; _elevatorRotationLeverMoving = false; @@ -870,9 +796,7 @@ void Mechanical::fortressRotation_run() { } } -void Mechanical::o_fortressRotation_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Fortress rotation init", op); - +void Mechanical::o_fortressRotation_init(uint16 var, const ArgumentsArray &args) { _fortressRotationGears = getInvokingResource<MystAreaVideo>(); VideoEntryPtr gears = _fortressRotationGears->playMovie(); @@ -1020,9 +944,7 @@ void Mechanical::fortressSimulation_run() { } } -void Mechanical::o_fortressSimulation_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Fortress rotation simulator init", op); - +void Mechanical::o_fortressSimulation_init(uint16 var, const ArgumentsArray &args) { _fortressSimulationHolo = getInvokingResource<MystAreaVideo>(); _fortressSimulationStartSound1 = args[0]; @@ -1042,9 +964,7 @@ void Mechanical::o_fortressSimulation_init(uint16 op, uint16 var, const Argument _vm->_cursor->hideCursor(); } -void Mechanical::o_fortressSimulationStartup_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Fortress rotation simulator startup init", op); - +void Mechanical::o_fortressSimulationStartup_init(uint16 var, const ArgumentsArray &args) { _fortressSimulationStartup = getInvokingResource<MystAreaVideo>(); } diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h index 585164fe1b..46cfe687a0 100644 --- a/engines/mohawk/myst_stacks/mechanical.h +++ b/engines/mohawk/myst_stacks/mechanical.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Mechanical : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp index e9449b7c30..1a6fc3e8bf 100644 --- a/engines/mohawk/myst_stacks/myst.cpp +++ b/engines/mohawk/myst_stacks/myst.cpp @@ -96,15 +96,15 @@ void Myst::setupOpcodes() { OPCODE(127, o_clockLeverEndMove); OPCODE(128, o_treePressureReleaseStart); if (!observatoryIsDDMMYYYY2400()) { - OPCODE(129, o_observatoryMonthChangeStart); - OPCODE(130, o_observatoryMonthChangeStart); - OPCODE(131, o_observatoryDayChangeStart); - OPCODE(132, o_observatoryDayChangeStart); + OPCODE(129, o_observatoryMonthChangeStartIncrease); + OPCODE(130, o_observatoryMonthChangeStartDecrease); + OPCODE(131, o_observatoryDayChangeStartIncrease); + OPCODE(132, o_observatoryDayChangeStartDecrease); } else { - OPCODE(129, o_observatoryDayChangeStart); - OPCODE(130, o_observatoryDayChangeStart); - OPCODE(131, o_observatoryMonthChangeStart); - OPCODE(132, o_observatoryMonthChangeStart); + OPCODE(129, o_observatoryDayChangeStartIncrease); + OPCODE(130, o_observatoryDayChangeStartDecrease); + OPCODE(131, o_observatoryMonthChangeStartIncrease); + OPCODE(132, o_observatoryMonthChangeStartDecrease); } OPCODE(133, o_observatoryGoButton); OPCODE(134, o_observatoryMonthSliderMove); @@ -117,8 +117,8 @@ void Myst::setupOpcodes() { OPCODE(141, o_circuitBreakerStartMove); OPCODE(142, o_circuitBreakerMove); OPCODE(143, o_circuitBreakerEndMove); - OPCODE(144, o_clockLeverMove); - OPCODE(145, o_clockLeverMove); + OPCODE(144, o_clockLeverMoveLeft); + OPCODE(145, o_clockLeverMoveRight); OPCODE(146, o_boilerIncreasePressureStart); OPCODE(147, o_boilerLightPilot); OPCODE(148, NOP); @@ -163,12 +163,12 @@ void Myst::setupOpcodes() { OPCODE(189, o_clockHourWheelStartTurn); OPCODE(190, o_libraryCombinationBookStartRight); OPCODE(191, o_libraryCombinationBookStartLeft); - OPCODE(192, o_observatoryTimeChangeStart); + OPCODE(192, o_observatoryTimeChangeStartIncrease); OPCODE(193, NOP); OPCODE(194, o_observatoryChangeSettingStop); - OPCODE(195, o_observatoryTimeChangeStart); - OPCODE(196, o_observatoryYearChangeStart); - OPCODE(197, o_observatoryYearChangeStart); + OPCODE(195, o_observatoryTimeChangeStartDecrease); + OPCODE(196, o_observatoryYearChangeStartIncrease); + OPCODE(197, o_observatoryYearChangeStartDecrease); OPCODE(198, o_dockVaultForceClose); OPCODE(199, o_imagerEraseStop); @@ -815,9 +815,7 @@ uint16 Myst::bookCountPages(uint16 var) { return cnt; } -void Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Turn book page left", op); - +void Myst::o_libraryBookPageTurnLeft(uint16 var, const ArgumentsArray &args) { if (_libraryBookPage - 1 >= 0) { _libraryBookPage--; @@ -831,9 +829,7 @@ void Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, const ArgumentsArray } } -void Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Turn book page right", op); - +void Myst::o_libraryBookPageTurnRight(uint16 var, const ArgumentsArray &args) { if (_libraryBookPage + 1 < _libraryBookNumPages) { _libraryBookPage++; @@ -847,16 +843,11 @@ void Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, const ArgumentsArra } } -void Myst::o_fireplaceToggleButton(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_fireplaceToggleButton(uint16 var, const ArgumentsArray &args) { // Used on Myst Card 4162 (Fireplace Grid) - debugC(kDebugScript, "Opcode %d: Fireplace grid toggle button", op); - uint16 bitmask = args[0]; uint16 line = _fireplaceLines[var - 17]; - debugC(kDebugScript, "\tvar: %d", var); - debugC(kDebugScript, "\tbitmask: 0x%02X", bitmask); - if (line & bitmask) { // Unset button for (uint i = 4795; i >= 4779; i--) { @@ -874,11 +865,9 @@ void Myst::o_fireplaceToggleButton(uint16 op, uint16 var, const ArgumentsArray & } } -void Myst::o_fireplaceRotation(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_fireplaceRotation(uint16 var, const ArgumentsArray &args) { // Used on Myst Card 4162 and 4166 (Fireplace Puzzle Rotation Movies) uint16 movieNum = args[0]; - debugC(kDebugScript, "Opcode %d: Play Fireplace Puzzle Rotation Movies", op); - debugC(kDebugScript, "\tmovieNum: %d", movieNum); if (movieNum) _vm->playMovieBlocking(_vm->wrapMovieFilename("fpout", kMystStack), 167, 4); @@ -886,12 +875,9 @@ void Myst::o_fireplaceRotation(uint16 op, uint16 var, const ArgumentsArray &args _vm->playMovieBlocking(_vm->wrapMovieFilename("fpin", kMystStack), 167, 4); } -void Myst::o_courtyardBoxesCheckSolution(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_courtyardBoxesCheckSolution(uint16 var, const ArgumentsArray &args) { uint16 soundId = args[0]; - debugC(kDebugScript, "Opcode %d: Ship Puzzle Logic", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - // Change ship state if the boxes are correctly enabled if (_state.courtyardImageBoxes == 50 && !_state.shipFloating) { _vm->_cursor->hideCursor(); @@ -906,7 +892,7 @@ void Myst::o_courtyardBoxesCheckSolution(uint16 op, uint16 var, const ArgumentsA } } -void Myst::o_towerRotationStart(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_towerRotationStart(uint16 var, const ArgumentsArray &args) { _towerRotationBlinkLabel = false; _towerRotationMapClicked = true; _towerRotationSpeed = 0; @@ -921,7 +907,7 @@ void Myst::o_towerRotationStart(uint16 op, uint16 var, const ArgumentsArray &arg _vm->_sound->playEffect(5378, true); } -void Myst::o_towerRotationEnd(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_towerRotationEnd(uint16 var, const ArgumentsArray &args) { _towerRotationMapClicked = false; // Set angle value to expected value @@ -949,9 +935,7 @@ void Myst::o_towerRotationEnd(uint16 op, uint16 var, const ArgumentsArray &args) _towerRotationBlinkLabelCount = 0; } -void Myst::o_imagerChangeSelection(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Dock imager change selection", op); - +void Myst::o_imagerChangeSelection(uint16 var, const ArgumentsArray &args) { if (_imagerValidationStep != 10) { _imagerValidationStep = 0; @@ -975,16 +959,12 @@ void Myst::o_imagerChangeSelection(uint16 op, uint16 var, const ArgumentsArray & } } -void Myst::o_dockVaultOpen(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_dockVaultOpen(uint16 var, const ArgumentsArray &args) { // Used on Myst 4143 (Dock near Marker Switch) uint16 soundId = args[0]; uint16 delay = args[1]; uint16 directionalUpdateDataSize = args[2]; - debugC(kDebugScript, "Opcode %d: Vault Open Logic", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - debugC(kDebugScript, "\tdirectionalUpdateDataSize: %d", directionalUpdateDataSize); - if ((_state.cabinMarkerSwitch == 1) && (_state.clockTowerMarkerSwitch == 1) && (_state.dockMarkerSwitch == 0) && @@ -1004,16 +984,12 @@ void Myst::o_dockVaultOpen(uint16 op, uint16 var, const ArgumentsArray &args) { } } -void Myst::o_dockVaultClose(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_dockVaultClose(uint16 var, const ArgumentsArray &args) { // Used on Myst 4143 (Dock near Marker Switch) uint16 soundId = args[0]; uint16 delay = args[1]; uint16 directionalUpdateDataSize = args[2]; - debugC(kDebugScript, "Opcode %d: Vault Close Logic", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - debugC(kDebugScript, "\tdirectionalUpdateDataSize: %d", directionalUpdateDataSize); - if ((_state.cabinMarkerSwitch == 1) && (_state.clockTowerMarkerSwitch == 1) && (_state.dockMarkerSwitch == 1) && @@ -1031,13 +1007,11 @@ void Myst::o_dockVaultClose(uint16 op, uint16 var, const ArgumentsArray &args) { } } -void Myst::o_bookGivePage(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_bookGivePage(uint16 var, const ArgumentsArray &args) { uint16 cardIdLose = args[0]; uint16 cardIdBookCover = args[1]; uint16 soundIdAddPage = args[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); @@ -1054,31 +1028,37 @@ void Myst::o_bookGivePage(uint16 op, uint16 var, const ArgumentsArray &args) { switch (_globals.heldPage) { case 7: bookVar = 100; + // fallthrough case 1: mask = 1; break; case 8: bookVar = 100; + // fallthrough case 2: mask = 2; break; case 9: bookVar = 100; + // fallthrough case 3: mask = 4; break; case 10: bookVar = 100; + // fallthrough case 4: mask = 8; break; case 11: bookVar = 100; + // fallthrough case 5: mask = 16; break; case 12: bookVar = 100; + // fallthrough case 6: mask = 32; break; @@ -1118,12 +1098,10 @@ void Myst::o_bookGivePage(uint16 op, uint16 var, const ArgumentsArray &args) { } } -void Myst::o_clockWheelsExecute(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_clockWheelsExecute(uint16 var, const ArgumentsArray &args) { // Used on Card 4006 (Clock Tower Time Controls) uint16 soundId = args[0]; - debugC(kDebugScript, "Opcode %d: Clock Tower Bridge Puzzle Execute Button", op); - // Correct time is 2:40 bool correctTime = _state.clockTowerHourPosition == 2 && _state.clockTowerMinutePosition == 40; @@ -1161,9 +1139,7 @@ void Myst::o_clockWheelsExecute(uint16 op, uint16 var, const ArgumentsArray &arg } } -void Myst::o_imagerPlayButton(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Imager play button", op); - +void Myst::o_imagerPlayButton(uint16 var, const ArgumentsArray &args) { uint16 video = getVar(51); // Press button @@ -1247,9 +1223,7 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, const ArgumentsArray &args) _vm->_cursor->showCursor(); } -void Myst::o_imagerEraseButton(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Imager erase button", op); - +void Myst::o_imagerEraseButton(uint16 var, const ArgumentsArray &args) { _imagerRedButton = static_cast<MystAreaImageSwitch *>(getInvokingResource<MystArea>()->_parent); for (uint i = 0; i < 4; i++) _imagerSound[i] = args[i]; @@ -1322,9 +1296,7 @@ void Myst::imagerValidation_run() { } } -void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Tower elevator animation", op); - +void Myst::o_towerElevatorAnimation(uint16 var, const ArgumentsArray &args) { _treeStopped = true; _vm->_cursor->hideCursor(); @@ -1347,9 +1319,7 @@ void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, const ArgumentsArray _treeStopped = false; } -void Myst::o_generatorButtonPressed(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generator button pressed", op); - +void Myst::o_generatorButtonPressed(uint16 var, const ArgumentsArray &args) { MystArea *button = getInvokingResource<MystArea>()->_parent; generatorRedrawRocket(); @@ -1442,9 +1412,7 @@ void Myst::generatorButtonValue(MystArea *button, uint16 &mask, uint16 &value) { } } -void Myst::o_cabinSafeChangeDigit(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Cabin safe change digit", op); - +void Myst::o_cabinSafeChangeDigit(uint16 var, const ArgumentsArray &args) { uint16 d1 = _state.cabinSafeCombination / 100; uint16 d2 = (_state.cabinSafeCombination / 10) % 10; uint16 d3 = _state.cabinSafeCombination % 10; @@ -1461,9 +1429,7 @@ void Myst::o_cabinSafeChangeDigit(uint16 op, uint16 var, const ArgumentsArray &a _vm->redrawArea(var); } -void Myst::o_cabinSafeHandleStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Cabin safe handle start move", op); - +void Myst::o_cabinSafeHandleStartMove(uint16 var, const ArgumentsArray &args) { // Used on Card 4100 MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); handle->drawFrame(0); @@ -1471,9 +1437,7 @@ void Myst::o_cabinSafeHandleStartMove(uint16 op, uint16 var, const ArgumentsArra _tempVar = 0; } -void Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Cabin safe handle move", op); - +void Myst::o_cabinSafeHandleMove(uint16 var, const ArgumentsArray &args) { // Used on Card 4100 MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); @@ -1501,21 +1465,25 @@ void Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, const ArgumentsArray &ar } } -void Myst::o_cabinSafeHandleEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Cabin safe handle end move", op); - +void Myst::o_cabinSafeHandleEndMove(uint16 var, const ArgumentsArray &args) { // Used on Card 4100 MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); handle->drawFrame(0); _vm->checkCursorHints(); } -void Myst::o_observatoryMonthChangeStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Observatory month change start", op); +void Myst::o_observatoryMonthChangeStartIncrease(uint16 var, const ArgumentsArray &args) { + observatoryMonthChangeStart(true); +} + +void Myst::o_observatoryMonthChangeStartDecrease(uint16 var, const ArgumentsArray &args) { + observatoryMonthChangeStart(false); +} +void Myst::observatoryMonthChangeStart(bool increase) { _vm->_sound->pauseBackground(); - if (op == 129 || op == 131) { + if (increase) { // Increase if (observatoryIsDDMMYYYY2400()) _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(36, 0, 48, 9), Common::Rect(351, 70, 363, 79)); @@ -1569,12 +1537,18 @@ void Myst::observatoryMonthChange_run() { observatoryIncrementMonth(_observatoryIncrement); } -void Myst::o_observatoryDayChangeStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Observatory day change start", op); +void Myst::o_observatoryDayChangeStartIncrease(uint16 var, const ArgumentsArray &args) { + observatoryDayChangeStart(true); +} + +void Myst::o_observatoryDayChangeStartDecrease(uint16 var, const ArgumentsArray &args) { + observatoryDayChangeStart(false); +} +void Myst::observatoryDayChangeStart(bool increase) { _vm->_sound->pauseBackground(); - if (op == 129 || op == 131) { + if (increase) { // Increase if (observatoryIsDDMMYYYY2400()) _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(0, 0, 12, 9), Common::Rect(315, 70, 327, 79)); @@ -1629,12 +1603,18 @@ void Myst::observatoryDayChange_run() { observatoryIncrementDay(_observatoryIncrement); } -void Myst::o_observatoryYearChangeStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Observatory year change start", op); +void Myst::o_observatoryYearChangeStartIncrease(uint16 var, const ArgumentsArray &args) { + observatoryYearChangeStart(true); +} + +void Myst::o_observatoryYearChangeStartDecrease(uint16 var, const ArgumentsArray &args) { + observatoryYearChangeStart(false); +} +void Myst::observatoryYearChangeStart(bool increase) { _vm->_sound->pauseBackground(); - if (op == 196) { + if (increase) { // Increase _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(72, 0, 84, 9), Common::Rect(387, 70, 399, 79)); _observatoryIncrement = -1; @@ -1683,12 +1663,18 @@ void Myst::observatoryYearChange_run() { observatoryIncrementYear(_observatoryIncrement); } -void Myst::o_observatoryTimeChangeStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Observatory time change start", op); +void Myst::o_observatoryTimeChangeStartIncrease(uint16 var, const ArgumentsArray &args) { + observatoryTimeChangeStart(true); +} + +void Myst::o_observatoryTimeChangeStartDecrease(uint16 var, const ArgumentsArray &args) { + observatoryTimeChangeStart(false); +} +void Myst::observatoryTimeChangeStart(bool increase) { _vm->_sound->pauseBackground(); - if (op == 192) { + if (increase) { // Increase _vm->_gfx->copyImageSectionToScreen(11098, Common::Rect(109, 0, 121, 9), Common::Rect(424, 70, 436, 79)); _observatoryIncrement = -1; @@ -1742,9 +1728,7 @@ void Myst::observatoryTimeChange_run() { observatoryIncrementTime(_observatoryIncrement); } -void Myst::o_observatoryGoButton(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Observatory go button", op); - +void Myst::o_observatoryGoButton(uint16 var, const ArgumentsArray &args) { // Setting not at target if (_state.observatoryDayTarget != _state.observatoryDaySetting || _state.observatoryMonthTarget != _state.observatoryMonthSetting @@ -1776,42 +1760,30 @@ void Myst::o_observatoryGoButton(uint16 op, uint16 var, const ArgumentsArray &ar } } -void Myst::o_observatoryMonthSliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Month slider move", op); - +void Myst::o_observatoryMonthSliderMove(uint16 var, const ArgumentsArray &args) { observatoryUpdateMonth(); } -void Myst::o_observatoryDaySliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Day slider move", op); - +void Myst::o_observatoryDaySliderMove(uint16 var, const ArgumentsArray &args) { observatoryUpdateDay(); } -void Myst::o_observatoryYearSliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Year slider move", op); - +void Myst::o_observatoryYearSliderMove(uint16 var, const ArgumentsArray &args) { observatoryUpdateYear(); } -void Myst::o_observatoryTimeSliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Time slider move", op); - +void Myst::o_observatoryTimeSliderMove(uint16 var, const ArgumentsArray &args) { observatoryUpdateTime(); } -void Myst::o_circuitBreakerStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Circuit breaker start move", op); - +void Myst::o_circuitBreakerStartMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *breaker = getInvokingResource<MystVideoInfo>(); breaker->drawFrame(0); _vm->_cursor->setCursor(700); _tempVar = 0; } -void Myst::o_circuitBreakerMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Circuit breaker move", op); - +void Myst::o_circuitBreakerMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *breaker = getInvokingResource<MystVideoInfo>(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -1860,17 +1832,13 @@ void Myst::o_circuitBreakerMove(uint16 op, uint16 var, const ArgumentsArray &arg } } -void Myst::o_circuitBreakerEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Circuit breaker end move", op); - +void Myst::o_circuitBreakerEndMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *breaker = getInvokingResource<MystVideoInfo>(); _vm->redrawArea(breaker->getImageSwitchVar()); _vm->checkCursorHints(); } -void Myst::o_boilerIncreasePressureStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Boiler increase pressure start", op); - +void Myst::o_boilerIncreasePressureStart(uint16 var, const ArgumentsArray &args) { _treeStopped = true; if (_state.cabinValvePosition < 25) _vm->_sound->stopBackground(); @@ -1878,9 +1846,7 @@ void Myst::o_boilerIncreasePressureStart(uint16 op, uint16 var, const ArgumentsA _boilerPressureIncreasing = true; } -void Myst::o_boilerLightPilot(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Boiler light pilot", op); - +void Myst::o_boilerLightPilot(uint16 var, const ArgumentsArray &args) { // Match is lit if (_cabinMatchState == 1) { _state.cabinPilotLightLit = 1; @@ -1940,9 +1906,7 @@ void Myst::boilerResetGauge(const Common::Rational &rate) { _cabinGaugeMovie->setRate(rate); } -void Myst::o_boilerIncreasePressureStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Boiler increase pressure stop", op); - +void Myst::o_boilerIncreasePressureStop(uint16 var, const ArgumentsArray &args) { _treeStopped = false; _boilerPressureIncreasing = false; _state.treeLastMoveTime = _vm->_system->getMillis(); @@ -2006,18 +1970,14 @@ void Myst::boilerPressureDecrease_run() { } } -void Myst::o_boilerDecreasePressureStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Boiler decrease pressure start", op); - +void Myst::o_boilerDecreasePressureStart(uint16 var, const ArgumentsArray &args) { _treeStopped = true; _vm->_sound->stopBackground(); _boilerPressureDecreasing = true; } -void Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Boiler decrease pressure stop", op); - +void Myst::o_boilerDecreasePressureStop(uint16 var, const ArgumentsArray &args) { _treeStopped = false; _boilerPressureDecreasing = false; _state.treeLastMoveTime = _vm->_system->getMillis(); @@ -2038,16 +1998,12 @@ void Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, const ArgumentsAr } } -void Myst::o_basementIncreasePressureStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Basement increase pressure start", op); - +void Myst::o_basementIncreasePressureStart(uint16 var, const ArgumentsArray &args) { _treeStopped = true; _basementPressureIncreasing = true; } -void Myst::o_basementIncreasePressureStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Basement increase pressure stop", op); - +void Myst::o_basementIncreasePressureStop(uint16 var, const ArgumentsArray &args) { _treeStopped = false; _basementPressureIncreasing = false; _state.treeLastMoveTime = _vm->_system->getMillis(); @@ -2079,16 +2035,12 @@ void Myst::basementPressureDecrease_run() { } } -void Myst::o_basementDecreasePressureStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Basement decrease pressure start", op); - +void Myst::o_basementDecreasePressureStart(uint16 var, const ArgumentsArray &args) { _treeStopped = true; _basementPressureDecreasing = true; } -void Myst::o_basementDecreasePressureStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Basement decrease pressure stop", op); - +void Myst::o_basementDecreasePressureStop(uint16 var, const ArgumentsArray &args) { _treeStopped = false; _basementPressureDecreasing = false; _state.treeLastMoveTime = _vm->_system->getMillis(); @@ -2163,24 +2115,18 @@ uint32 Myst::treeNextMoveDelay(uint16 pressure) { return 25000 * pressure / 13 + 3000; } -void Myst::o_rocketSoundSliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket slider start move", op); - +void Myst::o_rocketSoundSliderStartMove(uint16 var, const ArgumentsArray &args) { _rocketSliderSound = 0; _vm->_cursor->setCursor(700); _vm->_sound->pauseBackground(); rocketSliderMove(); } -void Myst::o_rocketSoundSliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket slider move", op); - +void Myst::o_rocketSoundSliderMove(uint16 var, const ArgumentsArray &args) { rocketSliderMove(); } -void Myst::o_rocketSoundSliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket slider end move", op); - +void Myst::o_rocketSoundSliderEndMove(uint16 var, const ArgumentsArray &args) { _vm->checkCursorHints(); if (_state.generatorVoltage == 59 && !_state.generatorBreakers && _rocketSliderSound) @@ -2295,9 +2241,7 @@ void Myst::rocketCheckSolution() { _vm->_cursor->showCursor(); } -void Myst::o_rocketPianoStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket piano start move", op); - +void Myst::o_rocketPianoStart(uint16 var, const ArgumentsArray &args) { MystAreaDrag *key = getInvokingResource<MystAreaDrag>(); // What the hell?? @@ -2319,9 +2263,7 @@ void Myst::o_rocketPianoStart(uint16 op, uint16 var, const ArgumentsArray &args) } } -void Myst::o_rocketPianoMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket piano move", op); - +void Myst::o_rocketPianoMove(uint16 var, const ArgumentsArray &args) { const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); Common::Rect piano = Common::Rect(85, 123, 460, 270); @@ -2366,9 +2308,7 @@ void Myst::o_rocketPianoMove(uint16 op, uint16 var, const ArgumentsArray &args) } } -void Myst::o_rocketPianoStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket piano end move", op); - +void Myst::o_rocketPianoStop(uint16 var, const ArgumentsArray &args) { MystAreaImageSwitch *key = getInvokingResource<MystAreaImageSwitch>(); Common::Rect src = key->getSubImage(0).rect; @@ -2383,9 +2323,7 @@ void Myst::o_rocketPianoStop(uint16 op, uint16 var, const ArgumentsArray &args) _vm->_sound->resumeBackground(); } -void Myst::o_rocketLeverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket lever start move", op); - +void Myst::o_rocketLeverStartMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); _vm->_cursor->setCursor(700); @@ -2393,9 +2331,7 @@ void Myst::o_rocketLeverStartMove(uint16 op, uint16 var, const ArgumentsArray &a lever->drawFrame(0); } -void Myst::o_rocketOpenBook(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket open link book", op); - +void Myst::o_rocketOpenBook(uint16 var, const ArgumentsArray &args) { // Flyby movie _rocketLinkBook->setBounds(Audio::Timestamp(0, 3500, 600), Audio::Timestamp(0, 13100, 600)); @@ -2403,9 +2339,7 @@ void Myst::o_rocketOpenBook(uint16 op, uint16 var, const ArgumentsArray &args) { _tempVar = 2; } -void Myst::o_rocketLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket lever move", op); - +void Myst::o_rocketLeverMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -2432,9 +2366,7 @@ void Myst::o_rocketLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) _rocketLeverPosition = step; } -void Myst::o_rocketLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket lever end move", op); - +void Myst::o_rocketLeverEndMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); _vm->checkCursorHints(); @@ -2442,9 +2374,7 @@ void Myst::o_rocketLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &arg lever->drawFrame(0); } -void Myst::o_cabinLeave(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Leave cabin", op); - +void Myst::o_cabinLeave(uint16 var, const ArgumentsArray &args) { // If match is lit, put out if (_cabinMatchState == 1) { _matchGoOutTime = _vm->_system->getMillis(); @@ -2454,9 +2384,7 @@ void Myst::o_cabinLeave(uint16 op, uint16 var, const ArgumentsArray &args) { } } -void Myst::o_treePressureReleaseStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Tree pressure release start", op); - +void Myst::o_treePressureReleaseStart(uint16 var, const ArgumentsArray &args) { Common::Rect src = Common::Rect(0, 0, 49, 86); Common::Rect dest = Common::Rect(78, 46, 127, 132); _vm->_gfx->copyImageSectionToScreen(4631, src, dest); @@ -2470,9 +2398,7 @@ void Myst::o_treePressureReleaseStart(uint16 op, uint16 var, const ArgumentsArra } } -void Myst::o_treePressureReleaseStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Tree pressure release stop", op); - +void Myst::o_treePressureReleaseStop(uint16 var, const ArgumentsArray &args) { Common::Rect rect = Common::Rect(78, 46, 127, 132); _vm->_gfx->copyBackBufferToScreen(rect); @@ -2480,18 +2406,14 @@ void Myst::o_treePressureReleaseStop(uint16 op, uint16 var, const ArgumentsArray _treeMinPosition = 0; } -void Myst::o_observatoryMonthSliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Month slider start move", op); - +void Myst::o_observatoryMonthSliderStartMove(uint16 var, const ArgumentsArray &args) { _vm->_cursor->setCursor(700); _vm->_sound->pauseBackground(); observatoryUpdateMonth(); } -void Myst::o_observatoryMonthSliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Month slider end move", op); - +void Myst::o_observatoryMonthSliderEndMove(uint16 var, const ArgumentsArray &args) { _vm->checkCursorHints(); _vm->_sound->resumeBackground(); @@ -2511,18 +2433,14 @@ void Myst::observatoryUpdateMonth() { } } -void Myst::o_observatoryDaySliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Day slider start move", op); - +void Myst::o_observatoryDaySliderStartMove(uint16 var, const ArgumentsArray &args) { _vm->_cursor->setCursor(700); _vm->_sound->pauseBackground(); observatoryUpdateDay(); } -void Myst::o_observatoryDaySliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Day slider end move", op); - +void Myst::o_observatoryDaySliderEndMove(uint16 var, const ArgumentsArray &args) { _vm->checkCursorHints(); _vm->_sound->resumeBackground(); @@ -2543,18 +2461,14 @@ void Myst::observatoryUpdateDay() { } } -void Myst::o_observatoryYearSliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Year slider start move", op); - +void Myst::o_observatoryYearSliderStartMove(uint16 var, const ArgumentsArray &args) { _vm->_cursor->setCursor(700); _vm->_sound->pauseBackground(); observatoryUpdateYear(); } -void Myst::o_observatoryYearSliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Year slider end move", op); - +void Myst::o_observatoryYearSliderEndMove(uint16 var, const ArgumentsArray &args) { _vm->checkCursorHints(); _vm->_sound->resumeBackground(); @@ -2577,18 +2491,14 @@ void Myst::observatoryUpdateYear() { } } -void Myst::o_observatoryTimeSliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Time slider start move", op); - +void Myst::o_observatoryTimeSliderStartMove(uint16 var, const ArgumentsArray &args) { _vm->_cursor->setCursor(700); _vm->_sound->pauseBackground(); observatoryUpdateTime(); } -void Myst::o_observatoryTimeSliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Time slider end move", op); - +void Myst::o_observatoryTimeSliderEndMove(uint16 var, const ArgumentsArray &args) { _vm->checkCursorHints(); _vm->_sound->resumeBackground(); @@ -2615,12 +2525,11 @@ void Myst::observatoryUpdateTime() { } } -void Myst::o_libraryCombinationBookStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Combination book stop turning pages", op); +void Myst::o_libraryCombinationBookStop(uint16 var, const ArgumentsArray &args) { _libraryCombinationBookPagesTurning = false; } -void Myst::o_cabinMatchLight(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_cabinMatchLight(uint16 var, const ArgumentsArray &args) { if (!_cabinMatchState) { _vm->_sound->playEffect(4103); @@ -2659,37 +2568,29 @@ void Myst::matchBurn_run() { } } -void Myst::o_courtyardBoxEnter(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Mouse enters courtyard box", op); +void Myst::o_courtyardBoxEnter(uint16 var, const ArgumentsArray &args) { _tempVar = 1; _vm->_sound->playEffect(_courtyardBoxSound); _vm->redrawArea(var); } -void Myst::o_courtyardBoxLeave(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Mouse leaves courtyard box", op); +void Myst::o_courtyardBoxLeave(uint16 var, const ArgumentsArray &args) { _tempVar = 0; _vm->redrawArea(var); } -void Myst::o_clockMinuteWheelStartTurn(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_clockMinuteWheelStartTurn(uint16 var, const ArgumentsArray &args) { // Used on Card 4006 - debugC(kDebugScript, "Opcode %d: Minute wheel start turn", op); - clockWheelStartTurn(2); } -void Myst::o_clockWheelEndTurn(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_clockWheelEndTurn(uint16 var, const ArgumentsArray &args) { // Used on Card 4006 - debugC(kDebugScript, "Opcode %d: Wheel end turn", op); - _clockTurningWheel = 0; } -void Myst::o_clockHourWheelStartTurn(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_clockHourWheelStartTurn(uint16 var, const ArgumentsArray &args) { // Used on Card 4006 - debugC(kDebugScript, "Opcode %d: Hour wheel start turn", op); - clockWheelStartTurn(1); } @@ -2739,18 +2640,14 @@ void Myst::clockWheelTurn(uint16 var) { } } -void Myst::o_libraryCombinationBookStartRight(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Combination book start turning pages right", op); - +void Myst::o_libraryCombinationBookStartRight(uint16 var, const ArgumentsArray &args) { _tempVar = 0; libraryCombinationBookTurnRight(); _startTime = _vm->_system->getMillis(); _libraryCombinationBookPagesTurning = true; } -void Myst::o_libraryCombinationBookStartLeft(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Combination book start turning pages left", op); - +void Myst::o_libraryCombinationBookStartLeft(uint16 var, const ArgumentsArray &args) { _tempVar = 0; libraryCombinationBookTurnLeft(); _startTime = _vm->_system->getMillis(); @@ -2818,9 +2715,7 @@ void Myst::libraryCombinationBook_run() { } } -void Myst::o_observatoryChangeSettingStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Observatory change setting stop", op); - +void Myst::o_observatoryChangeSettingStop(uint16 var, const ArgumentsArray &args) { // Stop persistent scripts _observatoryMonthChanging = false; _observatoryDayChanging = false; @@ -2837,16 +2732,12 @@ void Myst::o_observatoryChangeSettingStop(uint16 op, uint16 var, const Arguments _vm->_sound->resumeBackground(); } -void Myst::o_dockVaultForceClose(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_dockVaultForceClose(uint16 var, const ArgumentsArray &args) { // Used on Myst 4143 (Dock near Marker Switch) uint16 soundId = args[0]; uint16 delay = args[1]; uint16 directionalUpdateDataSize = args[2]; - debugC(kDebugScript, "Opcode %d: Vault Force Close", op); - debugC(kDebugScript, "\tsoundId: %d", soundId); - debugC(kDebugScript, "\tdirectionalUpdateDataSize: %d", directionalUpdateDataSize); - if (_dockVaultState) { // Open switch _state.dockMarkerSwitch = 1; @@ -2861,13 +2752,11 @@ void Myst::o_dockVaultForceClose(uint16 op, uint16 var, const ArgumentsArray &ar } } -void Myst::o_imagerEraseStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Imager stop erase", op); +void Myst::o_imagerEraseStop(uint16 var, const ArgumentsArray &args) { _imagerValidationRunning = false; } -void Myst::o_clockLeverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Clock lever start move", op); +void Myst::o_clockLeverStartMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(0); _vm->_cursor->setCursor(700); @@ -2875,9 +2764,15 @@ void Myst::o_clockLeverStartMove(uint16 op, uint16 var, const ArgumentsArray &ar _clockLeverPulled = false; } -void Myst::o_clockLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Clock left lever move", op); +void Myst::o_clockLeverMoveLeft(uint16 var, const ArgumentsArray &args) { + clockLeverMove(true); +} + +void Myst::o_clockLeverMoveRight(uint16 var, const ArgumentsArray &args) { + clockLeverMove(false); +} +void Myst::clockLeverMove(bool leftLever) { if (!_clockLeverPulled) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -2889,7 +2784,7 @@ void Myst::o_clockLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { clockGearForwardOneStep(1); // Left lever - if (op == 144) + if (leftLever) clockGearForwardOneStep(2); else // Right lever clockGearForwardOneStep(0); @@ -2953,8 +2848,7 @@ void Myst::clockGears_run() { } } -void Myst::o_clockLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Clock lever end move", op); +void Myst::o_clockLeverEndMove(uint16 var, const ArgumentsArray &args) { static const char *videos[] = { "cl1wg1", "cl1wg2", "cl1wg3", "cl1wlfch" }; _vm->_cursor->hideCursor(); @@ -3012,17 +2906,13 @@ void Myst::clockGearsCheckSolution() { } } -void Myst::o_clockResetLeverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Clock reset lever start move", op); - +void Myst::o_clockResetLeverStartMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(0); _vm->_cursor->setCursor(700); } -void Myst::o_clockResetLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Clock reset lever move", op); - +void Myst::o_clockResetLeverMove(uint16 var, const ArgumentsArray &args) { MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); // If pulled @@ -3117,9 +3007,7 @@ void Myst::clockResetGear(uint16 gear) { _clockGearsPositions[gear] = 3; } -void Myst::o_clockResetLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Clock reset lever end move", op); - +void Myst::o_clockResetLeverEndMove(uint16 var, const ArgumentsArray &args) { // Get current lever frame MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -3128,7 +3016,7 @@ void Myst::o_clockResetLeverEndMove(uint16 op, uint16 var, const ArgumentsArray _vm->checkCursorHints(); } -void Myst::o_libraryBook_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_libraryBook_init(uint16 var, const ArgumentsArray &args) { _libraryBookPage = 0; _libraryBookNumPages = args[0]; _libraryBookBaseImage = args[1]; @@ -3136,9 +3024,7 @@ void Myst::o_libraryBook_init(uint16 op, uint16 var, const ArgumentsArray &args) _libraryBookSound2 = args[3]; } -void Myst::o_courtyardBox_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Courtyard box init", op); - +void Myst::o_courtyardBox_init(uint16 var, const ArgumentsArray &args) { _courtyardBoxSound = args[0]; } @@ -3182,7 +3068,7 @@ void Myst::towerRotationMap_run() { } } -void Myst::o_towerRotationMap_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_towerRotationMap_init(uint16 var, const ArgumentsArray &args) { _towerRotationMapRunning = true; _towerRotationMapTower = getInvokingResource<MystAreaImageSwitch>(); _towerRotationMapLabel = _vm->getViewResource<MystAreaImageSwitch>(args[0]); @@ -3298,22 +3184,20 @@ void Myst::towerRotationMapRotate() { towerRotationMapDrawLine(center, end); } -void Myst::o_forechamberDoor_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_forechamberDoor_init(uint16 var, const ArgumentsArray &args) { // Used for Card 4138 (Dock Forechamber Door) // Set forechamber door to closed _tempVar = 0; } -void Myst::o_shipAccess_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_shipAccess_init(uint16 var, const ArgumentsArray &args) { // Enable acces to the ship if (_state.shipFloating) { getInvokingResource<MystArea>()->setEnabled(true); } } -void Myst::o_butterflies_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Butterflies movie init", op); - +void Myst::o_butterflies_init(uint16 var, const ArgumentsArray &args) { // Used for Card 4256 (Butterfly Movie Activation) if (!_butterfliesMoviePlayed) { MystAreaVideo *butterflies = getInvokingResource<MystAreaVideo>(); @@ -3323,10 +3207,7 @@ void Myst::o_butterflies_init(uint16 op, uint16 var, const ArgumentsArray &args) } } -void Myst::o_imager_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Imager init", op); - debugC(kDebugScript, "Var: %d", var); - +void Myst::o_imager_init(uint16 var, const ArgumentsArray &args) { MystAreaActionSwitch *select = getInvokingResource<MystAreaActionSwitch>(); _imagerMovie = static_cast<MystAreaVideo *>(select->getSubResource(getVar(var))); _imagerRunning = true; @@ -3369,7 +3250,7 @@ void Myst::libraryBookcaseTransform_run(void) { } } -void Myst::o_libraryBookcaseTransform_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_libraryBookcaseTransform_init(uint16 var, const ArgumentsArray &args) { if (_libraryBookcaseChanged) { MystAreaActionSwitch *resource = getInvokingResource<MystAreaActionSwitch>(); _libraryBookcaseMovie = static_cast<MystAreaVideo *>(resource->getSubResource(getVar(0))); @@ -3395,25 +3276,19 @@ void Myst::generatorControlRoom_run(void) { } } -void Myst::o_generatorControlRoom_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generator control room init", op); - +void Myst::o_generatorControlRoom_init(uint16 var, const ArgumentsArray &args) { _generatorVoltage = _state.generatorVoltage; _generatorControlRoomRunning = true; } -void Myst::o_fireplace_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Fireplace grid init", op); - +void Myst::o_fireplace_init(uint16 var, const ArgumentsArray &args) { // Clear fireplace grid for (uint i = 0; i < 6; i++) _fireplaceLines[i] = 0; } -void Myst::o_clockGears_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_clockGears_init(uint16 var, const ArgumentsArray &args) { // Used for Card 4113 (Clock Tower Cog Puzzle) - debugC(kDebugScript, "Opcode %d: Gears puzzle init", op); - // Set gears position if (_state.gearsOpen) { _clockGearsPositions[0] = 2; @@ -3428,9 +3303,7 @@ void Myst::o_clockGears_init(uint16 op, uint16 var, const ArgumentsArray &args) } } -void Myst::o_gulls1_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Gulls init", op); - +void Myst::o_gulls1_init(uint16 var, const ArgumentsArray &args) { if (!_state.shipFloating) { _gullsNextTime = _vm->_system->getMillis() + 2000; _gullsFlying1 = true; @@ -3460,9 +3333,7 @@ void Myst::gullsFly1_run() { } } -void Myst::o_observatory_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Stellar observatory init", op); - +void Myst::o_observatory_init(uint16 var, const ArgumentsArray &args) { _tempVar = 0; _observatoryNotInitialized = true; _observatoryVisualizer = getInvokingResource<MystAreaImageSwitch>(); @@ -3579,9 +3450,7 @@ void Myst::observatory_run() { } } -void Myst::o_gulls2_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Gulls init", op); - +void Myst::o_gulls2_init(uint16 var, const ArgumentsArray &args) { if (!_state.shipFloating) { _gullsNextTime = _vm->_system->getMillis() + 2000; _gullsFlying2 = true; @@ -3605,15 +3474,11 @@ void Myst::gullsFly2_run() { } } -void Myst::o_treeCard_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Enter tree card", op); - +void Myst::o_treeCard_init(uint16 var, const ArgumentsArray &args) { _tree = getInvokingResource<MystAreaImageSwitch>(); } -void Myst::o_treeEntry_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Enter tree card with entry", op); - +void Myst::o_treeEntry_init(uint16 var, const ArgumentsArray &args) { _treeAlcove = getInvokingResource<MystArea>(); _treeMinAccessiblePosition = args[0]; _treeMaxAccessiblePosition = args[1]; @@ -3621,9 +3486,7 @@ void Myst::o_treeEntry_init(uint16 op, uint16 var, const ArgumentsArray &args) { treeSetAlcoveAccessible(); } -void Myst::o_boilerMovies_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Boiler movies init", op); - +void Myst::o_boilerMovies_init(uint16 var, const ArgumentsArray &args) { boilerFireInit(); boilerGaugeInit(); } @@ -3697,9 +3560,7 @@ void Myst::boilerGaugeInit() { _cabinGaugeMovieEnabled = true; } -void Myst::o_rocketSliders_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket sliders init", op); - +void Myst::o_rocketSliders_init(uint16 var, const ArgumentsArray &args) { _rocketSlider1 = _vm->getViewResource<MystAreaSlider>(args[0]); _rocketSlider2 = _vm->getViewResource<MystAreaSlider>(args[1]); _rocketSlider3 = _vm->getViewResource<MystAreaSlider>(args[2]); @@ -3718,15 +3579,12 @@ void Myst::o_rocketSliders_init(uint16 op, uint16 var, const ArgumentsArray &arg _rocketSlider5->setPosition(_state.rocketSliderPosition[4]); } -void Myst::o_rocketLinkVideo_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Rocket link video init", op); +void Myst::o_rocketLinkVideo_init(uint16 var, const ArgumentsArray &args) { _tempVar = 0; } -void Myst::o_greenBook_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Myst::o_greenBook_init(uint16 var, const ArgumentsArray &args) { // Used for Card 4168 (Green Book Movies) - debugC(kDebugScript, "Opcode %d: Green book init", op); - _greenBookRunning = true; _tempVar = 1; } @@ -3775,9 +3633,7 @@ void Myst::greenBook_run() { } } -void Myst::o_gulls3_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Gulls init", op); - +void Myst::o_gulls3_init(uint16 var, const ArgumentsArray &args) { if (!_state.shipFloating) { _gullsNextTime = _vm->_system->getMillis() + 2000; _gullsFlying3 = true; @@ -3803,9 +3659,7 @@ void Myst::gullsFly3_run() { } } -void Myst::o_bookAddSpecialPage_exit(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Book Exit Function", op); - +void Myst::o_bookAddSpecialPage_exit(uint16 var, const ArgumentsArray &args) { uint16 numPages = bookCountPages(var); // Add special page @@ -3817,30 +3671,22 @@ void Myst::o_bookAddSpecialPage_exit(uint16 op, uint16 var, const ArgumentsArray } } -void Myst::o_treeCard_exit(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Exit tree card", op); - +void Myst::o_treeCard_exit(uint16 var, const ArgumentsArray &args) { _tree = nullptr; } -void Myst::o_treeEntry_exit(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Exit tree card with entry", op); - +void Myst::o_treeEntry_exit(uint16 var, const ArgumentsArray &args) { _treeAlcove = nullptr; } -void Myst::o_boiler_exit(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Exit boiler card", op); - +void Myst::o_boiler_exit(uint16 var, const ArgumentsArray &args) { _cabinGaugeMovie = VideoEntryPtr(); _cabinFireMovie = VideoEntryPtr(); _cabinGaugeMovieEnabled = false; } -void Myst::o_generatorControlRoom_exit(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generator room exit", op); - +void Myst::o_generatorControlRoom_exit(uint16 var, const ArgumentsArray &args) { _generatorVoltage = _state.generatorVoltage; } diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h index f3c9087d58..2da33f0389 100644 --- a/engines/mohawk/myst_stacks/myst.h +++ b/engines/mohawk/myst_stacks/myst.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Myst : public MystScriptParser { public: @@ -96,8 +96,10 @@ protected: DECLARE_OPCODE(o_cabinSafeHandleMove); DECLARE_OPCODE(o_cabinSafeHandleEndMove); DECLARE_OPCODE(o_treePressureReleaseStart); - DECLARE_OPCODE(o_observatoryMonthChangeStart); - DECLARE_OPCODE(o_observatoryDayChangeStart); + DECLARE_OPCODE(o_observatoryMonthChangeStartIncrease); + DECLARE_OPCODE(o_observatoryMonthChangeStartDecrease); + DECLARE_OPCODE(o_observatoryDayChangeStartIncrease); + DECLARE_OPCODE(o_observatoryDayChangeStartDecrease); DECLARE_OPCODE(o_observatoryGoButton); DECLARE_OPCODE(o_observatoryMonthSliderMove); DECLARE_OPCODE(o_observatoryDaySliderMove); @@ -143,7 +145,8 @@ protected: DECLARE_OPCODE(o_clockWheelEndTurn); DECLARE_OPCODE(o_clockHourWheelStartTurn); DECLARE_OPCODE(o_clockLeverStartMove); - DECLARE_OPCODE(o_clockLeverMove); + DECLARE_OPCODE(o_clockLeverMoveLeft); + DECLARE_OPCODE(o_clockLeverMoveRight); DECLARE_OPCODE(o_clockLeverEndMove); DECLARE_OPCODE(o_clockResetLeverStartMove); DECLARE_OPCODE(o_clockResetLeverMove); @@ -151,9 +154,11 @@ protected: DECLARE_OPCODE(o_libraryCombinationBookStartRight); DECLARE_OPCODE(o_libraryCombinationBookStartLeft); - DECLARE_OPCODE(o_observatoryTimeChangeStart); + DECLARE_OPCODE(o_observatoryTimeChangeStartIncrease); + DECLARE_OPCODE(o_observatoryTimeChangeStartDecrease); DECLARE_OPCODE(o_observatoryChangeSettingStop); - DECLARE_OPCODE(o_observatoryYearChangeStart); + DECLARE_OPCODE(o_observatoryYearChangeStartIncrease); + DECLARE_OPCODE(o_observatoryYearChangeStartDecrease); DECLARE_OPCODE(o_dockVaultForceClose); DECLARE_OPCODE(o_imagerEraseStop); @@ -311,6 +316,7 @@ protected: void clockWheelStartTurn(uint16 wheel); void clockWheelTurn(uint16 var); + void clockLeverMove(bool leftLever); void clockGearForwardOneStep(uint16 gear); void clockWeightDownOneStep(); void clockGearsCheckSolution(); @@ -336,6 +342,10 @@ protected: bool observatoryIsDDMMYYYY2400(); void observatorySetTargetToSetting(); void observatoryUpdateVisualizer(uint16 x, uint16 y); + void observatoryMonthChangeStart(bool increase); + void observatoryDayChangeStart(bool increase); + void observatoryYearChangeStart(bool increase); + void observatoryTimeChangeStart(bool increase); void observatoryIncrementMonth(int16 increment); void observatoryIncrementDay(int16 increment); void observatoryIncrementYear(int16 increment); diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp index db657e5920..9ad40b0f46 100644 --- a/engines/mohawk/myst_stacks/preview.cpp +++ b/engines/mohawk/myst_stacks/preview.cpp @@ -79,28 +79,22 @@ void Preview::runPersistentScripts() { speech_run(); } -void Preview::o_fadeToBlack(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Fade to black", op); +void Preview::o_fadeToBlack(uint16 var, const ArgumentsArray &args) { _vm->_gfx->fadeToBlack(); } -void Preview::o_fadeFromBlack(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Fade from black", op); +void Preview::o_fadeFromBlack(uint16 var, const ArgumentsArray &args) { _vm->_gfx->fadeFromBlack(); } -void Preview::o_stayHere(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Stay here dialog", op); - +void Preview::o_stayHere(uint16 var, const ArgumentsArray &args) { // Nuh-uh! No leaving the library in the demo! GUI::MessageDialog dialog("You can't leave the library in the demo."); dialog.runModal(); } -void Preview::o_speechStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Speech stop", op); - +void Preview::o_speechStop(uint16 var, const ArgumentsArray &args) { _vm->_sound->stopSpeech(); _speechRunning = false; _globals.currentAge = 2; @@ -225,22 +219,18 @@ void Preview::speech_run() { } } -void Preview::o_speech_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Speech init", op); - +void Preview::o_speech_init(uint16 var, const ArgumentsArray &args) { // Used for Card 3000 (Closed Myst Book) _speechStep = 0; _speechRunning = true; } -void Preview::o_library_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Library init", op); - +void Preview::o_library_init(uint16 var, const ArgumentsArray &args) { // Used for Card 3002 (Myst Island Overview) _library = getInvokingResource<MystAreaImageSwitch>(); } -void Preview::o_libraryBookcaseTransformDemo_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Preview::o_libraryBookcaseTransformDemo_init(uint16 var, const ArgumentsArray &args) { if (_libraryBookcaseChanged) { MystAreaActionSwitch *resource = getInvokingResource<MystAreaActionSwitch>(); _libraryBookcaseMovie = static_cast<MystAreaVideo *>(resource->getSubResource(getVar(303))); diff --git a/engines/mohawk/myst_stacks/preview.h b/engines/mohawk/myst_stacks/preview.h index dbbd6c2c63..6c0fe83b42 100644 --- a/engines/mohawk/myst_stacks/preview.h +++ b/engines/mohawk/myst_stacks/preview.h @@ -35,7 +35,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Preview : public Myst { public: diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp index fe1a64a257..427635b94c 100644 --- a/engines/mohawk/myst_stacks/selenitic.cpp +++ b/engines/mohawk/myst_stacks/selenitic.cpp @@ -285,7 +285,7 @@ bool Selenitic::setVarValue(uint16 var, uint16 value) { return refresh; } -void Selenitic::o_mazeRunnerMove(uint16 op, uint16 var, const ArgumentsArray &args) { +void Selenitic::o_mazeRunnerMove(uint16 var, const ArgumentsArray &args) { uint16 oldPosition = _mazeRunnerPosition; uint16 move = var; @@ -566,16 +566,11 @@ void Selenitic::mazeRunnerPlaySoundHelp() { _mazeRunnerLight->drawConditionalDataToScreen(0); } -void Selenitic::o_mazeRunnerSoundRepeat(uint16 op, uint16 var, const ArgumentsArray &args) { +void Selenitic::o_mazeRunnerSoundRepeat(uint16 var, const ArgumentsArray &args) { mazeRunnerPlaySoundHelp(); } -/** - * Sound receiver sigma button - */ -void Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound receiver sigma button", op); - +void Selenitic::o_soundReceiverSigma(uint16 var, const ArgumentsArray &args) { _vm->_cursor->hideCursor(); _soundReceiverCurrentSource->drawConditionalDataToScreen(0); @@ -622,26 +617,15 @@ void Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, const ArgumentsArray _vm->_cursor->showCursor(); } -/** - * Sound receiver right button - */ -void Selenitic::o_soundReceiverRight(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound receiver right", op); - +void Selenitic::o_soundReceiverRight(uint16 var, const ArgumentsArray &args) { soundReceiverLeftRight(1); } -/** - * Sound receiver left button - */ -void Selenitic::o_soundReceiverLeft(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound receiver left", op); - +void Selenitic::o_soundReceiverLeft(uint16 var, const ArgumentsArray &args) { soundReceiverLeftRight(2); } void Selenitic::soundReceiverLeftRight(uint direction) { - if (_soundReceiverSigmaPressed) { _soundReceiverSigmaButton->drawConditionalDataToScreen(0); _soundReceiverSigmaPressed = false; @@ -694,12 +678,7 @@ void Selenitic::soundReceiverDrawAngle() { _vm->redrawResource(_soundReceiverAngle4); } -/** - * Sound receiver source selection buttons - */ -void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound receiver source", op); - +void Selenitic::o_soundReceiverSource(uint16 var, const ArgumentsArray &args) { if (_soundReceiverSigmaPressed) { _soundReceiverSigmaButton->drawConditionalDataToScreen(0); _soundReceiverSigmaPressed = false; @@ -731,7 +710,7 @@ void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, const ArgumentsArra _vm->_cursor->showCursor(); } -void Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, const ArgumentsArray &args) { +void Selenitic::o_mazeRunnerDoorButton(uint16 var, const ArgumentsArray &args) { // Used for Selenitic Maze Runner Exit Logic uint16 cardIdExit = args[0]; uint16 cardIdEntry = args[1]; @@ -748,9 +727,7 @@ void Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, const ArgumentsArr } } -void Selenitic::o_soundReceiverUpdateSound(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound receiver update sound", op); - +void Selenitic::o_soundReceiverUpdateSound(uint16 var, const ArgumentsArray &args) { soundReceiverUpdateSound(); } @@ -796,9 +773,7 @@ MystAreaSlider *Selenitic::soundLockSliderFromVar(uint16 var) { return nullptr; } -void Selenitic::o_soundLockMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound lock move", op); - +void Selenitic::o_soundLockMove(uint16 var, const ArgumentsArray &args) { MystAreaSlider *slider = soundLockSliderFromVar(var); uint16 soundId = soundLockCurrentSound(slider->_pos.y, true); @@ -808,9 +783,7 @@ void Selenitic::o_soundLockMove(uint16 op, uint16 var, const ArgumentsArray &arg } } -void Selenitic::o_soundLockStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound lock start move", op); - +void Selenitic::o_soundLockStartMove(uint16 var, const ArgumentsArray &args) { MystAreaSlider *slider = soundLockSliderFromVar(var); _vm->_cursor->setCursor(700); @@ -820,9 +793,7 @@ void Selenitic::o_soundLockStartMove(uint16 op, uint16 var, const ArgumentsArray _vm->_sound->playEffect(_soundLockSoundId, true); } -void Selenitic::o_soundLockEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound lock end move", op); - +void Selenitic::o_soundLockEndMove(uint16 var, const ArgumentsArray &args) { MystAreaSlider *slider = soundLockSliderFromVar(var); uint16 *value = &_state.soundLockSliderPositions[0]; @@ -879,9 +850,7 @@ void Selenitic::soundLockCheckSolution(MystAreaSlider *slider, uint16 value, uin _vm->_sound->stopEffect(); } -void Selenitic::o_soundLockButton(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound lock button", op); - +void Selenitic::o_soundLockButton(uint16 var, const ArgumentsArray &args) { bool solved = true; _vm->_sound->pauseBackground(); @@ -920,9 +889,7 @@ void Selenitic::o_soundLockButton(uint16 op, uint16 var, const ArgumentsArray &a _vm->_cursor->showCursor(); } -void Selenitic::o_soundReceiverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound receiver end move", op); - +void Selenitic::o_soundReceiverEndMove(uint16 var, const ArgumentsArray &args) { uint16 oldDirection = _soundReceiverDirection; if (_soundReceiverDirection) { @@ -937,15 +904,15 @@ void Selenitic::o_soundReceiverEndMove(uint16 op, uint16 var, const ArgumentsArr } } -void Selenitic::o_mazeRunnerCompass_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Selenitic::o_mazeRunnerCompass_init(uint16 var, const ArgumentsArray &args) { _mazeRunnerCompass = getInvokingResource<MystAreaImageSwitch>(); } -void Selenitic::o_mazeRunnerWindow_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Selenitic::o_mazeRunnerWindow_init(uint16 var, const ArgumentsArray &args) { _mazeRunnerWindow = getInvokingResource<MystAreaImageSwitch>(); } -void Selenitic::o_mazeRunnerLight_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Selenitic::o_mazeRunnerLight_init(uint16 var, const ArgumentsArray &args) { _mazeRunnerLight = getInvokingResource<MystAreaImageSwitch>(); } @@ -1065,9 +1032,7 @@ void Selenitic::soundReceiverSolution(uint16 source, uint16 &solution, bool &ena } } -void Selenitic::o_soundReceiver_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound receiver init", op); - +void Selenitic::o_soundReceiver_init(uint16 var, const ArgumentsArray &args) { // Used for Card 1245 (Sound Receiver) _soundReceiverRunning = true; @@ -1094,9 +1059,7 @@ void Selenitic::o_soundReceiver_init(uint16 op, uint16 var, const ArgumentsArray _soundReceiverSigmaPressed = false; } -void Selenitic::o_soundLock_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Sound lock init", op); - +void Selenitic::o_soundLock_init(uint16 var, const ArgumentsArray &args) { for (uint i = 0; i < _vm->_resources.size(); i++) { if (_vm->_resources[i]->type == kMystAreaSlider) { switch (_vm->_resources[i]->getImageSwitchVar()) { @@ -1129,11 +1092,11 @@ void Selenitic::o_soundLock_init(uint16 op, uint16 var, const ArgumentsArray &ar _soundLockSoundId = 0; } -void Selenitic::o_mazeRunnerRight_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Selenitic::o_mazeRunnerRight_init(uint16 var, const ArgumentsArray &args) { _mazeRunnerRightButton = getInvokingResource<MystAreaImageSwitch>(); } -void Selenitic::o_mazeRunnerLeft_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Selenitic::o_mazeRunnerLeft_init(uint16 var, const ArgumentsArray &args) { _mazeRunnerLeftButton = getInvokingResource<MystAreaImageSwitch>(); } diff --git a/engines/mohawk/myst_stacks/selenitic.h b/engines/mohawk/myst_stacks/selenitic.h index 706bee52a0..e0b4564bb9 100644 --- a/engines/mohawk/myst_stacks/selenitic.h +++ b/engines/mohawk/myst_stacks/selenitic.h @@ -34,7 +34,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Selenitic : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp index 851ce84c96..070724c221 100644 --- a/engines/mohawk/myst_stacks/slides.cpp +++ b/engines/mohawk/myst_stacks/slides.cpp @@ -68,18 +68,14 @@ void Slides::runPersistentScripts() { } } -void Slides::o_returnToMenu(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Return to menu", op); - +void Slides::o_returnToMenu(uint16 var, const ArgumentsArray &args) { // Go to the information screens of the menu _vm->changeToStack(kDemoStack, 2002, 0, 0); } -void Slides::o_setCardSwap(uint16 op, uint16 var, const ArgumentsArray &args) { +void Slides::o_setCardSwap(uint16 var, const ArgumentsArray &args) { _nextCardID = args[0]; - debugC(kDebugScript, "Opcode %d: Set next card %d", op, _nextCardID); - _nextCardTime = _vm->_system->getMillis() + 5000; _cardSwapEnabled = true; } diff --git a/engines/mohawk/myst_stacks/slides.h b/engines/mohawk/myst_stacks/slides.h index 6215447816..63fd9c823e 100644 --- a/engines/mohawk/myst_stacks/slides.h +++ b/engines/mohawk/myst_stacks/slides.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Slides : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp index 6196618d90..bfe1b19329 100644 --- a/engines/mohawk/myst_stacks/stoneship.cpp +++ b/engines/mohawk/myst_stacks/stoneship.cpp @@ -383,9 +383,7 @@ bool Stoneship::setVarValue(uint16 var, uint16 value) { return refresh; } -void Stoneship::o_pumpTurnOff(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Turn off previous pump selection", op); - +void Stoneship::o_pumpTurnOff(uint16 var, const ArgumentsArray &args) { if (_state.pumpState) { uint16 buttonVar = 0; @@ -413,17 +411,13 @@ void Stoneship::o_pumpTurnOff(uint16 op, uint16 var, const ArgumentsArray &args) } } -void Stoneship::o_brotherDoorOpen(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Open brother door", op); - +void Stoneship::o_brotherDoorOpen(uint16 var, const ArgumentsArray &args) { _brotherDoorOpen = 1; _vm->redrawArea(19, 0); animatedUpdate(args, 5); } -void Stoneship::o_cabinBookMovie(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Play Book Room Movie", op); - +void Stoneship::o_cabinBookMovie(uint16 var, const ArgumentsArray &args) { uint16 startTime = args[0]; uint16 endTime = args[1]; @@ -436,9 +430,7 @@ void Stoneship::o_cabinBookMovie(uint16 op, uint16 var, const ArgumentsArray &ar _vm->waitUntilMovieEnds(book); } -void Stoneship::o_drawerOpenSirius(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Open drawer", op); - +void Stoneship::o_drawerOpenSirius(uint16 var, const ArgumentsArray &args) { MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(args[0]); if (drawer->getImageSwitchVar() == 35) { @@ -454,20 +446,17 @@ void Stoneship::o_drawerOpenSirius(uint16 op, uint16 var, const ArgumentsArray & _vm->_gfx->runTransition(transition, drawer->getRect(), 25, 5); } -void Stoneship::o_drawerClose(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Close drawer", op); +void Stoneship::o_drawerClose(uint16 var, const ArgumentsArray &args) { drawerClose(args[0]); } -void Stoneship::o_telescopeStart(uint16 op, uint16 var, const ArgumentsArray &args) { +void Stoneship::o_telescopeStart(uint16 var, const ArgumentsArray &args) { const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); _telescopeOldMouse = mouse.x; _vm->_cursor->setCursor(700); } -void Stoneship::o_telescopeMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Telescope move", op); - +void Stoneship::o_telescopeMove(uint16 var, const ArgumentsArray &args) { MystAreaDrag *display = getInvokingResource<MystAreaDrag>(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -483,13 +472,11 @@ void Stoneship::o_telescopeMove(uint16 op, uint16 var, const ArgumentsArray &arg telescopeLighthouseDraw(); } -void Stoneship::o_telescopeStop(uint16 op, uint16 var, const ArgumentsArray &args) { +void Stoneship::o_telescopeStop(uint16 var, const ArgumentsArray &args) { _vm->checkCursorHints(); } -void Stoneship::o_generatorStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generator start", op); - +void Stoneship::o_generatorStart(uint16 var, const ArgumentsArray &args) { MystAreaDrag *handle = getInvokingResource<MystAreaDrag>(); uint16 soundId = handle->getList1(0); @@ -513,9 +500,7 @@ void Stoneship::o_generatorStart(uint16 op, uint16 var, const ArgumentsArray &ar _vm->_sound->playEffect(soundId, true); } -void Stoneship::o_generatorStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Generator stop", op); - +void Stoneship::o_generatorStop(uint16 var, const ArgumentsArray &args) { _batteryCharging = false; if (_state.generatorDuration) { @@ -580,18 +565,14 @@ void Stoneship::batteryDeplete_run() { } } -void Stoneship::o_drawerOpenAchenar(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Open drawer", op); - +void Stoneship::o_drawerOpenAchenar(uint16 var, const ArgumentsArray &args) { MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(args[0]); drawer->drawConditionalDataToScreen(0, 0); _vm->_gfx->runTransition(kTransitionTopToBottom, drawer->getRect(), 25, 5); } -void Stoneship::o_hologramPlayback(uint16 op, uint16 var, const ArgumentsArray &args) { +void Stoneship::o_hologramPlayback(uint16 var, const ArgumentsArray &args) { // Used for Card 2013 (Achenar's Rose-Skull Hologram) - debugC(kDebugScript, "Opcode %d: Rose-Skull Hologram Playback", op); - uint16 startPoint = args[0]; uint16 endPoint = args[1]; // uint16 direction = args[2]; @@ -610,14 +591,11 @@ void Stoneship::o_hologramPlayback(uint16 op, uint16 var, const ArgumentsArray & _vm->waitUntilMovieEnds(displayMovie); } -void Stoneship::o_hologramSelectionStart(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Hologram start move", op); +void Stoneship::o_hologramSelectionStart(uint16 var, const ArgumentsArray &args) { //_vm->_cursor->setCursor(0); } -void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Hologram move", op); - +void Stoneship::o_hologramSelectionMove(uint16 var, const ArgumentsArray &args) { MystAreaDrag *handle = getInvokingResource<MystAreaDrag>(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -642,13 +620,11 @@ void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, const ArgumentsAr } } -void Stoneship::o_hologramSelectionStop(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Hologram stop move", op); +void Stoneship::o_hologramSelectionStop(uint16 var, const ArgumentsArray &args) { _vm->checkCursorHints(); } -void Stoneship::o_compassButton(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Compass rose button pressed", op); +void Stoneship::o_compassButton(uint16 var, const ArgumentsArray &args) { // Used on Card 2111 (Compass Rose) // Called when Button Clicked. uint16 correctButton = args[0]; @@ -666,12 +642,10 @@ void Stoneship::o_compassButton(uint16 op, uint16 var, const ArgumentsArray &arg _batteryDepleting = false; } - o_redrawCard(op, var, args); + o_redrawCard(var, args); } -void Stoneship::o_chestValveVideos(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Chest valve videos", op); - +void Stoneship::o_chestValveVideos(uint16 var, const ArgumentsArray &args) { Common::String movie = _vm->wrapMovieFilename("ligspig", kStoneshipStack); _vm->_sound->playEffect(2132); @@ -721,9 +695,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, const ArgumentsArray & } } -void Stoneship::o_chestDropKey(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: drop chest key", op); - +void Stoneship::o_chestDropKey(uint16 var, const ArgumentsArray &args) { // If holding Key to Lamp Room Trapdoor, drop to bottom of // Lighthouse... if (_state.trapdoorKeyState == 1) { @@ -732,9 +704,7 @@ void Stoneship::o_chestDropKey(uint16 op, uint16 var, const ArgumentsArray &args } } -void Stoneship::o_trapLockOpen(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Trap lock open video", op); - +void Stoneship::o_trapLockOpen(uint16 var, const ArgumentsArray &args) { Common::String movie = _vm->wrapMovieFilename("openloc", kStoneshipStack); VideoEntryPtr lock = _vm->_video->playMovie(movie); @@ -759,13 +729,10 @@ void Stoneship::o_trapLockOpen(uint16 op, uint16 var, const ArgumentsArray &args _vm->_sound->playEffect(4143); } -void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, const ArgumentsArray &args) { +void Stoneship::o_sideDoorsMovies(uint16 var, const ArgumentsArray &args) { // Used for Cards 2285, 2289, 2247, 2251 (Side Doors in Tunnels Down To Brothers Rooms) uint16 movieId = args[0]; - debugC(kDebugScript, "Opcode %d: Play Side Door Movies", op); - debugC(kDebugScript, "\tmovieId: %d", movieId); - _vm->_cursor->hideCursor(); _vm->_sound->pauseBackground(); @@ -795,24 +762,18 @@ void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, const ArgumentsArray &a _vm->_cursor->showCursor(); } -void Stoneship::o_cloudOrbEnter(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Cloud orb enter", op); - +void Stoneship::o_cloudOrbEnter(uint16 var, const ArgumentsArray &args) { _vm->_sound->playEffect(_cloudOrbSound, true); _cloudOrbMovie->playMovie(); } -void Stoneship::o_cloudOrbLeave(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Cloud orb leave", op); - +void Stoneship::o_cloudOrbLeave(uint16 var, const ArgumentsArray &args) { _cloudOrbMovie->pauseMovie(true); _vm->_sound->playEffect(_cloudOrbStopSound); _vm->_gfx->runTransition(kTransitionTopToBottom, getInvokingResource<MystArea>()->getRect(), 4, 0); } -void Stoneship::o_drawerCloseOpened(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Close open drawer", op); - +void Stoneship::o_drawerCloseOpened(uint16 var, const ArgumentsArray &args) { uint16 drawerOpen = getVar(var); if (drawerOpen) drawerClose(args[0] + drawerOpen - 1); @@ -827,15 +788,13 @@ void Stoneship::drawerClose(uint16 drawer) { _vm->_gfx->runTransition(kTransitionBottomToTop, res->getRect(), 25, 5); } -void Stoneship::o_hologramDisplay_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Hologram display init", op); +void Stoneship::o_hologramDisplay_init(uint16 var, const ArgumentsArray &args) { _hologramDisplay = getInvokingResource<MystAreaVideo>(); _hologramDisplayPos = 0; } -void Stoneship::o_hologramSelection_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Hologram selection init", op); +void Stoneship::o_hologramSelection_init(uint16 var, const ArgumentsArray &args) { _hologramSelection = getInvokingResource<MystAreaVideo>(); } @@ -853,26 +812,21 @@ void Stoneship::batteryGaugeUpdate() { _batteryGauge->setRect(rect); } -void Stoneship::o_battery_init(uint16 op, uint16 var, const ArgumentsArray &args) { +void Stoneship::o_battery_init(uint16 var, const ArgumentsArray &args) { // Used for Card 2160 (Lighthouse Battery Pack Closeup) - debugC(kDebugScript, "Opcode %d: Battery init", op); - _batteryGauge = getInvokingResource<MystAreaImageSwitch>(); batteryGaugeUpdate(); } -void Stoneship::o_tunnelEnter_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Tunnel enter", op); - - o_tunnel_init(op, var, args); +void Stoneship::o_tunnelEnter_init(uint16 var, const ArgumentsArray &args) { + o_tunnel_init(var, args); _tunnelRunning = true; _tunnelNextTime = _vm->_system->getMillis() + 1500; } -void Stoneship::o_batteryGauge_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Battery gauge init", op); +void Stoneship::o_batteryGauge_init(uint16 var, const ArgumentsArray &args) { _batteryLastCharge = batteryRemainingCharge(); _batteryGaugeRunning = true; } @@ -892,9 +846,7 @@ void Stoneship::batteryGauge_run() { } } -void Stoneship::o_tunnel_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Tunnel card init", op); - +void Stoneship::o_tunnel_init(uint16 var, const ArgumentsArray &args) { _tunnelImagesCount = args[0]; assert(_tunnelImagesCount <= 2 && "Too many images"); @@ -930,21 +882,15 @@ void Stoneship::tunnel_run() { } } -void Stoneship::o_tunnelLeave_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Tunnel leave", op); - +void Stoneship::o_tunnelLeave_init(uint16 var, const ArgumentsArray &args) { _tunnelRunning = false; } -void Stoneship::o_chest_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Chest init", op); - +void Stoneship::o_chest_init(uint16 var, const ArgumentsArray &args) { _state.chestOpenState = 0; } -void Stoneship::o_telescope_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Telescope init", op); - +void Stoneship::o_telescope_init(uint16 var, const ArgumentsArray &args) { // Used in Card 2218 (Telescope view) _telescopePanorama = args[0]; _telescopeLighthouseOff = args[1]; @@ -990,9 +936,7 @@ void Stoneship::telescopeLighthouseDraw() { } } -void Stoneship::o_achenarDrawers_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Achenar's Room Drawers Init", op); - +void Stoneship::o_achenarDrawers_init(uint16 var, const ArgumentsArray &args) { // Used for Card 2004 (Achenar's Room Drawers) if (!_chestAchenarBottomDrawerClosed) { uint16 count1 = args[0]; @@ -1008,9 +952,7 @@ void Stoneship::o_achenarDrawers_init(uint16 op, uint16 var, const ArgumentsArra } } -void Stoneship::o_cloudOrb_init(uint16 op, uint16 var, const ArgumentsArray &args) { - debugC(kDebugScript, "Opcode %d: Cloud orb init", op); - +void Stoneship::o_cloudOrb_init(uint16 var, const ArgumentsArray &args) { _cloudOrbMovie = getInvokingResource<MystAreaVideo>(); _cloudOrbSound = args[0]; _cloudOrbStopSound = args[1]; diff --git a/engines/mohawk/myst_stacks/stoneship.h b/engines/mohawk/myst_stacks/stoneship.h index b98c41042d..dca7ce8fd3 100644 --- a/engines/mohawk/myst_stacks/stoneship.h +++ b/engines/mohawk/myst_stacks/stoneship.h @@ -33,7 +33,7 @@ struct MystScriptEntry; namespace MystStacks { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) +#define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args) class Stoneship : public MystScriptParser { public: |