diff options
author | Bastien Bouclet | 2017-04-08 07:38:49 +0200 |
---|---|---|
committer | Bastien Bouclet | 2017-07-22 20:38:56 +0200 |
commit | 3e99dd8ccc0cda437ed19dcd3048f1e8eaa6c532 (patch) | |
tree | 314c125a6ff6b161d2bc5c8b21158c2537d61c1e /engines | |
parent | 75040819c6642c304962d02ba646e04242cd4755 (diff) | |
download | scummvm-rg350-3e99dd8ccc0cda437ed19dcd3048f1e8eaa6c532.tar.gz scummvm-rg350-3e99dd8ccc0cda437ed19dcd3048f1e8eaa6c532.tar.bz2 scummvm-rg350-3e99dd8ccc0cda437ed19dcd3048f1e8eaa6c532.zip |
MOHAWK: Myst: Switch to bounds checked opcode arguments
Diffstat (limited to 'engines')
25 files changed, 550 insertions, 566 deletions
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp index 30d2c155df..f3caee6150 100644 --- a/engines/mohawk/myst_scripts.cpp +++ b/engines/mohawk/myst_scripts.cpp @@ -37,16 +37,10 @@ namespace Mohawk { MystScriptEntry::MystScriptEntry() { type = kMystScriptNone; var = 0; - argc = 0; - argv = nullptr; resourceId = 0; u1 = 0; } -MystScriptEntry::~MystScriptEntry() { - delete[] argv; -} - const uint8 MystScriptParser::_stackMap[11] = { kSeleniticStack, kStoneshipStack, @@ -169,19 +163,19 @@ void MystScriptParser::runScript(MystScript script, MystArea *invokingResource) else _invokingResource = _vm->_resources[entry.resourceId]; - runOpcode(entry.opcode, entry.var, entry.argc, entry.argv); + runOpcode(entry.opcode, entry.var, entry.args); } _scriptNestingLevel--; } -void MystScriptParser::runOpcode(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::runOpcode(uint16 op, uint16 var, const ArgumentsArray &args) { _scriptNestingLevel++; bool ranOpcode = false; for (uint16 i = 0; i < _opcodes.size(); i++) if (_opcodes[i]->op == op) { - (this->*(_opcodes[i]->proc)) (op, var, argc, argv); + (this->*(_opcodes[i]->proc)) (op, var, args); ranOpcode = true; break; } @@ -223,13 +217,11 @@ MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, Myst entry.opcode = stream->readUint16LE(); entry.var = stream->readUint16LE(); - entry.argc = stream->readUint16LE(); + uint16 argumentCount = stream->readUint16LE(); - if (entry.argc > 0) { - entry.argv = new uint16[entry.argc]; - for (uint16 j = 0; j < entry.argc; j++) - entry.argv[j] = stream->readUint16LE(); - } + entry.args.resize(argumentCount); + for (uint16 j = 0; j < entry.args.size(); j++) + entry.args[j] = stream->readUint16LE(); // u1 exists only in EXIT scripts if (type == kMystScriptExit) @@ -266,13 +258,13 @@ bool MystScriptParser::setVarValue(uint16 var, uint16 value) { return false; } -void MystScriptParser::animatedUpdate(uint16 argc, uint16 *argv, uint16 delay) { +void MystScriptParser::animatedUpdate(const ArgumentsArray &args, uint16 delay) { uint16 argsRead = 0; - while (argsRead < argc) { - Common::Rect rect = Common::Rect(argv[argsRead], argv[argsRead + 1], argv[argsRead + 2], argv[argsRead + 3]); - TransitionType kind = static_cast<TransitionType>(argv[argsRead + 4]); - uint16 steps = argv[argsRead + 5]; + while (argsRead < args.size()) { + Common::Rect rect = Common::Rect(args[argsRead], args[argsRead + 1], args[argsRead + 2], args[argsRead + 3]); + TransitionType kind = static_cast<TransitionType>(args[argsRead + 4]); + uint16 steps = args[argsRead + 5]; debugC(kDebugScript, "\trect.left: %d", rect.left); debugC(kDebugScript, "\trect.top: %d", rect.top); @@ -288,82 +280,82 @@ void MystScriptParser::animatedUpdate(uint16 argc, uint16 *argv, uint16 delay) { } } -void MystScriptParser::unknown(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +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", argc); + warning("\tArg count = %d", args.size()); - if (argc) { + if (!args.empty()) { Common::String str; - str += Common::String::format("%d", argv[0]); + str += Common::String::format("%d", args[0]); - for (uint16 i = 1; i < argc; i++) - str += Common::String::format(", %d", argv[i]); + 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 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::NOP(uint16 op, uint16 var, const ArgumentsArray &args) { } -void MystScriptParser::o_toggleVar(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_toggleVar(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Toggle var %d", op, var); toggleVar(var); _vm->redrawArea(var); } -void MystScriptParser::o_setVar(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - debugC(kDebugScript, "Opcode %d: Set var %d: %d", op, var, argv[0]); +void MystScriptParser::o_setVar(uint16 op, uint16 var, const ArgumentsArray &args) { + debugC(kDebugScript, "Opcode %d: Set var %d: %d", op, var, args[0]); - if (setVarValue(var, argv[0])) + if (setVarValue(var, args[0])) _vm->redrawArea(var); } -void MystScriptParser::o_changeCardSwitch4(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeCardSwitch4(uint16 op, uint16 var, const ArgumentsArray &args) { uint16 value = getVar(var); debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value); if (value) - _vm->changeToCard(argv[value -1 ], kTransitionDissolve); + _vm->changeToCard(args[value -1 ], kTransitionDissolve); else if (_invokingResource != nullptr) _vm->changeToCard(_invokingResource->getDest(), kTransitionDissolve); else warning("Missing invokingResource in altDest call"); } -void MystScriptParser::o_changeCardSwitchLtR(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeCardSwitchLtR(uint16 op, uint16 var, const ArgumentsArray &args) { uint16 value = getVar(var); debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value); if (value) - _vm->changeToCard(argv[value -1 ], kTransitionLeftToRight); + _vm->changeToCard(args[value -1 ], kTransitionLeftToRight); else if (_invokingResource != nullptr) _vm->changeToCard(_invokingResource->getDest(), kTransitionLeftToRight); else warning("Missing invokingResource in altDest call"); } -void MystScriptParser::o_changeCardSwitchRtL(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeCardSwitchRtL(uint16 op, uint16 var, const ArgumentsArray &args) { uint16 value = getVar(var); debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value); if (value) - _vm->changeToCard(argv[value -1 ], kTransitionRightToLeft); + _vm->changeToCard(args[value -1 ], kTransitionRightToLeft); else if (_invokingResource != nullptr) _vm->changeToCard(_invokingResource->getDest(), kTransitionRightToLeft); else warning("Missing invokingResource in altDest call"); } -void MystScriptParser::o_takePage(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_takePage(uint16 op, 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; // = argv[0]; + uint16 cursorId; // = args[0]; switch (var) { case 41: // Vault white page cursorId = kWhitePageCursor; @@ -402,7 +394,7 @@ void MystScriptParser::o_takePage(uint16 op, uint16 var, uint16 argc, uint16 *ar } } -void MystScriptParser::o_redrawCard(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_redrawCard(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Redraw card", op); _vm->drawCardBackground(); @@ -410,7 +402,7 @@ void MystScriptParser::o_redrawCard(uint16 op, uint16 var, uint16 argc, uint16 * _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); } -void MystScriptParser::o_goToDest(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_goToDest(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); if (_invokingResource != nullptr) @@ -419,7 +411,7 @@ void MystScriptParser::o_goToDest(uint16 op, uint16 var, uint16 argc, uint16 *ar warning("Opcode %d: Missing invokingResource", op); } -void MystScriptParser::o_goToDestForward(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_goToDestForward(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); if (_invokingResource != nullptr) @@ -428,7 +420,7 @@ void MystScriptParser::o_goToDestForward(uint16 op, uint16 var, uint16 argc, uin warning("Opcode %d: Missing invokingResource", op); } -void MystScriptParser::o_goToDestLeft(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_goToDestLeft(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); if (_invokingResource != nullptr) @@ -437,7 +429,7 @@ void MystScriptParser::o_goToDestLeft(uint16 op, uint16 var, uint16 argc, uint16 warning("Opcode %d: Missing invokingResource", op); } -void MystScriptParser::o_goToDestRight(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_goToDestRight(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); if (_invokingResource != nullptr) @@ -446,7 +438,7 @@ void MystScriptParser::o_goToDestRight(uint16 op, uint16 var, uint16 argc, uint1 warning("Opcode %d: Missing invokingResource", op); } -void MystScriptParser::o_goToDestUp(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_goToDestUp(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op); if (_invokingResource != nullptr) @@ -455,7 +447,7 @@ void MystScriptParser::o_goToDestUp(uint16 op, uint16 var, uint16 argc, uint16 * warning("Opcode %d: Missing invokingResource", op); } -void MystScriptParser::o_triggerMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_triggerMovie(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Trigger Type 6 Resource Movie..", op); // 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 @@ -463,8 +455,8 @@ void MystScriptParser::o_triggerMovie(uint16 op, uint16 var, uint16 argc, uint16 // if the movie actually has a sound track. The code is never executed. int16 direction = 1; - if (argc == 1) - direction = argv[0]; + if (args.size() == 1) + direction = args[0]; debugC(kDebugScript, "\tDirection: %d", direction); @@ -474,54 +466,54 @@ void MystScriptParser::o_triggerMovie(uint16 op, uint16 var, uint16 argc, uint16 resource->playMovie(); } -void MystScriptParser::o_toggleVarNoRedraw(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_toggleVarNoRedraw(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: toggleVarNoRedraw", op); toggleVar(var); } -void MystScriptParser::o_drawAreaState(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - debugC(kDebugScript, "Opcode %d: drawAreaState, state: %d", op, argv[0]); +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); MystAreaImageSwitch *parent = static_cast<MystAreaImageSwitch *>(getInvokingResource<MystArea>()->_parent); - parent->drawConditionalDataToScreen(argv[0]); + parent->drawConditionalDataToScreen(args[0]); } -void MystScriptParser::o_redrawAreaForVar(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_redrawAreaForVar(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: redraw area", op); debugC(kDebugScript, "\tvar: %d", var); _vm->redrawArea(var); } -void MystScriptParser::o_changeCardDirectional(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeCardDirectional(uint16 op, 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 = argv[0]; - uint16 directionalUpdateDataSize = argv[1]; + 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(directionalUpdateDataSize, &argv[2], 0); + animatedUpdate(ArgumentsArray(args.begin() + 2, directionalUpdateDataSize), 0); } // NOTE: Opcode 17 and 18 form a pair, where Opcode 17 jumps to a card, // 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, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeCardPush(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Jump to Card Id, Storing Current Card Id", op); _savedCardId = _vm->getCurCard(); - uint16 cardId = argv[0]; - TransitionType transition = static_cast<TransitionType>(argv[1]); + uint16 cardId = args[0]; + TransitionType transition = static_cast<TransitionType>(args[1]); debugC(kDebugScript, "\tCurrent CardId: %d", _savedCardId); debugC(kDebugScript, "\tJump to CardId: %d", cardId); @@ -529,7 +521,7 @@ void MystScriptParser::o_changeCardPush(uint16 op, uint16 var, uint16 argc, uint _vm->changeToCard(cardId, transition); } -void MystScriptParser::o_changeCardPop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +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); @@ -538,94 +530,82 @@ void MystScriptParser::o_changeCardPop(uint16 op, uint16 var, uint16 argc, uint1 return; } - TransitionType transition = static_cast<TransitionType>(argv[0]); + TransitionType transition = static_cast<TransitionType>(args[0]); _vm->changeToCard(_savedCardId, transition); } -void MystScriptParser::o_enableAreas(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_enableAreas(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Enable Hotspots", op); - uint16 count = argv[0]; + uint16 count = args[0]; - if (argc == count + 1) { - for (uint16 i = 0; i < count; i++) { - debugC(kDebugScript, "Enable hotspot index %d", argv[i + 1]); + for (uint16 i = 0; i < count; i++) { + debugC(kDebugScript, "Enable hotspot index %d", args[i + 1]); - MystArea *resource = nullptr; - if (argv[i + 1] == 0xFFFF) - resource = _invokingResource; - else - resource = _vm->_resources[argv[i + 1]]; + MystArea *resource = nullptr; + if (args[i + 1] == 0xFFFF) + resource = _invokingResource; + else + resource = _vm->_resources[args[i + 1]]; - if (resource) - resource->setEnabled(true); - else - warning("Unknown Resource in enableAreas script Opcode"); - } - } else { - error("Invalid arguments for opcode %d", op); + if (resource) + resource->setEnabled(true); + else + warning("Unknown Resource in enableAreas script Opcode"); } } -void MystScriptParser::o_disableAreas(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_disableAreas(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Disable Hotspots", op); - uint16 count = argv[0]; + uint16 count = args[0]; - if (argc == count + 1) { - for (uint16 i = 0; i < count; i++) { - debugC(kDebugScript, "Disable hotspot index %d", argv[i + 1]); + for (uint16 i = 0; i < count; i++) { + debugC(kDebugScript, "Disable hotspot index %d", args[i + 1]); - MystArea *resource = nullptr; - if (argv[i + 1] == 0xFFFF) - resource = _invokingResource; - else - resource = _vm->_resources[argv[i + 1]]; + MystArea *resource = nullptr; + if (args[i + 1] == 0xFFFF) + resource = _invokingResource; + else + resource = _vm->_resources[args[i + 1]]; - if (resource) - resource->setEnabled(false); - else - warning("Unknown Resource in disableAreas script Opcode"); - } - } else { - error("Invalid arguments for opcode %d", op); + if (resource) + resource->setEnabled(false); + else + warning("Unknown Resource in disableAreas script Opcode"); } } -void MystScriptParser::o_directionalUpdate(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_directionalUpdate(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Transition / Directional update", op); - animatedUpdate(argc, argv, 0); + animatedUpdate(args, 0); } -void MystScriptParser::o_toggleAreasActivation(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_toggleAreasActivation(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Toggle areas activation", op); - uint16 count = argv[0]; + uint16 count = args[0]; - if (argc == count + 1) { - for (uint16 i = 0; i < count; i++) { - debugC(kDebugScript, "Enable/Disable hotspot index %d", argv[i + 1]); + for (uint16 i = 0; i < count; i++) { + debugC(kDebugScript, "Enable/Disable hotspot index %d", args[i + 1]); - MystArea *resource = nullptr; - if (argv[i + 1] == 0xFFFF) - resource = _invokingResource; - else - resource = _vm->_resources[argv[i + 1]]; + MystArea *resource = nullptr; + if (args[i + 1] == 0xFFFF) + resource = _invokingResource; + else + resource = _vm->_resources[args[i + 1]]; - if (resource) - resource->setEnabled(!resource->isEnabled()); - else - warning("Unknown Resource in toggleAreasActivation script Opcode"); - } - } else { - error("Invalid arguments for opcode %d", op); + if (resource) + resource->setEnabled(!resource->isEnabled()); + else + warning("Unknown Resource in toggleAreasActivation script Opcode"); } } -void MystScriptParser::o_playSound(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - uint16 soundId = argv[0]; +void MystScriptParser::o_playSound(uint16 op, uint16 var, const ArgumentsArray &args) { + uint16 soundId = args[0]; debugC(kDebugScript, "Opcode %d: playSound", op); debugC(kDebugScript, "\tsoundId: %d", soundId); @@ -633,13 +613,13 @@ void MystScriptParser::o_playSound(uint16 op, uint16 var, uint16 argc, uint16 *a _vm->_sound->playEffect(soundId); } -void MystScriptParser::o_stopSoundBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_stopSoundBackground(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: stopSoundBackground", op); _vm->_sound->stopBackground(); } -void MystScriptParser::o_playSoundBlocking(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - uint16 soundId = argv[0]; +void MystScriptParser::o_playSoundBlocking(uint16 op, uint16 var, const ArgumentsArray &args) { + uint16 soundId = args[0]; debugC(kDebugScript, "Opcode %d: playSoundBlocking", op); debugC(kDebugScript, "\tsoundId: %d", soundId); @@ -648,16 +628,16 @@ void MystScriptParser::o_playSoundBlocking(uint16 op, uint16 var, uint16 argc, u _vm->playSoundBlocking(soundId); } -void MystScriptParser::o_copyBackBufferToScreen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_copyBackBufferToScreen(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Copy back buffer to screen", op); Common::Rect rect; - if (argv[0] == 0xFFFF) { + if (args[0] == 0xFFFF) { // Used in Stoneship Card 2111 (Compass Rose) // Used in Mechanical Card 6267 (Code Lock) rect = _invokingResource->getRect(); } else { - rect = Common::Rect(argv[0], argv[1], argv[2], argv[3]); + rect = Common::Rect(args[0], args[1], args[2], args[3]); } debugC(kDebugScript, "\trect.left: %d", rect.left); @@ -668,16 +648,16 @@ void MystScriptParser::o_copyBackBufferToScreen(uint16 op, uint16 var, uint16 ar _vm->_gfx->copyBackBufferToScreen(rect); } -void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - uint16 imageId = argv[0]; +void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, const ArgumentsArray &args) { + uint16 imageId = args[0]; // WORKAROUND wrong image id in mechanical staircase if (imageId == 7158) imageId = 7178; - Common::Rect srcRect = Common::Rect(argv[1], argv[2], argv[3], argv[4]); + Common::Rect srcRect = Common::Rect(args[1], args[2], args[3], args[4]); - Common::Rect dstRect = Common::Rect(argv[5], argv[6], 544, 333); + Common::Rect dstRect = Common::Rect(args[5], args[6], 544, 333); if (dstRect.left == -1 || dstRect.top == -1) { // Interpreted as full screen @@ -702,14 +682,14 @@ void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, uint16 arg _vm->_gfx->copyImageSectionToBackBuffer(imageId, srcRect, dstRect); } -void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeBackgroundSound(uint16 op, 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 < argc; i++) { - writeStream.writeUint16LE(argv[i]); + for (uint i = 0; i < args.size(); i++) { + writeStream.writeUint16LE(args[i]); } Common::MemoryReadStream readStream = Common::MemoryReadStream(writeStream.getData(), writeStream.size()); @@ -718,13 +698,13 @@ void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, uint16 arg _vm->applySoundBlock(soundBlock); } -void MystScriptParser::o_soundPlaySwitch(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_soundPlaySwitch(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Switch Choice of Play Sound", op); uint16 value = getVar(var); - if (value < argc) { - uint16 soundId = argv[value]; + if (value < args.size()) { + uint16 soundId = args[value]; debugC(kDebugScript, "\tvar: %d", var); debugC(kDebugScript, "\tsoundId: %d", soundId); @@ -733,17 +713,17 @@ void MystScriptParser::o_soundPlaySwitch(uint16 op, uint16 var, uint16 argc, uin } } -void MystScriptParser::o_soundResumeBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_soundResumeBackground(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: soundResumeBackground", op); _vm->_sound->resumeBackground(); } -void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - uint16 imageId = argv[0]; +void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, const ArgumentsArray &args) { + uint16 imageId = args[0]; - Common::Rect srcRect = Common::Rect(argv[1], argv[2], argv[3], argv[4]); + Common::Rect srcRect = Common::Rect(args[1], args[2], args[3], args[4]); - Common::Rect dstRect = Common::Rect(argv[5], argv[6], 544, 333); + Common::Rect dstRect = Common::Rect(args[5], args[6], 544, 333); if (dstRect.left == -1 || dstRect.top == -1) { // Interpreted as full screen @@ -768,23 +748,23 @@ void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, uint16 argc, u _vm->_gfx->copyImageSectionToScreen(imageId, srcRect, dstRect); } -void MystScriptParser::o_changeCard(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeCard(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Change Card", op); - uint16 cardId = argv[0]; - TransitionType transition = static_cast<TransitionType>(argv[1]); + 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, uint16 argc, uint16 *argv) { +void MystScriptParser::o_drawImageChangeCard(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Draw Full Screen Image, Delay then Change Card", op); - uint16 imageId = argv[0]; - uint16 cardId = argv[1]; - TransitionType transition = static_cast<TransitionType>(argv[2]); + 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); @@ -795,10 +775,10 @@ void MystScriptParser::o_drawImageChangeCard(uint16 op, uint16 var, uint16 argc, _vm->changeToCard(cardId, transition); } -void MystScriptParser::o_changeMainCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Change main cursor", op); - uint16 cursorId = argv[0]; + uint16 cursorId = args[0]; debugC(kDebugScript, "Cursor: %d", cursorId); @@ -806,33 +786,33 @@ void MystScriptParser::o_changeMainCursor(uint16 op, uint16 var, uint16 argc, ui _vm->_cursor->setCursor(cursorId); } -void MystScriptParser::o_hideCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_hideCursor(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Hide Cursor", op); _vm->_cursor->hideCursor(); } -void MystScriptParser::o_showCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_showCursor(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Show Cursor", op); _vm->_cursor->showCursor(); } -void MystScriptParser::o_delay(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_delay(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Mechanical Card 6327 (Elevator) debugC(kDebugScript, "Opcode %d: Delay", op); - uint16 time = argv[0]; + uint16 time = args[0]; debugC(kDebugScript, "\tTime: %d", time); _vm->wait(time); } -void MystScriptParser::o_changeStack(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_changeStack(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: changeStack", op); - uint16 targetStack = argv[0]; - uint16 soundIdLinkSrc = argv[1]; - uint16 soundIdLinkDst = argv[2]; + 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); @@ -851,13 +831,13 @@ void MystScriptParser::o_changeStack(uint16 op, uint16 var, uint16 argc, uint16 } } -void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +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); - uint16 cardId = argv[0]; - uint16 soundId = argv[1]; - uint16 delayBetweenSteps = argv[2]; - uint16 dataSize = argv[3]; + uint16 cardId = args[0]; + uint16 soundId = args[1]; + uint16 delayBetweenSteps = args[2]; + uint16 dataSize = args[3]; debugC(kDebugScript, "\tcard: %d", cardId); debugC(kDebugScript, "\tsound: %d", soundId); @@ -869,15 +849,15 @@ void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, u _vm->changeToCard(cardId, kNoTransition); - animatedUpdate(dataSize, &argv[4], delayBetweenSteps); + animatedUpdate(ArgumentsArray(args.begin() + 4, dataSize), delayBetweenSteps); } -void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Play Sound and Directional Update Screen Region", op); - uint16 soundId = argv[0]; - uint16 delayBetweenSteps = argv[1]; - uint16 dataSize = argv[2]; + uint16 soundId = args[0]; + uint16 delayBetweenSteps = args[1]; + uint16 dataSize = args[2]; debugC(kDebugScript, "\tsound: %d", soundId); debugC(kDebugScript, "\tdelay between steps: %d", delayBetweenSteps); @@ -886,22 +866,22 @@ void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, uint1 if (soundId) _vm->_sound->playEffect(soundId); - animatedUpdate(dataSize, &argv[3], delayBetweenSteps); + animatedUpdate(ArgumentsArray(args.begin() + 3, dataSize), delayBetweenSteps); } -void MystScriptParser::o_saveMainCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_saveMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Save main cursor", op); _savedCursorId = _vm->getMainCursor(); } -void MystScriptParser::o_restoreMainCursor(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_restoreMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Restore main cursor", op); _vm->setMainCursor(_savedCursorId); } -void MystScriptParser::o_soundWaitStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_soundWaitStop(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Selenitic Card 1191 (Maze Runner) // Used on Mechanical Card 6267 (Code Lock) // Used when Button is pushed... @@ -911,7 +891,7 @@ void MystScriptParser::o_soundWaitStop(uint16 op, uint16 var, uint16 argc, uint1 _vm->doFrame(); } -void MystScriptParser::o_quit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_quit(uint16 op, uint16 var, const ArgumentsArray &args) { _vm->quitGame(); } @@ -922,7 +902,7 @@ void MystScriptParser::showMap() { } } -void MystScriptParser::o_exitMap(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void MystScriptParser::o_exitMap(uint16 op, uint16 var, const ArgumentsArray &args) { _vm->changeToCard(_savedMapCardId, kTransitionCopy); } diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h index 1ec821b60b..4ae9fb5f14 100644 --- a/engines/mohawk/myst_scripts.h +++ b/engines/mohawk/myst_scripts.h @@ -31,7 +31,9 @@ namespace Mohawk { -#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, uint16 argc, uint16 *argv) +typedef Common::Array<uint16> ArgumentsArray; + +#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) class MohawkEngine_Myst; class MystArea; @@ -45,14 +47,12 @@ enum MystScriptType { struct MystScriptEntry { MystScriptEntry(); - ~MystScriptEntry(); MystScriptType type; uint16 resourceId; uint16 opcode; uint16 var; - uint16 argc; - uint16 *argv; + ArgumentsArray args; uint16 u1; }; @@ -64,7 +64,7 @@ public: virtual ~MystScriptParser(); void runScript(MystScript script, MystArea *invokingResource = nullptr); - void runOpcode(uint16 op, uint16 var = 0, uint16 argc = 0, uint16 *argv = nullptr); + void runOpcode(uint16 op, uint16 var = 0, const ArgumentsArray &args = ArgumentsArray()); const Common::String getOpcodeDesc(uint16 op); MystScript readScript(Common::SeekableReadStream *stream, MystScriptType type); void setInvokingResource(MystArea *resource) { _invokingResource = resource; } @@ -86,7 +86,7 @@ public: virtual uint16 getMap() { return 0; } void showMap(); - void animatedUpdate(uint16 argc, uint16 *argv, uint16 delay); + void animatedUpdate(const ArgumentsArray &args, uint16 delay); DECLARE_OPCODE(unknown); @@ -146,7 +146,7 @@ protected: MohawkEngine_Myst *_vm; MystGameState::Globals &_globals; - typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 op, uint16 var, uint16 argc, uint16* argv); + typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 op, uint16 var, const ArgumentsArray &args); struct MystOpcode { MystOpcode(uint16 o, OpcodeProcMyst p, const char *d) : op(o), proc(p), desc(d) {} diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp index a6e3e568a3..6c56ad5afd 100644 --- a/engines/mohawk/myst_stacks/channelwood.cpp +++ b/engines/mohawk/myst_stacks/channelwood.cpp @@ -299,7 +299,7 @@ bool Channelwood::pipeChangeValve(bool open, uint16 mask) { return false; } -void Channelwood::o_bridgeToggle(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_bridgeToggle(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Bridge rise / skink video", op); VideoEntryPtr bridge = _vm->_video->playMovie(_vm->wrapMovieFilename("bridge", kChannelwoodStack)); @@ -317,10 +317,10 @@ void Channelwood::o_bridgeToggle(uint16 op, uint16 var, uint16 argc, uint16 *arg _vm->waitUntilMovieEnds(bridge); } -void Channelwood::o_pipeExtend(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_pipeExtend(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Play Pipe Movie and Sound", op); - uint16 soundId = argv[0]; + uint16 soundId = args[0]; debugC(kDebugScript, "\tsoundId: %d", soundId); _vm->_sound->playEffect(soundId); @@ -340,11 +340,11 @@ void Channelwood::o_pipeExtend(uint16 op, uint16 var, uint16 argc, uint16 *argv) _vm->_sound->resumeBackground(); } -void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +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); - uint16 imageId = argv[0]; - uint16 cardId = argv[1]; + uint16 imageId = args[0]; + uint16 cardId = args[1]; debugC(kDebugScript, "\timageId: %d", imageId); debugC(kDebugScript, "\tcardId: %d", cardId); @@ -354,14 +354,14 @@ void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, uint16 a _vm->changeToCard(cardId, kTransitionPartToLeft); - if (argc == 3) { - uint16 volume = argv[2]; + if (args.size() == 3) { + uint16 volume = args[2]; _vm->_sound->changeBackgroundVolume(volume); } } -void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Open Animation", op); Common::Rect rect = getInvokingResource<MystArea>()->getRect(); @@ -374,7 +374,7 @@ void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, uint16 argc, uint1 pipeChangeValve(true, 0x80); } -void Channelwood::o_leverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_leverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generic lever start move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -383,7 +383,7 @@ void Channelwood::o_leverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *a _leverPulled = false; } -void Channelwood::o_leverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_leverMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generic lever move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -398,7 +398,7 @@ void Channelwood::o_leverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) } } -void Channelwood::o_leverMoveFail(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_leverMoveFail(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generic lever move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -415,7 +415,7 @@ void Channelwood::o_leverMoveFail(uint16 op, uint16 var, uint16 argc, uint16 *ar } } -void Channelwood::o_leverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_leverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generic lever end move", op); // Get current lever frame @@ -431,13 +431,13 @@ void Channelwood::o_leverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *arg _vm->checkCursorHints(); } -void Channelwood::o_leverEndMoveResumeBackground(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_leverEndMoveResumeBackground(uint16 op, uint16 var, const ArgumentsArray &args) { _vm->_sound->resumeBackground(); - o_leverEndMove(op, var, argc, argv); + o_leverEndMove(op, var, args); } -void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - o_leverEndMove(op, var, argc, argv); +void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, const ArgumentsArray &args) { + o_leverEndMove(op, var, args); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); uint16 soundId = lever->getList3(0); @@ -445,20 +445,20 @@ void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, uint16 argc, ui _vm->_sound->playEffect(soundId); } -void Channelwood::o_leverElev3StartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_leverElev3StartMove(uint16 op, uint16 var, const ArgumentsArray &args) { _vm->_gfx->copyImageToScreen(3970, Common::Rect(544, 333)); _vm->doFrame(); - o_leverStartMove(op, var, argc, argv); + o_leverStartMove(op, var, args); } -void Channelwood::o_leverElev3EndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - o_leverEndMove(op, var, argc, argv); +void Channelwood::o_leverElev3EndMove(uint16 op, uint16 var, const ArgumentsArray &args) { + o_leverEndMove(op, var, args); _vm->_gfx->copyImageToScreen(3265, Common::Rect(544, 333)); _vm->doFrame(); _vm->_sound->playEffect(5265); } -void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Pump lever move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -472,8 +472,8 @@ void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *ar } } -void Channelwood::o_pumpLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - o_leverEndMove(op, var, argc, argv); +void Channelwood::o_pumpLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { + o_leverEndMove(op, var, args); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); uint16 soundId = lever->getList3(0); @@ -481,7 +481,7 @@ void Channelwood::o_pumpLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 _vm->_sound->playBackground(soundId, 36864); } -void Channelwood::o_stairsDoorToggle(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_stairsDoorToggle(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Play stairs door video", op); MystAreaVideo *movie = getInvokingResource<MystAreaVideo>(); @@ -497,7 +497,7 @@ void Channelwood::o_stairsDoorToggle(uint16 op, uint16 var, uint16 argc, uint16 } } -void Channelwood::o_valveHandleMove1(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_valveHandleMove1(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Valve handle move", op); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); @@ -513,7 +513,7 @@ void Channelwood::o_valveHandleMove1(uint16 op, uint16 var, uint16 argc, uint16 } } -void Channelwood::o_valveHandleMoveStart1(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_valveHandleMoveStart1(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Valve handle move start", op); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); @@ -522,10 +522,10 @@ void Channelwood::o_valveHandleMoveStart1(uint16 op, uint16 var, uint16 argc, ui _vm->_sound->playEffect(soundId); _vm->_cursor->setCursor(700); - o_valveHandleMove1(op, var, argc, argv); + o_valveHandleMove1(op, var, args); } -void Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Valve handle move stop", op); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); @@ -548,7 +548,7 @@ void Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, uint16 argc, uint _vm->checkCursorHints(); } -void Channelwood::o_valveHandleMove2(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_valveHandleMove2(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Valve handle move", op); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); @@ -564,7 +564,7 @@ void Channelwood::o_valveHandleMove2(uint16 op, uint16 var, uint16 argc, uint16 } } -void Channelwood::o_valveHandleMoveStart2(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_valveHandleMoveStart2(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Valve handle move start", op); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); @@ -573,10 +573,10 @@ void Channelwood::o_valveHandleMoveStart2(uint16 op, uint16 var, uint16 argc, ui _vm->_sound->playEffect(soundId); _vm->_cursor->setCursor(700); - o_valveHandleMove2(op, var, argc, argv); + o_valveHandleMove2(op, var, args); } -void Channelwood::o_valveHandleMove3(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_valveHandleMove3(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Valve handle move", op); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); @@ -592,7 +592,7 @@ void Channelwood::o_valveHandleMove3(uint16 op, uint16 var, uint16 argc, uint16 } } -void Channelwood::o_valveHandleMoveStart3(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_valveHandleMoveStart3(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Valve handle move start", op); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); @@ -601,14 +601,14 @@ void Channelwood::o_valveHandleMoveStart3(uint16 op, uint16 var, uint16 argc, ui _vm->_sound->playEffect(soundId); _vm->_cursor->setCursor(700); - o_valveHandleMove3(op, var, argc, argv); + o_valveHandleMove3(op, var, args); } -void Channelwood::o_hologramMonitor(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_hologramMonitor(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Hologram monitor", op); // Used on Card 3012 (Temple Hologram Monitor) - uint16 button = argv[0]; // 0 to 3 + uint16 button = args[0]; // 0 to 3 if (_state.holoprojectorSelection != button || !_vm->_video->isVideoPlaying()) { _state.holoprojectorSelection = button; @@ -650,7 +650,7 @@ void Channelwood::o_hologramMonitor(uint16 op, uint16 var, uint16 argc, uint16 * } } -void Channelwood::o_drawerOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_drawerOpen(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Open Sirius drawer", op); _siriusDrawerState = 1; @@ -658,7 +658,7 @@ void Channelwood::o_drawerOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) _vm->redrawArea(102, false); } -void Channelwood::o_hologramTemple(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_hologramTemple(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Temple hologram", op); _vm->_sound->pauseBackground(); @@ -685,14 +685,14 @@ void Channelwood::o_hologramTemple(uint16 op, uint16 var, uint16 argc, uint16 *a _vm->_sound->resumeBackground(); } -void Channelwood::o_executeMouseUp(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_executeMouseUp(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Execute mouse up", op); - MystArea *resource = _vm->getViewResource<MystArea>(argv[0]); + MystArea *resource = _vm->getViewResource<MystArea>(args[0]); resource->handleMouseUp(); } -void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Close Animation", op); Common::Rect rect = getInvokingResource<MystArea>()->getRect(); @@ -705,12 +705,12 @@ void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, uint16 argc, uint pipeChangeValve(false, 0x80); } -void Channelwood::o_elevatorMovies(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_elevatorMovies(uint16 op, uint16 var, const ArgumentsArray &args) { // Used by Card 3262 (Elevator) debugC(kDebugScript, "Opcode %d: Elevator movie", op); - uint16 elevator = argv[0]; - uint16 direction = argv[1]; + uint16 elevator = args[0]; + uint16 direction = args[1]; Common::String movie; uint16 x; @@ -750,27 +750,27 @@ void Channelwood::o_elevatorMovies(uint16 op, uint16 var, uint16 argc, uint16 *a _vm->_sound->resumeBackground(); } -void Channelwood::o_soundReplace(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_soundReplace(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Play sound if not already playing", op); - uint16 soundId = argv[0]; + uint16 soundId = args[0]; if (!_vm->_sound->isEffectPlaying()) { _vm->_sound->playEffect(soundId); } } -void Channelwood::o_lever_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_lever_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generic lever init", op); _leverAction = getInvokingResource<MystArea>(); } -void Channelwood::o_pipeValve_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_pipeValve_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Water valve init", op); _valveVar = var; } -void Channelwood::o_drawer_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Channelwood::o_drawer_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sirius's drawer init", op); _siriusDrawerState = 0; } diff --git a/engines/mohawk/myst_stacks/channelwood.h b/engines/mohawk/myst_stacks/channelwood.h index ac875e52d8..c6c9be7376 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 b295255dfb..e8c5387528 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, uint16 argc, uint16 *argv) { +void Credits::o_runCredits(uint16 op, 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 c2c20372bd..923f98ba83 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 848736e37c..84261a8bd5 100644 --- a/engines/mohawk/myst_stacks/demo.cpp +++ b/engines/mohawk/myst_stacks/demo.cpp @@ -76,13 +76,13 @@ void Demo::runPersistentScripts() { } } -void Demo::o_stopIntro(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Demo::o_stopIntro(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Unk", op); // The original also seems to stop the movies. Not needed with this engine. _vm->_gfx->fadeToBlack(); } -void Demo::o_fadeFromBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Demo::o_fadeFromBlack(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Fade from black", op); // FIXME: This glitches when enabled. The backbuffer is drawn to screen, @@ -90,7 +90,7 @@ void Demo::o_fadeFromBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) { // _vm->_gfx->fadeFromBlack(); } -void Demo::o_fadeToBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Demo::o_fadeToBlack(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Fade to black", op); _vm->_gfx->fadeToBlack(); } @@ -122,7 +122,7 @@ void Demo::returnToMenu_run() { } } -void Demo::o_returnToMenu_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Demo::o_returnToMenu_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Return to menu init", op); // Used on Card 2001, 2002 and 2003 diff --git a/engines/mohawk/myst_stacks/demo.h b/engines/mohawk/myst_stacks/demo.h index 64a392502f..c2a8fce10c 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 8611662b69..bffb61eb79 100644 --- a/engines/mohawk/myst_stacks/dni.cpp +++ b/engines/mohawk/myst_stacks/dni.cpp @@ -95,7 +95,7 @@ uint16 Dni::getVar(uint16 var) { } } -void Dni::o_handPage(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Dni::o_handPage(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Hand page to Atrus", op); // Used in Card 5014 (Atrus) @@ -214,7 +214,7 @@ void Dni::atrus_run() { } } -void Dni::o_atrus_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Dni::o_atrus_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Atrus init", op); _atrusRunning = true; diff --git a/engines/mohawk/myst_stacks/dni.h b/engines/mohawk/myst_stacks/dni.h index 1a5f0911f9..75a35ec2e8 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 2797ba3ef5..d462a985e9 100644 --- a/engines/mohawk/myst_stacks/intro.cpp +++ b/engines/mohawk/myst_stacks/intro.cpp @@ -79,7 +79,7 @@ uint16 Intro::getVar(uint16 var) { } } -void Intro::o_useLinkBook(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Intro::o_useLinkBook(uint16 op, 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; @@ -146,7 +146,7 @@ void Intro::introMovies_run() { } } -void Intro::o_playIntroMovies(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Intro::o_playIntroMovies(uint16 op, uint16 var, const ArgumentsArray &args) { _introMoviesRunning = true; _introStep = 0; } @@ -165,7 +165,7 @@ void Intro::mystLinkBook_run() { } } -void Intro::o_mystLinkBook_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Intro::o_mystLinkBook_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Myst link book init", op); _linkBookMovie = getInvokingResource<MystAreaVideo>(); diff --git a/engines/mohawk/myst_stacks/intro.h b/engines/mohawk/myst_stacks/intro.h index 0095706795..266189b7a5 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 41f91bc3fa..ab4788b076 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 5a1b5e04ae..81fbf7821d 100644 --- a/engines/mohawk/myst_stacks/mechanical.cpp +++ b/engines/mohawk/myst_stacks/mechanical.cpp @@ -271,13 +271,13 @@ bool Mechanical::setVarValue(uint16 var, uint16 value) { return refresh; } -void Mechanical::o_throneEnablePassage(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_throneEnablePassage(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Enable throne passage", op); - _vm->_resources[argv[0]]->setEnabled(getVar(var)); + _vm->_resources[args[0]]->setEnabled(getVar(var)); } -void Mechanical::o_birdCrankStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_birdCrankStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Mechanical bird crank start", op); MystAreaDrag *crank = getInvokingResource<MystAreaDrag>(); @@ -292,7 +292,7 @@ void Mechanical::o_birdCrankStart(uint16 op, uint16 var, uint16 argc, uint16 *ar crankMovie->playMovie(); } -void Mechanical::o_birdCrankStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_birdCrankStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Mechanical bird crank stop", op); MystAreaDrag *crank = getInvokingResource<MystAreaDrag>(); @@ -309,14 +309,14 @@ void Mechanical::o_birdCrankStop(uint16 op, uint16 var, uint16 argc, uint16 *arg _bird->playMovie(); } -void Mechanical::o_snakeBoxTrigger(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_snakeBoxTrigger(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Trigger Playing Of Snake Movie", op); // Used on Mechanical Card 6043 (Weapons Rack with Snake Box) _snakeBox->playMovie(); } -void Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Play Stairs Movement Movie", op); VideoEntryPtr staircase = _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack)); @@ -334,7 +334,7 @@ void Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, uint16 argc, ui _vm->waitUntilMovieEnds(staircase); } -void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Elevator rotation lever start", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -348,7 +348,7 @@ void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, uint16 argc, uin _vm->_cursor->setCursor(700); } -void Mechanical::o_elevatorRotationMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_elevatorRotationMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Elevator rotation lever move", op); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -366,7 +366,7 @@ void Mechanical::o_elevatorRotationMove(uint16 op, uint16 var, uint16 argc, uint lever->drawFrame(step); } -void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Elevator rotation lever stop", op); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -414,7 +414,7 @@ void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, uint16 argc, uint _vm->checkCursorHints(); } -void Mechanical::o_fortressRotationSpeedStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressRotationSpeedStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation speed lever start", op); _vm->_cursor->setCursor(700); @@ -423,7 +423,7 @@ void Mechanical::o_fortressRotationSpeedStart(uint16 op, uint16 var, uint16 argc lever->drawFrame(0); } -void Mechanical::o_fortressRotationSpeedMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressRotationSpeedMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation speed lever move", op); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -441,7 +441,7 @@ void Mechanical::o_fortressRotationSpeedMove(uint16 op, uint16 var, uint16 argc, lever->drawFrame(step); } -void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation speed lever stop", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -457,7 +457,7 @@ void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, uint16 argc, _vm->checkCursorHints(); } -void Mechanical::o_fortressRotationBrakeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressRotationBrakeStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation brake lever start", op); _vm->_cursor->setCursor(700); @@ -466,7 +466,7 @@ void Mechanical::o_fortressRotationBrakeStart(uint16 op, uint16 var, uint16 argc lever->drawFrame(_fortressRotationBrake); } -void Mechanical::o_fortressRotationBrakeMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressRotationBrakeMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation brake lever move", op); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -484,7 +484,7 @@ void Mechanical::o_fortressRotationBrakeMove(uint16 op, uint16 var, uint16 argc, lever->drawFrame(step); } -void Mechanical::o_fortressRotationBrakeStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressRotationBrakeStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation brake lever stop", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -493,7 +493,7 @@ void Mechanical::o_fortressRotationBrakeStop(uint16 op, uint16 var, uint16 argc, _vm->checkCursorHints(); } -void Mechanical::o_fortressSimulationSpeedStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressSimulationSpeedStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever start", op); _vm->_cursor->setCursor(700); @@ -502,7 +502,7 @@ void Mechanical::o_fortressSimulationSpeedStart(uint16 op, uint16 var, uint16 ar lever->drawFrame(0); } -void Mechanical::o_fortressSimulationSpeedMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressSimulationSpeedMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever move", op); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -520,7 +520,7 @@ void Mechanical::o_fortressSimulationSpeedMove(uint16 op, uint16 var, uint16 arg lever->drawFrame(step); } -void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever stop", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -536,7 +536,7 @@ void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, uint16 arg _vm->checkCursorHints(); } -void Mechanical::o_fortressSimulationBrakeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressSimulationBrakeStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever start", op); _vm->_cursor->setCursor(700); @@ -545,7 +545,7 @@ void Mechanical::o_fortressSimulationBrakeStart(uint16 op, uint16 var, uint16 ar lever->drawFrame(_fortressSimulationBrake); } -void Mechanical::o_fortressSimulationBrakeMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressSimulationBrakeMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever move", op); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -563,7 +563,7 @@ void Mechanical::o_fortressSimulationBrakeMove(uint16 op, uint16 var, uint16 arg lever->drawFrame(step); } -void Mechanical::o_fortressSimulationBrakeStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressSimulationBrakeStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever stop", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -572,9 +572,9 @@ void Mechanical::o_fortressSimulationBrakeStop(uint16 op, uint16 var, uint16 arg _vm->checkCursorHints(); } -void Mechanical::o_elevatorWindowMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - uint16 startTime = argv[0]; - uint16 endTime = argv[1]; +void Mechanical::o_elevatorWindowMovie(uint16 op, 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); @@ -587,7 +587,7 @@ void Mechanical::o_elevatorWindowMovie(uint16 op, uint16 var, uint16 argc, uint1 _vm->waitUntilMovieEnds(window); } -void Mechanical::o_elevatorGoMiddle(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_elevatorGoMiddle(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Elevator go middle from top", op); _elevatorTooLate = false; @@ -634,7 +634,7 @@ void Mechanical::elevatorGoMiddle_run() { _vm->wait(500); _vm->_sound->playEffect(9120); static uint16 moviePos[2] = { 3540, 5380 }; - o_elevatorWindowMovie(121, 0, 2, moviePos); + o_elevatorWindowMovie(121, 0, ArgumentsArray(moviePos, ARRAYSIZE(moviePos))); _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); _vm->_sound->playEffect(10120); _vm->_cursor->showCursor(); @@ -647,9 +647,9 @@ void Mechanical::elevatorGoMiddle_run() { } } -void Mechanical::o_elevatorTopMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - uint16 startTime = argv[0]; - uint16 endTime = argv[1]; +void Mechanical::o_elevatorTopMovie(uint16 op, 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); @@ -662,7 +662,7 @@ void Mechanical::o_elevatorTopMovie(uint16 op, uint16 var, uint16 argc, uint16 * _vm->waitUntilMovieEnds(window); } -void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Set fortress position", op); VideoEntryPtr gears = _fortressRotationGears->getVideo(); @@ -676,13 +676,13 @@ void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, uint16 arg _fortressPosition = (moviePosition + 900) / 1800 % 4; } -void Mechanical::o_mystStaircaseMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_mystStaircaseMovie(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Myst book staircase video", op); _vm->playMovieBlocking(_vm->wrapMovieFilename("sstairs", kMechanicalStack), 199, 108); } -void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Wait for the elevator to go middle", op); // Wait while the elevator times out @@ -692,61 +692,61 @@ void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, uint16 argc, uint1 } } -void Mechanical::o_crystalEnterYellow(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_crystalEnterYellow(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Crystal enter", op); _crystalLit = 3; _vm->redrawArea(20); } -void Mechanical::o_crystalEnterGreen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_crystalEnterGreen(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Crystal enter", op); _crystalLit = 1; _vm->redrawArea(21); } -void Mechanical::o_crystalEnterRed(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_crystalEnterRed(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Crystal enter", op); _crystalLit = 2; _vm->redrawArea(22); } -void Mechanical::o_crystalLeaveYellow(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_crystalLeaveYellow(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Crystal leave", op); _crystalLit = 0; _vm->redrawArea(20); } -void Mechanical::o_crystalLeaveGreen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_crystalLeaveGreen(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Crystal leave", op); _crystalLit = 0; _vm->redrawArea(21); } -void Mechanical::o_crystalLeaveRed(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_crystalLeaveRed(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Crystal leave", op); _crystalLit = 0; _vm->redrawArea(22); } -void Mechanical::o_throne_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_throne_init(uint16 op, 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, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressStaircase_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Staircase init", op); - _vm->_resources[argv[0]]->setEnabled(!_state.staircaseState); - _vm->_resources[argv[1]]->setEnabled(!_state.staircaseState); - _vm->_resources[argv[2]]->setEnabled(_state.staircaseState); + _vm->_resources[args[0]]->setEnabled(!_state.staircaseState); + _vm->_resources[args[1]]->setEnabled(!_state.staircaseState); + _vm->_resources[args[2]]->setEnabled(_state.staircaseState); } void Mechanical::birdSing_run() { @@ -759,7 +759,7 @@ void Mechanical::birdSing_run() { } } -void Mechanical::o_bird_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_bird_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Mechanical bird init", op); _birdSinging = false; @@ -767,7 +767,7 @@ void Mechanical::o_bird_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _bird = getInvokingResource<MystAreaVideo>(); } -void Mechanical::o_snakeBox_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_snakeBox_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Snake box init", op); _snakeBox = getInvokingResource<MystAreaVideo>(); @@ -790,10 +790,10 @@ void Mechanical::elevatorRotation_run() { } } -void Mechanical::o_elevatorRotation_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_elevatorRotation_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Elevator rotation init", op); - _elevatorRotationSoundId = argv[0]; + _elevatorRotationSoundId = args[0]; _elevatorRotationGearPosition = 0; _elevatorRotationLeverMoving = false; } @@ -870,7 +870,7 @@ void Mechanical::fortressRotation_run() { } } -void Mechanical::o_fortressRotation_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressRotation_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Fortress rotation init", op); _fortressRotationGears = getInvokingResource<MystAreaVideo>(); @@ -880,10 +880,10 @@ void Mechanical::o_fortressRotation_init(uint16 op, uint16 var, uint16 argc, uin gears->seek(Audio::Timestamp(0, 1800 * _fortressPosition, 600)); gears->setRate(0); - _fortressRotationSounds[0] = argv[0]; - _fortressRotationSounds[1] = argv[1]; - _fortressRotationSounds[2] = argv[2]; - _fortressRotationSounds[3] = argv[3]; + _fortressRotationSounds[0] = args[0]; + _fortressRotationSounds[1] = args[1]; + _fortressRotationSounds[2] = args[2]; + _fortressRotationSounds[3] = args[3]; _fortressRotationBrake = 0; @@ -1020,18 +1020,18 @@ void Mechanical::fortressSimulation_run() { } } -void Mechanical::o_fortressSimulation_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressSimulation_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Fortress rotation simulator init", op); _fortressSimulationHolo = getInvokingResource<MystAreaVideo>(); - _fortressSimulationStartSound1 = argv[0]; - _fortressSimulationStartSound2 = argv[1]; + _fortressSimulationStartSound1 = args[0]; + _fortressSimulationStartSound2 = args[1]; - _fortressRotationSounds[0] = argv[2]; - _fortressRotationSounds[1] = argv[3]; - _fortressRotationSounds[2] = argv[4]; - _fortressRotationSounds[3] = argv[5]; + _fortressRotationSounds[0] = args[2]; + _fortressRotationSounds[1] = args[3]; + _fortressRotationSounds[2] = args[4]; + _fortressRotationSounds[3] = args[5]; _fortressSimulationBrake = 0; @@ -1042,7 +1042,7 @@ void Mechanical::o_fortressSimulation_init(uint16 op, uint16 var, uint16 argc, u _vm->_cursor->hideCursor(); } -void Mechanical::o_fortressSimulationStartup_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Mechanical::o_fortressSimulationStartup_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Fortress rotation simulator startup init", op); _fortressSimulationStartup = getInvokingResource<MystAreaVideo>(); diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h index aae02df433..585164fe1b 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 71747fa158..e9449b7c30 100644 --- a/engines/mohawk/myst_stacks/myst.cpp +++ b/engines/mohawk/myst_stacks/myst.cpp @@ -815,7 +815,7 @@ uint16 Myst::bookCountPages(uint16 var) { return cnt; } -void Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Turn book page left", op); if (_libraryBookPage - 1 >= 0) { @@ -831,7 +831,7 @@ void Myst::o_libraryBookPageTurnLeft(uint16 op, uint16 var, uint16 argc, uint16 } } -void Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Turn book page right", op); if (_libraryBookPage + 1 < _libraryBookNumPages) { @@ -847,11 +847,11 @@ void Myst::o_libraryBookPageTurnRight(uint16 op, uint16 var, uint16 argc, uint16 } } -void Myst::o_fireplaceToggleButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_fireplaceToggleButton(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Myst Card 4162 (Fireplace Grid) debugC(kDebugScript, "Opcode %d: Fireplace grid toggle button", op); - uint16 bitmask = argv[0]; + uint16 bitmask = args[0]; uint16 line = _fireplaceLines[var - 17]; debugC(kDebugScript, "\tvar: %d", var); @@ -874,9 +874,9 @@ void Myst::o_fireplaceToggleButton(uint16 op, uint16 var, uint16 argc, uint16 *a } } -void Myst::o_fireplaceRotation(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_fireplaceRotation(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Myst Card 4162 and 4166 (Fireplace Puzzle Rotation Movies) - uint16 movieNum = argv[0]; + uint16 movieNum = args[0]; debugC(kDebugScript, "Opcode %d: Play Fireplace Puzzle Rotation Movies", op); debugC(kDebugScript, "\tmovieNum: %d", movieNum); @@ -886,8 +886,8 @@ void Myst::o_fireplaceRotation(uint16 op, uint16 var, uint16 argc, uint16 *argv) _vm->playMovieBlocking(_vm->wrapMovieFilename("fpin", kMystStack), 167, 4); } -void Myst::o_courtyardBoxesCheckSolution(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - uint16 soundId = argv[0]; +void Myst::o_courtyardBoxesCheckSolution(uint16 op, uint16 var, const ArgumentsArray &args) { + uint16 soundId = args[0]; debugC(kDebugScript, "Opcode %d: Ship Puzzle Logic", op); debugC(kDebugScript, "\tsoundId: %d", soundId); @@ -906,7 +906,7 @@ void Myst::o_courtyardBoxesCheckSolution(uint16 op, uint16 var, uint16 argc, uin } } -void Myst::o_towerRotationStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_towerRotationStart(uint16 op, uint16 var, const ArgumentsArray &args) { _towerRotationBlinkLabel = false; _towerRotationMapClicked = true; _towerRotationSpeed = 0; @@ -921,7 +921,7 @@ void Myst::o_towerRotationStart(uint16 op, uint16 var, uint16 argc, uint16 *argv _vm->_sound->playEffect(5378, true); } -void Myst::o_towerRotationEnd(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_towerRotationEnd(uint16 op, uint16 var, const ArgumentsArray &args) { _towerRotationMapClicked = false; // Set angle value to expected value @@ -949,13 +949,13 @@ void Myst::o_towerRotationEnd(uint16 op, uint16 var, uint16 argc, uint16 *argv) _towerRotationBlinkLabelCount = 0; } -void Myst::o_imagerChangeSelection(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_imagerChangeSelection(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Dock imager change selection", op); if (_imagerValidationStep != 10) { _imagerValidationStep = 0; - int16 signedValue = argv[0]; + int16 signedValue = args[0]; uint16 d1 = (_state.imagerSelection / 10) % 10; uint16 d2 = _state.imagerSelection % 10; @@ -975,11 +975,11 @@ void Myst::o_imagerChangeSelection(uint16 op, uint16 var, uint16 argc, uint16 *a } } -void Myst::o_dockVaultOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_dockVaultOpen(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Myst 4143 (Dock near Marker Switch) - uint16 soundId = argv[0]; - uint16 delay = argv[1]; - uint16 directionalUpdateDataSize = argv[2]; + 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); @@ -1000,15 +1000,15 @@ void Myst::o_dockVaultOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _vm->_sound->playEffect(soundId); _vm->redrawArea(41, false); - animatedUpdate(directionalUpdateDataSize, &argv[3], delay); + animatedUpdate(ArgumentsArray(args.begin() + 3, directionalUpdateDataSize), delay); } } -void Myst::o_dockVaultClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_dockVaultClose(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Myst 4143 (Dock near Marker Switch) - uint16 soundId = argv[0]; - uint16 delay = argv[1]; - uint16 directionalUpdateDataSize = argv[2]; + 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); @@ -1027,14 +1027,14 @@ void Myst::o_dockVaultClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _vm->_sound->playEffect(soundId); _vm->redrawArea(41, false); - animatedUpdate(directionalUpdateDataSize, &argv[3], delay); + animatedUpdate(ArgumentsArray(args.begin() + 3, directionalUpdateDataSize), delay); } } -void Myst::o_bookGivePage(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - uint16 cardIdLose = argv[0]; - uint16 cardIdBookCover = argv[1]; - uint16 soundIdAddPage = argv[2]; +void Myst::o_bookGivePage(uint16 op, 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); @@ -1118,9 +1118,9 @@ void Myst::o_bookGivePage(uint16 op, uint16 var, uint16 argc, uint16 *argv) { } } -void Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockWheelsExecute(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Card 4006 (Clock Tower Time Controls) - uint16 soundId = argv[0]; + uint16 soundId = args[0]; debugC(kDebugScript, "Opcode %d: Clock Tower Bridge Puzzle Execute Button", op); @@ -1161,7 +1161,7 @@ void Myst::o_clockWheelsExecute(uint16 op, uint16 var, uint16 argc, uint16 *argv } } -void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_imagerPlayButton(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Imager play button", op); uint16 video = getVar(51); @@ -1183,7 +1183,7 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) // Play selected video if (!_state.imagerActive && video != 3) - _vm->_sound->playEffect(argv[0]); + _vm->_sound->playEffect(args[0]); switch (video) { case 0: // Nothing @@ -1220,7 +1220,7 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) _imagerMovie->setBlocking(false); if (_state.imagerActive) { - _vm->_sound->playEffect(argv[1]); + _vm->_sound->playEffect(args[1]); // Water disappearing VideoEntryPtr water = _imagerMovie->playMovie(); @@ -1247,13 +1247,13 @@ void Myst::o_imagerPlayButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) _vm->_cursor->showCursor(); } -void Myst::o_imagerEraseButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_imagerEraseButton(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Imager erase button", op); _imagerRedButton = static_cast<MystAreaImageSwitch *>(getInvokingResource<MystArea>()->_parent); for (uint i = 0; i < 4; i++) - _imagerSound[i] = argv[i]; - _imagerValidationCard = argv[4]; + _imagerSound[i] = args[i]; + _imagerValidationCard = args[4]; if (_imagerValidationStep == 0) { // Validation script is not running, run it @@ -1322,7 +1322,7 @@ void Myst::imagerValidation_run() { } } -void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Tower elevator animation", op); _treeStopped = true; @@ -1331,7 +1331,7 @@ void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, uint16 argc, uint16 * _vm->_sound->stopEffect(); _vm->_sound->pauseBackground(); - switch (argv[0]) { + switch (args[0]) { case 0: _vm->playMovieBlocking(_vm->wrapMovieFilename("libdown", kMystStack), 216, 78); break; @@ -1347,7 +1347,7 @@ void Myst::o_towerElevatorAnimation(uint16 op, uint16 var, uint16 argc, uint16 * _treeStopped = false; } -void Myst::o_generatorButtonPressed(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_generatorButtonPressed(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generator button pressed", op); MystArea *button = getInvokingResource<MystArea>()->_parent; @@ -1442,7 +1442,7 @@ void Myst::generatorButtonValue(MystArea *button, uint16 &mask, uint16 &value) { } } -void Myst::o_cabinSafeChangeDigit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_cabinSafeChangeDigit(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Cabin safe change digit", op); uint16 d1 = _state.cabinSafeCombination / 100; @@ -1461,7 +1461,7 @@ void Myst::o_cabinSafeChangeDigit(uint16 op, uint16 var, uint16 argc, uint16 *ar _vm->redrawArea(var); } -void Myst::o_cabinSafeHandleStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_cabinSafeHandleStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Cabin safe handle start move", op); // Used on Card 4100 @@ -1471,7 +1471,7 @@ void Myst::o_cabinSafeHandleStartMove(uint16 op, uint16 var, uint16 argc, uint16 _tempVar = 0; } -void Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Cabin safe handle move", op); // Used on Card 4100 @@ -1501,7 +1501,7 @@ void Myst::o_cabinSafeHandleMove(uint16 op, uint16 var, uint16 argc, uint16 *arg } } -void Myst::o_cabinSafeHandleEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_cabinSafeHandleEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Cabin safe handle end move", op); // Used on Card 4100 @@ -1510,7 +1510,7 @@ void Myst::o_cabinSafeHandleEndMove(uint16 op, uint16 var, uint16 argc, uint16 * _vm->checkCursorHints(); } -void Myst::o_observatoryMonthChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryMonthChangeStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Observatory month change start", op); _vm->_sound->pauseBackground(); @@ -1569,7 +1569,7 @@ void Myst::observatoryMonthChange_run() { observatoryIncrementMonth(_observatoryIncrement); } -void Myst::o_observatoryDayChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryDayChangeStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Observatory day change start", op); _vm->_sound->pauseBackground(); @@ -1629,7 +1629,7 @@ void Myst::observatoryDayChange_run() { observatoryIncrementDay(_observatoryIncrement); } -void Myst::o_observatoryYearChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryYearChangeStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Observatory year change start", op); _vm->_sound->pauseBackground(); @@ -1683,7 +1683,7 @@ void Myst::observatoryYearChange_run() { observatoryIncrementYear(_observatoryIncrement); } -void Myst::o_observatoryTimeChangeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryTimeChangeStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Observatory time change start", op); _vm->_sound->pauseBackground(); @@ -1742,7 +1742,7 @@ void Myst::observatoryTimeChange_run() { observatoryIncrementTime(_observatoryIncrement); } -void Myst::o_observatoryGoButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryGoButton(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Observatory go button", op); // Setting not at target @@ -1750,7 +1750,7 @@ void Myst::o_observatoryGoButton(uint16 op, uint16 var, uint16 argc, uint16 *arg || _state.observatoryMonthTarget != _state.observatoryMonthSetting || _state.observatoryYearTarget != _state.observatoryYearSetting || _state.observatoryTimeTarget != _state.observatoryTimeSetting) { - uint16 soundId = argv[0]; + uint16 soundId = args[0]; _vm->_sound->playEffect(soundId); int16 distance = _state.observatoryYearTarget - _state.observatoryYearSetting; @@ -1776,31 +1776,31 @@ void Myst::o_observatoryGoButton(uint16 op, uint16 var, uint16 argc, uint16 *arg } } -void Myst::o_observatoryMonthSliderMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryMonthSliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Month slider move", op); observatoryUpdateMonth(); } -void Myst::o_observatoryDaySliderMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryDaySliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Day slider move", op); observatoryUpdateDay(); } -void Myst::o_observatoryYearSliderMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryYearSliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Year slider move", op); observatoryUpdateYear(); } -void Myst::o_observatoryTimeSliderMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryTimeSliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Time slider move", op); observatoryUpdateTime(); } -void Myst::o_circuitBreakerStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_circuitBreakerStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Circuit breaker start move", op); MystVideoInfo *breaker = getInvokingResource<MystVideoInfo>(); @@ -1809,7 +1809,7 @@ void Myst::o_circuitBreakerStartMove(uint16 op, uint16 var, uint16 argc, uint16 _tempVar = 0; } -void Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_circuitBreakerMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Circuit breaker move", op); MystVideoInfo *breaker = getInvokingResource<MystVideoInfo>(); @@ -1860,7 +1860,7 @@ void Myst::o_circuitBreakerMove(uint16 op, uint16 var, uint16 argc, uint16 *argv } } -void Myst::o_circuitBreakerEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_circuitBreakerEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Circuit breaker end move", op); MystVideoInfo *breaker = getInvokingResource<MystVideoInfo>(); @@ -1868,7 +1868,7 @@ void Myst::o_circuitBreakerEndMove(uint16 op, uint16 var, uint16 argc, uint16 *a _vm->checkCursorHints(); } -void Myst::o_boilerIncreasePressureStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_boilerIncreasePressureStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Boiler increase pressure start", op); _treeStopped = true; @@ -1878,7 +1878,7 @@ void Myst::o_boilerIncreasePressureStart(uint16 op, uint16 var, uint16 argc, uin _boilerPressureIncreasing = true; } -void Myst::o_boilerLightPilot(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_boilerLightPilot(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Boiler light pilot", op); // Match is lit @@ -1940,7 +1940,7 @@ void Myst::boilerResetGauge(const Common::Rational &rate) { _cabinGaugeMovie->setRate(rate); } -void Myst::o_boilerIncreasePressureStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_boilerIncreasePressureStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Boiler increase pressure stop", op); _treeStopped = false; @@ -2006,7 +2006,7 @@ void Myst::boilerPressureDecrease_run() { } } -void Myst::o_boilerDecreasePressureStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_boilerDecreasePressureStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Boiler decrease pressure start", op); _treeStopped = true; @@ -2015,7 +2015,7 @@ void Myst::o_boilerDecreasePressureStart(uint16 op, uint16 var, uint16 argc, uin _boilerPressureDecreasing = true; } -void Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Boiler decrease pressure stop", op); _treeStopped = false; @@ -2038,14 +2038,14 @@ void Myst::o_boilerDecreasePressureStop(uint16 op, uint16 var, uint16 argc, uint } } -void Myst::o_basementIncreasePressureStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_basementIncreasePressureStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Basement increase pressure start", op); _treeStopped = true; _basementPressureIncreasing = true; } -void Myst::o_basementIncreasePressureStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_basementIncreasePressureStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Basement increase pressure stop", op); _treeStopped = false; @@ -2079,14 +2079,14 @@ void Myst::basementPressureDecrease_run() { } } -void Myst::o_basementDecreasePressureStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_basementDecreasePressureStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Basement decrease pressure start", op); _treeStopped = true; _basementPressureDecreasing = true; } -void Myst::o_basementDecreasePressureStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_basementDecreasePressureStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Basement decrease pressure stop", op); _treeStopped = false; @@ -2163,7 +2163,7 @@ uint32 Myst::treeNextMoveDelay(uint16 pressure) { return 25000 * pressure / 13 + 3000; } -void Myst::o_rocketSoundSliderStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketSoundSliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket slider start move", op); _rocketSliderSound = 0; @@ -2172,13 +2172,13 @@ void Myst::o_rocketSoundSliderStartMove(uint16 op, uint16 var, uint16 argc, uint rocketSliderMove(); } -void Myst::o_rocketSoundSliderMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketSoundSliderMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket slider move", op); rocketSliderMove(); } -void Myst::o_rocketSoundSliderEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketSoundSliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket slider end move", op); _vm->checkCursorHints(); @@ -2295,7 +2295,7 @@ void Myst::rocketCheckSolution() { _vm->_cursor->showCursor(); } -void Myst::o_rocketPianoStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketPianoStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket piano start move", op); MystAreaDrag *key = getInvokingResource<MystAreaDrag>(); @@ -2319,7 +2319,7 @@ void Myst::o_rocketPianoStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) } } -void Myst::o_rocketPianoMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketPianoMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket piano move", op); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); @@ -2366,7 +2366,7 @@ void Myst::o_rocketPianoMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { } } -void Myst::o_rocketPianoStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketPianoStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket piano end move", op); MystAreaImageSwitch *key = getInvokingResource<MystAreaImageSwitch>(); @@ -2383,7 +2383,7 @@ void Myst::o_rocketPianoStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _vm->_sound->resumeBackground(); } -void Myst::o_rocketLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketLeverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket lever start move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -2393,7 +2393,7 @@ void Myst::o_rocketLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *ar lever->drawFrame(0); } -void Myst::o_rocketOpenBook(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketOpenBook(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket open link book", op); // Flyby movie @@ -2403,7 +2403,7 @@ void Myst::o_rocketOpenBook(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _tempVar = 2; } -void Myst::o_rocketLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket lever move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -2432,7 +2432,7 @@ void Myst::o_rocketLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _rocketLeverPosition = step; } -void Myst::o_rocketLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket lever end move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -2442,7 +2442,7 @@ void Myst::o_rocketLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv lever->drawFrame(0); } -void Myst::o_cabinLeave(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_cabinLeave(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Leave cabin", op); // If match is lit, put out @@ -2454,7 +2454,7 @@ void Myst::o_cabinLeave(uint16 op, uint16 var, uint16 argc, uint16 *argv) { } } -void Myst::o_treePressureReleaseStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_treePressureReleaseStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Tree pressure release start", op); Common::Rect src = Common::Rect(0, 0, 49, 86); @@ -2470,7 +2470,7 @@ void Myst::o_treePressureReleaseStart(uint16 op, uint16 var, uint16 argc, uint16 } } -void Myst::o_treePressureReleaseStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_treePressureReleaseStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Tree pressure release stop", op); Common::Rect rect = Common::Rect(78, 46, 127, 132); @@ -2480,7 +2480,7 @@ void Myst::o_treePressureReleaseStop(uint16 op, uint16 var, uint16 argc, uint16 _treeMinPosition = 0; } -void Myst::o_observatoryMonthSliderStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryMonthSliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Month slider start move", op); _vm->_cursor->setCursor(700); @@ -2489,7 +2489,7 @@ void Myst::o_observatoryMonthSliderStartMove(uint16 op, uint16 var, uint16 argc, observatoryUpdateMonth(); } -void Myst::o_observatoryMonthSliderEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryMonthSliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Month slider end move", op); _vm->checkCursorHints(); @@ -2511,7 +2511,7 @@ void Myst::observatoryUpdateMonth() { } } -void Myst::o_observatoryDaySliderStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryDaySliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Day slider start move", op); _vm->_cursor->setCursor(700); @@ -2520,7 +2520,7 @@ void Myst::o_observatoryDaySliderStartMove(uint16 op, uint16 var, uint16 argc, u observatoryUpdateDay(); } -void Myst::o_observatoryDaySliderEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryDaySliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Day slider end move", op); _vm->checkCursorHints(); @@ -2543,7 +2543,7 @@ void Myst::observatoryUpdateDay() { } } -void Myst::o_observatoryYearSliderStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryYearSliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Year slider start move", op); _vm->_cursor->setCursor(700); @@ -2552,7 +2552,7 @@ void Myst::o_observatoryYearSliderStartMove(uint16 op, uint16 var, uint16 argc, observatoryUpdateYear(); } -void Myst::o_observatoryYearSliderEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryYearSliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Year slider end move", op); _vm->checkCursorHints(); @@ -2577,7 +2577,7 @@ void Myst::observatoryUpdateYear() { } } -void Myst::o_observatoryTimeSliderStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryTimeSliderStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Time slider start move", op); _vm->_cursor->setCursor(700); @@ -2586,7 +2586,7 @@ void Myst::o_observatoryTimeSliderStartMove(uint16 op, uint16 var, uint16 argc, observatoryUpdateTime(); } -void Myst::o_observatoryTimeSliderEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryTimeSliderEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Time slider end move", op); _vm->checkCursorHints(); @@ -2615,12 +2615,12 @@ void Myst::observatoryUpdateTime() { } } -void Myst::o_libraryCombinationBookStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_libraryCombinationBookStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Combination book stop turning pages", op); _libraryCombinationBookPagesTurning = false; } -void Myst::o_cabinMatchLight(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_cabinMatchLight(uint16 op, uint16 var, const ArgumentsArray &args) { if (!_cabinMatchState) { _vm->_sound->playEffect(4103); @@ -2659,34 +2659,34 @@ void Myst::matchBurn_run() { } } -void Myst::o_courtyardBoxEnter(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_courtyardBoxEnter(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Mouse enters courtyard box", op); _tempVar = 1; _vm->_sound->playEffect(_courtyardBoxSound); _vm->redrawArea(var); } -void Myst::o_courtyardBoxLeave(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_courtyardBoxLeave(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Mouse leaves courtyard box", op); _tempVar = 0; _vm->redrawArea(var); } -void Myst::o_clockMinuteWheelStartTurn(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockMinuteWheelStartTurn(uint16 op, 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, uint16 argc, uint16 *argv) { +void Myst::o_clockWheelEndTurn(uint16 op, 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, uint16 argc, uint16 *argv) { +void Myst::o_clockHourWheelStartTurn(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Card 4006 debugC(kDebugScript, "Opcode %d: Hour wheel start turn", op); @@ -2739,7 +2739,7 @@ void Myst::clockWheelTurn(uint16 var) { } } -void Myst::o_libraryCombinationBookStartRight(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_libraryCombinationBookStartRight(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Combination book start turning pages right", op); _tempVar = 0; @@ -2748,7 +2748,7 @@ void Myst::o_libraryCombinationBookStartRight(uint16 op, uint16 var, uint16 argc _libraryCombinationBookPagesTurning = true; } -void Myst::o_libraryCombinationBookStartLeft(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_libraryCombinationBookStartLeft(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Combination book start turning pages left", op); _tempVar = 0; @@ -2818,7 +2818,7 @@ void Myst::libraryCombinationBook_run() { } } -void Myst::o_observatoryChangeSettingStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatoryChangeSettingStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Observatory change setting stop", op); // Stop persistent scripts @@ -2837,11 +2837,11 @@ void Myst::o_observatoryChangeSettingStop(uint16 op, uint16 var, uint16 argc, ui _vm->_sound->resumeBackground(); } -void Myst::o_dockVaultForceClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_dockVaultForceClose(uint16 op, uint16 var, const ArgumentsArray &args) { // Used on Myst 4143 (Dock near Marker Switch) - uint16 soundId = argv[0]; - uint16 delay = argv[1]; - uint16 directionalUpdateDataSize = argv[2]; + 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); @@ -2857,16 +2857,16 @@ void Myst::o_dockVaultForceClose(uint16 op, uint16 var, uint16 argc, uint16 *arg _dockVaultState = 0; _vm->_sound->playEffect(soundId); _vm->redrawArea(41, false); - animatedUpdate(directionalUpdateDataSize, &argv[3], delay); + animatedUpdate(ArgumentsArray(args.begin() + 3, directionalUpdateDataSize), delay); } } -void Myst::o_imagerEraseStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_imagerEraseStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Imager stop erase", op); _imagerValidationRunning = false; } -void Myst::o_clockLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockLeverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Clock lever start move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); lever->drawFrame(0); @@ -2875,7 +2875,7 @@ void Myst::o_clockLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *arg _clockLeverPulled = false; } -void Myst::o_clockLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Clock left lever move", op); if (!_clockLeverPulled) { @@ -2953,7 +2953,7 @@ void Myst::clockGears_run() { } } -void Myst::o_clockLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Clock lever end move", op); static const char *videos[] = { "cl1wg1", "cl1wg2", "cl1wg3", "cl1wlfch" }; @@ -3012,7 +3012,7 @@ void Myst::clockGearsCheckSolution() { } } -void Myst::o_clockResetLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockResetLeverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Clock reset lever start move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -3020,7 +3020,7 @@ void Myst::o_clockResetLeverStartMove(uint16 op, uint16 var, uint16 argc, uint16 _vm->_cursor->setCursor(700); } -void Myst::o_clockResetLeverMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockResetLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Clock reset lever move", op); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); @@ -3117,7 +3117,7 @@ void Myst::clockResetGear(uint16 gear) { _clockGearsPositions[gear] = 3; } -void Myst::o_clockResetLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockResetLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Clock reset lever end move", op); // Get current lever frame @@ -3128,18 +3128,18 @@ void Myst::o_clockResetLeverEndMove(uint16 op, uint16 var, uint16 argc, uint16 * _vm->checkCursorHints(); } -void Myst::o_libraryBook_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_libraryBook_init(uint16 op, uint16 var, const ArgumentsArray &args) { _libraryBookPage = 0; - _libraryBookNumPages = argv[0]; - _libraryBookBaseImage = argv[1]; - _libraryBookSound1 = argv[2]; - _libraryBookSound2 = argv[3]; + _libraryBookNumPages = args[0]; + _libraryBookBaseImage = args[1]; + _libraryBookSound1 = args[2]; + _libraryBookSound2 = args[3]; } -void Myst::o_courtyardBox_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_courtyardBox_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Courtyard box init", op); - _courtyardBoxSound = argv[0]; + _courtyardBoxSound = args[0]; } void Myst::towerRotationMap_run() { @@ -3182,10 +3182,10 @@ void Myst::towerRotationMap_run() { } } -void Myst::o_towerRotationMap_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_towerRotationMap_init(uint16 op, uint16 var, const ArgumentsArray &args) { _towerRotationMapRunning = true; _towerRotationMapTower = getInvokingResource<MystAreaImageSwitch>(); - _towerRotationMapLabel = _vm->getViewResource<MystAreaImageSwitch>(argv[0]); + _towerRotationMapLabel = _vm->getViewResource<MystAreaImageSwitch>(args[0]); _tempVar = 0; _startTime = 0; _towerRotationMapClicked = false; @@ -3298,20 +3298,20 @@ void Myst::towerRotationMapRotate() { towerRotationMapDrawLine(center, end); } -void Myst::o_forechamberDoor_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_forechamberDoor_init(uint16 op, 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, uint16 argc, uint16 *argv) { +void Myst::o_shipAccess_init(uint16 op, 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, uint16 argc, uint16 *argv) { +void Myst::o_butterflies_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Butterflies movie init", op); // Used for Card 4256 (Butterfly Movie Activation) @@ -3323,7 +3323,7 @@ void Myst::o_butterflies_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) } } -void Myst::o_imager_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_imager_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Imager init", op); debugC(kDebugScript, "Var: %d", var); @@ -3369,11 +3369,11 @@ void Myst::libraryBookcaseTransform_run(void) { } } -void Myst::o_libraryBookcaseTransform_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_libraryBookcaseTransform_init(uint16 op, uint16 var, const ArgumentsArray &args) { if (_libraryBookcaseChanged) { MystAreaActionSwitch *resource = getInvokingResource<MystAreaActionSwitch>(); _libraryBookcaseMovie = static_cast<MystAreaVideo *>(resource->getSubResource(getVar(0))); - _libraryBookcaseSoundId = argv[0]; + _libraryBookcaseSoundId = args[0]; _libraryBookcaseMoving = true; } } @@ -3395,14 +3395,14 @@ void Myst::generatorControlRoom_run(void) { } } -void Myst::o_generatorControlRoom_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_generatorControlRoom_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generator control room init", op); _generatorVoltage = _state.generatorVoltage; _generatorControlRoomRunning = true; } -void Myst::o_fireplace_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_fireplace_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Fireplace grid init", op); // Clear fireplace grid @@ -3410,7 +3410,7 @@ void Myst::o_fireplace_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _fireplaceLines[i] = 0; } -void Myst::o_clockGears_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_clockGears_init(uint16 op, uint16 var, const ArgumentsArray &args) { // Used for Card 4113 (Clock Tower Cog Puzzle) debugC(kDebugScript, "Opcode %d: Gears puzzle init", op); @@ -3428,7 +3428,7 @@ void Myst::o_clockGears_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { } } -void Myst::o_gulls1_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_gulls1_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Gulls init", op); if (!_state.shipFloating) { @@ -3460,22 +3460,22 @@ void Myst::gullsFly1_run() { } } -void Myst::o_observatory_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_observatory_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Stellar observatory init", op); _tempVar = 0; _observatoryNotInitialized = true; _observatoryVisualizer = getInvokingResource<MystAreaImageSwitch>(); - _observatoryGoButton = _vm->getViewResource<MystAreaImageSwitch>(argv[0]); + _observatoryGoButton = _vm->getViewResource<MystAreaImageSwitch>(args[0]); if (observatoryIsDDMMYYYY2400()) { - _observatoryDaySlider = _vm->getViewResource<MystAreaSlider>(argv[1]); - _observatoryMonthSlider = _vm->getViewResource<MystAreaSlider>(argv[2]); + _observatoryDaySlider = _vm->getViewResource<MystAreaSlider>(args[1]); + _observatoryMonthSlider = _vm->getViewResource<MystAreaSlider>(args[2]); } else { - _observatoryMonthSlider = _vm->getViewResource<MystAreaSlider>(argv[1]); - _observatoryDaySlider = _vm->getViewResource<MystAreaSlider>(argv[2]); + _observatoryMonthSlider = _vm->getViewResource<MystAreaSlider>(args[1]); + _observatoryDaySlider = _vm->getViewResource<MystAreaSlider>(args[2]); } - _observatoryYearSlider = _vm->getViewResource<MystAreaSlider>(argv[3]); - _observatoryTimeSlider = _vm->getViewResource<MystAreaSlider>(argv[4]); + _observatoryYearSlider = _vm->getViewResource<MystAreaSlider>(args[3]); + _observatoryTimeSlider = _vm->getViewResource<MystAreaSlider>(args[4]); // Set date selection sliders position _observatoryDaySlider->setPosition(_state.observatoryDaySlider); @@ -3579,7 +3579,7 @@ void Myst::observatory_run() { } } -void Myst::o_gulls2_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_gulls2_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Gulls init", op); if (!_state.shipFloating) { @@ -3605,23 +3605,23 @@ void Myst::gullsFly2_run() { } } -void Myst::o_treeCard_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_treeCard_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Enter tree card", op); _tree = getInvokingResource<MystAreaImageSwitch>(); } -void Myst::o_treeEntry_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_treeEntry_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Enter tree card with entry", op); _treeAlcove = getInvokingResource<MystArea>(); - _treeMinAccessiblePosition = argv[0]; - _treeMaxAccessiblePosition = argv[1]; + _treeMinAccessiblePosition = args[0]; + _treeMaxAccessiblePosition = args[1]; treeSetAlcoveAccessible(); } -void Myst::o_boilerMovies_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_boilerMovies_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Boiler movies init", op); boilerFireInit(); @@ -3697,14 +3697,14 @@ void Myst::boilerGaugeInit() { _cabinGaugeMovieEnabled = true; } -void Myst::o_rocketSliders_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketSliders_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket sliders init", op); - _rocketSlider1 = _vm->getViewResource<MystAreaSlider>(argv[0]); - _rocketSlider2 = _vm->getViewResource<MystAreaSlider>(argv[1]); - _rocketSlider3 = _vm->getViewResource<MystAreaSlider>(argv[2]); - _rocketSlider4 = _vm->getViewResource<MystAreaSlider>(argv[3]); - _rocketSlider5 = _vm->getViewResource<MystAreaSlider>(argv[4]); + _rocketSlider1 = _vm->getViewResource<MystAreaSlider>(args[0]); + _rocketSlider2 = _vm->getViewResource<MystAreaSlider>(args[1]); + _rocketSlider3 = _vm->getViewResource<MystAreaSlider>(args[2]); + _rocketSlider4 = _vm->getViewResource<MystAreaSlider>(args[3]); + _rocketSlider5 = _vm->getViewResource<MystAreaSlider>(args[4]); // Initialize sliders position for (uint i = 0; i < 5; i++) @@ -3718,12 +3718,12 @@ void Myst::o_rocketSliders_init(uint16 op, uint16 var, uint16 argc, uint16 *argv _rocketSlider5->setPosition(_state.rocketSliderPosition[4]); } -void Myst::o_rocketLinkVideo_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_rocketLinkVideo_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Rocket link video init", op); _tempVar = 0; } -void Myst::o_greenBook_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_greenBook_init(uint16 op, uint16 var, const ArgumentsArray &args) { // Used for Card 4168 (Green Book Movies) debugC(kDebugScript, "Opcode %d: Green book init", op); @@ -3775,7 +3775,7 @@ void Myst::greenBook_run() { } } -void Myst::o_gulls3_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_gulls3_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Gulls init", op); if (!_state.shipFloating) { @@ -3803,7 +3803,7 @@ void Myst::gullsFly3_run() { } } -void Myst::o_bookAddSpecialPage_exit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_bookAddSpecialPage_exit(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Book Exit Function", op); uint16 numPages = bookCountPages(var); @@ -3817,19 +3817,19 @@ void Myst::o_bookAddSpecialPage_exit(uint16 op, uint16 var, uint16 argc, uint16 } } -void Myst::o_treeCard_exit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_treeCard_exit(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Exit tree card", op); _tree = nullptr; } -void Myst::o_treeEntry_exit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_treeEntry_exit(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Exit tree card with entry", op); _treeAlcove = nullptr; } -void Myst::o_boiler_exit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_boiler_exit(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Exit boiler card", op); _cabinGaugeMovie = VideoEntryPtr(); @@ -3838,7 +3838,7 @@ void Myst::o_boiler_exit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _cabinGaugeMovieEnabled = false; } -void Myst::o_generatorControlRoom_exit(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Myst::o_generatorControlRoom_exit(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generator room exit", op); _generatorVoltage = _state.generatorVoltage; diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h index 870daa8c68..f3c9087d58 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) class Myst : public MystScriptParser { public: diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp index 3a2524d59a..db657e5920 100644 --- a/engines/mohawk/myst_stacks/preview.cpp +++ b/engines/mohawk/myst_stacks/preview.cpp @@ -79,18 +79,18 @@ void Preview::runPersistentScripts() { speech_run(); } -void Preview::o_fadeToBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Preview::o_fadeToBlack(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Fade to black", op); _vm->_gfx->fadeToBlack(); } -void Preview::o_fadeFromBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Preview::o_fadeFromBlack(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Fade from black", op); _vm->_gfx->fadeFromBlack(); } -void Preview::o_stayHere(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Preview::o_stayHere(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Stay here dialog", op); // Nuh-uh! No leaving the library in the demo! @@ -98,7 +98,7 @@ void Preview::o_stayHere(uint16 op, uint16 var, uint16 argc, uint16 *argv) { dialog.runModal(); } -void Preview::o_speechStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Preview::o_speechStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Speech stop", op); _vm->_sound->stopSpeech(); @@ -225,7 +225,7 @@ void Preview::speech_run() { } } -void Preview::o_speech_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Preview::o_speech_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Speech init", op); // Used for Card 3000 (Closed Myst Book) @@ -233,18 +233,18 @@ void Preview::o_speech_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { _speechRunning = true; } -void Preview::o_library_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Preview::o_library_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Library init", op); // Used for Card 3002 (Myst Island Overview) _library = getInvokingResource<MystAreaImageSwitch>(); } -void Preview::o_libraryBookcaseTransformDemo_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Preview::o_libraryBookcaseTransformDemo_init(uint16 op, uint16 var, const ArgumentsArray &args) { if (_libraryBookcaseChanged) { MystAreaActionSwitch *resource = getInvokingResource<MystAreaActionSwitch>(); _libraryBookcaseMovie = static_cast<MystAreaVideo *>(resource->getSubResource(getVar(303))); - _libraryBookcaseSoundId = argv[0]; + _libraryBookcaseSoundId = args[0]; _libraryBookcaseMoving = true; } } diff --git a/engines/mohawk/myst_stacks/preview.h b/engines/mohawk/myst_stacks/preview.h index 7a818a182c..dbbd6c2c63 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 774efcd0b7..fe1a64a257 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, uint16 argc, uint16 *argv) { +void Selenitic::o_mazeRunnerMove(uint16 op, uint16 var, const ArgumentsArray &args) { uint16 oldPosition = _mazeRunnerPosition; uint16 move = var; @@ -566,14 +566,14 @@ void Selenitic::mazeRunnerPlaySoundHelp() { _mazeRunnerLight->drawConditionalDataToScreen(0); } -void Selenitic::o_mazeRunnerSoundRepeat(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_mazeRunnerSoundRepeat(uint16 op, uint16 var, const ArgumentsArray &args) { mazeRunnerPlaySoundHelp(); } /** * Sound receiver sigma button */ -void Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound receiver sigma button", op); _vm->_cursor->hideCursor(); @@ -625,7 +625,7 @@ void Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, uint16 argc, uint16 /** * Sound receiver right button */ -void Selenitic::o_soundReceiverRight(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundReceiverRight(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound receiver right", op); soundReceiverLeftRight(1); @@ -634,7 +634,7 @@ void Selenitic::o_soundReceiverRight(uint16 op, uint16 var, uint16 argc, uint16 /** * Sound receiver left button */ -void Selenitic::o_soundReceiverLeft(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundReceiverLeft(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound receiver left", op); soundReceiverLeftRight(2); @@ -697,7 +697,7 @@ void Selenitic::soundReceiverDrawAngle() { /** * Sound receiver source selection buttons */ -void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound receiver source", op); if (_soundReceiverSigmaPressed) { @@ -719,7 +719,7 @@ void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, uint16 argc, uint16 _vm->_sound->stopEffect(); - uint16 soundId = argv[0]; + uint16 soundId = args[0]; _vm->_sound->stopBackground(); _vm->_sound->playEffect(soundId); @@ -731,23 +731,24 @@ void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, uint16 argc, uint16 _vm->_cursor->showCursor(); } -void Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, const ArgumentsArray &args) { // Used for Selenitic Maze Runner Exit Logic - uint16 cardIdExit = argv[0]; - uint16 cardIdEntry = argv[1]; + uint16 cardIdExit = args[0]; + uint16 cardIdEntry = args[1]; + uint16 updateDataSize = args[2]; if (_mazeRunnerPosition == 288) { _vm->changeToCard(cardIdEntry, kNoTransition); _vm->_sound->playEffect(cardIdEntry); - animatedUpdate(argv[2], &argv[3], 10); + animatedUpdate(ArgumentsArray(args.begin() + 3, updateDataSize), 10); } else if (_mazeRunnerPosition == 289) { _vm->changeToCard(cardIdExit, kNoTransition); _vm->_sound->playEffect(cardIdExit); - animatedUpdate(argv[2], &argv[3], 10); + animatedUpdate(ArgumentsArray(args.begin() + 3, updateDataSize), 10); } } -void Selenitic::o_soundReceiverUpdateSound(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundReceiverUpdateSound(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound receiver update sound", op); soundReceiverUpdateSound(); @@ -795,7 +796,7 @@ MystAreaSlider *Selenitic::soundLockSliderFromVar(uint16 var) { return nullptr; } -void Selenitic::o_soundLockMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundLockMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound lock move", op); MystAreaSlider *slider = soundLockSliderFromVar(var); @@ -807,7 +808,7 @@ void Selenitic::o_soundLockMove(uint16 op, uint16 var, uint16 argc, uint16 *argv } } -void Selenitic::o_soundLockStartMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundLockStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound lock start move", op); MystAreaSlider *slider = soundLockSliderFromVar(var); @@ -819,7 +820,7 @@ void Selenitic::o_soundLockStartMove(uint16 op, uint16 var, uint16 argc, uint16 _vm->_sound->playEffect(_soundLockSoundId, true); } -void Selenitic::o_soundLockEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundLockEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound lock end move", op); MystAreaSlider *slider = soundLockSliderFromVar(var); @@ -878,7 +879,7 @@ void Selenitic::soundLockCheckSolution(MystAreaSlider *slider, uint16 value, uin _vm->_sound->stopEffect(); } -void Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundLockButton(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound lock button", op); bool solved = true; @@ -900,15 +901,18 @@ void Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 argc, uint16 *ar if (solved) { _soundLockButton->drawConditionalDataToScreen(2); - uint16 cardIdClosed = argv[0]; - uint16 cardIdOpen = argv[1]; + uint16 cardIdClosed = args[0]; + uint16 cardIdOpen = args[1]; _vm->changeToCard(cardIdClosed, kTransitionDissolve); _vm->changeToCard(cardIdOpen, kNoTransition); - _vm->_sound->playEffect(argv[2]); + _vm->_sound->playEffect(args[2]); - animatedUpdate(argv[4], &argv[5], argv[3]); + uint16 animationDelay = args[3]; + uint16 animationDataSize = args[4]; + + animatedUpdate(ArgumentsArray(args.begin() + 5, animationDataSize), animationDelay); } else { _soundLockButton->drawConditionalDataToScreen(0); } @@ -916,7 +920,7 @@ void Selenitic::o_soundLockButton(uint16 op, uint16 var, uint16 argc, uint16 *ar _vm->_cursor->showCursor(); } -void Selenitic::o_soundReceiverEndMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundReceiverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound receiver end move", op); uint16 oldDirection = _soundReceiverDirection; @@ -933,15 +937,15 @@ void Selenitic::o_soundReceiverEndMove(uint16 op, uint16 var, uint16 argc, uint1 } } -void Selenitic::o_mazeRunnerCompass_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_mazeRunnerCompass_init(uint16 op, uint16 var, const ArgumentsArray &args) { _mazeRunnerCompass = getInvokingResource<MystAreaImageSwitch>(); } -void Selenitic::o_mazeRunnerWindow_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_mazeRunnerWindow_init(uint16 op, uint16 var, const ArgumentsArray &args) { _mazeRunnerWindow = getInvokingResource<MystAreaImageSwitch>(); } -void Selenitic::o_mazeRunnerLight_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_mazeRunnerLight_init(uint16 op, uint16 var, const ArgumentsArray &args) { _mazeRunnerLight = getInvokingResource<MystAreaImageSwitch>(); } @@ -1061,7 +1065,7 @@ void Selenitic::soundReceiverSolution(uint16 source, uint16 &solution, bool &ena } } -void Selenitic::o_soundReceiver_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundReceiver_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound receiver init", op); // Used for Card 1245 (Sound Receiver) @@ -1090,7 +1094,7 @@ void Selenitic::o_soundReceiver_init(uint16 op, uint16 var, uint16 argc, uint16 _soundReceiverSigmaPressed = false; } -void Selenitic::o_soundLock_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_soundLock_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Sound lock init", op); for (uint i = 0; i < _vm->_resources.size(); i++) { @@ -1125,11 +1129,11 @@ void Selenitic::o_soundLock_init(uint16 op, uint16 var, uint16 argc, uint16 *arg _soundLockSoundId = 0; } -void Selenitic::o_mazeRunnerRight_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_mazeRunnerRight_init(uint16 op, uint16 var, const ArgumentsArray &args) { _mazeRunnerRightButton = getInvokingResource<MystAreaImageSwitch>(); } -void Selenitic::o_mazeRunnerLeft_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Selenitic::o_mazeRunnerLeft_init(uint16 op, 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 fc9649755d..706bee52a0 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 0560608b24..851ce84c96 100644 --- a/engines/mohawk/myst_stacks/slides.cpp +++ b/engines/mohawk/myst_stacks/slides.cpp @@ -68,15 +68,15 @@ void Slides::runPersistentScripts() { } } -void Slides::o_returnToMenu(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Slides::o_returnToMenu(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Return to menu", op); // Go to the information screens of the menu _vm->changeToStack(kDemoStack, 2002, 0, 0); } -void Slides::o_setCardSwap(uint16 op, uint16 var, uint16 argc, uint16 *argv) { - _nextCardID = argv[0]; +void Slides::o_setCardSwap(uint16 op, uint16 var, const ArgumentsArray &args) { + _nextCardID = args[0]; debugC(kDebugScript, "Opcode %d: Set next card %d", op, _nextCardID); diff --git a/engines/mohawk/myst_stacks/slides.h b/engines/mohawk/myst_stacks/slides.h index a0c9ae5821..6215447816 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, 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 706bd72163..6196618d90 100644 --- a/engines/mohawk/myst_stacks/stoneship.cpp +++ b/engines/mohawk/myst_stacks/stoneship.cpp @@ -383,7 +383,7 @@ bool Stoneship::setVarValue(uint16 var, uint16 value) { return refresh; } -void Stoneship::o_pumpTurnOff(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_pumpTurnOff(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Turn off previous pump selection", op); if (_state.pumpState) { @@ -413,19 +413,19 @@ void Stoneship::o_pumpTurnOff(uint16 op, uint16 var, uint16 argc, uint16 *argv) } } -void Stoneship::o_brotherDoorOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_brotherDoorOpen(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Open brother door", op); _brotherDoorOpen = 1; _vm->redrawArea(19, 0); - animatedUpdate(argc, argv, 5); + animatedUpdate(args, 5); } -void Stoneship::o_cabinBookMovie(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_cabinBookMovie(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Play Book Room Movie", op); - uint16 startTime = argv[0]; - uint16 endTime = argv[1]; + uint16 startTime = args[0]; + uint16 endTime = args[1]; VideoEntryPtr book = _vm->_video->playMovie(_vm->wrapMovieFilename("bkroom", kStoneshipStack)); if (!book) @@ -436,10 +436,10 @@ void Stoneship::o_cabinBookMovie(uint16 op, uint16 var, uint16 argc, uint16 *arg _vm->waitUntilMovieEnds(book); } -void Stoneship::o_drawerOpenSirius(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_drawerOpenSirius(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Open drawer", op); - MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(argv[0]); + MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(args[0]); if (drawer->getImageSwitchVar() == 35) { drawer->drawConditionalDataToScreen(getVar(102), 0); @@ -448,24 +448,24 @@ void Stoneship::o_drawerOpenSirius(uint16 op, uint16 var, uint16 argc, uint16 *a } TransitionType transition = kTransitionTopToBottom; - if (argc == 2 && argv[1]) + if (args.size() == 2 && args[1]) transition = kTransitionCopy; _vm->_gfx->runTransition(transition, drawer->getRect(), 25, 5); } -void Stoneship::o_drawerClose(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_drawerClose(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Close drawer", op); - drawerClose(argv[0]); + drawerClose(args[0]); } -void Stoneship::o_telescopeStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_telescopeStart(uint16 op, 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, uint16 argc, uint16 *argv) { +void Stoneship::o_telescopeMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Telescope move", op); MystAreaDrag *display = getInvokingResource<MystAreaDrag>(); @@ -483,11 +483,11 @@ void Stoneship::o_telescopeMove(uint16 op, uint16 var, uint16 argc, uint16 *argv telescopeLighthouseDraw(); } -void Stoneship::o_telescopeStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_telescopeStop(uint16 op, uint16 var, const ArgumentsArray &args) { _vm->checkCursorHints(); } -void Stoneship::o_generatorStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_generatorStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generator start", op); MystAreaDrag *handle = getInvokingResource<MystAreaDrag>(); @@ -513,7 +513,7 @@ void Stoneship::o_generatorStart(uint16 op, uint16 var, uint16 argc, uint16 *arg _vm->_sound->playEffect(soundId, true); } -void Stoneship::o_generatorStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_generatorStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Generator stop", op); _batteryCharging = false; @@ -580,21 +580,21 @@ void Stoneship::batteryDeplete_run() { } } -void Stoneship::o_drawerOpenAchenar(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_drawerOpenAchenar(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Open drawer", op); - MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(argv[0]); + 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, uint16 argc, uint16 *argv) { +void Stoneship::o_hologramPlayback(uint16 op, 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 = argv[0]; - uint16 endPoint = argv[1]; - // uint16 direction = argv[2]; + uint16 startPoint = args[0]; + uint16 endPoint = args[1]; + // uint16 direction = args[2]; _hologramDisplay->setBlocking(false); VideoEntryPtr displayMovie = _hologramDisplay->playMovie(); @@ -610,12 +610,12 @@ void Stoneship::o_hologramPlayback(uint16 op, uint16 var, uint16 argc, uint16 *a _vm->waitUntilMovieEnds(displayMovie); } -void Stoneship::o_hologramSelectionStart(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_hologramSelectionStart(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Hologram start move", op); //_vm->_cursor->setCursor(0); } -void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Hologram move", op); MystAreaDrag *handle = getInvokingResource<MystAreaDrag>(); @@ -642,16 +642,16 @@ void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, uint16 argc, uint } } -void Stoneship::o_hologramSelectionStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_hologramSelectionStop(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Hologram stop move", op); _vm->checkCursorHints(); } -void Stoneship::o_compassButton(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_compassButton(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Compass rose button pressed", op); // Used on Card 2111 (Compass Rose) // Called when Button Clicked. - uint16 correctButton = argv[0]; + uint16 correctButton = args[0]; if (correctButton) { // Correct Button -> Light On Logic @@ -666,10 +666,10 @@ void Stoneship::o_compassButton(uint16 op, uint16 var, uint16 argc, uint16 *argv _batteryDepleting = false; } - o_redrawCard(op, var, argc, argv); + o_redrawCard(op, var, args); } -void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_chestValveVideos(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Chest valve videos", op); Common::String movie = _vm->wrapMovieFilename("ligspig", kStoneshipStack); @@ -721,7 +721,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, uint16 argc, uint16 *a } } -void Stoneship::o_chestDropKey(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_chestDropKey(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: drop chest key", op); // If holding Key to Lamp Room Trapdoor, drop to bottom of @@ -732,7 +732,7 @@ void Stoneship::o_chestDropKey(uint16 op, uint16 var, uint16 argc, uint16 *argv) } } -void Stoneship::o_trapLockOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_trapLockOpen(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Trap lock open video", op); Common::String movie = _vm->wrapMovieFilename("openloc", kStoneshipStack); @@ -759,9 +759,9 @@ void Stoneship::o_trapLockOpen(uint16 op, uint16 var, uint16 argc, uint16 *argv) _vm->_sound->playEffect(4143); } -void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, const ArgumentsArray &args) { // Used for Cards 2285, 2289, 2247, 2251 (Side Doors in Tunnels Down To Brothers Rooms) - uint16 movieId = argv[0]; + uint16 movieId = args[0]; debugC(kDebugScript, "Opcode %d: Play Side Door Movies", op); debugC(kDebugScript, "\tmovieId: %d", movieId); @@ -795,14 +795,14 @@ void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, uint16 argc, uint16 *ar _vm->_cursor->showCursor(); } -void Stoneship::o_cloudOrbEnter(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_cloudOrbEnter(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Cloud orb enter", op); _vm->_sound->playEffect(_cloudOrbSound, true); _cloudOrbMovie->playMovie(); } -void Stoneship::o_cloudOrbLeave(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_cloudOrbLeave(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Cloud orb leave", op); _cloudOrbMovie->pauseMovie(true); @@ -810,12 +810,12 @@ void Stoneship::o_cloudOrbLeave(uint16 op, uint16 var, uint16 argc, uint16 *argv _vm->_gfx->runTransition(kTransitionTopToBottom, getInvokingResource<MystArea>()->getRect(), 4, 0); } -void Stoneship::o_drawerCloseOpened(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_drawerCloseOpened(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Close open drawer", op); uint16 drawerOpen = getVar(var); if (drawerOpen) - drawerClose(argv[0] + drawerOpen - 1); + drawerClose(args[0] + drawerOpen - 1); } void Stoneship::drawerClose(uint16 drawer) { @@ -827,14 +827,14 @@ void Stoneship::drawerClose(uint16 drawer) { _vm->_gfx->runTransition(kTransitionBottomToTop, res->getRect(), 25, 5); } -void Stoneship::o_hologramDisplay_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_hologramDisplay_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Hologram display init", op); _hologramDisplay = getInvokingResource<MystAreaVideo>(); _hologramDisplayPos = 0; } -void Stoneship::o_hologramSelection_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_hologramSelection_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Hologram selection init", op); _hologramSelection = getInvokingResource<MystAreaVideo>(); } @@ -853,7 +853,7 @@ void Stoneship::batteryGaugeUpdate() { _batteryGauge->setRect(rect); } -void Stoneship::o_battery_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_battery_init(uint16 op, uint16 var, const ArgumentsArray &args) { // Used for Card 2160 (Lighthouse Battery Pack Closeup) debugC(kDebugScript, "Opcode %d: Battery init", op); @@ -862,16 +862,16 @@ void Stoneship::o_battery_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) batteryGaugeUpdate(); } -void Stoneship::o_tunnelEnter_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_tunnelEnter_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Tunnel enter", op); - o_tunnel_init(op, var, argc, argv); + o_tunnel_init(op, var, args); _tunnelRunning = true; _tunnelNextTime = _vm->_system->getMillis() + 1500; } -void Stoneship::o_batteryGauge_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_batteryGauge_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Battery gauge init", op); _batteryLastCharge = batteryRemainingCharge(); _batteryGaugeRunning = true; @@ -892,18 +892,18 @@ void Stoneship::batteryGauge_run() { } } -void Stoneship::o_tunnel_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_tunnel_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Tunnel card init", op); - _tunnelImagesCount = argv[0]; + _tunnelImagesCount = args[0]; assert(_tunnelImagesCount <= 2 && "Too many images"); for (uint i = 0; i < _tunnelImagesCount; i++) { - _tunnelImages[i] = argv[i + 1]; + _tunnelImages[i] = args[i + 1]; } - _tunnelAlarmSound = argv[argc - 1]; + _tunnelAlarmSound = args[args.size() - 1]; debugC(kDebugScript, "\timage count: %d", _tunnelImagesCount); debugC(kDebugScript, "\tsoundIdAlarm: %d", _tunnelAlarmSound); @@ -930,25 +930,25 @@ void Stoneship::tunnel_run() { } } -void Stoneship::o_tunnelLeave_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_tunnelLeave_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Tunnel leave", op); _tunnelRunning = false; } -void Stoneship::o_chest_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_chest_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Chest init", op); _state.chestOpenState = 0; } -void Stoneship::o_telescope_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_telescope_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Telescope init", op); // Used in Card 2218 (Telescope view) - _telescopePanorama = argv[0]; - _telescopeLighthouseOff = argv[1]; - _telescopeLighthouseOn = argv[2]; + _telescopePanorama = args[0]; + _telescopeLighthouseOff = args[1]; + _telescopeLighthouseOn = args[2]; _telescopePosition = 0; _telescopeRunning = true; @@ -990,30 +990,30 @@ void Stoneship::telescopeLighthouseDraw() { } } -void Stoneship::o_achenarDrawers_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_achenarDrawers_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Achenar's Room Drawers Init", op); // Used for Card 2004 (Achenar's Room Drawers) if (!_chestAchenarBottomDrawerClosed) { - uint16 count1 = argv[0]; + uint16 count1 = args[0]; for (uint16 i = 0; i < count1; i++) { - debugC(kDebugScript, "Disable hotspot index %d", argv[i + 1]); - _vm->setResourceEnabled(argv[i + 1], false); + debugC(kDebugScript, "Disable hotspot index %d", args[i + 1]); + _vm->setResourceEnabled(args[i + 1], false); } - uint16 count2 = argv[count1 + 1]; + uint16 count2 = args[count1 + 1]; for (uint16 i = 0; i < count2; i++) { - debugC(kDebugScript, "Enable hotspot index %d", argv[i + count1 + 2]); - _vm->setResourceEnabled(argv[i + count1 + 2], true); + debugC(kDebugScript, "Enable hotspot index %d", args[i + count1 + 2]); + _vm->setResourceEnabled(args[i + count1 + 2], true); } } } -void Stoneship::o_cloudOrb_init(uint16 op, uint16 var, uint16 argc, uint16 *argv) { +void Stoneship::o_cloudOrb_init(uint16 op, uint16 var, const ArgumentsArray &args) { debugC(kDebugScript, "Opcode %d: Cloud orb init", op); _cloudOrbMovie = getInvokingResource<MystAreaVideo>(); - _cloudOrbSound = argv[0]; - _cloudOrbStopSound = argv[1]; + _cloudOrbSound = args[0]; + _cloudOrbStopSound = args[1]; } } // End of namespace MystStacks diff --git a/engines/mohawk/myst_stacks/stoneship.h b/engines/mohawk/myst_stacks/stoneship.h index 776641a787..b98c41042d 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, uint16 argc, uint16 *argv) +#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) class Stoneship : public MystScriptParser { public: |