MOHAWK: Myst: Improve script execution tracing

This commit is contained in:
Bastien Bouclet 2017-07-22 12:12:02 +02:00
parent 3e99dd8ccc
commit a99397f126
25 changed files with 432 additions and 941 deletions

View file

@ -28,6 +28,7 @@
#include "mohawk/myst_sound.h" #include "mohawk/myst_sound.h"
#include "mohawk/video.h" #include "mohawk/video.h"
#include "common/debug-channels.h"
#include "common/system.h" #include "common/system.h"
#include "common/memstream.h" #include "common/memstream.h"
#include "common/textconsole.h" #include "common/textconsole.h"
@ -100,8 +101,8 @@ void MystScriptParser::setupCommonOpcodes() {
OPCODE(4, o_redrawCard); OPCODE(4, o_redrawCard);
// Opcode 5 Not Present // Opcode 5 Not Present
OPCODE(6, o_goToDestForward); OPCODE(6, o_goToDestForward);
OPCODE(7, o_goToDestLeft); OPCODE(7, o_goToDestRight);
OPCODE(8, o_goToDestRight); OPCODE(8, o_goToDestLeft);
OPCODE(9, o_triggerMovie); OPCODE(9, o_triggerMovie);
OPCODE(10, o_toggleVarNoRedraw); OPCODE(10, o_toggleVarNoRedraw);
// Opcode 11 Not Present // Opcode 11 Not Present
@ -150,13 +151,10 @@ void MystScriptParser::setupCommonOpcodes() {
#undef OPCODE #undef OPCODE
void MystScriptParser::runScript(MystScript script, MystArea *invokingResource) { void MystScriptParser::runScript(MystScript script, MystArea *invokingResource) {
debugC(kDebugScript, "Script Size: %d", script->size());
_scriptNestingLevel++; _scriptNestingLevel++;
for (uint16 i = 0; i < script->size(); i++) { for (uint16 i = 0; i < script->size(); i++) {
MystScriptEntry &entry = (*script)[i]; MystScriptEntry &entry = (*script)[i];
debugC(kDebugScript, "\tOpcode %d: %d", i, entry.opcode);
if (entry.type == kMystScriptNormal) if (entry.type == kMystScriptNormal)
_invokingResource = invokingResource; _invokingResource = invokingResource;
@ -175,7 +173,11 @@ void MystScriptParser::runOpcode(uint16 op, uint16 var, const ArgumentsArray &ar
bool ranOpcode = false; bool ranOpcode = false;
for (uint16 i = 0; i < _opcodes.size(); i++) for (uint16 i = 0; i < _opcodes.size(); i++)
if (_opcodes[i]->op == op) { if (_opcodes[i]->op == op) {
(this->*(_opcodes[i]->proc)) (op, var, args); if (DebugMan.isDebugChannelEnabled(kDebugScript)) {
debugC(kDebugScript, "Running command: %s", describeCommand(*_opcodes[i], var, args).c_str());
}
(this->*(_opcodes[i]->proc)) (var, args);
ranOpcode = true; ranOpcode = true;
break; break;
} }
@ -198,6 +200,22 @@ const Common::String MystScriptParser::getOpcodeDesc(uint16 op) {
return Common::String::format("%d", op); return Common::String::format("%d", op);
} }
Common::String MystScriptParser::describeCommand(const MystOpcode &command, uint16 var, const ArgumentsArray &args) {
Common::String desc = Common::String::format("%s(", command.desc);
if (var != 0) {
desc += Common::String::format("var = %d%s", var, args.size() != 0 ? ", " : "");
}
for (uint16 j = 0; j < args.size(); j++) {
desc += Common::String::format("%d", args[j]);
if (j != args.size() - 1)
desc += ", ";
}
desc += ")";
return desc;
}
MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, MystScriptType type) { MystScript MystScriptParser::readScript(Common::SeekableReadStream *stream, MystScriptType type) {
assert(stream); assert(stream);
assert(type != kMystScriptNone); assert(type != kMystScriptNone);
@ -280,44 +298,22 @@ void MystScriptParser::animatedUpdate(const ArgumentsArray &args, uint16 delay)
} }
} }
void MystScriptParser::unknown(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::NOP(uint16 var, const ArgumentsArray &args) {
warning("Unimplemented opcode 0x%02x (%d)", op, op);
warning("\tUses var %d", var);
warning("\tArg count = %d", args.size());
if (!args.empty()) {
Common::String str;
str += Common::String::format("%d", args[0]);
for (uint16 i = 1; i < args.size(); i++)
str += Common::String::format(", %d", args[i]);
warning("\tArgs: %s\n", str.c_str());
}
} }
void MystScriptParser::NOP(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_toggleVar(uint16 var, const ArgumentsArray &args) {
}
void MystScriptParser::o_toggleVar(uint16 op, uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Toggle var %d", op, var);
toggleVar(var); toggleVar(var);
_vm->redrawArea(var); _vm->redrawArea(var);
} }
void MystScriptParser::o_setVar(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_setVar(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Set var %d: %d", op, var, args[0]);
if (setVarValue(var, args[0])) if (setVarValue(var, args[0]))
_vm->redrawArea(var); _vm->redrawArea(var);
} }
void MystScriptParser::o_changeCardSwitch4(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeCardSwitch4(uint16 var, const ArgumentsArray &args) {
uint16 value = getVar(var); uint16 value = getVar(var);
debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value);
if (value) if (value)
_vm->changeToCard(args[value -1 ], kTransitionDissolve); _vm->changeToCard(args[value -1 ], kTransitionDissolve);
else if (_invokingResource != nullptr) else if (_invokingResource != nullptr)
@ -326,11 +322,9 @@ void MystScriptParser::o_changeCardSwitch4(uint16 op, uint16 var, const Argument
warning("Missing invokingResource in altDest call"); warning("Missing invokingResource in altDest call");
} }
void MystScriptParser::o_changeCardSwitchLtR(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeCardSwitchLtR(uint16 var, const ArgumentsArray &args) {
uint16 value = getVar(var); uint16 value = getVar(var);
debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value);
if (value) if (value)
_vm->changeToCard(args[value -1 ], kTransitionLeftToRight); _vm->changeToCard(args[value -1 ], kTransitionLeftToRight);
else if (_invokingResource != nullptr) else if (_invokingResource != nullptr)
@ -339,11 +333,9 @@ void MystScriptParser::o_changeCardSwitchLtR(uint16 op, uint16 var, const Argume
warning("Missing invokingResource in altDest call"); warning("Missing invokingResource in altDest call");
} }
void MystScriptParser::o_changeCardSwitchRtL(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeCardSwitchRtL(uint16 var, const ArgumentsArray &args) {
uint16 value = getVar(var); uint16 value = getVar(var);
debugC(kDebugScript, "Opcode %d: changeCardSwitch var %d: %d", op, var, value);
if (value) if (value)
_vm->changeToCard(args[value -1 ], kTransitionRightToLeft); _vm->changeToCard(args[value -1 ], kTransitionRightToLeft);
else if (_invokingResource != nullptr) else if (_invokingResource != nullptr)
@ -352,7 +344,7 @@ void MystScriptParser::o_changeCardSwitchRtL(uint16 op, uint16 var, const Argume
warning("Missing invokingResource in altDest call"); warning("Missing invokingResource in altDest call");
} }
void MystScriptParser::o_takePage(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_takePage(uint16 var, const ArgumentsArray &args) {
// In most game releases, the first opcode argument is the new mouse cursor. // 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. // However, in the original v1.0 English release this opcode takes no argument.
uint16 cursorId; // = args[0]; uint16 cursorId; // = args[0];
@ -375,8 +367,6 @@ void MystScriptParser::o_takePage(uint16 op, uint16 var, const ArgumentsArray &a
uint16 oldPage = _globals.heldPage; uint16 oldPage = _globals.heldPage;
debugC(kDebugScript, "Opcode %d: takePage Var %d CursorId %d", op, var, cursorId);
// Take / drop page // Take / drop page
toggleVar(var); toggleVar(var);
@ -394,61 +384,48 @@ void MystScriptParser::o_takePage(uint16 op, uint16 var, const ArgumentsArray &a
} }
} }
void MystScriptParser::o_redrawCard(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_redrawCard(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Redraw card", op);
_vm->drawCardBackground(); _vm->drawCardBackground();
_vm->drawResourceImages(); _vm->drawResourceImages();
_vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
} }
void MystScriptParser::o_goToDest(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_goToDest(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op);
if (_invokingResource != nullptr) if (_invokingResource != nullptr)
_vm->changeToCard(_invokingResource->getDest(), kTransitionCopy); _vm->changeToCard(_invokingResource->getDest(), kTransitionCopy);
else else
warning("Opcode %d: Missing invokingResource", op); warning("Opcode o_goToDest: Missing invokingResource");
} }
void MystScriptParser::o_goToDestForward(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_goToDestForward(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op);
if (_invokingResource != nullptr) if (_invokingResource != nullptr)
_vm->changeToCard(_invokingResource->getDest(), kTransitionDissolve); _vm->changeToCard(_invokingResource->getDest(), kTransitionDissolve);
else else
warning("Opcode %d: Missing invokingResource", op); warning("Opcode o_goToDestForward: Missing invokingResource");
} }
void MystScriptParser::o_goToDestLeft(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_goToDestRight(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op);
if (_invokingResource != nullptr) if (_invokingResource != nullptr)
_vm->changeToCard(_invokingResource->getDest(), kTransitionPartToRight); _vm->changeToCard(_invokingResource->getDest(), kTransitionPartToRight);
else else
warning("Opcode %d: Missing invokingResource", op); warning("Opcode o_goToDestRight: Missing invokingResource");
} }
void MystScriptParser::o_goToDestRight(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_goToDestLeft(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op);
if (_invokingResource != nullptr) if (_invokingResource != nullptr)
_vm->changeToCard(_invokingResource->getDest(), kTransitionPartToLeft); _vm->changeToCard(_invokingResource->getDest(), kTransitionPartToLeft);
else else
warning("Opcode %d: Missing invokingResource", op); warning("Opcode o_goToDestLeft: Missing invokingResource");
} }
void MystScriptParser::o_goToDestUp(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_goToDestUp(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Change To Dest of Invoking Resource", op);
if (_invokingResource != nullptr) if (_invokingResource != nullptr)
_vm->changeToCard(_invokingResource->getDest(), kTransitionTopToBottom); _vm->changeToCard(_invokingResource->getDest(), kTransitionTopToBottom);
else else
warning("Opcode %d: Missing invokingResource", op); warning("Opcode o_goToDestUp: Missing invokingResource");
} }
void MystScriptParser::o_triggerMovie(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_triggerMovie(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, // 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 // if the movie has a sound track, as well as code to resume it afterwards. But since
// the movie has not yet been loaded at this point, it is impossible to know // the movie has not yet been loaded at this point, it is impossible to know
@ -458,46 +435,31 @@ void MystScriptParser::o_triggerMovie(uint16 op, uint16 var, const ArgumentsArra
if (args.size() == 1) if (args.size() == 1)
direction = args[0]; direction = args[0];
debugC(kDebugScript, "\tDirection: %d", direction);
// Trigger resource 6 movie overriding play direction // Trigger resource 6 movie overriding play direction
MystAreaVideo *resource = getInvokingResource<MystAreaVideo>(); MystAreaVideo *resource = getInvokingResource<MystAreaVideo>();
resource->setDirection(direction); resource->setDirection(direction);
resource->playMovie(); resource->playMovie();
} }
void MystScriptParser::o_toggleVarNoRedraw(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_toggleVarNoRedraw(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: toggleVarNoRedraw", op);
toggleVar(var); toggleVar(var);
} }
void MystScriptParser::o_drawAreaState(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_drawAreaState(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); MystAreaImageSwitch *parent = static_cast<MystAreaImageSwitch *>(getInvokingResource<MystArea>()->_parent);
parent->drawConditionalDataToScreen(args[0]); parent->drawConditionalDataToScreen(args[0]);
} }
void MystScriptParser::o_redrawAreaForVar(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_redrawAreaForVar(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: redraw area", op);
debugC(kDebugScript, "\tvar: %d", var);
_vm->redrawArea(var); _vm->redrawArea(var);
} }
void MystScriptParser::o_changeCardDirectional(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeCardDirectional(uint16 var, const ArgumentsArray &args) {
// Used by Channelwood Card 3262 (In Elevator) // Used by Channelwood Card 3262 (In Elevator)
debugC(kDebugScript, "Opcode %d: Change Card with optional directional update", op);
uint16 cardId = args[0]; uint16 cardId = args[0];
uint16 directionalUpdateDataSize = args[1]; uint16 directionalUpdateDataSize = args[1];
debugC(kDebugScript, "\tcardId: %d", cardId);
debugC(kDebugScript, "\tdirectonal update data size: %d", directionalUpdateDataSize);
_vm->changeToCard(cardId, kNoTransition); _vm->changeToCard(cardId, kNoTransition);
animatedUpdate(ArgumentsArray(args.begin() + 2, directionalUpdateDataSize), 0); animatedUpdate(ArgumentsArray(args.begin() + 2, directionalUpdateDataSize), 0);
@ -507,24 +469,16 @@ void MystScriptParser::o_changeCardDirectional(uint16 op, uint16 var, const Argu
// but with the current cardId stored. // but with the current cardId stored.
// Opcode 18 then "pops" this stored CardId and returns to that card. // Opcode 18 then "pops" this stored CardId and returns to that card.
void MystScriptParser::o_changeCardPush(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeCardPush(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Jump to Card Id, Storing Current Card Id", op);
_savedCardId = _vm->getCurCard(); _savedCardId = _vm->getCurCard();
uint16 cardId = args[0]; uint16 cardId = args[0];
TransitionType transition = static_cast<TransitionType>(args[1]); TransitionType transition = static_cast<TransitionType>(args[1]);
debugC(kDebugScript, "\tCurrent CardId: %d", _savedCardId);
debugC(kDebugScript, "\tJump to CardId: %d", cardId);
_vm->changeToCard(cardId, transition); _vm->changeToCard(cardId, transition);
} }
void MystScriptParser::o_changeCardPop(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeCardPop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Return To Stored Card Id", op);
debugC(kDebugScript, "\tCardId: %d", _savedCardId);
if (_savedCardId == 0) { if (_savedCardId == 0) {
warning("No pushed card to go back to"); warning("No pushed card to go back to");
return; return;
@ -535,14 +489,10 @@ void MystScriptParser::o_changeCardPop(uint16 op, uint16 var, const ArgumentsArr
_vm->changeToCard(_savedCardId, transition); _vm->changeToCard(_savedCardId, transition);
} }
void MystScriptParser::o_enableAreas(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_enableAreas(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Enable Hotspots", op);
uint16 count = args[0]; uint16 count = args[0];
for (uint16 i = 0; i < count; i++) { for (uint16 i = 0; i < count; i++) {
debugC(kDebugScript, "Enable hotspot index %d", args[i + 1]);
MystArea *resource = nullptr; MystArea *resource = nullptr;
if (args[i + 1] == 0xFFFF) if (args[i + 1] == 0xFFFF)
resource = _invokingResource; resource = _invokingResource;
@ -556,14 +506,10 @@ void MystScriptParser::o_enableAreas(uint16 op, uint16 var, const ArgumentsArray
} }
} }
void MystScriptParser::o_disableAreas(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_disableAreas(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Disable Hotspots", op);
uint16 count = args[0]; uint16 count = args[0];
for (uint16 i = 0; i < count; i++) { for (uint16 i = 0; i < count; i++) {
debugC(kDebugScript, "Disable hotspot index %d", args[i + 1]);
MystArea *resource = nullptr; MystArea *resource = nullptr;
if (args[i + 1] == 0xFFFF) if (args[i + 1] == 0xFFFF)
resource = _invokingResource; resource = _invokingResource;
@ -577,20 +523,14 @@ void MystScriptParser::o_disableAreas(uint16 op, uint16 var, const ArgumentsArra
} }
} }
void MystScriptParser::o_directionalUpdate(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_directionalUpdate(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Transition / Directional update", op);
animatedUpdate(args, 0); animatedUpdate(args, 0);
} }
void MystScriptParser::o_toggleAreasActivation(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_toggleAreasActivation(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Toggle areas activation", op);
uint16 count = args[0]; uint16 count = args[0];
for (uint16 i = 0; i < count; i++) { for (uint16 i = 0; i < count; i++) {
debugC(kDebugScript, "Enable/Disable hotspot index %d", args[i + 1]);
MystArea *resource = nullptr; MystArea *resource = nullptr;
if (args[i + 1] == 0xFFFF) if (args[i + 1] == 0xFFFF)
resource = _invokingResource; resource = _invokingResource;
@ -604,33 +544,24 @@ void MystScriptParser::o_toggleAreasActivation(uint16 op, uint16 var, const Argu
} }
} }
void MystScriptParser::o_playSound(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_playSound(uint16 var, const ArgumentsArray &args) {
uint16 soundId = args[0]; uint16 soundId = args[0];
debugC(kDebugScript, "Opcode %d: playSound", op);
debugC(kDebugScript, "\tsoundId: %d", soundId);
_vm->_sound->playEffect(soundId); _vm->_sound->playEffect(soundId);
} }
void MystScriptParser::o_stopSoundBackground(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_stopSoundBackground(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: stopSoundBackground", op);
_vm->_sound->stopBackground(); _vm->_sound->stopBackground();
} }
void MystScriptParser::o_playSoundBlocking(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_playSoundBlocking(uint16 var, const ArgumentsArray &args) {
uint16 soundId = args[0]; uint16 soundId = args[0];
debugC(kDebugScript, "Opcode %d: playSoundBlocking", op);
debugC(kDebugScript, "\tsoundId: %d", soundId);
_vm->_sound->stopEffect(); _vm->_sound->stopEffect();
_vm->playSoundBlocking(soundId); _vm->playSoundBlocking(soundId);
} }
void MystScriptParser::o_copyBackBufferToScreen(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_copyBackBufferToScreen(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Copy back buffer to screen", op);
Common::Rect rect; Common::Rect rect;
if (args[0] == 0xFFFF) { if (args[0] == 0xFFFF) {
// Used in Stoneship Card 2111 (Compass Rose) // Used in Stoneship Card 2111 (Compass Rose)
@ -648,7 +579,7 @@ void MystScriptParser::o_copyBackBufferToScreen(uint16 op, uint16 var, const Arg
_vm->_gfx->copyBackBufferToScreen(rect); _vm->_gfx->copyBackBufferToScreen(rect);
} }
void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_copyImageToBackBuffer(uint16 var, const ArgumentsArray &args) {
uint16 imageId = args[0]; uint16 imageId = args[0];
// WORKAROUND wrong image id in mechanical staircase // WORKAROUND wrong image id in mechanical staircase
@ -668,8 +599,6 @@ void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, const Argu
dstRect.right = dstRect.left + srcRect.width(); dstRect.right = dstRect.left + srcRect.width();
dstRect.bottom = dstRect.top + srcRect.height(); dstRect.bottom = dstRect.top + srcRect.height();
debugC(kDebugScript, "Opcode %d: Copy image to back buffer", op);
debugC(kDebugScript, "\timageId: %d", imageId);
debugC(kDebugScript, "\tsrcRect.left: %d", srcRect.left); debugC(kDebugScript, "\tsrcRect.left: %d", srcRect.left);
debugC(kDebugScript, "\tsrcRect.top: %d", srcRect.top); debugC(kDebugScript, "\tsrcRect.top: %d", srcRect.top);
debugC(kDebugScript, "\tsrcRect.right: %d", srcRect.right); debugC(kDebugScript, "\tsrcRect.right: %d", srcRect.right);
@ -682,11 +611,9 @@ void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, const Argu
_vm->_gfx->copyImageSectionToBackBuffer(imageId, srcRect, dstRect); _vm->_gfx->copyImageSectionToBackBuffer(imageId, srcRect, dstRect);
} }
void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeBackgroundSound(uint16 var, const ArgumentsArray &args) {
// Used on Stoneship Card 2080 // Used on Stoneship Card 2080
// Used on Channelwood Card 3225 with argc = 8 i.e. Conditional Sound List // 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); Common::MemoryWriteStreamDynamic writeStream = Common::MemoryWriteStreamDynamic(DisposeAfterUse::YES);
for (uint i = 0; i < args.size(); i++) { for (uint i = 0; i < args.size(); i++) {
writeStream.writeUint16LE(args[i]); writeStream.writeUint16LE(args[i]);
@ -698,27 +625,21 @@ void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, const Argu
_vm->applySoundBlock(soundBlock); _vm->applySoundBlock(soundBlock);
} }
void MystScriptParser::o_soundPlaySwitch(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_soundPlaySwitch(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Switch Choice of Play Sound", op);
uint16 value = getVar(var); uint16 value = getVar(var);
if (value < args.size()) { if (value < args.size()) {
uint16 soundId = args[value]; uint16 soundId = args[value];
debugC(kDebugScript, "\tvar: %d", var);
debugC(kDebugScript, "\tsoundId: %d", soundId);
if (soundId) if (soundId)
_vm->_sound->playEffect(soundId); _vm->_sound->playEffect(soundId);
} }
} }
void MystScriptParser::o_soundResumeBackground(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_soundResumeBackground(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: soundResumeBackground", op);
_vm->_sound->resumeBackground(); _vm->_sound->resumeBackground();
} }
void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_copyImageToScreen(uint16 var, const ArgumentsArray &args) {
uint16 imageId = args[0]; uint16 imageId = args[0];
Common::Rect srcRect = Common::Rect(args[1], args[2], args[3], args[4]); Common::Rect srcRect = Common::Rect(args[1], args[2], args[3], args[4]);
@ -734,8 +655,6 @@ void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, const Argument
dstRect.right = dstRect.left + srcRect.width(); dstRect.right = dstRect.left + srcRect.width();
dstRect.bottom = dstRect.top + srcRect.height(); dstRect.bottom = dstRect.top + srcRect.height();
debugC(kDebugScript, "Opcode %d: Copy image to screen", op);
debugC(kDebugScript, "\timageId: %d", imageId);
debugC(kDebugScript, "\tsrcRect.left: %d", srcRect.left); debugC(kDebugScript, "\tsrcRect.left: %d", srcRect.left);
debugC(kDebugScript, "\tsrcRect.top: %d", srcRect.top); debugC(kDebugScript, "\tsrcRect.top: %d", srcRect.top);
debugC(kDebugScript, "\tsrcRect.right: %d", srcRect.right); debugC(kDebugScript, "\tsrcRect.right: %d", srcRect.right);
@ -748,73 +667,51 @@ void MystScriptParser::o_copyImageToScreen(uint16 op, uint16 var, const Argument
_vm->_gfx->copyImageSectionToScreen(imageId, srcRect, dstRect); _vm->_gfx->copyImageSectionToScreen(imageId, srcRect, dstRect);
} }
void MystScriptParser::o_changeCard(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeCard(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Change Card", op);
uint16 cardId = args[0]; uint16 cardId = args[0];
TransitionType transition = static_cast<TransitionType>(args[1]); TransitionType transition = static_cast<TransitionType>(args[1]);
debugC(kDebugScript, "\tTarget Card: %d", cardId);
_vm->changeToCard(cardId, transition); _vm->changeToCard(cardId, transition);
} }
void MystScriptParser::o_drawImageChangeCard(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_drawImageChangeCard(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Draw Full Screen Image, Delay then Change Card", op);
uint16 imageId = args[0]; uint16 imageId = args[0];
uint16 cardId = args[1]; uint16 cardId = args[1];
TransitionType transition = static_cast<TransitionType>(args[2]); TransitionType transition = static_cast<TransitionType>(args[2]);
debugC(kDebugScript, "\timageId: %d", imageId);
debugC(kDebugScript, "\tcardId: %d", cardId);
_vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333)); _vm->_gfx->copyImageToScreen(imageId, Common::Rect(0, 0, 544, 333));
_vm->wait(200); _vm->wait(200);
_vm->changeToCard(cardId, transition); _vm->changeToCard(cardId, transition);
} }
void MystScriptParser::o_changeMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeMainCursor(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Change main cursor", op);
uint16 cursorId = args[0]; uint16 cursorId = args[0];
debugC(kDebugScript, "Cursor: %d", cursorId);
_vm->setMainCursor(cursorId); _vm->setMainCursor(cursorId);
_vm->_cursor->setCursor(cursorId); _vm->_cursor->setCursor(cursorId);
} }
void MystScriptParser::o_hideCursor(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_hideCursor(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Hide Cursor", op);
_vm->_cursor->hideCursor(); _vm->_cursor->hideCursor();
} }
void MystScriptParser::o_showCursor(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_showCursor(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Show Cursor", op);
_vm->_cursor->showCursor(); _vm->_cursor->showCursor();
} }
void MystScriptParser::o_delay(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_delay(uint16 var, const ArgumentsArray &args) {
// Used on Mechanical Card 6327 (Elevator) // Used on Mechanical Card 6327 (Elevator)
debugC(kDebugScript, "Opcode %d: Delay", op);
uint16 time = args[0]; uint16 time = args[0];
debugC(kDebugScript, "\tTime: %d", time);
_vm->wait(time); _vm->wait(time);
} }
void MystScriptParser::o_changeStack(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeStack(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: changeStack", op);
uint16 targetStack = args[0]; uint16 targetStack = args[0];
uint16 soundIdLinkSrc = args[1]; uint16 soundIdLinkSrc = args[1];
uint16 soundIdLinkDst = args[2]; uint16 soundIdLinkDst = args[2];
debugC(kDebugScript, "\tTarget Stack: %d", targetStack);
debugC(kDebugScript, "\tSource Stack Link Sound: %d", soundIdLinkSrc); debugC(kDebugScript, "\tSource Stack Link Sound: %d", soundIdLinkSrc);
debugC(kDebugScript, "\tDestination Stack Link Sound: %d", soundIdLinkDst); debugC(kDebugScript, "\tDestination Stack Link Sound: %d", soundIdLinkDst);
@ -831,9 +728,7 @@ void MystScriptParser::o_changeStack(uint16 op, uint16 var, const ArgumentsArray
} }
} }
void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Play Sound, Change Card and Directional Update Screen Region", op);
uint16 cardId = args[0]; uint16 cardId = args[0];
uint16 soundId = args[1]; uint16 soundId = args[1];
uint16 delayBetweenSteps = args[2]; uint16 delayBetweenSteps = args[2];
@ -852,9 +747,7 @@ void MystScriptParser::o_changeCardPlaySoundDirectional(uint16 op, uint16 var, c
animatedUpdate(ArgumentsArray(args.begin() + 4, dataSize), delayBetweenSteps); animatedUpdate(ArgumentsArray(args.begin() + 4, dataSize), delayBetweenSteps);
} }
void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_directionalUpdatePlaySound(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Play Sound and Directional Update Screen Region", op);
uint16 soundId = args[0]; uint16 soundId = args[0];
uint16 delayBetweenSteps = args[1]; uint16 delayBetweenSteps = args[1];
uint16 dataSize = args[2]; uint16 dataSize = args[2];
@ -869,29 +762,23 @@ void MystScriptParser::o_directionalUpdatePlaySound(uint16 op, uint16 var, const
animatedUpdate(ArgumentsArray(args.begin() + 3, dataSize), delayBetweenSteps); animatedUpdate(ArgumentsArray(args.begin() + 3, dataSize), delayBetweenSteps);
} }
void MystScriptParser::o_saveMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_saveMainCursor(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Save main cursor", op);
_savedCursorId = _vm->getMainCursor(); _savedCursorId = _vm->getMainCursor();
} }
void MystScriptParser::o_restoreMainCursor(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_restoreMainCursor(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Restore main cursor", op);
_vm->setMainCursor(_savedCursorId); _vm->setMainCursor(_savedCursorId);
} }
void MystScriptParser::o_soundWaitStop(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_soundWaitStop(uint16 var, const ArgumentsArray &args) {
// Used on Selenitic Card 1191 (Maze Runner) // Used on Selenitic Card 1191 (Maze Runner)
// Used on Mechanical Card 6267 (Code Lock) // Used on Mechanical Card 6267 (Code Lock)
// Used when Button is pushed... // Used when Button is pushed...
debugC(kDebugScript, "Opcode %d: Wait for foreground sound to finish", op);
while (_vm->_sound->isEffectPlaying()) while (_vm->_sound->isEffectPlaying())
_vm->doFrame(); _vm->doFrame();
} }
void MystScriptParser::o_quit(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_quit(uint16 var, const ArgumentsArray &args) {
_vm->quitGame(); _vm->quitGame();
} }
@ -902,7 +789,7 @@ void MystScriptParser::showMap() {
} }
} }
void MystScriptParser::o_exitMap(uint16 op, uint16 var, const ArgumentsArray &args) { void MystScriptParser::o_exitMap(uint16 var, const ArgumentsArray &args) {
_vm->changeToCard(_savedMapCardId, kTransitionCopy); _vm->changeToCard(_savedMapCardId, kTransitionCopy);
} }

View file

@ -33,7 +33,7 @@ namespace Mohawk {
typedef Common::Array<uint16> ArgumentsArray; typedef Common::Array<uint16> ArgumentsArray;
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class MohawkEngine_Myst; class MohawkEngine_Myst;
class MystArea; class MystArea;
@ -88,8 +88,6 @@ public:
void animatedUpdate(const ArgumentsArray &args, uint16 delay); void animatedUpdate(const ArgumentsArray &args, uint16 delay);
DECLARE_OPCODE(unknown);
// Common opcodes // Common opcodes
DECLARE_OPCODE(o_toggleVar); DECLARE_OPCODE(o_toggleVar);
DECLARE_OPCODE(o_setVar); DECLARE_OPCODE(o_setVar);
@ -100,8 +98,8 @@ public:
DECLARE_OPCODE(o_redrawCard); DECLARE_OPCODE(o_redrawCard);
DECLARE_OPCODE(o_goToDest); DECLARE_OPCODE(o_goToDest);
DECLARE_OPCODE(o_goToDestForward); DECLARE_OPCODE(o_goToDestForward);
DECLARE_OPCODE(o_goToDestLeft);
DECLARE_OPCODE(o_goToDestRight); DECLARE_OPCODE(o_goToDestRight);
DECLARE_OPCODE(o_goToDestLeft);
DECLARE_OPCODE(o_goToDestUp); DECLARE_OPCODE(o_goToDestUp);
DECLARE_OPCODE(o_triggerMovie); DECLARE_OPCODE(o_triggerMovie);
DECLARE_OPCODE(o_toggleVarNoRedraw); DECLARE_OPCODE(o_toggleVarNoRedraw);
@ -146,7 +144,7 @@ protected:
MohawkEngine_Myst *_vm; MohawkEngine_Myst *_vm;
MystGameState::Globals &_globals; MystGameState::Globals &_globals;
typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 op, uint16 var, const ArgumentsArray &args); typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 var, const ArgumentsArray &args);
struct MystOpcode { struct MystOpcode {
MystOpcode(uint16 o, OpcodeProcMyst p, const char *d) : op(o), proc(p), desc(d) {} MystOpcode(uint16 o, OpcodeProcMyst p, const char *d) : op(o), proc(p), desc(d) {}
@ -175,6 +173,8 @@ protected:
private: private:
MystArea *_invokingResource; MystArea *_invokingResource;
int32 _scriptNestingLevel; int32 _scriptNestingLevel;
Common::String describeCommand(const MystOpcode &command, uint16 var, const ArgumentsArray &args);
}; };
template<class T> template<class T>

View file

@ -299,9 +299,7 @@ bool Channelwood::pipeChangeValve(bool open, uint16 mask) {
return false; return false;
} }
void Channelwood::o_bridgeToggle(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_bridgeToggle(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Bridge rise / skink video", op);
VideoEntryPtr bridge = _vm->_video->playMovie(_vm->wrapMovieFilename("bridge", kChannelwoodStack)); VideoEntryPtr bridge = _vm->_video->playMovie(_vm->wrapMovieFilename("bridge", kChannelwoodStack));
if (!bridge) if (!bridge)
error("Failed to open 'bridge' movie"); error("Failed to open 'bridge' movie");
@ -317,9 +315,7 @@ void Channelwood::o_bridgeToggle(uint16 op, uint16 var, const ArgumentsArray &ar
_vm->waitUntilMovieEnds(bridge); _vm->waitUntilMovieEnds(bridge);
} }
void Channelwood::o_pipeExtend(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_pipeExtend(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Play Pipe Movie and Sound", op);
uint16 soundId = args[0]; uint16 soundId = args[0];
debugC(kDebugScript, "\tsoundId: %d", soundId); debugC(kDebugScript, "\tsoundId: %d", soundId);
@ -340,9 +336,7 @@ void Channelwood::o_pipeExtend(uint16 op, uint16 var, const ArgumentsArray &args
_vm->_sound->resumeBackground(); _vm->_sound->resumeBackground();
} }
void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_drawImageChangeCardAndVolume(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Draw Full Screen Image, Change Card, and change volume", op);
uint16 imageId = args[0]; uint16 imageId = args[0];
uint16 cardId = args[1]; uint16 cardId = args[1];
@ -361,8 +355,7 @@ void Channelwood::o_drawImageChangeCardAndVolume(uint16 op, uint16 var, const Ar
} }
void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_waterTankValveOpen(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Open Animation", op);
Common::Rect rect = getInvokingResource<MystArea>()->getRect(); Common::Rect rect = getInvokingResource<MystArea>()->getRect();
for (uint i = 0; i < 2; i++) for (uint i = 0; i < 2; i++)
@ -374,18 +367,14 @@ void Channelwood::o_waterTankValveOpen(uint16 op, uint16 var, const ArgumentsArr
pipeChangeValve(true, 0x80); pipeChangeValve(true, 0x80);
} }
void Channelwood::o_leverStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_leverStartMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Generic lever start move", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(0); lever->drawFrame(0);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
_leverPulled = false; _leverPulled = false;
} }
void Channelwood::o_leverMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_leverMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Generic lever move", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
if (lever->pullLeverV()) { if (lever->pullLeverV()) {
@ -398,9 +387,7 @@ void Channelwood::o_leverMove(uint16 op, uint16 var, const ArgumentsArray &args)
} }
} }
void Channelwood::o_leverMoveFail(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_leverMoveFail(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Generic lever move", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
if (lever->pullLeverV()) { if (lever->pullLeverV()) {
@ -415,9 +402,7 @@ void Channelwood::o_leverMoveFail(uint16 op, uint16 var, const ArgumentsArray &a
} }
} }
void Channelwood::o_leverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_leverEndMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Generic lever end move", op);
// Get current lever frame // Get current lever frame
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
@ -431,13 +416,13 @@ void Channelwood::o_leverEndMove(uint16 op, uint16 var, const ArgumentsArray &ar
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Channelwood::o_leverEndMoveResumeBackground(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_leverEndMoveResumeBackground(uint16 var, const ArgumentsArray &args) {
_vm->_sound->resumeBackground(); _vm->_sound->resumeBackground();
o_leverEndMove(op, var, args); o_leverEndMove(var, args);
} }
void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_leverEndMoveWithSound(uint16 var, const ArgumentsArray &args) {
o_leverEndMove(op, var, args); o_leverEndMove(var, args);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
uint16 soundId = lever->getList3(0); uint16 soundId = lever->getList3(0);
@ -445,22 +430,20 @@ void Channelwood::o_leverEndMoveWithSound(uint16 op, uint16 var, const Arguments
_vm->_sound->playEffect(soundId); _vm->_sound->playEffect(soundId);
} }
void Channelwood::o_leverElev3StartMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_leverElev3StartMove(uint16 var, const ArgumentsArray &args) {
_vm->_gfx->copyImageToScreen(3970, Common::Rect(544, 333)); _vm->_gfx->copyImageToScreen(3970, Common::Rect(544, 333));
_vm->doFrame(); _vm->doFrame();
o_leverStartMove(op, var, args); o_leverStartMove(var, args);
} }
void Channelwood::o_leverElev3EndMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_leverElev3EndMove(uint16 var, const ArgumentsArray &args) {
o_leverEndMove(op, var, args); o_leverEndMove(var, args);
_vm->_gfx->copyImageToScreen(3265, Common::Rect(544, 333)); _vm->_gfx->copyImageToScreen(3265, Common::Rect(544, 333));
_vm->doFrame(); _vm->doFrame();
_vm->_sound->playEffect(5265); _vm->_sound->playEffect(5265);
} }
void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_pumpLeverMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Pump lever move", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
if (lever->pullLeverV()) { if (lever->pullLeverV()) {
@ -472,8 +455,8 @@ void Channelwood::o_pumpLeverMove(uint16 op, uint16 var, const ArgumentsArray &a
} }
} }
void Channelwood::o_pumpLeverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_pumpLeverEndMove(uint16 var, const ArgumentsArray &args) {
o_leverEndMove(op, var, args); o_leverEndMove(var, args);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
uint16 soundId = lever->getList3(0); uint16 soundId = lever->getList3(0);
@ -481,9 +464,7 @@ void Channelwood::o_pumpLeverEndMove(uint16 op, uint16 var, const ArgumentsArray
_vm->_sound->playBackground(soundId, 36864); _vm->_sound->playBackground(soundId, 36864);
} }
void Channelwood::o_stairsDoorToggle(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_stairsDoorToggle(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Play stairs door video", op);
MystAreaVideo *movie = getInvokingResource<MystAreaVideo>(); MystAreaVideo *movie = getInvokingResource<MystAreaVideo>();
if (_state.stairsUpperDoorState) { if (_state.stairsUpperDoorState) {
@ -497,9 +478,7 @@ void Channelwood::o_stairsDoorToggle(uint16 op, uint16 var, const ArgumentsArray
} }
} }
void Channelwood::o_valveHandleMove1(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_valveHandleMove1(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Valve handle move", op);
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
@ -513,21 +492,17 @@ void Channelwood::o_valveHandleMove1(uint16 op, uint16 var, const ArgumentsArray
} }
} }
void Channelwood::o_valveHandleMoveStart1(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_valveHandleMoveStart1(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Valve handle move start", op);
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0); uint16 soundId = handle->getList1(0);
if (soundId) if (soundId)
_vm->_sound->playEffect(soundId); _vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
o_valveHandleMove1(op, var, args); o_valveHandleMove1(var, args);
} }
void Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_valveHandleMoveStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Valve handle move stop", op);
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
// Update state with valve position // Update state with valve position
@ -548,9 +523,7 @@ void Channelwood::o_valveHandleMoveStop(uint16 op, uint16 var, const ArgumentsAr
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Channelwood::o_valveHandleMove2(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_valveHandleMove2(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Valve handle move", op);
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
@ -564,21 +537,17 @@ void Channelwood::o_valveHandleMove2(uint16 op, uint16 var, const ArgumentsArray
} }
} }
void Channelwood::o_valveHandleMoveStart2(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_valveHandleMoveStart2(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Valve handle move start", op);
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0); uint16 soundId = handle->getList1(0);
if (soundId) if (soundId)
_vm->_sound->playEffect(soundId); _vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
o_valveHandleMove2(op, var, args); o_valveHandleMove2(var, args);
} }
void Channelwood::o_valveHandleMove3(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_valveHandleMove3(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Valve handle move", op);
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
@ -592,21 +561,17 @@ void Channelwood::o_valveHandleMove3(uint16 op, uint16 var, const ArgumentsArray
} }
} }
void Channelwood::o_valveHandleMoveStart3(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_valveHandleMoveStart3(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Valve handle move start", op);
MystVideoInfo *handle = getInvokingResource<MystVideoInfo>(); MystVideoInfo *handle = getInvokingResource<MystVideoInfo>();
uint16 soundId = handle->getList1(0); uint16 soundId = handle->getList1(0);
if (soundId) if (soundId)
_vm->_sound->playEffect(soundId); _vm->_sound->playEffect(soundId);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
o_valveHandleMove3(op, var, args); o_valveHandleMove3(var, args);
} }
void Channelwood::o_hologramMonitor(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_hologramMonitor(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Hologram monitor", op);
// Used on Card 3012 (Temple Hologram Monitor) // Used on Card 3012 (Temple Hologram Monitor)
uint16 button = args[0]; // 0 to 3 uint16 button = args[0]; // 0 to 3
@ -644,23 +609,19 @@ void Channelwood::o_hologramMonitor(uint16 op, uint16 var, const ArgumentsArray
video->moveTo(226, 68); video->moveTo(226, 68);
break; break;
default: default:
warning("Opcode %d Control Variable Out of Range", op); warning("Opcode o_hologramMonitor Control Variable Out of Range");
break; break;
} }
} }
} }
void Channelwood::o_drawerOpen(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_drawerOpen(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Open Sirius drawer", op);
_siriusDrawerState = 1; _siriusDrawerState = 1;
_vm->redrawArea(18, false); _vm->redrawArea(18, false);
_vm->redrawArea(102, false); _vm->redrawArea(102, false);
} }
void Channelwood::o_hologramTemple(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_hologramTemple(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Temple hologram", op);
_vm->_sound->pauseBackground(); _vm->_sound->pauseBackground();
// Used on Card 3333 (Temple Hologram) // Used on Card 3333 (Temple Hologram)
@ -678,22 +639,19 @@ void Channelwood::o_hologramTemple(uint16 op, uint16 var, const ArgumentsArray &
_vm->playMovieBlocking(_vm->wrapMovieFilename("holosmsg", kChannelwoodStack), 127, 45); _vm->playMovieBlocking(_vm->wrapMovieFilename("holosmsg", kChannelwoodStack), 127, 45);
break; break;
default: default:
warning("Opcode %d Control Variable Out of Range", op); warning("Opcode o_hologramTemple Control Variable Out of Range");
break; break;
} }
_vm->_sound->resumeBackground(); _vm->_sound->resumeBackground();
} }
void Channelwood::o_executeMouseUp(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_executeMouseUp(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Execute mouse up", op);
MystArea *resource = _vm->getViewResource<MystArea>(args[0]); MystArea *resource = _vm->getViewResource<MystArea>(args[0]);
resource->handleMouseUp(); resource->handleMouseUp();
} }
void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_waterTankValveClose(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Do Water Tank Valve Close Animation", op);
Common::Rect rect = getInvokingResource<MystArea>()->getRect(); Common::Rect rect = getInvokingResource<MystArea>()->getRect();
for (uint i = 0; i < 2; i++) for (uint i = 0; i < 2; i++)
@ -705,10 +663,8 @@ void Channelwood::o_waterTankValveClose(uint16 op, uint16 var, const ArgumentsAr
pipeChangeValve(false, 0x80); pipeChangeValve(false, 0x80);
} }
void Channelwood::o_elevatorMovies(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_elevatorMovies(uint16 var, const ArgumentsArray &args) {
// Used by Card 3262 (Elevator) // Used by Card 3262 (Elevator)
debugC(kDebugScript, "Opcode %d: Elevator movie", op);
uint16 elevator = args[0]; uint16 elevator = args[0];
uint16 direction = args[1]; uint16 direction = args[1];
@ -750,9 +706,7 @@ void Channelwood::o_elevatorMovies(uint16 op, uint16 var, const ArgumentsArray &
_vm->_sound->resumeBackground(); _vm->_sound->resumeBackground();
} }
void Channelwood::o_soundReplace(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_soundReplace(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Play sound if not already playing", op);
uint16 soundId = args[0]; uint16 soundId = args[0];
if (!_vm->_sound->isEffectPlaying()) { if (!_vm->_sound->isEffectPlaying()) {
@ -760,18 +714,15 @@ void Channelwood::o_soundReplace(uint16 op, uint16 var, const ArgumentsArray &ar
} }
} }
void Channelwood::o_lever_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_lever_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Generic lever init", op);
_leverAction = getInvokingResource<MystArea>(); _leverAction = getInvokingResource<MystArea>();
} }
void Channelwood::o_pipeValve_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_pipeValve_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Water valve init", op);
_valveVar = var; _valveVar = var;
} }
void Channelwood::o_drawer_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Channelwood::o_drawer_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sirius's drawer init", op);
_siriusDrawerState = 0; _siriusDrawerState = 0;
} }

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Channelwood : public MystScriptParser { class Channelwood : public MystScriptParser {
public: public:

View file

@ -90,7 +90,7 @@ uint16 Credits::getVar(uint16 var) {
} }
} }
void Credits::o_runCredits(uint16 op, uint16 var, const ArgumentsArray &args) { void Credits::o_runCredits(uint16 var, const ArgumentsArray &args) {
// Activate the credits // Activate the credits
_creditsRunning = true; _creditsRunning = true;
_curImage = 0; _curImage = 0;

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Credits : public MystScriptParser { class Credits : public MystScriptParser {
public: public:

View file

@ -76,22 +76,18 @@ void Demo::runPersistentScripts() {
} }
} }
void Demo::o_stopIntro(uint16 op, uint16 var, const ArgumentsArray &args) { void Demo::o_stopIntro(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Unk", op);
// The original also seems to stop the movies. Not needed with this engine. // The original also seems to stop the movies. Not needed with this engine.
_vm->_gfx->fadeToBlack(); _vm->_gfx->fadeToBlack();
} }
void Demo::o_fadeFromBlack(uint16 op, uint16 var, const ArgumentsArray &args) { void Demo::o_fadeFromBlack(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Fade from black", op);
// FIXME: This glitches when enabled. The backbuffer is drawn to screen, // FIXME: This glitches when enabled. The backbuffer is drawn to screen,
// and then the fading occurs, causing the background to appear for one frame. // and then the fading occurs, causing the background to appear for one frame.
// _vm->_gfx->fadeFromBlack(); // _vm->_gfx->fadeFromBlack();
} }
void Demo::o_fadeToBlack(uint16 op, uint16 var, const ArgumentsArray &args) { void Demo::o_fadeToBlack(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Fade to black", op);
_vm->_gfx->fadeToBlack(); _vm->_gfx->fadeToBlack();
} }
@ -122,9 +118,7 @@ void Demo::returnToMenu_run() {
} }
} }
void Demo::o_returnToMenu_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Demo::o_returnToMenu_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Return to menu init", op);
// Used on Card 2001, 2002 and 2003 // Used on Card 2001, 2002 and 2003
_returnToMenuNextTime = _vm->_system->getMillis() + 5000; _returnToMenuNextTime = _vm->_system->getMillis() + 5000;
_returnToMenuRunning = true; _returnToMenuRunning = true;

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Demo : public Intro { class Demo : public Intro {
public: public:

View file

@ -95,8 +95,7 @@ uint16 Dni::getVar(uint16 var) {
} }
} }
void Dni::o_handPage(uint16 op, uint16 var, const ArgumentsArray &args) { void Dni::o_handPage(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Hand page to Atrus", op);
// Used in Card 5014 (Atrus) // Used in Card 5014 (Atrus)
// Find Atrus movie // Find Atrus movie
@ -214,9 +213,7 @@ void Dni::atrus_run() {
} }
} }
void Dni::o_atrus_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Dni::o_atrus_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Atrus init", op);
_atrusRunning = true; _atrusRunning = true;
} }

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Dni : public MystScriptParser { class Dni : public MystScriptParser {
public: public:

View file

@ -79,15 +79,12 @@ uint16 Intro::getVar(uint16 var) {
} }
} }
void Intro::o_useLinkBook(uint16 op, uint16 var, const ArgumentsArray &args) { void Intro::o_useLinkBook(uint16 var, const ArgumentsArray &args) {
// Hard coded SoundId valid only for Intro Stack. // Hard coded SoundId valid only for Intro Stack.
// Other stacks use Opcode 40, which takes SoundId values as arguments. // Other stacks use Opcode 40, which takes SoundId values as arguments.
const uint16 soundIdLinkSrc = 5; const uint16 soundIdLinkSrc = 5;
const uint16 soundIdLinkDst[] = { 2282, 3029, 6396, 7122, 3137, 0, 9038, 5134, 0, 4739, 4741 }; const uint16 soundIdLinkDst[] = { 2282, 3029, 6396, 7122, 3137, 0, 9038, 5134, 0, 4739, 4741 };
debugC(kDebugScript, "Opcode %d: o_useLinkBook", op);
debugC(kDebugScript, "\tvar: %d", var);
// Change to dest stack // Change to dest stack
_vm->changeToStack(_stackMap[_globals.currentAge], _startCard[_globals.currentAge], soundIdLinkSrc, soundIdLinkDst[_globals.currentAge]); _vm->changeToStack(_stackMap[_globals.currentAge], _startCard[_globals.currentAge], soundIdLinkSrc, soundIdLinkDst[_globals.currentAge]);
} }
@ -146,7 +143,7 @@ void Intro::introMovies_run() {
} }
} }
void Intro::o_playIntroMovies(uint16 op, uint16 var, const ArgumentsArray &args) { void Intro::o_playIntroMovies(uint16 var, const ArgumentsArray &args) {
_introMoviesRunning = true; _introMoviesRunning = true;
_introStep = 0; _introStep = 0;
} }
@ -165,9 +162,7 @@ void Intro::mystLinkBook_run() {
} }
} }
void Intro::o_mystLinkBook_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Intro::o_mystLinkBook_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Myst link book init", op);
_linkBookMovie = getInvokingResource<MystAreaVideo>(); _linkBookMovie = getInvokingResource<MystAreaVideo>();
_startTime = 1; _startTime = 1;
_linkBookRunning = true; _linkBookRunning = true;

