aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/inter_v2.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_v2.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_v2.cpp')
-rw-r--r--engines/gob/inter_v2.cpp158
1 files changed, 27 insertions, 131 deletions
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index 7c84586fec..6681ea7269 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -49,7 +49,9 @@
namespace Gob {
#define OPCODE(x) _OPCODE(Inter_v2, x)
-#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(Inter_v2, x)
+#define OPCODEVER Inter_v2
+#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
+#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
const int Inter_v2::_goblinFuncLookUp[][2] = {
{0, 0},
@@ -155,110 +157,31 @@ void Inter_v2::setupOpcodesDraw() {
OPCODEDRAW(0x88, o2_resetImdFrontSurf);
}
-void Inter_v2::setupOpcodes() {
- static const OpcodeFuncEntryV2 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),
- {0, ""},
- {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(o1_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_v2::setupOpcodesFunc() {
+ Inter_v1::setupOpcodesFunc();
+ OPCODEFUNC(0x09, o2_assign);
+
+ OPCODEFUNC(0x11, o2_printText);
+
+ OPCODEFUNC(0x17, o2_animPalInit);
+
+ OPCODEFUNC(0x18, o2_addCollision);
+ OPCODEFUNC(0x19, o2_freeCollision);
+
+ OPCODEFUNC(0x25, o2_goblinFunc);
+
+ OPCODEFUNC(0x39, o2_stopSound);
+ OPCODEFUNC(0x3A, o2_loadSound);
+
+ OPCODEFUNC(0x3E, o2_getFreeMem);
+ OPCODEFUNC(0x3F, o2_checkData);
+
+ OPCODEFUNC(0x4D, o2_readData);
+ OPCODEFUNC(0x4E, o2_writeData);
+}
+
+void Inter_v2::setupOpcodes() {
static const OpcodeGoblinEntryV2 opcodesGoblin[71] = {
/* 00 */
OPCODE(o2_loadInfogramesIns),
@@ -351,29 +274,9 @@ void Inter_v2::setupOpcodes() {
{0, ""},
};
- _opcodesFuncV2 = opcodesFunc;
_opcodesGoblinV2 = opcodesGoblin;
}
-bool Inter_v2::executeFuncOpcode(byte i, byte j, OpFuncParams &params) {
- debugC(1, kDebugFuncOp, "opcodeFunc %d.%d [0x%X.0x%X] (%s)",
- i, j, i, j, getOpcodeFuncDesc(i, j));
-
- if ((i > 4) || (j > 15)) {
- warning("unimplemented opcodeFunc: %d.%d", i, j);
- return false;
- }
-
- OpcodeFuncProcV2 op = _opcodesFuncV2[i*16 + j].proc;
-
- if (op == 0)
- warning("unimplemented opcodeFunc: %d.%d", i, j);
- else
- return (this->*op) (params);
-
- return false;
-}
-
void Inter_v2::executeGoblinOpcode(int i, OpGobParams &params) {
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
i, i, getOpcodeGoblinDesc(i));
@@ -396,13 +299,6 @@ void Inter_v2::executeGoblinOpcode(int i, OpGobParams &params) {
(this->*op) (params);
}
-const char *Inter_v2::getOpcodeFuncDesc(byte i, byte j) {
- if ((i > 4) || (j > 15))
- return "";
-
- return _opcodesFuncV2[i*16 + j].desc;
-}
-
const char *Inter_v2::getOpcodeGoblinDesc(int i) {
for (int j = 0; j < ARRAYSIZE(_goblinFuncLookUp); j++)
if (_goblinFuncLookUp[j][0] == i)