mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
Changed opcodeFunc to be functor-based
svn-id: r41602
This commit is contained in:
parent
25c92dfdef
commit
8615c57791
@ -69,17 +69,49 @@ Inter::~Inter() {
|
||||
|
||||
void Inter::NsetupOpcodes() {
|
||||
setupOpcodesDraw();
|
||||
setupOpcodesFunc();
|
||||
}
|
||||
|
||||
void Inter::executeOpcodeDraw(byte i) {
|
||||
debugC(1, kDebugDrawOp, "opcodeDraw %d [0x%X] (%s)", i, i, getDescOpcodeDraw(i));
|
||||
|
||||
if (_opcodesDraw[i].proc && _opcodesDraw[i].proc->isValid())
|
||||
(*_opcodesDraw[i].proc)();
|
||||
else
|
||||
warning("unimplemented opcodeDraw: %d", i);
|
||||
warning("unimplemented opcodeDraw: %d [0x%X]", i, i);
|
||||
}
|
||||
|
||||
bool Inter::executeOpcodeFunc(byte i, byte j, OpFuncParams ¶ms) {
|
||||
debugC(1, kDebugFuncOp, "opcodeFunc %d.%d [0x%X.0x%X] (%s)",
|
||||
i, j, i, j, getDescOpcodeFunc(i, j));
|
||||
|
||||
if ((i > 4) || (j > 15)) {
|
||||
warning("unimplemented opcodeFunc: %d.%d [0x%X.0x%X]", i, j, i, j);
|
||||
return false;
|
||||
}
|
||||
|
||||
i = i * 16 + j;
|
||||
if (_opcodesFunc[i].proc && _opcodesFunc[i].proc->isValid())
|
||||
return (*_opcodesFunc[i].proc)(params);
|
||||
else
|
||||
warning("unimplemented opcodeFunc: %d.%d [0x%X.0x%X]", i, j, i, j);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *Inter::getDescOpcodeDraw(byte i) {
|
||||
return _opcodesDraw[i].desc;
|
||||
const char *desc = _opcodesDraw[i].desc;
|
||||
|
||||
return ((desc) ? desc : "");
|
||||
}
|
||||
|
||||
const char *Inter::getDescOpcodeFunc(byte i, byte j) {
|
||||
if ((i > 4) || (j > 15))
|
||||
return "";
|
||||
|
||||
const char *desc = _opcodesDraw[i * 16 + j].desc;
|
||||
|
||||
return ((desc) ? desc : "");
|
||||
}
|
||||
|
||||
void Inter::initControlVars(char full) {
|
||||
@ -292,7 +324,7 @@ void Inter::funcBlock(int16 retFlag) {
|
||||
if (cmd2 == 0)
|
||||
cmd >>= 4;
|
||||
|
||||
if (executeFuncOpcode(cmd2, cmd, params))
|
||||
if (executeOpcodeFunc(cmd2, cmd, params))
|
||||
return;
|
||||
|
||||
if (_vm->shouldQuit())
|
||||
|
@ -37,24 +37,40 @@ namespace Gob {
|
||||
// to save abit of memory used by opcode names in the Scumm engine.
|
||||
#ifndef REDUCE_MEMORY_USAGE
|
||||
#define _OPCODEDRAW(ver, x) setProc(new Common::Functor0Mem<void, ver>(this, &ver::x), #x)
|
||||
#define _OPCODEFUNC(ver, x) setProc(new Common::Functor1Mem<OpFuncParams &, bool, ver>(this, &ver::x), #x)
|
||||
#else
|
||||
#define _OPCODEDRAW(ver, x) setProc(new Common::Functor0Mem<void, ver>(this, &ver::x), "")
|
||||
#define _OPCODEFUNC(ver, x) setProc(new Common::Functor1Mem<OpFuncParams &, bool, ver>(this, &ver::x), "")
|
||||
#endif
|
||||
|
||||
#define CLEAROPCODEDRAW(i) _opcodesDraw[i].setProc(0, 0);
|
||||
#define CLEAROPCODEFUNC(i) _opcodesFunc[i].setProc(0, 0);
|
||||
|
||||
typedef Common::Functor0<void> OpcodeDraw;
|
||||
typedef Common::Functor1<struct OpFuncParams &, bool> OpcodeFunc;
|
||||
|
||||
struct OpcodeDrawEntry : Common::NonCopyable {
|
||||
OpcodeDraw *proc;
|
||||
struct OpFuncParams {
|
||||
byte cmdCount;
|
||||
byte counter;
|
||||
int16 retFlag;
|
||||
};
|
||||
struct OpGobParams {
|
||||
int16 extraData;
|
||||
VariableReference retVarPtr;
|
||||
Goblin::Gob_Object *objDesc;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct OpcodeEntry : Common::NonCopyable {
|
||||
T *proc;
|
||||
const char *desc;
|
||||
|
||||
OpcodeDrawEntry() : proc(0), desc(0) {}
|
||||
~OpcodeDrawEntry() {
|
||||
OpcodeEntry() : proc(0), desc(0) {}
|
||||
~OpcodeEntry() {
|
||||
setProc(0, 0);
|
||||
}
|
||||
|
||||
void setProc(OpcodeDraw *p, const char *d) {
|
||||
void setProc(T *p, const char *d) {
|
||||
if (proc != p) {
|
||||
delete proc;
|
||||
proc = p;
|
||||
@ -106,18 +122,8 @@ public:
|
||||
virtual ~Inter();
|
||||
|
||||
protected:
|
||||
struct OpFuncParams {
|
||||
byte cmdCount;
|
||||
byte counter;
|
||||
int16 retFlag;
|
||||
};
|
||||
struct OpGobParams {
|
||||
int16 extraData;
|
||||
VariableReference retVarPtr;
|
||||
Goblin::Gob_Object *objDesc;
|
||||
};
|
||||
|
||||
OpcodeDrawEntry _opcodesDraw[256];
|
||||
OpcodeEntry<OpcodeDraw> _opcodesDraw[256];
|
||||
OpcodeEntry<OpcodeFunc> _opcodesFunc[256];
|
||||
|
||||
bool _break;
|
||||
|
||||
@ -135,15 +141,16 @@ protected:
|
||||
|
||||
void NsetupOpcodes();
|
||||
void executeOpcodeDraw(byte i);
|
||||
bool executeOpcodeFunc(byte i, byte j, OpFuncParams ¶ms);
|
||||
|
||||
const char *getDescOpcodeDraw(byte i);
|
||||
const char *getDescOpcodeFunc(byte i, byte j);
|
||||
|
||||
virtual void setupOpcodesDraw() = 0;
|
||||
virtual void setupOpcodesFunc() = 0;
|
||||
|
||||
virtual void setupOpcodes() = 0;
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) = 0;
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms) = 0;
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j) = 0;
|
||||
virtual const char *getOpcodeGoblinDesc(int i) = 0;
|
||||
|
||||
virtual void checkSwitchTable(byte **ppExec) = 0;
|
||||
@ -162,26 +169,19 @@ public:
|
||||
virtual void animPalette();
|
||||
|
||||
protected:
|
||||
typedef bool (Inter_v1::*OpcodeFuncProcV1)(OpFuncParams &);
|
||||
typedef void (Inter_v1::*OpcodeGoblinProcV1)(OpGobParams &);
|
||||
struct OpcodeFuncEntryV1 {
|
||||
OpcodeFuncProcV1 proc;
|
||||
const char *desc;
|
||||
};
|
||||
struct OpcodeGoblinEntryV1 {
|
||||
OpcodeGoblinProcV1 proc;
|
||||
const char *desc;
|
||||
};
|
||||
const OpcodeFuncEntryV1 *_opcodesFuncV1;
|
||||
const OpcodeGoblinEntryV1 *_opcodesGoblinV1;
|
||||
static const int _goblinFuncLookUp[][2];
|
||||
|
||||
virtual void setupOpcodesDraw();
|
||||
virtual void setupOpcodesFunc();
|
||||
|
||||
virtual void setupOpcodes();
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms);
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms);
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j);
|
||||
virtual const char *getOpcodeGoblinDesc(int i);
|
||||
|
||||
virtual void checkSwitchTable(byte **ppExec);
|
||||
@ -351,26 +351,19 @@ public:
|
||||
virtual void animPalette();
|
||||
|
||||
protected:
|
||||
typedef bool (Inter_v2::*OpcodeFuncProcV2)(OpFuncParams &);
|
||||
typedef void (Inter_v2::*OpcodeGoblinProcV2)(OpGobParams &);
|
||||
struct OpcodeFuncEntryV2 {
|
||||
OpcodeFuncProcV2 proc;
|
||||
const char *desc;
|
||||
};
|
||||
struct OpcodeGoblinEntryV2 {
|
||||
OpcodeGoblinProcV2 proc;
|
||||
const char *desc;
|
||||
};
|
||||
const OpcodeFuncEntryV2 *_opcodesFuncV2;
|
||||
const OpcodeGoblinEntryV2 *_opcodesGoblinV2;
|
||||
static const int _goblinFuncLookUp[][2];
|
||||
|
||||
virtual void setupOpcodesDraw();
|
||||
virtual void setupOpcodesFunc();
|
||||
|
||||
virtual void setupOpcodes();
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms);
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms);
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j);
|
||||
virtual const char *getOpcodeGoblinDesc(int i);
|
||||
|
||||
virtual void checkSwitchTable(byte **ppExec);
|
||||
@ -437,26 +430,19 @@ public:
|
||||
virtual ~Inter_Bargon() {}
|
||||
|
||||
protected:
|
||||
typedef bool (Inter_Bargon::*OpcodeFuncProcBargon)(OpFuncParams &);
|
||||
typedef void (Inter_Bargon::*OpcodeGoblinProcBargon)(OpGobParams &);
|
||||
struct OpcodeFuncEntryBargon {
|
||||
OpcodeFuncProcBargon proc;
|
||||
const char *desc;
|
||||
};
|
||||
struct OpcodeGoblinEntryBargon {
|
||||
OpcodeGoblinProcBargon proc;
|
||||
const char *desc;
|
||||
};
|
||||
const OpcodeFuncEntryBargon *_opcodesFuncBargon;
|
||||
const OpcodeGoblinEntryBargon *_opcodesGoblinBargon;
|
||||
static const int _goblinFuncLookUp[][2];
|
||||
|
||||
virtual void setupOpcodesDraw();
|
||||
virtual void setupOpcodesFunc();
|
||||
|
||||
virtual void setupOpcodes();
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms);
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms);
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j);
|
||||
virtual const char *getOpcodeGoblinDesc(int i);
|
||||
|
||||
void oBargon_intro0(OpGobParams ¶ms);
|
||||
@ -477,26 +463,19 @@ public:
|
||||
virtual ~Inter_Fascination() {}
|
||||
|
||||
protected:
|
||||
typedef bool (Inter_Fascination::*OpcodeFuncProcFascination)(OpFuncParams &);
|
||||
typedef void (Inter_Fascination::*OpcodeGoblinProcFascination)(OpGobParams &);
|
||||
struct OpcodeFuncEntryFascination {
|
||||
OpcodeFuncProcFascination proc;
|
||||
const char *desc;
|
||||
};
|
||||
struct OpcodeGoblinEntryFascination {
|
||||
OpcodeGoblinProcFascination proc;
|
||||
const char *desc;
|
||||
};
|
||||
const OpcodeFuncEntryFascination *_opcodesFuncFascination;
|
||||
const OpcodeGoblinEntryFascination *_opcodesGoblinFascination;
|
||||
static const int _goblinFuncLookUp[][2];
|
||||
|
||||
virtual void setupOpcodesDraw();
|
||||
virtual void setupOpcodesFunc();
|
||||
|
||||
virtual void setupOpcodes();
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms);
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms);
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j);
|
||||
virtual const char *getOpcodeGoblinDesc(int i);
|
||||
|
||||
void oFascin_playProtracker(OpGobParams ¶ms);
|
||||
@ -532,33 +511,23 @@ public:
|
||||
virtual ~Inter_v3() {}
|
||||
|
||||
protected:
|
||||
typedef bool (Inter_v3::*OpcodeFuncProcV3)(OpFuncParams &);
|
||||
typedef void (Inter_v3::*OpcodeGoblinProcV3)(OpGobParams &);
|
||||
struct OpcodeFuncEntryV3 {
|
||||
OpcodeFuncProcV3 proc;
|
||||
const char *desc;
|
||||
};
|
||||
struct OpcodeGoblinEntryV3 {
|
||||
OpcodeGoblinProcV3 proc;
|
||||
const char *desc;
|
||||
};
|
||||
const OpcodeFuncEntryV3 *_opcodesFuncV3;
|
||||
const OpcodeGoblinEntryV3 *_opcodesGoblinV3;
|
||||
static const int _goblinFuncLookUp[][2];
|
||||
|
||||
virtual void setupOpcodesDraw();
|
||||
virtual void setupOpcodesFunc();
|
||||
|
||||
virtual void setupOpcodes();
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms);
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms);
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j);
|
||||
virtual const char *getOpcodeGoblinDesc(int i);
|
||||
|
||||
bool o3_getTotTextItemPart(OpFuncParams ¶ms);
|
||||
bool o3_copySprite(OpFuncParams ¶ms);
|
||||
bool o3_checkData(OpFuncParams ¶ms);
|
||||
bool o3_readData(OpFuncParams ¶ms);
|
||||
bool o3_writeData(OpFuncParams ¶ms);
|
||||
|
||||
void o3_wobble(OpGobParams ¶ms);
|
||||
};
|
||||
@ -569,26 +538,19 @@ public:
|
||||
virtual ~Inter_v4() {}
|
||||
|
||||
protected:
|
||||
typedef bool (Inter_v4::*OpcodeFuncProcV4)(OpFuncParams &);
|
||||
typedef void (Inter_v4::*OpcodeGoblinProcV4)(OpGobParams &);
|
||||
struct OpcodeFuncEntryV4 {
|
||||
OpcodeFuncProcV4 proc;
|
||||
const char *desc;
|
||||
};
|
||||
struct OpcodeGoblinEntryV4 {
|
||||
OpcodeGoblinProcV4 proc;
|
||||
const char *desc;
|
||||
};
|
||||
const OpcodeFuncEntryV4 *_opcodesFuncV4;
|
||||
const OpcodeGoblinEntryV4 *_opcodesGoblinV4;
|
||||
static const int _goblinFuncLookUp[][2];
|
||||
|
||||
virtual void setupOpcodesDraw();
|
||||
virtual void setupOpcodesFunc();
|
||||
|
||||
virtual void setupOpcodes();
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms);
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms);
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j);
|
||||
virtual const char *getOpcodeGoblinDesc(int i);
|
||||
|
||||
void o4_initScreen();
|
||||
@ -601,26 +563,19 @@ public:
|
||||
virtual ~Inter_v5() {}
|
||||
|
||||
protected:
|
||||
typedef bool (Inter_v5::*OpcodeFuncProcV5)(OpFuncParams &);
|
||||
typedef void (Inter_v5::*OpcodeGoblinProcV5)(OpGobParams &);
|
||||
struct OpcodeFuncEntryV5 {
|
||||
OpcodeFuncProcV5 proc;
|
||||
const char *desc;
|
||||
};
|
||||
struct OpcodeGoblinEntryV5 {
|
||||
OpcodeGoblinProcV5 proc;
|
||||
const char *desc;
|
||||
};
|
||||
const OpcodeFuncEntryV5 *_opcodesFuncV5;
|
||||
const OpcodeGoblinEntryV5 *_opcodesGoblinV5;
|
||||
static const int _goblinFuncLookUp[][2];
|
||||
|
||||
virtual void setupOpcodesDraw();
|
||||
virtual void setupOpcodesFunc();
|
||||
|
||||
virtual void setupOpcodes();
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms);
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms);
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j);
|
||||
virtual const char *getOpcodeGoblinDesc(int i);
|
||||
|
||||
byte _gob_97_98_val;
|
||||
@ -654,28 +609,21 @@ public:
|
||||
virtual ~Inter_v6() {}
|
||||
|
||||
protected:
|
||||
typedef bool (Inter_v6::*OpcodeFuncProcV6)(OpFuncParams &);
|
||||
typedef void (Inter_v6::*OpcodeGoblinProcV6)(OpGobParams &);
|
||||
struct OpcodeFuncEntryV6 {
|
||||
OpcodeFuncProcV6 proc;
|
||||
const char *desc;
|
||||
};
|
||||
struct OpcodeGoblinEntryV6 {
|
||||
OpcodeGoblinProcV6 proc;
|
||||
const char *desc;
|
||||
};
|
||||
const OpcodeFuncEntryV6 *_opcodesFuncV6;
|
||||
const OpcodeGoblinEntryV6 *_opcodesGoblinV6;
|
||||
static const int _goblinFuncLookUp[][2];
|
||||
|
||||
virtual void setupOpcodesDraw();
|
||||
virtual void setupOpcodesFunc();
|
||||
|
||||
bool _gotFirstPalette;
|
||||
|
||||
virtual void setupOpcodes();
|
||||
virtual bool executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms);
|
||||
virtual void executeGoblinOpcode(int i, OpGobParams ¶ms);
|
||||
virtual const char *getOpcodeFuncDesc(byte i, byte j);
|
||||
virtual const char *getOpcodeGoblinDesc(int i);
|
||||
|
||||
void o6_totSub();
|
||||
|
@ -40,7 +40,9 @@
|
||||
namespace Gob {
|
||||
|
||||
#define OPCODE(x) _OPCODE(Inter_Bargon, x)
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(Inter_Bargon, x)
|
||||
#define OPCODEVER Inter_Bargon
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
|
||||
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
|
||||
|
||||
const int Inter_Bargon::_goblinFuncLookUp[][2] = {
|
||||
{1, 0},
|
||||
@ -125,110 +127,11 @@ void Inter_Bargon::setupOpcodesDraw() {
|
||||
Inter_v2::setupOpcodesDraw();
|
||||
}
|
||||
|
||||
void Inter_Bargon::setupOpcodes() {
|
||||
static const OpcodeFuncEntryBargon 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 */
|
||||
{0, ""},
|
||||
{0, ""},
|
||||
{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_Bargon::setupOpcodesFunc() {
|
||||
Inter_v2::setupOpcodesFunc();
|
||||
}
|
||||
|
||||
void Inter_Bargon::setupOpcodes() {
|
||||
static const OpcodeGoblinEntryBargon opcodesGoblin[71] = {
|
||||
/* 00 */
|
||||
OPCODE(oBargon_intro0),
|
||||
@ -321,29 +224,9 @@ void Inter_Bargon::setupOpcodes() {
|
||||
{0, ""},
|
||||
};
|
||||
|
||||
_opcodesFuncBargon = opcodesFunc;
|
||||
_opcodesGoblinBargon = opcodesGoblin;
|
||||
}
|
||||
|
||||
bool Inter_Bargon::executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) {
|
||||
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;
|
||||
}
|
||||
|
||||
OpcodeFuncProcBargon op = _opcodesFuncBargon[i*16 + j].proc;
|
||||
|
||||
if (op == 0)
|
||||
warning("unimplemented opcodeFunc: %d.%d", i, j);
|
||||
else
|
||||
return (this->*op) (params);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inter_Bargon::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
|
||||
i, i, getOpcodeGoblinDesc(i));
|
||||
@ -367,13 +250,6 @@ void Inter_Bargon::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
(this->*op) (params);
|
||||
}
|
||||
|
||||
const char *Inter_Bargon::getOpcodeFuncDesc(byte i, byte j) {
|
||||
if ((i > 4) || (j > 15))
|
||||
return "";
|
||||
|
||||
return _opcodesFuncBargon[i*16 + j].desc;
|
||||
}
|
||||
|
||||
const char *Inter_Bargon::getOpcodeGoblinDesc(int i) {
|
||||
for (int j = 0; j < ARRAYSIZE(_goblinFuncLookUp); j++)
|
||||
if (_goblinFuncLookUp[j][0] == i)
|
||||
|
@ -41,7 +41,9 @@
|
||||
namespace Gob {
|
||||
|
||||
#define OPCODE(x) _OPCODE(Inter_Fascination, x)
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(Inter_Fascination, x)
|
||||
#define OPCODEVER Inter_Fascination
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
|
||||
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
|
||||
|
||||
const int Inter_Fascination::_goblinFuncLookUp[][2] = {
|
||||
{1, 0},
|
||||
@ -100,110 +102,11 @@ void Inter_Fascination::setupOpcodesDraw() {
|
||||
CLEAROPCODEDRAW(0x88);
|
||||
}
|
||||
|
||||
void Inter_Fascination::setupOpcodes() {
|
||||
static const OpcodeFuncEntryFascination 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(o1_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(o1_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_Fascination::setupOpcodesFunc() {
|
||||
Inter_v2::setupOpcodesFunc();
|
||||
}
|
||||
|
||||
void Inter_Fascination::setupOpcodes() {
|
||||
static const OpcodeGoblinEntryFascination opcodesGoblin[15] = {
|
||||
/* 00 */
|
||||
OPCODE(oFascin_geUnknown0),
|
||||
@ -226,7 +129,6 @@ void Inter_Fascination::setupOpcodes() {
|
||||
OPCODE(oFascin_geUnknown1002), //to be replaced by o2_stopProtracker when protrackerPlay is fixed
|
||||
};
|
||||
|
||||
_opcodesFuncFascination = opcodesFunc;
|
||||
_opcodesGoblinFascination = opcodesGoblin;
|
||||
}
|
||||
|
||||
@ -375,25 +277,6 @@ void Inter_Fascination::oFascin_cdUnknown11() {
|
||||
evalExpr(0);
|
||||
}
|
||||
|
||||
bool Inter_Fascination::executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) {
|
||||
debugC(1, kDebugFuncOp, "opcodeFunc %d.%d [0x%X.0x%X] (%s)",
|
||||
i, j, i, j, getOpcodeFuncDesc(i, j));
|
||||
|
||||
if ((i > 4) || (j > 16)) {
|
||||
warning("Invalid opcodeFunc: %d.%d", i, j);
|
||||
return false;
|
||||
}
|
||||
|
||||
OpcodeFuncProcFascination op = _opcodesFuncFascination[i*16 + j].proc;
|
||||
|
||||
if (op == 0)
|
||||
warning("unimplemented opcodeFunc: %d.%d", i, j);
|
||||
else
|
||||
return (this->*op) (params);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inter_Fascination::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
|
||||
i, i, getOpcodeGoblinDesc(i));
|
||||
@ -417,13 +300,6 @@ void Inter_Fascination::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
(this->*op) (params);
|
||||
}
|
||||
|
||||
const char *Inter_Fascination::getOpcodeFuncDesc(byte i, byte j) {
|
||||
if ((i > 4) || (j > 15))
|
||||
return "";
|
||||
|
||||
return _opcodesFuncFascination[i*16 + j].desc;
|
||||
}
|
||||
|
||||
const char *Inter_Fascination::getOpcodeGoblinDesc(int i) {
|
||||
for (int j = 0; j < ARRAYSIZE(_goblinFuncLookUp); j++)
|
||||
if (_goblinFuncLookUp[j][0] == i)
|
||||
|
@ -47,7 +47,9 @@
|
||||
namespace Gob {
|
||||
|
||||
#define OPCODE(x) _OPCODE(Inter_v1, x)
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(Inter_v1, x)
|
||||
#define OPCODEVER Inter_v1
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
|
||||
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
|
||||
|
||||
const int Inter_v1::_goblinFuncLookUp[][2] = {
|
||||
{1, 0},
|
||||
@ -164,110 +166,82 @@ void Inter_v1::setupOpcodesDraw() {
|
||||
OPCODEDRAW(0x31, o1_freeFontToSprite);
|
||||
}
|
||||
|
||||
void Inter_v1::setupOpcodes() {
|
||||
static const OpcodeFuncEntryV1 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(o1_assign),
|
||||
OPCODE(o1_loadSpriteToPos),
|
||||
{0, ""},
|
||||
/* 0C */
|
||||
{0, ""},
|
||||
{0, ""},
|
||||
{0, ""},
|
||||
{0, ""},
|
||||
/* 10 */
|
||||
{0, ""},
|
||||
OPCODE(o1_printText),
|
||||
OPCODE(o1_loadTot),
|
||||
OPCODE(o1_palLoad),
|
||||
/* 14 */
|
||||
OPCODE(o1_keyFunc),
|
||||
OPCODE(o1_capturePush),
|
||||
OPCODE(o1_capturePop),
|
||||
OPCODE(o1_animPalInit),
|
||||
/* 18 */
|
||||
{0, ""},
|
||||
{0, ""},
|
||||
{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(o1_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(o1_stopSound),
|
||||
OPCODE(o1_loadSound),
|
||||
OPCODE(o1_freeSoundSlot),
|
||||
/* 3C */
|
||||
OPCODE(o1_waitEndPlay),
|
||||
OPCODE(o1_playComposition),
|
||||
OPCODE(o1_getFreeMem),
|
||||
OPCODE(o1_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(o1_readData),
|
||||
OPCODE(o1_writeData),
|
||||
OPCODE(o1_manageDataFile),
|
||||
};
|
||||
void Inter_v1::setupOpcodesFunc() {
|
||||
OPCODEFUNC(0x00, o1_callSub);
|
||||
OPCODEFUNC(0x01, o1_callSub);
|
||||
OPCODEFUNC(0x02, o1_printTotText);
|
||||
OPCODEFUNC(0x03, o1_loadCursor);
|
||||
|
||||
OPCODEFUNC(0x05, o1_switch);
|
||||
OPCODEFUNC(0x06, o1_repeatUntil);
|
||||
OPCODEFUNC(0x07, o1_whileDo);
|
||||
|
||||
OPCODEFUNC(0x08, o1_if);
|
||||
OPCODEFUNC(0x09, o1_assign);
|
||||
OPCODEFUNC(0x0A, o1_loadSpriteToPos);
|
||||
OPCODEFUNC(0x11, o1_printText);
|
||||
OPCODEFUNC(0x12, o1_loadTot);
|
||||
OPCODEFUNC(0x13, o1_palLoad);
|
||||
|
||||
OPCODEFUNC(0x14, o1_keyFunc);
|
||||
OPCODEFUNC(0x15, o1_capturePush);
|
||||
OPCODEFUNC(0x16, o1_capturePop);
|
||||
OPCODEFUNC(0x17, o1_animPalInit);
|
||||
|
||||
OPCODEFUNC(0x1E, o1_drawOperations);
|
||||
OPCODEFUNC(0x1F, o1_setcmdCount);
|
||||
|
||||
OPCODEFUNC(0x20, o1_return);
|
||||
OPCODEFUNC(0x21, o1_renewTimeInVars);
|
||||
OPCODEFUNC(0x22, o1_speakerOn);
|
||||
OPCODEFUNC(0x23, o1_speakerOff);
|
||||
|
||||
OPCODEFUNC(0x24, o1_putPixel);
|
||||
OPCODEFUNC(0x25, o1_goblinFunc);
|
||||
OPCODEFUNC(0x26, o1_createSprite);
|
||||
OPCODEFUNC(0x27, o1_freeSprite);
|
||||
|
||||
OPCODEFUNC(0x30, o1_returnTo);
|
||||
OPCODEFUNC(0x31, o1_loadSpriteContent);
|
||||
OPCODEFUNC(0x32, o1_copySprite);
|
||||
OPCODEFUNC(0x33, o1_fillRect);
|
||||
|
||||
OPCODEFUNC(0x34, o1_drawLine);
|
||||
OPCODEFUNC(0x35, o1_strToLong);
|
||||
OPCODEFUNC(0x36, o1_invalidate);
|
||||
OPCODEFUNC(0x37, o1_setBackDelta);
|
||||
|
||||
OPCODEFUNC(0x38, o1_playSound);
|
||||
OPCODEFUNC(0x39, o1_stopSound);
|
||||
OPCODEFUNC(0x3A, o1_loadSound);
|
||||
OPCODEFUNC(0x3B, o1_freeSoundSlot);
|
||||
|
||||
OPCODEFUNC(0x3C, o1_waitEndPlay);
|
||||
OPCODEFUNC(0x3D, o1_playComposition);
|
||||
OPCODEFUNC(0x3E, o1_getFreeMem);
|
||||
OPCODEFUNC(0x3F, o1_checkData);
|
||||
|
||||
OPCODEFUNC(0x41, o1_prepareStr);
|
||||
OPCODEFUNC(0x42, o1_insertStr);
|
||||
OPCODEFUNC(0x43, o1_cutStr);
|
||||
|
||||
OPCODEFUNC(0x44, o1_strstr);
|
||||
OPCODEFUNC(0x45, o1_istrlen);
|
||||
OPCODEFUNC(0x46, o1_setMousePos);
|
||||
OPCODEFUNC(0x47, o1_setFrameRate);
|
||||
|
||||
OPCODEFUNC(0x48, o1_animatePalette);
|
||||
OPCODEFUNC(0x49, o1_animateCursor);
|
||||
OPCODEFUNC(0x4A, o1_blitCursor);
|
||||
OPCODEFUNC(0x4B, o1_loadFont);
|
||||
|
||||
OPCODEFUNC(0x4C, o1_freeFont);
|
||||
OPCODEFUNC(0x4D, o1_readData);
|
||||
OPCODEFUNC(0x4E, o1_writeData);
|
||||
OPCODEFUNC(0x4F, o1_manageDataFile);
|
||||
}
|
||||
|
||||
void Inter_v1::setupOpcodes() {
|
||||
static const OpcodeGoblinEntryV1 opcodesGoblin[71] = {
|
||||
/* 00 */
|
||||
OPCODE(o1_setState),
|
||||
@ -360,28 +334,9 @@ void Inter_v1::setupOpcodes() {
|
||||
OPCODE(o1_initGoblin)
|
||||
};
|
||||
|
||||
_opcodesFuncV1 = opcodesFunc;
|
||||
_opcodesGoblinV1 = opcodesGoblin;
|
||||
}
|
||||
|
||||
bool Inter_v1::executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) {
|
||||
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;
|
||||
}
|
||||
|
||||
OpcodeFuncProcV1 op = _opcodesFuncV1[i*16 + j].proc;
|
||||
|
||||
if (op == 0)
|
||||
warning("unimplemented opcodeFunc: %d.%d", i, j);
|
||||
else
|
||||
return (this->*op) (params);
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inter_v1::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
|
||||
i, i, getOpcodeGoblinDesc(i));
|
||||
@ -403,13 +358,6 @@ void Inter_v1::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
(this->*op) (params);
|
||||
}
|
||||
|
||||
const char *Inter_v1::getOpcodeFuncDesc(byte i, byte j) {
|
||||
if ((i > 4) || (j > 15))
|
||||
return "";
|
||||
|
||||
return _opcodesFuncV1[i*16 + j].desc;
|
||||
}
|
||||
|
||||
const char *Inter_v1::getOpcodeGoblinDesc(int i) {
|
||||
for (int j = 0; j < ARRAYSIZE(_goblinFuncLookUp); j++)
|
||||
if (_goblinFuncLookUp[j][0] == i)
|
||||
|
@ -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 ¶ms) {
|
||||
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 ¶ms) {
|
||||
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
|
||||
i, i, getOpcodeGoblinDesc(i));
|
||||
@ -396,13 +299,6 @@ void Inter_v2::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
(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)
|
||||
|
@ -37,7 +37,9 @@
|
||||
namespace Gob {
|
||||
|
||||
#define OPCODE(x) _OPCODE(Inter_v3, x)
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(Inter_v3, x)
|
||||
#define OPCODEVER Inter_v3
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
|
||||
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
|
||||
|
||||
const int Inter_v3::_goblinFuncLookUp[][2] = {
|
||||
{0, 0},
|
||||
@ -122,110 +124,14 @@ void Inter_v3::setupOpcodesDraw() {
|
||||
Inter_v2::setupOpcodesDraw();
|
||||
}
|
||||
|
||||
void Inter_v3::setupOpcodes() {
|
||||
static const OpcodeFuncEntryV3 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(o3_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_v3::setupOpcodesFunc() {
|
||||
Inter_v2::setupOpcodesFunc();
|
||||
|
||||
OPCODEFUNC(0x1A, o3_getTotTextItemPart);
|
||||
OPCODEFUNC(0x32, o3_copySprite);
|
||||
}
|
||||
|
||||
void Inter_v3::setupOpcodes() {
|
||||
static const OpcodeGoblinEntryV3 opcodesGoblin[71] = {
|
||||
/* 00 */
|
||||
OPCODE(o2_loadInfogramesIns),
|
||||
@ -318,29 +224,9 @@ void Inter_v3::setupOpcodes() {
|
||||
{0, ""},
|
||||
};
|
||||
|
||||
_opcodesFuncV3 = opcodesFunc;
|
||||
_opcodesGoblinV3 = opcodesGoblin;
|
||||
}
|
||||
|
||||
bool Inter_v3::executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) {
|
||||
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;
|
||||
}
|
||||
|
||||
OpcodeFuncProcV3 op = _opcodesFuncV3[i*16 + j].proc;
|
||||
|
||||
if (op == 0)
|
||||
warning("unimplemented opcodeFunc: %d.%d", i, j);
|
||||
else
|
||||
return (this->*op) (params);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inter_v3::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
|
||||
i, i, getOpcodeGoblinDesc(i));
|
||||
@ -363,13 +249,6 @@ void Inter_v3::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
(this->*op) (params);
|
||||
}
|
||||
|
||||
const char *Inter_v3::getOpcodeFuncDesc(byte i, byte j) {
|
||||
if ((i > 4) || (j > 15))
|
||||
return "";
|
||||
|
||||
return _opcodesFuncV3[i*16 + j].desc;
|
||||
}
|
||||
|
||||
const char *Inter_v3::getOpcodeGoblinDesc(int i) {
|
||||
for (int j = 0; j < ARRAYSIZE(_goblinFuncLookUp); j++)
|
||||
if (_goblinFuncLookUp[j][0] == i)
|
||||
|
@ -39,7 +39,9 @@
|
||||
namespace Gob {
|
||||
|
||||
#define OPCODE(x) _OPCODE(Inter_v4, x)
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(Inter_v4, x)
|
||||
#define OPCODEVER Inter_v4
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
|
||||
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
|
||||
|
||||
const int Inter_v4::_goblinFuncLookUp[][2] = {
|
||||
{0, 0},
|
||||
@ -127,110 +129,11 @@ void Inter_v4::setupOpcodesDraw() {
|
||||
OPCODEDRAW(0x83, o4_playVmdOrMusic);
|
||||
}
|
||||
|
||||
void Inter_v4::setupOpcodes() {
|
||||
static const OpcodeFuncEntryV4 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(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_v4::setupOpcodesFunc() {
|
||||
Inter_v3::setupOpcodesFunc();
|
||||
}
|
||||
|
||||
void Inter_v4::setupOpcodes() {
|
||||
static const OpcodeGoblinEntryV4 opcodesGoblin[71] = {
|
||||
/* 00 */
|
||||
{0, ""},
|
||||
@ -323,31 +226,9 @@ void Inter_v4::setupOpcodes() {
|
||||
{0, ""},
|
||||
};
|
||||
|
||||
_opcodesFuncV4 = opcodesFunc;
|
||||
_opcodesGoblinV4 = opcodesGoblin;
|
||||
}
|
||||
|
||||
bool Inter_v4::executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) {
|
||||
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;
|
||||
}
|
||||
|
||||
OpcodeFuncProcV4 op = _opcodesFuncV4[i*16 + j].proc;
|
||||
|
||||
if (op == 0)
|
||||
warning("unimplemented opcodeFunc: %d.%d", i, j);
|
||||
else
|
||||
return (this->*op) (params);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inter_v4::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
|
||||
i, i, getOpcodeGoblinDesc(i));
|
||||
@ -372,13 +253,6 @@ void Inter_v4::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
(this->*op) (params);
|
||||
}
|
||||
|
||||
const char *Inter_v4::getOpcodeFuncDesc(byte i, byte j) {
|
||||
if ((i > 4) || (j > 15))
|
||||
return "";
|
||||
|
||||
return _opcodesFuncV4[i*16 + j].desc;
|
||||
}
|
||||
|
||||
const char *Inter_v4::getOpcodeGoblinDesc(int i) {
|
||||
for (int j = 0; j < ARRAYSIZE(_goblinFuncLookUp); j++)
|
||||
if (_goblinFuncLookUp[j][0] == i)
|
||||
|
@ -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 ¶ms) {
|
||||
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 ¶ms) {
|
||||
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
|
||||
i, i, getOpcodeGoblinDesc(i));
|
||||
@ -327,13 +210,6 @@ void Inter_v5::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -40,7 +40,9 @@
|
||||
namespace Gob {
|
||||
|
||||
#define OPCODE(x) _OPCODE(Inter_v6, x)
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(Inter_v6, x)
|
||||
#define OPCODEVER Inter_v6
|
||||
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
|
||||
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
|
||||
|
||||
const int Inter_v6::_goblinFuncLookUp[][2] = {
|
||||
{0, 0},
|
||||
@ -61,110 +63,17 @@ void Inter_v6::setupOpcodesDraw() {
|
||||
OPCODEDRAW(0x85, o6_openItk);
|
||||
}
|
||||
|
||||
void Inter_v6::setupOpcodes() {
|
||||
static const OpcodeFuncEntryV6 opcodesFunc[80] = {
|
||||
/* 00 */
|
||||
OPCODE(o1_callSub),
|
||||
OPCODE(o1_callSub),
|
||||
OPCODE(o1_printTotText),
|
||||
OPCODE(o6_loadCursor),
|
||||
/* 04 */
|
||||
{0, ""},
|
||||
OPCODE(o1_switch),
|
||||
OPCODE(o1_repeatUntil),
|
||||
OPCODE(o1_whileDo),
|
||||
/* 08 */
|
||||
OPCODE(o1_if),
|
||||
OPCODE(o6_assign),
|
||||
OPCODE(o1_loadSpriteToPos),
|
||||
{0, ""},
|
||||
/* 0C */
|
||||
{0, ""},
|
||||
{0, ""},
|
||||
{0, ""},
|
||||
{0, ""},
|
||||
/* 10 */
|
||||
{0, ""},
|
||||
OPCODE(o2_printText),
|
||||
OPCODE(o1_loadTot),
|
||||
OPCODE(o6_palLoad),
|
||||
/* 14 */
|
||||
OPCODE(o1_keyFunc),
|
||||
OPCODE(o1_capturePush),
|
||||
OPCODE(o1_capturePop),
|
||||
OPCODE(o2_animPalInit),
|
||||
/* 18 */
|
||||
OPCODE(o2_addCollision),
|
||||
OPCODE(o6_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(o6_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_v6::setupOpcodesFunc() {
|
||||
Inter_v5::setupOpcodesFunc();
|
||||
|
||||
OPCODEFUNC(0x03, o6_loadCursor);
|
||||
OPCODEFUNC(0x09, o6_assign);
|
||||
OPCODEFUNC(0x13, o6_palLoad);
|
||||
OPCODEFUNC(0x19, o6_freeCollision);
|
||||
OPCODEFUNC(0x33, o6_fillRect);
|
||||
}
|
||||
|
||||
void Inter_v6::setupOpcodes() {
|
||||
static const OpcodeGoblinEntryV6 opcodesGoblin[71] = {
|
||||
/* 00 */
|
||||
{0, ""},
|
||||
@ -257,33 +166,9 @@ void Inter_v6::setupOpcodes() {
|
||||
{0, ""},
|
||||
};
|
||||
|
||||
_opcodesFuncV6 = opcodesFunc;
|
||||
_opcodesGoblinV6 = opcodesGoblin;
|
||||
}
|
||||
|
||||
bool Inter_v6::executeFuncOpcode(byte i, byte j, OpFuncParams ¶ms) {
|
||||
_vm->_video->_palLUT->buildNext();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
OpcodeFuncProcV6 op = _opcodesFuncV6[i*16 + j].proc;
|
||||
|
||||
if (op == 0)
|
||||
warning("unimplemented opcodeFunc: %d.%d", i, j);
|
||||
else
|
||||
return (this->*op) (params);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inter_v6::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
debugC(1, kDebugGobOp, "opcodeGoblin %d [0x%X] (%s)",
|
||||
i, i, getOpcodeGoblinDesc(i));
|
||||
@ -310,13 +195,6 @@ void Inter_v6::executeGoblinOpcode(int i, OpGobParams ¶ms) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *Inter_v6::getOpcodeFuncDesc(byte i, byte j) {
|
||||
if ((i > 4) || (j > 15))
|
||||
return "";
|
||||
|
||||
return _opcodesFuncV6[i*16 + j].desc;
|
||||
}
|
||||
|
||||
const char *Inter_v6::getOpcodeGoblinDesc(int i) {
|
||||
for (int j = 0; j < ARRAYSIZE(_goblinFuncLookUp); j++)
|
||||
if (_goblinFuncLookUp[j][0] == i)
|
||||
|
Loading…
x
Reference in New Issue
Block a user