View file

@ -34,7 +34,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Intro : public MystScriptParser { class Intro : public MystScriptParser {
public: public:

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class MakingOf : public MystScriptParser { class MakingOf : public MystScriptParser {
public: public:

View file

@ -271,15 +271,11 @@ bool Mechanical::setVarValue(uint16 var, uint16 value) {
return refresh; return refresh;
} }
void Mechanical::o_throneEnablePassage(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_throneEnablePassage(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Enable throne passage", op);
_vm->_resources[args[0]]->setEnabled(getVar(var)); _vm->_resources[args[0]]->setEnabled(getVar(var));
} }
void Mechanical::o_birdCrankStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_birdCrankStart(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Mechanical bird crank start", op);
MystAreaDrag *crank = getInvokingResource<MystAreaDrag>(); MystAreaDrag *crank = getInvokingResource<MystAreaDrag>();
uint16 crankSoundId = crank->getList2(0); uint16 crankSoundId = crank->getList2(0);
@ -292,9 +288,7 @@ void Mechanical::o_birdCrankStart(uint16 op, uint16 var, const ArgumentsArray &a
crankMovie->playMovie(); crankMovie->playMovie();
} }
void Mechanical::o_birdCrankStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_birdCrankStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Mechanical bird crank stop", op);
MystAreaDrag *crank = getInvokingResource<MystAreaDrag>(); MystAreaDrag *crank = getInvokingResource<MystAreaDrag>();
MystAreaVideo *crankMovie = static_cast<MystAreaVideo *>(crank->getSubResource(0)); MystAreaVideo *crankMovie = static_cast<MystAreaVideo *>(crank->getSubResource(0));
@ -309,16 +303,12 @@ void Mechanical::o_birdCrankStop(uint16 op, uint16 var, const ArgumentsArray &ar
_bird->playMovie(); _bird->playMovie();
} }
void Mechanical::o_snakeBoxTrigger(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_snakeBoxTrigger(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) // Used on Mechanical Card 6043 (Weapons Rack with Snake Box)
_snakeBox->playMovie(); _snakeBox->playMovie();
} }
void Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressStaircaseMovie(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Play Stairs Movement Movie", op);
VideoEntryPtr staircase = _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack)); VideoEntryPtr staircase = _vm->_video->playMovie(_vm->wrapMovieFilename("hhstairs", kMechanicalStack));
if (!staircase) if (!staircase)
error("Failed to open hhstairs movie"); error("Failed to open hhstairs movie");
@ -334,9 +324,7 @@ void Mechanical::o_fortressStaircaseMovie(uint16 op, uint16 var, const Arguments
_vm->waitUntilMovieEnds(staircase); _vm->waitUntilMovieEnds(staircase);
} }
void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_elevatorRotationStart(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Elevator rotation lever start", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(0); lever->drawFrame(0);
@ -348,9 +336,7 @@ void Mechanical::o_elevatorRotationStart(uint16 op, uint16 var, const ArgumentsA
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
} }
void Mechanical::o_elevatorRotationMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_elevatorRotationMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Elevator rotation lever move", op);
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
@ -366,9 +352,7 @@ void Mechanical::o_elevatorRotationMove(uint16 op, uint16 var, const ArgumentsAr
lever->drawFrame(step); lever->drawFrame(step);
} }
void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_elevatorRotationStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Elevator rotation lever stop", op);
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
@ -414,18 +398,14 @@ void Mechanical::o_elevatorRotationStop(uint16 op, uint16 var, const ArgumentsAr
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Mechanical::o_fortressRotationSpeedStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressRotationSpeedStart(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation speed lever start", op);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(0); lever->drawFrame(0);
} }
void Mechanical::o_fortressRotationSpeedMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressRotationSpeedMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation speed lever move", op);
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
@ -441,9 +421,7 @@ void Mechanical::o_fortressRotationSpeedMove(uint16 op, uint16 var, const Argume
lever->drawFrame(step); lever->drawFrame(step);
} }
void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressRotationSpeedStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation speed lever stop", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
// Release lever // Release lever
@ -457,18 +435,14 @@ void Mechanical::o_fortressRotationSpeedStop(uint16 op, uint16 var, const Argume
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Mechanical::o_fortressRotationBrakeStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressRotationBrakeStart(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation brake lever start", op);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(_fortressRotationBrake); lever->drawFrame(_fortressRotationBrake);
} }
void Mechanical::o_fortressRotationBrakeMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressRotationBrakeMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation brake lever move", op);
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
@ -484,27 +458,21 @@ void Mechanical::o_fortressRotationBrakeMove(uint16 op, uint16 var, const Argume
lever->drawFrame(step); lever->drawFrame(step);
} }
void Mechanical::o_fortressRotationBrakeStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressRotationBrakeStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation brake lever stop", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(_fortressRotationBrake); lever->drawFrame(_fortressRotationBrake);
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Mechanical::o_fortressSimulationSpeedStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressSimulationSpeedStart(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever start", op);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(0); lever->drawFrame(0);
} }
void Mechanical::o_fortressSimulationSpeedMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressSimulationSpeedMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever move", op);
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
@ -520,9 +488,7 @@ void Mechanical::o_fortressSimulationSpeedMove(uint16 op, uint16 var, const Argu
lever->drawFrame(step); lever->drawFrame(step);
} }
void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressSimulationSpeedStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation simulator speed lever stop", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
// Release lever // Release lever
@ -536,18 +502,14 @@ void Mechanical::o_fortressSimulationSpeedStop(uint16 op, uint16 var, const Argu
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Mechanical::o_fortressSimulationBrakeStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressSimulationBrakeStart(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever start", op);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(_fortressSimulationBrake); lever->drawFrame(_fortressSimulationBrake);
} }
void Mechanical::o_fortressSimulationBrakeMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressSimulationBrakeMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever move", op);
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
@ -563,21 +525,17 @@ void Mechanical::o_fortressSimulationBrakeMove(uint16 op, uint16 var, const Argu
lever->drawFrame(step); lever->drawFrame(step);
} }
void Mechanical::o_fortressSimulationBrakeStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressSimulationBrakeStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d Fortress rotation simulator brake lever stop", op);
MystVideoInfo *lever = getInvokingResource<MystVideoInfo>(); MystVideoInfo *lever = getInvokingResource<MystVideoInfo>();
lever->drawFrame(_fortressSimulationBrake); lever->drawFrame(_fortressSimulationBrake);
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Mechanical::o_elevatorWindowMovie(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_elevatorWindowMovie(uint16 var, const ArgumentsArray &args) {
uint16 startTime = args[0]; uint16 startTime = args[0];
uint16 endTime = args[1]; uint16 endTime = args[1];
debugC(kDebugScript, "Opcode %d Movie Time Index %d to %d", op, startTime, endTime);
VideoEntryPtr window = _vm->_video->playMovie(_vm->wrapMovieFilename("ewindow", kMechanicalStack)); VideoEntryPtr window = _vm->_video->playMovie(_vm->wrapMovieFilename("ewindow", kMechanicalStack));
if (!window) if (!window)
error("Failed to open ewindow movie"); error("Failed to open ewindow movie");
@ -587,9 +545,7 @@ void Mechanical::o_elevatorWindowMovie(uint16 op, uint16 var, const ArgumentsArr
_vm->waitUntilMovieEnds(window); _vm->waitUntilMovieEnds(window);
} }
void Mechanical::o_elevatorGoMiddle(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_elevatorGoMiddle(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Elevator go middle from top", op);
_elevatorTooLate = false; _elevatorTooLate = false;
_elevatorTopCounter = 5; _elevatorTopCounter = 5;
_elevatorGoingMiddle = true; _elevatorGoingMiddle = true;
@ -634,7 +590,7 @@ void Mechanical::elevatorGoMiddle_run() {
_vm->wait(500); _vm->wait(500);
_vm->_sound->playEffect(9120); _vm->_sound->playEffect(9120);
static uint16 moviePos[2] = { 3540, 5380 }; static uint16 moviePos[2] = { 3540, 5380 };
o_elevatorWindowMovie(121, 0, ArgumentsArray(moviePos, ARRAYSIZE(moviePos))); o_elevatorWindowMovie(0, ArgumentsArray(moviePos, ARRAYSIZE(moviePos)));
_vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333)); _vm->_gfx->copyBackBufferToScreen(Common::Rect(544, 333));
_vm->_sound->playEffect(10120); _vm->_sound->playEffect(10120);
_vm->_cursor->showCursor(); _vm->_cursor->showCursor();
@ -647,12 +603,10 @@ void Mechanical::elevatorGoMiddle_run() {
} }
} }
void Mechanical::o_elevatorTopMovie(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_elevatorTopMovie(uint16 var, const ArgumentsArray &args) {
uint16 startTime = args[0]; uint16 startTime = args[0];
uint16 endTime = args[1]; uint16 endTime = args[1];
debugC(kDebugScript, "Opcode %d Movie Time Index %d to %d", op, startTime, endTime);
VideoEntryPtr window = _vm->_video->playMovie(_vm->wrapMovieFilename("hcelev", kMechanicalStack)); VideoEntryPtr window = _vm->_video->playMovie(_vm->wrapMovieFilename("hcelev", kMechanicalStack));
if (!window) if (!window)
error("Failed to open hcelev movie"); error("Failed to open hcelev movie");
@ -662,9 +616,7 @@ void Mechanical::o_elevatorTopMovie(uint16 op, uint16 var, const ArgumentsArray
_vm->waitUntilMovieEnds(window); _vm->waitUntilMovieEnds(window);
} }
void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressRotationSetPosition(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Set fortress position", op);
VideoEntryPtr gears = _fortressRotationGears->getVideo(); VideoEntryPtr gears = _fortressRotationGears->getVideo();
uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames(); uint32 moviePosition = Audio::Timestamp(gears->getTime(), 600).totalNumberOfFrames();
@ -676,15 +628,11 @@ void Mechanical::o_fortressRotationSetPosition(uint16 op, uint16 var, const Argu
_fortressPosition = (moviePosition + 900) / 1800 % 4; _fortressPosition = (moviePosition + 900) / 1800 % 4;
} }
void Mechanical::o_mystStaircaseMovie(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_mystStaircaseMovie(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Myst book staircase video", op);
_vm->playMovieBlocking(_vm->wrapMovieFilename("sstairs", kMechanicalStack), 199, 108); _vm->playMovieBlocking(_vm->wrapMovieFilename("sstairs", kMechanicalStack), 199, 108);
} }
void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_elevatorWaitTimeout(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Wait for the elevator to go middle", op);
// Wait while the elevator times out // Wait while the elevator times out
while (_elevatorGoingMiddle) { while (_elevatorGoingMiddle) {
runPersistentScripts(); runPersistentScripts();
@ -692,58 +640,42 @@ void Mechanical::o_elevatorWaitTimeout(uint16 op, uint16 var, const ArgumentsArr
} }
} }
void Mechanical::o_crystalEnterYellow(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_crystalEnterYellow(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Crystal enter", op);
_crystalLit = 3; _crystalLit = 3;
_vm->redrawArea(20); _vm->redrawArea(20);
} }
void Mechanical::o_crystalEnterGreen(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_crystalEnterGreen(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Crystal enter", op);
_crystalLit = 1; _crystalLit = 1;
_vm->redrawArea(21); _vm->redrawArea(21);
} }
void Mechanical::o_crystalEnterRed(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_crystalEnterRed(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Crystal enter", op);
_crystalLit = 2; _crystalLit = 2;
_vm->redrawArea(22); _vm->redrawArea(22);
} }
void Mechanical::o_crystalLeaveYellow(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_crystalLeaveYellow(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Crystal leave", op);
_crystalLit = 0; _crystalLit = 0;
_vm->redrawArea(20); _vm->redrawArea(20);
} }
void Mechanical::o_crystalLeaveGreen(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_crystalLeaveGreen(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Crystal leave", op);
_crystalLit = 0; _crystalLit = 0;
_vm->redrawArea(21); _vm->redrawArea(21);
} }
void Mechanical::o_crystalLeaveRed(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_crystalLeaveRed(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Crystal leave", op);
_crystalLit = 0; _crystalLit = 0;
_vm->redrawArea(22); _vm->redrawArea(22);
} }
void Mechanical::o_throne_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_throne_init(uint16 var, const ArgumentsArray &args) {
// Used on Card 6238 (Sirrus' Throne) and Card 6027 (Achenar's Throne) // 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)); getInvokingResource<MystArea>()->setEnabled(getVar(var));
} }
void Mechanical::o_fortressStaircase_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressStaircase_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Staircase init", op);
_vm->_resources[args[0]]->setEnabled(!_state.staircaseState); _vm->_resources[args[0]]->setEnabled(!_state.staircaseState);
_vm->_resources[args[1]]->setEnabled(!_state.staircaseState); _vm->_resources[args[1]]->setEnabled(!_state.staircaseState);
_vm->_resources[args[2]]->setEnabled(_state.staircaseState); _vm->_resources[args[2]]->setEnabled(_state.staircaseState);
@ -759,17 +691,13 @@ void Mechanical::birdSing_run() {
} }
} }
void Mechanical::o_bird_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_bird_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Mechanical bird init", op);
_birdSinging = false; _birdSinging = false;
_birdSingEndTime = 0; _birdSingEndTime = 0;
_bird = getInvokingResource<MystAreaVideo>(); _bird = getInvokingResource<MystAreaVideo>();
} }
void Mechanical::o_snakeBox_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_snakeBox_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Snake box init", op);
_snakeBox = getInvokingResource<MystAreaVideo>(); _snakeBox = getInvokingResource<MystAreaVideo>();
} }
@ -790,9 +718,7 @@ void Mechanical::elevatorRotation_run() {
} }
} }
void Mechanical::o_elevatorRotation_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_elevatorRotation_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Elevator rotation init", op);
_elevatorRotationSoundId = args[0]; _elevatorRotationSoundId = args[0];
_elevatorRotationGearPosition = 0; _elevatorRotationGearPosition = 0;
_elevatorRotationLeverMoving = false; _elevatorRotationLeverMoving = false;
@ -870,9 +796,7 @@ void Mechanical::fortressRotation_run() {
} }
} }
void Mechanical::o_fortressRotation_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressRotation_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Fortress rotation init", op);
_fortressRotationGears = getInvokingResource<MystAreaVideo>(); _fortressRotationGears = getInvokingResource<MystAreaVideo>();
VideoEntryPtr gears = _fortressRotationGears->playMovie(); VideoEntryPtr gears = _fortressRotationGears->playMovie();
@ -1020,9 +944,7 @@ void Mechanical::fortressSimulation_run() {
} }
} }
void Mechanical::o_fortressSimulation_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressSimulation_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Fortress rotation simulator init", op);
_fortressSimulationHolo = getInvokingResource<MystAreaVideo>(); _fortressSimulationHolo = getInvokingResource<MystAreaVideo>();
_fortressSimulationStartSound1 = args[0]; _fortressSimulationStartSound1 = args[0];
@ -1042,9 +964,7 @@ void Mechanical::o_fortressSimulation_init(uint16 op, uint16 var, const Argument
_vm->_cursor->hideCursor(); _vm->_cursor->hideCursor();
} }
void Mechanical::o_fortressSimulationStartup_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Mechanical::o_fortressSimulationStartup_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Fortress rotation simulator startup init", op);
_fortressSimulationStartup = getInvokingResource<MystAreaVideo>(); _fortressSimulationStartup = getInvokingResource<MystAreaVideo>();
} }

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Mechanical : public MystScriptParser { class Mechanical : public MystScriptParser {
public: public:

File diff suppressed because it is too large Load diff

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Myst : public MystScriptParser { class Myst : public MystScriptParser {
public: public:
@ -96,8 +96,10 @@ protected:
DECLARE_OPCODE(o_cabinSafeHandleMove); DECLARE_OPCODE(o_cabinSafeHandleMove);
DECLARE_OPCODE(o_cabinSafeHandleEndMove); DECLARE_OPCODE(o_cabinSafeHandleEndMove);
DECLARE_OPCODE(o_treePressureReleaseStart); DECLARE_OPCODE(o_treePressureReleaseStart);
DECLARE_OPCODE(o_observatoryMonthChangeStart); DECLARE_OPCODE(o_observatoryMonthChangeStartIncrease);
DECLARE_OPCODE(o_observatoryDayChangeStart); DECLARE_OPCODE(o_observatoryMonthChangeStartDecrease);
DECLARE_OPCODE(o_observatoryDayChangeStartIncrease);
DECLARE_OPCODE(o_observatoryDayChangeStartDecrease);
DECLARE_OPCODE(o_observatoryGoButton); DECLARE_OPCODE(o_observatoryGoButton);
DECLARE_OPCODE(o_observatoryMonthSliderMove); DECLARE_OPCODE(o_observatoryMonthSliderMove);
DECLARE_OPCODE(o_observatoryDaySliderMove); DECLARE_OPCODE(o_observatoryDaySliderMove);
@ -143,7 +145,8 @@ protected:
DECLARE_OPCODE(o_clockWheelEndTurn); DECLARE_OPCODE(o_clockWheelEndTurn);
DECLARE_OPCODE(o_clockHourWheelStartTurn); DECLARE_OPCODE(o_clockHourWheelStartTurn);
DECLARE_OPCODE(o_clockLeverStartMove); DECLARE_OPCODE(o_clockLeverStartMove);
DECLARE_OPCODE(o_clockLeverMove); DECLARE_OPCODE(o_clockLeverMoveLeft);
DECLARE_OPCODE(o_clockLeverMoveRight);
DECLARE_OPCODE(o_clockLeverEndMove); DECLARE_OPCODE(o_clockLeverEndMove);
DECLARE_OPCODE(o_clockResetLeverStartMove); DECLARE_OPCODE(o_clockResetLeverStartMove);
DECLARE_OPCODE(o_clockResetLeverMove); DECLARE_OPCODE(o_clockResetLeverMove);
@ -151,9 +154,11 @@ protected:
DECLARE_OPCODE(o_libraryCombinationBookStartRight); DECLARE_OPCODE(o_libraryCombinationBookStartRight);
DECLARE_OPCODE(o_libraryCombinationBookStartLeft); DECLARE_OPCODE(o_libraryCombinationBookStartLeft);
DECLARE_OPCODE(o_observatoryTimeChangeStart); DECLARE_OPCODE(o_observatoryTimeChangeStartIncrease);
DECLARE_OPCODE(o_observatoryTimeChangeStartDecrease);
DECLARE_OPCODE(o_observatoryChangeSettingStop); DECLARE_OPCODE(o_observatoryChangeSettingStop);
DECLARE_OPCODE(o_observatoryYearChangeStart); DECLARE_OPCODE(o_observatoryYearChangeStartIncrease);
DECLARE_OPCODE(o_observatoryYearChangeStartDecrease);
DECLARE_OPCODE(o_dockVaultForceClose); DECLARE_OPCODE(o_dockVaultForceClose);
DECLARE_OPCODE(o_imagerEraseStop); DECLARE_OPCODE(o_imagerEraseStop);
@ -311,6 +316,7 @@ protected:
void clockWheelStartTurn(uint16 wheel); void clockWheelStartTurn(uint16 wheel);
void clockWheelTurn(uint16 var); void clockWheelTurn(uint16 var);
void clockLeverMove(bool leftLever);
void clockGearForwardOneStep(uint16 gear); void clockGearForwardOneStep(uint16 gear);
void clockWeightDownOneStep(); void clockWeightDownOneStep();
void clockGearsCheckSolution(); void clockGearsCheckSolution();
@ -336,6 +342,10 @@ protected:
bool observatoryIsDDMMYYYY2400(); bool observatoryIsDDMMYYYY2400();
void observatorySetTargetToSetting(); void observatorySetTargetToSetting();
void observatoryUpdateVisualizer(uint16 x, uint16 y); void observatoryUpdateVisualizer(uint16 x, uint16 y);
void observatoryMonthChangeStart(bool increase);
void observatoryDayChangeStart(bool increase);
void observatoryYearChangeStart(bool increase);
void observatoryTimeChangeStart(bool increase);
void observatoryIncrementMonth(int16 increment); void observatoryIncrementMonth(int16 increment);
void observatoryIncrementDay(int16 increment); void observatoryIncrementDay(int16 increment);
void observatoryIncrementYear(int16 increment); void observatoryIncrementYear(int16 increment);

View file

@ -79,28 +79,22 @@ void Preview::runPersistentScripts() {
speech_run(); speech_run();
} }
void Preview::o_fadeToBlack(uint16 op, uint16 var, const ArgumentsArray &args) { void Preview::o_fadeToBlack(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Fade to black", op);
_vm->_gfx->fadeToBlack(); _vm->_gfx->fadeToBlack();
} }
void Preview::o_fadeFromBlack(uint16 op, uint16 var, const ArgumentsArray &args) { void Preview::o_fadeFromBlack(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Fade from black", op);
_vm->_gfx->fadeFromBlack(); _vm->_gfx->fadeFromBlack();
} }
void Preview::o_stayHere(uint16 op, uint16 var, const ArgumentsArray &args) { void Preview::o_stayHere(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Stay here dialog", op);
// Nuh-uh! No leaving the library in the demo! // Nuh-uh! No leaving the library in the demo!
GUI::MessageDialog dialog("You can't leave the library in the demo."); GUI::MessageDialog dialog("You can't leave the library in the demo.");
dialog.runModal(); dialog.runModal();
} }
void Preview::o_speechStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Preview::o_speechStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Speech stop", op);
_vm->_sound->stopSpeech(); _vm->_sound->stopSpeech();
_speechRunning = false; _speechRunning = false;
_globals.currentAge = 2; _globals.currentAge = 2;
@ -225,22 +219,18 @@ void Preview::speech_run() {
} }
} }
void Preview::o_speech_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Preview::o_speech_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Speech init", op);
// Used for Card 3000 (Closed Myst Book) // Used for Card 3000 (Closed Myst Book)
_speechStep = 0; _speechStep = 0;
_speechRunning = true; _speechRunning = true;
} }
void Preview::o_library_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Preview::o_library_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Library init", op);
// Used for Card 3002 (Myst Island Overview) // Used for Card 3002 (Myst Island Overview)
_library = getInvokingResource<MystAreaImageSwitch>(); _library = getInvokingResource<MystAreaImageSwitch>();
} }
void Preview::o_libraryBookcaseTransformDemo_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Preview::o_libraryBookcaseTransformDemo_init(uint16 var, const ArgumentsArray &args) {
if (_libraryBookcaseChanged) { if (_libraryBookcaseChanged) {
MystAreaActionSwitch *resource = getInvokingResource<MystAreaActionSwitch>(); MystAreaActionSwitch *resource = getInvokingResource<MystAreaActionSwitch>();
_libraryBookcaseMovie = static_cast<MystAreaVideo *>(resource->getSubResource(getVar(303))); _libraryBookcaseMovie = static_cast<MystAreaVideo *>(resource->getSubResource(getVar(303)));

View file

@ -35,7 +35,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Preview : public Myst { class Preview : public Myst {
public: public:

View file

@ -285,7 +285,7 @@ bool Selenitic::setVarValue(uint16 var, uint16 value) {
return refresh; return refresh;
} }
void Selenitic::o_mazeRunnerMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_mazeRunnerMove(uint16 var, const ArgumentsArray &args) {
uint16 oldPosition = _mazeRunnerPosition; uint16 oldPosition = _mazeRunnerPosition;
uint16 move = var; uint16 move = var;
@ -566,16 +566,11 @@ void Selenitic::mazeRunnerPlaySoundHelp() {
_mazeRunnerLight->drawConditionalDataToScreen(0); _mazeRunnerLight->drawConditionalDataToScreen(0);
} }
void Selenitic::o_mazeRunnerSoundRepeat(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_mazeRunnerSoundRepeat(uint16 var, const ArgumentsArray &args) {
mazeRunnerPlaySoundHelp(); mazeRunnerPlaySoundHelp();
} }
/** void Selenitic::o_soundReceiverSigma(uint16 var, const ArgumentsArray &args) {
* Sound receiver sigma button
*/
void Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound receiver sigma button", op);
_vm->_cursor->hideCursor(); _vm->_cursor->hideCursor();
_soundReceiverCurrentSource->drawConditionalDataToScreen(0); _soundReceiverCurrentSource->drawConditionalDataToScreen(0);
@ -622,26 +617,15 @@ void Selenitic::o_soundReceiverSigma(uint16 op, uint16 var, const ArgumentsArray
_vm->_cursor->showCursor(); _vm->_cursor->showCursor();
} }
/** void Selenitic::o_soundReceiverRight(uint16 var, const ArgumentsArray &args) {
* Sound receiver right button
*/
void Selenitic::o_soundReceiverRight(uint16 op, uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound receiver right", op);
soundReceiverLeftRight(1); soundReceiverLeftRight(1);
} }
/** void Selenitic::o_soundReceiverLeft(uint16 var, const ArgumentsArray &args) {
* Sound receiver left button
*/
void Selenitic::o_soundReceiverLeft(uint16 op, uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound receiver left", op);
soundReceiverLeftRight(2); soundReceiverLeftRight(2);
} }
void Selenitic::soundReceiverLeftRight(uint direction) { void Selenitic::soundReceiverLeftRight(uint direction) {
if (_soundReceiverSigmaPressed) { if (_soundReceiverSigmaPressed) {
_soundReceiverSigmaButton->drawConditionalDataToScreen(0); _soundReceiverSigmaButton->drawConditionalDataToScreen(0);
_soundReceiverSigmaPressed = false; _soundReceiverSigmaPressed = false;
@ -694,12 +678,7 @@ void Selenitic::soundReceiverDrawAngle() {
_vm->redrawResource(_soundReceiverAngle4); _vm->redrawResource(_soundReceiverAngle4);
} }
/** void Selenitic::o_soundReceiverSource(uint16 var, const ArgumentsArray &args) {
* Sound receiver source selection buttons
*/
void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound receiver source", op);
if (_soundReceiverSigmaPressed) { if (_soundReceiverSigmaPressed) {
_soundReceiverSigmaButton->drawConditionalDataToScreen(0); _soundReceiverSigmaButton->drawConditionalDataToScreen(0);
_soundReceiverSigmaPressed = false; _soundReceiverSigmaPressed = false;
@ -731,7 +710,7 @@ void Selenitic::o_soundReceiverSource(uint16 op, uint16 var, const ArgumentsArra
_vm->_cursor->showCursor(); _vm->_cursor->showCursor();
} }
void Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_mazeRunnerDoorButton(uint16 var, const ArgumentsArray &args) {
// Used for Selenitic Maze Runner Exit Logic // Used for Selenitic Maze Runner Exit Logic
uint16 cardIdExit = args[0]; uint16 cardIdExit = args[0];
uint16 cardIdEntry = args[1]; uint16 cardIdEntry = args[1];
@ -748,9 +727,7 @@ void Selenitic::o_mazeRunnerDoorButton(uint16 op, uint16 var, const ArgumentsArr
} }
} }
void Selenitic::o_soundReceiverUpdateSound(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_soundReceiverUpdateSound(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound receiver update sound", op);
soundReceiverUpdateSound(); soundReceiverUpdateSound();
} }
@ -796,9 +773,7 @@ MystAreaSlider *Selenitic::soundLockSliderFromVar(uint16 var) {
return nullptr; return nullptr;
} }
void Selenitic::o_soundLockMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_soundLockMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound lock move", op);
MystAreaSlider *slider = soundLockSliderFromVar(var); MystAreaSlider *slider = soundLockSliderFromVar(var);
uint16 soundId = soundLockCurrentSound(slider->_pos.y, true); uint16 soundId = soundLockCurrentSound(slider->_pos.y, true);
@ -808,9 +783,7 @@ void Selenitic::o_soundLockMove(uint16 op, uint16 var, const ArgumentsArray &arg
} }
} }
void Selenitic::o_soundLockStartMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_soundLockStartMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound lock start move", op);
MystAreaSlider *slider = soundLockSliderFromVar(var); MystAreaSlider *slider = soundLockSliderFromVar(var);
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
@ -820,9 +793,7 @@ void Selenitic::o_soundLockStartMove(uint16 op, uint16 var, const ArgumentsArray
_vm->_sound->playEffect(_soundLockSoundId, true); _vm->_sound->playEffect(_soundLockSoundId, true);
} }
void Selenitic::o_soundLockEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_soundLockEndMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound lock end move", op);
MystAreaSlider *slider = soundLockSliderFromVar(var); MystAreaSlider *slider = soundLockSliderFromVar(var);
uint16 *value = &_state.soundLockSliderPositions[0]; uint16 *value = &_state.soundLockSliderPositions[0];
@ -879,9 +850,7 @@ void Selenitic::soundLockCheckSolution(MystAreaSlider *slider, uint16 value, uin
_vm->_sound->stopEffect(); _vm->_sound->stopEffect();
} }
void Selenitic::o_soundLockButton(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_soundLockButton(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound lock button", op);
bool solved = true; bool solved = true;
_vm->_sound->pauseBackground(); _vm->_sound->pauseBackground();
@ -920,9 +889,7 @@ void Selenitic::o_soundLockButton(uint16 op, uint16 var, const ArgumentsArray &a
_vm->_cursor->showCursor(); _vm->_cursor->showCursor();
} }
void Selenitic::o_soundReceiverEndMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_soundReceiverEndMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound receiver end move", op);
uint16 oldDirection = _soundReceiverDirection; uint16 oldDirection = _soundReceiverDirection;
if (_soundReceiverDirection) { if (_soundReceiverDirection) {
@ -937,15 +904,15 @@ void Selenitic::o_soundReceiverEndMove(uint16 op, uint16 var, const ArgumentsArr
} }
} }
void Selenitic::o_mazeRunnerCompass_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_mazeRunnerCompass_init(uint16 var, const ArgumentsArray &args) {
_mazeRunnerCompass = getInvokingResource<MystAreaImageSwitch>(); _mazeRunnerCompass = getInvokingResource<MystAreaImageSwitch>();
} }
void Selenitic::o_mazeRunnerWindow_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_mazeRunnerWindow_init(uint16 var, const ArgumentsArray &args) {
_mazeRunnerWindow = getInvokingResource<MystAreaImageSwitch>(); _mazeRunnerWindow = getInvokingResource<MystAreaImageSwitch>();
} }
void Selenitic::o_mazeRunnerLight_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_mazeRunnerLight_init(uint16 var, const ArgumentsArray &args) {
_mazeRunnerLight = getInvokingResource<MystAreaImageSwitch>(); _mazeRunnerLight = getInvokingResource<MystAreaImageSwitch>();
} }
@ -1065,9 +1032,7 @@ void Selenitic::soundReceiverSolution(uint16 source, uint16 &solution, bool &ena
} }
} }
void Selenitic::o_soundReceiver_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_soundReceiver_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound receiver init", op);
// Used for Card 1245 (Sound Receiver) // Used for Card 1245 (Sound Receiver)
_soundReceiverRunning = true; _soundReceiverRunning = true;
@ -1094,9 +1059,7 @@ void Selenitic::o_soundReceiver_init(uint16 op, uint16 var, const ArgumentsArray
_soundReceiverSigmaPressed = false; _soundReceiverSigmaPressed = false;
} }
void Selenitic::o_soundLock_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_soundLock_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Sound lock init", op);
for (uint i = 0; i < _vm->_resources.size(); i++) { for (uint i = 0; i < _vm->_resources.size(); i++) {
if (_vm->_resources[i]->type == kMystAreaSlider) { if (_vm->_resources[i]->type == kMystAreaSlider) {
switch (_vm->_resources[i]->getImageSwitchVar()) { switch (_vm->_resources[i]->getImageSwitchVar()) {
@ -1129,11 +1092,11 @@ void Selenitic::o_soundLock_init(uint16 op, uint16 var, const ArgumentsArray &ar
_soundLockSoundId = 0; _soundLockSoundId = 0;
} }
void Selenitic::o_mazeRunnerRight_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_mazeRunnerRight_init(uint16 var, const ArgumentsArray &args) {
_mazeRunnerRightButton = getInvokingResource<MystAreaImageSwitch>(); _mazeRunnerRightButton = getInvokingResource<MystAreaImageSwitch>();
} }
void Selenitic::o_mazeRunnerLeft_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Selenitic::o_mazeRunnerLeft_init(uint16 var, const ArgumentsArray &args) {
_mazeRunnerLeftButton = getInvokingResource<MystAreaImageSwitch>(); _mazeRunnerLeftButton = getInvokingResource<MystAreaImageSwitch>();
} }

View file

@ -34,7 +34,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Selenitic : public MystScriptParser { class Selenitic : public MystScriptParser {
public: public:

View file

@ -68,18 +68,14 @@ void Slides::runPersistentScripts() {
} }
} }
void Slides::o_returnToMenu(uint16 op, uint16 var, const ArgumentsArray &args) { void Slides::o_returnToMenu(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Return to menu", op);
// Go to the information screens of the menu // Go to the information screens of the menu
_vm->changeToStack(kDemoStack, 2002, 0, 0); _vm->changeToStack(kDemoStack, 2002, 0, 0);
} }
void Slides::o_setCardSwap(uint16 op, uint16 var, const ArgumentsArray &args) { void Slides::o_setCardSwap(uint16 var, const ArgumentsArray &args) {
_nextCardID = args[0]; _nextCardID = args[0];
debugC(kDebugScript, "Opcode %d: Set next card %d", op, _nextCardID);
_nextCardTime = _vm->_system->getMillis() + 5000; _nextCardTime = _vm->_system->getMillis() + 5000;
_cardSwapEnabled = true; _cardSwapEnabled = true;
} }

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Slides : public MystScriptParser { class Slides : public MystScriptParser {
public: public:

View file

@ -383,9 +383,7 @@ bool Stoneship::setVarValue(uint16 var, uint16 value) {
return refresh; return refresh;
} }
void Stoneship::o_pumpTurnOff(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_pumpTurnOff(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Turn off previous pump selection", op);
if (_state.pumpState) { if (_state.pumpState) {
uint16 buttonVar = 0; uint16 buttonVar = 0;
@ -413,17 +411,13 @@ void Stoneship::o_pumpTurnOff(uint16 op, uint16 var, const ArgumentsArray &args)
} }
} }
void Stoneship::o_brotherDoorOpen(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_brotherDoorOpen(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Open brother door", op);
_brotherDoorOpen = 1; _brotherDoorOpen = 1;
_vm->redrawArea(19, 0); _vm->redrawArea(19, 0);
animatedUpdate(args, 5); animatedUpdate(args, 5);
} }
void Stoneship::o_cabinBookMovie(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_cabinBookMovie(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Play Book Room Movie", op);
uint16 startTime = args[0]; uint16 startTime = args[0];
uint16 endTime = args[1]; uint16 endTime = args[1];
@ -436,9 +430,7 @@ void Stoneship::o_cabinBookMovie(uint16 op, uint16 var, const ArgumentsArray &ar
_vm->waitUntilMovieEnds(book); _vm->waitUntilMovieEnds(book);
} }
void Stoneship::o_drawerOpenSirius(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_drawerOpenSirius(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Open drawer", op);
MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(args[0]); MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(args[0]);
if (drawer->getImageSwitchVar() == 35) { if (drawer->getImageSwitchVar() == 35) {
@ -454,20 +446,17 @@ void Stoneship::o_drawerOpenSirius(uint16 op, uint16 var, const ArgumentsArray &
_vm->_gfx->runTransition(transition, drawer->getRect(), 25, 5); _vm->_gfx->runTransition(transition, drawer->getRect(), 25, 5);
} }
void Stoneship::o_drawerClose(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_drawerClose(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Close drawer", op);
drawerClose(args[0]); drawerClose(args[0]);
} }
void Stoneship::o_telescopeStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_telescopeStart(uint16 var, const ArgumentsArray &args) {
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
_telescopeOldMouse = mouse.x; _telescopeOldMouse = mouse.x;
_vm->_cursor->setCursor(700); _vm->_cursor->setCursor(700);
} }
void Stoneship::o_telescopeMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_telescopeMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Telescope move", op);
MystAreaDrag *display = getInvokingResource<MystAreaDrag>(); MystAreaDrag *display = getInvokingResource<MystAreaDrag>();
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
@ -483,13 +472,11 @@ void Stoneship::o_telescopeMove(uint16 op, uint16 var, const ArgumentsArray &arg
telescopeLighthouseDraw(); telescopeLighthouseDraw();
} }
void Stoneship::o_telescopeStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_telescopeStop(uint16 var, const ArgumentsArray &args) {
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Stoneship::o_generatorStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_generatorStart(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Generator start", op);
MystAreaDrag *handle = getInvokingResource<MystAreaDrag>(); MystAreaDrag *handle = getInvokingResource<MystAreaDrag>();
uint16 soundId = handle->getList1(0); uint16 soundId = handle->getList1(0);
@ -513,9 +500,7 @@ void Stoneship::o_generatorStart(uint16 op, uint16 var, const ArgumentsArray &ar
_vm->_sound->playEffect(soundId, true); _vm->_sound->playEffect(soundId, true);
} }
void Stoneship::o_generatorStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_generatorStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Generator stop", op);
_batteryCharging = false; _batteryCharging = false;
if (_state.generatorDuration) { if (_state.generatorDuration) {
@ -580,18 +565,14 @@ void Stoneship::batteryDeplete_run() {
} }
} }
void Stoneship::o_drawerOpenAchenar(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_drawerOpenAchenar(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Open drawer", op);
MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(args[0]); MystAreaImageSwitch *drawer = _vm->getViewResource<MystAreaImageSwitch>(args[0]);
drawer->drawConditionalDataToScreen(0, 0); drawer->drawConditionalDataToScreen(0, 0);
_vm->_gfx->runTransition(kTransitionTopToBottom, drawer->getRect(), 25, 5); _vm->_gfx->runTransition(kTransitionTopToBottom, drawer->getRect(), 25, 5);
} }
void Stoneship::o_hologramPlayback(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_hologramPlayback(uint16 var, const ArgumentsArray &args) {
// Used for Card 2013 (Achenar's Rose-Skull Hologram) // Used for Card 2013 (Achenar's Rose-Skull Hologram)
debugC(kDebugScript, "Opcode %d: Rose-Skull Hologram Playback", op);
uint16 startPoint = args[0]; uint16 startPoint = args[0];
uint16 endPoint = args[1]; uint16 endPoint = args[1];
// uint16 direction = args[2]; // uint16 direction = args[2];
@ -610,14 +591,11 @@ void Stoneship::o_hologramPlayback(uint16 op, uint16 var, const ArgumentsArray &
_vm->waitUntilMovieEnds(displayMovie); _vm->waitUntilMovieEnds(displayMovie);
} }
void Stoneship::o_hologramSelectionStart(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_hologramSelectionStart(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Hologram start move", op);
//_vm->_cursor->setCursor(0); //_vm->_cursor->setCursor(0);
} }
void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_hologramSelectionMove(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Hologram move", op);
MystAreaDrag *handle = getInvokingResource<MystAreaDrag>(); MystAreaDrag *handle = getInvokingResource<MystAreaDrag>();
const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos(); const Common::Point &mouse = _vm->_system->getEventManager()->getMousePos();
@ -642,13 +620,11 @@ void Stoneship::o_hologramSelectionMove(uint16 op, uint16 var, const ArgumentsAr
} }
} }
void Stoneship::o_hologramSelectionStop(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_hologramSelectionStop(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Hologram stop move", op);
_vm->checkCursorHints(); _vm->checkCursorHints();
} }
void Stoneship::o_compassButton(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_compassButton(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Compass rose button pressed", op);
// Used on Card 2111 (Compass Rose) // Used on Card 2111 (Compass Rose)
// Called when Button Clicked. // Called when Button Clicked.
uint16 correctButton = args[0]; uint16 correctButton = args[0];
@ -666,12 +642,10 @@ void Stoneship::o_compassButton(uint16 op, uint16 var, const ArgumentsArray &arg
_batteryDepleting = false; _batteryDepleting = false;
} }
o_redrawCard(op, var, args); o_redrawCard(var, args);
} }
void Stoneship::o_chestValveVideos(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_chestValveVideos(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Chest valve videos", op);
Common::String movie = _vm->wrapMovieFilename("ligspig", kStoneshipStack); Common::String movie = _vm->wrapMovieFilename("ligspig", kStoneshipStack);
_vm->_sound->playEffect(2132); _vm->_sound->playEffect(2132);
@ -721,9 +695,7 @@ void Stoneship::o_chestValveVideos(uint16 op, uint16 var, const ArgumentsArray &
} }
} }
void Stoneship::o_chestDropKey(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_chestDropKey(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: drop chest key", op);
// If holding Key to Lamp Room Trapdoor, drop to bottom of // If holding Key to Lamp Room Trapdoor, drop to bottom of
// Lighthouse... // Lighthouse...
if (_state.trapdoorKeyState == 1) { if (_state.trapdoorKeyState == 1) {
@ -732,9 +704,7 @@ void Stoneship::o_chestDropKey(uint16 op, uint16 var, const ArgumentsArray &args
} }
} }
void Stoneship::o_trapLockOpen(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_trapLockOpen(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Trap lock open video", op);
Common::String movie = _vm->wrapMovieFilename("openloc", kStoneshipStack); Common::String movie = _vm->wrapMovieFilename("openloc", kStoneshipStack);
VideoEntryPtr lock = _vm->_video->playMovie(movie); VideoEntryPtr lock = _vm->_video->playMovie(movie);
@ -759,13 +729,10 @@ void Stoneship::o_trapLockOpen(uint16 op, uint16 var, const ArgumentsArray &args
_vm->_sound->playEffect(4143); _vm->_sound->playEffect(4143);
} }
void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_sideDoorsMovies(uint16 var, const ArgumentsArray &args) {
// Used for Cards 2285, 2289, 2247, 2251 (Side Doors in Tunnels Down To Brothers Rooms) // Used for Cards 2285, 2289, 2247, 2251 (Side Doors in Tunnels Down To Brothers Rooms)
uint16 movieId = args[0]; uint16 movieId = args[0];
debugC(kDebugScript, "Opcode %d: Play Side Door Movies", op);
debugC(kDebugScript, "\tmovieId: %d", movieId);
_vm->_cursor->hideCursor(); _vm->_cursor->hideCursor();
_vm->_sound->pauseBackground(); _vm->_sound->pauseBackground();
@ -795,24 +762,18 @@ void Stoneship::o_sideDoorsMovies(uint16 op, uint16 var, const ArgumentsArray &a
_vm->_cursor->showCursor(); _vm->_cursor->showCursor();
} }
void Stoneship::o_cloudOrbEnter(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_cloudOrbEnter(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Cloud orb enter", op);
_vm->_sound->playEffect(_cloudOrbSound, true); _vm->_sound->playEffect(_cloudOrbSound, true);
_cloudOrbMovie->playMovie(); _cloudOrbMovie->playMovie();
} }
void Stoneship::o_cloudOrbLeave(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_cloudOrbLeave(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Cloud orb leave", op);
_cloudOrbMovie->pauseMovie(true); _cloudOrbMovie->pauseMovie(true);
_vm->_sound->playEffect(_cloudOrbStopSound); _vm->_sound->playEffect(_cloudOrbStopSound);
_vm->_gfx->runTransition(kTransitionTopToBottom, getInvokingResource<MystArea>()->getRect(), 4, 0); _vm->_gfx->runTransition(kTransitionTopToBottom, getInvokingResource<MystArea>()->getRect(), 4, 0);
} }
void Stoneship::o_drawerCloseOpened(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_drawerCloseOpened(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Close open drawer", op);
uint16 drawerOpen = getVar(var); uint16 drawerOpen = getVar(var);
if (drawerOpen) if (drawerOpen)
drawerClose(args[0] + drawerOpen - 1); drawerClose(args[0] + drawerOpen - 1);
@ -827,15 +788,13 @@ void Stoneship::drawerClose(uint16 drawer) {
_vm->_gfx->runTransition(kTransitionBottomToTop, res->getRect(), 25, 5); _vm->_gfx->runTransition(kTransitionBottomToTop, res->getRect(), 25, 5);
} }
void Stoneship::o_hologramDisplay_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_hologramDisplay_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Hologram display init", op);
_hologramDisplay = getInvokingResource<MystAreaVideo>(); _hologramDisplay = getInvokingResource<MystAreaVideo>();
_hologramDisplayPos = 0; _hologramDisplayPos = 0;
} }
void Stoneship::o_hologramSelection_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_hologramSelection_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Hologram selection init", op);
_hologramSelection = getInvokingResource<MystAreaVideo>(); _hologramSelection = getInvokingResource<MystAreaVideo>();
} }
@ -853,26 +812,21 @@ void Stoneship::batteryGaugeUpdate() {
_batteryGauge->setRect(rect); _batteryGauge->setRect(rect);
} }
void Stoneship::o_battery_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_battery_init(uint16 var, const ArgumentsArray &args) {
// Used for Card 2160 (Lighthouse Battery Pack Closeup) // Used for Card 2160 (Lighthouse Battery Pack Closeup)
debugC(kDebugScript, "Opcode %d: Battery init", op);
_batteryGauge = getInvokingResource<MystAreaImageSwitch>(); _batteryGauge = getInvokingResource<MystAreaImageSwitch>();
batteryGaugeUpdate(); batteryGaugeUpdate();
} }
void Stoneship::o_tunnelEnter_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_tunnelEnter_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Tunnel enter", op); o_tunnel_init(var, args);
o_tunnel_init(op, var, args);
_tunnelRunning = true; _tunnelRunning = true;
_tunnelNextTime = _vm->_system->getMillis() + 1500; _tunnelNextTime = _vm->_system->getMillis() + 1500;
} }
void Stoneship::o_batteryGauge_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_batteryGauge_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Battery gauge init", op);
_batteryLastCharge = batteryRemainingCharge(); _batteryLastCharge = batteryRemainingCharge();
_batteryGaugeRunning = true; _batteryGaugeRunning = true;
} }
@ -892,9 +846,7 @@ void Stoneship::batteryGauge_run() {
} }
} }
void Stoneship::o_tunnel_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_tunnel_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Tunnel card init", op);
_tunnelImagesCount = args[0]; _tunnelImagesCount = args[0];
assert(_tunnelImagesCount <= 2 && "Too many images"); assert(_tunnelImagesCount <= 2 && "Too many images");
@ -930,21 +882,15 @@ void Stoneship::tunnel_run() {
} }
} }
void Stoneship::o_tunnelLeave_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_tunnelLeave_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Tunnel leave", op);
_tunnelRunning = false; _tunnelRunning = false;
} }
void Stoneship::o_chest_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_chest_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Chest init", op);
_state.chestOpenState = 0; _state.chestOpenState = 0;
} }
void Stoneship::o_telescope_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_telescope_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Telescope init", op);
// Used in Card 2218 (Telescope view) // Used in Card 2218 (Telescope view)
_telescopePanorama = args[0]; _telescopePanorama = args[0];
_telescopeLighthouseOff = args[1]; _telescopeLighthouseOff = args[1];
@ -990,9 +936,7 @@ void Stoneship::telescopeLighthouseDraw() {
} }
} }
void Stoneship::o_achenarDrawers_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_achenarDrawers_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Achenar's Room Drawers Init", op);
// Used for Card 2004 (Achenar's Room Drawers) // Used for Card 2004 (Achenar's Room Drawers)
if (!_chestAchenarBottomDrawerClosed) { if (!_chestAchenarBottomDrawerClosed) {
uint16 count1 = args[0]; uint16 count1 = args[0];
@ -1008,9 +952,7 @@ void Stoneship::o_achenarDrawers_init(uint16 op, uint16 var, const ArgumentsArra
} }
} }
void Stoneship::o_cloudOrb_init(uint16 op, uint16 var, const ArgumentsArray &args) { void Stoneship::o_cloudOrb_init(uint16 var, const ArgumentsArray &args) {
debugC(kDebugScript, "Opcode %d: Cloud orb init", op);
_cloudOrbMovie = getInvokingResource<MystAreaVideo>(); _cloudOrbMovie = getInvokingResource<MystAreaVideo>();
_cloudOrbSound = args[0]; _cloudOrbSound = args[0];
_cloudOrbStopSound = args[1]; _cloudOrbStopSound = args[1];

View file

@ -33,7 +33,7 @@ struct MystScriptEntry;
namespace MystStacks { namespace MystStacks {
#define DECLARE_OPCODE(x) void x(uint16 op, uint16 var, const ArgumentsArray &args) #define DECLARE_OPCODE(x) void x(uint16 var, const ArgumentsArray &args)
class Stoneship : public MystScriptParser { class Stoneship : public MystScriptParser {
public: public: