aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/inter_v5.cpp
diff options
context:
space:
mode:
authorSven Hesse2009-06-17 04:16:21 +0000
committerSven Hesse2009-06-17 04:16:21 +0000
commit8615c5779184d1715b1eefa6cc5477ce7c7eebaf (patch)
tree138086d438a4a0ab05ffec479506408f66d223b5 /engines/gob/inter_v5.cpp
parent25c92dfdef52d6e6ebbd16e6ba8966272246fb45 (diff)
downloadscummvm-rg350-8615c5779184d1715b1eefa6cc5477ce7c7eebaf.tar.gz
scummvm-rg350-8615c5779184d1715b1eefa6cc5477ce7c7eebaf.tar.bz2
scummvm-rg350-8615c5779184d1715b1eefa6cc5477ce7c7eebaf.zip
Changed opcodeFunc to be functor-based
svn-id: r41602
Diffstat (limited to 'engines/gob/inter_v5.cpp')
-rw-r--r--engines/gob/inter_v5.cpp142
1 files changed, 9 insertions, 133 deletions
diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp
index f83e8dd292..426cef9b92 100644
--- a/engines/gob/inter_v5.cpp
+++ b/engines/gob/inter_v5.cpp
@@ -36,7 +36,9 @@
namespace Gob {
#define OPCODE(x) _OPCODE(Inter_v5, x)
-#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(Inter_v5, x)
+#define OPCODEVER Inter_v5
+#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
+#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
const int Inter_v5::_goblinFuncLookUp[][2] = {
{0, 0},
@@ -80,110 +82,13 @@ void Inter_v5::setupOpcodesDraw() {
OPCODEDRAW(0x80, o5_initScreen);
}
-void Inter_v5::setupOpcodes() {
- static const OpcodeFuncEntryV5 opcodesFunc[80] = {
- /* 00 */
- OPCODE(o1_callSub),
- OPCODE(o1_callSub),
- OPCODE(o1_printTotText),
- OPCODE(o1_loadCursor),
- /* 04 */
- {0, ""},
- OPCODE(o1_switch),
- OPCODE(o1_repeatUntil),
- OPCODE(o1_whileDo),
- /* 08 */
- OPCODE(o1_if),
- OPCODE(o2_assign),
- OPCODE(o1_loadSpriteToPos),
- {0, ""},
- /* 0C */
- {0, ""},
- {0, ""},
- {0, ""},
- {0, ""},
- /* 10 */
- {0, ""},
- OPCODE(o2_printText),
- OPCODE(o1_loadTot),
- OPCODE(o1_palLoad),
- /* 14 */
- OPCODE(o1_keyFunc),
- OPCODE(o1_capturePush),
- OPCODE(o1_capturePop),
- OPCODE(o2_animPalInit),
- /* 18 */
- OPCODE(o2_addCollision),
- OPCODE(o2_freeCollision),
- OPCODE(o3_getTotTextItemPart),
- {0, ""},
- /* 1C */
- {0, ""},
- {0, ""},
- OPCODE(o1_drawOperations),
- OPCODE(o1_setcmdCount),
- /* 20 */
- OPCODE(o1_return),
- OPCODE(o1_renewTimeInVars),
- OPCODE(o1_speakerOn),
- OPCODE(o1_speakerOff),
- /* 24 */
- OPCODE(o1_putPixel),
- OPCODE(o2_goblinFunc),
- OPCODE(o1_createSprite),
- OPCODE(o1_freeSprite),
- /* 28 */
- {0, ""},
- {0, ""},
- {0, ""},
- {0, ""},
- /* 2C */
- {0, ""},
- {0, ""},
- {0, ""},
- {0, ""},
- /* 30 */
- OPCODE(o1_returnTo),
- OPCODE(o1_loadSpriteContent),
- OPCODE(o1_copySprite),
- OPCODE(o1_fillRect),
- /* 34 */
- OPCODE(o1_drawLine),
- OPCODE(o1_strToLong),
- OPCODE(o1_invalidate),
- OPCODE(o1_setBackDelta),
- /* 38 */
- OPCODE(o1_playSound),
- OPCODE(o2_stopSound),
- OPCODE(o2_loadSound),
- OPCODE(o1_freeSoundSlot),
- /* 3C */
- OPCODE(o1_waitEndPlay),
- OPCODE(o1_playComposition),
- OPCODE(o2_getFreeMem),
- OPCODE(o2_checkData),
- /* 40 */
- {0, ""},
- OPCODE(o1_prepareStr),
- OPCODE(o1_insertStr),
- OPCODE(o1_cutStr),
- /* 44 */
- OPCODE(o1_strstr),
- OPCODE(o5_istrlen),
- OPCODE(o1_setMousePos),
- OPCODE(o1_setFrameRate),
- /* 48 */
- OPCODE(o1_animatePalette),
- OPCODE(o1_animateCursor),
- OPCODE(o1_blitCursor),
- OPCODE(o1_loadFont),
- /* 4C */
- OPCODE(o1_freeFont),
- OPCODE(o2_readData),
- OPCODE(o2_writeData),
- OPCODE(o1_manageDataFile),
- };
+void Inter_v5::setupOpcodesFunc() {
+ Inter_v4::setupOpcodesFunc();
+
+ OPCODEFUNC(0x45, o5_istrlen);
+}
+void Inter_v5::setupOpcodes() {
static const OpcodeGoblinEntryV5 opcodesGoblin[71] = {
/* 00 */
OPCODE(o5_spaceShooter),
@@ -276,31 +181,9 @@ void Inter_v5::setupOpcodes() {
{0, ""},
};
- _opcodesFuncV5 = opcodesFunc;
_opcodesGoblinV5 = opcodesGoblin;
}
-bool Inter_v5::executeFuncOpcode(byte i, byte j, OpFuncParams &params) {
- debugC(1, kDebugFuncOp, "opcodeFunc %d.%d [0x%X.0x%X] (%s) - %s, %d, %d",
- i, j, i, j, getOpcodeFuncDesc(i, j), _vm->_game->_curTotFile,
- (uint) (_vm->_global->_inter_execPtr - _vm->_game->_totFileData),
- (uint) (_vm->_global->_inter_execPtr - _vm->_game->_totFileData - params.counter - 4));
-
- if ((i > 4) || (j > 15)) {
- warning("unimplemented opcodeFunc: %d.%d", i, j);
- return false;
- }
-
- OpcodeFuncProcV5 op = _opcodesFuncV5[i*16 + j].proc;
-
- if (op == 0)
- warning("unimplemented opcodeFunc: %d.%d", i, j);
- else
- return (this->*op) (params);
-
- return false;
-}
-
void Inter_v5::executeGoblinOpcode(int i, OpGobParams &params) {
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
i, i, getOpcodeGoblinDesc(i));
@@ -327,13 +210,6 @@ void Inter_v5::executeGoblinOpcode(int i, OpGobParams &params) {
}
}
-const char *Inter_v5::getOpcodeFuncDesc(byte i, byte j) {
- if ((i > 4) || (j > 15))
- return "";
-
- return _opcodesFuncV5[i*16 + j].desc;
-}
-
const char *Inter_v5::getOpcodeGoblinDesc(int i) {
for (int j = 0; j < ARRAYSIZE(_goblinFuncLookUp); j++)
if (_goblinFuncLookUp[j][0] == i)