aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/myst_scripts.cpp122
-rw-r--r--engines/mohawk/myst_scripts.h29
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp70
-rw-r--r--engines/mohawk/myst_stacks/credits.cpp8
-rw-r--r--engines/mohawk/myst_stacks/demo.cpp21
-rw-r--r--engines/mohawk/myst_stacks/dni.cpp12
-rw-r--r--engines/mohawk/myst_stacks/intro.cpp12
-rw-r--r--engines/mohawk/myst_stacks/makingof.cpp6
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp88
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp270
-rw-r--r--engines/mohawk/myst_stacks/preview.cpp27
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp54
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp8
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp76
14 files changed, 380 insertions, 423 deletions
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index ce742f3a41..ba426505e1 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -84,71 +84,81 @@ MystScriptParser::MystScriptParser(MohawkEngine_Myst *vm) :
}
MystScriptParser::~MystScriptParser() {
- for (uint32 i = 0; i < _opcodes.size(); i++)
- delete _opcodes[i];
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, &MystScriptParser::x, #x))
-
void MystScriptParser::setupCommonOpcodes() {
// These opcodes are common to each stack
// "Standard" Opcodes
- OPCODE(0, o_toggleVar);
- OPCODE(1, o_setVar);
- OPCODE(2, o_changeCardSwitch4);
- OPCODE(3, o_takePage);
- OPCODE(4, o_redrawCard);
+ REGISTER_OPCODE(0, MystScriptParser, o_toggleVar);
+ REGISTER_OPCODE(1, MystScriptParser, o_setVar);
+ REGISTER_OPCODE(2, MystScriptParser, o_changeCardSwitch4);
+ REGISTER_OPCODE(3, MystScriptParser, o_takePage);
+ REGISTER_OPCODE(4, MystScriptParser, o_redrawCard);
// Opcode 5 Not Present
- OPCODE(6, o_goToDestForward);
- OPCODE(7, o_goToDestRight);
- OPCODE(8, o_goToDestLeft);
- OPCODE(9, o_triggerMovie);
- OPCODE(10, o_toggleVarNoRedraw);
+ REGISTER_OPCODE(6, MystScriptParser, o_goToDestForward);
+ REGISTER_OPCODE(7, MystScriptParser, o_goToDestRight);
+ REGISTER_OPCODE(8, MystScriptParser, o_goToDestLeft);
+ REGISTER_OPCODE(9, MystScriptParser, o_triggerMovie);
+ REGISTER_OPCODE(10, MystScriptParser, o_toggleVarNoRedraw);
// Opcode 11 Not Present
- OPCODE(12, o_changeCardSwitchLtR);
- OPCODE(13, o_changeCardSwitchRtL);
- OPCODE(14, o_drawAreaState);
- OPCODE(15, o_redrawAreaForVar);
- OPCODE(16, o_changeCardDirectional);
- OPCODE(17, o_changeCardPush);
- OPCODE(18, o_changeCardPop);
- OPCODE(19, o_enableAreas);
- OPCODE(20, o_disableAreas);
- OPCODE(21, o_directionalUpdate);
- OPCODE(22, o_goToDestUp);
- OPCODE(23, o_toggleAreasActivation);
- OPCODE(24, o_playSound);
+ REGISTER_OPCODE(12, MystScriptParser, o_changeCardSwitchLtR);
+ REGISTER_OPCODE(13, MystScriptParser, o_changeCardSwitchRtL);
+ REGISTER_OPCODE(14, MystScriptParser, o_drawAreaState);
+ REGISTER_OPCODE(15, MystScriptParser, o_redrawAreaForVar);
+ REGISTER_OPCODE(16, MystScriptParser, o_changeCardDirectional);
+ REGISTER_OPCODE(17, MystScriptParser, o_changeCardPush);
+ REGISTER_OPCODE(18, MystScriptParser, o_changeCardPop);
+ REGISTER_OPCODE(19, MystScriptParser, o_enableAreas);
+ REGISTER_OPCODE(20, MystScriptParser, o_disableAreas);
+ REGISTER_OPCODE(21, MystScriptParser, o_directionalUpdate);
+ REGISTER_OPCODE(22, MystScriptParser, o_goToDestUp);
+ REGISTER_OPCODE(23, MystScriptParser, o_toggleAreasActivation);
+ REGISTER_OPCODE(24, MystScriptParser, o_playSound);
// Opcode 25 is unused; original calls replaceSoundMyst
- OPCODE(26, o_stopSoundBackground);
- OPCODE(27, o_playSoundBlocking);
- OPCODE(28, o_copyBackBufferToScreen);
- OPCODE(29, o_copyImageToBackBuffer);
- OPCODE(30, o_changeBackgroundSound);
- OPCODE(31, o_soundPlaySwitch);
- OPCODE(32, o_soundResumeBackground);
- OPCODE(33, o_copyImageToScreen);
- OPCODE(34, o_changeCard);
- OPCODE(35, o_drawImageChangeCard);
- OPCODE(36, o_changeMainCursor);
- OPCODE(37, o_hideCursor);
- OPCODE(38, o_showCursor);
- OPCODE(39, o_delay);
- OPCODE(40, o_changeStack);
- OPCODE(41, o_changeCardPlaySoundDirectional);
- OPCODE(42, o_directionalUpdatePlaySound);
- OPCODE(43, o_saveMainCursor);
- OPCODE(44, o_restoreMainCursor);
+ REGISTER_OPCODE(26, MystScriptParser, o_stopSoundBackground);
+ REGISTER_OPCODE(27, MystScriptParser, o_playSoundBlocking);
+ REGISTER_OPCODE(28, MystScriptParser, o_copyBackBufferToScreen);
+ REGISTER_OPCODE(29, MystScriptParser, o_copyImageToBackBuffer);
+ REGISTER_OPCODE(30, MystScriptParser, o_changeBackgroundSound);
+ REGISTER_OPCODE(31, MystScriptParser, o_soundPlaySwitch);
+ REGISTER_OPCODE(32, MystScriptParser, o_soundResumeBackground);
+ REGISTER_OPCODE(33, MystScriptParser, o_copyImageToScreen);
+ REGISTER_OPCODE(34, MystScriptParser, o_changeCard);
+ REGISTER_OPCODE(35, MystScriptParser, o_drawImageChangeCard);
+ REGISTER_OPCODE(36, MystScriptParser, o_changeMainCursor);
+ REGISTER_OPCODE(37, MystScriptParser, o_hideCursor);
+ REGISTER_OPCODE(38, MystScriptParser, o_showCursor);
+ REGISTER_OPCODE(39, MystScriptParser, o_delay);
+ REGISTER_OPCODE(40, MystScriptParser, o_changeStack);
+ REGISTER_OPCODE(41, MystScriptParser, o_changeCardPlaySoundDirectional);
+ REGISTER_OPCODE(42, MystScriptParser, o_directionalUpdatePlaySound);
+ REGISTER_OPCODE(43, MystScriptParser, o_saveMainCursor);
+ REGISTER_OPCODE(44, MystScriptParser, o_restoreMainCursor);
// Opcode 45 Not Present
- OPCODE(46, o_soundWaitStop);
- OPCODE(48, o_goToDest);
- OPCODE(51, o_exitMap);
+ REGISTER_OPCODE(46, MystScriptParser, o_soundWaitStop);
+ REGISTER_OPCODE(48, MystScriptParser, o_goToDest);
+ REGISTER_OPCODE(51, MystScriptParser, o_exitMap);
// Opcodes 47 to 99 Not Present
- OPCODE(0xFFFF, NOP);
+ REGISTER_OPCODE(0xFFFF, MystScriptParser, NOP);
+}
+
+void MystScriptParser::registerOpcode(uint16 op, const char *name, OpcodeProcMyst *command) {
+ _opcodes.push_back(MystOpcode(op, command, name));
}
-#undef OPCODE
+void MystScriptParser::overrideOpcode(uint16 op, const char *name, MystScriptParser::OpcodeProcMyst *command) {
+ for (uint i = 0; i < _opcodes.size(); i++) {
+ if (_opcodes[i].op == op) {
+ _opcodes[i].desc = name;
+ _opcodes[i].proc = Common::SharedPtr<OpcodeProcMyst>(command);
+ return;
+ }
+ }
+
+ warning("Unable to find opcode %d to override with '%s'", op, name);
+}
void MystScriptParser::runScript(MystScript script, MystArea *invokingResource) {
_scriptNestingLevel++;
@@ -172,12 +182,12 @@ void MystScriptParser::runOpcode(uint16 op, uint16 var, const ArgumentsArray &ar
bool ranOpcode = false;
for (uint16 i = 0; i < _opcodes.size(); i++)
- if (_opcodes[i]->op == op) {
+ if (_opcodes[i].op == op) {
if (DebugMan.isDebugChannelEnabled(kDebugScript)) {
- debugC(kDebugScript, "Running command: %s", describeCommand(*_opcodes[i], var, args).c_str());
+ debugC(kDebugScript, "Running command: %s", describeCommand(_opcodes[i], var, args).c_str());
}
- (this->*(_opcodes[i]->proc)) (var, args);
+ (*_opcodes[i].proc)(var, args);
ranOpcode = true;
break;
}
@@ -194,8 +204,8 @@ bool MystScriptParser::isScriptRunning() const {
const Common::String MystScriptParser::getOpcodeDesc(uint16 op) {
for (uint16 i = 0; i < _opcodes.size(); i++)
- if (_opcodes[i]->op == op)
- return _opcodes[i]->desc;
+ if (_opcodes[i].op == op)
+ return _opcodes[i].desc;
return Common::String::format("%d", op);
}
diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h
index ec22fecdac..a336f0239a 100644
--- a/engines/mohawk/myst_scripts.h
+++ b/engines/mohawk/myst_scripts.h
@@ -144,17 +144,20 @@ protected:
MohawkEngine_Myst *_vm;
MystGameState::Globals &_globals;
- typedef void (MystScriptParser::*OpcodeProcMyst)(uint16 var, const ArgumentsArray &args);
+ typedef Common::Functor2<uint16, const ArgumentsArray &, void> OpcodeProcMyst;
- struct MystOpcode {
- MystOpcode(uint16 o, OpcodeProcMyst p, const char *d) : op(o), proc(p), desc(d) {}
+#define REGISTER_OPCODE(op, cls, method) \
+ registerOpcode( \
+ op, #method, new Common::Functor2Mem<uint16, const ArgumentsArray &, void, cls>(this, &cls::method) \
+ )
- uint16 op;
- OpcodeProcMyst proc;
- const char *desc;
- };
+#define OVERRIDE_OPCODE(op, cls, method) \
+ overrideOpcode( \
+ op, #method, new Common::Functor2Mem<uint16, const ArgumentsArray &, void, cls>(this, &cls::method) \
+ )
- Common::Array<MystOpcode *> _opcodes;
+ void registerOpcode(uint16 op, const char *name, OpcodeProcMyst *command);
+ void overrideOpcode(uint16 op, const char *name, OpcodeProcMyst *command);
uint16 _savedCardId;
uint16 _savedMapCardId;
@@ -171,6 +174,16 @@ protected:
T *getInvokingResource() const;
private:
+ struct MystOpcode {
+ MystOpcode(uint16 o, OpcodeProcMyst *p, const char *d) : op(o), proc(p), desc(d) {}
+
+ uint16 op;
+ Common::SharedPtr<OpcodeProcMyst> proc;
+ const char *desc;
+ };
+
+ Common::Array<MystOpcode> _opcodes;
+
MystArea *_invokingResource;
int32 _scriptNestingLevel;
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index 208275d851..4777e92899 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -44,51 +44,47 @@ Channelwood::Channelwood(MohawkEngine_Myst *vm) :
Channelwood::~Channelwood() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Channelwood::x, #x))
-
void Channelwood::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, o_bridgeToggle);
- OPCODE(101, o_pipeExtend);
- OPCODE(102, o_drawImageChangeCardAndVolume);
- OPCODE(104, o_waterTankValveOpen);
- OPCODE(105, o_leverStartMove);
- OPCODE(106, o_leverEndMove);
- OPCODE(107, o_leverMoveFail);
- OPCODE(108, o_leverMove);
- OPCODE(109, o_stairsDoorToggle);
- OPCODE(110, o_valveHandleMove1);
- OPCODE(111, o_valveHandleMoveStart1);
- OPCODE(112, o_valveHandleMoveStop);
- OPCODE(113, o_valveHandleMove2);
- OPCODE(114, o_valveHandleMoveStart2);
- OPCODE(115, o_valveHandleMove3);
- OPCODE(116, o_valveHandleMoveStart3);
- OPCODE(117, o_hologramMonitor);
- OPCODE(118, o_drawerOpen);
- OPCODE(119, o_hologramTemple);
- OPCODE(120, o_leverElev3StartMove);
- OPCODE(121, o_leverElev3EndMove);
- OPCODE(122, o_waterTankValveClose);
- OPCODE(123, o_executeMouseUp);
- OPCODE(124, o_leverEndMoveWithSound);
- OPCODE(125, o_pumpLeverMove);
- OPCODE(126, o_pumpLeverEndMove);
- OPCODE(127, o_elevatorMovies);
- OPCODE(128, o_leverEndMoveResumeBackground);
- OPCODE(129, o_soundReplace);
+ REGISTER_OPCODE(100, Channelwood, o_bridgeToggle);
+ REGISTER_OPCODE(101, Channelwood, o_pipeExtend);
+ REGISTER_OPCODE(102, Channelwood, o_drawImageChangeCardAndVolume);
+ REGISTER_OPCODE(104, Channelwood, o_waterTankValveOpen);
+ REGISTER_OPCODE(105, Channelwood, o_leverStartMove);
+ REGISTER_OPCODE(106, Channelwood, o_leverEndMove);
+ REGISTER_OPCODE(107, Channelwood, o_leverMoveFail);
+ REGISTER_OPCODE(108, Channelwood, o_leverMove);
+ REGISTER_OPCODE(109, Channelwood, o_stairsDoorToggle);
+ REGISTER_OPCODE(110, Channelwood, o_valveHandleMove1);
+ REGISTER_OPCODE(111, Channelwood, o_valveHandleMoveStart1);
+ REGISTER_OPCODE(112, Channelwood, o_valveHandleMoveStop);
+ REGISTER_OPCODE(113, Channelwood, o_valveHandleMove2);
+ REGISTER_OPCODE(114, Channelwood, o_valveHandleMoveStart2);
+ REGISTER_OPCODE(115, Channelwood, o_valveHandleMove3);
+ REGISTER_OPCODE(116, Channelwood, o_valveHandleMoveStart3);
+ REGISTER_OPCODE(117, Channelwood, o_hologramMonitor);
+ REGISTER_OPCODE(118, Channelwood, o_drawerOpen);
+ REGISTER_OPCODE(119, Channelwood, o_hologramTemple);
+ REGISTER_OPCODE(120, Channelwood, o_leverElev3StartMove);
+ REGISTER_OPCODE(121, Channelwood, o_leverElev3EndMove);
+ REGISTER_OPCODE(122, Channelwood, o_waterTankValveClose);
+ REGISTER_OPCODE(123, Channelwood, o_executeMouseUp);
+ REGISTER_OPCODE(124, Channelwood, o_leverEndMoveWithSound);
+ REGISTER_OPCODE(125, Channelwood, o_pumpLeverMove);
+ REGISTER_OPCODE(126, Channelwood, o_pumpLeverEndMove);
+ REGISTER_OPCODE(127, Channelwood, o_elevatorMovies);
+ REGISTER_OPCODE(128, Channelwood, o_leverEndMoveResumeBackground);
+ REGISTER_OPCODE(129, Channelwood, o_soundReplace);
// "Init" Opcodes
- OPCODE(201, o_lever_init);
- OPCODE(202, o_pipeValve_init);
- OPCODE(203, o_drawer_init);
+ REGISTER_OPCODE(201, Channelwood, o_lever_init);
+ REGISTER_OPCODE(202, Channelwood, o_pipeValve_init);
+ REGISTER_OPCODE(203, Channelwood, o_drawer_init);
// "Exit" Opcodes
- OPCODE(300, NOP);
+ REGISTER_OPCODE(300, Channelwood, NOP);
}
-#undef OPCODE
-
void Channelwood::disablePersistentScripts() {
}
diff --git a/engines/mohawk/myst_stacks/credits.cpp b/engines/mohawk/myst_stacks/credits.cpp
index 752e624c68..ba49ac2201 100644
--- a/engines/mohawk/myst_stacks/credits.cpp
+++ b/engines/mohawk/myst_stacks/credits.cpp
@@ -42,18 +42,14 @@ Credits::Credits(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
Credits::~Credits() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Credits::x, #x))
-
void Credits::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, o_quit);
+ REGISTER_OPCODE(100, Credits, o_quit);
// "Init" Opcodes
- OPCODE(200, o_runCredits);
+ REGISTER_OPCODE(200, Credits, o_runCredits);
}
-#undef OPCODE
-
void Credits::disablePersistentScripts() {
_creditsRunning = false;
}
diff --git a/engines/mohawk/myst_stacks/demo.cpp b/engines/mohawk/myst_stacks/demo.cpp
index 92c1dc7631..7ae55686c5 100644
--- a/engines/mohawk/myst_stacks/demo.cpp
+++ b/engines/mohawk/myst_stacks/demo.cpp
@@ -39,29 +39,16 @@ Demo::Demo(MohawkEngine_Myst *vm) : Intro(vm) {
Demo::~Demo() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Demo::x, #x))
-
-#define OVERRIDE_OPCODE(opcode, x) \
- for (uint32 i = 0; i < _opcodes.size(); i++) \
- if (_opcodes[i]->op == opcode) { \
- _opcodes[i]->proc = (OpcodeProcMyst) &Demo::x; \
- _opcodes[i]->desc = #x; \
- break; \
- }
-
void Demo::setupOpcodes() {
// "Stack-Specific" Opcodes
- OVERRIDE_OPCODE(100, o_stopIntro);
- OPCODE(101, o_fadeFromBlack);
- OPCODE(102, o_fadeToBlack);
+ OVERRIDE_OPCODE(100, Demo, o_stopIntro);
+ REGISTER_OPCODE(101, Demo, o_fadeFromBlack);
+ REGISTER_OPCODE(102, Demo, o_fadeToBlack);
// "Init" Opcodes
- OVERRIDE_OPCODE(201, o_returnToMenu_init);
+ OVERRIDE_OPCODE(201, Demo, o_returnToMenu_init);
}
-#undef OPCODE
-#undef OVERRIDE_OPCODE
-
void Demo::disablePersistentScripts() {
Intro::disablePersistentScripts();
diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp
index b0b485b3cc..c668a8c37e 100644
--- a/engines/mohawk/myst_stacks/dni.cpp
+++ b/engines/mohawk/myst_stacks/dni.cpp
@@ -42,22 +42,18 @@ Dni::Dni(MohawkEngine_Myst *vm) :
Dni::~Dni() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Dni::x, #x))
-
void Dni::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, NOP);
- OPCODE(101, o_handPage);
+ REGISTER_OPCODE(100, Dni, NOP);
+ REGISTER_OPCODE(101, Dni, o_handPage);
// "Init" Opcodes
- OPCODE(200, o_atrus_init);
+ REGISTER_OPCODE(200, Dni, o_atrus_init);
// "Exit" Opcodes
- OPCODE(300, NOP);
+ REGISTER_OPCODE(300, Dni, NOP);
}
-#undef OPCODE
-
void Dni::disablePersistentScripts() {
_atrusRunning = false;
_waitForLoop = false;
diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp
index c4cd2096c4..b77fa0851d 100644
--- a/engines/mohawk/myst_stacks/intro.cpp
+++ b/engines/mohawk/myst_stacks/intro.cpp
@@ -38,22 +38,18 @@ Intro::Intro(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
Intro::~Intro() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Intro::x, #x))
-
void Intro::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, o_useLinkBook);
+ REGISTER_OPCODE(100, Intro, o_useLinkBook);
// "Init" Opcodes
- OPCODE(200, o_playIntroMovies);
- OPCODE(201, o_mystLinkBook_init);
+ REGISTER_OPCODE(200, Intro, o_playIntroMovies);
+ REGISTER_OPCODE(201, Intro, o_mystLinkBook_init);
// "Exit" Opcodes
- OPCODE(300, NOP);
+ REGISTER_OPCODE(300, Intro, NOP);
}
-#undef OPCODE
-
void Intro::disablePersistentScripts() {
_introMoviesRunning = false;
_linkBookRunning = false;
diff --git a/engines/mohawk/myst_stacks/makingof.cpp b/engines/mohawk/myst_stacks/makingof.cpp
index a0a1f359ba..2907c53231 100644
--- a/engines/mohawk/myst_stacks/makingof.cpp
+++ b/engines/mohawk/myst_stacks/makingof.cpp
@@ -37,15 +37,11 @@ MakingOf::MakingOf(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
MakingOf::~MakingOf() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &MakingOf::x, #x))
-
void MakingOf::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, o_quit);
+ REGISTER_OPCODE(100, MakingOf, o_quit);
}
-#undef OPCODE
-
void MakingOf::disablePersistentScripts() {
}
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index fb109acc17..0f07e8be29 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -58,60 +58,56 @@ Mechanical::Mechanical(MohawkEngine_Myst *vm) :
Mechanical::~Mechanical() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Mechanical::x, #x))
-
void Mechanical::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, o_throneEnablePassage);
- OPCODE(101, o_birdCrankStart);
- OPCODE(102, NOP);
- OPCODE(103, o_birdCrankStop);
- OPCODE(104, o_snakeBoxTrigger);
- OPCODE(105, o_fortressStaircaseMovie);
- OPCODE(106, o_elevatorRotationStart);
- OPCODE(107, o_elevatorRotationMove);
- OPCODE(108, o_elevatorRotationStop);
- OPCODE(109, o_fortressRotationSpeedStart);
- OPCODE(110, o_fortressRotationSpeedMove);
- OPCODE(111, o_fortressRotationSpeedStop);
- OPCODE(112, o_fortressRotationBrakeStart);
- OPCODE(113, o_fortressRotationBrakeMove);
- OPCODE(114, o_fortressRotationBrakeStop);
- OPCODE(115, o_fortressSimulationSpeedStart);
- OPCODE(116, o_fortressSimulationSpeedMove);
- OPCODE(117, o_fortressSimulationSpeedStop);
- OPCODE(118, o_fortressSimulationBrakeStart);
- OPCODE(119, o_fortressSimulationBrakeMove);
- OPCODE(120, o_fortressSimulationBrakeStop);
- OPCODE(121, o_elevatorWindowMovie);
- OPCODE(122, o_elevatorGoMiddle);
- OPCODE(123, o_elevatorTopMovie);
- OPCODE(124, o_fortressRotationSetPosition);
- OPCODE(125, o_mystStaircaseMovie);
- OPCODE(126, o_elevatorWaitTimeout);
- OPCODE(127, o_crystalEnterYellow);
- OPCODE(128, o_crystalLeaveYellow);
- OPCODE(129, o_crystalEnterGreen);
- OPCODE(130, o_crystalLeaveGreen);
- OPCODE(131, o_crystalEnterRed);
- OPCODE(132, o_crystalLeaveRed);
+ REGISTER_OPCODE(100, Mechanical, o_throneEnablePassage);
+ REGISTER_OPCODE(101, Mechanical, o_birdCrankStart);
+ REGISTER_OPCODE(102, Mechanical, NOP);
+ REGISTER_OPCODE(103, Mechanical, o_birdCrankStop);
+ REGISTER_OPCODE(104, Mechanical, o_snakeBoxTrigger);
+ REGISTER_OPCODE(105, Mechanical, o_fortressStaircaseMovie);
+ REGISTER_OPCODE(106, Mechanical, o_elevatorRotationStart);
+ REGISTER_OPCODE(107, Mechanical, o_elevatorRotationMove);
+ REGISTER_OPCODE(108, Mechanical, o_elevatorRotationStop);
+ REGISTER_OPCODE(109, Mechanical, o_fortressRotationSpeedStart);
+ REGISTER_OPCODE(110, Mechanical, o_fortressRotationSpeedMove);
+ REGISTER_OPCODE(111, Mechanical, o_fortressRotationSpeedStop);
+ REGISTER_OPCODE(112, Mechanical, o_fortressRotationBrakeStart);
+ REGISTER_OPCODE(113, Mechanical, o_fortressRotationBrakeMove);
+ REGISTER_OPCODE(114, Mechanical, o_fortressRotationBrakeStop);
+ REGISTER_OPCODE(115, Mechanical, o_fortressSimulationSpeedStart);
+ REGISTER_OPCODE(116, Mechanical, o_fortressSimulationSpeedMove);
+ REGISTER_OPCODE(117, Mechanical, o_fortressSimulationSpeedStop);
+ REGISTER_OPCODE(118, Mechanical, o_fortressSimulationBrakeStart);
+ REGISTER_OPCODE(119, Mechanical, o_fortressSimulationBrakeMove);
+ REGISTER_OPCODE(120, Mechanical, o_fortressSimulationBrakeStop);
+ REGISTER_OPCODE(121, Mechanical, o_elevatorWindowMovie);
+ REGISTER_OPCODE(122, Mechanical, o_elevatorGoMiddle);
+ REGISTER_OPCODE(123, Mechanical, o_elevatorTopMovie);
+ REGISTER_OPCODE(124, Mechanical, o_fortressRotationSetPosition);
+ REGISTER_OPCODE(125, Mechanical, o_mystStaircaseMovie);
+ REGISTER_OPCODE(126, Mechanical, o_elevatorWaitTimeout);
+ REGISTER_OPCODE(127, Mechanical, o_crystalEnterYellow);
+ REGISTER_OPCODE(128, Mechanical, o_crystalLeaveYellow);
+ REGISTER_OPCODE(129, Mechanical, o_crystalEnterGreen);
+ REGISTER_OPCODE(130, Mechanical, o_crystalLeaveGreen);
+ REGISTER_OPCODE(131, Mechanical, o_crystalEnterRed);
+ REGISTER_OPCODE(132, Mechanical, o_crystalLeaveRed);
// "Init" Opcodes
- OPCODE(200, o_throne_init);
- OPCODE(201, o_fortressStaircase_init);
- OPCODE(202, o_bird_init);
- OPCODE(203, o_snakeBox_init);
- OPCODE(204, o_elevatorRotation_init);
- OPCODE(205, o_fortressRotation_init);
- OPCODE(206, o_fortressSimulation_init);
- OPCODE(209, o_fortressSimulationStartup_init);
+ REGISTER_OPCODE(200, Mechanical, o_throne_init);
+ REGISTER_OPCODE(201, Mechanical, o_fortressStaircase_init);
+ REGISTER_OPCODE(202, Mechanical, o_bird_init);
+ REGISTER_OPCODE(203, Mechanical, o_snakeBox_init);
+ REGISTER_OPCODE(204, Mechanical, o_elevatorRotation_init);
+ REGISTER_OPCODE(205, Mechanical, o_fortressRotation_init);
+ REGISTER_OPCODE(206, Mechanical, o_fortressSimulation_init);
+ REGISTER_OPCODE(209, Mechanical, o_fortressSimulationStartup_init);
// "Exit" Opcodes
- OPCODE(300, NOP);
+ REGISTER_OPCODE(300, Mechanical, NOP);
}
-#undef OPCODE
-
void Mechanical::disablePersistentScripts() {
_fortressSimulationRunning = false;
_elevatorRotationLeverMoving = false;
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 1a6fc3e8bf..8bf759666f 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -66,151 +66,147 @@ Myst::Myst(MohawkEngine_Myst *vm) :
Myst::~Myst() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Myst::x, #x))
-
void Myst::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, NOP);
- OPCODE(101, o_libraryBookPageTurnLeft);
- OPCODE(102, o_libraryBookPageTurnRight);
- OPCODE(103, o_fireplaceToggleButton);
- OPCODE(104, o_fireplaceRotation);
- OPCODE(105, o_courtyardBoxesCheckSolution);
- OPCODE(106, o_towerRotationStart);
- OPCODE(107, NOP);
- OPCODE(108, o_towerRotationEnd);
- OPCODE(109, o_imagerChangeSelection);
- OPCODE(113, o_dockVaultOpen);
- OPCODE(114, o_dockVaultClose);
- OPCODE(115, o_bookGivePage);
- OPCODE(116, o_clockWheelsExecute);
- OPCODE(117, o_imagerPlayButton);
- OPCODE(118, o_imagerEraseButton);
- OPCODE(119, o_towerElevatorAnimation);
- OPCODE(120, o_generatorButtonPressed);
- OPCODE(121, o_cabinSafeChangeDigit);
- OPCODE(122, o_cabinSafeHandleStartMove);
- OPCODE(123, o_cabinSafeHandleMove);
- OPCODE(124, o_cabinSafeHandleEndMove);
- OPCODE(126, o_clockLeverStartMove);
- OPCODE(127, o_clockLeverEndMove);
- OPCODE(128, o_treePressureReleaseStart);
+ REGISTER_OPCODE(100, Myst, NOP);
+ REGISTER_OPCODE(101, Myst, o_libraryBookPageTurnLeft);
+ REGISTER_OPCODE(102, Myst, o_libraryBookPageTurnRight);
+ REGISTER_OPCODE(103, Myst, o_fireplaceToggleButton);
+ REGISTER_OPCODE(104, Myst, o_fireplaceRotation);
+ REGISTER_OPCODE(105, Myst, o_courtyardBoxesCheckSolution);
+ REGISTER_OPCODE(106, Myst, o_towerRotationStart);
+ REGISTER_OPCODE(107, Myst, NOP);
+ REGISTER_OPCODE(108, Myst, o_towerRotationEnd);
+ REGISTER_OPCODE(109, Myst, o_imagerChangeSelection);
+ REGISTER_OPCODE(113, Myst, o_dockVaultOpen);
+ REGISTER_OPCODE(114, Myst, o_dockVaultClose);
+ REGISTER_OPCODE(115, Myst, o_bookGivePage);
+ REGISTER_OPCODE(116, Myst, o_clockWheelsExecute);
+ REGISTER_OPCODE(117, Myst, o_imagerPlayButton);
+ REGISTER_OPCODE(118, Myst, o_imagerEraseButton);
+ REGISTER_OPCODE(119, Myst, o_towerElevatorAnimation);
+ REGISTER_OPCODE(120, Myst, o_generatorButtonPressed);
+ REGISTER_OPCODE(121, Myst, o_cabinSafeChangeDigit);
+ REGISTER_OPCODE(122, Myst, o_cabinSafeHandleStartMove);
+ REGISTER_OPCODE(123, Myst, o_cabinSafeHandleMove);
+ REGISTER_OPCODE(124, Myst, o_cabinSafeHandleEndMove);
+ REGISTER_OPCODE(126, Myst, o_clockLeverStartMove);
+ REGISTER_OPCODE(127, Myst, o_clockLeverEndMove);
+ REGISTER_OPCODE(128, Myst, o_treePressureReleaseStart);
if (!observatoryIsDDMMYYYY2400()) {
- OPCODE(129, o_observatoryMonthChangeStartIncrease);
- OPCODE(130, o_observatoryMonthChangeStartDecrease);
- OPCODE(131, o_observatoryDayChangeStartIncrease);
- OPCODE(132, o_observatoryDayChangeStartDecrease);
+ REGISTER_OPCODE(129, Myst, o_observatoryMonthChangeStartIncrease);
+ REGISTER_OPCODE(130, Myst, o_observatoryMonthChangeStartDecrease);
+ REGISTER_OPCODE(131, Myst, o_observatoryDayChangeStartIncrease);
+ REGISTER_OPCODE(132, Myst, o_observatoryDayChangeStartDecrease);
} else {
- OPCODE(129, o_observatoryDayChangeStartIncrease);
- OPCODE(130, o_observatoryDayChangeStartDecrease);
- OPCODE(131, o_observatoryMonthChangeStartIncrease);
- OPCODE(132, o_observatoryMonthChangeStartDecrease);
- }
- OPCODE(133, o_observatoryGoButton);
- OPCODE(134, o_observatoryMonthSliderMove);
- OPCODE(135, o_observatoryDaySliderMove);
- OPCODE(136, o_observatoryYearSliderMove);
- OPCODE(137, o_observatoryTimeSliderMove);
- OPCODE(138, o_clockResetLeverStartMove);
- OPCODE(139, o_clockResetLeverMove);
- OPCODE(140, o_clockResetLeverEndMove);
- OPCODE(141, o_circuitBreakerStartMove);
- OPCODE(142, o_circuitBreakerMove);
- OPCODE(143, o_circuitBreakerEndMove);
- OPCODE(144, o_clockLeverMoveLeft);
- OPCODE(145, o_clockLeverMoveRight);
- OPCODE(146, o_boilerIncreasePressureStart);
- OPCODE(147, o_boilerLightPilot);
- OPCODE(148, NOP);
- OPCODE(149, o_boilerIncreasePressureStop);
- OPCODE(150, o_boilerDecreasePressureStart);
- OPCODE(151, o_boilerDecreasePressureStop);
- OPCODE(152, NOP);
- OPCODE(153, o_basementIncreasePressureStart);
- OPCODE(154, o_basementIncreasePressureStop);
- OPCODE(155, o_basementDecreasePressureStart);
- OPCODE(156, o_basementDecreasePressureStop);
- OPCODE(157, o_rocketPianoMove);
- OPCODE(158, o_rocketSoundSliderStartMove);
- OPCODE(159, o_rocketSoundSliderMove);
- OPCODE(160, o_rocketSoundSliderEndMove);
- OPCODE(161, o_rocketPianoStart);
- OPCODE(162, o_rocketPianoStop);
- OPCODE(163, o_rocketLeverStartMove);
- OPCODE(164, o_rocketOpenBook);
- OPCODE(165, o_rocketLeverMove);
- OPCODE(166, o_rocketLeverEndMove);
- OPCODE(167, NOP);
- OPCODE(168, o_treePressureReleaseStop);
- OPCODE(169, o_cabinLeave);
- OPCODE(170, o_observatoryMonthSliderStartMove);
- OPCODE(171, o_observatoryMonthSliderEndMove);
- OPCODE(172, o_observatoryDaySliderStartMove);
- OPCODE(173, o_observatoryDaySliderEndMove);
- OPCODE(174, o_observatoryYearSliderStartMove);
- OPCODE(175, o_observatoryYearSliderEndMove);
- OPCODE(176, o_observatoryTimeSliderStartMove);
- OPCODE(177, o_observatoryTimeSliderEndMove);
- OPCODE(180, o_libraryCombinationBookStop);
- OPCODE(181, NOP);
- OPCODE(182, o_cabinMatchLight);
- OPCODE(183, o_courtyardBoxEnter);
- OPCODE(184, o_courtyardBoxLeave);
- OPCODE(185, NOP);
- OPCODE(186, o_clockMinuteWheelStartTurn);
- OPCODE(187, NOP);
- OPCODE(188, o_clockWheelEndTurn);
- OPCODE(189, o_clockHourWheelStartTurn);
- OPCODE(190, o_libraryCombinationBookStartRight);
- OPCODE(191, o_libraryCombinationBookStartLeft);
- OPCODE(192, o_observatoryTimeChangeStartIncrease);
- OPCODE(193, NOP);
- OPCODE(194, o_observatoryChangeSettingStop);
- OPCODE(195, o_observatoryTimeChangeStartDecrease);
- OPCODE(196, o_observatoryYearChangeStartIncrease);
- OPCODE(197, o_observatoryYearChangeStartDecrease);
- OPCODE(198, o_dockVaultForceClose);
- OPCODE(199, o_imagerEraseStop);
+ REGISTER_OPCODE(129, Myst, o_observatoryDayChangeStartIncrease);
+ REGISTER_OPCODE(130, Myst, o_observatoryDayChangeStartDecrease);
+ REGISTER_OPCODE(131, Myst, o_observatoryMonthChangeStartIncrease);
+ REGISTER_OPCODE(132, Myst, o_observatoryMonthChangeStartDecrease);
+ }
+ REGISTER_OPCODE(133, Myst, o_observatoryGoButton);
+ REGISTER_OPCODE(134, Myst, o_observatoryMonthSliderMove);
+ REGISTER_OPCODE(135, Myst, o_observatoryDaySliderMove);
+ REGISTER_OPCODE(136, Myst, o_observatoryYearSliderMove);
+ REGISTER_OPCODE(137, Myst, o_observatoryTimeSliderMove);
+ REGISTER_OPCODE(138, Myst, o_clockResetLeverStartMove);
+ REGISTER_OPCODE(139, Myst, o_clockResetLeverMove);
+ REGISTER_OPCODE(140, Myst, o_clockResetLeverEndMove);
+ REGISTER_OPCODE(141, Myst, o_circuitBreakerStartMove);
+ REGISTER_OPCODE(142, Myst, o_circuitBreakerMove);
+ REGISTER_OPCODE(143, Myst, o_circuitBreakerEndMove);
+ REGISTER_OPCODE(144, Myst, o_clockLeverMoveLeft);
+ REGISTER_OPCODE(145, Myst, o_clockLeverMoveRight);
+ REGISTER_OPCODE(146, Myst, o_boilerIncreasePressureStart);
+ REGISTER_OPCODE(147, Myst, o_boilerLightPilot);
+ REGISTER_OPCODE(148, Myst, NOP);
+ REGISTER_OPCODE(149, Myst, o_boilerIncreasePressureStop);
+ REGISTER_OPCODE(150, Myst, o_boilerDecreasePressureStart);
+ REGISTER_OPCODE(151, Myst, o_boilerDecreasePressureStop);
+ REGISTER_OPCODE(152, Myst, NOP);
+ REGISTER_OPCODE(153, Myst, o_basementIncreasePressureStart);
+ REGISTER_OPCODE(154, Myst, o_basementIncreasePressureStop);
+ REGISTER_OPCODE(155, Myst, o_basementDecreasePressureStart);
+ REGISTER_OPCODE(156, Myst, o_basementDecreasePressureStop);
+ REGISTER_OPCODE(157, Myst, o_rocketPianoMove);
+ REGISTER_OPCODE(158, Myst, o_rocketSoundSliderStartMove);
+ REGISTER_OPCODE(159, Myst, o_rocketSoundSliderMove);
+ REGISTER_OPCODE(160, Myst, o_rocketSoundSliderEndMove);
+ REGISTER_OPCODE(161, Myst, o_rocketPianoStart);
+ REGISTER_OPCODE(162, Myst, o_rocketPianoStop);
+ REGISTER_OPCODE(163, Myst, o_rocketLeverStartMove);
+ REGISTER_OPCODE(164, Myst, o_rocketOpenBook);
+ REGISTER_OPCODE(165, Myst, o_rocketLeverMove);
+ REGISTER_OPCODE(166, Myst, o_rocketLeverEndMove);
+ REGISTER_OPCODE(167, Myst, NOP);
+ REGISTER_OPCODE(168, Myst, o_treePressureReleaseStop);
+ REGISTER_OPCODE(169, Myst, o_cabinLeave);
+ REGISTER_OPCODE(170, Myst, o_observatoryMonthSliderStartMove);
+ REGISTER_OPCODE(171, Myst, o_observatoryMonthSliderEndMove);
+ REGISTER_OPCODE(172, Myst, o_observatoryDaySliderStartMove);
+ REGISTER_OPCODE(173, Myst, o_observatoryDaySliderEndMove);
+ REGISTER_OPCODE(174, Myst, o_observatoryYearSliderStartMove);
+ REGISTER_OPCODE(175, Myst, o_observatoryYearSliderEndMove);
+ REGISTER_OPCODE(176, Myst, o_observatoryTimeSliderStartMove);
+ REGISTER_OPCODE(177, Myst, o_observatoryTimeSliderEndMove);
+ REGISTER_OPCODE(180, Myst, o_libraryCombinationBookStop);
+ REGISTER_OPCODE(181, Myst, NOP);
+ REGISTER_OPCODE(182, Myst, o_cabinMatchLight);
+ REGISTER_OPCODE(183, Myst, o_courtyardBoxEnter);
+ REGISTER_OPCODE(184, Myst, o_courtyardBoxLeave);
+ REGISTER_OPCODE(185, Myst, NOP);
+ REGISTER_OPCODE(186, Myst, o_clockMinuteWheelStartTurn);
+ REGISTER_OPCODE(187, Myst, NOP);
+ REGISTER_OPCODE(188, Myst, o_clockWheelEndTurn);
+ REGISTER_OPCODE(189, Myst, o_clockHourWheelStartTurn);
+ REGISTER_OPCODE(190, Myst, o_libraryCombinationBookStartRight);
+ REGISTER_OPCODE(191, Myst, o_libraryCombinationBookStartLeft);
+ REGISTER_OPCODE(192, Myst, o_observatoryTimeChangeStartIncrease);
+ REGISTER_OPCODE(193, Myst, NOP);
+ REGISTER_OPCODE(194, Myst, o_observatoryChangeSettingStop);
+ REGISTER_OPCODE(195, Myst, o_observatoryTimeChangeStartDecrease);
+ REGISTER_OPCODE(196, Myst, o_observatoryYearChangeStartIncrease);
+ REGISTER_OPCODE(197, Myst, o_observatoryYearChangeStartDecrease);
+ REGISTER_OPCODE(198, Myst, o_dockVaultForceClose);
+ REGISTER_OPCODE(199, Myst, o_imagerEraseStop);
// "Init" Opcodes
- OPCODE(200, o_libraryBook_init);
- OPCODE(201, o_courtyardBox_init);
- OPCODE(202, o_towerRotationMap_init);
- OPCODE(203, o_forechamberDoor_init);
- OPCODE(204, o_shipAccess_init);
- OPCODE(205, NOP);
- OPCODE(206, o_butterflies_init);
- OPCODE(208, o_imager_init);
- OPCODE(209, o_libraryBookcaseTransform_init);
- OPCODE(210, o_generatorControlRoom_init);
- OPCODE(211, o_fireplace_init);
- OPCODE(212, o_clockGears_init);
- OPCODE(213, o_gulls1_init);
- OPCODE(214, o_observatory_init);
- OPCODE(215, o_gulls2_init);
- OPCODE(216, o_treeCard_init);
- OPCODE(217, o_treeEntry_init);
- OPCODE(218, o_boilerMovies_init);
- OPCODE(219, o_rocketSliders_init);
- OPCODE(220, o_rocketLinkVideo_init);
- OPCODE(221, o_greenBook_init);
- OPCODE(222, o_gulls3_init);
+ REGISTER_OPCODE(200, Myst, o_libraryBook_init);
+ REGISTER_OPCODE(201, Myst, o_courtyardBox_init);
+ REGISTER_OPCODE(202, Myst, o_towerRotationMap_init);
+ REGISTER_OPCODE(203, Myst, o_forechamberDoor_init);
+ REGISTER_OPCODE(204, Myst, o_shipAccess_init);
+ REGISTER_OPCODE(205, Myst, NOP);
+ REGISTER_OPCODE(206, Myst, o_butterflies_init);
+ REGISTER_OPCODE(208, Myst, o_imager_init);
+ REGISTER_OPCODE(209, Myst, o_libraryBookcaseTransform_init);
+ REGISTER_OPCODE(210, Myst, o_generatorControlRoom_init);
+ REGISTER_OPCODE(211, Myst, o_fireplace_init);
+ REGISTER_OPCODE(212, Myst, o_clockGears_init);
+ REGISTER_OPCODE(213, Myst, o_gulls1_init);
+ REGISTER_OPCODE(214, Myst, o_observatory_init);
+ REGISTER_OPCODE(215, Myst, o_gulls2_init);
+ REGISTER_OPCODE(216, Myst, o_treeCard_init);
+ REGISTER_OPCODE(217, Myst, o_treeEntry_init);
+ REGISTER_OPCODE(218, Myst, o_boilerMovies_init);
+ REGISTER_OPCODE(219, Myst, o_rocketSliders_init);
+ REGISTER_OPCODE(220, Myst, o_rocketLinkVideo_init);
+ REGISTER_OPCODE(221, Myst, o_greenBook_init);
+ REGISTER_OPCODE(222, Myst, o_gulls3_init);
// "Exit" Opcodes
- OPCODE(300, o_bookAddSpecialPage_exit);
- OPCODE(301, NOP);
- OPCODE(302, NOP);
- OPCODE(303, NOP);
- OPCODE(304, o_treeCard_exit);
- OPCODE(305, o_treeEntry_exit);
- OPCODE(306, o_boiler_exit);
- OPCODE(307, o_generatorControlRoom_exit);
- OPCODE(308, NOP);
- OPCODE(309, NOP);
- OPCODE(312, NOP);
-}
-
-#undef OPCODE
+ REGISTER_OPCODE(300, Myst, o_bookAddSpecialPage_exit);
+ REGISTER_OPCODE(301, Myst, NOP);
+ REGISTER_OPCODE(302, Myst, NOP);
+ REGISTER_OPCODE(303, Myst, NOP);
+ REGISTER_OPCODE(304, Myst, o_treeCard_exit);
+ REGISTER_OPCODE(305, Myst, o_treeEntry_exit);
+ REGISTER_OPCODE(306, Myst, o_boiler_exit);
+ REGISTER_OPCODE(307, Myst, o_generatorControlRoom_exit);
+ REGISTER_OPCODE(308, Myst, NOP);
+ REGISTER_OPCODE(309, Myst, NOP);
+ REGISTER_OPCODE(312, Myst, NOP);
+}
void Myst::disablePersistentScripts() {
_libraryBookcaseMoving = false;
diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp
index 9ad40b0f46..bc0dd04360 100644
--- a/engines/mohawk/myst_stacks/preview.cpp
+++ b/engines/mohawk/myst_stacks/preview.cpp
@@ -42,32 +42,19 @@ Preview::Preview(MohawkEngine_Myst *vm) : Myst(vm) {
Preview::~Preview() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Preview::x, #x))
-
-#define OVERRIDE_OPCODE(opcode, x) \
- for (uint32 i = 0; i < _opcodes.size(); i++) \
- if (_opcodes[i]->op == opcode) { \
- _opcodes[i]->proc = (OpcodeProcMyst) &Preview::x; \
- _opcodes[i]->desc = #x; \
- break; \
- }
-
void Preview::setupOpcodes() {
// "Stack-Specific" Opcodes
- OVERRIDE_OPCODE(196, o_fadeToBlack);
- OVERRIDE_OPCODE(197, o_fadeFromBlack);
- OVERRIDE_OPCODE(198, o_stayHere);
- OVERRIDE_OPCODE(199, o_speechStop);
+ OVERRIDE_OPCODE(196, Preview, o_fadeToBlack);
+ OVERRIDE_OPCODE(197, Preview, o_fadeFromBlack);
+ OVERRIDE_OPCODE(198, Preview, o_stayHere);
+ OVERRIDE_OPCODE(199, Preview, o_speechStop);
// "Init" Opcodes
- OVERRIDE_OPCODE(209, o_libraryBookcaseTransformDemo_init);
- OPCODE(298, o_speech_init);
- OPCODE(299, o_library_init);
+ OVERRIDE_OPCODE(209, Preview, o_libraryBookcaseTransformDemo_init);
+ REGISTER_OPCODE(298, Preview, o_speech_init);
+ REGISTER_OPCODE(299, Preview, o_library_init);
}
-#undef OPCODE
-#undef OVERRIDE_OPCODE
-
void Preview::disablePersistentScripts() {
Myst::disablePersistentScripts();
}
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index 427635b94c..087143abfc 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -49,41 +49,37 @@ Selenitic::Selenitic(MohawkEngine_Myst *vm) :
Selenitic::~Selenitic() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Selenitic::x, #x))
-
void Selenitic::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, o_mazeRunnerMove);
- OPCODE(101, o_mazeRunnerSoundRepeat);
- OPCODE(102, o_soundReceiverSigma);
- OPCODE(103, o_soundReceiverRight);
- OPCODE(104, o_soundReceiverLeft);
- OPCODE(105, o_soundReceiverSource);
- OPCODE(106, o_soundReceiverSource);
- OPCODE(107, o_soundReceiverSource);
- OPCODE(108, o_soundReceiverSource);
- OPCODE(109, o_soundReceiverSource);
- OPCODE(110, o_mazeRunnerDoorButton);
- OPCODE(111, o_soundReceiverUpdateSound);
- OPCODE(112, o_soundLockMove);
- OPCODE(113, o_soundLockStartMove);
- OPCODE(114, o_soundLockEndMove);
- OPCODE(115, o_soundLockButton);
- OPCODE(116, NOP);
- OPCODE(117, o_soundReceiverEndMove);
+ REGISTER_OPCODE(100, Selenitic, o_mazeRunnerMove);
+ REGISTER_OPCODE(101, Selenitic, o_mazeRunnerSoundRepeat);
+ REGISTER_OPCODE(102, Selenitic, o_soundReceiverSigma);
+ REGISTER_OPCODE(103, Selenitic, o_soundReceiverRight);
+ REGISTER_OPCODE(104, Selenitic, o_soundReceiverLeft);
+ REGISTER_OPCODE(105, Selenitic, o_soundReceiverSource);
+ REGISTER_OPCODE(106, Selenitic, o_soundReceiverSource);
+ REGISTER_OPCODE(107, Selenitic, o_soundReceiverSource);
+ REGISTER_OPCODE(108, Selenitic, o_soundReceiverSource);
+ REGISTER_OPCODE(109, Selenitic, o_soundReceiverSource);
+ REGISTER_OPCODE(110, Selenitic, o_mazeRunnerDoorButton);
+ REGISTER_OPCODE(111, Selenitic, o_soundReceiverUpdateSound);
+ REGISTER_OPCODE(112, Selenitic, o_soundLockMove);
+ REGISTER_OPCODE(113, Selenitic, o_soundLockStartMove);
+ REGISTER_OPCODE(114, Selenitic, o_soundLockEndMove);
+ REGISTER_OPCODE(115, Selenitic, o_soundLockButton);
+ REGISTER_OPCODE(116, Selenitic, NOP);
+ REGISTER_OPCODE(117, Selenitic, o_soundReceiverEndMove);
// "Init" Opcodes
- OPCODE(200, o_mazeRunnerCompass_init);
- OPCODE(201, o_mazeRunnerWindow_init);
- OPCODE(202, o_mazeRunnerLight_init);
- OPCODE(203, o_soundReceiver_init);
- OPCODE(204, o_soundLock_init);
- OPCODE(205, o_mazeRunnerRight_init);
- OPCODE(206, o_mazeRunnerLeft_init);
+ REGISTER_OPCODE(200, Selenitic, o_mazeRunnerCompass_init);
+ REGISTER_OPCODE(201, Selenitic, o_mazeRunnerWindow_init);
+ REGISTER_OPCODE(202, Selenitic, o_mazeRunnerLight_init);
+ REGISTER_OPCODE(203, Selenitic, o_soundReceiver_init);
+ REGISTER_OPCODE(204, Selenitic, o_soundLock_init);
+ REGISTER_OPCODE(205, Selenitic, o_mazeRunnerRight_init);
+ REGISTER_OPCODE(206, Selenitic, o_mazeRunnerLeft_init);
}
-#undef OPCODE
-
void Selenitic::disablePersistentScripts() {
_soundReceiverRunning = false;
}
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
index 070724c221..f8c388d7bc 100644
--- a/engines/mohawk/myst_stacks/slides.cpp
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -41,18 +41,14 @@ Slides::Slides(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
Slides::~Slides() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Slides::x, #x))
-
void Slides::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, o_returnToMenu);
+ REGISTER_OPCODE(100, Slides, o_returnToMenu);
// "Init" Opcodes
- OPCODE(200, o_setCardSwap);
+ REGISTER_OPCODE(200, Slides, o_setCardSwap);
}
-#undef OPCODE
-
void Slides::disablePersistentScripts() {
_cardSwapEnabled = false;
}
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index bfe1b19329..f4b38305f2 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -66,54 +66,50 @@ Stoneship::Stoneship(MohawkEngine_Myst *vm) :
Stoneship::~Stoneship() {
}
-#define OPCODE(op, x) _opcodes.push_back(new MystOpcode(op, (OpcodeProcMyst) &Stoneship::x, #x))
-
void Stoneship::setupOpcodes() {
// "Stack-Specific" Opcodes
- OPCODE(100, o_pumpTurnOff);
- OPCODE(101, o_brotherDoorOpen);
- OPCODE(102, o_cabinBookMovie);
- OPCODE(103, o_drawerOpenSirius);
- OPCODE(104, o_drawerClose);
- OPCODE(105, o_telescopeStart);
- OPCODE(106, o_telescopeMove);
- OPCODE(107, o_telescopeStop);
- OPCODE(108, o_generatorStart);
- OPCODE(109, NOP);
- OPCODE(110, o_generatorStop);
- OPCODE(111, o_drawerOpenAchenar);
- OPCODE(112, o_hologramPlayback);
- OPCODE(113, o_hologramSelectionStart);
- OPCODE(114, o_hologramSelectionMove);
- OPCODE(115, o_hologramSelectionStop);
- OPCODE(116, o_compassButton);
- OPCODE(117, o_chestValveVideos);
- OPCODE(118, o_chestDropKey);
- OPCODE(119, o_trapLockOpen);
- OPCODE(120, o_sideDoorsMovies);
- OPCODE(121, o_cloudOrbEnter);
- OPCODE(122, o_cloudOrbLeave);
- OPCODE(125, o_drawerCloseOpened);
+ REGISTER_OPCODE(100, Stoneship, o_pumpTurnOff);
+ REGISTER_OPCODE(101, Stoneship, o_brotherDoorOpen);
+ REGISTER_OPCODE(102, Stoneship, o_cabinBookMovie);
+ REGISTER_OPCODE(103, Stoneship, o_drawerOpenSirius);
+ REGISTER_OPCODE(104, Stoneship, o_drawerClose);
+ REGISTER_OPCODE(105, Stoneship, o_telescopeStart);
+ REGISTER_OPCODE(106, Stoneship, o_telescopeMove);
+ REGISTER_OPCODE(107, Stoneship, o_telescopeStop);
+ REGISTER_OPCODE(108, Stoneship, o_generatorStart);
+ REGISTER_OPCODE(109, Stoneship, NOP);
+ REGISTER_OPCODE(110, Stoneship, o_generatorStop);
+ REGISTER_OPCODE(111, Stoneship, o_drawerOpenAchenar);
+ REGISTER_OPCODE(112, Stoneship, o_hologramPlayback);
+ REGISTER_OPCODE(113, Stoneship, o_hologramSelectionStart);
+ REGISTER_OPCODE(114, Stoneship, o_hologramSelectionMove);
+ REGISTER_OPCODE(115, Stoneship, o_hologramSelectionStop);
+ REGISTER_OPCODE(116, Stoneship, o_compassButton);
+ REGISTER_OPCODE(117, Stoneship, o_chestValveVideos);
+ REGISTER_OPCODE(118, Stoneship, o_chestDropKey);
+ REGISTER_OPCODE(119, Stoneship, o_trapLockOpen);
+ REGISTER_OPCODE(120, Stoneship, o_sideDoorsMovies);
+ REGISTER_OPCODE(121, Stoneship, o_cloudOrbEnter);
+ REGISTER_OPCODE(122, Stoneship, o_cloudOrbLeave);
+ REGISTER_OPCODE(125, Stoneship, o_drawerCloseOpened);
// "Init" Opcodes
- OPCODE(200, o_hologramDisplay_init);
- OPCODE(201, o_hologramSelection_init);
- OPCODE(202, o_battery_init);
- OPCODE(203, o_tunnelEnter_init);
- OPCODE(204, o_batteryGauge_init);
- OPCODE(205, o_tunnel_init);
- OPCODE(206, o_tunnelLeave_init);
- OPCODE(207, o_chest_init);
- OPCODE(208, o_telescope_init);
- OPCODE(209, o_achenarDrawers_init);
- OPCODE(210, o_cloudOrb_init);
+ REGISTER_OPCODE(200, Stoneship, o_hologramDisplay_init);
+ REGISTER_OPCODE(201, Stoneship, o_hologramSelection_init);
+ REGISTER_OPCODE(202, Stoneship, o_battery_init);
+ REGISTER_OPCODE(203, Stoneship, o_tunnelEnter_init);
+ REGISTER_OPCODE(204, Stoneship, o_batteryGauge_init);
+ REGISTER_OPCODE(205, Stoneship, o_tunnel_init);
+ REGISTER_OPCODE(206, Stoneship, o_tunnelLeave_init);
+ REGISTER_OPCODE(207, Stoneship, o_chest_init);
+ REGISTER_OPCODE(208, Stoneship, o_telescope_init);
+ REGISTER_OPCODE(209, Stoneship, o_achenarDrawers_init);
+ REGISTER_OPCODE(210, Stoneship, o_cloudOrb_init);
// "Exit" Opcodes
- OPCODE(300, NOP);
+ REGISTER_OPCODE(300, Stoneship, NOP);
}
-#undef OPCODE
-
void Stoneship::disablePersistentScripts() {
_batteryCharging = false;
_batteryDepleting = false;