aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2007-04-15 12:04:47 +0000
committerTravis Howell2007-04-15 12:04:47 +0000
commit48c21a1e314c9c3b605e498a1de612d515975b96 (patch)
treed500cfb4f1a4b6759292048593eaed315127dcbe /engines
parent2d617677dfe97253eb1ac43fe70c7fecf057c361 (diff)
downloadscummvm-rg350-48c21a1e314c9c3b605e498a1de612d515975b96.tar.gz
scummvm-rg350-48c21a1e314c9c3b605e498a1de612d515975b96.tar.bz2
scummvm-rg350-48c21a1e314c9c3b605e498a1de612d515975b96.zip
Add eriktorbjorn's patch to split script opcodes into specific game engines.
svn-id: r26490
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.h516
-rw-r--r--engines/agos/icons.cpp2
-rw-r--r--engines/agos/script.cpp143
-rw-r--r--engines/agos/script_e1.cpp620
-rw-r--r--engines/agos/script_e2.cpp383
-rw-r--r--engines/agos/script_ff.cpp385
-rw-r--r--engines/agos/script_pp.cpp339
-rw-r--r--engines/agos/script_s1.cpp328
-rw-r--r--engines/agos/script_s2.cpp309
-rw-r--r--engines/agos/script_ww.cpp337
10 files changed, 2384 insertions, 978 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 39d757d9e2..4a6771e9a0 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -124,6 +124,15 @@ struct GameSpecificSettings;
class Debugger;
+// This is to help devices with small memory (PDA, smartphones, ...)
+// to save a bit of memory used by opcode names in the AGOS engine.
+
+#ifndef REDUCE_MEMORY_USAGE
+# define _OPCODE(ver, x) { &ver::x, #x }
+#else
+# define _OPCODE(ver, x) { &ver::x, "" }
+#endif
+
class AGOSEngine : public Engine {
friend class Debugger;
friend class MoviePlayer;
@@ -131,12 +140,7 @@ class AGOSEngine : public Engine {
GUI::Debugger *getDebugger();
public:
- typedef void (AGOSEngine::*OpcodeProc) ();
-
- virtual void setupOpcodes(OpcodeProc *op);
-
- void setupOpcodes();
- OpcodeProc _opcode_table[300];
+ virtual void setupOpcodes();
int _numOpcodes;
typedef void (AGOSEngine::*VgaOpcodeProc) ();
@@ -574,6 +578,7 @@ protected:
bool checkIfToRunSubroutineLine(SubroutineLine *sl, Subroutine *sub);
int runScript();
+ virtual void executeOpcode(int opcode) = 0;
byte getByte();
int getNextWord();
@@ -951,6 +956,7 @@ public:
int getScriptReturn();
// Opcodes, common
+ void o_invalid();
void o_at();
void o_notAt();
void o_carried();
@@ -1033,6 +1039,7 @@ public:
void o_defObj();
void o_here();
void o_doClassIcons();
+ void o_playTune();
void o_setAdjNoun();
void o_saveUserGame();
void o_loadUserGame();
@@ -1044,63 +1051,6 @@ public:
void o_setDollar();
void o_isBox();
- // Opcodes, Elvira 1
- void oe1_present();
- void oe1_notPresent();
- void oe1_worn();
- void oe1_notWorn();
- void oe1_notCarried();
- void oe1_isNotAt();
- void oe1_sibling();
- void oe1_notSibling();
- void oe1_isIn();
- void oe1_isNotIn();
- void oe1_isPlayer();
- void oe1_canPut();
- void oe1_create();
- void oe1_copyof();
- void oe1_copyfo();
- void oe1_whatO();
- void oe1_weigh();
- void oe1_setFF();
- void oe1_moveDirn();
- void oe1_score();
- void oe1_look();
- void oe1_doClass();
- void oe1_pObj();
- void oe1_pName();
- void oe1_pcName();
- void oe1_isCalled();
- void oe1_cFlag();
- void oe1_rescan();
- void oe1_setUserItem();
- void oe1_getUserItem();
- void oe1_whereTo();
- void oe1_doorExit();
- void oe1_saveGame();
- void oe1_loadGame();
- void oe1_clearUserItem();
- void oe1_findMaster();
- void oe1_nextMaster();
- void oe1_animate();
- void oe1_stopAnimate();
- void oe1_menu();
- void oe1_enableInput();
- void oe1_setTime();
- void oe1_ifTime();
- void oe1_playTune();
- void oe1_bitClear();
- void oe1_bitSet();
- void oe1_bitTest();
- void oe1_zoneDisk();
- void oe1_printStats();
- void oe1_stopTune();
- void oe1_printPlayerDamage();
- void oe1_printMonsterDamage();
- void oe1_pauseGame();
- void oe1_printPlayerHit();
- void oe1_printMonsterHit();
-
int16 levelOf(Item *item);
int16 moreText(Item *i);
void lobjFunc(Item *i, const char *f);
@@ -1109,152 +1059,6 @@ public:
void printScroll();
void synchChain(Item *i);
- // Opcodes, Elvira 2
- void oe2_moveDirn();
- void oe2_doClass();
- void oe2_pObj();
- void oe2_loadGame();
- void oe2_drawItem();
- void oe2_doTable();
- void oe2_pauseGame();
- void oe2_setDoorOpen();
- void oe2_setDoorClosed();
- void oe2_setDoorLocked();
- void oe2_ifDoorOpen();
- void oe2_ifDoorClosed();
- void oe2_ifDoorLocked();
- void oe2_storeItem();
- void oe2_getItem();
- void oe2_bSet();
- void oe2_bClear();
- void oe2_bZero();
- void oe2_bNotZero();
- void oe2_getOValue();
- void oe2_setOValue();
- void oe2_ink();
- void oe2_printStats();
- void oe2_setSuperRoom();
- void oe2_getSuperRoom();
- void oe2_setExitOpen();
- void oe2_setExitClosed();
- void oe2_setExitLocked();
- void oe2_ifExitOpen();
- void oe2_ifExitClosed();
- void oe2_ifExitLocked();
- void oe2_unk174();
- void oe2_getDollar2();
- void oe2_setSRExit();
- void oe2_unk177();
- void oe2_unk178();
- void oe2_isAdjNoun();
- void oe2_b2Set();
- void oe2_b2Clear();
- void oe2_b2Zero();
- void oe2_b2NotZero();
-
- // Opcodes, Waxworks
- void oww_moveDirn();
- void oww_goto();
- void oww_addTextBox();
- void oww_setShortText();
- void oww_setLongText();
- void oww_whereTo();
- void oww_menu();
- void oww_textMenu();
- void oww_pauseGame();
- void oww_boxMessage();
- void oww_boxMsg();
- void oww_boxLongText();
- void oww_printBox();
- void oww_boxPObj();
- void oww_lockZones();
- void oww_unlockZones();
-
- // Opcodes, Simon 1
- void oww_printLongText();
- void os1_animate();
- void os1_playTune();
- void os1_pauseGame();
- void os1_screenTextBox();
- void os1_screenTextMsg();
- void os1_playEffect();
- void os1_screenTextPObj();
- void os1_getPathPosn();
- void os1_scnTxtLongText();
- void os1_mouseOn();
- void os1_mouseOff();
- void os1_loadBeard();
- void os1_unloadBeard();
- void os1_unloadZone();
- void os1_loadStrings();
- void os1_unfreezeZones();
- void os1_specialFade();
-
- // Opcodes, Simon 2
- void os2_printLongText();
- void os2_rescan();
- void os2_animate();
- void os2_stopAnimate();
- void os2_playTune();
- void os2_screenTextPObj();
- void os2_mouseOn();
- void os2_mouseOff();
- void os2_isShortText();
- void os2_clearMarks();
- void os2_waitMark();
-
- // Opcodes, Feeble Files
- void off_chance();
- void off_jumpOut();
- void off_addTextBox();
- void off_printLongText();
- void off_addBox();
- void off_oracleTextDown();
- void off_oracleTextUp();
- void off_ifTime();
- void off_setTime();
- void off_saveUserGame();
- void off_loadUserGame();
- void off_listSaveGames();
- void off_checkCD();
- void off_screenTextBox();
- void off_isAdjNoun();
- void off_hyperLinkOn();
- void off_hyperLinkOff();
- void off_checkPaths();
- void off_screenTextPObj();
- void off_mouseOn();
- void off_mouseOff();
- void off_loadVideo();
- void off_playVideo();
- void off_centreScroll();
- void off_resetPVCount();
- void off_setPathValues();
- void off_stopClock();
- void off_restartClock();
- void off_setColour();
- void off_b3Set();
- void off_b3Clear();
- void off_b3Zero();
- void off_b3NotZero();
-
- // Opcodes, Puzzle Pack
- void opp_iconifyWindow();
- void opp_restoreOopsPosition();
- void opp_loadMouseImage();
- void opp_message();
- void opp_setShortText();
- void opp_loadHiScores();
- void opp_checkHiScores();
- void opp_sync();
- void opp_saveUserGame();
- void opp_loadUserGame();
- void opp_saveOopsPosition();
- void opp_resetGameTime();
- void opp_resetPVCount();
- void opp_setPathValues();
- void opp_restartClock();
-
protected:
bool drawImage_clip(VC10_state *state);
@@ -1415,10 +1219,75 @@ public:
AGOSEngine_Elvira1(OSystem *system);
//~AGOSEngine_Elvira1();
-
- virtual void setupOpcodes(OpcodeProc *op);
+ virtual void setupOpcodes();
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
-private:
+
+ virtual void executeOpcode(int opcode);
+
+ void oe1_present();
+ void oe1_notPresent();
+ void oe1_worn();
+ void oe1_notWorn();
+ void oe1_notCarried();
+ void oe1_isNotAt();
+ void oe1_sibling();
+ void oe1_notSibling();
+ void oe1_isIn();
+ void oe1_isNotIn();
+ void oe1_isPlayer();
+ void oe1_canPut();
+ void oe1_create();
+ void oe1_copyof();
+ void oe1_copyfo();
+ void oe1_whatO();
+ void oe1_weigh();
+ void oe1_setFF();
+ void oe1_moveDirn();
+ void oe1_score();
+ void oe1_look();
+ void oe1_doClass();
+ void oe1_pObj();
+ void oe1_pName();
+ void oe1_pcName();
+ void oe1_isCalled();
+ void oe1_cFlag();
+ void oe1_rescan();
+ void oe1_setUserItem();
+ void oe1_getUserItem();
+ void oe1_whereTo();
+ void oe1_doorExit();
+ void oe1_saveGame();
+ void oe1_loadGame();
+ void oe1_clearUserItem();
+ void oe1_findMaster();
+ void oe1_nextMaster();
+ void oe1_animate();
+ void oe1_stopAnimate();
+ void oe1_menu();
+ void oe1_enableInput();
+ void oe1_setTime();
+ void oe1_ifTime();
+ void oe1_playTune();
+ void oe1_bitClear();
+ void oe1_bitSet();
+ void oe1_bitTest();
+ void oe1_zoneDisk();
+ void oe1_printStats();
+ void oe1_stopTune();
+ void oe1_printPlayerDamage();
+ void oe1_printMonsterDamage();
+ void oe1_pauseGame();
+ void oe1_printPlayerHit();
+ void oe1_printMonsterHit();
+
+protected:
+ typedef void (AGOSEngine_Elvira1::*OpcodeProcElvira1) ();
+ struct OpcodeEntryElvira1 {
+ OpcodeProcElvira1 proc;
+ const char *desc;
+ };
+
+ const OpcodeEntryElvira1 *_opcodesElvira1;
};
class AGOSEngine_Elvira2 : public AGOSEngine_Elvira1 {
@@ -1426,9 +1295,61 @@ public:
AGOSEngine_Elvira2(OSystem *system);
//~AGOSEngine_Elvira2();
- virtual void setupOpcodes(OpcodeProc *op);
+ virtual void setupOpcodes();
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
-private:
+
+ virtual void executeOpcode(int opcode);
+
+ void oe2_moveDirn();
+ void oe2_doClass();
+ void oe2_pObj();
+ void oe2_loadGame();
+ void oe2_drawItem();
+ void oe2_doTable();
+ void oe2_pauseGame();
+ void oe2_setDoorOpen();
+ void oe2_setDoorClosed();
+ void oe2_setDoorLocked();
+ void oe2_ifDoorOpen();
+ void oe2_ifDoorClosed();
+ void oe2_ifDoorLocked();
+ void oe2_storeItem();
+ void oe2_getItem();
+ void oe2_bSet();
+ void oe2_bClear();
+ void oe2_bZero();
+ void oe2_bNotZero();
+ void oe2_getOValue();
+ void oe2_setOValue();
+ void oe2_ink();
+ void oe2_printStats();
+ void oe2_setSuperRoom();
+ void oe2_getSuperRoom();
+ void oe2_setExitOpen();
+ void oe2_setExitClosed();
+ void oe2_setExitLocked();
+ void oe2_ifExitOpen();
+ void oe2_ifExitClosed();
+ void oe2_ifExitLocked();
+ void oe2_unk174();
+ void oe2_getDollar2();
+ void oe2_setSRExit();
+ void oe2_unk177();
+ void oe2_unk178();
+ void oe2_isAdjNoun();
+ void oe2_b2Set();
+ void oe2_b2Clear();
+ void oe2_b2Zero();
+ void oe2_b2NotZero();
+
+protected:
+ typedef void (AGOSEngine_Elvira2::*OpcodeProcElvira2) ();
+ struct OpcodeEntryElvira2 {
+ OpcodeProcElvira2 proc;
+ const char *desc;
+ };
+
+ const OpcodeEntryElvira2 *_opcodesElvira2;
};
class AGOSEngine_Waxworks : public AGOSEngine_Elvira2 {
@@ -1436,9 +1357,37 @@ public:
AGOSEngine_Waxworks(OSystem *system);
//~AGOSEngine_Waxworks();
- virtual void setupOpcodes(OpcodeProc *op);
+ virtual void setupOpcodes();
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
-private:
+
+ virtual void executeOpcode(int opcode);
+
+ void oww_moveDirn();
+ void oww_goto();
+ void oww_addTextBox();
+ void oww_setShortText();
+ void oww_setLongText();
+ void oww_printLongText();
+ void oww_whereTo();
+ void oww_menu();
+ void oww_textMenu();
+ void oww_pauseGame();
+ void oww_boxMessage();
+ void oww_boxMsg();
+ void oww_boxLongText();
+ void oww_printBox();
+ void oww_boxPObj();
+ void oww_lockZones();
+ void oww_unlockZones();
+
+protected:
+ typedef void (AGOSEngine_Waxworks::*OpcodeProcWaxworks) ();
+ struct OpcodeEntryWaxworks {
+ OpcodeProcWaxworks proc;
+ const char *desc;
+ };
+
+ const OpcodeEntryWaxworks *_opcodesWaxworks;
};
class AGOSEngine_Simon1 : public AGOSEngine_Waxworks {
@@ -1446,9 +1395,37 @@ public:
AGOSEngine_Simon1(OSystem *system);
//~AGOSEngine_Simon1();
- virtual void setupOpcodes(OpcodeProc *op);
+ virtual void setupOpcodes();
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
-private:
+
+ virtual void executeOpcode(int opcode);
+
+ // Opcodes, Simon 1
+ void os1_animate();
+ void os1_pauseGame();
+ void os1_screenTextBox();
+ void os1_screenTextMsg();
+ void os1_playEffect();
+ void os1_screenTextPObj();
+ void os1_getPathPosn();
+ void os1_scnTxtLongText();
+ void os1_mouseOn();
+ void os1_mouseOff();
+ void os1_loadBeard();
+ void os1_unloadBeard();
+ void os1_unloadZone();
+ void os1_loadStrings();
+ void os1_unfreezeZones();
+ void os1_specialFade();
+
+protected:
+ typedef void (AGOSEngine_Simon1::*OpcodeProcSimon1) ();
+ struct OpcodeEntrySimon1 {
+ OpcodeProcSimon1 proc;
+ const char *desc;
+ };
+
+ const OpcodeEntrySimon1 *_opcodesSimon1;
};
class AGOSEngine_Simon2 : public AGOSEngine_Simon1 {
@@ -1456,9 +1433,31 @@ public:
AGOSEngine_Simon2(OSystem *system);
//~AGOSEngine_Simon2();
- virtual void setupOpcodes(OpcodeProc *op);
+ virtual void setupOpcodes();
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
-private:
+
+ virtual void executeOpcode(int opcode);
+
+ void os2_printLongText();
+ void os2_rescan();
+ void os2_animate();
+ void os2_stopAnimate();
+ void os2_playTune();
+ void os2_screenTextPObj();
+ void os2_mouseOn();
+ void os2_mouseOff();
+ void os2_isShortText();
+ void os2_clearMarks();
+ void os2_waitMark();
+
+protected:
+ typedef void (AGOSEngine_Simon2::*OpcodeProcSimon2) ();
+ struct OpcodeEntrySimon2 {
+ OpcodeProcSimon2 proc;
+ const char *desc;
+ };
+
+ const OpcodeEntrySimon2 *_opcodesSimon2;
};
class AGOSEngine_Feeble : public AGOSEngine_Simon2 {
@@ -1466,11 +1465,56 @@ public:
AGOSEngine_Feeble(OSystem *system);
//~AGOSEngine_Feeble();
- virtual void setupOpcodes(OpcodeProc *op);
+ virtual void setupOpcodes();
virtual void setupVideoOpcodes(VgaOpcodeProc *op);
+ virtual void executeOpcode(int opcode);
+
virtual void drawMousePointer();
+
+ void off_chance();
+ void off_jumpOut();
+ void off_addTextBox();
+ void off_printLongText();
+ void off_addBox();
+ void off_oracleTextDown();
+ void off_oracleTextUp();
+ void off_ifTime();
+ void off_setTime();
+ void off_saveUserGame();
+ void off_loadUserGame();
+ void off_listSaveGames();
+ void off_checkCD();
+ void off_screenTextBox();
+ void off_isAdjNoun();
+ void off_hyperLinkOn();
+ void off_hyperLinkOff();
+ void off_checkPaths();
+ void off_screenTextPObj();
+ void off_mouseOn();
+ void off_mouseOff();
+ void off_loadVideo();
+ void off_playVideo();
+ void off_centreScroll();
+ void off_resetPVCount();
+ void off_setPathValues();
+ void off_stopClock();
+ void off_restartClock();
+ void off_setColour();
+ void off_b3Set();
+ void off_b3Clear();
+ void off_b3Zero();
+ void off_b3NotZero();
+
protected:
+ typedef void (AGOSEngine_Feeble::*OpcodeProcFeeble) ();
+ struct OpcodeEntryFeeble {
+ OpcodeProcFeeble proc;
+ const char *desc;
+ };
+
+ const OpcodeEntryFeeble *_opcodesFeeble;
+
virtual void resetVerbs();
virtual void setVerb(HitArea * ha);
@@ -1480,7 +1524,6 @@ protected:
virtual void clearName();
virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
-private:
};
class AGOSEngine_PuzzlePack : public AGOSEngine_Feeble {
@@ -1488,11 +1531,36 @@ public:
AGOSEngine_PuzzlePack(OSystem *system);
//~AGOSEngine_PuzzlePack();
- virtual void setupOpcodes(OpcodeProc *op);
+ virtual void setupOpcodes();
+
+ virtual void executeOpcode(int opcode);
+
+ void opp_iconifyWindow();
+ void opp_restoreOopsPosition();
+ void opp_loadMouseImage();
+ void opp_message();
+ void opp_setShortText();
+ void opp_loadHiScores();
+ void opp_checkHiScores();
+ void opp_sync();
+ void opp_saveUserGame();
+ void opp_loadUserGame();
+ void opp_saveOopsPosition();
+ void opp_resetGameTime();
+ void opp_resetPVCount();
+ void opp_setPathValues();
+ void opp_restartClock();
protected:
+ typedef void (AGOSEngine_PuzzlePack::*OpcodeProcPuzzlePack) ();
+ struct OpcodeEntryPuzzlePack {
+ OpcodeProcPuzzlePack proc;
+ const char *desc;
+ };
+
+ const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
+
virtual void resetVerbs();
-private:
};
} // End of namespace AGOS
diff --git a/engines/agos/icons.cpp b/engines/agos/icons.cpp
index 3c3810163f..f2273c815b 100644
--- a/engines/agos/icons.cpp
+++ b/engines/agos/icons.cpp
@@ -58,7 +58,7 @@ void AGOSEngine::loadIconData() {
error("Out of icon memory");
memcpy(_iconFilePtr, src, 43 * 336);
- os1_unfreezeZones();
+ unfreezeBottom();
}
// Thanks to Stuart Caie for providing the original
diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp
index 57cd96350b..3ba88524d9 100644
--- a/engines/agos/script.cpp
+++ b/engines/agos/script.cpp
@@ -36,128 +36,8 @@ extern bool isSmartphone(void);
namespace AGOS {
-void AGOSEngine::setupOpcodes(OpcodeProc *op) {
- // A common set of opcodes for Elvira 2 and later.
-
- op[1] = &AGOSEngine::o_at;
- op[2] = &AGOSEngine::o_notAt;
- op[5] = &AGOSEngine::o_carried;
- op[6] = &AGOSEngine::o_notCarried;
- op[7] = &AGOSEngine::o_isAt;
- op[11] = &AGOSEngine::o_zero;
- op[12] = &AGOSEngine::o_notZero;
- op[13] = &AGOSEngine::o_eq;
- op[14] = &AGOSEngine::o_notEq;
- op[15] = &AGOSEngine::o_gt;
- op[16] = &AGOSEngine::o_lt;
- op[17] = &AGOSEngine::o_eqf;
- op[18] = &AGOSEngine::o_notEqf;
- op[19] = &AGOSEngine::o_ltf;
- op[20] = &AGOSEngine::o_gtf;
- op[23] = &AGOSEngine::o_chance;
- op[25] = &AGOSEngine::o_isRoom;
- op[26] = &AGOSEngine::o_isObject;
- op[27] = &AGOSEngine::o_state;
- op[28] = &AGOSEngine::o_oflag;
- op[31] = &AGOSEngine::o_destroy;
- op[33] = &AGOSEngine::o_place;
- op[36] = &AGOSEngine::o_copyff;
- op[41] = &AGOSEngine::o_clear;
- op[42] = &AGOSEngine::o_let;
- op[43] = &AGOSEngine::o_add;
- op[44] = &AGOSEngine::o_sub;
- op[45] = &AGOSEngine::o_addf;
- op[46] = &AGOSEngine::o_subf;
- op[47] = &AGOSEngine::o_mul;
- op[48] = &AGOSEngine::o_div;
- op[49] = &AGOSEngine::o_mulf;
- op[50] = &AGOSEngine::o_divf;
- op[51] = &AGOSEngine::o_mod;
- op[52] = &AGOSEngine::o_modf;
- op[53] = &AGOSEngine::o_random;
- op[55] = &AGOSEngine::o_goto;
- op[56] = &AGOSEngine::o_oset;
- op[57] = &AGOSEngine::o_oclear;
- op[58] = &AGOSEngine::o_putBy;
- op[59] = &AGOSEngine::o_inc;
- op[60] = &AGOSEngine::o_dec;
- op[61] = &AGOSEngine::o_setState;
- op[62] = &AGOSEngine::o_print;
- op[63] = &AGOSEngine::o_message;
- op[64] = &AGOSEngine::o_msg;
- op[68] = &AGOSEngine::o_end;
- op[69] = &AGOSEngine::o_done;
- op[71] = &AGOSEngine::o_process;
- op[76] = &AGOSEngine::o_when;
- op[77] = &AGOSEngine::o_if1;
- op[78] = &AGOSEngine::o_if2;
- op[79] = &AGOSEngine::o_isCalled;
- op[80] = &AGOSEngine::o_is;
- op[82] = &AGOSEngine::o_debug;
- op[87] = &AGOSEngine::o_comment;
- op[90] = &AGOSEngine::o_getParent;
- op[91] = &AGOSEngine::o_getNext;
- op[92] = &AGOSEngine::o_getChildren;
- op[96] = &AGOSEngine::o_picture;
- op[97] = &AGOSEngine::o_loadZone;
- op[100] = &AGOSEngine::o_killAnimate;
- op[101] = &AGOSEngine::o_defWindow;
- op[102] = &AGOSEngine::o_window;
- op[103] = &AGOSEngine::o_cls;
- op[104] = &AGOSEngine::o_closeWindow;
- op[107] = &AGOSEngine::o_addBox;
- op[108] = &AGOSEngine::o_delBox;
- op[109] = &AGOSEngine::o_enableBox;
- op[110] = &AGOSEngine::o_disableBox;
- op[111] = &AGOSEngine::o_moveBox;
- op[114] = &AGOSEngine::o_doIcons;
- op[115] = &AGOSEngine::o_isClass;
- op[116] = &AGOSEngine::o_setClass;
- op[117] = &AGOSEngine::o_unsetClass;
- op[119] = &AGOSEngine::o_waitSync;
- op[120] = &AGOSEngine::o_sync;
- op[121] = &AGOSEngine::o_defObj;
- op[125] = &AGOSEngine::o_here;
- op[126] = &AGOSEngine::o_doClassIcons;
- op[130] = &AGOSEngine::o_setAdjNoun;
- op[132] = &AGOSEngine::o_saveUserGame;
- op[133] = &AGOSEngine::o_loadUserGame;
- op[136] = &AGOSEngine::o_copysf;
- op[137] = &AGOSEngine::o_restoreIcons;
- op[138] = &AGOSEngine::o_freezeZones;
- op[139] = &AGOSEngine::o_placeNoIcons;
- op[140] = &AGOSEngine::o_clearTimers;
- op[141] = &AGOSEngine::o_setDollar;
- op[142] = &AGOSEngine::o_isBox;
- op[143] = &AGOSEngine::oe2_doTable;
- op[151] = &AGOSEngine::oe2_storeItem;
- op[152] = &AGOSEngine::oe2_getItem;
- op[153] = &AGOSEngine::oe2_bSet;
- op[154] = &AGOSEngine::oe2_bClear;
- op[155] = &AGOSEngine::oe2_bZero;
- op[156] = &AGOSEngine::oe2_bNotZero;
- op[157] = &AGOSEngine::oe2_getOValue;
- op[158] = &AGOSEngine::oe2_setOValue;
- op[160] = &AGOSEngine::oe2_ink;
-}
-
void AGOSEngine::setupOpcodes() {
- memset(_opcode_table, 0, sizeof(_opcode_table));
- _numOpcodes = ARRAYSIZE(_opcode_table);
-
- switch (getGameType()) {
- case GType_ELVIRA1:
- case GType_ELVIRA2:
- case GType_WW:
- case GType_SIMON1:
- case GType_SIMON2:
- case GType_FF:
- case GType_PP:
- setupOpcodes(_opcode_table);
- break;
- default:
- error("setupOpcodes: Unknown game");
- }
+ error("setupOpcodes: Unknown game");
}
void AGOSEngine::setScriptCondition(bool cond) {
@@ -180,6 +60,11 @@ int AGOSEngine::getScriptReturn() {
// Common Opcodes
// -----------------------------------------------------------------------
+void AGOSEngine::o_invalid() {
+ // TODO: Better error reporting
+ error("Invalid opcode");
+}
+
void AGOSEngine::o_at() {
// 1: ptrA parent is
setScriptCondition(me()->parent == getNextItemID());
@@ -815,6 +700,18 @@ void AGOSEngine::o_doClassIcons() {
mouseOn();
}
+void AGOSEngine::o_playTune() {
+ // 127: play tune
+ int music = getVarOrWord();
+ int track = getVarOrWord();
+
+ if (music != _lastMusicPlayed) {
+ _lastMusicPlayed = music;
+ loadMusic(music);
+ _midi.startTrack(track);
+ }
+}
+
void AGOSEngine::o_setAdjNoun() {
// 130: set adj noun
uint var = getVarOrByte();
@@ -1027,10 +924,10 @@ int AGOSEngine::runScript() {
setScriptCondition(true);
setScriptReturn(0);
- if (opcode > _numOpcodes || !_opcode_table[opcode])
+ if (opcode > _numOpcodes)
error("Invalid opcode '%d' encountered", opcode);
- (this->*_opcode_table[opcode]) ();
+ executeOpcode(opcode);
} while (getScriptCondition() != flag && !getScriptReturn());
return getScriptReturn();
diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp
index 3c17d67f2f..f688dd4834 100644
--- a/engines/agos/script_e1.cpp
+++ b/engines/agos/script_e1.cpp
@@ -28,169 +28,393 @@
namespace AGOS {
-void AGOSEngine_Elvira1::setupOpcodes(OpcodeProc *op) {
- op[0] = &AGOSEngine::o_at;
- op[1] = &AGOSEngine::o_notAt;
- op[2] = &AGOSEngine::oe1_present;
- op[3] = &AGOSEngine::oe1_notPresent;
- op[4] = &AGOSEngine::oe1_worn;
- op[5] = &AGOSEngine::oe1_notWorn;
- op[6] = &AGOSEngine::o_carried;
- op[7] = &AGOSEngine::o_notCarried;
- op[8] = &AGOSEngine::o_isAt;
- op[9] = &AGOSEngine::oe1_isNotAt;
- op[10] = &AGOSEngine::oe1_sibling;
- op[11] = &AGOSEngine::oe1_notSibling;
- op[12] = &AGOSEngine::o_zero;
- op[13] = &AGOSEngine::o_notZero;
- op[14] = &AGOSEngine::o_eq;
- op[15] = &AGOSEngine::o_notEq;
- op[16] = &AGOSEngine::o_gt;
- op[17] = &AGOSEngine::o_lt;
- op[18] = &AGOSEngine::o_eqf;
- op[19] = &AGOSEngine::o_notEqf;
- op[20] = &AGOSEngine::o_ltf;
- op[21] = &AGOSEngine::o_gtf;
- op[22] = &AGOSEngine::oe1_isIn;
- op[23] = &AGOSEngine::oe1_isNotIn;
- op[29] = &AGOSEngine::o_chance;
- op[30] = &AGOSEngine::oe1_isPlayer;
- op[32] = &AGOSEngine::o_isRoom;
- op[33] = &AGOSEngine::o_isObject;
- op[34] = &AGOSEngine::o_state;
- op[36] = &AGOSEngine::o_oflag;
- op[37] = &AGOSEngine::oe1_canPut;
- op[47] = &AGOSEngine::oe1_create;
- op[48] = &AGOSEngine::o_destroy;
- op[51] = &AGOSEngine::o_place;
- op[54] = &AGOSEngine::oe1_copyof;
- op[55] = &AGOSEngine::oe1_copyfo;
- op[56] = &AGOSEngine::o_copyff;
- op[57] = &AGOSEngine::oe1_whatO;
- op[59] = &AGOSEngine::oe1_weigh;
- op[60] = &AGOSEngine::oe1_setFF;
- op[61] = &AGOSEngine::o_clear;
- op[64] = &AGOSEngine::o_let;
- op[65] = &AGOSEngine::o_add;
- op[66] = &AGOSEngine::o_sub;
- op[67] = &AGOSEngine::o_addf;
- op[68] = &AGOSEngine::o_subf;
- op[69] = &AGOSEngine::o_mul;
- op[70] = &AGOSEngine::o_div;
- op[71] = &AGOSEngine::o_mulf;
- op[72] = &AGOSEngine::o_divf;
- op[73] = &AGOSEngine::o_mod;
- op[74] = &AGOSEngine::o_modf;
- op[75] = &AGOSEngine::o_random;
- op[76] = &AGOSEngine::oe1_moveDirn;
- op[77] = &AGOSEngine::o_goto;
- op[80] = &AGOSEngine::o_oset;
- op[81] = &AGOSEngine::o_oclear;
- op[84] = &AGOSEngine::o_putBy;
- op[85] = &AGOSEngine::o_inc;
- op[86] = &AGOSEngine::o_dec;
- op[87] = &AGOSEngine::o_setState;
- op[89] = &AGOSEngine::o_print;
- op[90] = &AGOSEngine::oe1_score;
- op[91] = &AGOSEngine::o_message;
- op[92] = &AGOSEngine::o_msg;
- op[96] = &AGOSEngine::oe1_look;
- op[97] = &AGOSEngine::o_end;
- op[98] = &AGOSEngine::o_done;
- op[105] = &AGOSEngine::o_process;
- op[106] = &AGOSEngine::oe1_doClass;
- op[112] = &AGOSEngine::oe1_pObj;
- op[114] = &AGOSEngine::oe1_pName;
- op[115] = &AGOSEngine::oe1_pcName;
- op[119] = &AGOSEngine::o_when;
- op[128] = &AGOSEngine::o_if1;
- op[129] = &AGOSEngine::o_if2;
- op[135] = &AGOSEngine::oe1_isCalled;
- op[136] = &AGOSEngine::o_is;
- op[152] = &AGOSEngine::o_debug;
- op[162] = &AGOSEngine::oe1_cFlag;
- op[164] = &AGOSEngine::oe1_rescan;
- op[176] = &AGOSEngine::oe1_setUserItem;
- op[177] = &AGOSEngine::oe1_getUserItem;
- op[178] = &AGOSEngine::oe1_clearUserItem;
- op[180] = &AGOSEngine::oe1_whereTo;
- op[181] = &AGOSEngine::oe1_doorExit;
- op[198] = &AGOSEngine::o_comment;
- op[201] = &AGOSEngine::oe1_saveGame;
- op[202] = &AGOSEngine::oe1_loadGame;
- op[206] = &AGOSEngine::o_getParent;
- op[207] = &AGOSEngine::o_getNext;
- op[208] = &AGOSEngine::o_getChildren;
- op[219] = &AGOSEngine::oe1_findMaster;
- op[220] = &AGOSEngine::oe1_nextMaster;
- op[224] = &AGOSEngine::o_picture;
- op[225] = &AGOSEngine::o_loadZone;
- op[226] = &AGOSEngine::oe1_animate;
- op[227] = &AGOSEngine::oe1_stopAnimate;
- op[228] = &AGOSEngine::o_killAnimate;
- op[229] = &AGOSEngine::o_defWindow;
- op[230] = &AGOSEngine::o_window;
- op[231] = &AGOSEngine::o_cls;
- op[232] = &AGOSEngine::o_closeWindow;
- op[233] = &AGOSEngine::oe1_menu;
- op[235] = &AGOSEngine::o_addBox;
- op[236] = &AGOSEngine::o_delBox;
- op[237] = &AGOSEngine::o_enableBox;
- op[238] = &AGOSEngine::o_disableBox;
- op[239] = &AGOSEngine::o_moveBox;
- op[242] = &AGOSEngine::o_doIcons;
- op[243] = &AGOSEngine::o_isClass;
- op[249] = &AGOSEngine::o_setClass;
- op[250] = &AGOSEngine::o_unsetClass;
- op[251] = &AGOSEngine::oe1_bitClear;
- op[252] = &AGOSEngine::oe1_bitSet;
- op[253] = &AGOSEngine::oe1_bitTest;
- op[255] = &AGOSEngine::o_waitSync;
- op[256] = &AGOSEngine::o_sync;
- op[257] = &AGOSEngine::o_defObj;
- op[258] = &AGOSEngine::oe1_enableInput;
- op[259] = &AGOSEngine::oe1_setTime;
- op[260] = &AGOSEngine::oe1_ifTime;
- op[261] = &AGOSEngine::o_here;
- op[262] = &AGOSEngine::o_doClassIcons;
- op[263] = &AGOSEngine::oe1_playTune;
- op[266] = &AGOSEngine::o_setAdjNoun;
- op[267] = &AGOSEngine::oe1_zoneDisk;
- op[268] = &AGOSEngine::o_saveUserGame;
- op[269] = &AGOSEngine::o_loadUserGame;
- op[270] = &AGOSEngine::oe1_printStats;
- op[271] = &AGOSEngine::oe1_stopTune;
- op[272] = &AGOSEngine::oe1_printPlayerDamage;
- op[273] = &AGOSEngine::oe1_printMonsterDamage;
- op[274] = &AGOSEngine::oe1_pauseGame;
- op[275] = &AGOSEngine::o_copysf;
- op[276] = &AGOSEngine::o_restoreIcons;
- op[277] = &AGOSEngine::oe1_printPlayerHit;
- op[278] = &AGOSEngine::oe1_printMonsterHit;
- op[279] = &AGOSEngine::o_freezeZones;
- op[280] = &AGOSEngine::o_placeNoIcons;
- op[281] = &AGOSEngine::o_clearTimers;
- op[282] = &AGOSEngine::o_setDollar;
- op[283] = &AGOSEngine::o_isBox;
+#define OPCODE(x) _OPCODE(AGOSEngine_Elvira1, x)
+
+void AGOSEngine_Elvira1::setupOpcodes() {
+ static const OpcodeEntryElvira1 opcodes[] = {
+ /* 00 */
+ OPCODE(o_at),
+ OPCODE(o_notAt),
+ OPCODE(oe1_present),
+ OPCODE(oe1_notPresent),
+ /* 04 */
+ OPCODE(oe1_worn),
+ OPCODE(oe1_notWorn),
+ OPCODE(o_carried),
+ OPCODE(o_notCarried),
+ /* 08 */
+ OPCODE(o_isAt),
+ OPCODE(oe1_isNotAt),
+ OPCODE(oe1_sibling),
+ OPCODE(oe1_notSibling),
+ /* 12 */
+ OPCODE(o_zero),
+ OPCODE(o_notZero),
+ OPCODE(o_eq),
+ OPCODE(o_notEq),
+ /* 16 */
+ OPCODE(o_gt),
+ OPCODE(o_lt),
+ OPCODE(o_eqf),
+ OPCODE(o_notEqf),
+ /* 20 */
+ OPCODE(o_ltf),
+ OPCODE(o_gtf),
+ OPCODE(oe1_isIn),
+ OPCODE(oe1_isNotIn),
+ /* 24 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 28 */
+ OPCODE(o_invalid),
+ OPCODE(o_chance),
+ OPCODE(oe1_isPlayer),
+ OPCODE(o_invalid),
+ /* 32 */
+ OPCODE(o_isRoom),
+ OPCODE(o_isObject),
+ OPCODE(o_state),
+ OPCODE(o_invalid),
+ /* 36 */
+ OPCODE(o_oflag),
+ OPCODE(oe1_canPut),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 40 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 44 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe1_create),
+ /* 48 */
+ OPCODE(o_destroy),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_place),
+ /* 52 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe1_copyof),
+ OPCODE(oe1_copyfo),
+ /* 56 */
+ OPCODE(o_copyff),
+ OPCODE(oe1_whatO),
+ OPCODE(o_invalid),
+ OPCODE(oe1_weigh),
+ /* 60 */
+ OPCODE(oe1_setFF),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 64 */
+ OPCODE(o_let),
+ OPCODE(o_add),
+ OPCODE(o_sub),
+ OPCODE(o_addf),
+ /* 68 */
+ OPCODE(o_subf),
+ OPCODE(o_mul),
+ OPCODE(o_div),
+ OPCODE(o_mulf),
+ /* 72 */
+ OPCODE(o_divf),
+ OPCODE(o_mod),
+ OPCODE(o_modf),
+ OPCODE(o_random),
+ /* 76 */
+ OPCODE(oe1_moveDirn),
+ OPCODE(o_goto),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 80 */
+ OPCODE(o_oset),
+ OPCODE(o_oclear),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 84 */
+ OPCODE(o_putBy),
+ OPCODE(o_inc),
+ OPCODE(o_dec),
+ OPCODE(o_setState),
+ /* 88 */
+ OPCODE(o_invalid),
+ OPCODE(o_print),
+ OPCODE(oe1_score),
+ OPCODE(o_message),
+ /* 92 */
+ OPCODE(o_msg),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 96 */
+ OPCODE(oe1_look),
+ OPCODE(o_end),
+ OPCODE(o_done),
+ OPCODE(o_invalid),
+ /* 100 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 104 */
+ OPCODE(o_invalid),
+ OPCODE(o_process),
+ OPCODE(oe1_doClass),
+ OPCODE(o_invalid),
+ /* 108 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 112*/
+ OPCODE(oe1_pObj),
+ OPCODE(o_invalid),
+ OPCODE(oe1_pName),
+ OPCODE(oe1_pcName),
+ /* 116 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_when),
+ /* 120 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 124 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 128 */
+ OPCODE(o_if1),
+ OPCODE(o_if2),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 132 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe1_isCalled),
+ /* 136 */
+ OPCODE(o_is),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 140 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 144 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 148 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 152 */
+ OPCODE(o_debug),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 156 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 160 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe1_cFlag),
+ OPCODE(o_invalid),
+ /* 164 */
+ OPCODE(oe1_rescan),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 168 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 172 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 176 */
+ OPCODE(oe1_setUserItem),
+ OPCODE(oe1_getUserItem),
+ OPCODE(oe1_clearUserItem),
+ OPCODE(o_invalid),
+ /* 180 */
+ OPCODE(oe1_whereTo),
+ OPCODE(oe1_doorExit),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 184 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 188 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 192 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 196 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_comment),
+ OPCODE(o_invalid),
+ /* 200 */
+ OPCODE(o_invalid),
+ OPCODE(oe1_saveGame),
+ OPCODE(oe1_loadGame),
+ OPCODE(o_invalid),
+ /* 204 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_getParent),
+ OPCODE(o_getNext),
+ /* 208 */
+ OPCODE(o_getChildren),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 212 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 216 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe1_findMaster),
+ /* 220 */
+ OPCODE(oe1_nextMaster),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 224 */
+ OPCODE(o_picture),
+ OPCODE(o_loadZone),
+ OPCODE(oe1_animate),
+ OPCODE(oe1_stopAnimate),
+ /* 228 */
+ OPCODE(o_killAnimate),
+ OPCODE(o_defWindow),
+ OPCODE(o_window),
+ OPCODE(o_cls),
+ /* 232 */
+ OPCODE(o_closeWindow),
+ OPCODE(oe1_menu),
+ OPCODE(o_invalid),
+ OPCODE(o_addBox),
+ /* 236 */
+ OPCODE(o_delBox),
+ OPCODE(o_enableBox),
+ OPCODE(o_disableBox),
+ OPCODE(o_moveBox),
+ /* 240 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_doIcons),
+ OPCODE(o_isClass),
+ /* 244 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 248 */
+ OPCODE(o_invalid),
+ OPCODE(o_setClass),
+ OPCODE(o_unsetClass),
+ OPCODE(oe1_bitClear),
+ /* 252 */
+ OPCODE(oe1_bitSet),
+ OPCODE(oe1_bitTest),
+ OPCODE(o_invalid),
+ OPCODE(o_waitSync),
+ /* 256 */
+ OPCODE(o_sync),
+ OPCODE(o_defObj),
+ OPCODE(oe1_enableInput),
+ OPCODE(oe1_setTime),
+ /* 260 */
+ OPCODE(oe1_ifTime),
+ OPCODE(o_here),
+ OPCODE(o_doClassIcons),
+ OPCODE(oe1_playTune),
+ /* 264 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_setAdjNoun),
+ OPCODE(oe1_zoneDisk),
+ /* 268 */
+ OPCODE(o_saveUserGame),
+ OPCODE(o_loadUserGame),
+ OPCODE(oe1_printStats),
+ OPCODE(oe1_stopTune),
+ /* 272 */
+ OPCODE(oe1_printPlayerDamage),
+ OPCODE(oe1_printMonsterDamage),
+ OPCODE(oe1_pauseGame),
+ OPCODE(o_copysf),
+ /* 276 */
+ OPCODE(o_restoreIcons),
+ OPCODE(oe1_printPlayerHit),
+ OPCODE(oe1_printMonsterHit),
+ OPCODE(o_freezeZones),
+ /* 280 */
+ OPCODE(o_placeNoIcons),
+ OPCODE(o_clearTimers),
+ OPCODE(o_setDollar),
+ OPCODE(o_isBox)
+ };
+
+ _opcodesElvira1 = opcodes;
+ _numOpcodes = 284;
+}
+
+void AGOSEngine_Elvira1::executeOpcode(int opcode) {
+ OpcodeProcElvira1 op = _opcodesElvira1[opcode].proc;
+ (this->*op) ();
}
// -----------------------------------------------------------------------
// Elvira 1 Opcodes
// -----------------------------------------------------------------------
-void AGOSEngine::oe1_present() {
+void AGOSEngine_Elvira1::oe1_present() {
// 2: present (here or carried)
Item *item = getNextItemPtr();
setScriptCondition(item->parent == getItem1ID() || item->parent == me()->parent);
}
-void AGOSEngine::oe1_notPresent() {
+void AGOSEngine_Elvira1::oe1_notPresent() {
// 3: not present (neither here nor carried)
Item *item = getNextItemPtr();
setScriptCondition(item->parent != getItem1ID() && item->parent != me()->parent);
}
-void AGOSEngine::oe1_worn() {
+void AGOSEngine_Elvira1::oe1_worn() {
// 4: worn
Item *item = getNextItemPtr();
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
@@ -201,7 +425,7 @@ void AGOSEngine::oe1_worn() {
setScriptCondition((subObject->objectFlags & kOFWorn) != 0);
}
-void AGOSEngine::oe1_notWorn() {
+void AGOSEngine_Elvira1::oe1_notWorn() {
// 5: not worn
Item *item = getNextItemPtr();
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
@@ -212,72 +436,72 @@ void AGOSEngine::oe1_notWorn() {
setScriptCondition((subObject->objectFlags & kOFWorn) == 0);
}
-void AGOSEngine::oe1_isNotAt() {
+void AGOSEngine_Elvira1::oe1_isNotAt() {
// 9: parent is not
Item *item = getNextItemPtr();
setScriptCondition(item->parent != getNextItemID());
}
-void AGOSEngine::oe1_sibling() {
+void AGOSEngine_Elvira1::oe1_sibling() {
// 10: sibling
Item *item1 = getNextItemPtr();
Item *item2 = getNextItemPtr();
setScriptCondition(item1->parent == item2->parent);
}
-void AGOSEngine::oe1_notSibling() {
+void AGOSEngine_Elvira1::oe1_notSibling() {
// 11: not sibling
Item *item1 = getNextItemPtr();
Item *item2 = getNextItemPtr();
setScriptCondition(item1->parent != item2->parent);
}
-void AGOSEngine::oe1_isIn() {
+void AGOSEngine_Elvira1::oe1_isIn() {
// 22: is in
Item *item1 = getNextItemPtr();
Item *item2 = getNextItemPtr();
setScriptCondition(contains(item1, item2) != 0);
}
-void AGOSEngine::oe1_isNotIn() {
+void AGOSEngine_Elvira1::oe1_isNotIn() {
// 23: is not in
Item *item1 = getNextItemPtr();
Item *item2 = getNextItemPtr();
setScriptCondition(contains(item1, item2) == 0);
}
-void AGOSEngine::oe1_isPlayer() {
+void AGOSEngine_Elvira1::oe1_isPlayer() {
// 30: is player
setScriptCondition(isPlayer(getNextItemPtr()));
}
-void AGOSEngine::oe1_canPut() {
+void AGOSEngine_Elvira1::oe1_canPut() {
// 37: can put
Item *item1 = getNextItemPtr();
Item *item2 = getNextItemPtr();
setScriptCondition(canPlace(item1, item2) == 0);
}
-void AGOSEngine::oe1_create() {
+void AGOSEngine_Elvira1::oe1_create() {
// 47: create
setItemParent(getNextItemPtr(), derefItem(me()->parent));
}
-void AGOSEngine::oe1_copyof() {
+void AGOSEngine_Elvira1::oe1_copyof() {
// 54: copy of
Item *item = getNextItemPtr();
uint tmp = getVarOrByte();
writeNextVarContents(getUserFlag(item, tmp));
}
-void AGOSEngine::oe1_copyfo() {
+void AGOSEngine_Elvira1::oe1_copyfo() {
// 55: copy fo
uint tmp = getNextVarContents();
Item *item = getNextItemPtr();
setUserFlag(item, getVarOrByte(), tmp);
}
-void AGOSEngine::oe1_whatO() {
+void AGOSEngine_Elvira1::oe1_whatO() {
// 57: what o
int a = getVarOrWord();
@@ -287,30 +511,30 @@ void AGOSEngine::oe1_whatO() {
_objectItem = findMaster(_scriptAdj2, _scriptNoun2);
}
-void AGOSEngine::oe1_weigh() {
+void AGOSEngine_Elvira1::oe1_weigh() {
// 59: weight
Item *item = getNextItemPtr();
writeNextVarContents(weighUp(item));
}
-void AGOSEngine::oe1_setFF() {
+void AGOSEngine_Elvira1::oe1_setFF() {
// 60: set FF
writeNextVarContents(255);
}
-void AGOSEngine::oe1_moveDirn() {
+void AGOSEngine_Elvira1::oe1_moveDirn() {
// 54: move direction
int16 d = readVariable(getVarOrWord());
moveDirn_e1(me(), d);
}
-void AGOSEngine::oe1_score() {
+void AGOSEngine_Elvira1::oe1_score() {
// 90: score
SubPlayer *p = (SubPlayer *) findChildOfType(me(), 3);
showMessageFormat("Your score is %ld.\n", p->score);
}
-void AGOSEngine::oe1_look() {
+void AGOSEngine_Elvira1::oe1_look() {
// 96: look
Item *i = derefItem(me()->parent);
if (i == NULL)
@@ -343,7 +567,7 @@ void AGOSEngine::oe1_look() {
}
}
-void AGOSEngine::oe1_doClass() {
+void AGOSEngine_Elvira1::oe1_doClass() {
// 106: do class
Item *i = getNextItemPtr();
int16 cm = getVarOrWord();
@@ -366,7 +590,7 @@ void AGOSEngine::oe1_doClass() {
}
}
-void AGOSEngine::oe1_pObj() {
+void AGOSEngine_Elvira1::oe1_pObj() {
// 112: print object
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
getVarOrWord();
@@ -375,13 +599,13 @@ void AGOSEngine::oe1_pObj() {
showMessageFormat("%s", (const char *)getStringPtrByID(subObject->objectName));
}
-void AGOSEngine::oe1_pName() {
+void AGOSEngine_Elvira1::oe1_pName() {
// 114:
Item *i = getNextItemPtr();
showMessageFormat("%s", (const char *)getStringPtrByID(i->itemName));
}
-void AGOSEngine::oe1_pcName() {
+void AGOSEngine_Elvira1::oe1_pcName() {
// 115:
Item *i = getNextItemPtr();
Common::String name = (const char *)getStringPtrByID(i->itemName);
@@ -389,14 +613,14 @@ void AGOSEngine::oe1_pcName() {
showMessageFormat("%s", name.c_str());
}
-void AGOSEngine::oe1_isCalled() {
+void AGOSEngine_Elvira1::oe1_isCalled() {
// 135: childstruct fr2 is
Item *item = getNextItemPtr();
uint stringId = getNextStringID();
setScriptCondition(!scumm_stricmp((const char *)getStringPtrByID(item->itemName), (const char *)getStringPtrByID(stringId)));
}
-void AGOSEngine::oe1_cFlag() {
+void AGOSEngine_Elvira1::oe1_cFlag() {
// 162: check container flag
SubContainer *c = (SubContainer *)findChildOfType(getNextItemPtr(), 7);
uint bit = getVarOrWord();
@@ -407,19 +631,19 @@ void AGOSEngine::oe1_cFlag() {
setScriptCondition((c->flags & (1 << bit)) != 0);
}
-void AGOSEngine::oe1_rescan() {
+void AGOSEngine_Elvira1::oe1_rescan() {
// 164: restart subroutine
setScriptReturn(-10);
}
-void AGOSEngine::oe1_setUserItem() {
+void AGOSEngine_Elvira1::oe1_setUserItem() {
// 176: set user item
Item *i = getNextItemPtr();
uint tmp = getVarOrWord();
setUserItem(i, tmp, getNextItemID());
}
-void AGOSEngine::oe1_getUserItem() {
+void AGOSEngine_Elvira1::oe1_getUserItem() {
// 177: get user item
Item *i = getNextItemPtr();
int n = getVarOrWord();
@@ -430,7 +654,7 @@ void AGOSEngine::oe1_getUserItem() {
_objectItem = derefItem(getUserItem(i, n));
}
-void AGOSEngine::oe1_whereTo() {
+void AGOSEngine_Elvira1::oe1_whereTo() {
// 180: where to
Item *i = getNextItemPtr();
int16 d = getVarOrWord();
@@ -442,7 +666,7 @@ void AGOSEngine::oe1_whereTo() {
_objectItem = getExitOf_e1(i, d);
}
-void AGOSEngine::oe1_doorExit() {
+void AGOSEngine_Elvira1::oe1_doorExit() {
// 181: door exit
Item *x;
Item *a = (Item *)-1;
@@ -466,7 +690,7 @@ void AGOSEngine::oe1_doorExit() {
writeVariable(f, 255);
}
-void AGOSEngine::oe1_saveGame() {
+void AGOSEngine_Elvira1::oe1_saveGame() {
// 201: save game
uint16 stringId = getNextStringID();
@@ -474,7 +698,7 @@ void AGOSEngine::oe1_saveGame() {
saveGame_e1((const char *)getStringPtrByID(stringId));
}
-void AGOSEngine::oe1_loadGame() {
+void AGOSEngine_Elvira1::oe1_loadGame() {
// 202: load game
uint16 stringId = getNextStringID();
debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
@@ -486,14 +710,14 @@ void AGOSEngine::oe1_loadGame() {
}
}
-void AGOSEngine::oe1_clearUserItem() {
+void AGOSEngine_Elvira1::oe1_clearUserItem() {
// 178: clear user item
Item *i = getNextItemPtr();
uint tmp = getVarOrWord();
setUserItem(i, tmp, 0);
}
-void AGOSEngine::oe1_findMaster() {
+void AGOSEngine_Elvira1::oe1_findMaster() {
// 219: find master
int16 ad, no;
int16 d = getVarOrByte();
@@ -508,7 +732,7 @@ void AGOSEngine::oe1_findMaster() {
_objectItem = findMaster(ad, no);
}
-void AGOSEngine::oe1_nextMaster() {
+void AGOSEngine_Elvira1::oe1_nextMaster() {
// 220: next master
int16 ad, no;
Item *item = getNextItemPtr();
@@ -524,7 +748,7 @@ void AGOSEngine::oe1_nextMaster() {
_objectItem = nextMaster(item, ad, no);
}
-void AGOSEngine::oe1_animate() {
+void AGOSEngine_Elvira1::oe1_animate() {
// 226: animate
uint vgaSpriteId = getVarOrWord();
uint windowNum = getVarOrByte();
@@ -537,19 +761,19 @@ void AGOSEngine::oe1_animate() {
_lockWord &= ~0x40;
}
-void AGOSEngine::oe1_stopAnimate() {
+void AGOSEngine_Elvira1::oe1_stopAnimate() {
// 227: stop animate
stopAnimate(getVarOrWord());
}
-void AGOSEngine::oe1_menu() {
+void AGOSEngine_Elvira1::oe1_menu() {
// 233: agos menu
uint b = getVarOrWord();
uint a = getVarOrWord();
drawMenuStrip(a, b);
}
-void AGOSEngine::oe1_bitClear() {
+void AGOSEngine_Elvira1::oe1_bitClear() {
// 251: set bit off
int var = getVarOrWord();
int bit = getVarOrWord();
@@ -557,7 +781,7 @@ void AGOSEngine::oe1_bitClear() {
writeVariable(var, _variableArray[var] & ~(1 << bit));
}
-void AGOSEngine::oe1_bitSet() {
+void AGOSEngine_Elvira1::oe1_bitSet() {
// 252: set bit on
int var = getVarOrWord();
int bit = getVarOrWord();
@@ -565,7 +789,7 @@ void AGOSEngine::oe1_bitSet() {
writeVariable(var, _variableArray[var] | (1 << bit));
}
-void AGOSEngine::oe1_bitTest() {
+void AGOSEngine_Elvira1::oe1_bitTest() {
// 253: bit test
int var = getVarOrWord();
int bit = getVarOrWord();
@@ -573,7 +797,7 @@ void AGOSEngine::oe1_bitTest() {
setScriptCondition((_variableArray[var] & (1 << bit)) != 0);
}
-void AGOSEngine::oe1_enableInput() {
+void AGOSEngine_Elvira1::oe1_enableInput() {
// 258: enable input
_variableArray[500] = 0;
@@ -593,12 +817,12 @@ void AGOSEngine::oe1_enableInput() {
_lastHitArea = 0;
}
-void AGOSEngine::oe1_setTime() {
+void AGOSEngine_Elvira1::oe1_setTime() {
// 259: set time
time(&_timeStore);
}
-void AGOSEngine::oe1_ifTime() {
+void AGOSEngine_Elvira1::oe1_ifTime() {
// 260: if time
time_t t;
@@ -611,7 +835,7 @@ void AGOSEngine::oe1_ifTime() {
setScriptCondition(false);
}
-void AGOSEngine::oe1_playTune() {
+void AGOSEngine_Elvira1::oe1_playTune() {
// 264: play tune
int music = getVarOrWord();
int track = getVarOrWord();
@@ -631,13 +855,13 @@ void AGOSEngine::oe1_playTune() {
}
}
-void AGOSEngine::oe1_zoneDisk() {
+void AGOSEngine_Elvira1::oe1_zoneDisk() {
// 267: set disk number of each zone
getVarOrWord();
getVarOrWord();
}
-void AGOSEngine::oe1_printStats() {
+void AGOSEngine_Elvira1::oe1_printStats() {
// 270: print stats
WindowBlock *window = _dummyWindow;
int val;
@@ -697,11 +921,11 @@ void AGOSEngine::oe1_printStats() {
mouseOn();
}
-void AGOSEngine::oe1_stopTune() {
+void AGOSEngine_Elvira1::oe1_stopTune() {
// 271: stop tune
}
-void AGOSEngine::oe1_printPlayerDamage() {
+void AGOSEngine_Elvira1::oe1_printPlayerDamage() {
// 272: print player damage
WindowBlock *window = _dummyWindow;
window->flags = 1;
@@ -711,7 +935,7 @@ void AGOSEngine::oe1_printPlayerDamage() {
mouseOn();
}
-void AGOSEngine::oe1_printMonsterDamage() {
+void AGOSEngine_Elvira1::oe1_printMonsterDamage() {
// 273: print monster damage
WindowBlock *window = _dummyWindow;
window->flags = 1;
@@ -721,7 +945,7 @@ void AGOSEngine::oe1_printMonsterDamage() {
mouseOn();
}
-void AGOSEngine::oe1_pauseGame() {
+void AGOSEngine_Elvira1::oe1_pauseGame() {
// 274: pause game
WindowBlock *window = _windowArray[4];
const char *message1, *message2;
@@ -792,7 +1016,7 @@ restart:
_gameStoppedClock = time(NULL) - pauseTime + _gameStoppedClock;
}
-void AGOSEngine::oe1_printPlayerHit() {
+void AGOSEngine_Elvira1::oe1_printPlayerHit() {
// 277: print player hit
WindowBlock *window = _dummyWindow;
window->flags = 1;
@@ -802,7 +1026,7 @@ void AGOSEngine::oe1_printPlayerHit() {
mouseOn();
}
-void AGOSEngine::oe1_printMonsterHit() {
+void AGOSEngine_Elvira1::oe1_printMonsterHit() {
// 278: print monster hit
WindowBlock *window = _dummyWindow;
window->flags = 1;
diff --git a/engines/agos/script_e2.cpp b/engines/agos/script_e2.cpp
index ac4d40a446..cab8f6ddf5 100644
--- a/engines/agos/script_e2.cpp
+++ b/engines/agos/script_e2.cpp
@@ -27,77 +27,262 @@
namespace AGOS {
-void AGOSEngine_Elvira2::setupOpcodes(OpcodeProc *op) {
- AGOSEngine::setupOpcodes(op);
-
- op[8] = &AGOSEngine::oe1_isNotAt;
- op[9] = &AGOSEngine::oe1_sibling;
- op[10] = &AGOSEngine::oe1_notSibling;
- op[21] = &AGOSEngine::oe1_isIn;
- op[22] = &AGOSEngine::oe1_isNotIn;
- op[24] = &AGOSEngine::oe1_isPlayer;
- op[29] = &AGOSEngine::oe1_canPut;
- op[34] = &AGOSEngine::oe1_copyof;
- op[35] = &AGOSEngine::oe1_copyfo;
- op[37] = &AGOSEngine::oe1_whatO;
- op[39] = &AGOSEngine::oe1_weigh;
- op[54] = &AGOSEngine::oe2_moveDirn;
- op[72] = &AGOSEngine::oe2_doClass;
- op[73] = &AGOSEngine::oe2_pObj;
- op[74] = &AGOSEngine::oe1_pName;
- op[75] = &AGOSEngine::oe1_pcName;
- op[79] = &AGOSEngine::oe1_isCalled;
- op[83] = &AGOSEngine::oe1_rescan;
- op[89] = &AGOSEngine::oe2_loadGame;
- op[94] = &AGOSEngine::oe1_findMaster;
- op[95] = &AGOSEngine::oe1_nextMaster;
- op[98] = &AGOSEngine::oe1_animate;
- op[99] = &AGOSEngine::oe1_stopAnimate;
- op[113] = &AGOSEngine::oe2_drawItem;
- op[123] = &AGOSEngine::oe1_setTime;
- op[124] = &AGOSEngine::oe1_ifTime;
- op[127] = &AGOSEngine::os1_playTune;
- op[135] = &AGOSEngine::oe2_pauseGame;
- op[144] = &AGOSEngine::oe2_setDoorOpen;
- op[145] = &AGOSEngine::oe2_setDoorClosed;
- op[146] = &AGOSEngine::oe2_setDoorLocked;
- op[147] = &AGOSEngine::oe2_setDoorClosed;
- op[148] = &AGOSEngine::oe2_ifDoorOpen;
- op[149] = &AGOSEngine::oe2_ifDoorClosed;
- op[150] = &AGOSEngine::oe2_ifDoorLocked;
- op[161] = &AGOSEngine::oe2_printStats;
- op[165] = &AGOSEngine::oe2_setSuperRoom;
- op[166] = &AGOSEngine::oe2_getSuperRoom;
- op[167] = &AGOSEngine::oe2_setExitOpen;
- op[168] = &AGOSEngine::oe2_setExitClosed;
- op[169] = &AGOSEngine::oe2_setExitLocked;
- op[170] = &AGOSEngine::oe2_setExitClosed;
- op[171] = &AGOSEngine::oe2_ifExitOpen;
- op[172] = &AGOSEngine::oe2_ifExitClosed;
- op[173] = &AGOSEngine::oe2_ifExitLocked;
- op[174] = &AGOSEngine::oe2_unk174;
- op[175] = &AGOSEngine::oe2_getDollar2;
- op[176] = &AGOSEngine::oe2_setSRExit;
- op[177] = &AGOSEngine::oe2_unk177;
- op[178] = &AGOSEngine::oe2_unk178;
- op[179] = &AGOSEngine::oe2_isAdjNoun;
- op[180] = &AGOSEngine::oe2_b2Set;
- op[181] = &AGOSEngine::oe2_b2Clear;
- op[182] = &AGOSEngine::oe2_b2Zero;
- op[183] = &AGOSEngine::oe2_b2NotZero;
+#define OPCODE(x) _OPCODE(AGOSEngine_Elvira2, x)
+
+void AGOSEngine_Elvira2::setupOpcodes() {
+ static const OpcodeEntryElvira2 opcodes[] = {
+ /* 00 */
+ OPCODE(o_invalid),
+ OPCODE(o_at),
+ OPCODE(o_notAt),
+ OPCODE(o_invalid),
+ /* 04 */
+ OPCODE(o_invalid),
+ OPCODE(o_carried),
+ OPCODE(o_notCarried),
+ OPCODE(o_isAt),
+ /* 08 */
+ OPCODE(oe1_isNotAt),
+ OPCODE(oe1_sibling),
+ OPCODE(oe1_notSibling),
+ OPCODE(o_zero),
+ /* 12 */
+ OPCODE(o_notZero),
+ OPCODE(o_eq),
+ OPCODE(o_notEq),
+ OPCODE(o_gt),
+ /* 16 */
+ OPCODE(o_lt),
+ OPCODE(o_eqf),
+ OPCODE(o_notEqf),
+ OPCODE(o_ltf),
+ /* 20 */
+ OPCODE(o_gtf),
+ OPCODE(oe1_isIn),
+ OPCODE(oe1_isNotIn),
+ OPCODE(o_chance),
+ /* 24 */
+ OPCODE(oe1_isPlayer),
+ OPCODE(o_isRoom),
+ OPCODE(o_isObject),
+ OPCODE(o_state),
+ /* 28 */
+ OPCODE(o_oflag),
+ OPCODE(oe1_canPut),
+ OPCODE(o_invalid),
+ OPCODE(o_destroy),
+ /* 32 */
+ OPCODE(o_invalid),
+ OPCODE(o_place),
+ OPCODE(oe1_copyof),
+ OPCODE(oe1_copyfo),
+ /* 36 */
+ OPCODE(o_copyff),
+ OPCODE(oe1_whatO),
+ OPCODE(o_invalid),
+ OPCODE(oe1_weigh),
+ /* 40 */
+ OPCODE(o_invalid),
+ OPCODE(o_clear),
+ OPCODE(o_let),
+ OPCODE(o_add),
+ /* 44 */
+ OPCODE(o_sub),
+ OPCODE(o_addf),
+ OPCODE(o_subf),
+ OPCODE(o_mul),
+ /* 48 */
+ OPCODE(o_div),
+ OPCODE(o_mulf),
+ OPCODE(o_divf),
+ OPCODE(o_mod),
+ /* 52 */
+ OPCODE(o_modf),
+ OPCODE(o_random),
+ OPCODE(oe2_moveDirn),
+ OPCODE(o_goto),
+ /* 56 */
+ OPCODE(o_oset),
+ OPCODE(o_oclear),
+ OPCODE(o_putBy),
+ OPCODE(o_inc),
+ /* 60 */
+ OPCODE(o_dec),
+ OPCODE(o_setState),
+ OPCODE(o_print),
+ OPCODE(o_message),
+ /* 64 */
+ OPCODE(o_msg),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 68 */
+ OPCODE(o_end),
+ OPCODE(o_done),
+ OPCODE(o_invalid),
+ OPCODE(o_process),
+ /* 72 */
+ OPCODE(oe2_doClass),
+ OPCODE(oe2_pObj),
+ OPCODE(oe1_pName),
+ OPCODE(oe1_pcName),
+ /* 76 */
+ OPCODE(o_when),
+ OPCODE(o_if1),
+ OPCODE(o_if2),
+ OPCODE(oe1_isCalled),
+ /* 80 */
+ OPCODE(o_is),
+ OPCODE(o_invalid),
+ OPCODE(o_debug),
+ OPCODE(oe1_rescan),
+ /* 84 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_comment),
+ /* 88 */
+ OPCODE(o_invalid),
+ OPCODE(oe2_loadGame),
+ OPCODE(o_getParent),
+ OPCODE(o_getNext),
+ /* 92 */
+ OPCODE(o_getChildren),
+ OPCODE(o_invalid),
+ OPCODE(oe1_findMaster),
+ OPCODE(oe1_nextMaster),
+ /* 96 */
+ OPCODE(o_picture),
+ OPCODE(o_loadZone),
+ OPCODE(oe1_animate),
+ OPCODE(oe1_stopAnimate),
+ /* 100 */
+ OPCODE(o_killAnimate),
+ OPCODE(o_defWindow),
+ OPCODE(o_window),
+ OPCODE(o_cls),
+ /* 104 */
+ OPCODE(o_closeWindow),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_addBox),
+ /* 108 */
+ OPCODE(o_delBox),
+ OPCODE(o_enableBox),
+ OPCODE(o_disableBox),
+ OPCODE(o_moveBox),
+ /* 112 */
+ OPCODE(o_invalid),
+ OPCODE(oe2_drawItem),
+ OPCODE(o_doIcons),
+ OPCODE(o_isClass),
+ /* 116 */
+ OPCODE(o_setClass),
+ OPCODE(o_unsetClass),
+ OPCODE(o_invalid),
+ OPCODE(o_waitSync),
+ /* 120*/
+ OPCODE(o_sync),
+ OPCODE(o_defObj),
+ OPCODE(o_invalid),
+ OPCODE(oe1_setTime),
+ /* 124 */
+ OPCODE(oe1_ifTime),
+ OPCODE(o_here),
+ OPCODE(o_doClassIcons),
+ OPCODE(o_playTune),
+ /* 128 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_setAdjNoun),
+ OPCODE(o_invalid),
+ /* 132 */
+ OPCODE(o_saveUserGame),
+ OPCODE(o_loadUserGame),
+ OPCODE(o_invalid),
+ OPCODE(oe2_pauseGame),
+ /* 136 */
+ OPCODE(o_copysf),
+ OPCODE(o_restoreIcons),
+ OPCODE(o_freezeZones),
+ OPCODE(o_placeNoIcons),
+ /* 140 */
+ OPCODE(o_clearTimers),
+ OPCODE(o_setDollar),
+ OPCODE(o_isBox),
+ OPCODE(oe2_doTable),
+ /* 144 */
+ OPCODE(oe2_setDoorOpen),
+ OPCODE(oe2_setDoorClosed),
+ OPCODE(oe2_setDoorLocked),
+ OPCODE(oe2_setDoorClosed),
+ /* 148 */
+ OPCODE(oe2_ifDoorOpen),
+ OPCODE(oe2_ifDoorClosed),
+ OPCODE(oe2_ifDoorLocked),
+ OPCODE(oe2_storeItem),
+ /* 152 */
+ OPCODE(oe2_getItem),
+ OPCODE(oe2_bSet),
+ OPCODE(oe2_bClear),
+ OPCODE(oe2_bZero),
+ /* 156 */
+ OPCODE(oe2_bNotZero),
+ OPCODE(oe2_getOValue),
+ OPCODE(oe2_setOValue),
+ OPCODE(o_invalid),
+ /* 160 */
+ OPCODE(oe2_ink),
+ OPCODE(oe2_printStats),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 164 */
+ OPCODE(o_invalid),
+ OPCODE(oe2_setSuperRoom),
+ OPCODE(oe2_getSuperRoom),
+ OPCODE(oe2_setExitOpen),
+ /* 168 */
+ OPCODE(oe2_setExitClosed),
+ OPCODE(oe2_setExitLocked),
+ OPCODE(oe2_setExitClosed),
+ OPCODE(oe2_ifExitOpen),
+ /* 172 */
+ OPCODE(oe2_ifExitClosed),
+ OPCODE(oe2_ifExitLocked),
+ OPCODE(oe2_unk174),
+ OPCODE(oe2_getDollar2),
+ /* 176 */
+ OPCODE(oe2_setSRExit),
+ OPCODE(oe2_unk177),
+ OPCODE(oe2_unk178),
+ OPCODE(oe2_isAdjNoun),
+ /* 180 */
+ OPCODE(oe2_b2Set),
+ OPCODE(oe2_b2Clear),
+ OPCODE(oe2_b2Zero),
+ OPCODE(oe2_b2NotZero)
+ };
+
+ _opcodesElvira2 = opcodes;
+ _numOpcodes = 184;
+}
+
+void AGOSEngine_Elvira2::executeOpcode(int opcode) {
+ OpcodeProcElvira2 op = _opcodesElvira2[opcode].proc;
+ (this->*op) ();
}
// -----------------------------------------------------------------------
// Elvira 2 Opcodes
// -----------------------------------------------------------------------
-void AGOSEngine::oe2_moveDirn() {
+void AGOSEngine_Elvira2::oe2_moveDirn() {
// 54: move direction
int16 d = getVarOrByte();
moveDirn_e2(me(), d);
}
-void AGOSEngine::oe2_doClass() {
+void AGOSEngine_Elvira2::oe2_doClass() {
// 72: do class
Item *i = getNextItemPtr();
byte cm = getByte();
@@ -120,7 +305,7 @@ void AGOSEngine::oe2_doClass() {
}
}
-void AGOSEngine::oe2_pObj() {
+void AGOSEngine_Elvira2::oe2_pObj() {
// 73: print object
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
@@ -128,7 +313,7 @@ void AGOSEngine::oe2_pObj() {
showMessageFormat((const char *)getStringPtrByID(subObject->objectFlagValue[0]));
}
-void AGOSEngine::oe2_loadGame() {
+void AGOSEngine_Elvira2::oe2_loadGame() {
// 89: load game
uint16 stringId = getNextStringID();
debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
@@ -140,7 +325,7 @@ void AGOSEngine::oe2_loadGame() {
}
}
-void AGOSEngine::oe2_drawItem() {
+void AGOSEngine_Elvira2::oe2_drawItem() {
// 113: draw item
Item *i = getNextItemPtr();
int a = getVarOrByte();
@@ -151,7 +336,7 @@ void AGOSEngine::oe2_drawItem() {
mouseOn();
}
-void AGOSEngine::oe2_doTable() {
+void AGOSEngine_Elvira2::oe2_doTable() {
// 143: start item sub
Item *i = getNextItemPtr();
@@ -176,7 +361,7 @@ void AGOSEngine::oe2_doTable() {
}
}
-void AGOSEngine::oe2_pauseGame() {
+void AGOSEngine_Elvira2::oe2_pauseGame() {
// 135: pause game
HitArea *ha;
@@ -205,53 +390,53 @@ void AGOSEngine::oe2_pauseGame() {
_gameStoppedClock = time(NULL) - pauseTime + _gameStoppedClock;
}
-void AGOSEngine::oe2_setDoorOpen() {
+void AGOSEngine_Elvira2::oe2_setDoorOpen() {
// 144: set door open
Item *i = getNextItemPtr();
setDoorState(i, getVarOrByte(), 1);
}
-void AGOSEngine::oe2_setDoorClosed() {
+void AGOSEngine_Elvira2::oe2_setDoorClosed() {
// 145: set door closed
Item *i = getNextItemPtr();
setDoorState(i, getVarOrByte(), 2);
}
-void AGOSEngine::oe2_setDoorLocked() {
+void AGOSEngine_Elvira2::oe2_setDoorLocked() {
// 146: set door locked
Item *i = getNextItemPtr();
setDoorState(i, getVarOrByte(), 3);
}
-void AGOSEngine::oe2_ifDoorOpen() {
+void AGOSEngine_Elvira2::oe2_ifDoorOpen() {
// 148: if door open
Item *i = getNextItemPtr();
uint16 d = getVarOrByte();
setScriptCondition(getDoorState(i, d) == 1);
}
-void AGOSEngine::oe2_ifDoorClosed() {
+void AGOSEngine_Elvira2::oe2_ifDoorClosed() {
// 149: if door closed
Item *i = getNextItemPtr();
uint16 d = getVarOrByte();
setScriptCondition(getDoorState(i, d) == 2);
}
-void AGOSEngine::oe2_ifDoorLocked() {
+void AGOSEngine_Elvira2::oe2_ifDoorLocked() {
// 150: if door locked
Item *i=getNextItemPtr();
uint16 d = getVarOrByte();
setScriptCondition(getDoorState(i, d) == 3);
}
-void AGOSEngine::oe2_storeItem() {
+void AGOSEngine_Elvira2::oe2_storeItem() {
// 151: set array6 to item
uint var = getVarOrByte();
Item *item = getNextItemPtr();
_itemStore[var] = item;
}
-void AGOSEngine::oe2_getItem() {
+void AGOSEngine_Elvira2::oe2_getItem() {
// 152: set m1 to m3 to array 6
Item *item = _itemStore[getVarOrByte()];
uint var = getVarOrByte();
@@ -262,22 +447,22 @@ void AGOSEngine::oe2_getItem() {
}
}
-void AGOSEngine::oe2_bSet() {
+void AGOSEngine_Elvira2::oe2_bSet() {
// 153: set bit
setBitFlag(getVarWrapper(), true);
}
-void AGOSEngine::oe2_bClear() {
+void AGOSEngine_Elvira2::oe2_bClear() {
// 154: clear bit
setBitFlag(getVarWrapper(), false);
}
-void AGOSEngine::oe2_bZero() {
+void AGOSEngine_Elvira2::oe2_bZero() {
// 155: is bit clear
setScriptCondition(!getBitFlag(getVarWrapper()));
}
-void AGOSEngine::oe2_bNotZero() {
+void AGOSEngine_Elvira2::oe2_bNotZero() {
// 156: is bit set
uint bit = getVarWrapper();
@@ -289,7 +474,7 @@ void AGOSEngine::oe2_bNotZero() {
setScriptCondition(getBitFlag(bit));
}
-void AGOSEngine::oe2_getOValue() {
+void AGOSEngine_Elvira2::oe2_getOValue() {
// 157: get item int prop
Item *item = getNextItemPtr();
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
@@ -303,7 +488,7 @@ void AGOSEngine::oe2_getOValue() {
}
}
-void AGOSEngine::oe2_setOValue() {
+void AGOSEngine_Elvira2::oe2_setOValue() {
// 158: set item prop
Item *item = getNextItemPtr();
SubObject *subObject = (SubObject *)findChildOfType(item, 2);
@@ -316,12 +501,12 @@ void AGOSEngine::oe2_setOValue() {
}
}
-void AGOSEngine::oe2_ink() {
+void AGOSEngine_Elvira2::oe2_ink() {
// 160
setTextColor(getVarOrByte());
}
-void AGOSEngine::oe2_printStats() {
+void AGOSEngine_Elvira2::oe2_printStats() {
// 161: print stats
WindowBlock *window = _dummyWindow;
int val;
@@ -366,17 +551,17 @@ void AGOSEngine::oe2_printStats() {
mouseOn();
}
-void AGOSEngine::oe2_setSuperRoom() {
+void AGOSEngine_Elvira2::oe2_setSuperRoom() {
// 165: set super room
_superRoomNumber = getVarOrWord();
}
-void AGOSEngine::oe2_getSuperRoom() {
+void AGOSEngine_Elvira2::oe2_getSuperRoom() {
// 166: get super room
writeNextVarContents(_superRoomNumber);
}
-void AGOSEngine::oe2_setExitOpen() {
+void AGOSEngine_Elvira2::oe2_setExitOpen() {
// 167: set exit open
Item *i = getNextItemPtr();
uint16 n = getVarOrWord();
@@ -384,7 +569,7 @@ void AGOSEngine::oe2_setExitOpen() {
setExitState(i, n, d, 1);
}
-void AGOSEngine::oe2_setExitClosed() {
+void AGOSEngine_Elvira2::oe2_setExitClosed() {
// 168: set exit closed
Item *i = getNextItemPtr();
uint16 n = getVarOrWord();
@@ -392,7 +577,7 @@ void AGOSEngine::oe2_setExitClosed() {
setExitState(i, n, d, 2);
}
-void AGOSEngine::oe2_setExitLocked() {
+void AGOSEngine_Elvira2::oe2_setExitLocked() {
// 169: set exit locked
Item *i = getNextItemPtr();
uint16 n = getVarOrWord();
@@ -400,7 +585,7 @@ void AGOSEngine::oe2_setExitLocked() {
setExitState(i, n, d, 3);
}
-void AGOSEngine::oe2_ifExitOpen() {
+void AGOSEngine_Elvira2::oe2_ifExitOpen() {
// 171: if exit open
Item *i = getNextItemPtr();
uint16 n = getVarOrWord();
@@ -408,7 +593,7 @@ void AGOSEngine::oe2_ifExitOpen() {
setScriptCondition(getExitState(i, n, d) == 1);
}
-void AGOSEngine::oe2_ifExitClosed() {
+void AGOSEngine_Elvira2::oe2_ifExitClosed() {
// 172: if exit closed
Item *i = getNextItemPtr();
uint16 n = getVarOrWord();
@@ -416,7 +601,7 @@ void AGOSEngine::oe2_ifExitClosed() {
setScriptCondition(getExitState(i, n, d) == 2);
}
-void AGOSEngine::oe2_ifExitLocked() {
+void AGOSEngine_Elvira2::oe2_ifExitLocked() {
// 173: if exit locked
Item *i = getNextItemPtr();
uint16 n = getVarOrWord();
@@ -424,13 +609,13 @@ void AGOSEngine::oe2_ifExitLocked() {
setScriptCondition(getExitState(i, n, d) == 3);
}
-void AGOSEngine::oe2_unk174() {
+void AGOSEngine_Elvira2::oe2_unk174() {
// 174:
uint a = getVarOrWord();
debug(0, "oe2_unk174: stub (%d)", a);
}
-void AGOSEngine::oe2_getDollar2() {
+void AGOSEngine_Elvira2::oe2_getDollar2() {
// 175
_showPreposition = true;
@@ -455,7 +640,7 @@ void AGOSEngine::oe2_getDollar2() {
_showPreposition = false;
}
-void AGOSEngine::oe2_setSRExit() {
+void AGOSEngine_Elvira2::oe2_setSRExit() {
// 176: set super room exit
Item *i = getNextItemPtr();
uint n = getVarOrWord();
@@ -464,44 +649,44 @@ void AGOSEngine::oe2_setSRExit() {
setSRExit(i, n, d, s);
}
-void AGOSEngine::oe2_unk177() {
+void AGOSEngine_Elvira2::oe2_unk177() {
// 177: set unknown vga event
uint a = getVarOrByte();
debug(0, "oe2_unk177: stub (%d)", a);
}
-void AGOSEngine::oe2_unk178() {
+void AGOSEngine_Elvira2::oe2_unk178() {
// 178: set unknown vga event
uint a = getVarOrByte();
debug(0, "oe2_unk178: stub (%d)", a);
}
-void AGOSEngine::oe2_isAdjNoun() {
+void AGOSEngine_Elvira2::oe2_isAdjNoun() {
// 179: item unk1 unk2 is
Item *item = getNextItemPtr();
int16 a = getNextWord(), b = getNextWord();
setScriptCondition(item->adjective == a && item->noun == b);
}
-void AGOSEngine::oe2_b2Set() {
+void AGOSEngine_Elvira2::oe2_b2Set() {
// 180: set bit2
uint bit = getVarOrByte();
_bitArrayTwo[bit / 16] |= (1 << (bit & 15));
}
-void AGOSEngine::oe2_b2Clear() {
+void AGOSEngine_Elvira2::oe2_b2Clear() {
// 181: clear bit2
uint bit = getVarOrByte();
_bitArrayTwo[bit / 16] &= ~(1 << (bit & 15));
}
-void AGOSEngine::oe2_b2Zero() {
+void AGOSEngine_Elvira2::oe2_b2Zero() {
// 182: is bit2 clear
uint bit = getVarOrByte();
setScriptCondition((_bitArrayTwo[bit / 16] & (1 << (bit & 15))) == 0);
}
-void AGOSEngine::oe2_b2NotZero() {
+void AGOSEngine_Elvira2::oe2_b2NotZero() {
// 183: is bit2 set
uint bit = getVarOrByte();
setScriptCondition((_bitArrayTwo[bit / 16] & (1 << (bit & 15))) != 0);
diff --git a/engines/agos/script_ff.cpp b/engines/agos/script_ff.cpp
index 912110bb9d..7dff2346cf 100644
--- a/engines/agos/script_ff.cpp
+++ b/engines/agos/script_ff.cpp
@@ -30,69 +30,276 @@
namespace AGOS {
-void AGOSEngine_Feeble::setupOpcodes(OpcodeProc *op) {
- AGOSEngine::setupOpcodes(op);
-
- op[23] = &AGOSEngine::off_chance;
- op[37] = &AGOSEngine::off_jumpOut;
- op[65] = &AGOSEngine::off_addTextBox;
- op[66] = &AGOSEngine::oww_setShortText;
- op[67] = &AGOSEngine::oww_setLongText;
- op[70] = &AGOSEngine::off_printLongText;
- op[83] = &AGOSEngine::os2_rescan;
- op[98] = &AGOSEngine::os2_animate;
- op[99] = &AGOSEngine::os2_stopAnimate;
- op[107] = &AGOSEngine::off_addBox;
- op[122] = &AGOSEngine::off_oracleTextDown;
- op[123] = &AGOSEngine::off_oracleTextUp;
- op[124] = &AGOSEngine::off_ifTime;
- op[131] = &AGOSEngine::off_setTime;
- op[132] = &AGOSEngine::off_saveUserGame;
- op[133] = &AGOSEngine::off_loadUserGame;
- op[134] = &AGOSEngine::off_listSaveGames;
- op[135] = &AGOSEngine::off_checkCD;
- op[161] = &AGOSEngine::off_screenTextBox;
- op[162] = &AGOSEngine::os1_screenTextMsg;
- op[164] = &AGOSEngine::oe2_getDollar2;
- op[165] = &AGOSEngine::off_isAdjNoun;
- op[166] = &AGOSEngine::oe2_b2Set;
- op[167] = &AGOSEngine::oe2_b2Clear;
- op[168] = &AGOSEngine::oe2_b2Zero;
- op[169] = &AGOSEngine::oe2_b2NotZero;
- op[171] = &AGOSEngine::off_hyperLinkOn;
- op[172] = &AGOSEngine::off_hyperLinkOff;
- op[173] = &AGOSEngine::off_checkPaths;
- op[175] = &AGOSEngine::oww_lockZones;
- op[176] = &AGOSEngine::oww_unlockZones;
- op[177] = &AGOSEngine::off_screenTextPObj;
- op[178] = &AGOSEngine::os1_getPathPosn;
- op[179] = &AGOSEngine::os1_scnTxtLongText;
- op[180] = &AGOSEngine::off_mouseOn;
- op[181] = &AGOSEngine::off_mouseOff;
- op[182] = &AGOSEngine::off_loadVideo;
- op[183] = &AGOSEngine::off_playVideo;
- op[184] = &AGOSEngine::os1_unloadZone;
- op[186] = &AGOSEngine::os1_unfreezeZones;
- op[187] = &AGOSEngine::off_centreScroll;
- op[188] = &AGOSEngine::os2_isShortText;
- op[189] = &AGOSEngine::os2_clearMarks;
- op[190] = &AGOSEngine::os2_waitMark;
- op[191] = &AGOSEngine::off_resetPVCount;
- op[192] = &AGOSEngine::off_setPathValues;
- op[193] = &AGOSEngine::off_stopClock;
- op[194] = &AGOSEngine::off_restartClock;
- op[195] = &AGOSEngine::off_setColour;
- op[196] = &AGOSEngine::off_b3Set;
- op[197] = &AGOSEngine::off_b3Clear;
- op[198] = &AGOSEngine::off_b3Zero;
- op[199] = &AGOSEngine::off_b3NotZero;
+#define OPCODE(x) _OPCODE(AGOSEngine_Feeble, x)
+
+void AGOSEngine_Feeble::setupOpcodes() {
+ static const OpcodeEntryFeeble opcodes[] = {
+ /* 00 */
+ OPCODE(o_invalid),
+ OPCODE(o_at),
+ OPCODE(o_notAt),
+ OPCODE(o_invalid),
+ /* 04 */
+ OPCODE(o_invalid),
+ OPCODE(o_carried),
+ OPCODE(o_notCarried),
+ OPCODE(o_isAt),
+ /* 08 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_zero),
+ /* 12 */
+ OPCODE(o_notZero),
+ OPCODE(o_eq),
+ OPCODE(o_notEq),
+ OPCODE(o_gt),
+ /* 16 */
+ OPCODE(o_lt),
+ OPCODE(o_eqf),
+ OPCODE(o_notEqf),
+ OPCODE(o_ltf),
+ /* 20 */
+ OPCODE(o_gtf),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(off_chance),
+ /* 24 */
+ OPCODE(o_invalid),
+ OPCODE(o_isRoom),
+ OPCODE(o_isObject),
+ OPCODE(o_state),
+ /* 28 */
+ OPCODE(o_oflag),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_destroy),
+ /* 32 */
+ OPCODE(o_invalid),
+ OPCODE(o_place),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 36 */
+ OPCODE(o_copyff),
+ OPCODE(off_jumpOut),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 40 */
+ OPCODE(o_invalid),
+ OPCODE(o_clear),
+ OPCODE(o_let),
+ OPCODE(o_add),
+ /* 44 */
+ OPCODE(o_sub),
+ OPCODE(o_addf),
+ OPCODE(o_subf),
+ OPCODE(o_mul),
+ /* 48 */
+ OPCODE(o_div),
+ OPCODE(o_mulf),
+ OPCODE(o_divf),
+ OPCODE(o_mod),
+ /* 52 */
+ OPCODE(o_modf),
+ OPCODE(o_random),
+ OPCODE(o_invalid),
+ OPCODE(o_goto),
+ /* 56 */
+ OPCODE(o_oset),
+ OPCODE(o_oclear),
+ OPCODE(o_putBy),
+ OPCODE(o_inc),
+ /* 60 */
+ OPCODE(o_dec),
+ OPCODE(o_setState),
+ OPCODE(o_print),
+ OPCODE(o_message),
+ /* 64 */
+ OPCODE(o_msg),
+ OPCODE(off_addTextBox),
+ OPCODE(oww_setShortText),
+ OPCODE(oww_setLongText),
+ /* 68 */
+ OPCODE(o_end),
+ OPCODE(o_done),
+ OPCODE(off_printLongText),
+ OPCODE(o_process),
+ /* 72 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 76 */
+ OPCODE(o_when),
+ OPCODE(o_if1),
+ OPCODE(o_if2),
+ OPCODE(o_isCalled),
+ /* 80 */
+ OPCODE(o_is),
+ OPCODE(o_invalid),
+ OPCODE(o_debug),
+ OPCODE(os2_rescan),
+ /* 84 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_comment),
+ /* 88 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_getParent),
+ OPCODE(o_getNext),
+ /* 92 */
+ OPCODE(o_getChildren),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 96 */
+ OPCODE(o_picture),
+ OPCODE(o_loadZone),
+ OPCODE(os2_animate),
+ OPCODE(os2_stopAnimate),
+ /* 100 */
+ OPCODE(o_killAnimate),
+ OPCODE(o_defWindow),
+ OPCODE(o_window),
+ OPCODE(o_cls),
+ /* 104 */
+ OPCODE(o_closeWindow),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(off_addBox),
+ /* 108 */
+ OPCODE(o_delBox),
+ OPCODE(o_enableBox),
+ OPCODE(o_disableBox),
+ OPCODE(o_moveBox),
+ /* 112 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_doIcons),
+ OPCODE(o_isClass),
+ /* 116 */
+ OPCODE(o_setClass),
+ OPCODE(o_unsetClass),
+ OPCODE(o_invalid),
+ OPCODE(o_waitSync),
+ /* 120 */
+ OPCODE(o_sync),
+ OPCODE(o_defObj),
+ OPCODE(off_oracleTextDown),
+ OPCODE(off_oracleTextUp),
+ /* 124 */
+ OPCODE(off_ifTime),
+ OPCODE(o_here),
+ OPCODE(o_doClassIcons),
+ OPCODE(o_invalid),
+ /* 128 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_setAdjNoun),
+ OPCODE(off_setTime),
+ /* 132 */
+ OPCODE(off_saveUserGame),
+ OPCODE(off_loadUserGame),
+ OPCODE(off_listSaveGames),
+ OPCODE(off_checkCD),
+ /* 136 */
+ OPCODE(o_copysf),
+ OPCODE(o_restoreIcons),
+ OPCODE(o_freezeZones),
+ OPCODE(o_placeNoIcons),
+ /* 140 */
+ OPCODE(o_clearTimers),
+ OPCODE(o_setDollar),
+ OPCODE(o_isBox),
+ OPCODE(oe2_doTable),
+ /* 144 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 148 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe2_storeItem),
+ /* 152 */
+ OPCODE(oe2_getItem),
+ OPCODE(oe2_bSet),
+ OPCODE(oe2_bClear),
+ OPCODE(oe2_bZero),
+ /* 156 */
+ OPCODE(oe2_bNotZero),
+ OPCODE(oe2_getOValue),
+ OPCODE(oe2_setOValue),
+ OPCODE(o_invalid),
+ /* 160 */
+ OPCODE(oe2_ink),
+ OPCODE(off_screenTextBox),
+ OPCODE(os1_screenTextMsg),
+ OPCODE(o_invalid),
+ /* 164 */
+ OPCODE(oe2_getDollar2),
+ OPCODE(off_isAdjNoun),
+ OPCODE(oe2_b2Set),
+ OPCODE(oe2_b2Clear),
+ /* 168 */
+ OPCODE(oe2_b2Zero),
+ OPCODE(oe2_b2NotZero),
+ OPCODE(o_invalid),
+ OPCODE(off_hyperLinkOn),
+ /* 172 */
+ OPCODE(off_hyperLinkOff),
+ OPCODE(off_checkPaths),
+ OPCODE(o_invalid),
+ OPCODE(oww_lockZones),
+ /* 176 */
+ OPCODE(oww_unlockZones),
+ OPCODE(off_screenTextPObj),
+ OPCODE(os1_getPathPosn),
+ OPCODE(os1_scnTxtLongText),
+ /* 180 */
+ OPCODE(off_mouseOn),
+ OPCODE(off_mouseOff),
+ OPCODE(off_loadVideo),
+ OPCODE(off_playVideo),
+ /* 184 */
+ OPCODE(os1_unloadZone),
+ OPCODE(o_invalid),
+ OPCODE(os1_unfreezeZones),
+ OPCODE(off_centreScroll),
+ /* 188 */
+ OPCODE(os2_isShortText),
+ OPCODE(os2_clearMarks),
+ OPCODE(os2_waitMark),
+ OPCODE(off_resetPVCount),
+ /* 192 */
+ OPCODE(off_setPathValues),
+ OPCODE(off_stopClock),
+ OPCODE(off_restartClock),
+ OPCODE(off_setColour),
+ /* 196 */
+ OPCODE(off_b3Set),
+ OPCODE(off_b3Clear),
+ OPCODE(off_b3Zero),
+ OPCODE(off_b3NotZero)
+ };
+
+ _opcodesFeeble = opcodes;
+ _numOpcodes = 200;
+}
+
+void AGOSEngine_Feeble::executeOpcode(int opcode) {
+ OpcodeProcFeeble op = _opcodesFeeble[opcode].proc;
+ (this->*op) ();
}
// -----------------------------------------------------------------------
// Feeble Files Opcodes
// -----------------------------------------------------------------------
-void AGOSEngine::off_chance() {
+void AGOSEngine_Feeble::off_chance() {
// 23
uint a = getVarOrWord();
@@ -112,13 +319,13 @@ void AGOSEngine::off_chance() {
setScriptCondition(false);
}
-void AGOSEngine::off_jumpOut() {
+void AGOSEngine_Feeble::off_jumpOut() {
// 37
getVarOrByte();
setScriptReturn(1);
}
-void AGOSEngine::off_addTextBox() {
+void AGOSEngine_Feeble::off_addTextBox() {
// 65: add hit area
uint flags = kBFTextBox | kBFBoxItem;
uint id = getVarOrWord();
@@ -139,14 +346,14 @@ void AGOSEngine::off_addTextBox() {
defineBox(id, x, y, w, h, flags + (num << 8), 208, _dummyItem2);
}
-void AGOSEngine::off_printLongText() {
+void AGOSEngine_Feeble::off_printLongText() {
// 70: show string from array
int num = getVarOrByte();
const char *str = (const char *)getStringPtrByID(_longText[num]);
sendInteractText(num, "%d. %s\n", num, str);
}
-void AGOSEngine::off_addBox() {
+void AGOSEngine_Feeble::off_addBox() {
// 107: add item hitarea
uint flags = 0;
uint id = getVarOrWord();
@@ -176,17 +383,17 @@ void AGOSEngine::off_addBox() {
defineBox(id, x, y, w, h, flags, verb, item);
}
-void AGOSEngine::off_oracleTextDown() {
+void AGOSEngine_Feeble::off_oracleTextDown() {
// 122: oracle text down
oracleTextDown();
}
-void AGOSEngine::off_oracleTextUp() {
+void AGOSEngine_Feeble::off_oracleTextUp() {
// 123: oracle text up
oracleTextUp();
}
-void AGOSEngine::off_ifTime() {
+void AGOSEngine_Feeble::off_ifTime() {
// 124: if time
time_t t;
@@ -200,13 +407,13 @@ void AGOSEngine::off_ifTime() {
setScriptCondition(false);
}
-void AGOSEngine::off_setTime() {
+void AGOSEngine_Feeble::off_setTime() {
// 131
time(&_timeStore);
_timeStore -= _gameStoppedClock;
}
-void AGOSEngine::off_saveUserGame() {
+void AGOSEngine_Feeble::off_saveUserGame() {
// 132: save game
_noOracleScroll = 0;
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
@@ -214,7 +421,7 @@ void AGOSEngine::off_saveUserGame() {
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
}
-void AGOSEngine::off_loadUserGame() {
+void AGOSEngine_Feeble::off_loadUserGame() {
// 133: load game
if (readVariable(55) == 999) {
loadGame(getFileName(GAME_RESTFILE), true);
@@ -223,12 +430,12 @@ void AGOSEngine::off_loadUserGame() {
}
}
-void AGOSEngine::off_listSaveGames() {
+void AGOSEngine_Feeble::off_listSaveGames() {
// 134: dummy opcode?
listSaveGames(1);
}
-void AGOSEngine::off_checkCD() {
+void AGOSEngine_Feeble::off_checkCD() {
// 135: switch CD
uint disc = readVariable(97);
@@ -244,7 +451,7 @@ void AGOSEngine::off_checkCD() {
debug(0, "Switch to CD number %d", disc);
}
-void AGOSEngine::off_screenTextBox() {
+void AGOSEngine_Feeble::off_screenTextBox() {
// 161: setup text
TextLocation *tl = getTextLocation(getVarOrByte());
@@ -253,7 +460,7 @@ void AGOSEngine::off_screenTextBox() {
tl->width = getVarOrWord();
}
-void AGOSEngine::off_isAdjNoun() {
+void AGOSEngine_Feeble::off_isAdjNoun() {
// 165: item unk1 unk2 is
Item *item = getNextItemPtr();
int16 a = getNextWord(), b = getNextWord();
@@ -265,17 +472,17 @@ void AGOSEngine::off_isAdjNoun() {
setScriptCondition(false);
}
-void AGOSEngine::off_hyperLinkOn() {
+void AGOSEngine_Feeble::off_hyperLinkOn() {
// 171: oracle hyperlink on
hyperLinkOn(getVarOrWord());
}
-void AGOSEngine::off_hyperLinkOff() {
+void AGOSEngine_Feeble::off_hyperLinkOff() {
// 172: oracle hyperlink off
hyperLinkOff();
}
-void AGOSEngine::off_checkPaths() {
+void AGOSEngine_Feeble::off_checkPaths() {
// 173 check paths
int i, count;
const uint8 *pathVal1 = _pathValues1;
@@ -311,7 +518,7 @@ void AGOSEngine::off_checkPaths() {
_variableArray2[52] = result;
}
-void AGOSEngine::off_screenTextPObj() {
+void AGOSEngine_Feeble::off_screenTextPObj() {
// 177: inventory descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@@ -340,7 +547,7 @@ void AGOSEngine::off_screenTextPObj() {
}
}
-void AGOSEngine::off_mouseOn() {
+void AGOSEngine_Feeble::off_mouseOn() {
// 180: force mouseOn
if (_mouseCursor != 5) {
resetVerbs();
@@ -349,29 +556,29 @@ void AGOSEngine::off_mouseOn() {
_mouseHideCount = 0;
}
-void AGOSEngine::off_mouseOff() {
+void AGOSEngine_Feeble::off_mouseOff() {
// 181: force mouseOff
scriptMouseOff();
clearName();
}
-void AGOSEngine::off_loadVideo() {
+void AGOSEngine_Feeble::off_loadVideo() {
// 182: load video file
const byte *filename = getStringPtrByID(getNextStringID());
_moviePlay->load((const char *)filename);
}
-void AGOSEngine::off_playVideo() {
+void AGOSEngine_Feeble::off_playVideo() {
// 183: play video
_moviePlay->play();
}
-void AGOSEngine::off_centreScroll() {
+void AGOSEngine_Feeble::off_centreScroll() {
// 187
centreScroll();
}
-void AGOSEngine::off_resetPVCount() {
+void AGOSEngine_Feeble::off_resetPVCount() {
// 191
if (getBitFlag(83)) {
_PVCount1 = 0;
@@ -382,7 +589,7 @@ void AGOSEngine::off_resetPVCount() {
}
}
-void AGOSEngine::off_setPathValues() {
+void AGOSEngine_Feeble::off_setPathValues() {
// 192
uint8 a = getVarOrByte();
uint8 b = getVarOrByte();
@@ -401,19 +608,19 @@ void AGOSEngine::off_setPathValues() {
}
}
-void AGOSEngine::off_stopClock() {
+void AGOSEngine_Feeble::off_stopClock() {
// 193: pause clock
_clockStopped = time(NULL);
}
-void AGOSEngine::off_restartClock() {
+void AGOSEngine_Feeble::off_restartClock() {
// 194: resume clock
if (_clockStopped != 0)
_gameStoppedClock += time(NULL) - _clockStopped;
_clockStopped = 0;
}
-void AGOSEngine::off_setColour() {
+void AGOSEngine_Feeble::off_setColour() {
// 195: set palette colour
uint c = getVarOrByte() * 4;
uint r = getVarOrByte();
@@ -427,25 +634,25 @@ void AGOSEngine::off_setColour() {
_paletteFlag = 2;
}
-void AGOSEngine::off_b3Set() {
+void AGOSEngine_Feeble::off_b3Set() {
// 196: set bit3
uint bit = getVarOrByte();
_bitArrayThree[bit / 16] |= (1 << (bit & 15));
}
-void AGOSEngine::off_b3Clear() {
+void AGOSEngine_Feeble::off_b3Clear() {
// 197: clear bit3
uint bit = getVarOrByte();
_bitArrayThree[bit / 16] &= ~(1 << (bit & 15));
}
-void AGOSEngine::off_b3Zero() {
+void AGOSEngine_Feeble::off_b3Zero() {
// 198: is bit3 clear
uint bit = getVarOrByte();
setScriptCondition((_bitArrayThree[bit / 16] & (1 << (bit & 15))) == 0);
}
-void AGOSEngine::off_b3NotZero() {
+void AGOSEngine_Feeble::off_b3NotZero() {
// 199: is bit3 set
uint bit = getVarOrByte();
setScriptCondition((_bitArrayThree[bit / 16] & (1 << (bit & 15))) != 0);
diff --git a/engines/agos/script_pp.cpp b/engines/agos/script_pp.cpp
index 02660e2c8d..3038a48e0d 100644
--- a/engines/agos/script_pp.cpp
+++ b/engines/agos/script_pp.cpp
@@ -29,64 +29,271 @@
namespace AGOS {
-void AGOSEngine_PuzzlePack::setupOpcodes(OpcodeProc *op) {
- AGOSEngine::setupOpcodes(op);
-
- op[23] = &AGOSEngine::off_chance;
- op[30] = &AGOSEngine::opp_iconifyWindow;
- op[32] = &AGOSEngine::opp_restoreOopsPosition;
- op[38] = &AGOSEngine::opp_loadMouseImage;
- op[63] = &AGOSEngine::opp_message;
- op[65] = &AGOSEngine::off_addTextBox;
- op[66] = &AGOSEngine::opp_setShortText;
- op[67] = &AGOSEngine::oww_setLongText;
- op[70] = &AGOSEngine::off_printLongText;
- op[83] = &AGOSEngine::os2_rescan;
- op[98] = &AGOSEngine::os2_animate;
- op[99] = &AGOSEngine::os2_stopAnimate;
- op[105] = &AGOSEngine::opp_loadHiScores;
- op[106] = &AGOSEngine::opp_checkHiScores;
- op[107] = &AGOSEngine::off_addBox;
- op[120] = &AGOSEngine::opp_sync;
- op[122] = &AGOSEngine::off_oracleTextDown;
- op[123] = &AGOSEngine::off_oracleTextUp;
- op[124] = &AGOSEngine::off_ifTime;
- op[131] = &AGOSEngine::off_setTime;
- op[132] = &AGOSEngine::opp_saveUserGame;
- op[133] = &AGOSEngine::opp_loadUserGame;
- op[134] = &AGOSEngine::off_listSaveGames;
- op[161] = &AGOSEngine::off_screenTextBox;
- op[162] = &AGOSEngine::os1_screenTextMsg;
- op[164] = &AGOSEngine::oe2_getDollar2;
- op[165] = &AGOSEngine::off_isAdjNoun;
- op[171] = &AGOSEngine::off_hyperLinkOn;
- op[172] = &AGOSEngine::off_hyperLinkOff;
- op[173] = &AGOSEngine::opp_saveOopsPosition;
- op[175] = &AGOSEngine::oww_lockZones;
- op[176] = &AGOSEngine::oww_unlockZones;
- op[177] = &AGOSEngine::off_screenTextPObj;
- op[178] = &AGOSEngine::os1_getPathPosn;
- op[179] = &AGOSEngine::os1_scnTxtLongText;
- op[180] = &AGOSEngine::os1_mouseOn;
- op[181] = &AGOSEngine::off_mouseOff;
- op[184] = &AGOSEngine::os1_unloadZone;
- op[186] = &AGOSEngine::os1_unfreezeZones;
- op[187] = &AGOSEngine::opp_resetGameTime;
- op[188] = &AGOSEngine::os2_isShortText;
- op[189] = &AGOSEngine::os2_clearMarks;
- op[190] = &AGOSEngine::os2_waitMark;
- op[191] = &AGOSEngine::opp_resetPVCount;
- op[192] = &AGOSEngine::opp_setPathValues;
- op[193] = &AGOSEngine::off_stopClock;
- op[194] = &AGOSEngine::opp_restartClock;
- op[195] = &AGOSEngine::off_setColour;
+#define OPCODE(x) _OPCODE(AGOSEngine_PuzzlePack, x)
+
+void AGOSEngine_PuzzlePack::setupOpcodes() {
+ static const OpcodeEntryPuzzlePack opcodes[] = {
+ /* 00 */
+ OPCODE(o_invalid),
+ OPCODE(o_at),
+ OPCODE(o_notAt),
+ OPCODE(o_invalid),
+ /* 04 */
+ OPCODE(o_invalid),
+ OPCODE(o_carried),
+ OPCODE(o_notCarried),
+ OPCODE(o_isAt),
+ /* 08 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_zero),
+ /* 12 */
+ OPCODE(o_notZero),
+ OPCODE(o_eq),
+ OPCODE(o_notEq),
+ OPCODE(o_gt),
+ /* 16 */
+ OPCODE(o_lt),
+ OPCODE(o_eqf),
+ OPCODE(o_notEqf),
+ OPCODE(o_ltf),
+ /* 20 */
+ OPCODE(o_gtf),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(off_chance),
+ /* 24 */
+ OPCODE(o_invalid),
+ OPCODE(o_isRoom),
+ OPCODE(o_isObject),
+ OPCODE(o_state),
+ /* 28 */
+ OPCODE(o_oflag),
+ OPCODE(opp_iconifyWindow),
+ OPCODE(o_invalid),
+ OPCODE(o_destroy),
+ /* 32 */
+ OPCODE(opp_restoreOopsPosition),
+ OPCODE(o_place),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 36 */
+ OPCODE(o_copyff),
+ OPCODE(o_invalid),
+ OPCODE(opp_loadMouseImage),
+ OPCODE(o_invalid),
+ /* 40 */
+ OPCODE(o_invalid),
+ OPCODE(o_clear),
+ OPCODE(o_let),
+ OPCODE(o_add),
+ /* 44 */
+ OPCODE(o_sub),
+ OPCODE(o_addf),
+ OPCODE(o_subf),
+ OPCODE(o_mul),
+ /* 48 */
+ OPCODE(o_div),
+ OPCODE(o_mulf),
+ OPCODE(o_divf),
+ OPCODE(o_mod),
+ /* 52 */
+ OPCODE(o_modf),
+ OPCODE(o_random),
+ OPCODE(o_invalid),
+ OPCODE(o_goto),
+ /* 56 */
+ OPCODE(o_oset),
+ OPCODE(o_oclear),
+ OPCODE(o_putBy),
+ OPCODE(o_inc),
+ /* 60 */
+ OPCODE(o_dec),
+ OPCODE(o_setState),
+ OPCODE(o_print),
+ OPCODE(opp_message),
+ /* 64 */
+ OPCODE(o_msg),
+ OPCODE(off_addTextBox),
+ OPCODE(opp_setShortText),
+ OPCODE(oww_setLongText),
+ /* 68 */
+ OPCODE(o_end),
+ OPCODE(o_done),
+ OPCODE(off_printLongText),
+ OPCODE(o_process),
+ /* 72 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 76 */
+ OPCODE(o_when),
+ OPCODE(o_if1),
+ OPCODE(o_if2),
+ OPCODE(o_isCalled),
+ /* 80 */
+ OPCODE(o_is),
+ OPCODE(o_invalid),
+ OPCODE(o_debug),
+ OPCODE(os2_rescan),
+ /* 84 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_comment),
+ /* 88 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_getParent),
+ OPCODE(o_getNext),
+ /* 92 */
+ OPCODE(o_getChildren),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 96 */
+ OPCODE(o_picture),
+ OPCODE(o_loadZone),
+ OPCODE(os2_animate),
+ OPCODE(os2_stopAnimate),
+ /* 100 */
+ OPCODE(o_killAnimate),
+ OPCODE(o_defWindow),
+ OPCODE(o_window),
+ OPCODE(o_cls),
+ /* 104 */
+ OPCODE(o_closeWindow),
+ OPCODE(opp_loadHiScores),
+ OPCODE(opp_checkHiScores),
+ OPCODE(off_addBox),
+ /* 108 */
+ OPCODE(o_delBox),
+ OPCODE(o_enableBox),
+ OPCODE(o_disableBox),
+ OPCODE(o_moveBox),
+ /* 112 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_doIcons),
+ OPCODE(o_isClass),
+ /* 116 */
+ OPCODE(o_setClass),
+ OPCODE(o_unsetClass),
+ OPCODE(o_invalid),
+ OPCODE(o_waitSync),
+ /* 120 */
+ OPCODE(opp_sync),
+ OPCODE(o_defObj),
+ OPCODE(off_oracleTextDown),
+ OPCODE(off_oracleTextUp),
+ /* 124 */
+ OPCODE(off_ifTime),
+ OPCODE(o_here),
+ OPCODE(o_doClassIcons),
+ OPCODE(o_invalid),
+ /* 128 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_setAdjNoun),
+ OPCODE(off_setTime),
+ /* 132 */
+ OPCODE(opp_saveUserGame),
+ OPCODE(opp_loadUserGame),
+ OPCODE(off_listSaveGames),
+ OPCODE(o_invalid),
+ /* 136 */
+ OPCODE(o_copysf),
+ OPCODE(o_restoreIcons),
+ OPCODE(o_freezeZones),
+ OPCODE(o_placeNoIcons),
+ /* 140 */
+ OPCODE(o_clearTimers),
+ OPCODE(o_setDollar),
+ OPCODE(o_isBox),
+ OPCODE(oe2_doTable),
+ /* 144 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 148 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe2_storeItem),
+ /* 152 */
+ OPCODE(oe2_getItem),
+ OPCODE(oe2_bSet),
+ OPCODE(oe2_bClear),
+ OPCODE(oe2_bZero),
+ /* 156 */
+ OPCODE(oe2_bNotZero),
+ OPCODE(oe2_getOValue),
+ OPCODE(oe2_setOValue),
+ OPCODE(o_invalid),
+ /* 160 */
+ OPCODE(oe2_ink),
+ OPCODE(off_screenTextBox),
+ OPCODE(os1_screenTextMsg),
+ OPCODE(o_invalid),
+ /* 164 */
+ OPCODE(oe2_getDollar2),
+ OPCODE(off_isAdjNoun),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 168 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(off_hyperLinkOn),
+ /* 172 */
+ OPCODE(off_hyperLinkOff),
+ OPCODE(opp_saveOopsPosition),
+ OPCODE(o_invalid),
+ OPCODE(oww_lockZones),
+ /* 176 */
+ OPCODE(oww_unlockZones),
+ OPCODE(off_screenTextPObj),
+ OPCODE(os1_getPathPosn),
+ OPCODE(os1_scnTxtLongText),
+ /* 180 */
+ OPCODE(os1_mouseOn),
+ OPCODE(off_mouseOff),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 184 */
+ OPCODE(os1_unloadZone),
+ OPCODE(o_invalid),
+ OPCODE(os1_unfreezeZones),
+ OPCODE(opp_resetGameTime),
+ /* 188 */
+ OPCODE(os2_isShortText),
+ OPCODE(os2_clearMarks),
+ OPCODE(os2_waitMark),
+ OPCODE(opp_resetPVCount),
+ /* 192 */
+ OPCODE(opp_setPathValues),
+ OPCODE(off_stopClock),
+ OPCODE(opp_restartClock),
+ OPCODE(off_setColour),
+ };
+
+ _opcodesPuzzlePack = opcodes;
+ _numOpcodes = 196;
+}
+
+void AGOSEngine_PuzzlePack::executeOpcode(int opcode) {
+ OpcodeProcPuzzlePack op = _opcodesPuzzlePack[opcode].proc;
+ (this->*op) ();
}
// -----------------------------------------------------------------------
// Puzzle Pack Opcodes
// -----------------------------------------------------------------------
-void AGOSEngine::opp_iconifyWindow() {
+void AGOSEngine_PuzzlePack::opp_iconifyWindow() {
// 30
getNextItemPtr();
if (_clockStopped != 0)
@@ -95,7 +302,7 @@ void AGOSEngine::opp_iconifyWindow() {
_system->setFeatureState(OSystem::kFeatureIconifyWindow, true);
}
-void AGOSEngine::opp_restoreOopsPosition() {
+void AGOSEngine_PuzzlePack::opp_restoreOopsPosition() {
// 32: restore oops position
uint i;
@@ -117,14 +324,14 @@ void AGOSEngine::opp_restoreOopsPosition() {
}
}
-void AGOSEngine::opp_loadMouseImage() {
+void AGOSEngine_PuzzlePack::opp_loadMouseImage() {
// 38: load mouse image
getNextItemPtr();
getVarOrByte();
loadMouseImage();
}
-void AGOSEngine::opp_message() {
+void AGOSEngine_PuzzlePack::opp_message() {
// 63: show string nl
if (getBitFlag(105)) {
@@ -136,7 +343,7 @@ void AGOSEngine::opp_message() {
}
}
-void AGOSEngine::opp_setShortText() {
+void AGOSEngine_PuzzlePack::opp_setShortText() {
// 66: set item name
uint var = getVarOrByte();
uint stringId = getNextStringID();
@@ -147,18 +354,18 @@ void AGOSEngine::opp_setShortText() {
}
}
-void AGOSEngine::opp_loadHiScores() {
+void AGOSEngine_PuzzlePack::opp_loadHiScores() {
// 105: load high scores
getVarOrByte();
}
-void AGOSEngine::opp_checkHiScores() {
+void AGOSEngine_PuzzlePack::opp_checkHiScores() {
// 106: check high scores
getVarOrByte();
getVarOrByte();
}
-void AGOSEngine::opp_sync() {
+void AGOSEngine_PuzzlePack::opp_sync() {
// 120: sync
uint a = getVarOrWord();
if (a == 8001 || a == 8101 || a == 8201 || a == 8301 || a == 8401) {
@@ -167,7 +374,7 @@ void AGOSEngine::opp_sync() {
sendSync(a);
}
-void AGOSEngine::opp_saveUserGame() {
+void AGOSEngine_PuzzlePack::opp_saveUserGame() {
// 132: save game
if (_clockStopped != 0)
_gameTime += time(NULL) - _clockStopped;
@@ -183,7 +390,7 @@ void AGOSEngine::opp_saveUserGame() {
//saveHiScores()
}
-void AGOSEngine::opp_loadUserGame() {
+void AGOSEngine_PuzzlePack::opp_loadUserGame() {
// 133: load usergame
// NoPatience or Jumble
@@ -196,7 +403,7 @@ void AGOSEngine::opp_loadUserGame() {
loadGame(genSaveName(1));
}
-void AGOSEngine::opp_saveOopsPosition() {
+void AGOSEngine_PuzzlePack::opp_saveOopsPosition() {
// 173: save oops position
if (!isVgaQueueEmpty()) {
_oopsValid = true;
@@ -208,18 +415,18 @@ void AGOSEngine::opp_saveOopsPosition() {
}
}
-void AGOSEngine::opp_resetGameTime() {
+void AGOSEngine_PuzzlePack::opp_resetGameTime() {
// 187: reset game time
_gameTime = 0;
}
-void AGOSEngine::opp_resetPVCount() {
+void AGOSEngine_PuzzlePack::opp_resetPVCount() {
// 191
_PVCount = 0;
_GPVCount = 0;
}
-void AGOSEngine::opp_setPathValues() {
+void AGOSEngine_PuzzlePack::opp_setPathValues() {
// 192
_pathValues[_PVCount++] = getVarOrByte();
_pathValues[_PVCount++] = getVarOrByte();
@@ -227,7 +434,7 @@ void AGOSEngine::opp_setPathValues() {
_pathValues[_PVCount++] = getVarOrByte();
}
-void AGOSEngine::opp_restartClock() {
+void AGOSEngine_PuzzlePack::opp_restartClock() {
// 194: resume clock
if (_clockStopped != 0)
_gameTime += time(NULL) - _clockStopped;
diff --git a/engines/agos/script_s1.cpp b/engines/agos/script_s1.cpp
index d464833431..dd7e683147 100644
--- a/engines/agos/script_s1.cpp
+++ b/engines/agos/script_s1.cpp
@@ -33,49 +33,261 @@ extern bool isSmartphone(void);
namespace AGOS {
-void AGOSEngine_Simon1::setupOpcodes(OpcodeProc *op) {
- AGOSEngine::setupOpcodes(op);
-
- op[65] = &AGOSEngine::oww_addTextBox;
- op[66] = &AGOSEngine::oww_setShortText;
- op[67] = &AGOSEngine::oww_setLongText;
- op[70] = &AGOSEngine::oww_printLongText;
- op[83] = &AGOSEngine::oe1_rescan;
- op[88] = &AGOSEngine::o_haltAnimation;
- op[89] = &AGOSEngine::o_restartAnimation;
- op[98] = &AGOSEngine::os1_animate;
- op[99] = &AGOSEngine::oe1_stopAnimate;
- op[127] = &AGOSEngine::os1_playTune;
- op[135] = &AGOSEngine::os1_pauseGame;
- op[161] = &AGOSEngine::os1_screenTextBox;
- op[162] = &AGOSEngine::os1_screenTextMsg;
- op[163] = &AGOSEngine::os1_playEffect;
- op[164] = &AGOSEngine::oe2_getDollar2;
- op[165] = &AGOSEngine::oe2_isAdjNoun;
- op[166] = &AGOSEngine::oe2_b2Set;
- op[167] = &AGOSEngine::oe2_b2Clear;
- op[168] = &AGOSEngine::oe2_b2Zero;
- op[169] = &AGOSEngine::oe2_b2NotZero;
- op[175] = &AGOSEngine::oww_lockZones;
- op[176] = &AGOSEngine::oww_unlockZones;
- op[177] = &AGOSEngine::os1_screenTextPObj;
- op[178] = &AGOSEngine::os1_getPathPosn;
- op[179] = &AGOSEngine::os1_scnTxtLongText;
- op[180] = &AGOSEngine::os1_mouseOn;
- op[181] = &AGOSEngine::os1_mouseOff;
- op[182] = &AGOSEngine::os1_loadBeard;
- op[183] = &AGOSEngine::os1_unloadBeard;
- op[184] = &AGOSEngine::os1_unloadZone;
- op[185] = &AGOSEngine::os1_loadStrings;
- op[186] = &AGOSEngine::os1_unfreezeZones;
- op[187] = &AGOSEngine::os1_specialFade;
+#define OPCODE(x) _OPCODE(AGOSEngine_Simon1, x)
+
+void AGOSEngine_Simon1::setupOpcodes() {
+ static const OpcodeEntrySimon1 opcodes[] = {
+ /* 00 */
+ OPCODE(o_invalid),
+ OPCODE(o_at),
+ OPCODE(o_notAt),
+ OPCODE(o_invalid),
+ /* 04 */
+ OPCODE(o_invalid),
+ OPCODE(o_carried),
+ OPCODE(o_notCarried),
+ OPCODE(o_isAt),
+ /* 08 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_zero),
+ /* 12 */
+ OPCODE(o_notZero),
+ OPCODE(o_eq),
+ OPCODE(o_notEq),
+ OPCODE(o_gt),
+ /* 16 */
+ OPCODE(o_lt),
+ OPCODE(o_eqf),
+ OPCODE(o_notEqf),
+ OPCODE(o_ltf),
+ /* 20 */
+ OPCODE(o_gtf),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_chance),
+ /* 24 */
+ OPCODE(o_invalid),
+ OPCODE(o_isRoom),
+ OPCODE(o_isObject),
+ OPCODE(o_state),
+ /* 28 */
+ OPCODE(o_oflag),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_destroy),
+ /* 32 */
+ OPCODE(o_invalid),
+ OPCODE(o_place),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 36 */
+ OPCODE(o_copyff),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 40 */
+ OPCODE(o_invalid),
+ OPCODE(o_clear),
+ OPCODE(o_let),
+ OPCODE(o_add),
+ /* 44 */
+ OPCODE(o_sub),
+ OPCODE(o_addf),
+ OPCODE(o_subf),
+ OPCODE(o_mul),
+ /* 48 */
+ OPCODE(o_div),
+ OPCODE(o_mulf),
+ OPCODE(o_divf),
+ OPCODE(o_mod),
+ /* 52 */
+ OPCODE(o_modf),
+ OPCODE(o_random),
+ OPCODE(o_invalid),
+ OPCODE(o_goto),
+ /* 56 */
+ OPCODE(o_oset),
+ OPCODE(o_oclear),
+ OPCODE(o_putBy),
+ OPCODE(o_inc),
+ /* 60 */
+ OPCODE(o_dec),
+ OPCODE(o_setState),
+ OPCODE(o_print),
+ OPCODE(o_message),
+ /* 64 */
+ OPCODE(o_msg),
+ OPCODE(oww_addTextBox),
+ OPCODE(oww_setShortText),
+ OPCODE(oww_setLongText),
+ /* 68 */
+ OPCODE(o_end),
+ OPCODE(o_done),
+ OPCODE(oww_printLongText),
+ OPCODE(o_process),
+ /* 72 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 76 */
+ OPCODE(o_when),
+ OPCODE(o_if1),
+ OPCODE(o_if2),
+ OPCODE(o_isCalled),
+ /* 80 */
+ OPCODE(o_is),
+ OPCODE(o_invalid),
+ OPCODE(o_debug),
+ OPCODE(oe1_rescan),
+ /* 84 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_comment),
+ /* 88 */
+ OPCODE(o_haltAnimation),
+ OPCODE(o_restartAnimation),
+ OPCODE(o_getParent),
+ OPCODE(o_getNext),
+ /* 92 */
+ OPCODE(o_getChildren),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 96 */
+ OPCODE(o_picture),
+ OPCODE(o_loadZone),
+ OPCODE(os1_animate),
+ OPCODE(oe1_stopAnimate),
+ /* 100 */
+ OPCODE(o_killAnimate),
+ OPCODE(o_defWindow),
+ OPCODE(o_window),
+ OPCODE(o_cls),
+ /* 104 */
+ OPCODE(o_closeWindow),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_addBox),
+ /* 108 */
+ OPCODE(o_delBox),
+ OPCODE(o_enableBox),
+ OPCODE(o_disableBox),
+ OPCODE(o_moveBox),
+ /* 112 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_doIcons),
+ OPCODE(o_isClass),
+ /* 116 */
+ OPCODE(o_setClass),
+ OPCODE(o_unsetClass),
+ OPCODE(o_invalid),
+ OPCODE(o_waitSync),
+ /* 120 */
+ OPCODE(o_sync),
+ OPCODE(o_defObj),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 124 */
+ OPCODE(o_invalid),
+ OPCODE(o_here),
+ OPCODE(o_doClassIcons),
+ OPCODE(o_playTune),
+ /* 128 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_setAdjNoun),
+ OPCODE(o_invalid),
+ /* 132 */
+ OPCODE(o_saveUserGame),
+ OPCODE(o_loadUserGame),
+ OPCODE(o_invalid),
+ OPCODE(os1_pauseGame),
+ /* 136 */
+ OPCODE(o_copysf),
+ OPCODE(o_restoreIcons),
+ OPCODE(o_freezeZones),
+ OPCODE(o_placeNoIcons),
+ /* 140 */
+ OPCODE(o_clearTimers),
+ OPCODE(o_setDollar),
+ OPCODE(o_isBox),
+ OPCODE(oe2_doTable),
+ /* 144 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 148 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe2_storeItem),
+ /* 152 */
+ OPCODE(oe2_getItem),
+ OPCODE(oe2_bSet),
+ OPCODE(oe2_bClear),
+ OPCODE(oe2_bZero),
+ /* 156 */
+ OPCODE(oe2_bNotZero),
+ OPCODE(oe2_getOValue),
+ OPCODE(oe2_setOValue),
+ OPCODE(o_invalid),
+ /* 160 */
+ OPCODE(oe2_ink),
+ OPCODE(os1_screenTextBox),
+ OPCODE(os1_screenTextMsg),
+ OPCODE(os1_playEffect),
+ /* 164 */
+ OPCODE(oe2_getDollar2),
+ OPCODE(oe2_isAdjNoun),
+ OPCODE(oe2_b2Set),
+ OPCODE(oe2_b2Clear),
+ /* 168 */
+ OPCODE(oe2_b2Zero),
+ OPCODE(oe2_b2NotZero),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 172 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oww_lockZones),
+ /* 176 */
+ OPCODE(oww_unlockZones),
+ OPCODE(os1_screenTextPObj),
+ OPCODE(os1_getPathPosn),
+ OPCODE(os1_scnTxtLongText),
+ /* 180 */
+ OPCODE(os1_mouseOn),
+ OPCODE(os1_mouseOff),
+ OPCODE(os1_loadBeard),
+ OPCODE(os1_unloadBeard),
+ /* 184 */
+ OPCODE(os1_unloadZone),
+ OPCODE(os1_loadStrings),
+ OPCODE(os1_unfreezeZones),
+ OPCODE(os1_specialFade),
+ };
+
+ _opcodesSimon1 = opcodes;
+ _numOpcodes = 188;
+}
+
+void AGOSEngine_Simon1::executeOpcode(int opcode) {
+ OpcodeProcSimon1 op = _opcodesSimon1[opcode].proc;
+ (this->*op) ();
}
// -----------------------------------------------------------------------
// Simon 1 Opcodes
// -----------------------------------------------------------------------
-void AGOSEngine::os1_animate() {
+void AGOSEngine_Simon1::os1_animate() {
// 98: animate
uint vgaSpriteId = getVarOrWord();
uint windowNum = getVarOrByte();
@@ -92,19 +304,7 @@ void AGOSEngine::os1_animate() {
_lockWord &= ~0x40;
}
-void AGOSEngine::os1_playTune() {
- // 127: play tune
- int music = getVarOrWord();
- int track = getVarOrWord();
-
- if (music != _lastMusicPlayed) {
- _lastMusicPlayed = music;
- loadMusic(music);
- _midi.startTrack(track);
- }
-}
-
-void AGOSEngine::os1_pauseGame() {
+void AGOSEngine_Simon1::os1_pauseGame() {
// 135: pause game
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true);
@@ -158,7 +358,7 @@ void AGOSEngine::os1_pauseGame() {
_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
}
-void AGOSEngine::os1_screenTextBox() {
+void AGOSEngine_Simon1::os1_screenTextBox() {
// 161: setup text
TextLocation *tl = getTextLocation(getVarOrByte());
@@ -167,7 +367,7 @@ void AGOSEngine::os1_screenTextBox() {
tl->width = getVarOrWord();
}
-void AGOSEngine::os1_screenTextMsg() {
+void AGOSEngine_Simon1::os1_screenTextMsg() {
// 162: print string
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@@ -202,7 +402,7 @@ void AGOSEngine::os1_screenTextMsg() {
}
-void AGOSEngine::os1_playEffect() {
+void AGOSEngine_Simon1::os1_playEffect() {
// 163: play sound
uint soundId = getVarOrWord();
@@ -212,7 +412,7 @@ void AGOSEngine::os1_playEffect() {
_sound->playEffects(soundId);
}
-void AGOSEngine::os1_screenTextPObj() {
+void AGOSEngine_Simon1::os1_screenTextPObj() {
// 177: inventory descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@@ -253,7 +453,7 @@ void AGOSEngine::os1_screenTextPObj() {
}
}
-void AGOSEngine::os1_getPathPosn() {
+void AGOSEngine_Simon1::os1_getPathPosn() {
// 178: path find
uint x = getVarOrWord();
uint y = getVarOrWord();
@@ -302,7 +502,7 @@ void AGOSEngine::os1_getPathPosn() {
writeVariable(var_2, best_j);
}
-void AGOSEngine::os1_scnTxtLongText() {
+void AGOSEngine_Simon1::os1_scnTxtLongText() {
// 179: conversation responses and room descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@@ -324,17 +524,17 @@ void AGOSEngine::os1_scnTxtLongText() {
printScreenText(vgaSpriteId, color, string_ptr, tl->x, tl->y, tl->width);
}
-void AGOSEngine::os1_mouseOn() {
+void AGOSEngine_Simon1::os1_mouseOn() {
// 180: force mouseOn
_mouseHideCount = 0;
}
-void AGOSEngine::os1_mouseOff() {
+void AGOSEngine_Simon1::os1_mouseOff() {
// 181: force mouseOff
scriptMouseOff();
}
-void AGOSEngine::os1_loadBeard() {
+void AGOSEngine_Simon1::os1_loadBeard() {
// 182: load beard
if (_beardLoaded == false) {
_beardLoaded = true;
@@ -344,7 +544,7 @@ void AGOSEngine::os1_loadBeard() {
}
}
-void AGOSEngine::os1_unloadBeard() {
+void AGOSEngine_Simon1::os1_unloadBeard() {
// 183: unload beard
if (_beardLoaded == true) {
_beardLoaded = false;
@@ -354,7 +554,7 @@ void AGOSEngine::os1_unloadBeard() {
}
}
-void AGOSEngine::os1_unloadZone() {
+void AGOSEngine_Simon1::os1_unloadZone() {
// 184: unload zone
uint a = getVarOrWord();
VgaPointersEntry *vpe = &_vgaBufferPointers[a];
@@ -364,7 +564,7 @@ void AGOSEngine::os1_unloadZone() {
vpe->vgaFile2 = NULL;
}
-void AGOSEngine::os1_loadStrings() {
+void AGOSEngine_Simon1::os1_loadStrings() {
// 185: load sound files
_soundFileId = getVarOrWord();
if (getPlatform() == Common::kPlatformAmiga && getFeatures() & GF_TALKIE) {
@@ -376,12 +576,12 @@ void AGOSEngine::os1_loadStrings() {
}
}
-void AGOSEngine::os1_unfreezeZones() {
+void AGOSEngine_Simon1::os1_unfreezeZones() {
// 186: freeze zone
unfreezeBottom();
}
-void AGOSEngine::os1_specialFade() {
+void AGOSEngine_Simon1::os1_specialFade() {
// 187: fade to black
uint i;
diff --git a/engines/agos/script_s2.cpp b/engines/agos/script_s2.cpp
index ea2ef5d1bb..100da239bb 100644
--- a/engines/agos/script_s2.cpp
+++ b/engines/agos/script_s2.cpp
@@ -27,55 +27,272 @@
namespace AGOS {
-void AGOSEngine_Simon2::setupOpcodes(OpcodeProc *op) {
- AGOSEngine::setupOpcodes(op);
-
- op[65] = &AGOSEngine::oww_addTextBox;
- op[66] = &AGOSEngine::oww_setShortText;
- op[67] = &AGOSEngine::oww_setLongText;
- op[70] = &AGOSEngine::os2_printLongText;
- op[83] = &AGOSEngine::os2_rescan;
- op[88] = &AGOSEngine::o_haltAnimation;
- op[89] = &AGOSEngine::o_restartAnimation;
- op[98] = &AGOSEngine::os2_animate;
- op[99] = &AGOSEngine::os2_stopAnimate;
- op[127] = &AGOSEngine::os2_playTune;
- op[135] = &AGOSEngine::os1_pauseGame;
- op[161] = &AGOSEngine::os1_screenTextBox;
- op[162] = &AGOSEngine::os1_screenTextMsg;
- op[163] = &AGOSEngine::os1_playEffect;
- op[164] = &AGOSEngine::oe2_getDollar2;
- op[165] = &AGOSEngine::oe2_isAdjNoun;
- op[166] = &AGOSEngine::oe2_b2Set;
- op[167] = &AGOSEngine::oe2_b2Clear;
- op[168] = &AGOSEngine::oe2_b2Zero;
- op[169] = &AGOSEngine::oe2_b2NotZero;
- op[175] = &AGOSEngine::oww_lockZones;
- op[176] = &AGOSEngine::oww_unlockZones;
- op[177] = &AGOSEngine::os2_screenTextPObj;
- op[178] = &AGOSEngine::os1_getPathPosn;
- op[179] = &AGOSEngine::os1_scnTxtLongText;
- op[180] = &AGOSEngine::os2_mouseOn;
- op[181] = &AGOSEngine::os2_mouseOff;
- op[184] = &AGOSEngine::os1_unloadZone;
- op[186] = &AGOSEngine::os1_unfreezeZones;
- op[188] = &AGOSEngine::os2_isShortText;
- op[189] = &AGOSEngine::os2_clearMarks;
- op[190] = &AGOSEngine::os2_waitMark;
+#define OPCODE(x) _OPCODE(AGOSEngine_Simon2, x)
+
+void AGOSEngine_Simon2::setupOpcodes() {
+ static const OpcodeEntrySimon2 opcodes[] = {
+ /* 00 */
+ OPCODE(o_invalid),
+ OPCODE(o_at),
+ OPCODE(o_notAt),
+ OPCODE(o_invalid),
+ /* 04 */
+ OPCODE(o_invalid),
+ OPCODE(o_carried),
+ OPCODE(o_notCarried),
+ OPCODE(o_isAt),
+ /* 08 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_zero),
+ /* 12 */
+ OPCODE(o_notZero),
+ OPCODE(o_eq),
+ OPCODE(o_notEq),
+ OPCODE(o_gt),
+ /* 16 */
+ OPCODE(o_lt),
+ OPCODE(o_eqf),
+ OPCODE(o_notEqf),
+ OPCODE(o_ltf),
+ /* 20 */
+ OPCODE(o_gtf),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_chance),
+ /* 24 */
+ OPCODE(o_invalid),
+ OPCODE(o_isRoom),
+ OPCODE(o_isObject),
+ OPCODE(o_state),
+ /* 28 */
+ OPCODE(o_oflag),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_destroy),
+ /* 32 */
+ OPCODE(o_invalid),
+ OPCODE(o_place),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 36 */
+ OPCODE(o_copyff),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 40 */
+ OPCODE(o_invalid),
+ OPCODE(o_clear),
+ OPCODE(o_let),
+ OPCODE(o_add),
+ /* 44 */
+ OPCODE(o_sub),
+ OPCODE(o_addf),
+ OPCODE(o_subf),
+ OPCODE(o_mul),
+ /* 48 */
+ OPCODE(o_div),
+ OPCODE(o_mulf),
+ OPCODE(o_divf),
+ OPCODE(o_mod),
+ /* 52 */
+ OPCODE(o_modf),
+ OPCODE(o_random),
+ OPCODE(o_invalid),
+ OPCODE(o_goto),
+ /* 56 */
+ OPCODE(o_oset),
+ OPCODE(o_oclear),
+ OPCODE(o_putBy),
+ OPCODE(o_inc),
+ /* 60 */
+ OPCODE(o_dec),
+ OPCODE(o_setState),
+ OPCODE(o_print),
+ OPCODE(o_message),
+ /* 64 */
+ OPCODE(o_msg),
+ OPCODE(oww_addTextBox),
+ OPCODE(oww_setShortText),
+ OPCODE(oww_setLongText),
+ /* 68 */
+ OPCODE(o_end),
+ OPCODE(o_done),
+ OPCODE(os2_printLongText),
+ OPCODE(o_process),
+ /* 72 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 76 */
+ OPCODE(o_when),
+ OPCODE(o_if1),
+ OPCODE(o_if2),
+ OPCODE(o_isCalled),
+ /* 80 */
+ OPCODE(o_is),
+ OPCODE(o_invalid),
+ OPCODE(o_debug),
+ OPCODE(os2_rescan),
+ /* 84 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_comment),
+ /* 88 */
+ OPCODE(o_haltAnimation),
+ OPCODE(o_restartAnimation),
+ OPCODE(o_getParent),
+ OPCODE(o_getNext),
+ /* 92 */
+ OPCODE(o_getChildren),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 96 */
+ OPCODE(o_picture),
+ OPCODE(o_loadZone),
+ OPCODE(os2_animate),
+ OPCODE(os2_stopAnimate),
+ /* 100 */
+ OPCODE(o_killAnimate),
+ OPCODE(o_defWindow),
+ OPCODE(o_window),
+ OPCODE(o_cls),
+ /* 104 */
+ OPCODE(o_closeWindow),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_addBox),
+ /* 108 */
+ OPCODE(o_delBox),
+ OPCODE(o_enableBox),
+ OPCODE(o_disableBox),
+ OPCODE(o_moveBox),
+ /* 112 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_doIcons),
+ OPCODE(o_isClass),
+ /* 116 */
+ OPCODE(o_setClass),
+ OPCODE(o_unsetClass),
+ OPCODE(o_invalid),
+ OPCODE(o_waitSync),
+ /* 120 */
+ OPCODE(o_sync),
+ OPCODE(o_defObj),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 124 */
+ OPCODE(o_invalid),
+ OPCODE(o_here),
+ OPCODE(o_doClassIcons),
+ OPCODE(os2_playTune),
+ /* 128 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_setAdjNoun),
+ OPCODE(o_invalid),
+ /* 132 */
+ OPCODE(o_saveUserGame),
+ OPCODE(o_loadUserGame),
+ OPCODE(o_invalid),
+ OPCODE(os1_pauseGame),
+ /* 136 */
+ OPCODE(o_copysf),
+ OPCODE(o_restoreIcons),
+ OPCODE(o_freezeZones),
+ OPCODE(o_placeNoIcons),
+ /* 140 */
+ OPCODE(o_clearTimers),
+ OPCODE(o_setDollar),
+ OPCODE(o_isBox),
+ OPCODE(oe2_doTable),
+ /* 144 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 148 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe2_storeItem),
+ /* 152 */
+ OPCODE(oe2_getItem),
+ OPCODE(oe2_bSet),
+ OPCODE(oe2_bClear),
+ OPCODE(oe2_bZero),
+ /* 156C */
+ OPCODE(oe2_bNotZero),
+ OPCODE(oe2_getOValue),
+ OPCODE(oe2_setOValue),
+ OPCODE(o_invalid),
+ /* 160 */
+ OPCODE(oe2_ink),
+ OPCODE(os1_screenTextBox),
+ OPCODE(os1_screenTextMsg),
+ OPCODE(os1_playEffect),
+ /* 164 */
+ OPCODE(oe2_getDollar2),
+ OPCODE(oe2_isAdjNoun),
+ OPCODE(oe2_b2Set),
+ OPCODE(oe2_b2Clear),
+ /* 168 */
+ OPCODE(oe2_b2Zero),
+ OPCODE(oe2_b2NotZero),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 172 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oww_lockZones),
+ /* 176 */
+ OPCODE(oww_unlockZones),
+ OPCODE(os2_screenTextPObj),
+ OPCODE(os1_getPathPosn),
+ OPCODE(os1_scnTxtLongText),
+ /* 180 */
+ OPCODE(os2_mouseOn),
+ OPCODE(os2_mouseOff),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 184 */
+ OPCODE(os1_unloadZone),
+ OPCODE(o_invalid),
+ OPCODE(os1_unfreezeZones),
+ OPCODE(o_invalid),
+ /* 188 */
+ OPCODE(os2_isShortText),
+ OPCODE(os2_clearMarks),
+ OPCODE(os2_waitMark),
+ };
+
+ _opcodesSimon2 = opcodes;
+ _numOpcodes = 191;
+}
+
+void AGOSEngine_Simon2::executeOpcode(int opcode) {
+ OpcodeProcSimon2 op = _opcodesSimon2[opcode].proc;
+ (this->*op) ();
}
// -----------------------------------------------------------------------
// Simon 2 Opcodes
// -----------------------------------------------------------------------
-void AGOSEngine::os2_printLongText() {
+void AGOSEngine_Simon2::os2_printLongText() {
// 70: show string from array
const char *str = (const char *)getStringPtrByID(_longText[getVarOrByte()]);
writeVariable(51, strlen(str) / 53 * 8 + 8);
showMessageFormat("%s\n", str);
}
-void AGOSEngine::os2_rescan() {
+void AGOSEngine_Simon2::os2_rescan() {
// 83: restart subroutine
if (_exitCutscene) {
if (getBitFlag(9)) {
@@ -88,7 +305,7 @@ void AGOSEngine::os2_rescan() {
setScriptReturn(-10);
}
-void AGOSEngine::os2_animate() {
+void AGOSEngine_Simon2::os2_animate() {
// 98: start vga
uint zoneNum = getVarOrWord();
uint vgaSpriteId = getVarOrWord();
@@ -102,14 +319,14 @@ void AGOSEngine::os2_animate() {
_lockWord &= ~0x40;
}
-void AGOSEngine::os2_stopAnimate() {
+void AGOSEngine_Simon2::os2_stopAnimate() {
// 99: kill sprite
uint a = getVarOrWord();
uint b = getVarOrWord();
stopAnimateSimon2(a, b);
}
-void AGOSEngine::os2_playTune() {
+void AGOSEngine_Simon2::os2_playTune() {
// 127: deals with music
int music = getVarOrWord();
int track = getVarOrWord();
@@ -131,7 +348,7 @@ void AGOSEngine::os2_playTune() {
_midi.startTrack(track);
}
-void AGOSEngine::os2_screenTextPObj() {
+void AGOSEngine_Simon2::os2_screenTextPObj() {
// 177: inventory descriptions
uint vgaSpriteId = getVarOrByte();
uint color = getVarOrByte();
@@ -216,7 +433,7 @@ void AGOSEngine::os2_screenTextPObj() {
}
}
-void AGOSEngine::os2_mouseOn() {
+void AGOSEngine_Simon2::os2_mouseOn() {
// 180: force mouseOn
if (getGameType() == GType_SIMON2 && getBitFlag(79)) {
_mouseCursor = 0;
@@ -224,26 +441,26 @@ void AGOSEngine::os2_mouseOn() {
_mouseHideCount = 0;
}
-void AGOSEngine::os2_mouseOff() {
+void AGOSEngine_Simon2::os2_mouseOff() {
// 181: force mouseOff
scriptMouseOff();
changeWindow(1);
showMessageFormat("\xC");
}
-void AGOSEngine::os2_isShortText() {
+void AGOSEngine_Simon2::os2_isShortText() {
// 188: string2 is
uint i = getVarOrByte();
uint str = getNextStringID();
setScriptCondition(str < _numTextBoxes && _shortText[i] == str);
}
-void AGOSEngine::os2_clearMarks() {
+void AGOSEngine_Simon2::os2_clearMarks() {
// 189: clear_op189_flag
_marks = 0;
}
-void AGOSEngine::os2_waitMark() {
+void AGOSEngine_Simon2::os2_waitMark() {
// 190
uint i = getVarOrByte();
if (!(_marks & (1 << i)))
diff --git a/engines/agos/script_ww.cpp b/engines/agos/script_ww.cpp
index 398530cd47..9a8e62de92 100644
--- a/engines/agos/script_ww.cpp
+++ b/engines/agos/script_ww.cpp
@@ -29,70 +29,271 @@
namespace AGOS {
-void AGOSEngine_Waxworks::setupOpcodes(OpcodeProc *op) {
- AGOSEngine::setupOpcodes(op);
-
- op[8] = &AGOSEngine::oe1_isNotAt;
- op[9] = &AGOSEngine::oe1_sibling;
- op[10] = &AGOSEngine::oe1_notSibling;
- op[21] = &AGOSEngine::oe1_isIn;
- op[22] = &AGOSEngine::oe1_isNotIn;
- op[24] = &AGOSEngine::oe1_isPlayer;
- op[29] = &AGOSEngine::oe1_canPut;
- op[34] = &AGOSEngine::oe1_copyof;
- op[37] = &AGOSEngine::oe1_whatO;
- op[35] = &AGOSEngine::oe1_copyfo;
- op[39] = &AGOSEngine::oe1_weigh;
- op[54] = &AGOSEngine::oww_moveDirn;
- op[55] = &AGOSEngine::oww_goto;
- op[65] = &AGOSEngine::oww_addTextBox;
- op[66] = &AGOSEngine::oww_setShortText;
- op[67] = &AGOSEngine::oww_setLongText;
- op[70] = &AGOSEngine::oww_printLongText;
- op[83] = &AGOSEngine::oe1_rescan;
- op[85] = &AGOSEngine::oww_whereTo;
- op[89] = &AGOSEngine::oe2_loadGame;
- op[94] = &AGOSEngine::oe1_findMaster;
- op[95] = &AGOSEngine::oe1_nextMaster;
- op[98] = &AGOSEngine::oe1_animate;
- op[99] = &AGOSEngine::oe1_stopAnimate;
- op[105] = &AGOSEngine::oww_menu;
- op[106] = &AGOSEngine::oww_textMenu;
- op[127] = &AGOSEngine::os1_playTune;
- op[135] = &AGOSEngine::oww_pauseGame;
- op[144] = &AGOSEngine::oe2_setDoorOpen;
- op[145] = &AGOSEngine::oe2_setDoorClosed;
- op[146] = &AGOSEngine::oe2_setDoorLocked;
- op[147] = &AGOSEngine::oe2_setDoorClosed;
- op[148] = &AGOSEngine::oe2_ifDoorOpen;
- op[149] = &AGOSEngine::oe2_ifDoorClosed;
- op[150] = &AGOSEngine::oe2_ifDoorLocked;
- op[175] = &AGOSEngine::oe2_getDollar2;
- op[179] = &AGOSEngine::oe2_isAdjNoun;
- op[180] = &AGOSEngine::oe2_b2Set;
- op[181] = &AGOSEngine::oe2_b2Clear;
- op[182] = &AGOSEngine::oe2_b2Zero;
- op[183] = &AGOSEngine::oe2_b2NotZero;
- op[184] = &AGOSEngine::oww_boxMessage;
- op[185] = &AGOSEngine::oww_boxMsg;
- op[186] = &AGOSEngine::oww_boxLongText;
- op[187] = &AGOSEngine::oww_printBox;
- op[188] = &AGOSEngine::oww_boxPObj;
- op[189] = &AGOSEngine::oww_lockZones;
- op[190] = &AGOSEngine::oww_unlockZones;
+#define OPCODE(x) _OPCODE(AGOSEngine_Waxworks, x)
+
+void AGOSEngine_Waxworks::setupOpcodes() {
+ static const OpcodeEntryWaxworks opcodes[] = {
+ /* 00 */
+ OPCODE(o_invalid),
+ OPCODE(o_at),
+ OPCODE(o_notAt),
+ OPCODE(o_invalid),
+ /* 04 */
+ OPCODE(o_invalid),
+ OPCODE(o_carried),
+ OPCODE(o_notCarried),
+ OPCODE(o_isAt),
+ /* 08 */
+ OPCODE(oe1_isNotAt),
+ OPCODE(oe1_sibling),
+ OPCODE(oe1_notSibling),
+ OPCODE(o_zero),
+ /* 12 */
+ OPCODE(o_notZero),
+ OPCODE(o_eq),
+ OPCODE(o_notEq),
+ OPCODE(o_gt),
+ /* 16 */
+ OPCODE(o_lt),
+ OPCODE(o_eqf),
+ OPCODE(o_notEqf),
+ OPCODE(o_ltf),
+ /* 20 */
+ OPCODE(o_gtf),
+ OPCODE(oe1_isIn),
+ OPCODE(oe1_isNotIn),
+ OPCODE(o_chance),
+ /* 24 */
+ OPCODE(oe1_isPlayer),
+ OPCODE(o_isRoom),
+ OPCODE(o_isObject),
+ OPCODE(o_state),
+ /* 28 */
+ OPCODE(o_oflag),
+ OPCODE(oe1_canPut),
+ OPCODE(o_invalid),
+ OPCODE(o_destroy),
+ /* 32 */
+ OPCODE(o_invalid),
+ OPCODE(o_place),
+ OPCODE(oe1_copyof),
+ OPCODE(oe1_copyfo),
+ /* 36 */
+ OPCODE(o_copyff),
+ OPCODE(oe1_whatO),
+ OPCODE(o_invalid),
+ OPCODE(oe1_weigh),
+ /* 40 */
+ OPCODE(o_invalid),
+ OPCODE(o_clear),
+ OPCODE(o_let),
+ OPCODE(o_add),
+ /* 44 */
+ OPCODE(o_sub),
+ OPCODE(o_addf),
+ OPCODE(o_subf),
+ OPCODE(o_mul),
+ /* 48 */
+ OPCODE(o_div),
+ OPCODE(o_mulf),
+ OPCODE(o_divf),
+ OPCODE(o_mod),
+ /* 52 */
+ OPCODE(o_modf),
+ OPCODE(o_random),
+ OPCODE(oww_moveDirn),
+ OPCODE(oww_goto),
+ /* 56 */
+ OPCODE(o_oset),
+ OPCODE(o_oclear),
+ OPCODE(o_putBy),
+ OPCODE(o_inc),
+ /* 60 */
+ OPCODE(o_dec),
+ OPCODE(o_setState),
+ OPCODE(o_print),
+ OPCODE(o_message),
+ /* 64 */
+ OPCODE(o_msg),
+ OPCODE(oww_addTextBox),
+ OPCODE(oww_setShortText),
+ OPCODE(oww_setLongText),
+ /* 68 */
+ OPCODE(o_end),
+ OPCODE(o_done),
+ OPCODE(o_invalid),
+ OPCODE(o_process),
+ /* 72 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 76 */
+ OPCODE(o_when),
+ OPCODE(o_if1),
+ OPCODE(o_if2),
+ OPCODE(o_isCalled),
+ /* 80 */
+ OPCODE(o_is),
+ OPCODE(o_invalid),
+ OPCODE(o_debug),
+ OPCODE(oe1_rescan),
+ /* 84 */
+ OPCODE(o_invalid),
+ OPCODE(oww_whereTo),
+ OPCODE(o_invalid),
+ OPCODE(o_comment),
+ /* 88 */
+ OPCODE(o_invalid),
+ OPCODE(oe2_loadGame),
+ OPCODE(o_getParent),
+ OPCODE(o_getNext),
+ /* 92 */
+ OPCODE(o_getChildren),
+ OPCODE(o_invalid),
+ OPCODE(oe1_findMaster),
+ OPCODE(oe1_nextMaster),
+ /* 96 */
+ OPCODE(o_picture),
+ OPCODE(o_loadZone),
+ OPCODE(oe1_animate),
+ OPCODE(oe1_stopAnimate),
+ /* 100 */
+ OPCODE(o_killAnimate),
+ OPCODE(o_defWindow),
+ OPCODE(o_window),
+ OPCODE(o_cls),
+ /* 104 */
+ OPCODE(o_closeWindow),
+ OPCODE(oww_menu),
+ OPCODE(oww_textMenu),
+ OPCODE(o_addBox),
+ /* 108 */
+ OPCODE(o_delBox),
+ OPCODE(o_enableBox),
+ OPCODE(o_disableBox),
+ OPCODE(o_moveBox),
+ /* 112 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_doIcons),
+ OPCODE(o_isClass),
+ /* 116 */
+ OPCODE(o_setClass),
+ OPCODE(o_unsetClass),
+ OPCODE(o_invalid),
+ OPCODE(o_waitSync),
+ /* 120 */
+ OPCODE(o_sync),
+ OPCODE(o_defObj),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 124 */
+ OPCODE(o_invalid),
+ OPCODE(o_here),
+ OPCODE(o_doClassIcons),
+ OPCODE(o_playTune),
+ /* 128 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_setAdjNoun),
+ OPCODE(o_invalid),
+ /* 132 */
+ OPCODE(o_saveUserGame),
+ OPCODE(o_loadUserGame),
+ OPCODE(o_invalid),
+ OPCODE(oww_pauseGame),
+ /* 136 */
+ OPCODE(o_copysf),
+ OPCODE(o_restoreIcons),
+ OPCODE(o_freezeZones),
+ OPCODE(o_placeNoIcons),
+ /* 140 */
+ OPCODE(o_clearTimers),
+ OPCODE(o_setDollar),
+ OPCODE(o_isBox),
+ OPCODE(oe2_doTable),
+ /* 144 */
+ OPCODE(oe2_setDoorOpen),
+ OPCODE(oe2_setDoorClosed),
+ OPCODE(oe2_setDoorLocked),
+ OPCODE(oe2_setDoorClosed),
+ /* 148 */
+ OPCODE(oe2_ifDoorOpen),
+ OPCODE(oe2_ifDoorClosed),
+ OPCODE(oe2_ifDoorLocked),
+ OPCODE(oe2_storeItem),
+ /* 152 */
+ OPCODE(oe2_getItem),
+ OPCODE(oe2_bSet),
+ OPCODE(oe2_bClear),
+ OPCODE(oe2_bZero),
+ /* 156 */
+ OPCODE(oe2_bNotZero),
+ OPCODE(oe2_getOValue),
+ OPCODE(oe2_setOValue),
+ OPCODE(o_invalid),
+ /* 160 */
+ OPCODE(oe2_ink),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 164 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 168 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ /* 172 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe2_getDollar2),
+ /* 176 */
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(o_invalid),
+ OPCODE(oe2_isAdjNoun),
+ /* 180 */
+ OPCODE(oe2_b2Set),
+ OPCODE(oe2_b2Clear),
+ OPCODE(oe2_b2Zero),
+ OPCODE(oe2_b2NotZero),
+ /* 184 */
+ OPCODE(oww_boxMessage),
+ OPCODE(oww_boxMsg),
+ OPCODE(oww_boxLongText),
+ OPCODE(oww_printBox),
+ /* 188 */
+ OPCODE(oww_boxPObj),
+ OPCODE(oww_lockZones),
+ OPCODE(oww_unlockZones),
+ };
+
+ _opcodesWaxworks = opcodes;
+ _numOpcodes = 191;
+}
+
+void AGOSEngine_Waxworks::executeOpcode(int opcode) {
+ OpcodeProcWaxworks op = _opcodesWaxworks[opcode].proc;
+ (this->*op) ();
}
// -----------------------------------------------------------------------
// Waxworks Opcodes
// -----------------------------------------------------------------------
-void AGOSEngine::oww_moveDirn() {
+void AGOSEngine_Waxworks::oww_moveDirn() {
// 54: move direction
int16 d = getVarOrByte();
moveDirn_ww(me(), d);
}
-void AGOSEngine::oww_goto() {
+void AGOSEngine_Waxworks::oww_goto() {
// 55: set itemA parent
uint item = getNextItemID();
if (derefItem(item) == NULL) {
@@ -102,7 +303,7 @@ void AGOSEngine::oww_goto() {
setItemParent(me(), derefItem(item));
}
-void AGOSEngine::oww_addTextBox() {
+void AGOSEngine_Waxworks::oww_addTextBox() {
// 65: add hit area
uint id = getVarOrWord();
uint x = getVarOrWord();
@@ -114,7 +315,7 @@ void AGOSEngine::oww_addTextBox() {
defineBox(id, x, y, w, h, (number << 8) + 129, 208, _dummyItem2);
}
-void AGOSEngine::oww_setShortText() {
+void AGOSEngine_Waxworks::oww_setShortText() {
// 66: set item name
uint var = getVarOrByte();
uint stringId = getNextStringID();
@@ -123,7 +324,7 @@ void AGOSEngine::oww_setShortText() {
}
}
-void AGOSEngine::oww_setLongText() {
+void AGOSEngine_Waxworks::oww_setLongText() {
// 67: set item description
uint var = getVarOrByte();
uint stringId = getNextStringID();
@@ -140,13 +341,13 @@ void AGOSEngine::oww_setLongText() {
}
}
-void AGOSEngine::oww_printLongText() {
+void AGOSEngine_Waxworks::oww_printLongText() {
// 70: show string from array
const char *str = (const char *)getStringPtrByID(_longText[getVarOrByte()]);
showMessageFormat("%s\n", str);
}
-void AGOSEngine::oww_whereTo() {
+void AGOSEngine_Waxworks::oww_whereTo() {
// 85: where to
Item *i = getNextItemPtr();
int16 d = getVarOrByte();
@@ -158,18 +359,18 @@ void AGOSEngine::oww_whereTo() {
_objectItem = derefItem(getExitOf(i, d));
}
-void AGOSEngine::oww_menu() {
+void AGOSEngine_Waxworks::oww_menu() {
// 105: set agos menu
_agosMenu = getVarOrByte();
}
-void AGOSEngine::oww_textMenu() {
+void AGOSEngine_Waxworks::oww_textMenu() {
// 106: set text menu
byte slot = getVarOrByte();
_textMenu[slot] = getVarOrByte();
}
-void AGOSEngine::oww_pauseGame() {
+void AGOSEngine_Waxworks::oww_pauseGame() {
// 135: pause game
HitArea *ha;
@@ -200,27 +401,27 @@ void AGOSEngine::oww_pauseGame() {
_gameStoppedClock = time(NULL) - pauseTime + _gameStoppedClock;
}
-void AGOSEngine::oww_boxMessage() {
+void AGOSEngine_Waxworks::oww_boxMessage() {
// 184: print message to box
boxTextMessage((const char *)getStringPtrByID(getNextStringID()));
}
-void AGOSEngine::oww_boxMsg() {
+void AGOSEngine_Waxworks::oww_boxMsg() {
// 185: print msg to box
boxTextMsg((const char *)getStringPtrByID(getNextStringID()));
}
-void AGOSEngine::oww_boxLongText() {
+void AGOSEngine_Waxworks::oww_boxLongText() {
// 186: print long text to box
boxTextMsg((const char *)getStringPtrByID(_longText[getVarOrByte()]));
}
-void AGOSEngine::oww_printBox() {
+void AGOSEngine_Waxworks::oww_printBox() {
// 187: print box
printBox();
}
-void AGOSEngine::oww_boxPObj() {
+void AGOSEngine_Waxworks::oww_boxPObj() {
// 188: print object name to box
SubObject *subObject = (SubObject *)findChildOfType(getNextItemPtr(), 2);
@@ -228,12 +429,12 @@ void AGOSEngine::oww_boxPObj() {
boxTextMsg((const char *)getStringPtrByID(subObject->objectFlagValue[0]));
}
-void AGOSEngine::oww_lockZones() {
+void AGOSEngine_Waxworks::oww_lockZones() {
// 189: lock zone
_vgaMemBase = _vgaMemPtr;
}
-void AGOSEngine::oww_unlockZones() {
+void AGOSEngine_Waxworks::oww_unlockZones() {
// 190: unlock zone
_vgaMemPtr = _vgaFrozenBase;
_vgaMemBase = _vgaFrozenBase;