diff options
-rw-r--r-- | engines/scumm/he/intern_he.h | 70 | ||||
-rw-r--r-- | engines/scumm/he/script_v100he.cpp | 655 | ||||
-rw-r--r-- | engines/scumm/he/script_v60he.cpp | 655 | ||||
-rw-r--r-- | engines/scumm/he/script_v70he.cpp | 655 | ||||
-rw-r--r-- | engines/scumm/he/script_v71he.cpp | 655 | ||||
-rw-r--r-- | engines/scumm/he/script_v72he.cpp | 655 | ||||
-rw-r--r-- | engines/scumm/he/script_v80he.cpp | 654 | ||||
-rw-r--r-- | engines/scumm/he/script_v90he.cpp | 655 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/intern.h | 43 | ||||
-rw-r--r-- | engines/scumm/script.cpp | 9 | ||||
-rw-r--r-- | engines/scumm/script.h | 32 | ||||
-rw-r--r-- | engines/scumm/script_v0.cpp | 656 | ||||
-rw-r--r-- | engines/scumm/script_v2.cpp | 656 | ||||
-rw-r--r-- | engines/scumm/script_v5.cpp | 656 | ||||
-rw-r--r-- | engines/scumm/script_v6.cpp | 656 | ||||
-rw-r--r-- | engines/scumm/script_v8.cpp | 656 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 6 | ||||
-rw-r--r-- | engines/scumm/scumm_v0.h | 11 | ||||
-rw-r--r-- | engines/scumm/scumm_v2.h | 10 | ||||
-rw-r--r-- | engines/scumm/scumm_v5.h | 10 | ||||
-rw-r--r-- | engines/scumm/scumm_v6.h | 10 | ||||
-rw-r--r-- | engines/scumm/scumm_v8.h | 10 |
23 files changed, 3898 insertions, 4178 deletions
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index dcc1740d0e..c2079fa5fe 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -26,7 +26,6 @@ #ifndef SCUMM_HE_INTERN_HE_H #define SCUMM_HE_INTERN_HE_H -#include "scumm/intern.h" #include "scumm/scumm_v6.h" #ifdef ENABLE_HE #include "scumm/he/floodfill_he.h" @@ -51,13 +50,6 @@ class CUP_Player; class ScummEngine_v60he : public ScummEngine_v6 { protected: - typedef void (ScummEngine_v60he::*OpcodeProcv60he)(); - struct OpcodeEntryv60he { - OpcodeProcv60he proc; - const char *desc; - }; - - const OpcodeEntryv60he *_opcodesv60he; public: Common::SeekableReadStream *_hInFileTable[17]; @@ -75,8 +67,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void saveOrLoad(Serializer *s); @@ -115,14 +105,6 @@ class ScummEngine_v70he : public ScummEngine_v60he { friend class ResExtractor; protected: - typedef void (ScummEngine_v70he::*OpcodeProcv70he)(); - struct OpcodeEntryv70he { - OpcodeProcv70he proc; - const char *desc; - }; - - const OpcodeEntryv70he *_opcodesv70he; - ResExtractor *_resExtractor; byte *_heV7RoomOffsets; @@ -140,8 +122,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void setupScummVars(); virtual void resetScummVars(); @@ -185,15 +165,8 @@ class ScummEngine_v71he : public ScummEngine_v70he { friend class Wiz; protected: - typedef void (ScummEngine_v71he::*OpcodeProcv71he)(); - struct OpcodeEntryv71he { - OpcodeProcv71he proc; - const char *desc; - }; - - const OpcodeEntryv71he *_opcodesv71he; - bool _skipProcessActors; + public: ScummEngine_v71he(OSystem *syst, const DetectorResult &dr); ~ScummEngine_v71he(); @@ -206,8 +179,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void saveOrLoad(Serializer *s); @@ -253,11 +224,6 @@ public: class ScummEngine_v72he : public ScummEngine_v71he { protected: - typedef void (ScummEngine_v72he::*OpcodeProcV72he)(); - struct OpcodeEntryV72he { - OpcodeProcV72he proc; - const char *desc; - }; #include "common/pack-start.h" // START STRUCT PACKING @@ -272,8 +238,6 @@ protected: #include "common/pack-end.h" // END STRUCT PACKING - const OpcodeEntryV72he *_opcodesV72he; - int _stringLength; byte _stringBuffer[4096]; @@ -286,8 +250,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void setupScummVars(); virtual void resetScummVars(); @@ -386,14 +348,6 @@ protected: class ScummEngine_v80he : public ScummEngine_v72he { protected: - typedef void (ScummEngine_v80he::*OpcodeProcV80he)(); - struct OpcodeEntryV80he { - OpcodeProcV80he proc; - const char *desc; - }; - - const OpcodeEntryV80he *_opcodesV80he; - int32 _heSndResId, _curSndId, _sndPtrOffs, _sndTmrOffs, _sndDataSize; public: @@ -401,8 +355,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void setupScummVars(); virtual void resetScummVars(); @@ -443,14 +395,6 @@ class ScummEngine_v90he : public ScummEngine_v80he { friend class Sprite; protected: - typedef void (ScummEngine_v90he::*OpcodeProcV90he)(); - struct OpcodeEntryV90he { - OpcodeProcV90he proc; - const char *desc; - }; - - const OpcodeEntryV90he *_opcodesV90he; - FloodFillParameters _floodFillParams; struct VideoParameters { @@ -481,8 +425,6 @@ public: protected: virtual void allocateArrays(); virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void resetScumm(); @@ -596,16 +538,8 @@ protected: class ScummEngine_v100he : public ScummEngine_v99he { protected: - typedef void (ScummEngine_v100he::*OpcodeProcV100he)(); - struct OpcodeEntryV100he { - OpcodeProcV100he proc; - const char *desc; - }; - int32 _heResId, _heResType; - const OpcodeEntryV100he *_opcodesV100he; - byte _debugInputBuffer[256]; public: ScummEngine_v100he(OSystem *syst, const DetectorResult &dr) : ScummEngine_v99he(syst, dr) {} @@ -614,8 +548,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void saveOrLoad(Serializer *s); diff --git a/engines/scumm/he/script_v100he.cpp b/engines/scumm/he/script_v100he.cpp index 1df53a78fc..cd087fbd95 100644 --- a/engines/scumm/he/script_v100he.cpp +++ b/engines/scumm/he/script_v100he.cpp @@ -40,342 +40,329 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v100he, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v100he, x) void ScummEngine_v100he::setupOpcodes() { - static const OpcodeEntryV100he opcodes[256] = { - /* 00 */ - OPCODE(o100_actorOps), - OPCODE(o6_add), - OPCODE(o6_faceActor), - OPCODE(o90_sortArray), - /* 04 */ - OPCODE(o100_arrayOps), - OPCODE(o6_band), - OPCODE(o6_bor), - OPCODE(o6_breakHere), - /* 08 */ - OPCODE(o6_delayFrames), - OPCODE(o90_shl), - OPCODE(o90_shr), - OPCODE(o90_xor), - /* 0C */ - OPCODE(o6_setCameraAt), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_loadRoom), - OPCODE(o6_panCameraTo), - /* 10 */ - OPCODE(o72_captureWizImage), - OPCODE(o100_jumpToScript), - OPCODE(o6_setClass), - OPCODE(o60_closeFile), - /* 14 */ - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_invalid), - OPCODE(o72_createDirectory), - OPCODE(o100_createSound), - /* 18 */ - OPCODE(o6_cutscene), - OPCODE(o6_pop), - OPCODE(o72_traceStatus), - OPCODE(o6_wordVarDec), - /* 1C */ - OPCODE(o6_wordArrayDec), - OPCODE(o72_deleteFile), - OPCODE(o100_dim2dimArray), - OPCODE(o100_dimArray), - /* 20 */ - OPCODE(o6_div), - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - OPCODE(o6_drawBox), - /* 24 */ - OPCODE(o72_drawWizImage), - OPCODE(o80_drawWizPolygon), - OPCODE(o100_drawLine), - OPCODE(o100_drawObject), - /* 28 */ - OPCODE(o6_dup), - OPCODE(o90_dup_n), - OPCODE(o6_endCutscene), - OPCODE(o6_stopObjectCode), - /* 2C */ - OPCODE(o6_stopObjectCode), - OPCODE(o6_eq), - OPCODE(o100_floodFill), - OPCODE(o6_freezeUnfreeze), - /* 30 */ - OPCODE(o6_ge), - OPCODE(o6_getDateTime), - OPCODE(o100_setSpriteGroupInfo), - OPCODE(o6_gt), - /* 34 */ - OPCODE(o100_resourceRoutines), - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o100_wizImageOps), - /* 38 */ - OPCODE(o72_isAnyOf), - OPCODE(o6_wordVarInc), - OPCODE(o6_wordArrayInc), - OPCODE(o6_jump), - /* 3C */ - OPCODE(o90_kernelSetFunctions), - OPCODE(o6_land), - OPCODE(o6_le), - OPCODE(o60_localizeArrayToScript), - /* 40 */ - OPCODE(o6_wordArrayRead), - OPCODE(o6_wordArrayIndexedRead), - OPCODE(o6_lor), - OPCODE(o6_lt), - /* 44 */ - OPCODE(o90_mod), - OPCODE(o6_mul), - OPCODE(o6_neq), - OPCODE(o100_dim2dim2Array), - /* 48 */ - OPCODE(o6_invalid), - OPCODE(o100_redim2dimArray), - OPCODE(o6_not), - OPCODE(o6_invalid), - /* 4C */ - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o72_resetCutscene), - OPCODE(o6_setOwner), - /* 50 */ - OPCODE(o100_paletteOps), - OPCODE(o70_pickupObject), - OPCODE(o71_polygonOps), - OPCODE(o6_pop), - /* 54 */ - OPCODE(o6_printDebug), - OPCODE(o72_printWizImage), - OPCODE(o6_printLine), - OPCODE(o6_printSystem), - /* 58 */ - OPCODE(o6_printText), - OPCODE(o100_jumpToScriptUnk), - OPCODE(o100_startScriptUnk), - OPCODE(o6_pseudoRoom), - /* 5C */ - OPCODE(o6_pushByte), - OPCODE(o72_pushDWord), - OPCODE(o72_getScriptString), - OPCODE(o6_pushWord), - /* 60 */ - OPCODE(o6_pushWordVar), - OPCODE(o6_putActorAtObject), - OPCODE(o6_putActorAtXY), - OPCODE(o6_invalid), - /* 64 */ - OPCODE(o100_redimArray), - OPCODE(o72_rename), - OPCODE(o6_stopObjectCode), - OPCODE(o80_localizeArrayToRoom), - /* 68 */ - OPCODE(o100_roomOps), - OPCODE(o6_printActor), - OPCODE(o6_printEgo), - OPCODE(o72_talkActor), - /* 6C */ - OPCODE(o72_talkEgo), - OPCODE(o6_invalid), - OPCODE(o60_seekFilePos), - OPCODE(o6_setBoxFlags), - /* 70 */ - OPCODE(o6_invalid), - OPCODE(o6_setBoxSet), - OPCODE(o100_setSystemMessage), - OPCODE(o6_shuffle), - /* 74 */ - OPCODE(o6_delay), - OPCODE(o6_delayMinutes), - OPCODE(o6_delaySeconds), - OPCODE(o100_startSound), - /* 78 */ - OPCODE(o80_sourceDebug), - OPCODE(o100_setSpriteInfo), - OPCODE(o6_stampObject), - OPCODE(o72_startObject), - /* 7C */ - OPCODE(o100_startScript), - OPCODE(o6_startScriptQuick), - OPCODE(o80_setState), - OPCODE(o6_stopObjectScript), - /* 80 */ - OPCODE(o6_stopScript), - OPCODE(o6_stopSentence), - OPCODE(o6_stopSound), - OPCODE(o6_stopTalking), - /* 84 */ - OPCODE(o6_writeWordVar), - OPCODE(o6_wordArrayWrite), - OPCODE(o6_wordArrayIndexedWrite), - OPCODE(o6_sub), - /* 88 */ - OPCODE(o100_systemOps), - OPCODE(o6_invalid), - OPCODE(o72_setTimer), - OPCODE(o100_cursorCommand), - /* 8C */ - OPCODE(o100_videoOps), - OPCODE(o100_wait), - OPCODE(o6_walkActorToObj), - OPCODE(o6_walkActorTo), - /* 90 */ - OPCODE(o100_writeFile), - OPCODE(o72_writeINI), - OPCODE(o80_writeConfigFile), - OPCODE(o6_abs), - /* 94 */ - OPCODE(o6_getActorWalkBox), - OPCODE(o6_getActorCostume), - OPCODE(o6_getActorElevation), - OPCODE(o6_getObjectOldDir), - /* 98 */ - OPCODE(o6_getActorMoving), - OPCODE(o90_getActorData), - OPCODE(o6_getActorRoom), - OPCODE(o6_getActorScaleX), - /* 9C */ - OPCODE(o6_getAnimateVariable), - OPCODE(o6_getActorWidth), - OPCODE(o6_getObjectX), - OPCODE(o6_getObjectY), - /* A0 */ - OPCODE(o90_atan2), - OPCODE(o90_getSegmentAngle), - OPCODE(o90_getActorAnimProgress), - OPCODE(o90_getDistanceBetweenPoints), - /* A4 */ - OPCODE(o6_ifClassOfIs), - OPCODE(o6_invalid), - OPCODE(o90_cond), - OPCODE(o90_cos), - /* A8 */ - OPCODE(o100_debugInput), - OPCODE(o80_getFileSize), - OPCODE(o6_getActorFromXY), - OPCODE(o72_findAllObjects), - /* AC */ - OPCODE(o90_findAllObjectsWithClassOf), - OPCODE(o71_findBox), - OPCODE(o6_findInventory), - OPCODE(o72_findObject), - /* B0 */ - OPCODE(o72_findObjectWithClassOf), - OPCODE(o71_polygonHit), - OPCODE(o90_getLinesIntersectionPoint), - OPCODE(o90_fontUnk), - /* B4 */ - OPCODE(o72_getNumFreeArrays), - OPCODE(o72_getArrayDimSize), - OPCODE(o100_isResourceLoaded), - OPCODE(o100_getResourceSize), - /* B8 */ - OPCODE(o100_getSpriteGroupInfo), - OPCODE(o6_invalid), - OPCODE(o100_getWizData), - OPCODE(o6_isActorInBox), - /* BC */ - OPCODE(o6_isAnyOf), - OPCODE(o6_getInventoryCount), - OPCODE(o90_kernelGetFunctions), - OPCODE(o90_max), - /* C0 */ - OPCODE(o90_min), - OPCODE(o72_getObjectImageX), - OPCODE(o72_getObjectImageY), - OPCODE(o6_isRoomScriptRunning), - /* C4 */ - OPCODE(o90_getObjectData), - OPCODE(o72_openFile), - OPCODE(o90_getPolygonOverlap), - OPCODE(o6_getOwner), - /* C8 */ - OPCODE(o100_getPaletteData), - OPCODE(o6_pickOneOf), - OPCODE(o6_pickOneOfDefault), - OPCODE(o80_pickVarRandom), - /* CC */ - OPCODE(o72_getPixel), - OPCODE(o6_distObjectObject), - OPCODE(o6_distObjectPt), - OPCODE(o6_distPtPt), - /* D0 */ - OPCODE(o6_getRandomNumber), - OPCODE(o6_getRandomNumberRange), - OPCODE(o6_invalid), - OPCODE(o100_readFile), - /* D4 */ - OPCODE(o72_readINI), - OPCODE(o80_readConfigFile), - OPCODE(o6_isScriptRunning), - OPCODE(o90_sin), - /* D8 */ - OPCODE(o72_getSoundPosition), - OPCODE(o6_isSoundRunning), - OPCODE(o80_getSoundVar), - OPCODE(o100_getSpriteInfo), - /* DC */ - OPCODE(o90_sqrt), - OPCODE(o6_startObjectQuick), - OPCODE(o6_startScriptQuick2), - OPCODE(o6_getState), - /* E0 */ - OPCODE(o71_compareString), - OPCODE(o71_copyString), - OPCODE(o71_appendString), - OPCODE(o71_concatString), - /* E4 */ - OPCODE(o70_getStringLen), - OPCODE(o71_getStringLenForWidth), - OPCODE(o80_stringToInt), - OPCODE(o71_getCharIndexInString), - /* E8 */ - OPCODE(o71_getStringWidth), - OPCODE(o60_readFilePos), - OPCODE(o72_getTimer), - OPCODE(o6_getVerbEntrypoint), - /* EC */ - OPCODE(o100_getVideoData), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F0 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F4 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F8 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* FC */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesV100he = opcodes; -} - -void ScummEngine_v100he::executeOpcode(byte i) { - OpcodeProcV100he op = _opcodesV100he[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v100he::getOpcodeDesc(byte i) { - return _opcodesV100he[i].desc; + /* 00 */ + OPCODE(0x00, o100_actorOps); + OPCODE(0x01, o6_add); + OPCODE(0x02, o6_faceActor); + OPCODE(0x03, o90_sortArray); + /* 04 */ + OPCODE(0x04, o100_arrayOps); + OPCODE(0x05, o6_band); + OPCODE(0x06, o6_bor); + OPCODE(0x07, o6_breakHere); + /* 08 */ + OPCODE(0x08, o6_delayFrames); + OPCODE(0x09, o90_shl); + OPCODE(0x0a, o90_shr); + OPCODE(0x0b, o90_xor); + /* 0C */ + OPCODE(0x0c, o6_setCameraAt); + OPCODE(0x0d, o6_actorFollowCamera); + OPCODE(0x0e, o6_loadRoom); + OPCODE(0x0f, o6_panCameraTo); + /* 10 */ + OPCODE(0x10, o72_captureWizImage); + OPCODE(0x11, o100_jumpToScript); + OPCODE(0x12, o6_setClass); + OPCODE(0x13, o60_closeFile); + /* 14 */ + OPCODE(0x14, o6_loadRoomWithEgo); + OPCODE(0x15, o6_invalid); + OPCODE(0x16, o72_createDirectory); + OPCODE(0x17, o100_createSound); + /* 18 */ + OPCODE(0x18, o6_cutscene); + OPCODE(0x19, o6_pop); + OPCODE(0x1a, o72_traceStatus); + OPCODE(0x1b, o6_wordVarDec); + /* 1C */ + OPCODE(0x1c, o6_wordArrayDec); + OPCODE(0x1d, o72_deleteFile); + OPCODE(0x1e, o100_dim2dimArray); + OPCODE(0x1f, o100_dimArray); + /* 20 */ + OPCODE(0x20, o6_div); + OPCODE(0x21, o6_animateActor); + OPCODE(0x22, o6_doSentence); + OPCODE(0x23, o6_drawBox); + /* 24 */ + OPCODE(0x24, o72_drawWizImage); + OPCODE(0x25, o80_drawWizPolygon); + OPCODE(0x26, o100_drawLine); + OPCODE(0x27, o100_drawObject); + /* 28 */ + OPCODE(0x28, o6_dup); + OPCODE(0x29, o90_dup_n); + OPCODE(0x2a, o6_endCutscene); + OPCODE(0x2b, o6_stopObjectCode); + /* 2C */ + OPCODE(0x2c, o6_stopObjectCode); + OPCODE(0x2d, o6_eq); + OPCODE(0x2e, o100_floodFill); + OPCODE(0x2f, o6_freezeUnfreeze); + /* 30 */ + OPCODE(0x30, o6_ge); + OPCODE(0x31, o6_getDateTime); + OPCODE(0x32, o100_setSpriteGroupInfo); + OPCODE(0x33, o6_gt); + /* 34 */ + OPCODE(0x34, o100_resourceRoutines); + OPCODE(0x35, o6_if); + OPCODE(0x36, o6_ifNot); + OPCODE(0x37, o100_wizImageOps); + /* 38 */ + OPCODE(0x38, o72_isAnyOf); + OPCODE(0x39, o6_wordVarInc); + OPCODE(0x3a, o6_wordArrayInc); + OPCODE(0x3b, o6_jump); + /* 3C */ + OPCODE(0x3c, o90_kernelSetFunctions); + OPCODE(0x3d, o6_land); + OPCODE(0x3e, o6_le); + OPCODE(0x3f, o60_localizeArrayToScript); + /* 40 */ + OPCODE(0x40, o6_wordArrayRead); + OPCODE(0x41, o6_wordArrayIndexedRead); + OPCODE(0x42, o6_lor); + OPCODE(0x43, o6_lt); + /* 44 */ + OPCODE(0x44, o90_mod); + OPCODE(0x45, o6_mul); + OPCODE(0x46, o6_neq); + OPCODE(0x47, o100_dim2dim2Array); + /* 48 */ + OPCODE(0x48, o6_invalid); + OPCODE(0x49, o100_redim2dimArray); + OPCODE(0x4a, o6_not); + OPCODE(0x4b, o6_invalid); + /* 4C */ + OPCODE(0x4c, o6_beginOverride); + OPCODE(0x4d, o6_endOverride); + OPCODE(0x4e, o72_resetCutscene); + OPCODE(0x4f, o6_setOwner); + /* 50 */ + OPCODE(0x50, o100_paletteOps); + OPCODE(0x51, o70_pickupObject); + OPCODE(0x52, o71_polygonOps); + OPCODE(0x53, o6_pop); + /* 54 */ + OPCODE(0x54, o6_printDebug); + OPCODE(0x55, o72_printWizImage); + OPCODE(0x56, o6_printLine); + OPCODE(0x57, o6_printSystem); + /* 58 */ + OPCODE(0x58, o6_printText); + OPCODE(0x59, o100_jumpToScriptUnk); + OPCODE(0x5a, o100_startScriptUnk); + OPCODE(0x5b, o6_pseudoRoom); + /* 5C */ + OPCODE(0x5c, o6_pushByte); + OPCODE(0x5d, o72_pushDWord); + OPCODE(0x5e, o72_getScriptString); + OPCODE(0x5f, o6_pushWord); + /* 60 */ + OPCODE(0x60, o6_pushWordVar); + OPCODE(0x61, o6_putActorAtObject); + OPCODE(0x62, o6_putActorAtXY); + OPCODE(0x63, o6_invalid); + /* 64 */ + OPCODE(0x64, o100_redimArray); + OPCODE(0x65, o72_rename); + OPCODE(0x66, o6_stopObjectCode); + OPCODE(0x67, o80_localizeArrayToRoom); + /* 68 */ + OPCODE(0x68, o100_roomOps); + OPCODE(0x69, o6_printActor); + OPCODE(0x6a, o6_printEgo); + OPCODE(0x6b, o72_talkActor); + /* 6C */ + OPCODE(0x6c, o72_talkEgo); + OPCODE(0x6d, o6_invalid); + OPCODE(0x6e, o60_seekFilePos); + OPCODE(0x6f, o6_setBoxFlags); + /* 70 */ + OPCODE(0x70, o6_invalid); + OPCODE(0x71, o6_setBoxSet); + OPCODE(0x72, o100_setSystemMessage); + OPCODE(0x73, o6_shuffle); + /* 74 */ + OPCODE(0x74, o6_delay); + OPCODE(0x75, o6_delayMinutes); + OPCODE(0x76, o6_delaySeconds); + OPCODE(0x77, o100_startSound); + /* 78 */ + OPCODE(0x78, o80_sourceDebug); + OPCODE(0x79, o100_setSpriteInfo); + OPCODE(0x7a, o6_stampObject); + OPCODE(0x7b, o72_startObject); + /* 7C */ + OPCODE(0x7c, o100_startScript); + OPCODE(0x7d, o6_startScriptQuick); + OPCODE(0x7e, o80_setState); + OPCODE(0x7f, o6_stopObjectScript); + /* 80 */ + OPCODE(0x80, o6_stopScript); + OPCODE(0x81, o6_stopSentence); + OPCODE(0x82, o6_stopSound); + OPCODE(0x83, o6_stopTalking); + /* 84 */ + OPCODE(0x84, o6_writeWordVar); + OPCODE(0x85, o6_wordArrayWrite); + OPCODE(0x86, o6_wordArrayIndexedWrite); + OPCODE(0x87, o6_sub); + /* 88 */ + OPCODE(0x88, o100_systemOps); + OPCODE(0x89, o6_invalid); + OPCODE(0x8a, o72_setTimer); + OPCODE(0x8b, o100_cursorCommand); + /* 8C */ + OPCODE(0x8c, o100_videoOps); + OPCODE(0x8d, o100_wait); + OPCODE(0x8e, o6_walkActorToObj); + OPCODE(0x8f, o6_walkActorTo); + /* 90 */ + OPCODE(0x90, o100_writeFile); + OPCODE(0x91, o72_writeINI); + OPCODE(0x92, o80_writeConfigFile); + OPCODE(0x93, o6_abs); + /* 94 */ + OPCODE(0x94, o6_getActorWalkBox); + OPCODE(0x95, o6_getActorCostume); + OPCODE(0x96, o6_getActorElevation); + OPCODE(0x97, o6_getObjectOldDir); + /* 98 */ + OPCODE(0x98, o6_getActorMoving); + OPCODE(0x99, o90_getActorData); + OPCODE(0x9a, o6_getActorRoom); + OPCODE(0x9b, o6_getActorScaleX); + /* 9C */ + OPCODE(0x9c, o6_getAnimateVariable); + OPCODE(0x9d, o6_getActorWidth); + OPCODE(0x9e, o6_getObjectX); + OPCODE(0x9f, o6_getObjectY); + /* A0 */ + OPCODE(0xa0, o90_atan2); + OPCODE(0xa1, o90_getSegmentAngle); + OPCODE(0xa2, o90_getActorAnimProgress); + OPCODE(0xa3, o90_getDistanceBetweenPoints); + /* A4 */ + OPCODE(0xa4, o6_ifClassOfIs); + OPCODE(0xa5, o6_invalid); + OPCODE(0xa6, o90_cond); + OPCODE(0xa7, o90_cos); + /* A8 */ + OPCODE(0xa8, o100_debugInput); + OPCODE(0xa9, o80_getFileSize); + OPCODE(0xaa, o6_getActorFromXY); + OPCODE(0xab, o72_findAllObjects); + /* AC */ + OPCODE(0xac, o90_findAllObjectsWithClassOf); + OPCODE(0xad, o71_findBox); + OPCODE(0xae, o6_findInventory); + OPCODE(0xaf, o72_findObject); + /* B0 */ + OPCODE(0xb0, o72_findObjectWithClassOf); + OPCODE(0xb1, o71_polygonHit); + OPCODE(0xb2, o90_getLinesIntersectionPoint); + OPCODE(0xb3, o90_fontUnk); + /* B4 */ + OPCODE(0xb4, o72_getNumFreeArrays); + OPCODE(0xb5, o72_getArrayDimSize); + OPCODE(0xb6, o100_isResourceLoaded); + OPCODE(0xb7, o100_getResourceSize); + /* B8 */ + OPCODE(0xb8, o100_getSpriteGroupInfo); + OPCODE(0xb9, o6_invalid); + OPCODE(0xba, o100_getWizData); + OPCODE(0xbb, o6_isActorInBox); + /* BC */ + OPCODE(0xbc, o6_isAnyOf); + OPCODE(0xbd, o6_getInventoryCount); + OPCODE(0xbe, o90_kernelGetFunctions); + OPCODE(0xbf, o90_max); + /* C0 */ + OPCODE(0xc0, o90_min); + OPCODE(0xc1, o72_getObjectImageX); + OPCODE(0xc2, o72_getObjectImageY); + OPCODE(0xc3, o6_isRoomScriptRunning); + /* C4 */ + OPCODE(0xc4, o90_getObjectData); + OPCODE(0xc5, o72_openFile); + OPCODE(0xc6, o90_getPolygonOverlap); + OPCODE(0xc7, o6_getOwner); + /* C8 */ + OPCODE(0xc8, o100_getPaletteData); + OPCODE(0xc9, o6_pickOneOf); + OPCODE(0xca, o6_pickOneOfDefault); + OPCODE(0xcb, o80_pickVarRandom); + /* CC */ + OPCODE(0xcc, o72_getPixel); + OPCODE(0xcd, o6_distObjectObject); + OPCODE(0xce, o6_distObjectPt); + OPCODE(0xcf, o6_distPtPt); + /* D0 */ + OPCODE(0xd0, o6_getRandomNumber); + OPCODE(0xd1, o6_getRandomNumberRange); + OPCODE(0xd2, o6_invalid); + OPCODE(0xd3, o100_readFile); + /* D4 */ + OPCODE(0xd4, o72_readINI); + OPCODE(0xd5, o80_readConfigFile); + OPCODE(0xd6, o6_isScriptRunning); + OPCODE(0xd7, o90_sin); + /* D8 */ + OPCODE(0xd8, o72_getSoundPosition); + OPCODE(0xd9, o6_isSoundRunning); + OPCODE(0xda, o80_getSoundVar); + OPCODE(0xdb, o100_getSpriteInfo); + /* DC */ + OPCODE(0xdc, o90_sqrt); + OPCODE(0xdd, o6_startObjectQuick); + OPCODE(0xde, o6_startScriptQuick2); + OPCODE(0xdf, o6_getState); + /* E0 */ + OPCODE(0xe0, o71_compareString); + OPCODE(0xe1, o71_copyString); + OPCODE(0xe2, o71_appendString); + OPCODE(0xe3, o71_concatString); + /* E4 */ + OPCODE(0xe4, o70_getStringLen); + OPCODE(0xe5, o71_getStringLenForWidth); + OPCODE(0xe6, o80_stringToInt); + OPCODE(0xe7, o71_getCharIndexInString); + /* E8 */ + OPCODE(0xe8, o71_getStringWidth); + OPCODE(0xe9, o60_readFilePos); + OPCODE(0xea, o72_getTimer); + OPCODE(0xeb, o6_getVerbEntrypoint); + /* EC */ + OPCODE(0xec, o100_getVideoData); + OPCODE(0xed, o6_invalid); + OPCODE(0xee, o6_invalid); + OPCODE(0xef, o6_invalid); + /* F0 */ + OPCODE(0xf0, o6_invalid); + OPCODE(0xf1, o6_invalid); + OPCODE(0xf2, o6_invalid); + OPCODE(0xf3, o6_invalid); + /* F4 */ + OPCODE(0xf4, o6_invalid); + OPCODE(0xf5, o6_invalid); + OPCODE(0xf6, o6_invalid); + OPCODE(0xf7, o6_invalid); + /* F8 */ + OPCODE(0xf8, o6_invalid); + OPCODE(0xf9, o6_invalid); + OPCODE(0xfa, o6_invalid); + OPCODE(0xfb, o6_invalid); + /* FC */ + OPCODE(0xfc, o6_invalid); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } void ScummEngine_v100he::o100_actorOps() { diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index 86ce492033..a7c389d831 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -63,342 +63,329 @@ static int virtScreenSavePack(byte *dst, byte *src, int len, int unk); // transparency in akos.cpp // negative size in file read/write -#define OPCODE(x) _OPCODE(ScummEngine_v60he, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v60he, x) void ScummEngine_v60he::setupOpcodes() { - static const OpcodeEntryv60he opcodes[256] = { - /* 00 */ - OPCODE(o6_pushByte), - OPCODE(o6_pushWord), - OPCODE(o6_pushByteVar), - OPCODE(o6_pushWordVar), - /* 04 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayRead), - OPCODE(o6_wordArrayRead), - /* 08 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayIndexedRead), - OPCODE(o6_wordArrayIndexedRead), - /* 0C */ - OPCODE(o6_dup), - OPCODE(o6_not), - OPCODE(o6_eq), - OPCODE(o6_neq), - /* 10 */ - OPCODE(o6_gt), - OPCODE(o6_lt), - OPCODE(o6_le), - OPCODE(o6_ge), - /* 14 */ - OPCODE(o6_add), - OPCODE(o6_sub), - OPCODE(o6_mul), - OPCODE(o6_div), - /* 18 */ - OPCODE(o6_land), - OPCODE(o6_lor), - OPCODE(o6_pop), - OPCODE(o6_invalid), - /* 1C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 20 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 24 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 28 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 2C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 30 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 34 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 38 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 3C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 40 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_writeByteVar), - OPCODE(o6_writeWordVar), - /* 44 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayWrite), - OPCODE(o6_wordArrayWrite), - /* 48 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayIndexedWrite), - OPCODE(o6_wordArrayIndexedWrite), - /* 4C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteVarInc), - OPCODE(o6_wordVarInc), - /* 50 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayInc), - OPCODE(o6_wordArrayInc), - /* 54 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteVarDec), - OPCODE(o6_wordVarDec), - /* 58 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayDec), - OPCODE(o6_wordArrayDec), - /* 5C */ - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o6_startScript), - OPCODE(o6_startScriptQuick), - /* 60 */ - OPCODE(o6_startObject), - OPCODE(o6_drawObject), - OPCODE(o6_drawObjectAt), - OPCODE(o6_invalid), - /* 64 */ - OPCODE(o6_invalid), - OPCODE(o6_stopObjectCode), - OPCODE(o6_stopObjectCode), - OPCODE(o6_endCutscene), - /* 68 */ - OPCODE(o6_cutscene), - OPCODE(o6_stopMusic), - OPCODE(o6_freezeUnfreeze), - OPCODE(o6_cursorCommand), - /* 6C */ - OPCODE(o6_breakHere), - OPCODE(o6_ifClassOfIs), - OPCODE(o6_setClass), - OPCODE(o6_getState), - /* 70 */ - OPCODE(o60_setState), - OPCODE(o6_setOwner), - OPCODE(o6_getOwner), - OPCODE(o6_jump), - /* 74 */ - OPCODE(o6_startSound), - OPCODE(o6_stopSound), - OPCODE(o6_startMusic), - OPCODE(o6_stopObjectScript), - /* 78 */ - OPCODE(o6_panCameraTo), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_setCameraAt), - OPCODE(o6_loadRoom), - /* 7C */ - OPCODE(o6_stopScript), - OPCODE(o6_walkActorToObj), - OPCODE(o6_walkActorTo), - OPCODE(o6_putActorAtXY), - /* 80 */ - OPCODE(o6_putActorAtObject), - OPCODE(o6_faceActor), - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - /* 84 */ - OPCODE(o6_pickupObject), - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_invalid), - OPCODE(o6_getRandomNumber), - /* 88 */ - OPCODE(o6_getRandomNumberRange), - OPCODE(o6_invalid), - OPCODE(o6_getActorMoving), - OPCODE(o6_isScriptRunning), - /* 8C */ - OPCODE(o6_getActorRoom), - OPCODE(o6_getObjectX), - OPCODE(o6_getObjectY), - OPCODE(o6_getObjectOldDir), - /* 90 */ - OPCODE(o6_getActorWalkBox), - OPCODE(o6_getActorCostume), - OPCODE(o6_findInventory), - OPCODE(o6_getInventoryCount), - /* 94 */ - OPCODE(o6_getVerbFromXY), - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o6_setObjectName), - /* 98 */ - OPCODE(o6_isSoundRunning), - OPCODE(o6_setBoxFlags), - OPCODE(o6_invalid), - OPCODE(o6_resourceRoutines), - /* 9C */ - OPCODE(o60_roomOps), - OPCODE(o60_actorOps), - OPCODE(o6_verbOps), - OPCODE(o6_getActorFromXY), - /* A0 */ - OPCODE(o6_findObject), - OPCODE(o6_pseudoRoom), - OPCODE(o6_getActorElevation), - OPCODE(o6_getVerbEntrypoint), - /* A4 */ - OPCODE(o6_arrayOps), - OPCODE(o6_saveRestoreVerbs), - OPCODE(o6_drawBox), - OPCODE(o6_pop), - /* A8 */ - OPCODE(o6_getActorWidth), - OPCODE(o6_wait), - OPCODE(o6_getActorScaleX), - OPCODE(o6_getActorAnimCounter), - /* AC */ - OPCODE(o6_invalid), - OPCODE(o6_isAnyOf), - OPCODE(o6_systemOps), - OPCODE(o6_isActorInBox), - /* B0 */ - OPCODE(o6_delay), - OPCODE(o6_delaySeconds), - OPCODE(o6_delayMinutes), - OPCODE(o6_stopSentence), - /* B4 */ - OPCODE(o6_printLine), - OPCODE(o6_printText), - OPCODE(o6_printDebug), - OPCODE(o6_printSystem), - /* B8 */ - OPCODE(o6_printActor), - OPCODE(o6_printEgo), - OPCODE(o6_talkActor), - OPCODE(o6_talkEgo), - /* BC */ - OPCODE(o6_dimArray), - OPCODE(o6_stopObjectCode), - OPCODE(o6_startObjectQuick), - OPCODE(o6_startScriptQuick2), - /* C0 */ - OPCODE(o6_dim2dimArray), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C4 */ - OPCODE(o6_abs), - OPCODE(o6_distObjectObject), - OPCODE(o6_distObjectPt), - OPCODE(o6_distPtPt), - /* C8 */ - OPCODE(o60_kernelGetFunctions), - OPCODE(o60_kernelSetFunctions), - OPCODE(o6_delayFrames), - OPCODE(o6_pickOneOf), - /* CC */ - OPCODE(o6_pickOneOfDefault), - OPCODE(o6_stampObject), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* D0 */ - OPCODE(o6_getDateTime), - OPCODE(o6_stopTalking), - OPCODE(o6_getAnimateVariable), - OPCODE(o6_invalid), - /* D4 */ - OPCODE(o6_shuffle), - OPCODE(o6_jumpToScript), - OPCODE(o6_band), - OPCODE(o6_bor), - /* D8 */ - OPCODE(o6_isRoomScriptRunning), - OPCODE(o60_closeFile), - OPCODE(o60_openFile), - OPCODE(o60_readFile), - /* DC */ - OPCODE(o60_writeFile), - OPCODE(o6_findAllObjects), - OPCODE(o60_deleteFile), - OPCODE(o60_rename), - /* E0 */ - OPCODE(o60_soundOps), - OPCODE(o6_getPixel), - OPCODE(o60_localizeArrayToScript), - OPCODE(o6_pickVarRandom), - /* E4 */ - OPCODE(o6_setBoxSet), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* E8 */ - OPCODE(o6_invalid), - OPCODE(o60_seekFilePos), - OPCODE(o60_redimArray), - OPCODE(o60_readFilePos), - /* EC */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F0 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F4 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F8 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* FC */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesv60he = opcodes; -} - -void ScummEngine_v60he::executeOpcode(byte i) { - OpcodeProcv60he op = _opcodesv60he[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v60he::getOpcodeDesc(byte i) { - return _opcodesv60he[i].desc; + /* 00 */ + OPCODE(0x00, o6_pushByte); + OPCODE(0x01, o6_pushWord); + OPCODE(0x02, o6_pushByteVar); + OPCODE(0x03, o6_pushWordVar); + /* 04 */ + OPCODE(0x04, o6_invalid); + OPCODE(0x05, o6_invalid); + OPCODE(0x06, o6_byteArrayRead); + OPCODE(0x07, o6_wordArrayRead); + /* 08 */ + OPCODE(0x08, o6_invalid); + OPCODE(0x09, o6_invalid); + OPCODE(0x0a, o6_byteArrayIndexedRead); + OPCODE(0x0b, o6_wordArrayIndexedRead); + /* 0C */ + OPCODE(0x0c, o6_dup); + OPCODE(0x0d, o6_not); + OPCODE(0x0e, o6_eq); + OPCODE(0x0f, o6_neq); + /* 10 */ + OPCODE(0x10, o6_gt); + OPCODE(0x11, o6_lt); + OPCODE(0x12, o6_le); + OPCODE(0x13, o6_ge); + /* 14 */ + OPCODE(0x14, o6_add); + OPCODE(0x15, o6_sub); + OPCODE(0x16, o6_mul); + OPCODE(0x17, o6_div); + /* 18 */ + OPCODE(0x18, o6_land); + OPCODE(0x19, o6_lor); + OPCODE(0x1a, o6_pop); + OPCODE(0x1b, o6_invalid); + /* 1C */ + OPCODE(0x1c, o6_invalid); + OPCODE(0x1d, o6_invalid); + OPCODE(0x1e, o6_invalid); + OPCODE(0x1f, o6_invalid); + /* 20 */ + OPCODE(0x20, o6_invalid); + OPCODE(0x21, o6_invalid); + OPCODE(0x22, o6_invalid); + OPCODE(0x23, o6_invalid); + /* 24 */ + OPCODE(0x24, o6_invalid); + OPCODE(0x25, o6_invalid); + OPCODE(0x26, o6_invalid); + OPCODE(0x27, o6_invalid); + /* 28 */ + OPCODE(0x28, o6_invalid); + OPCODE(0x29, o6_invalid); + OPCODE(0x2a, o6_invalid); + OPCODE(0x2b, o6_invalid); + /* 2C */ + OPCODE(0x2c, o6_invalid); + OPCODE(0x2d, o6_invalid); + OPCODE(0x2e, o6_invalid); + OPCODE(0x2f, o6_invalid); + /* 30 */ + OPCODE(0x30, o6_invalid); + OPCODE(0x31, o6_invalid); + OPCODE(0x32, o6_invalid); + OPCODE(0x33, o6_invalid); + /* 34 */ + OPCODE(0x34, o6_invalid); + OPCODE(0x35, o6_invalid); + OPCODE(0x36, o6_invalid); + OPCODE(0x37, o6_invalid); + /* 38 */ + OPCODE(0x38, o6_invalid); + OPCODE(0x39, o6_invalid); + OPCODE(0x3a, o6_invalid); + OPCODE(0x3b, o6_invalid); + /* 3C */ + OPCODE(0x3c, o6_invalid); + OPCODE(0x3d, o6_invalid); + OPCODE(0x3e, o6_invalid); + OPCODE(0x3f, o6_invalid); + /* 40 */ + OPCODE(0x40, o6_invalid); + OPCODE(0x41, o6_invalid); + OPCODE(0x42, o6_writeByteVar); + OPCODE(0x43, o6_writeWordVar); + /* 44 */ + OPCODE(0x44, o6_invalid); + OPCODE(0x45, o6_invalid); + OPCODE(0x46, o6_byteArrayWrite); + OPCODE(0x47, o6_wordArrayWrite); + /* 48 */ + OPCODE(0x48, o6_invalid); + OPCODE(0x49, o6_invalid); + OPCODE(0x4a, o6_byteArrayIndexedWrite); + OPCODE(0x4b, o6_wordArrayIndexedWrite); + /* 4C */ + OPCODE(0x4c, o6_invalid); + OPCODE(0x4d, o6_invalid); + OPCODE(0x4e, o6_byteVarInc); + OPCODE(0x4f, o6_wordVarInc); + /* 50 */ + OPCODE(0x50, o6_invalid); + OPCODE(0x51, o6_invalid); + OPCODE(0x52, o6_byteArrayInc); + OPCODE(0x53, o6_wordArrayInc); + /* 54 */ + OPCODE(0x54, o6_invalid); + OPCODE(0x55, o6_invalid); + OPCODE(0x56, o6_byteVarDec); + OPCODE(0x57, o6_wordVarDec); + /* 58 */ + OPCODE(0x58, o6_invalid); + OPCODE(0x59, o6_invalid); + OPCODE(0x5a, o6_byteArrayDec); + OPCODE(0x5b, o6_wordArrayDec); + /* 5C */ + OPCODE(0x5c, o6_if); + OPCODE(0x5d, o6_ifNot); + OPCODE(0x5e, o6_startScript); + OPCODE(0x5f, o6_startScriptQuick); + /* 60 */ + OPCODE(0x60, o6_startObject); + OPCODE(0x61, o6_drawObject); + OPCODE(0x62, o6_drawObjectAt); + OPCODE(0x63, o6_invalid); + /* 64 */ + OPCODE(0x64, o6_invalid); + OPCODE(0x65, o6_stopObjectCode); + OPCODE(0x66, o6_stopObjectCode); + OPCODE(0x67, o6_endCutscene); + /* 68 */ + OPCODE(0x68, o6_cutscene); + OPCODE(0x69, o6_stopMusic); + OPCODE(0x6a, o6_freezeUnfreeze); + OPCODE(0x6b, o6_cursorCommand); + /* 6C */ + OPCODE(0x6c, o6_breakHere); + OPCODE(0x6d, o6_ifClassOfIs); + OPCODE(0x6e, o6_setClass); + OPCODE(0x6f, o6_getState); + /* 70 */ + OPCODE(0x70, o60_setState); + OPCODE(0x71, o6_setOwner); + OPCODE(0x72, o6_getOwner); + OPCODE(0x73, o6_jump); + /* 74 */ + OPCODE(0x74, o6_startSound); + OPCODE(0x75, o6_stopSound); + OPCODE(0x76, o6_startMusic); + OPCODE(0x77, o6_stopObjectScript); + /* 78 */ + OPCODE(0x78, o6_panCameraTo); + OPCODE(0x79, o6_actorFollowCamera); + OPCODE(0x7a, o6_setCameraAt); + OPCODE(0x7b, o6_loadRoom); + /* 7C */ + OPCODE(0x7c, o6_stopScript); + OPCODE(0x7d, o6_walkActorToObj); + OPCODE(0x7e, o6_walkActorTo); + OPCODE(0x7f, o6_putActorAtXY); + /* 80 */ + OPCODE(0x80, o6_putActorAtObject); + OPCODE(0x81, o6_faceActor); + OPCODE(0x82, o6_animateActor); + OPCODE(0x83, o6_doSentence); + /* 84 */ + OPCODE(0x84, o6_pickupObject); + OPCODE(0x85, o6_loadRoomWithEgo); + OPCODE(0x86, o6_invalid); + OPCODE(0x87, o6_getRandomNumber); + /* 88 */ + OPCODE(0x88, o6_getRandomNumberRange); + OPCODE(0x89, o6_invalid); + OPCODE(0x8a, o6_getActorMoving); + OPCODE(0x8b, o6_isScriptRunning); + /* 8C */ + OPCODE(0x8c, o6_getActorRoom); + OPCODE(0x8d, o6_getObjectX); + OPCODE(0x8e, o6_getObjectY); + OPCODE(0x8f, o6_getObjectOldDir); + /* 90 */ + OPCODE(0x90, o6_getActorWalkBox); + OPCODE(0x91, o6_getActorCostume); + OPCODE(0x92, o6_findInventory); + OPCODE(0x93, o6_getInventoryCount); + /* 94 */ + OPCODE(0x94, o6_getVerbFromXY); + OPCODE(0x95, o6_beginOverride); + OPCODE(0x96, o6_endOverride); + OPCODE(0x97, o6_setObjectName); + /* 98 */ + OPCODE(0x98, o6_isSoundRunning); + OPCODE(0x99, o6_setBoxFlags); + OPCODE(0x9a, o6_invalid); + OPCODE(0x9b, o6_resourceRoutines); + /* 9C */ + OPCODE(0x9c, o60_roomOps); + OPCODE(0x9d, o60_actorOps); + OPCODE(0x9e, o6_verbOps); + OPCODE(0x9f, o6_getActorFromXY); + /* A0 */ + OPCODE(0xa0, o6_findObject); + OPCODE(0xa1, o6_pseudoRoom); + OPCODE(0xa2, o6_getActorElevation); + OPCODE(0xa3, o6_getVerbEntrypoint); + /* A4 */ + OPCODE(0xa4, o6_arrayOps); + OPCODE(0xa5, o6_saveRestoreVerbs); + OPCODE(0xa6, o6_drawBox); + OPCODE(0xa7, o6_pop); + /* A8 */ + OPCODE(0xa8, o6_getActorWidth); + OPCODE(0xa9, o6_wait); + OPCODE(0xaa, o6_getActorScaleX); + OPCODE(0xab, o6_getActorAnimCounter); + /* AC */ + OPCODE(0xac, o6_invalid); + OPCODE(0xad, o6_isAnyOf); + OPCODE(0xae, o6_systemOps); + OPCODE(0xaf, o6_isActorInBox); + /* B0 */ + OPCODE(0xb0, o6_delay); + OPCODE(0xb1, o6_delaySeconds); + OPCODE(0xb2, o6_delayMinutes); + OPCODE(0xb3, o6_stopSentence); + /* B4 */ + OPCODE(0xb4, o6_printLine); + OPCODE(0xb5, o6_printText); + OPCODE(0xb6, o6_printDebug); + OPCODE(0xb7, o6_printSystem); + /* B8 */ + OPCODE(0xb8, o6_printActor); + OPCODE(0xb9, o6_printEgo); + OPCODE(0xba, o6_talkActor); + OPCODE(0xbb, o6_talkEgo); + /* BC */ + OPCODE(0xbc, o6_dimArray); + OPCODE(0xbd, o6_stopObjectCode); + OPCODE(0xbe, o6_startObjectQuick); + OPCODE(0xbf, o6_startScriptQuick2); + /* C0 */ + OPCODE(0xc0, o6_dim2dimArray); + OPCODE(0xc1, o6_invalid); + OPCODE(0xc2, o6_invalid); + OPCODE(0xc3, o6_invalid); + /* C4 */ + OPCODE(0xc4, o6_abs); + OPCODE(0xc5, o6_distObjectObject); + OPCODE(0xc6, o6_distObjectPt); + OPCODE(0xc7, o6_distPtPt); + /* C8 */ + OPCODE(0xc8, o60_kernelGetFunctions); + OPCODE(0xc9, o60_kernelSetFunctions); + OPCODE(0xca, o6_delayFrames); + OPCODE(0xcb, o6_pickOneOf); + /* CC */ + OPCODE(0xcc, o6_pickOneOfDefault); + OPCODE(0xcd, o6_stampObject); + OPCODE(0xce, o6_invalid); + OPCODE(0xcf, o6_invalid); + /* D0 */ + OPCODE(0xd0, o6_getDateTime); + OPCODE(0xd1, o6_stopTalking); + OPCODE(0xd2, o6_getAnimateVariable); + OPCODE(0xd3, o6_invalid); + /* D4 */ + OPCODE(0xd4, o6_shuffle); + OPCODE(0xd5, o6_jumpToScript); + OPCODE(0xd6, o6_band); + OPCODE(0xd7, o6_bor); + /* D8 */ + OPCODE(0xd8, o6_isRoomScriptRunning); + OPCODE(0xd9, o60_closeFile); + OPCODE(0xda, o60_openFile); + OPCODE(0xdb, o60_readFile); + /* DC */ + OPCODE(0xdc, o60_writeFile); + OPCODE(0xdd, o6_findAllObjects); + OPCODE(0xde, o60_deleteFile); + OPCODE(0xdf, o60_rename); + /* E0 */ + OPCODE(0xe0, o60_soundOps); + OPCODE(0xe1, o6_getPixel); + OPCODE(0xe2, o60_localizeArrayToScript); + OPCODE(0xe3, o6_pickVarRandom); + /* E4 */ + OPCODE(0xe4, o6_setBoxSet); + OPCODE(0xe5, o6_invalid); + OPCODE(0xe6, o6_invalid); + OPCODE(0xe7, o6_invalid); + /* E8 */ + OPCODE(0xe8, o6_invalid); + OPCODE(0xe9, o60_seekFilePos); + OPCODE(0xea, o60_redimArray); + OPCODE(0xeb, o60_readFilePos); + /* EC */ + OPCODE(0xec, o6_invalid); + OPCODE(0xed, o6_invalid); + OPCODE(0xee, o6_invalid); + OPCODE(0xef, o6_invalid); + /* F0 */ + OPCODE(0xf0, o6_invalid); + OPCODE(0xf1, o6_invalid); + OPCODE(0xf2, o6_invalid); + OPCODE(0xf3, o6_invalid); + /* F4 */ + OPCODE(0xf4, o6_invalid); + OPCODE(0xf5, o6_invalid); + OPCODE(0xf6, o6_invalid); + OPCODE(0xf7, o6_invalid); + /* F8 */ + OPCODE(0xf8, o6_invalid); + OPCODE(0xf9, o6_invalid); + OPCODE(0xfa, o6_invalid); + OPCODE(0xfb, o6_invalid); + /* FC */ + OPCODE(0xfc, o6_invalid); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } int ScummEngine_v60he::convertFilePath(byte *dst) { diff --git a/engines/scumm/he/script_v70he.cpp b/engines/scumm/he/script_v70he.cpp index 577e7c3d99..36c29f28e5 100644 --- a/engines/scumm/he/script_v70he.cpp +++ b/engines/scumm/he/script_v70he.cpp @@ -38,342 +38,329 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v70he, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v70he, x) void ScummEngine_v70he::setupOpcodes() { - static const OpcodeEntryv70he opcodes[256] = { - /* 00 */ - OPCODE(o6_pushByte), - OPCODE(o6_pushWord), - OPCODE(o6_pushByteVar), - OPCODE(o6_pushWordVar), - /* 04 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayRead), - OPCODE(o6_wordArrayRead), - /* 08 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayIndexedRead), - OPCODE(o6_wordArrayIndexedRead), - /* 0C */ - OPCODE(o6_dup), - OPCODE(o6_not), - OPCODE(o6_eq), - OPCODE(o6_neq), - /* 10 */ - OPCODE(o6_gt), - OPCODE(o6_lt), - OPCODE(o6_le), - OPCODE(o6_ge), - /* 14 */ - OPCODE(o6_add), - OPCODE(o6_sub), - OPCODE(o6_mul), - OPCODE(o6_div), - /* 18 */ - OPCODE(o6_land), - OPCODE(o6_lor), - OPCODE(o6_pop), - OPCODE(o6_invalid), - /* 1C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 20 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 24 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 28 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 2C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 30 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 34 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 38 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 3C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 40 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_writeByteVar), - OPCODE(o6_writeWordVar), - /* 44 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayWrite), - OPCODE(o6_wordArrayWrite), - /* 48 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayIndexedWrite), - OPCODE(o6_wordArrayIndexedWrite), - /* 4C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteVarInc), - OPCODE(o6_wordVarInc), - /* 50 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayInc), - OPCODE(o6_wordArrayInc), - /* 54 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteVarDec), - OPCODE(o6_wordVarDec), - /* 58 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayDec), - OPCODE(o6_wordArrayDec), - /* 5C */ - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o6_startScript), - OPCODE(o6_startScriptQuick), - /* 60 */ - OPCODE(o6_startObject), - OPCODE(o6_drawObject), - OPCODE(o6_drawObjectAt), - OPCODE(o6_invalid), - /* 64 */ - OPCODE(o6_invalid), - OPCODE(o6_stopObjectCode), - OPCODE(o6_stopObjectCode), - OPCODE(o6_endCutscene), - /* 68 */ - OPCODE(o6_cutscene), - OPCODE(o6_stopMusic), - OPCODE(o6_freezeUnfreeze), - OPCODE(o6_cursorCommand), - /* 6C */ - OPCODE(o6_breakHere), - OPCODE(o6_ifClassOfIs), - OPCODE(o6_setClass), - OPCODE(o6_getState), - /* 70 */ - OPCODE(o60_setState), - OPCODE(o6_setOwner), - OPCODE(o6_getOwner), - OPCODE(o6_jump), - /* 74 */ - OPCODE(o70_startSound), - OPCODE(o6_stopSound), - OPCODE(o6_startMusic), - OPCODE(o6_stopObjectScript), - /* 78 */ - OPCODE(o6_panCameraTo), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_setCameraAt), - OPCODE(o6_loadRoom), - /* 7C */ - OPCODE(o6_stopScript), - OPCODE(o6_walkActorToObj), - OPCODE(o6_walkActorTo), - OPCODE(o6_putActorAtXY), - /* 80 */ - OPCODE(o6_putActorAtObject), - OPCODE(o6_faceActor), - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - /* 84 */ - OPCODE(o70_pickupObject), - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_invalid), - OPCODE(o6_getRandomNumber), - /* 88 */ - OPCODE(o6_getRandomNumberRange), - OPCODE(o6_invalid), - OPCODE(o6_getActorMoving), - OPCODE(o6_isScriptRunning), - /* 8C */ - OPCODE(o70_getActorRoom), - OPCODE(o6_getObjectX), - OPCODE(o6_getObjectY), - OPCODE(o6_getObjectOldDir), - /* 90 */ - OPCODE(o6_getActorWalkBox), - OPCODE(o6_getActorCostume), - OPCODE(o6_findInventory), - OPCODE(o6_getInventoryCount), - /* 94 */ - OPCODE(o6_getVerbFromXY), - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o6_setObjectName), - /* 98 */ - OPCODE(o6_isSoundRunning), - OPCODE(o6_setBoxFlags), - OPCODE(o6_invalid), - OPCODE(o70_resourceRoutines), - /* 9C */ - OPCODE(o60_roomOps), - OPCODE(o60_actorOps), - OPCODE(o6_verbOps), - OPCODE(o6_getActorFromXY), - /* A0 */ - OPCODE(o6_findObject), - OPCODE(o6_pseudoRoom), - OPCODE(o6_getActorElevation), - OPCODE(o6_getVerbEntrypoint), - /* A4 */ - OPCODE(o6_arrayOps), - OPCODE(o6_saveRestoreVerbs), - OPCODE(o6_drawBox), - OPCODE(o6_pop), - /* A8 */ - OPCODE(o6_getActorWidth), - OPCODE(o6_wait), - OPCODE(o6_getActorScaleX), - OPCODE(o6_getActorAnimCounter), - /* AC */ - OPCODE(o6_invalid), - OPCODE(o6_isAnyOf), - OPCODE(o70_systemOps), - OPCODE(o6_isActorInBox), - /* B0 */ - OPCODE(o6_delay), - OPCODE(o6_delaySeconds), - OPCODE(o6_delayMinutes), - OPCODE(o6_stopSentence), - /* B4 */ - OPCODE(o6_printLine), - OPCODE(o6_printText), - OPCODE(o6_printDebug), - OPCODE(o6_printSystem), - /* B8 */ - OPCODE(o6_printActor), - OPCODE(o6_printEgo), - OPCODE(o6_talkActor), - OPCODE(o6_talkEgo), - /* BC */ - OPCODE(o6_dimArray), - OPCODE(o6_stopObjectCode), - OPCODE(o6_startObjectQuick), - OPCODE(o6_startScriptQuick2), - /* C0 */ - OPCODE(o6_dim2dimArray), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C4 */ - OPCODE(o6_abs), - OPCODE(o6_distObjectObject), - OPCODE(o6_distObjectPt), - OPCODE(o6_distPtPt), - /* C8 */ - OPCODE(o60_kernelGetFunctions), - OPCODE(o60_kernelSetFunctions), - OPCODE(o6_delayFrames), - OPCODE(o6_pickOneOf), - /* CC */ - OPCODE(o6_pickOneOfDefault), - OPCODE(o6_stampObject), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* D0 */ - OPCODE(o6_getDateTime), - OPCODE(o6_stopTalking), - OPCODE(o6_getAnimateVariable), - OPCODE(o6_invalid), - /* D4 */ - OPCODE(o6_shuffle), - OPCODE(o6_jumpToScript), - OPCODE(o6_band), - OPCODE(o6_bor), - /* D8 */ - OPCODE(o6_isRoomScriptRunning), - OPCODE(o60_closeFile), - OPCODE(o60_openFile), - OPCODE(o60_readFile), - /* DC */ - OPCODE(o60_writeFile), - OPCODE(o6_findAllObjects), - OPCODE(o60_deleteFile), - OPCODE(o60_rename), - /* E0 */ - OPCODE(o60_soundOps), - OPCODE(o6_getPixel), - OPCODE(o60_localizeArrayToScript), - OPCODE(o6_pickVarRandom), - /* E4 */ - OPCODE(o6_setBoxSet), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* E8 */ - OPCODE(o6_invalid), - OPCODE(o60_seekFilePos), - OPCODE(o60_redimArray), - OPCODE(o60_readFilePos), - /* EC */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o70_getStringLen), - OPCODE(o6_invalid), - /* F0 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o70_isResourceLoaded), - OPCODE(o70_readINI), - /* F4 */ - OPCODE(o70_writeINI), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F8 */ - OPCODE(o6_invalid), - OPCODE(o70_createDirectory), - OPCODE(o70_setSystemMessage), - OPCODE(o6_invalid), - /* FC */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesv70he = opcodes; -} - -void ScummEngine_v70he::executeOpcode(byte i) { - OpcodeProcv70he op = _opcodesv70he[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v70he::getOpcodeDesc(byte i) { - return _opcodesv70he[i].desc; + /* 00 */ + OPCODE(0x00, o6_pushByte); + OPCODE(0x01, o6_pushWord); + OPCODE(0x02, o6_pushByteVar); + OPCODE(0x03, o6_pushWordVar); + /* 04 */ + OPCODE(0x04, o6_invalid); + OPCODE(0x05, o6_invalid); + OPCODE(0x06, o6_byteArrayRead); + OPCODE(0x07, o6_wordArrayRead); + /* 08 */ + OPCODE(0x08, o6_invalid); + OPCODE(0x09, o6_invalid); + OPCODE(0x0a, o6_byteArrayIndexedRead); + OPCODE(0x0b, o6_wordArrayIndexedRead); + /* 0C */ + OPCODE(0x0c, o6_dup); + OPCODE(0x0d, o6_not); + OPCODE(0x0e, o6_eq); + OPCODE(0x0f, o6_neq); + /* 10 */ + OPCODE(0x10, o6_gt); + OPCODE(0x11, o6_lt); + OPCODE(0x12, o6_le); + OPCODE(0x13, o6_ge); + /* 14 */ + OPCODE(0x14, o6_add); + OPCODE(0x15, o6_sub); + OPCODE(0x16, o6_mul); + OPCODE(0x17, o6_div); + /* 18 */ + OPCODE(0x18, o6_land); + OPCODE(0x19, o6_lor); + OPCODE(0x1a, o6_pop); + OPCODE(0x1b, o6_invalid); + /* 1C */ + OPCODE(0x1c, o6_invalid); + OPCODE(0x1d, o6_invalid); + OPCODE(0x1e, o6_invalid); + OPCODE(0x1f, o6_invalid); + /* 20 */ + OPCODE(0x20, o6_invalid); + OPCODE(0x21, o6_invalid); + OPCODE(0x22, o6_invalid); + OPCODE(0x23, o6_invalid); + /* 24 */ + OPCODE(0x24, o6_invalid); + OPCODE(0x25, o6_invalid); + OPCODE(0x26, o6_invalid); + OPCODE(0x27, o6_invalid); + /* 28 */ + OPCODE(0x28, o6_invalid); + OPCODE(0x29, o6_invalid); + OPCODE(0x2a, o6_invalid); + OPCODE(0x2b, o6_invalid); + /* 2C */ + OPCODE(0x2c, o6_invalid); + OPCODE(0x2d, o6_invalid); + OPCODE(0x2e, o6_invalid); + OPCODE(0x2f, o6_invalid); + /* 30 */ + OPCODE(0x30, o6_invalid); + OPCODE(0x31, o6_invalid); + OPCODE(0x32, o6_invalid); + OPCODE(0x33, o6_invalid); + /* 34 */ + OPCODE(0x34, o6_invalid); + OPCODE(0x35, o6_invalid); + OPCODE(0x36, o6_invalid); + OPCODE(0x37, o6_invalid); + /* 38 */ + OPCODE(0x38, o6_invalid); + OPCODE(0x39, o6_invalid); + OPCODE(0x3a, o6_invalid); + OPCODE(0x3b, o6_invalid); + /* 3C */ + OPCODE(0x3c, o6_invalid); + OPCODE(0x3d, o6_invalid); + OPCODE(0x3e, o6_invalid); + OPCODE(0x3f, o6_invalid); + /* 40 */ + OPCODE(0x40, o6_invalid); + OPCODE(0x41, o6_invalid); + OPCODE(0x42, o6_writeByteVar); + OPCODE(0x43, o6_writeWordVar); + /* 44 */ + OPCODE(0x44, o6_invalid); + OPCODE(0x45, o6_invalid); + OPCODE(0x46, o6_byteArrayWrite); + OPCODE(0x47, o6_wordArrayWrite); + /* 48 */ + OPCODE(0x48, o6_invalid); + OPCODE(0x49, o6_invalid); + OPCODE(0x4a, o6_byteArrayIndexedWrite); + OPCODE(0x4b, o6_wordArrayIndexedWrite); + /* 4C */ + OPCODE(0x4c, o6_invalid); + OPCODE(0x4d, o6_invalid); + OPCODE(0x4e, o6_byteVarInc); + OPCODE(0x4f, o6_wordVarInc); + /* 50 */ + OPCODE(0x50, o6_invalid); + OPCODE(0x51, o6_invalid); + OPCODE(0x52, o6_byteArrayInc); + OPCODE(0x53, o6_wordArrayInc); + /* 54 */ + OPCODE(0x54, o6_invalid); + OPCODE(0x55, o6_invalid); + OPCODE(0x56, o6_byteVarDec); + OPCODE(0x57, o6_wordVarDec); + /* 58 */ + OPCODE(0x58, o6_invalid); + OPCODE(0x59, o6_invalid); + OPCODE(0x5a, o6_byteArrayDec); + OPCODE(0x5b, o6_wordArrayDec); + /* 5C */ + OPCODE(0x5c, o6_if); + OPCODE(0x5d, o6_ifNot); + OPCODE(0x5e, o6_startScript); + OPCODE(0x5f, o6_startScriptQuick); + /* 60 */ + OPCODE(0x60, o6_startObject); + OPCODE(0x61, o6_drawObject); + OPCODE(0x62, o6_drawObjectAt); + OPCODE(0x63, o6_invalid); + /* 64 */ + OPCODE(0x64, o6_invalid); + OPCODE(0x65, o6_stopObjectCode); + OPCODE(0x66, o6_stopObjectCode); + OPCODE(0x67, o6_endCutscene); + /* 68 */ + OPCODE(0x68, o6_cutscene); + OPCODE(0x69, o6_stopMusic); + OPCODE(0x6a, o6_freezeUnfreeze); + OPCODE(0x6b, o6_cursorCommand); + /* 6C */ + OPCODE(0x6c, o6_breakHere); + OPCODE(0x6d, o6_ifClassOfIs); + OPCODE(0x6e, o6_setClass); + OPCODE(0x6f, o6_getState); + /* 70 */ + OPCODE(0x70, o60_setState); + OPCODE(0x71, o6_setOwner); + OPCODE(0x72, o6_getOwner); + OPCODE(0x73, o6_jump); + /* 74 */ + OPCODE(0x74, o70_startSound); + OPCODE(0x75, o6_stopSound); + OPCODE(0x76, o6_startMusic); + OPCODE(0x77, o6_stopObjectScript); + /* 78 */ + OPCODE(0x78, o6_panCameraTo); + OPCODE(0x79, o6_actorFollowCamera); + OPCODE(0x7a, o6_setCameraAt); + OPCODE(0x7b, o6_loadRoom); + /* 7C */ + OPCODE(0x7c, o6_stopScript); + OPCODE(0x7d, o6_walkActorToObj); + OPCODE(0x7e, o6_walkActorTo); + OPCODE(0x7f, o6_putActorAtXY); + /* 80 */ + OPCODE(0x80, o6_putActorAtObject); + OPCODE(0x81, o6_faceActor); + OPCODE(0x82, o6_animateActor); + OPCODE(0x83, o6_doSentence); + /* 84 */ + OPCODE(0x84, o70_pickupObject); + OPCODE(0x85, o6_loadRoomWithEgo); + OPCODE(0x86, o6_invalid); + OPCODE(0x87, o6_getRandomNumber); + /* 88 */ + OPCODE(0x88, o6_getRandomNumberRange); + OPCODE(0x89, o6_invalid); + OPCODE(0x8a, o6_getActorMoving); + OPCODE(0x8b, o6_isScriptRunning); + /* 8C */ + OPCODE(0x8c, o70_getActorRoom); + OPCODE(0x8d, o6_getObjectX); + OPCODE(0x8e, o6_getObjectY); + OPCODE(0x8f, o6_getObjectOldDir); + /* 90 */ + OPCODE(0x90, o6_getActorWalkBox); + OPCODE(0x91, o6_getActorCostume); + OPCODE(0x92, o6_findInventory); + OPCODE(0x93, o6_getInventoryCount); + /* 94 */ + OPCODE(0x94, o6_getVerbFromXY); + OPCODE(0x95, o6_beginOverride); + OPCODE(0x96, o6_endOverride); + OPCODE(0x97, o6_setObjectName); + /* 98 */ + OPCODE(0x98, o6_isSoundRunning); + OPCODE(0x99, o6_setBoxFlags); + OPCODE(0x9a, o6_invalid); + OPCODE(0x9b, o70_resourceRoutines); + /* 9C */ + OPCODE(0x9c, o60_roomOps); + OPCODE(0x9d, o60_actorOps); + OPCODE(0x9e, o6_verbOps); + OPCODE(0x9f, o6_getActorFromXY); + /* A0 */ + OPCODE(0xa0, o6_findObject); + OPCODE(0xa1, o6_pseudoRoom); + OPCODE(0xa2, o6_getActorElevation); + OPCODE(0xa3, o6_getVerbEntrypoint); + /* A4 */ + OPCODE(0xa4, o6_arrayOps); + OPCODE(0xa5, o6_saveRestoreVerbs); + OPCODE(0xa6, o6_drawBox); + OPCODE(0xa7, o6_pop); + /* A8 */ + OPCODE(0xa8, o6_getActorWidth); + OPCODE(0xa9, o6_wait); + OPCODE(0xaa, o6_getActorScaleX); + OPCODE(0xab, o6_getActorAnimCounter); + /* AC */ + OPCODE(0xac, o6_invalid); + OPCODE(0xad, o6_isAnyOf); + OPCODE(0xae, o70_systemOps); + OPCODE(0xaf, o6_isActorInBox); + /* B0 */ + OPCODE(0xb0, o6_delay); + OPCODE(0xb1, o6_delaySeconds); + OPCODE(0xb2, o6_delayMinutes); + OPCODE(0xb3, o6_stopSentence); + /* B4 */ + OPCODE(0xb4, o6_printLine); + OPCODE(0xb5, o6_printText); + OPCODE(0xb6, o6_printDebug); + OPCODE(0xb7, o6_printSystem); + /* B8 */ + OPCODE(0xb8, o6_printActor); + OPCODE(0xb9, o6_printEgo); + OPCODE(0xba, o6_talkActor); + OPCODE(0xbb, o6_talkEgo); + /* BC */ + OPCODE(0xbc, o6_dimArray); + OPCODE(0xbd, o6_stopObjectCode); + OPCODE(0xbe, o6_startObjectQuick); + OPCODE(0xbf, o6_startScriptQuick2); + /* C0 */ + OPCODE(0xc0, o6_dim2dimArray); + OPCODE(0xc1, o6_invalid); + OPCODE(0xc2, o6_invalid); + OPCODE(0xc3, o6_invalid); + /* C4 */ + OPCODE(0xc4, o6_abs); + OPCODE(0xc5, o6_distObjectObject); + OPCODE(0xc6, o6_distObjectPt); + OPCODE(0xc7, o6_distPtPt); + /* C8 */ + OPCODE(0xc8, o60_kernelGetFunctions); + OPCODE(0xc9, o60_kernelSetFunctions); + OPCODE(0xca, o6_delayFrames); + OPCODE(0xcb, o6_pickOneOf); + /* CC */ + OPCODE(0xcc, o6_pickOneOfDefault); + OPCODE(0xcd, o6_stampObject); + OPCODE(0xce, o6_invalid); + OPCODE(0xcf, o6_invalid); + /* D0 */ + OPCODE(0xd0, o6_getDateTime); + OPCODE(0xd1, o6_stopTalking); + OPCODE(0xd2, o6_getAnimateVariable); + OPCODE(0xd3, o6_invalid); + /* D4 */ + OPCODE(0xd4, o6_shuffle); + OPCODE(0xd5, o6_jumpToScript); + OPCODE(0xd6, o6_band); + OPCODE(0xd7, o6_bor); + /* D8 */ + OPCODE(0xd8, o6_isRoomScriptRunning); + OPCODE(0xd9, o60_closeFile); + OPCODE(0xda, o60_openFile); + OPCODE(0xdb, o60_readFile); + /* DC */ + OPCODE(0xdc, o60_writeFile); + OPCODE(0xdd, o6_findAllObjects); + OPCODE(0xde, o60_deleteFile); + OPCODE(0xdf, o60_rename); + /* E0 */ + OPCODE(0xe0, o60_soundOps); + OPCODE(0xe1, o6_getPixel); + OPCODE(0xe2, o60_localizeArrayToScript); + OPCODE(0xe3, o6_pickVarRandom); + /* E4 */ + OPCODE(0xe4, o6_setBoxSet); + OPCODE(0xe5, o6_invalid); + OPCODE(0xe6, o6_invalid); + OPCODE(0xe7, o6_invalid); + /* E8 */ + OPCODE(0xe8, o6_invalid); + OPCODE(0xe9, o60_seekFilePos); + OPCODE(0xea, o60_redimArray); + OPCODE(0xeb, o60_readFilePos); + /* EC */ + OPCODE(0xec, o6_invalid); + OPCODE(0xed, o6_invalid); + OPCODE(0xee, o70_getStringLen); + OPCODE(0xef, o6_invalid); + /* F0 */ + OPCODE(0xf0, o6_invalid); + OPCODE(0xf1, o6_invalid); + OPCODE(0xf2, o70_isResourceLoaded); + OPCODE(0xf3, o70_readINI); + /* F4 */ + OPCODE(0xf4, o70_writeINI); + OPCODE(0xf5, o6_invalid); + OPCODE(0xf6, o6_invalid); + OPCODE(0xf7, o6_invalid); + /* F8 */ + OPCODE(0xf8, o6_invalid); + OPCODE(0xf9, o70_createDirectory); + OPCODE(0xfa, o70_setSystemMessage); + OPCODE(0xfb, o6_invalid); + /* FC */ + OPCODE(0xfc, o6_invalid); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } void ScummEngine_v70he::o70_startSound() { diff --git a/engines/scumm/he/script_v71he.cpp b/engines/scumm/he/script_v71he.cpp index 1338ab3db8..b2dd649264 100644 --- a/engines/scumm/he/script_v71he.cpp +++ b/engines/scumm/he/script_v71he.cpp @@ -30,342 +30,329 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v71he, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v71he, x) void ScummEngine_v71he::setupOpcodes() { - static const OpcodeEntryv71he opcodes[256] = { - /* 00 */ - OPCODE(o6_pushByte), - OPCODE(o6_pushWord), - OPCODE(o6_pushByteVar), - OPCODE(o6_pushWordVar), - /* 04 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayRead), - OPCODE(o6_wordArrayRead), - /* 08 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayIndexedRead), - OPCODE(o6_wordArrayIndexedRead), - /* 0C */ - OPCODE(o6_dup), - OPCODE(o6_not), - OPCODE(o6_eq), - OPCODE(o6_neq), - /* 10 */ - OPCODE(o6_gt), - OPCODE(o6_lt), - OPCODE(o6_le), - OPCODE(o6_ge), - /* 14 */ - OPCODE(o6_add), - OPCODE(o6_sub), - OPCODE(o6_mul), - OPCODE(o6_div), - /* 18 */ - OPCODE(o6_land), - OPCODE(o6_lor), - OPCODE(o6_pop), - OPCODE(o6_invalid), - /* 1C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 20 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 24 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 28 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 2C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 30 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 34 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 38 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 3C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 40 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_writeByteVar), - OPCODE(o6_writeWordVar), - /* 44 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayWrite), - OPCODE(o6_wordArrayWrite), - /* 48 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayIndexedWrite), - OPCODE(o6_wordArrayIndexedWrite), - /* 4C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteVarInc), - OPCODE(o6_wordVarInc), - /* 50 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayInc), - OPCODE(o6_wordArrayInc), - /* 54 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteVarDec), - OPCODE(o6_wordVarDec), - /* 58 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayDec), - OPCODE(o6_wordArrayDec), - /* 5C */ - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o6_startScript), - OPCODE(o6_startScriptQuick), - /* 60 */ - OPCODE(o6_startObject), - OPCODE(o6_drawObject), - OPCODE(o6_drawObjectAt), - OPCODE(o6_invalid), - /* 64 */ - OPCODE(o6_invalid), - OPCODE(o6_stopObjectCode), - OPCODE(o6_stopObjectCode), - OPCODE(o6_endCutscene), - /* 68 */ - OPCODE(o6_cutscene), - OPCODE(o6_stopMusic), - OPCODE(o6_freezeUnfreeze), - OPCODE(o6_cursorCommand), - /* 6C */ - OPCODE(o6_breakHere), - OPCODE(o6_ifClassOfIs), - OPCODE(o6_setClass), - OPCODE(o6_getState), - /* 70 */ - OPCODE(o60_setState), - OPCODE(o6_setOwner), - OPCODE(o6_getOwner), - OPCODE(o6_jump), - /* 74 */ - OPCODE(o70_startSound), - OPCODE(o6_stopSound), - OPCODE(o6_startMusic), - OPCODE(o6_stopObjectScript), - /* 78 */ - OPCODE(o6_panCameraTo), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_setCameraAt), - OPCODE(o6_loadRoom), - /* 7C */ - OPCODE(o6_stopScript), - OPCODE(o6_walkActorToObj), - OPCODE(o6_walkActorTo), - OPCODE(o6_putActorAtXY), - /* 80 */ - OPCODE(o6_putActorAtObject), - OPCODE(o6_faceActor), - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - /* 84 */ - OPCODE(o70_pickupObject), - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_invalid), - OPCODE(o6_getRandomNumber), - /* 88 */ - OPCODE(o6_getRandomNumberRange), - OPCODE(o6_invalid), - OPCODE(o6_getActorMoving), - OPCODE(o6_isScriptRunning), - /* 8C */ - OPCODE(o70_getActorRoom), - OPCODE(o6_getObjectX), - OPCODE(o6_getObjectY), - OPCODE(o6_getObjectOldDir), - /* 90 */ - OPCODE(o6_getActorWalkBox), - OPCODE(o6_getActorCostume), - OPCODE(o6_findInventory), - OPCODE(o6_getInventoryCount), - /* 94 */ - OPCODE(o6_getVerbFromXY), - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o6_setObjectName), - /* 98 */ - OPCODE(o6_isSoundRunning), - OPCODE(o6_setBoxFlags), - OPCODE(o6_invalid), - OPCODE(o70_resourceRoutines), - /* 9C */ - OPCODE(o60_roomOps), - OPCODE(o60_actorOps), - OPCODE(o6_verbOps), - OPCODE(o6_getActorFromXY), - /* A0 */ - OPCODE(o6_findObject), - OPCODE(o6_pseudoRoom), - OPCODE(o6_getActorElevation), - OPCODE(o6_getVerbEntrypoint), - /* A4 */ - OPCODE(o6_arrayOps), - OPCODE(o6_saveRestoreVerbs), - OPCODE(o6_drawBox), - OPCODE(o6_pop), - /* A8 */ - OPCODE(o6_getActorWidth), - OPCODE(o6_wait), - OPCODE(o6_getActorScaleX), - OPCODE(o6_getActorAnimCounter), - /* AC */ - OPCODE(o6_invalid), - OPCODE(o6_isAnyOf), - OPCODE(o70_systemOps), - OPCODE(o6_isActorInBox), - /* B0 */ - OPCODE(o6_delay), - OPCODE(o6_delaySeconds), - OPCODE(o6_delayMinutes), - OPCODE(o6_stopSentence), - /* B4 */ - OPCODE(o6_printLine), - OPCODE(o6_printText), - OPCODE(o6_printDebug), - OPCODE(o6_printSystem), - /* B8 */ - OPCODE(o6_printActor), - OPCODE(o6_printEgo), - OPCODE(o6_talkActor), - OPCODE(o6_talkEgo), - /* BC */ - OPCODE(o6_dimArray), - OPCODE(o6_stopObjectCode), - OPCODE(o6_startObjectQuick), - OPCODE(o6_startScriptQuick2), - /* C0 */ - OPCODE(o6_dim2dimArray), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C4 */ - OPCODE(o6_abs), - OPCODE(o6_distObjectObject), - OPCODE(o6_distObjectPt), - OPCODE(o6_distPtPt), - /* C8 */ - OPCODE(o60_kernelGetFunctions), - OPCODE(o71_kernelSetFunctions), - OPCODE(o6_delayFrames), - OPCODE(o6_pickOneOf), - /* CC */ - OPCODE(o6_pickOneOfDefault), - OPCODE(o6_stampObject), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* D0 */ - OPCODE(o6_getDateTime), - OPCODE(o6_stopTalking), - OPCODE(o6_getAnimateVariable), - OPCODE(o6_invalid), - /* D4 */ - OPCODE(o6_shuffle), - OPCODE(o6_jumpToScript), - OPCODE(o6_band), - OPCODE(o6_bor), - /* D8 */ - OPCODE(o6_isRoomScriptRunning), - OPCODE(o60_closeFile), - OPCODE(o60_openFile), - OPCODE(o60_readFile), - /* DC */ - OPCODE(o60_writeFile), - OPCODE(o6_findAllObjects), - OPCODE(o60_deleteFile), - OPCODE(o60_rename), - /* E0 */ - OPCODE(o60_soundOps), - OPCODE(o6_getPixel), - OPCODE(o60_localizeArrayToScript), - OPCODE(o6_pickVarRandom), - /* E4 */ - OPCODE(o6_setBoxSet), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* E8 */ - OPCODE(o6_invalid), - OPCODE(o60_seekFilePos), - OPCODE(o60_redimArray), - OPCODE(o60_readFilePos), - /* EC */ - OPCODE(o71_copyString), - OPCODE(o71_getStringWidth), - OPCODE(o70_getStringLen), - OPCODE(o71_appendString), - /* F0 */ - OPCODE(o71_concatString), - OPCODE(o71_compareString), - OPCODE(o70_isResourceLoaded), - OPCODE(o70_readINI), - /* F4 */ - OPCODE(o70_writeINI), - OPCODE(o71_getStringLenForWidth), - OPCODE(o71_getCharIndexInString), - OPCODE(o71_findBox), - /* F8 */ - OPCODE(o6_invalid), - OPCODE(o70_createDirectory), - OPCODE(o70_setSystemMessage), - OPCODE(o71_polygonOps), - /* FC */ - OPCODE(o71_polygonHit), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesv71he = opcodes; -} - -void ScummEngine_v71he::executeOpcode(byte i) { - OpcodeProcv71he op = _opcodesv71he[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v71he::getOpcodeDesc(byte i) { - return _opcodesv71he[i].desc; + /* 00 */ + OPCODE(0x00, o6_pushByte); + OPCODE(0x01, o6_pushWord); + OPCODE(0x02, o6_pushByteVar); + OPCODE(0x03, o6_pushWordVar); + /* 04 */ + OPCODE(0x04, o6_invalid); + OPCODE(0x05, o6_invalid); + OPCODE(0x06, o6_byteArrayRead); + OPCODE(0x07, o6_wordArrayRead); + /* 08 */ + OPCODE(0x08, o6_invalid); + OPCODE(0x09, o6_invalid); + OPCODE(0x0a, o6_byteArrayIndexedRead); + OPCODE(0x0b, o6_wordArrayIndexedRead); + /* 0C */ + OPCODE(0x0c, o6_dup); + OPCODE(0x0d, o6_not); + OPCODE(0x0e, o6_eq); + OPCODE(0x0f, o6_neq); + /* 10 */ + OPCODE(0x10, o6_gt); + OPCODE(0x11, o6_lt); + OPCODE(0x12, o6_le); + OPCODE(0x13, o6_ge); + /* 14 */ + OPCODE(0x14, o6_add); + OPCODE(0x15, o6_sub); + OPCODE(0x16, o6_mul); + OPCODE(0x17, o6_div); + /* 18 */ + OPCODE(0x18, o6_land); + OPCODE(0x19, o6_lor); + OPCODE(0x1a, o6_pop); + OPCODE(0x1b, o6_invalid); + /* 1C */ + OPCODE(0x1c, o6_invalid); + OPCODE(0x1d, o6_invalid); + OPCODE(0x1e, o6_invalid); + OPCODE(0x1f, o6_invalid); + /* 20 */ + OPCODE(0x20, o6_invalid); + OPCODE(0x21, o6_invalid); + OPCODE(0x22, o6_invalid); + OPCODE(0x23, o6_invalid); + /* 24 */ + OPCODE(0x24, o6_invalid); + OPCODE(0x25, o6_invalid); + OPCODE(0x26, o6_invalid); + OPCODE(0x27, o6_invalid); + /* 28 */ + OPCODE(0x28, o6_invalid); + OPCODE(0x29, o6_invalid); + OPCODE(0x2a, o6_invalid); + OPCODE(0x2b, o6_invalid); + /* 2C */ + OPCODE(0x2c, o6_invalid); + OPCODE(0x2d, o6_invalid); + OPCODE(0x2e, o6_invalid); + OPCODE(0x2f, o6_invalid); + /* 30 */ + OPCODE(0x30, o6_invalid); + OPCODE(0x31, o6_invalid); + OPCODE(0x32, o6_invalid); + OPCODE(0x33, o6_invalid); + /* 34 */ + OPCODE(0x34, o6_invalid); + OPCODE(0x35, o6_invalid); + OPCODE(0x36, o6_invalid); + OPCODE(0x37, o6_invalid); + /* 38 */ + OPCODE(0x38, o6_invalid); + OPCODE(0x39, o6_invalid); + OPCODE(0x3a, o6_invalid); + OPCODE(0x3b, o6_invalid); + /* 3C */ + OPCODE(0x3c, o6_invalid); + OPCODE(0x3d, o6_invalid); + OPCODE(0x3e, o6_invalid); + OPCODE(0x3f, o6_invalid); + /* 40 */ + OPCODE(0x40, o6_invalid); + OPCODE(0x41, o6_invalid); + OPCODE(0x42, o6_writeByteVar); + OPCODE(0x43, o6_writeWordVar); + /* 44 */ + OPCODE(0x44, o6_invalid); + OPCODE(0x45, o6_invalid); + OPCODE(0x46, o6_byteArrayWrite); + OPCODE(0x47, o6_wordArrayWrite); + /* 48 */ + OPCODE(0x48, o6_invalid); + OPCODE(0x49, o6_invalid); + OPCODE(0x4a, o6_byteArrayIndexedWrite); + OPCODE(0x4b, o6_wordArrayIndexedWrite); + /* 4C */ + OPCODE(0x4c, o6_invalid); + OPCODE(0x4d, o6_invalid); + OPCODE(0x4e, o6_byteVarInc); + OPCODE(0x4f, o6_wordVarInc); + /* 50 */ + OPCODE(0x50, o6_invalid); + OPCODE(0x51, o6_invalid); + OPCODE(0x52, o6_byteArrayInc); + OPCODE(0x53, o6_wordArrayInc); + /* 54 */ + OPCODE(0x54, o6_invalid); + OPCODE(0x55, o6_invalid); + OPCODE(0x56, o6_byteVarDec); + OPCODE(0x57, o6_wordVarDec); + /* 58 */ + OPCODE(0x58, o6_invalid); + OPCODE(0x59, o6_invalid); + OPCODE(0x5a, o6_byteArrayDec); + OPCODE(0x5b, o6_wordArrayDec); + /* 5C */ + OPCODE(0x5c, o6_if); + OPCODE(0x5d, o6_ifNot); + OPCODE(0x5e, o6_startScript); + OPCODE(0x5f, o6_startScriptQuick); + /* 60 */ + OPCODE(0x60, o6_startObject); + OPCODE(0x61, o6_drawObject); + OPCODE(0x62, o6_drawObjectAt); + OPCODE(0x63, o6_invalid); + /* 64 */ + OPCODE(0x64, o6_invalid); + OPCODE(0x65, o6_stopObjectCode); + OPCODE(0x66, o6_stopObjectCode); + OPCODE(0x67, o6_endCutscene); + /* 68 */ + OPCODE(0x68, o6_cutscene); + OPCODE(0x69, o6_stopMusic); + OPCODE(0x6a, o6_freezeUnfreeze); + OPCODE(0x6b, o6_cursorCommand); + /* 6C */ + OPCODE(0x6c, o6_breakHere); + OPCODE(0x6d, o6_ifClassOfIs); + OPCODE(0x6e, o6_setClass); + OPCODE(0x6f, o6_getState); + /* 70 */ + OPCODE(0x70, o60_setState); + OPCODE(0x71, o6_setOwner); + OPCODE(0x72, o6_getOwner); + OPCODE(0x73, o6_jump); + /* 74 */ + OPCODE(0x74, o70_startSound); + OPCODE(0x75, o6_stopSound); + OPCODE(0x76, o6_startMusic); + OPCODE(0x77, o6_stopObjectScript); + /* 78 */ + OPCODE(0x78, o6_panCameraTo); + OPCODE(0x79, o6_actorFollowCamera); + OPCODE(0x7a, o6_setCameraAt); + OPCODE(0x7b, o6_loadRoom); + /* 7C */ + OPCODE(0x7c, o6_stopScript); + OPCODE(0x7d, o6_walkActorToObj); + OPCODE(0x7e, o6_walkActorTo); + OPCODE(0x7f, o6_putActorAtXY); + /* 80 */ + OPCODE(0x80, o6_putActorAtObject); + OPCODE(0x81, o6_faceActor); + OPCODE(0x82, o6_animateActor); + OPCODE(0x83, o6_doSentence); + /* 84 */ + OPCODE(0x84, o70_pickupObject); + OPCODE(0x85, o6_loadRoomWithEgo); + OPCODE(0x86, o6_invalid); + OPCODE(0x87, o6_getRandomNumber); + /* 88 */ + OPCODE(0x88, o6_getRandomNumberRange); + OPCODE(0x89, o6_invalid); + OPCODE(0x8a, o6_getActorMoving); + OPCODE(0x8b, o6_isScriptRunning); + /* 8C */ + OPCODE(0x8c, o70_getActorRoom); + OPCODE(0x8d, o6_getObjectX); + OPCODE(0x8e, o6_getObjectY); + OPCODE(0x8f, o6_getObjectOldDir); + /* 90 */ + OPCODE(0x90, o6_getActorWalkBox); + OPCODE(0x91, o6_getActorCostume); + OPCODE(0x92, o6_findInventory); + OPCODE(0x93, o6_getInventoryCount); + /* 94 */ + OPCODE(0x94, o6_getVerbFromXY); + OPCODE(0x95, o6_beginOverride); + OPCODE(0x96, o6_endOverride); + OPCODE(0x97, o6_setObjectName); + /* 98 */ + OPCODE(0x98, o6_isSoundRunning); + OPCODE(0x99, o6_setBoxFlags); + OPCODE(0x9a, o6_invalid); + OPCODE(0x9b, o70_resourceRoutines); + /* 9C */ + OPCODE(0x9c, o60_roomOps); + OPCODE(0x9d, o60_actorOps); + OPCODE(0x9e, o6_verbOps); + OPCODE(0x9f, o6_getActorFromXY); + /* A0 */ + OPCODE(0xa0, o6_findObject); + OPCODE(0xa1, o6_pseudoRoom); + OPCODE(0xa2, o6_getActorElevation); + OPCODE(0xa3, o6_getVerbEntrypoint); + /* A4 */ + OPCODE(0xa4, o6_arrayOps); + OPCODE(0xa5, o6_saveRestoreVerbs); + OPCODE(0xa6, o6_drawBox); + OPCODE(0xa7, o6_pop); + /* A8 */ + OPCODE(0xa8, o6_getActorWidth); + OPCODE(0xa9, o6_wait); + OPCODE(0xaa, o6_getActorScaleX); + OPCODE(0xab, o6_getActorAnimCounter); + /* AC */ + OPCODE(0xac, o6_invalid); + OPCODE(0xad, o6_isAnyOf); + OPCODE(0xae, o70_systemOps); + OPCODE(0xaf, o6_isActorInBox); + /* B0 */ + OPCODE(0xb0, o6_delay); + OPCODE(0xb1, o6_delaySeconds); + OPCODE(0xb2, o6_delayMinutes); + OPCODE(0xb3, o6_stopSentence); + /* B4 */ + OPCODE(0xb4, o6_printLine); + OPCODE(0xb5, o6_printText); + OPCODE(0xb6, o6_printDebug); + OPCODE(0xb7, o6_printSystem); + /* B8 */ + OPCODE(0xb8, o6_printActor); + OPCODE(0xb9, o6_printEgo); + OPCODE(0xba, o6_talkActor); + OPCODE(0xbb, o6_talkEgo); + /* BC */ + OPCODE(0xbc, o6_dimArray); + OPCODE(0xbd, o6_stopObjectCode); + OPCODE(0xbe, o6_startObjectQuick); + OPCODE(0xbf, o6_startScriptQuick2); + /* C0 */ + OPCODE(0xc0, o6_dim2dimArray); + OPCODE(0xc1, o6_invalid); + OPCODE(0xc2, o6_invalid); + OPCODE(0xc3, o6_invalid); + /* C4 */ + OPCODE(0xc4, o6_abs); + OPCODE(0xc5, o6_distObjectObject); + OPCODE(0xc6, o6_distObjectPt); + OPCODE(0xc7, o6_distPtPt); + /* C8 */ + OPCODE(0xc8, o60_kernelGetFunctions); + OPCODE(0xc9, o71_kernelSetFunctions); + OPCODE(0xca, o6_delayFrames); + OPCODE(0xcb, o6_pickOneOf); + /* CC */ + OPCODE(0xcc, o6_pickOneOfDefault); + OPCODE(0xcd, o6_stampObject); + OPCODE(0xce, o6_invalid); + OPCODE(0xcf, o6_invalid); + /* D0 */ + OPCODE(0xd0, o6_getDateTime); + OPCODE(0xd1, o6_stopTalking); + OPCODE(0xd2, o6_getAnimateVariable); + OPCODE(0xd3, o6_invalid); + /* D4 */ + OPCODE(0xd4, o6_shuffle); + OPCODE(0xd5, o6_jumpToScript); + OPCODE(0xd6, o6_band); + OPCODE(0xd7, o6_bor); + /* D8 */ + OPCODE(0xd8, o6_isRoomScriptRunning); + OPCODE(0xd9, o60_closeFile); + OPCODE(0xda, o60_openFile); + OPCODE(0xdb, o60_readFile); + /* DC */ + OPCODE(0xdc, o60_writeFile); + OPCODE(0xdd, o6_findAllObjects); + OPCODE(0xde, o60_deleteFile); + OPCODE(0xdf, o60_rename); + /* E0 */ + OPCODE(0xe0, o60_soundOps); + OPCODE(0xe1, o6_getPixel); + OPCODE(0xe2, o60_localizeArrayToScript); + OPCODE(0xe3, o6_pickVarRandom); + /* E4 */ + OPCODE(0xe4, o6_setBoxSet); + OPCODE(0xe5, o6_invalid); + OPCODE(0xe6, o6_invalid); + OPCODE(0xe7, o6_invalid); + /* E8 */ + OPCODE(0xe8, o6_invalid); + OPCODE(0xe9, o60_seekFilePos); + OPCODE(0xea, o60_redimArray); + OPCODE(0xeb, o60_readFilePos); + /* EC */ + OPCODE(0xec, o71_copyString); + OPCODE(0xed, o71_getStringWidth); + OPCODE(0xee, o70_getStringLen); + OPCODE(0xef, o71_appendString); + /* F0 */ + OPCODE(0xf0, o71_concatString); + OPCODE(0xf1, o71_compareString); + OPCODE(0xf2, o70_isResourceLoaded); + OPCODE(0xf3, o70_readINI); + /* F4 */ + OPCODE(0xf4, o70_writeINI); + OPCODE(0xf5, o71_getStringLenForWidth); + OPCODE(0xf6, o71_getCharIndexInString); + OPCODE(0xf7, o71_findBox); + /* F8 */ + OPCODE(0xf8, o6_invalid); + OPCODE(0xf9, o70_createDirectory); + OPCODE(0xfa, o70_setSystemMessage); + OPCODE(0xfb, o71_polygonOps); + /* FC */ + OPCODE(0xfc, o71_polygonHit); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } byte *ScummEngine_v71he::heFindResourceData(uint32 tag, byte *ptr) { diff --git a/engines/scumm/he/script_v72he.cpp b/engines/scumm/he/script_v72he.cpp index afedcdba22..a9301eb6c0 100644 --- a/engines/scumm/he/script_v72he.cpp +++ b/engines/scumm/he/script_v72he.cpp @@ -42,342 +42,329 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v72he, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v72he, x) void ScummEngine_v72he::setupOpcodes() { - static const OpcodeEntryV72he opcodes[256] = { - /* 00 */ - OPCODE(o6_pushByte), - OPCODE(o6_pushWord), - OPCODE(o72_pushDWord), - OPCODE(o6_pushWordVar), - /* 04 */ - OPCODE(o72_getScriptString), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_wordArrayRead), - /* 08 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_wordArrayIndexedRead), - /* 0C */ - OPCODE(o6_dup), - OPCODE(o6_not), - OPCODE(o6_eq), - OPCODE(o6_neq), - /* 10 */ - OPCODE(o6_gt), - OPCODE(o6_lt), - OPCODE(o6_le), - OPCODE(o6_ge), - /* 14 */ - OPCODE(o6_add), - OPCODE(o6_sub), - OPCODE(o6_mul), - OPCODE(o6_div), - /* 18 */ - OPCODE(o6_land), - OPCODE(o6_lor), - OPCODE(o6_pop), - OPCODE(o72_isAnyOf), - /* 1C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 20 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 24 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 28 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 2C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 30 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 34 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 38 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 3C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 40 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_writeWordVar), - /* 44 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_wordArrayWrite), - /* 48 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_wordArrayIndexedWrite), - /* 4C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_wordVarInc), - /* 50 */ - OPCODE(o72_resetCutscene), - OPCODE(o6_invalid), - OPCODE(o72_findObjectWithClassOf), - OPCODE(o6_wordArrayInc), - /* 54 */ - OPCODE(o72_getObjectImageX), - OPCODE(o72_getObjectImageY), - OPCODE(o72_captureWizImage), - OPCODE(o6_wordVarDec), - /* 58 */ - OPCODE(o72_getTimer), - OPCODE(o72_setTimer), - OPCODE(o72_getSoundPosition), - OPCODE(o6_wordArrayDec), - /* 5C */ - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o72_startScript), - OPCODE(o6_startScriptQuick), - /* 60 */ - OPCODE(o72_startObject), - OPCODE(o72_drawObject), - OPCODE(o72_printWizImage), - OPCODE(o72_getArrayDimSize), - /* 64 */ - OPCODE(o72_getNumFreeArrays), - OPCODE(o6_stopObjectCode), - OPCODE(o6_stopObjectCode), - OPCODE(o6_endCutscene), - /* 68 */ - OPCODE(o6_cutscene), - OPCODE(o6_stopMusic), - OPCODE(o6_freezeUnfreeze), - OPCODE(o6_cursorCommand), - /* 6C */ - OPCODE(o6_breakHere), - OPCODE(o6_ifClassOfIs), - OPCODE(o6_setClass), - OPCODE(o6_getState), - /* 70 */ - OPCODE(o60_setState), - OPCODE(o6_setOwner), - OPCODE(o6_getOwner), - OPCODE(o6_jump), - /* 74 */ - OPCODE(o70_startSound), - OPCODE(o6_stopSound), - OPCODE(o6_startMusic), - OPCODE(o6_stopObjectScript), - /* 78 */ - OPCODE(o6_panCameraTo), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_setCameraAt), - OPCODE(o6_loadRoom), - /* 7C */ - OPCODE(o6_stopScript), - OPCODE(o6_walkActorToObj), - OPCODE(o6_walkActorTo), - OPCODE(o6_putActorAtXY), - /* 80 */ - OPCODE(o6_putActorAtObject), - OPCODE(o6_faceActor), - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - /* 84 */ - OPCODE(o70_pickupObject), - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_invalid), - OPCODE(o6_getRandomNumber), - /* 88 */ - OPCODE(o6_getRandomNumberRange), - OPCODE(o6_invalid), - OPCODE(o6_getActorMoving), - OPCODE(o6_isScriptRunning), - /* 8C */ - OPCODE(o70_getActorRoom), - OPCODE(o6_getObjectX), - OPCODE(o6_getObjectY), - OPCODE(o6_getObjectOldDir), - /* 90 */ - OPCODE(o6_getActorWalkBox), - OPCODE(o6_getActorCostume), - OPCODE(o6_findInventory), - OPCODE(o6_getInventoryCount), - /* 94 */ - OPCODE(o6_getVerbFromXY), - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o6_invalid), - /* 98 */ - OPCODE(o6_isSoundRunning), - OPCODE(o6_setBoxFlags), - OPCODE(o6_invalid), - OPCODE(o70_resourceRoutines), - /* 9C */ - OPCODE(o72_roomOps), - OPCODE(o72_actorOps), - OPCODE(o72_verbOps), - OPCODE(o6_getActorFromXY), - /* A0 */ - OPCODE(o72_findObject), - OPCODE(o6_pseudoRoom), - OPCODE(o6_getActorElevation), - OPCODE(o6_getVerbEntrypoint), - /* A4 */ - OPCODE(o72_arrayOps), - OPCODE(o6_saveRestoreVerbs), - OPCODE(o6_drawBox), - OPCODE(o6_pop), - /* A8 */ - OPCODE(o6_getActorWidth), - OPCODE(o6_wait), - OPCODE(o6_getActorScaleX), - OPCODE(o6_getActorAnimCounter), - /* AC */ - OPCODE(o6_invalid), - OPCODE(o6_isAnyOf), - OPCODE(o72_systemOps), - OPCODE(o6_isActorInBox), - /* B0 */ - OPCODE(o6_delay), - OPCODE(o6_delaySeconds), - OPCODE(o6_delayMinutes), - OPCODE(o6_stopSentence), - /* B4 */ - OPCODE(o6_printLine), - OPCODE(o6_printText), - OPCODE(o6_printDebug), - OPCODE(o6_printSystem), - /* B8 */ - OPCODE(o6_printActor), - OPCODE(o6_printEgo), - OPCODE(o72_talkActor), - OPCODE(o72_talkEgo), - /* BC */ - OPCODE(o72_dimArray), - OPCODE(o6_stopObjectCode), - OPCODE(o6_startObjectQuick), - OPCODE(o6_startScriptQuick2), - /* C0 */ - OPCODE(o72_dim2dimArray), - OPCODE(o72_traceStatus), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C4 */ - OPCODE(o6_abs), - OPCODE(o6_distObjectObject), - OPCODE(o6_distObjectPt), - OPCODE(o6_distPtPt), - /* C8 */ - OPCODE(o72_kernelGetFunctions), - OPCODE(o71_kernelSetFunctions), - OPCODE(o6_delayFrames), - OPCODE(o6_pickOneOf), - /* CC */ - OPCODE(o6_pickOneOfDefault), - OPCODE(o6_stampObject), - OPCODE(o72_drawWizImage), - OPCODE(o72_debugInput), - /* D0 */ - OPCODE(o6_getDateTime), - OPCODE(o6_stopTalking), - OPCODE(o6_getAnimateVariable), - OPCODE(o6_invalid), - /* D4 */ - OPCODE(o6_shuffle), - OPCODE(o72_jumpToScript), - OPCODE(o6_band), - OPCODE(o6_bor), - /* D8 */ - OPCODE(o6_isRoomScriptRunning), - OPCODE(o60_closeFile), - OPCODE(o72_openFile), - OPCODE(o72_readFile), - /* DC */ - OPCODE(o72_writeFile), - OPCODE(o72_findAllObjects), - OPCODE(o72_deleteFile), - OPCODE(o72_rename), - /* E0 */ - OPCODE(o60_soundOps), - OPCODE(o72_getPixel), - OPCODE(o60_localizeArrayToScript), - OPCODE(o72_pickVarRandom), - /* E4 */ - OPCODE(o6_setBoxSet), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* E8 */ - OPCODE(o6_invalid), - OPCODE(o60_seekFilePos), - OPCODE(o72_redimArray), - OPCODE(o60_readFilePos), - /* EC */ - OPCODE(o71_copyString), - OPCODE(o71_getStringWidth), - OPCODE(o70_getStringLen), - OPCODE(o71_appendString), - /* F0 */ - OPCODE(o71_concatString), - OPCODE(o71_compareString), - OPCODE(o70_isResourceLoaded), - OPCODE(o72_readINI), - /* F4 */ - OPCODE(o72_writeINI), - OPCODE(o71_getStringLenForWidth), - OPCODE(o71_getCharIndexInString), - OPCODE(o71_findBox), - /* F8 */ - OPCODE(o72_getResourceSize), - OPCODE(o72_createDirectory), - OPCODE(o72_setSystemMessage), - OPCODE(o71_polygonOps), - /* FC */ - OPCODE(o71_polygonHit), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesV72he = opcodes; -} - -void ScummEngine_v72he::executeOpcode(byte i) { - OpcodeProcV72he op = _opcodesV72he[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v72he::getOpcodeDesc(byte i) { - return _opcodesV72he[i].desc; + /* 00 */ + OPCODE(0x00, o6_pushByte); + OPCODE(0x01, o6_pushWord); + OPCODE(0x02, o72_pushDWord); + OPCODE(0x03, o6_pushWordVar); + /* 04 */ + OPCODE(0x04, o72_getScriptString); + OPCODE(0x05, o6_invalid); + OPCODE(0x06, o6_invalid); + OPCODE(0x07, o6_wordArrayRead); + /* 08 */ + OPCODE(0x08, o6_invalid); + OPCODE(0x09, o6_invalid); + OPCODE(0x0a, o6_invalid); + OPCODE(0x0b, o6_wordArrayIndexedRead); + /* 0C */ + OPCODE(0x0c, o6_dup); + OPCODE(0x0d, o6_not); + OPCODE(0x0e, o6_eq); + OPCODE(0x0f, o6_neq); + /* 10 */ + OPCODE(0x10, o6_gt); + OPCODE(0x11, o6_lt); + OPCODE(0x12, o6_le); + OPCODE(0x13, o6_ge); + /* 14 */ + OPCODE(0x14, o6_add); + OPCODE(0x15, o6_sub); + OPCODE(0x16, o6_mul); + OPCODE(0x17, o6_div); + /* 18 */ + OPCODE(0x18, o6_land); + OPCODE(0x19, o6_lor); + OPCODE(0x1a, o6_pop); + OPCODE(0x1b, o72_isAnyOf); + /* 1C */ + OPCODE(0x1c, o6_invalid); + OPCODE(0x1d, o6_invalid); + OPCODE(0x1e, o6_invalid); + OPCODE(0x1f, o6_invalid); + /* 20 */ + OPCODE(0x20, o6_invalid); + OPCODE(0x21, o6_invalid); + OPCODE(0x22, o6_invalid); + OPCODE(0x23, o6_invalid); + /* 24 */ + OPCODE(0x24, o6_invalid); + OPCODE(0x25, o6_invalid); + OPCODE(0x26, o6_invalid); + OPCODE(0x27, o6_invalid); + /* 28 */ + OPCODE(0x28, o6_invalid); + OPCODE(0x29, o6_invalid); + OPCODE(0x2a, o6_invalid); + OPCODE(0x2b, o6_invalid); + /* 2C */ + OPCODE(0x2c, o6_invalid); + OPCODE(0x2d, o6_invalid); + OPCODE(0x2e, o6_invalid); + OPCODE(0x2f, o6_invalid); + /* 30 */ + OPCODE(0x30, o6_invalid); + OPCODE(0x31, o6_invalid); + OPCODE(0x32, o6_invalid); + OPCODE(0x33, o6_invalid); + /* 34 */ + OPCODE(0x34, o6_invalid); + OPCODE(0x35, o6_invalid); + OPCODE(0x36, o6_invalid); + OPCODE(0x37, o6_invalid); + /* 38 */ + OPCODE(0x38, o6_invalid); + OPCODE(0x39, o6_invalid); + OPCODE(0x3a, o6_invalid); + OPCODE(0x3b, o6_invalid); + /* 3C */ + OPCODE(0x3c, o6_invalid); + OPCODE(0x3d, o6_invalid); + OPCODE(0x3e, o6_invalid); + OPCODE(0x3f, o6_invalid); + /* 40 */ + OPCODE(0x40, o6_invalid); + OPCODE(0x41, o6_invalid); + OPCODE(0x42, o6_invalid); + OPCODE(0x43, o6_writeWordVar); + /* 44 */ + OPCODE(0x44, o6_invalid); + OPCODE(0x45, o6_invalid); + OPCODE(0x46, o6_invalid); + OPCODE(0x47, o6_wordArrayWrite); + /* 48 */ + OPCODE(0x48, o6_invalid); + OPCODE(0x49, o6_invalid); + OPCODE(0x4a, o6_invalid); + OPCODE(0x4b, o6_wordArrayIndexedWrite); + /* 4C */ + OPCODE(0x4c, o6_invalid); + OPCODE(0x4d, o6_invalid); + OPCODE(0x4e, o6_invalid); + OPCODE(0x4f, o6_wordVarInc); + /* 50 */ + OPCODE(0x50, o72_resetCutscene); + OPCODE(0x51, o6_invalid); + OPCODE(0x52, o72_findObjectWithClassOf); + OPCODE(0x53, o6_wordArrayInc); + /* 54 */ + OPCODE(0x54, o72_getObjectImageX); + OPCODE(0x55, o72_getObjectImageY); + OPCODE(0x56, o72_captureWizImage); + OPCODE(0x57, o6_wordVarDec); + /* 58 */ + OPCODE(0x58, o72_getTimer); + OPCODE(0x59, o72_setTimer); + OPCODE(0x5a, o72_getSoundPosition); + OPCODE(0x5b, o6_wordArrayDec); + /* 5C */ + OPCODE(0x5c, o6_if); + OPCODE(0x5d, o6_ifNot); + OPCODE(0x5e, o72_startScript); + OPCODE(0x5f, o6_startScriptQuick); + /* 60 */ + OPCODE(0x60, o72_startObject); + OPCODE(0x61, o72_drawObject); + OPCODE(0x62, o72_printWizImage); + OPCODE(0x63, o72_getArrayDimSize); + /* 64 */ + OPCODE(0x64, o72_getNumFreeArrays); + OPCODE(0x65, o6_stopObjectCode); + OPCODE(0x66, o6_stopObjectCode); + OPCODE(0x67, o6_endCutscene); + /* 68 */ + OPCODE(0x68, o6_cutscene); + OPCODE(0x69, o6_stopMusic); + OPCODE(0x6a, o6_freezeUnfreeze); + OPCODE(0x6b, o6_cursorCommand); + /* 6C */ + OPCODE(0x6c, o6_breakHere); + OPCODE(0x6d, o6_ifClassOfIs); + OPCODE(0x6e, o6_setClass); + OPCODE(0x6f, o6_getState); + /* 70 */ + OPCODE(0x70, o60_setState); + OPCODE(0x71, o6_setOwner); + OPCODE(0x72, o6_getOwner); + OPCODE(0x73, o6_jump); + /* 74 */ + OPCODE(0x74, o70_startSound); + OPCODE(0x75, o6_stopSound); + OPCODE(0x76, o6_startMusic); + OPCODE(0x77, o6_stopObjectScript); + /* 78 */ + OPCODE(0x78, o6_panCameraTo); + OPCODE(0x79, o6_actorFollowCamera); + OPCODE(0x7a, o6_setCameraAt); + OPCODE(0x7b, o6_loadRoom); + /* 7C */ + OPCODE(0x7c, o6_stopScript); + OPCODE(0x7d, o6_walkActorToObj); + OPCODE(0x7e, o6_walkActorTo); + OPCODE(0x7f, o6_putActorAtXY); + /* 80 */ + OPCODE(0x80, o6_putActorAtObject); + OPCODE(0x81, o6_faceActor); + OPCODE(0x82, o6_animateActor); + OPCODE(0x83, o6_doSentence); + /* 84 */ + OPCODE(0x84, o70_pickupObject); + OPCODE(0x85, o6_loadRoomWithEgo); + OPCODE(0x86, o6_invalid); + OPCODE(0x87, o6_getRandomNumber); + /* 88 */ + OPCODE(0x88, o6_getRandomNumberRange); + OPCODE(0x89, o6_invalid); + OPCODE(0x8a, o6_getActorMoving); + OPCODE(0x8b, o6_isScriptRunning); + /* 8C */ + OPCODE(0x8c, o70_getActorRoom); + OPCODE(0x8d, o6_getObjectX); + OPCODE(0x8e, o6_getObjectY); + OPCODE(0x8f, o6_getObjectOldDir); + /* 90 */ + OPCODE(0x90, o6_getActorWalkBox); + OPCODE(0x91, o6_getActorCostume); + OPCODE(0x92, o6_findInventory); + OPCODE(0x93, o6_getInventoryCount); + /* 94 */ + OPCODE(0x94, o6_getVerbFromXY); + OPCODE(0x95, o6_beginOverride); + OPCODE(0x96, o6_endOverride); + OPCODE(0x97, o6_invalid); + /* 98 */ + OPCODE(0x98, o6_isSoundRunning); + OPCODE(0x99, o6_setBoxFlags); + OPCODE(0x9a, o6_invalid); + OPCODE(0x9b, o70_resourceRoutines); + /* 9C */ + OPCODE(0x9c, o72_roomOps); + OPCODE(0x9d, o72_actorOps); + OPCODE(0x9e, o72_verbOps); + OPCODE(0x9f, o6_getActorFromXY); + /* A0 */ + OPCODE(0xa0, o72_findObject); + OPCODE(0xa1, o6_pseudoRoom); + OPCODE(0xa2, o6_getActorElevation); + OPCODE(0xa3, o6_getVerbEntrypoint); + /* A4 */ + OPCODE(0xa4, o72_arrayOps); + OPCODE(0xa5, o6_saveRestoreVerbs); + OPCODE(0xa6, o6_drawBox); + OPCODE(0xa7, o6_pop); + /* A8 */ + OPCODE(0xa8, o6_getActorWidth); + OPCODE(0xa9, o6_wait); + OPCODE(0xaa, o6_getActorScaleX); + OPCODE(0xab, o6_getActorAnimCounter); + /* AC */ + OPCODE(0xac, o6_invalid); + OPCODE(0xad, o6_isAnyOf); + OPCODE(0xae, o72_systemOps); + OPCODE(0xaf, o6_isActorInBox); + /* B0 */ + OPCODE(0xb0, o6_delay); + OPCODE(0xb1, o6_delaySeconds); + OPCODE(0xb2, o6_delayMinutes); + OPCODE(0xb3, o6_stopSentence); + /* B4 */ + OPCODE(0xb4, o6_printLine); + OPCODE(0xb5, o6_printText); + OPCODE(0xb6, o6_printDebug); + OPCODE(0xb7, o6_printSystem); + /* B8 */ + OPCODE(0xb8, o6_printActor); + OPCODE(0xb9, o6_printEgo); + OPCODE(0xba, o72_talkActor); + OPCODE(0xbb, o72_talkEgo); + /* BC */ + OPCODE(0xbc, o72_dimArray); + OPCODE(0xbd, o6_stopObjectCode); + OPCODE(0xbe, o6_startObjectQuick); + OPCODE(0xbf, o6_startScriptQuick2); + /* C0 */ + OPCODE(0xc0, o72_dim2dimArray); + OPCODE(0xc1, o72_traceStatus); + OPCODE(0xc2, o6_invalid); + OPCODE(0xc3, o6_invalid); + /* C4 */ + OPCODE(0xc4, o6_abs); + OPCODE(0xc5, o6_distObjectObject); + OPCODE(0xc6, o6_distObjectPt); + OPCODE(0xc7, o6_distPtPt); + /* C8 */ + OPCODE(0xc8, o72_kernelGetFunctions); + OPCODE(0xc9, o71_kernelSetFunctions); + OPCODE(0xca, o6_delayFrames); + OPCODE(0xcb, o6_pickOneOf); + /* CC */ + OPCODE(0xcc, o6_pickOneOfDefault); + OPCODE(0xcd, o6_stampObject); + OPCODE(0xce, o72_drawWizImage); + OPCODE(0xcf, o72_debugInput); + /* D0 */ + OPCODE(0xd0, o6_getDateTime); + OPCODE(0xd1, o6_stopTalking); + OPCODE(0xd2, o6_getAnimateVariable); + OPCODE(0xd3, o6_invalid); + /* D4 */ + OPCODE(0xd4, o6_shuffle); + OPCODE(0xd5, o72_jumpToScript); + OPCODE(0xd6, o6_band); + OPCODE(0xd7, o6_bor); + /* D8 */ + OPCODE(0xd8, o6_isRoomScriptRunning); + OPCODE(0xd9, o60_closeFile); + OPCODE(0xda, o72_openFile); + OPCODE(0xdb, o72_readFile); + /* DC */ + OPCODE(0xdc, o72_writeFile); + OPCODE(0xdd, o72_findAllObjects); + OPCODE(0xde, o72_deleteFile); + OPCODE(0xdf, o72_rename); + /* E0 */ + OPCODE(0xe0, o60_soundOps); + OPCODE(0xe1, o72_getPixel); + OPCODE(0xe2, o60_localizeArrayToScript); + OPCODE(0xe3, o72_pickVarRandom); + /* E4 */ + OPCODE(0xe4, o6_setBoxSet); + OPCODE(0xe5, o6_invalid); + OPCODE(0xe6, o6_invalid); + OPCODE(0xe7, o6_invalid); + /* E8 */ + OPCODE(0xe8, o6_invalid); + OPCODE(0xe9, o60_seekFilePos); + OPCODE(0xea, o72_redimArray); + OPCODE(0xeb, o60_readFilePos); + /* EC */ + OPCODE(0xec, o71_copyString); + OPCODE(0xed, o71_getStringWidth); + OPCODE(0xee, o70_getStringLen); + OPCODE(0xef, o71_appendString); + /* F0 */ + OPCODE(0xf0, o71_concatString); + OPCODE(0xf1, o71_compareString); + OPCODE(0xf2, o70_isResourceLoaded); + OPCODE(0xf3, o72_readINI); + /* F4 */ + OPCODE(0xf4, o72_writeINI); + OPCODE(0xf5, o71_getStringLenForWidth); + OPCODE(0xf6, o71_getCharIndexInString); + OPCODE(0xf7, o71_findBox); + /* F8 */ + OPCODE(0xf8, o72_getResourceSize); + OPCODE(0xf9, o72_createDirectory); + OPCODE(0xfa, o72_setSystemMessage); + OPCODE(0xfb, o71_polygonOps); + /* FC */ + OPCODE(0xfc, o71_polygonHit); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } static const int arrayDataSizes[] = { 0, 1, 4, 8, 8, 16, 32 }; diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index 55dc62c38d..61ccad798b 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -39,343 +39,331 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v80he, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v80he, x) void ScummEngine_v80he::setupOpcodes() { - static const OpcodeEntryV80he opcodes[256] = { - /* 00 */ - OPCODE(o6_pushByte), - OPCODE(o6_pushWord), - OPCODE(o72_pushDWord), - OPCODE(o6_pushWordVar), - /* 04 */ - OPCODE(o72_getScriptString), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_wordArrayRead), - /* 08 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_wordArrayIndexedRead), - /* 0C */ - OPCODE(o6_dup), - OPCODE(o6_not), - OPCODE(o6_eq), - OPCODE(o6_neq), - /* 10 */ - OPCODE(o6_gt), - OPCODE(o6_lt), - OPCODE(o6_le), - OPCODE(o6_ge), - /* 14 */ - OPCODE(o6_add), - OPCODE(o6_sub), - OPCODE(o6_mul), - OPCODE(o6_div), - /* 18 */ - OPCODE(o6_land), - OPCODE(o6_lor), - OPCODE(o6_pop), - OPCODE(o72_isAnyOf), - /* 1C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 20 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 24 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 28 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 2C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 30 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 34 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 38 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 3C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 40 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_writeWordVar), - /* 44 */ - OPCODE(o6_invalid), - OPCODE(o80_createSound), - OPCODE(o80_getFileSize), - OPCODE(o6_wordArrayWrite), - /* 48 */ - OPCODE(o80_stringToInt), - OPCODE(o80_getSoundVar), - OPCODE(o80_localizeArrayToRoom), - OPCODE(o6_wordArrayIndexedWrite), - /* 4C */ - OPCODE(o80_sourceDebug), - OPCODE(o80_readConfigFile), - OPCODE(o80_writeConfigFile), - OPCODE(o6_wordVarInc), - /* 50 */ - OPCODE(o72_resetCutscene), - OPCODE(o6_invalid), - OPCODE(o72_findObjectWithClassOf), - OPCODE(o6_wordArrayInc), - /* 54 */ - OPCODE(o72_getObjectImageX), - OPCODE(o72_getObjectImageY), - OPCODE(o72_captureWizImage), - OPCODE(o6_wordVarDec), - /* 58 */ - OPCODE(o72_getTimer), - OPCODE(o72_setTimer), - OPCODE(o72_getSoundPosition), - OPCODE(o6_wordArrayDec), - /* 5C */ - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o72_startScript), - OPCODE(o6_startScriptQuick), - /* 60 */ - OPCODE(o72_startObject), - OPCODE(o72_drawObject), - OPCODE(o72_printWizImage), - OPCODE(o72_getArrayDimSize), - /* 64 */ - OPCODE(o72_getNumFreeArrays), - OPCODE(o6_stopObjectCode), - OPCODE(o6_stopObjectCode), - OPCODE(o6_endCutscene), - /* 68 */ - OPCODE(o6_cutscene), - OPCODE(o6_invalid), - OPCODE(o6_freezeUnfreeze), - OPCODE(o80_cursorCommand), - /* 6C */ - OPCODE(o6_breakHere), - OPCODE(o6_ifClassOfIs), - OPCODE(o6_setClass), - OPCODE(o6_getState), - /* 70 */ - OPCODE(o80_setState), - OPCODE(o6_setOwner), - OPCODE(o6_getOwner), - OPCODE(o6_jump), - /* 74 */ - OPCODE(o70_startSound), - OPCODE(o6_stopSound), - OPCODE(o6_invalid), - OPCODE(o6_stopObjectScript), - /* 78 */ - OPCODE(o6_panCameraTo), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_setCameraAt), - OPCODE(o6_loadRoom), - /* 7C */ - OPCODE(o6_stopScript), - OPCODE(o6_walkActorToObj), - OPCODE(o6_walkActorTo), - OPCODE(o6_putActorAtXY), - /* 80 */ - OPCODE(o6_putActorAtObject), - OPCODE(o6_faceActor), - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - /* 84 */ - OPCODE(o70_pickupObject), - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_invalid), - OPCODE(o6_getRandomNumber), - /* 88 */ - OPCODE(o6_getRandomNumberRange), - OPCODE(o6_invalid), - OPCODE(o6_getActorMoving), - OPCODE(o6_isScriptRunning), - /* 8C */ - OPCODE(o70_getActorRoom), - OPCODE(o6_getObjectX), - OPCODE(o6_getObjectY), - OPCODE(o6_getObjectOldDir), - /* 90 */ - OPCODE(o6_getActorWalkBox), - OPCODE(o6_getActorCostume), - OPCODE(o6_findInventory), - OPCODE(o6_getInventoryCount), - /* 94 */ - OPCODE(o6_invalid), - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o6_invalid), - /* 98 */ - OPCODE(o6_isSoundRunning), - OPCODE(o6_setBoxFlags), - OPCODE(o6_invalid), - OPCODE(o70_resourceRoutines), - /* 9C */ - OPCODE(o72_roomOps), - OPCODE(o72_actorOps), - OPCODE(o6_invalid), - OPCODE(o6_getActorFromXY), - /* A0 */ - OPCODE(o72_findObject), - OPCODE(o6_pseudoRoom), - OPCODE(o6_getActorElevation), - OPCODE(o6_getVerbEntrypoint), - /* A4 */ - OPCODE(o72_arrayOps), - OPCODE(o6_invalid), - OPCODE(o6_drawBox), - OPCODE(o6_pop), - /* A8 */ - OPCODE(o6_getActorWidth), - OPCODE(o6_wait), - OPCODE(o6_getActorScaleX), - OPCODE(o6_getActorAnimCounter), - /* AC */ - OPCODE(o80_drawWizPolygon), - OPCODE(o6_isAnyOf), - OPCODE(o72_systemOps), - OPCODE(o6_isActorInBox), - /* B0 */ - OPCODE(o6_delay), - OPCODE(o6_delaySeconds), - OPCODE(o6_delayMinutes), - OPCODE(o6_stopSentence), - /* B4 */ - OPCODE(o6_printLine), - OPCODE(o6_printText), - OPCODE(o6_printDebug), - OPCODE(o6_printSystem), - /* B8 */ - OPCODE(o6_printActor), - OPCODE(o6_printEgo), - OPCODE(o72_talkActor), - OPCODE(o72_talkEgo), - /* BC */ - OPCODE(o72_dimArray), - OPCODE(o6_stopObjectCode), - OPCODE(o6_startObjectQuick), - OPCODE(o6_startScriptQuick2), - /* C0 */ - OPCODE(o72_dim2dimArray), - OPCODE(o72_traceStatus), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C4 */ - OPCODE(o6_abs), - OPCODE(o6_distObjectObject), - OPCODE(o6_distObjectPt), - OPCODE(o6_distPtPt), - /* C8 */ - OPCODE(o72_kernelGetFunctions), - OPCODE(o71_kernelSetFunctions), - OPCODE(o6_delayFrames), - OPCODE(o6_pickOneOf), - /* CC */ - OPCODE(o6_pickOneOfDefault), - OPCODE(o6_stampObject), - OPCODE(o72_drawWizImage), - OPCODE(o72_debugInput), - /* D0 */ - OPCODE(o6_getDateTime), - OPCODE(o6_stopTalking), - OPCODE(o6_getAnimateVariable), - OPCODE(o6_invalid), - /* D4 */ - OPCODE(o6_shuffle), - OPCODE(o72_jumpToScript), - OPCODE(o6_band), - OPCODE(o6_bor), - /* D8 */ - OPCODE(o6_isRoomScriptRunning), - OPCODE(o60_closeFile), - OPCODE(o72_openFile), - OPCODE(o72_readFile), - /* DC */ - OPCODE(o72_writeFile), - OPCODE(o72_findAllObjects), - OPCODE(o72_deleteFile), - OPCODE(o72_rename), - /* E0 */ - OPCODE(o80_drawLine), - OPCODE(o72_getPixel), - OPCODE(o60_localizeArrayToScript), - OPCODE(o80_pickVarRandom), - /* E4 */ - OPCODE(o6_setBoxSet), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* E8 */ - OPCODE(o6_invalid), - OPCODE(o60_seekFilePos), - OPCODE(o72_redimArray), - OPCODE(o60_readFilePos), - /* EC */ - OPCODE(o71_copyString), - OPCODE(o71_getStringWidth), - OPCODE(o70_getStringLen), - OPCODE(o71_appendString), - /* F0 */ - OPCODE(o71_concatString), - OPCODE(o71_compareString), - OPCODE(o70_isResourceLoaded), - OPCODE(o72_readINI), - /* F4 */ - OPCODE(o72_writeINI), - OPCODE(o71_getStringLenForWidth), - OPCODE(o71_getCharIndexInString), - OPCODE(o71_findBox), - /* F8 */ - OPCODE(o72_getResourceSize), - OPCODE(o72_createDirectory), - OPCODE(o72_setSystemMessage), - OPCODE(o71_polygonOps), - /* FC */ - OPCODE(o71_polygonHit), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesV80he = opcodes; + /* 00 */ + OPCODE(0x00, o6_pushByte); + OPCODE(0x01, o6_pushWord); + OPCODE(0x02, o72_pushDWord); + OPCODE(0x03, o6_pushWordVar); + /* 04 */ + OPCODE(0x04, o72_getScriptString); + OPCODE(0x05, o6_invalid); + OPCODE(0x06, o6_invalid); + OPCODE(0x07, o6_wordArrayRead); + /* 08 */ + OPCODE(0x08, o6_invalid); + OPCODE(0x09, o6_invalid); + OPCODE(0x0a, o6_invalid); + OPCODE(0x0b, o6_wordArrayIndexedRead); + /* 0C */ + OPCODE(0x0c, o6_dup); + OPCODE(0x0d, o6_not); + OPCODE(0x0e, o6_eq); + OPCODE(0x0f, o6_neq); + /* 10 */ + OPCODE(0x10, o6_gt); + OPCODE(0x11, o6_lt); + OPCODE(0x12, o6_le); + OPCODE(0x13, o6_ge); + /* 14 */ + OPCODE(0x14, o6_add); + OPCODE(0x15, o6_sub); + OPCODE(0x16, o6_mul); + OPCODE(0x17, o6_div); + /* 18 */ + OPCODE(0x18, o6_land); + OPCODE(0x19, o6_lor); + OPCODE(0x1a, o6_pop); + OPCODE(0x1b, o72_isAnyOf); + /* 1C */ + OPCODE(0x1c, o6_invalid); + OPCODE(0x1d, o6_invalid); + OPCODE(0x1e, o6_invalid); + OPCODE(0x1f, o6_invalid); + /* 20 */ + OPCODE(0x20, o6_invalid); + OPCODE(0x21, o6_invalid); + OPCODE(0x22, o6_invalid); + OPCODE(0x23, o6_invalid); + /* 24 */ + OPCODE(0x24, o6_invalid); + OPCODE(0x25, o6_invalid); + OPCODE(0x26, o6_invalid); + OPCODE(0x27, o6_invalid); + /* 28 */ + OPCODE(0x28, o6_invalid); + OPCODE(0x29, o6_invalid); + OPCODE(0x2a, o6_invalid); + OPCODE(0x2b, o6_invalid); + /* 2C */ + OPCODE(0x2c, o6_invalid); + OPCODE(0x2d, o6_invalid); + OPCODE(0x2e, o6_invalid); + OPCODE(0x2f, o6_invalid); + /* 30 */ + OPCODE(0x30, o6_invalid); + OPCODE(0x31, o6_invalid); + OPCODE(0x32, o6_invalid); + OPCODE(0x33, o6_invalid); + /* 34 */ + OPCODE(0x34, o6_invalid); + OPCODE(0x35, o6_invalid); + OPCODE(0x36, o6_invalid); + OPCODE(0x37, o6_invalid); + /* 38 */ + OPCODE(0x38, o6_invalid); + OPCODE(0x39, o6_invalid); + OPCODE(0x3a, o6_invalid); + OPCODE(0x3b, o6_invalid); + /* 3C */ + OPCODE(0x3c, o6_invalid); + OPCODE(0x3d, o6_invalid); + OPCODE(0x3e, o6_invalid); + OPCODE(0x3f, o6_invalid); + /* 40 */ + OPCODE(0x40, o6_invalid); + OPCODE(0x41, o6_invalid); + OPCODE(0x42, o6_invalid); + OPCODE(0x43, o6_writeWordVar); + /* 44 */ + OPCODE(0x44, o6_invalid); + OPCODE(0x45, o80_createSound); + OPCODE(0x46, o80_getFileSize); + OPCODE(0x47, o6_wordArrayWrite); + /* 48 */ + OPCODE(0x48, o80_stringToInt); + OPCODE(0x49, o80_getSoundVar); + OPCODE(0x4a, o80_localizeArrayToRoom); + OPCODE(0x4b, o6_wordArrayIndexedWrite); + /* 4C */ + OPCODE(0x4c, o80_sourceDebug); + OPCODE(0x4d, o80_readConfigFile); + OPCODE(0x4e, o80_writeConfigFile); + OPCODE(0x4f, o6_wordVarInc); + /* 50 */ + OPCODE(0x50, o72_resetCutscene); + OPCODE(0x51, o6_invalid); + OPCODE(0x52, o72_findObjectWithClassOf); + OPCODE(0x53, o6_wordArrayInc); + /* 54 */ + OPCODE(0x54, o72_getObjectImageX); + OPCODE(0x55, o72_getObjectImageY); + OPCODE(0x56, o72_captureWizImage); + OPCODE(0x57, o6_wordVarDec); + /* 58 */ + OPCODE(0x58, o72_getTimer); + OPCODE(0x59, o72_setTimer); + OPCODE(0x5a, o72_getSoundPosition); + OPCODE(0x5b, o6_wordArrayDec); + /* 5C */ + OPCODE(0x5c, o6_if); + OPCODE(0x5d, o6_ifNot); + OPCODE(0x5e, o72_startScript); + OPCODE(0x5f, o6_startScriptQuick); + /* 60 */ + OPCODE(0x60, o72_startObject); + OPCODE(0x61, o72_drawObject); + OPCODE(0x62, o72_printWizImage); + OPCODE(0x63, o72_getArrayDimSize); + /* 64 */ + OPCODE(0x64, o72_getNumFreeArrays); + OPCODE(0x65, o6_stopObjectCode); + OPCODE(0x66, o6_stopObjectCode); + OPCODE(0x67, o6_endCutscene); + /* 68 */ + OPCODE(0x68, o6_cutscene); + OPCODE(0x69, o6_invalid); + OPCODE(0x6a, o6_freezeUnfreeze); + OPCODE(0x6b, o80_cursorCommand); + /* 6C */ + OPCODE(0x6c, o6_breakHere); + OPCODE(0x6d, o6_ifClassOfIs); + OPCODE(0x6e, o6_setClass); + OPCODE(0x6f, o6_getState); + /* 70 */ + OPCODE(0x70, o80_setState); + OPCODE(0x71, o6_setOwner); + OPCODE(0x72, o6_getOwner); + OPCODE(0x73, o6_jump); + /* 74 */ + OPCODE(0x74, o70_startSound); + OPCODE(0x75, o6_stopSound); + OPCODE(0x76, o6_invalid); + OPCODE(0x77, o6_stopObjectScript); + /* 78 */ + OPCODE(0x78, o6_panCameraTo); + OPCODE(0x79, o6_actorFollowCamera); + OPCODE(0x7a, o6_setCameraAt); + OPCODE(0x7b, o6_loadRoom); + /* 7C */ + OPCODE(0x7c, o6_stopScript); + OPCODE(0x7d, o6_walkActorToObj); + OPCODE(0x7e, o6_walkActorTo); + OPCODE(0x7f, o6_putActorAtXY); + /* 80 */ + OPCODE(0x80, o6_putActorAtObject); + OPCODE(0x81, o6_faceActor); + OPCODE(0x82, o6_animateActor); + OPCODE(0x83, o6_doSentence); + /* 84 */ + OPCODE(0x84, o70_pickupObject); + OPCODE(0x85, o6_loadRoomWithEgo); + OPCODE(0x86, o6_invalid); + OPCODE(0x87, o6_getRandomNumber); + /* 88 */ + OPCODE(0x88, o6_getRandomNumberRange); + OPCODE(0x89, o6_invalid); + OPCODE(0x8a, o6_getActorMoving); + OPCODE(0x8b, o6_isScriptRunning); + /* 8C */ + OPCODE(0x8c, o70_getActorRoom); + OPCODE(0x8d, o6_getObjectX); + OPCODE(0x8e, o6_getObjectY); + OPCODE(0x8f, o6_getObjectOldDir); + /* 90 */ + OPCODE(0x90, o6_getActorWalkBox); + OPCODE(0x91, o6_getActorCostume); + OPCODE(0x92, o6_findInventory); + OPCODE(0x93, o6_getInventoryCount); + /* 94 */ + OPCODE(0x94, o6_invalid); + OPCODE(0x95, o6_beginOverride); + OPCODE(0x96, o6_endOverride); + OPCODE(0x97, o6_invalid); + /* 98 */ + OPCODE(0x98, o6_isSoundRunning); + OPCODE(0x99, o6_setBoxFlags); + OPCODE(0x9a, o6_invalid); + OPCODE(0x9b, o70_resourceRoutines); + /* 9C */ + OPCODE(0x9c, o72_roomOps); + OPCODE(0x9d, o72_actorOps); + OPCODE(0x9e, o6_invalid); + OPCODE(0x9f, o6_getActorFromXY); + /* A0 */ + OPCODE(0xa0, o72_findObject); + OPCODE(0xa1, o6_pseudoRoom); + OPCODE(0xa2, o6_getActorElevation); + OPCODE(0xa3, o6_getVerbEntrypoint); + /* A4 */ + OPCODE(0xa4, o72_arrayOps); + OPCODE(0xa5, o6_invalid); + OPCODE(0xa6, o6_drawBox); + OPCODE(0xa7, o6_pop); + /* A8 */ + OPCODE(0xa8, o6_getActorWidth); + OPCODE(0xa9, o6_wait); + OPCODE(0xaa, o6_getActorScaleX); + OPCODE(0xab, o6_getActorAnimCounter); + /* AC */ + OPCODE(0xac, o80_drawWizPolygon); + OPCODE(0xad, o6_isAnyOf); + OPCODE(0xae, o72_systemOps); + OPCODE(0xaf, o6_isActorInBox); + /* B0 */ + OPCODE(0xb0, o6_delay); + OPCODE(0xb1, o6_delaySeconds); + OPCODE(0xb2, o6_delayMinutes); + OPCODE(0xb3, o6_stopSentence); + /* B4 */ + OPCODE(0xb4, o6_printLine); + OPCODE(0xb5, o6_printText); + OPCODE(0xb6, o6_printDebug); + OPCODE(0xb7, o6_printSystem); + /* B8 */ + OPCODE(0xb8, o6_printActor); + OPCODE(0xb9, o6_printEgo); + OPCODE(0xba, o72_talkActor); + OPCODE(0xbb, o72_talkEgo); + /* BC */ + OPCODE(0xbc, o72_dimArray); + OPCODE(0xbd, o6_stopObjectCode); + OPCODE(0xbe, o6_startObjectQuick); + OPCODE(0xbf, o6_startScriptQuick2); + /* C0 */ + OPCODE(0xc0, o72_dim2dimArray); + OPCODE(0xc1, o72_traceStatus); + OPCODE(0xc2, o6_invalid); + OPCODE(0xc3, o6_invalid); + /* C4 */ + OPCODE(0xc4, o6_abs); + OPCODE(0xc5, o6_distObjectObject); + OPCODE(0xc6, o6_distObjectPt); + OPCODE(0xc7, o6_distPtPt); + /* C8 */ + OPCODE(0xc8, o72_kernelGetFunctions); + OPCODE(0xc9, o71_kernelSetFunctions); + OPCODE(0xca, o6_delayFrames); + OPCODE(0xcb, o6_pickOneOf); + /* CC */ + OPCODE(0xcc, o6_pickOneOfDefault); + OPCODE(0xcd, o6_stampObject); + OPCODE(0xce, o72_drawWizImage); + OPCODE(0xcf, o72_debugInput); + /* D0 */ + OPCODE(0xd0, o6_getDateTime); + OPCODE(0xd1, o6_stopTalking); + OPCODE(0xd2, o6_getAnimateVariable); + OPCODE(0xd3, o6_invalid); + /* D4 */ + OPCODE(0xd4, o6_shuffle); + OPCODE(0xd5, o72_jumpToScript); + OPCODE(0xd6, o6_band); + OPCODE(0xd7, o6_bor); + /* D8 */ + OPCODE(0xd8, o6_isRoomScriptRunning); + OPCODE(0xd9, o60_closeFile); + OPCODE(0xda, o72_openFile); + OPCODE(0xdb, o72_readFile); + /* DC */ + OPCODE(0xdc, o72_writeFile); + OPCODE(0xdd, o72_findAllObjects); + OPCODE(0xde, o72_deleteFile); + OPCODE(0xdf, o72_rename); + /* E0 */ + OPCODE(0xe0, o80_drawLine); + OPCODE(0xe1, o72_getPixel); + OPCODE(0xe2, o60_localizeArrayToScript); + OPCODE(0xe3, o80_pickVarRandom); + /* E4 */ + OPCODE(0xe4, o6_setBoxSet); + OPCODE(0xe5, o6_invalid); + OPCODE(0xe6, o6_invalid); + OPCODE(0xe7, o6_invalid); + /* E8 */ + OPCODE(0xe8, o6_invalid); + OPCODE(0xe9, o60_seekFilePos); + OPCODE(0xea, o72_redimArray); + OPCODE(0xeb, o60_readFilePos); + /* EC */ + OPCODE(0xec, o71_copyString); + OPCODE(0xed, o71_getStringWidth); + OPCODE(0xee, o70_getStringLen); + OPCODE(0xef, o71_appendString); + /* F0 */ + OPCODE(0xf0, o71_concatString); + OPCODE(0xf1, o71_compareString); + OPCODE(0xf2, o70_isResourceLoaded); + OPCODE(0xf3, o72_readINI); + /* F4 */ + OPCODE(0xf4, o72_writeINI); + OPCODE(0xf5, o71_getStringLenForWidth); + OPCODE(0xf6, o71_getCharIndexInString); + OPCODE(0xf7, o71_findBox); + /* F8 */ + OPCODE(0xf8, o72_getResourceSize); + OPCODE(0xf9, o72_createDirectory); + OPCODE(0xfa, o72_setSystemMessage); + OPCODE(0xfb, o71_polygonOps); + /* FC */ + OPCODE(0xfc, o71_polygonHit); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } -void ScummEngine_v80he::executeOpcode(byte i) { - OpcodeProcV80he op = _opcodesV80he[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v80he::getOpcodeDesc(byte i) { - return _opcodesV80he[i].desc; -} void ScummEngine_v80he::o80_createSound() { byte subOp = fetchScriptByte(); diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp index 832a61f85e..933cffa2ec 100644 --- a/engines/scumm/he/script_v90he.cpp +++ b/engines/scumm/he/script_v90he.cpp @@ -38,342 +38,329 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v90he, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v90he, x) void ScummEngine_v90he::setupOpcodes() { - static const OpcodeEntryV90he opcodes[256] = { - /* 00 */ - OPCODE(o6_pushByte), - OPCODE(o6_pushWord), - OPCODE(o72_pushDWord), - OPCODE(o6_pushWordVar), - /* 04 */ - OPCODE(o72_getScriptString), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_wordArrayRead), - /* 08 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o90_dup_n), - OPCODE(o6_wordArrayIndexedRead), - /* 0C */ - OPCODE(o6_dup), - OPCODE(o6_not), - OPCODE(o6_eq), - OPCODE(o6_neq), - /* 10 */ - OPCODE(o6_gt), - OPCODE(o6_lt), - OPCODE(o6_le), - OPCODE(o6_ge), - /* 14 */ - OPCODE(o6_add), - OPCODE(o6_sub), - OPCODE(o6_mul), - OPCODE(o6_div), - /* 18 */ - OPCODE(o6_land), - OPCODE(o6_lor), - OPCODE(o6_pop), - OPCODE(o72_isAnyOf), - /* 1C */ - OPCODE(o90_wizImageOps), - OPCODE(o90_min), - OPCODE(o90_max), - OPCODE(o90_sin), - /* 20 */ - OPCODE(o90_cos), - OPCODE(o90_sqrt), - OPCODE(o90_atan2), - OPCODE(o90_getSegmentAngle), - /* 24 */ - OPCODE(o90_getDistanceBetweenPoints), - OPCODE(o90_getSpriteInfo), - OPCODE(o90_setSpriteInfo), - OPCODE(o90_getSpriteGroupInfo), - /* 28 */ - OPCODE(o90_setSpriteGroupInfo), - OPCODE(o90_getWizData), - OPCODE(o90_getActorData), - OPCODE(o90_startScriptUnk), - /* 2C */ - OPCODE(o90_jumpToScriptUnk), - OPCODE(o90_videoOps), - OPCODE(o90_getVideoData), - OPCODE(o90_floodFill), - /* 30 */ - OPCODE(o90_mod), - OPCODE(o90_shl), - OPCODE(o90_shr), - OPCODE(o90_xor), - /* 34 */ - OPCODE(o90_findAllObjectsWithClassOf), - OPCODE(o90_getPolygonOverlap), - OPCODE(o90_cond), - OPCODE(o90_dim2dim2Array), - /* 38 */ - OPCODE(o90_redim2dimArray), - OPCODE(o90_getLinesIntersectionPoint), - OPCODE(o90_sortArray), - OPCODE(o6_invalid), - /* 3C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 40 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_writeWordVar), - /* 44 */ - OPCODE(o90_getObjectData), - OPCODE(o80_createSound), - OPCODE(o80_getFileSize), - OPCODE(o6_wordArrayWrite), - /* 48 */ - OPCODE(o80_stringToInt), - OPCODE(o80_getSoundVar), - OPCODE(o80_localizeArrayToRoom), - OPCODE(o6_wordArrayIndexedWrite), - /* 4C */ - OPCODE(o80_sourceDebug), - OPCODE(o80_readConfigFile), - OPCODE(o80_writeConfigFile), - OPCODE(o6_wordVarInc), - /* 50 */ - OPCODE(o72_resetCutscene), - OPCODE(o6_invalid), - OPCODE(o72_findObjectWithClassOf), - OPCODE(o6_wordArrayInc), - /* 54 */ - OPCODE(o72_getObjectImageX), - OPCODE(o72_getObjectImageY), - OPCODE(o72_captureWizImage), - OPCODE(o6_wordVarDec), - /* 58 */ - OPCODE(o72_getTimer), - OPCODE(o72_setTimer), - OPCODE(o72_getSoundPosition), - OPCODE(o6_wordArrayDec), - /* 5C */ - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o72_startScript), - OPCODE(o6_startScriptQuick), - /* 60 */ - OPCODE(o72_startObject), - OPCODE(o72_drawObject), - OPCODE(o72_printWizImage), - OPCODE(o72_getArrayDimSize), - /* 64 */ - OPCODE(o72_getNumFreeArrays), - OPCODE(o6_stopObjectCode), - OPCODE(o6_stopObjectCode), - OPCODE(o6_endCutscene), - /* 68 */ - OPCODE(o6_cutscene), - OPCODE(o6_invalid), - OPCODE(o6_freezeUnfreeze), - OPCODE(o80_cursorCommand), - /* 6C */ - OPCODE(o6_breakHere), - OPCODE(o6_ifClassOfIs), - OPCODE(o6_setClass), - OPCODE(o6_getState), - /* 70 */ - OPCODE(o80_setState), - OPCODE(o6_setOwner), - OPCODE(o6_getOwner), - OPCODE(o6_jump), - /* 74 */ - OPCODE(o70_startSound), - OPCODE(o6_stopSound), - OPCODE(o6_invalid), - OPCODE(o6_stopObjectScript), - /* 78 */ - OPCODE(o6_panCameraTo), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_setCameraAt), - OPCODE(o6_loadRoom), - /* 7C */ - OPCODE(o6_stopScript), - OPCODE(o6_walkActorToObj), - OPCODE(o6_walkActorTo), - OPCODE(o6_putActorAtXY), - /* 80 */ - OPCODE(o6_putActorAtObject), - OPCODE(o6_faceActor), - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - /* 84 */ - OPCODE(o70_pickupObject), - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_invalid), - OPCODE(o6_getRandomNumber), - /* 88 */ - OPCODE(o6_getRandomNumberRange), - OPCODE(o6_invalid), - OPCODE(o6_getActorMoving), - OPCODE(o6_isScriptRunning), - /* 8C */ - OPCODE(o70_getActorRoom), - OPCODE(o6_getObjectX), - OPCODE(o6_getObjectY), - OPCODE(o6_getObjectOldDir), - /* 90 */ - OPCODE(o6_getActorWalkBox), - OPCODE(o6_getActorCostume), - OPCODE(o6_findInventory), - OPCODE(o6_getInventoryCount), - /* 94 */ - OPCODE(o90_getPaletteData), - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o6_invalid), - /* 98 */ - OPCODE(o6_isSoundRunning), - OPCODE(o6_setBoxFlags), - OPCODE(o6_invalid), - OPCODE(o70_resourceRoutines), - /* 9C */ - OPCODE(o72_roomOps), - OPCODE(o72_actorOps), - OPCODE(o90_paletteOps), - OPCODE(o6_getActorFromXY), - /* A0 */ - OPCODE(o72_findObject), - OPCODE(o6_pseudoRoom), - OPCODE(o6_getActorElevation), - OPCODE(o6_getVerbEntrypoint), - /* A4 */ - OPCODE(o72_arrayOps), - OPCODE(o90_fontUnk), - OPCODE(o6_drawBox), - OPCODE(o6_pop), - /* A8 */ - OPCODE(o6_getActorWidth), - OPCODE(o6_wait), - OPCODE(o6_getActorScaleX), - OPCODE(o90_getActorAnimProgress), - /* AC */ - OPCODE(o80_drawWizPolygon), - OPCODE(o6_isAnyOf), - OPCODE(o72_systemOps), - OPCODE(o6_isActorInBox), - /* B0 */ - OPCODE(o6_delay), - OPCODE(o6_delaySeconds), - OPCODE(o6_delayMinutes), - OPCODE(o6_stopSentence), - /* B4 */ - OPCODE(o6_printLine), - OPCODE(o6_printText), - OPCODE(o6_printDebug), - OPCODE(o6_printSystem), - /* B8 */ - OPCODE(o6_printActor), - OPCODE(o6_printEgo), - OPCODE(o72_talkActor), - OPCODE(o72_talkEgo), - /* BC */ - OPCODE(o72_dimArray), - OPCODE(o6_stopObjectCode), - OPCODE(o6_startObjectQuick), - OPCODE(o6_startScriptQuick2), - /* C0 */ - OPCODE(o72_dim2dimArray), - OPCODE(o72_traceStatus), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C4 */ - OPCODE(o6_abs), - OPCODE(o6_distObjectObject), - OPCODE(o6_distObjectPt), - OPCODE(o6_distPtPt), - /* C8 */ - OPCODE(o90_kernelGetFunctions), - OPCODE(o90_kernelSetFunctions), - OPCODE(o6_delayFrames), - OPCODE(o6_pickOneOf), - /* CC */ - OPCODE(o6_pickOneOfDefault), - OPCODE(o6_stampObject), - OPCODE(o72_drawWizImage), - OPCODE(o72_debugInput), - /* D0 */ - OPCODE(o6_getDateTime), - OPCODE(o6_stopTalking), - OPCODE(o6_getAnimateVariable), - OPCODE(o6_invalid), - /* D4 */ - OPCODE(o6_shuffle), - OPCODE(o72_jumpToScript), - OPCODE(o6_band), - OPCODE(o6_bor), - /* D8 */ - OPCODE(o6_isRoomScriptRunning), - OPCODE(o60_closeFile), - OPCODE(o72_openFile), - OPCODE(o72_readFile), - /* DC */ - OPCODE(o72_writeFile), - OPCODE(o72_findAllObjects), - OPCODE(o72_deleteFile), - OPCODE(o72_rename), - /* E0 */ - OPCODE(o80_drawLine), - OPCODE(o72_getPixel), - OPCODE(o60_localizeArrayToScript), - OPCODE(o80_pickVarRandom), - /* E4 */ - OPCODE(o6_setBoxSet), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* E8 */ - OPCODE(o6_invalid), - OPCODE(o60_seekFilePos), - OPCODE(o72_redimArray), - OPCODE(o60_readFilePos), - /* EC */ - OPCODE(o71_copyString), - OPCODE(o71_getStringWidth), - OPCODE(o70_getStringLen), - OPCODE(o71_appendString), - /* F0 */ - OPCODE(o71_concatString), - OPCODE(o71_compareString), - OPCODE(o70_isResourceLoaded), - OPCODE(o72_readINI), - /* F4 */ - OPCODE(o72_writeINI), - OPCODE(o71_getStringLenForWidth), - OPCODE(o71_getCharIndexInString), - OPCODE(o71_findBox), - /* F8 */ - OPCODE(o72_getResourceSize), - OPCODE(o72_createDirectory), - OPCODE(o72_setSystemMessage), - OPCODE(o71_polygonOps), - /* FC */ - OPCODE(o71_polygonHit), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesV90he = opcodes; -} - -void ScummEngine_v90he::executeOpcode(byte i) { - OpcodeProcV90he op = _opcodesV90he[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v90he::getOpcodeDesc(byte i) { - return _opcodesV90he[i].desc; + /* 00 */ + OPCODE(0x00, o6_pushByte); + OPCODE(0x01, o6_pushWord); + OPCODE(0x02, o72_pushDWord); + OPCODE(0x03, o6_pushWordVar); + /* 04 */ + OPCODE(0x04, o72_getScriptString); + OPCODE(0x05, o6_invalid); + OPCODE(0x06, o6_invalid); + OPCODE(0x07, o6_wordArrayRead); + /* 08 */ + OPCODE(0x08, o6_invalid); + OPCODE(0x09, o6_invalid); + OPCODE(0x0a, o90_dup_n); + OPCODE(0x0b, o6_wordArrayIndexedRead); + /* 0C */ + OPCODE(0x0c, o6_dup); + OPCODE(0x0d, o6_not); + OPCODE(0x0e, o6_eq); + OPCODE(0x0f, o6_neq); + /* 10 */ + OPCODE(0x10, o6_gt); + OPCODE(0x11, o6_lt); + OPCODE(0x12, o6_le); + OPCODE(0x13, o6_ge); + /* 14 */ + OPCODE(0x14, o6_add); + OPCODE(0x15, o6_sub); + OPCODE(0x16, o6_mul); + OPCODE(0x17, o6_div); + /* 18 */ + OPCODE(0x18, o6_land); + OPCODE(0x19, o6_lor); + OPCODE(0x1a, o6_pop); + OPCODE(0x1b, o72_isAnyOf); + /* 1C */ + OPCODE(0x1c, o90_wizImageOps); + OPCODE(0x1d, o90_min); + OPCODE(0x1e, o90_max); + OPCODE(0x1f, o90_sin); + /* 20 */ + OPCODE(0x20, o90_cos); + OPCODE(0x21, o90_sqrt); + OPCODE(0x22, o90_atan2); + OPCODE(0x23, o90_getSegmentAngle); + /* 24 */ + OPCODE(0x24, o90_getDistanceBetweenPoints); + OPCODE(0x25, o90_getSpriteInfo); + OPCODE(0x26, o90_setSpriteInfo); + OPCODE(0x27, o90_getSpriteGroupInfo); + /* 28 */ + OPCODE(0x28, o90_setSpriteGroupInfo); + OPCODE(0x29, o90_getWizData); + OPCODE(0x2a, o90_getActorData); + OPCODE(0x2b, o90_startScriptUnk); + /* 2C */ + OPCODE(0x2c, o90_jumpToScriptUnk); + OPCODE(0x2d, o90_videoOps); + OPCODE(0x2e, o90_getVideoData); + OPCODE(0x2f, o90_floodFill); + /* 30 */ + OPCODE(0x30, o90_mod); + OPCODE(0x31, o90_shl); + OPCODE(0x32, o90_shr); + OPCODE(0x33, o90_xor); + /* 34 */ + OPCODE(0x34, o90_findAllObjectsWithClassOf); + OPCODE(0x35, o90_getPolygonOverlap); + OPCODE(0x36, o90_cond); + OPCODE(0x37, o90_dim2dim2Array); + /* 38 */ + OPCODE(0x38, o90_redim2dimArray); + OPCODE(0x39, o90_getLinesIntersectionPoint); + OPCODE(0x3a, o90_sortArray); + OPCODE(0x3b, o6_invalid); + /* 3C */ + OPCODE(0x3c, o6_invalid); + OPCODE(0x3d, o6_invalid); + OPCODE(0x3e, o6_invalid); + OPCODE(0x3f, o6_invalid); + /* 40 */ + OPCODE(0x40, o6_invalid); + OPCODE(0x41, o6_invalid); + OPCODE(0x42, o6_invalid); + OPCODE(0x43, o6_writeWordVar); + /* 44 */ + OPCODE(0x44, o90_getObjectData); + OPCODE(0x45, o80_createSound); + OPCODE(0x46, o80_getFileSize); + OPCODE(0x47, o6_wordArrayWrite); + /* 48 */ + OPCODE(0x48, o80_stringToInt); + OPCODE(0x49, o80_getSoundVar); + OPCODE(0x4a, o80_localizeArrayToRoom); + OPCODE(0x4b, o6_wordArrayIndexedWrite); + /* 4C */ + OPCODE(0x4c, o80_sourceDebug); + OPCODE(0x4d, o80_readConfigFile); + OPCODE(0x4e, o80_writeConfigFile); + OPCODE(0x4f, o6_wordVarInc); + /* 50 */ + OPCODE(0x50, o72_resetCutscene); + OPCODE(0x51, o6_invalid); + OPCODE(0x52, o72_findObjectWithClassOf); + OPCODE(0x53, o6_wordArrayInc); + /* 54 */ + OPCODE(0x54, o72_getObjectImageX); + OPCODE(0x55, o72_getObjectImageY); + OPCODE(0x56, o72_captureWizImage); + OPCODE(0x57, o6_wordVarDec); + /* 58 */ + OPCODE(0x58, o72_getTimer); + OPCODE(0x59, o72_setTimer); + OPCODE(0x5a, o72_getSoundPosition); + OPCODE(0x5b, o6_wordArrayDec); + /* 5C */ + OPCODE(0x5c, o6_if); + OPCODE(0x5d, o6_ifNot); + OPCODE(0x5e, o72_startScript); + OPCODE(0x5f, o6_startScriptQuick); + /* 60 */ + OPCODE(0x60, o72_startObject); + OPCODE(0x61, o72_drawObject); + OPCODE(0x62, o72_printWizImage); + OPCODE(0x63, o72_getArrayDimSize); + /* 64 */ + OPCODE(0x64, o72_getNumFreeArrays); + OPCODE(0x65, o6_stopObjectCode); + OPCODE(0x66, o6_stopObjectCode); + OPCODE(0x67, o6_endCutscene); + /* 68 */ + OPCODE(0x68, o6_cutscene); + OPCODE(0x69, o6_invalid); + OPCODE(0x6a, o6_freezeUnfreeze); + OPCODE(0x6b, o80_cursorCommand); + /* 6C */ + OPCODE(0x6c, o6_breakHere); + OPCODE(0x6d, o6_ifClassOfIs); + OPCODE(0x6e, o6_setClass); + OPCODE(0x6f, o6_getState); + /* 70 */ + OPCODE(0x70, o80_setState); + OPCODE(0x71, o6_setOwner); + OPCODE(0x72, o6_getOwner); + OPCODE(0x73, o6_jump); + /* 74 */ + OPCODE(0x74, o70_startSound); + OPCODE(0x75, o6_stopSound); + OPCODE(0x76, o6_invalid); + OPCODE(0x77, o6_stopObjectScript); + /* 78 */ + OPCODE(0x78, o6_panCameraTo); + OPCODE(0x79, o6_actorFollowCamera); + OPCODE(0x7a, o6_setCameraAt); + OPCODE(0x7b, o6_loadRoom); + /* 7C */ + OPCODE(0x7c, o6_stopScript); + OPCODE(0x7d, o6_walkActorToObj); + OPCODE(0x7e, o6_walkActorTo); + OPCODE(0x7f, o6_putActorAtXY); + /* 80 */ + OPCODE(0x80, o6_putActorAtObject); + OPCODE(0x81, o6_faceActor); + OPCODE(0x82, o6_animateActor); + OPCODE(0x83, o6_doSentence); + /* 84 */ + OPCODE(0x84, o70_pickupObject); + OPCODE(0x85, o6_loadRoomWithEgo); + OPCODE(0x86, o6_invalid); + OPCODE(0x87, o6_getRandomNumber); + /* 88 */ + OPCODE(0x88, o6_getRandomNumberRange); + OPCODE(0x89, o6_invalid); + OPCODE(0x8a, o6_getActorMoving); + OPCODE(0x8b, o6_isScriptRunning); + /* 8C */ + OPCODE(0x8c, o70_getActorRoom); + OPCODE(0x8d, o6_getObjectX); + OPCODE(0x8e, o6_getObjectY); + OPCODE(0x8f, o6_getObjectOldDir); + /* 90 */ + OPCODE(0x90, o6_getActorWalkBox); + OPCODE(0x91, o6_getActorCostume); + OPCODE(0x92, o6_findInventory); + OPCODE(0x93, o6_getInventoryCount); + /* 94 */ + OPCODE(0x94, o90_getPaletteData); + OPCODE(0x95, o6_beginOverride); + OPCODE(0x96, o6_endOverride); + OPCODE(0x97, o6_invalid); + /* 98 */ + OPCODE(0x98, o6_isSoundRunning); + OPCODE(0x99, o6_setBoxFlags); + OPCODE(0x9a, o6_invalid); + OPCODE(0x9b, o70_resourceRoutines); + /* 9C */ + OPCODE(0x9c, o72_roomOps); + OPCODE(0x9d, o72_actorOps); + OPCODE(0x9e, o90_paletteOps); + OPCODE(0x9f, o6_getActorFromXY); + /* A0 */ + OPCODE(0xa0, o72_findObject); + OPCODE(0xa1, o6_pseudoRoom); + OPCODE(0xa2, o6_getActorElevation); + OPCODE(0xa3, o6_getVerbEntrypoint); + /* A4 */ + OPCODE(0xa4, o72_arrayOps); + OPCODE(0xa5, o90_fontUnk); + OPCODE(0xa6, o6_drawBox); + OPCODE(0xa7, o6_pop); + /* A8 */ + OPCODE(0xa8, o6_getActorWidth); + OPCODE(0xa9, o6_wait); + OPCODE(0xaa, o6_getActorScaleX); + OPCODE(0xab, o90_getActorAnimProgress); + /* AC */ + OPCODE(0xac, o80_drawWizPolygon); + OPCODE(0xad, o6_isAnyOf); + OPCODE(0xae, o72_systemOps); + OPCODE(0xaf, o6_isActorInBox); + /* B0 */ + OPCODE(0xb0, o6_delay); + OPCODE(0xb1, o6_delaySeconds); + OPCODE(0xb2, o6_delayMinutes); + OPCODE(0xb3, o6_stopSentence); + /* B4 */ + OPCODE(0xb4, o6_printLine); + OPCODE(0xb5, o6_printText); + OPCODE(0xb6, o6_printDebug); + OPCODE(0xb7, o6_printSystem); + /* B8 */ + OPCODE(0xb8, o6_printActor); + OPCODE(0xb9, o6_printEgo); + OPCODE(0xba, o72_talkActor); + OPCODE(0xbb, o72_talkEgo); + /* BC */ + OPCODE(0xbc, o72_dimArray); + OPCODE(0xbd, o6_stopObjectCode); + OPCODE(0xbe, o6_startObjectQuick); + OPCODE(0xbf, o6_startScriptQuick2); + /* C0 */ + OPCODE(0xc0, o72_dim2dimArray); + OPCODE(0xc1, o72_traceStatus); + OPCODE(0xc2, o6_invalid); + OPCODE(0xc3, o6_invalid); + /* C4 */ + OPCODE(0xc4, o6_abs); + OPCODE(0xc5, o6_distObjectObject); + OPCODE(0xc6, o6_distObjectPt); + OPCODE(0xc7, o6_distPtPt); + /* C8 */ + OPCODE(0xc8, o90_kernelGetFunctions); + OPCODE(0xc9, o90_kernelSetFunctions); + OPCODE(0xca, o6_delayFrames); + OPCODE(0xcb, o6_pickOneOf); + /* CC */ + OPCODE(0xcc, o6_pickOneOfDefault); + OPCODE(0xcd, o6_stampObject); + OPCODE(0xce, o72_drawWizImage); + OPCODE(0xcf, o72_debugInput); + /* D0 */ + OPCODE(0xd0, o6_getDateTime); + OPCODE(0xd1, o6_stopTalking); + OPCODE(0xd2, o6_getAnimateVariable); + OPCODE(0xd3, o6_invalid); + /* D4 */ + OPCODE(0xd4, o6_shuffle); + OPCODE(0xd5, o72_jumpToScript); + OPCODE(0xd6, o6_band); + OPCODE(0xd7, o6_bor); + /* D8 */ + OPCODE(0xd8, o6_isRoomScriptRunning); + OPCODE(0xd9, o60_closeFile); + OPCODE(0xda, o72_openFile); + OPCODE(0xdb, o72_readFile); + /* DC */ + OPCODE(0xdc, o72_writeFile); + OPCODE(0xdd, o72_findAllObjects); + OPCODE(0xde, o72_deleteFile); + OPCODE(0xdf, o72_rename); + /* E0 */ + OPCODE(0xe0, o80_drawLine); + OPCODE(0xe1, o72_getPixel); + OPCODE(0xe2, o60_localizeArrayToScript); + OPCODE(0xe3, o80_pickVarRandom); + /* E4 */ + OPCODE(0xe4, o6_setBoxSet); + OPCODE(0xe5, o6_invalid); + OPCODE(0xe6, o6_invalid); + OPCODE(0xe7, o6_invalid); + /* E8 */ + OPCODE(0xe8, o6_invalid); + OPCODE(0xe9, o60_seekFilePos); + OPCODE(0xea, o72_redimArray); + OPCODE(0xeb, o60_readFilePos); + /* EC */ + OPCODE(0xec, o71_copyString); + OPCODE(0xed, o71_getStringWidth); + OPCODE(0xee, o70_getStringLen); + OPCODE(0xef, o71_appendString); + /* F0 */ + OPCODE(0xf0, o71_concatString); + OPCODE(0xf1, o71_compareString); + OPCODE(0xf2, o70_isResourceLoaded); + OPCODE(0xf3, o72_readINI); + /* F4 */ + OPCODE(0xf4, o72_writeINI); + OPCODE(0xf5, o71_getStringLenForWidth); + OPCODE(0xf6, o71_getCharIndexInString); + OPCODE(0xf7, o71_findBox); + /* F8 */ + OPCODE(0xf8, o72_getResourceSize); + OPCODE(0xf9, o72_createDirectory); + OPCODE(0xfa, o72_setSystemMessage); + OPCODE(0xfb, o71_polygonOps); + /* FC */ + OPCODE(0xfc, o71_polygonHit); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } void ScummEngine_v90he::o90_dup_n() { diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index 81bce5916b..43e0148b00 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -26,7 +26,6 @@ #include "common/timer.h" #include "scumm/actor.h" -#include "scumm/intern.h" #include "scumm/saveload.h" #include "scumm/scumm_v7.h" #include "scumm/sound.h" diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h deleted file mode 100644 index 56defe508c..0000000000 --- a/engines/scumm/intern.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef SCUMM_INTERN_H -#define SCUMM_INTERN_H - -#include "scumm/scumm.h" - -namespace Scumm { - -// This is to help devices with small memory (PDA, smartphones, ...) -// to save abit of memory used by opcode names in the Scumm engine. -#ifndef REDUCE_MEMORY_USAGE -# define _OPCODE(ver, x) { &ver::x, #x } -#else -# define _OPCODE(ver, x) { &ver::x, "" } -#endif - -} // End of namespace Scumm - -#endif diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index 5730374a7d..4a31d9af75 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -477,6 +477,15 @@ void ScummEngine::executeScript() { } } +void ScummEngine::executeOpcode(byte i) { + assert(_opcodes[i].proc && _opcodes[i].proc->isValid()); + (*_opcodes[i].proc)(); +} + +const char *ScummEngine::getOpcodeDesc(byte i) { + return _opcodes[i].desc; +} + byte ScummEngine::fetchScriptByte() { if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) { long oldoffs = _scriptPointer - _scriptOrgPointer; diff --git a/engines/scumm/script.h b/engines/scumm/script.h index 9081e76c22..dbfa2630e5 100644 --- a/engines/scumm/script.h +++ b/engines/scumm/script.h @@ -26,10 +26,40 @@ #ifndef SCUMM_SCRIPT_H #define SCUMM_SCRIPT_H -#include "engines/engine.h" +#include "common/func.h" namespace Scumm { + +typedef Common::Functor0<void> Opcode; + +struct OpcodeEntry : Common::NonCopyable { + Opcode *proc; + const char *desc; + + OpcodeEntry() : proc(0), desc(0) {} + ~OpcodeEntry() { + setProc(0, 0); + } + + void setProc(Opcode *p, const char *d) { + if (proc != p) { + delete proc; + proc = p; + } + desc = d; + } +}; + + +// This is to help devices with small memory (PDA, smartphones, ...) +// to save abit of memory used by opcode names in the Scumm engine. +#ifndef REDUCE_MEMORY_USAGE +# define _OPCODE(ver, x) setProc(new Common::Functor0Mem<void, ver>(this, &ver::x), #x) +#else +# define _OPCODE(ver, x) setProc(new Common::Functor0Mem<void, ver>(this, &ver::x), "") +#endif + /** * The number of script slots, which determines the maximal number * of concurrently running scripts. diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index 309ecfe372..fcd2556905 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -26,340 +26,335 @@ #include "scumm/actor.h" #include "scumm/charset.h" -#include "scumm/intern.h" #include "scumm/object.h" #include "scumm/scumm_v0.h" #include "scumm/verbs.h" namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v0, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v0, x) void ScummEngine_v0::setupOpcodes() { - static const OpcodeEntryC64 opcodes[256] = { - /* 00 */ - OPCODE(o5_stopObjectCode), - OPCODE(o2_putActor), - OPCODE(o5_startMusic), - OPCODE(o_doSentence), - /* 04 */ - OPCODE(o_isGreaterEqual), - OPCODE(o_stopCurrentScript), - OPCODE(o5_getDist), - OPCODE(o5_getActorRoom), - /* 08 */ - OPCODE(o_isNotEqual), - OPCODE(o_stopCurrentScript), - OPCODE(o_stopCurrentScript), - OPCODE(o_setActorBitVar), - /* 0C */ - OPCODE(o_loadSound), - OPCODE(o_printEgo_c64), - OPCODE(o_putActorAtObject), - OPCODE(o2_clearState02), - /* 10 */ - OPCODE(o5_breakHere), - OPCODE(o_animateActor), - OPCODE(o2_panCameraTo), - OPCODE(o_lockCostume), - /* 14 */ - OPCODE(o_print_c64), - OPCODE(o5_walkActorToActor), - OPCODE(o5_getRandomNr), - OPCODE(o_clearState08), - /* 18 */ - OPCODE(o_jumpRelative), - OPCODE(o_stopCurrentScript), - OPCODE(o5_move), - OPCODE(o_getActorBitVar), - /* 1C */ - OPCODE(o5_startSound), - OPCODE(o_setBitVar), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifState04), - /* 20 */ - OPCODE(o5_stopMusic), - OPCODE(o2_putActor), - OPCODE(o5_saveLoadGame), - OPCODE(o_stopCurrentScript), - /* 24 */ - OPCODE(o_unknown2), - OPCODE(o5_loadRoom), - OPCODE(o_getClosestObjActor), - OPCODE(o2_getActorY), - /* 28 */ - OPCODE(o_equalZero), - OPCODE(o_setOwnerOf), - OPCODE(o2_delay), - OPCODE(o_setActorBitVar), - /* 2C */ - OPCODE(o_stopCurrentScript), - OPCODE(o2_putActorInRoom), - OPCODE(o_print_c64), - OPCODE(o2_ifState08), - /* 30 */ - OPCODE(o_loadCostume), - OPCODE(o_getBitVar), - OPCODE(o2_setCameraAt), - OPCODE(o_lockScript), - /* 34 */ - OPCODE(o5_getDist), - OPCODE(o_stopCurrentScript), - OPCODE(o2_walkActorToObject), - OPCODE(o2_clearState04), - /* 38 */ - OPCODE(o_isLessEqual), - OPCODE(o_stopCurrentScript), - OPCODE(o2_subtract), - OPCODE(o_stopCurrentScript), - /* 3C */ - OPCODE(o5_stopSound), - OPCODE(o_setBitVar), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifState02), - /* 40 */ - OPCODE(o_cutscene), - OPCODE(o2_putActor), - OPCODE(o2_startScript), - OPCODE(o_doSentence), - /* 44 */ - OPCODE(o_isLess), - OPCODE(o_stopCurrentScript), - OPCODE(o5_increment), - OPCODE(o2_getActorX), - /* 48 */ - OPCODE(o_isEqual), - OPCODE(o_stopCurrentScript), - OPCODE(o_loadRoom), - OPCODE(o_setActorBitVar), - /* 4C */ - OPCODE(o_loadScript), - OPCODE(o_lockRoom), - OPCODE(o_putActorAtObject), - OPCODE(o2_clearState02), - /* 50 */ - OPCODE(o_nop), - OPCODE(o_animateActor), - OPCODE(o5_actorFollowCamera), - OPCODE(o_lockSound), - /* 54 */ - OPCODE(o_setObjectName), - OPCODE(o5_walkActorToActor), - OPCODE(o_getActorMoving), - OPCODE(o_clearState08), - /* 58 */ - OPCODE(o_beginOverride), - OPCODE(o_stopCurrentScript), - OPCODE(o2_add), - OPCODE(o_getActorBitVar), - /* 5C */ - OPCODE(o5_startSound), - OPCODE(o_setBitVar), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifState04), - /* 60 */ - OPCODE(o_cursorCommand), - OPCODE(o2_putActor), - OPCODE(o2_stopScript), - OPCODE(o_stopCurrentScript), - /* 64 */ - OPCODE(o_ifActiveObject), - OPCODE(o_stopCurrentScript), - OPCODE(o_getClosestObjActor), - OPCODE(o5_getActorFacing), - /* 68 */ - OPCODE(o5_isScriptRunning), - OPCODE(o_setOwnerOf), - OPCODE(o_stopCurrentScript), - OPCODE(o_setActorBitVar), - /* 6C */ - OPCODE(o_stopCurrentScript), - OPCODE(o2_putActorInRoom), - OPCODE(o2_dummy), - OPCODE(o2_ifState08), - /* 70 */ - OPCODE(o_lights), - OPCODE(o_getBitVar), - OPCODE(o_nop), - OPCODE(o5_getObjectOwner), - /* 74 */ - OPCODE(o5_getDist), - OPCODE(o_printEgo_c64), - OPCODE(o2_walkActorToObject), - OPCODE(o2_clearState04), - /* 78 */ - OPCODE(o_isGreater), - OPCODE(o_stopCurrentScript), - OPCODE(o_stopCurrentScript), - OPCODE(o_stopCurrentScript), - /* 7C */ - OPCODE(o5_isSoundRunning), - OPCODE(o_setBitVar), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifNotState02), - /* 80 */ - OPCODE(o_stopCurrentScript), - OPCODE(o2_putActor), - OPCODE(o_stopCurrentScript), - OPCODE(o_doSentence), - /* 84 */ - OPCODE(o_isGreaterEqual), - OPCODE(o_stopCurrentScript), - OPCODE(o_nop), - OPCODE(o5_getActorRoom), - /* 88 */ - OPCODE(o_isNotEqual), - OPCODE(o_stopCurrentScript), - OPCODE(o_stopCurrentScript), - OPCODE(o_setActorBitVar), - /* 8C */ - OPCODE(o_loadSound), - OPCODE(o_stopCurrentScript), - OPCODE(o_putActorAtObject), - OPCODE(o2_setState02), - /* 90 */ - OPCODE(o_pickupObject), - OPCODE(o_animateActor), - OPCODE(o2_panCameraTo), - OPCODE(o_unlockCostume), - /* 94 */ - OPCODE(o5_print), - OPCODE(o2_actorFromPos), - OPCODE(o_stopCurrentScript), - OPCODE(o_setState08), - /* 98 */ - OPCODE(o2_restart), - OPCODE(o_stopCurrentScript), - OPCODE(o5_move), - OPCODE(o_getActorBitVar), - /* 9C */ - OPCODE(o5_startSound), - OPCODE(o_setBitVar), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifNotState04), - /* A0 */ - OPCODE(o5_stopObjectCode), - OPCODE(o2_putActor), - OPCODE(o5_saveLoadGame), - OPCODE(o_stopCurrentScript), - /* A4 */ - OPCODE(o_unknown2), - OPCODE(o5_loadRoom), - OPCODE(o_stopCurrentScript), - OPCODE(o2_getActorY), - /* A8 */ - OPCODE(o_notEqualZero), - OPCODE(o_setOwnerOf), - OPCODE(o_stopCurrentScript), - OPCODE(o_setActorBitVar), - /* AC */ - OPCODE(o_stopCurrentScript), - OPCODE(o2_putActorInRoom), - OPCODE(o_print_c64), - OPCODE(o2_ifNotState08), - /* B0 */ - OPCODE(o_loadCostume), - OPCODE(o_getBitVar), - OPCODE(o2_setCameraAt), - OPCODE(o_unlockScript), - /* B4 */ - OPCODE(o5_getDist), - OPCODE(o_stopCurrentScript), - OPCODE(o2_walkActorToObject), - OPCODE(o2_setState04), - /* B8 */ - OPCODE(o_isLessEqual), - OPCODE(o_stopCurrentScript), - OPCODE(o2_subtract), - OPCODE(o_stopCurrentScript), - /* BC */ - OPCODE(o5_stopSound), - OPCODE(o_setBitVar), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifNotState02), - /* C0 */ - OPCODE(o_endCutscene), - OPCODE(o2_putActor), - OPCODE(o2_startScript), - OPCODE(o_doSentence), - /* C4 */ - OPCODE(o_isLess), - OPCODE(o_stopCurrentScript), - OPCODE(o5_decrement), - OPCODE(o2_getActorX), - /* C8 */ - OPCODE(o_isEqual), - OPCODE(o_stopCurrentScript), - OPCODE(o_loadRoom), - OPCODE(o_setActorBitVar), - /* CC */ - OPCODE(o_loadScript), - OPCODE(o_unlockRoom), - OPCODE(o_putActorAtObject), - OPCODE(o2_setState02), - /* D0 */ - OPCODE(o_nop), - OPCODE(o_animateActor), - OPCODE(o5_actorFollowCamera), - OPCODE(o_unlockSound), - /* D4 */ - OPCODE(o_setObjectName), - OPCODE(o2_actorFromPos), - OPCODE(o_getActorMoving), - OPCODE(o_setState08), - /* D8 */ - OPCODE(o_stopCurrentScript), - OPCODE(o_stopCurrentScript), - OPCODE(o2_add), - OPCODE(o_getActorBitVar), - /* DC */ - OPCODE(o5_startSound), - OPCODE(o_setBitVar), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifNotState04), - /* E0 */ - OPCODE(o_cursorCommand), - OPCODE(o2_putActor), - OPCODE(o2_stopScript), - OPCODE(o_stopCurrentScript), - /* E4 */ - OPCODE(o_ifActiveObject), - OPCODE(o_loadRoomWithEgo), - OPCODE(o_stopCurrentScript), - OPCODE(o5_getActorFacing), - /* E8 */ - OPCODE(o5_isScriptRunning), - OPCODE(o_setOwnerOf), - OPCODE(o_stopCurrentScript), - OPCODE(o_setActorBitVar), - /* EC */ - OPCODE(o_stopCurrentScript), - OPCODE(o2_putActorInRoom), - OPCODE(o2_dummy), - OPCODE(o2_ifNotState08), - /* F0 */ - OPCODE(o_lights), - OPCODE(o_getBitVar), - OPCODE(o_nop), - OPCODE(o5_getObjectOwner), - /* F4 */ - OPCODE(o5_getDist), - OPCODE(o_stopCurrentScript), - OPCODE(o2_walkActorToObject), - OPCODE(o2_setState04), - /* F8 */ - OPCODE(o_isGreater), - OPCODE(o_stopCurrentScript), - OPCODE(o_stopCurrentScript), - OPCODE(o_stopCurrentScript), - /* FC */ - OPCODE(o5_isSoundRunning), - OPCODE(o_setBitVar), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifState02) - }; - - _opcodesC64 = opcodes; + /* 00 */ + OPCODE(0x00, o5_stopObjectCode); + OPCODE(0x01, o2_putActor); + OPCODE(0x02, o5_startMusic); + OPCODE(0x03, o_doSentence); + /* 04 */ + OPCODE(0x04, o_isGreaterEqual); + OPCODE(0x05, o_stopCurrentScript); + OPCODE(0x06, o5_getDist); + OPCODE(0x07, o5_getActorRoom); + /* 08 */ + OPCODE(0x08, o_isNotEqual); + OPCODE(0x09, o_stopCurrentScript); + OPCODE(0x0a, o_stopCurrentScript); + OPCODE(0x0b, o_setActorBitVar); + /* 0C */ + OPCODE(0x0c, o_loadSound); + OPCODE(0x0d, o_printEgo_c64); + OPCODE(0x0e, o_putActorAtObject); + OPCODE(0x0f, o2_clearState02); + /* 10 */ + OPCODE(0x10, o5_breakHere); + OPCODE(0x11, o_animateActor); + OPCODE(0x12, o2_panCameraTo); + OPCODE(0x13, o_lockCostume); + /* 14 */ + OPCODE(0x14, o_print_c64); + OPCODE(0x15, o5_walkActorToActor); + OPCODE(0x16, o5_getRandomNr); + OPCODE(0x17, o_clearState08); + /* 18 */ + OPCODE(0x18, o_jumpRelative); + OPCODE(0x19, o_stopCurrentScript); + OPCODE(0x1a, o5_move); + OPCODE(0x1b, o_getActorBitVar); + /* 1C */ + OPCODE(0x1c, o5_startSound); + OPCODE(0x1d, o_setBitVar); + OPCODE(0x1e, o2_walkActorTo); + OPCODE(0x1f, o2_ifState04); + /* 20 */ + OPCODE(0x20, o5_stopMusic); + OPCODE(0x21, o2_putActor); + OPCODE(0x22, o5_saveLoadGame); + OPCODE(0x23, o_stopCurrentScript); + /* 24 */ + OPCODE(0x24, o_unknown2); + OPCODE(0x25, o5_loadRoom); + OPCODE(0x26, o_getClosestObjActor); + OPCODE(0x27, o2_getActorY); + /* 28 */ + OPCODE(0x28, o_equalZero); + OPCODE(0x29, o_setOwnerOf); + OPCODE(0x2a, o2_delay); + OPCODE(0x2b, o_setActorBitVar); + /* 2C */ + OPCODE(0x2c, o_stopCurrentScript); + OPCODE(0x2d, o2_putActorInRoom); + OPCODE(0x2e, o_print_c64); + OPCODE(0x2f, o2_ifState08); + /* 30 */ + OPCODE(0x30, o_loadCostume); + OPCODE(0x31, o_getBitVar); + OPCODE(0x32, o2_setCameraAt); + OPCODE(0x33, o_lockScript); + /* 34 */ + OPCODE(0x34, o5_getDist); + OPCODE(0x35, o_stopCurrentScript); + OPCODE(0x36, o2_walkActorToObject); + OPCODE(0x37, o2_clearState04); + /* 38 */ + OPCODE(0x38, o_isLessEqual); + OPCODE(0x39, o_stopCurrentScript); + OPCODE(0x3a, o2_subtract); + OPCODE(0x3b, o_stopCurrentScript); + /* 3C */ + OPCODE(0x3c, o5_stopSound); + OPCODE(0x3d, o_setBitVar); + OPCODE(0x3e, o2_walkActorTo); + OPCODE(0x3f, o2_ifState02); + /* 40 */ + OPCODE(0x40, o_cutscene); + OPCODE(0x41, o2_putActor); + OPCODE(0x42, o2_startScript); + OPCODE(0x43, o_doSentence); + /* 44 */ + OPCODE(0x44, o_isLess); + OPCODE(0x45, o_stopCurrentScript); + OPCODE(0x46, o5_increment); + OPCODE(0x47, o2_getActorX); + /* 48 */ + OPCODE(0x48, o_isEqual); + OPCODE(0x49, o_stopCurrentScript); + OPCODE(0x4a, o_loadRoom); + OPCODE(0x4b, o_setActorBitVar); + /* 4C */ + OPCODE(0x4c, o_loadScript); + OPCODE(0x4d, o_lockRoom); + OPCODE(0x4e, o_putActorAtObject); + OPCODE(0x4f, o2_clearState02); + /* 50 */ + OPCODE(0x50, o_nop); + OPCODE(0x51, o_animateActor); + OPCODE(0x52, o5_actorFollowCamera); + OPCODE(0x53, o_lockSound); + /* 54 */ + OPCODE(0x54, o_setObjectName); + OPCODE(0x55, o5_walkActorToActor); + OPCODE(0x56, o_getActorMoving); + OPCODE(0x57, o_clearState08); + /* 58 */ + OPCODE(0x58, o_beginOverride); + OPCODE(0x59, o_stopCurrentScript); + OPCODE(0x5a, o2_add); + OPCODE(0x5b, o_getActorBitVar); + /* 5C */ + OPCODE(0x5c, o5_startSound); + OPCODE(0x5d, o_setBitVar); + OPCODE(0x5e, o2_walkActorTo); + OPCODE(0x5f, o2_ifState04); + /* 60 */ + OPCODE(0x60, o_cursorCommand); + OPCODE(0x61, o2_putActor); + OPCODE(0x62, o2_stopScript); + OPCODE(0x63, o_stopCurrentScript); + /* 64 */ + OPCODE(0x64, o_ifActiveObject); + OPCODE(0x65, o_stopCurrentScript); + OPCODE(0x66, o_getClosestObjActor); + OPCODE(0x67, o5_getActorFacing); + /* 68 */ + OPCODE(0x68, o5_isScriptRunning); + OPCODE(0x69, o_setOwnerOf); + OPCODE(0x6a, o_stopCurrentScript); + OPCODE(0x6b, o_setActorBitVar); + /* 6C */ + OPCODE(0x6c, o_stopCurrentScript); + OPCODE(0x6d, o2_putActorInRoom); + OPCODE(0x6e, o2_dummy); + OPCODE(0x6f, o2_ifState08); + /* 70 */ + OPCODE(0x70, o_lights); + OPCODE(0x71, o_getBitVar); + OPCODE(0x72, o_nop); + OPCODE(0x73, o5_getObjectOwner); + /* 74 */ + OPCODE(0x74, o5_getDist); + OPCODE(0x75, o_printEgo_c64); + OPCODE(0x76, o2_walkActorToObject); + OPCODE(0x77, o2_clearState04); + /* 78 */ + OPCODE(0x78, o_isGreater); + OPCODE(0x79, o_stopCurrentScript); + OPCODE(0x7a, o_stopCurrentScript); + OPCODE(0x7b, o_stopCurrentScript); + /* 7C */ + OPCODE(0x7c, o5_isSoundRunning); + OPCODE(0x7d, o_setBitVar); + OPCODE(0x7e, o2_walkActorTo); + OPCODE(0x7f, o2_ifNotState02); + /* 80 */ + OPCODE(0x80, o_stopCurrentScript); + OPCODE(0x81, o2_putActor); + OPCODE(0x82, o_stopCurrentScript); + OPCODE(0x83, o_doSentence); + /* 84 */ + OPCODE(0x84, o_isGreaterEqual); + OPCODE(0x85, o_stopCurrentScript); + OPCODE(0x86, o_nop); + OPCODE(0x87, o5_getActorRoom); + /* 88 */ + OPCODE(0x88, o_isNotEqual); + OPCODE(0x89, o_stopCurrentScript); + OPCODE(0x8a, o_stopCurrentScript); + OPCODE(0x8b, o_setActorBitVar); + /* 8C */ + OPCODE(0x8c, o_loadSound); + OPCODE(0x8d, o_stopCurrentScript); + OPCODE(0x8e, o_putActorAtObject); + OPCODE(0x8f, o2_setState02); + /* 90 */ + OPCODE(0x90, o_pickupObject); + OPCODE(0x91, o_animateActor); + OPCODE(0x92, o2_panCameraTo); + OPCODE(0x93, o_unlockCostume); + /* 94 */ + OPCODE(0x94, o5_print); + OPCODE(0x95, o2_actorFromPos); + OPCODE(0x96, o_stopCurrentScript); + OPCODE(0x97, o_setState08); + /* 98 */ + OPCODE(0x98, o2_restart); + OPCODE(0x99, o_stopCurrentScript); + OPCODE(0x9a, o5_move); + OPCODE(0x9b, o_getActorBitVar); + /* 9C */ + OPCODE(0x9c, o5_startSound); + OPCODE(0x9d, o_setBitVar); + OPCODE(0x9e, o2_walkActorTo); + OPCODE(0x9f, o2_ifNotState04); + /* A0 */ + OPCODE(0xa0, o5_stopObjectCode); + OPCODE(0xa1, o2_putActor); + OPCODE(0xa2, o5_saveLoadGame); + OPCODE(0xa3, o_stopCurrentScript); + /* A4 */ + OPCODE(0xa4, o_unknown2); + OPCODE(0xa5, o5_loadRoom); + OPCODE(0xa6, o_stopCurrentScript); + OPCODE(0xa7, o2_getActorY); + /* A8 */ + OPCODE(0xa8, o_notEqualZero); + OPCODE(0xa9, o_setOwnerOf); + OPCODE(0xaa, o_stopCurrentScript); + OPCODE(0xab, o_setActorBitVar); + /* AC */ + OPCODE(0xac, o_stopCurrentScript); + OPCODE(0xad, o2_putActorInRoom); + OPCODE(0xae, o_print_c64); + OPCODE(0xaf, o2_ifNotState08); + /* B0 */ + OPCODE(0xb0, o_loadCostume); + OPCODE(0xb1, o_getBitVar); + OPCODE(0xb2, o2_setCameraAt); + OPCODE(0xb3, o_unlockScript); + /* B4 */ + OPCODE(0xb4, o5_getDist); + OPCODE(0xb5, o_stopCurrentScript); + OPCODE(0xb6, o2_walkActorToObject); + OPCODE(0xb7, o2_setState04); + /* B8 */ + OPCODE(0xb8, o_isLessEqual); + OPCODE(0xb9, o_stopCurrentScript); + OPCODE(0xba, o2_subtract); + OPCODE(0xbb, o_stopCurrentScript); + /* BC */ + OPCODE(0xbc, o5_stopSound); + OPCODE(0xbd, o_setBitVar); + OPCODE(0xbe, o2_walkActorTo); + OPCODE(0xbf, o2_ifNotState02); + /* C0 */ + OPCODE(0xc0, o_endCutscene); + OPCODE(0xc1, o2_putActor); + OPCODE(0xc2, o2_startScript); + OPCODE(0xc3, o_doSentence); + /* C4 */ + OPCODE(0xc4, o_isLess); + OPCODE(0xc5, o_stopCurrentScript); + OPCODE(0xc6, o5_decrement); + OPCODE(0xc7, o2_getActorX); + /* C8 */ + OPCODE(0xc8, o_isEqual); + OPCODE(0xc9, o_stopCurrentScript); + OPCODE(0xca, o_loadRoom); + OPCODE(0xcb, o_setActorBitVar); + /* CC */ + OPCODE(0xcc, o_loadScript); + OPCODE(0xcd, o_unlockRoom); + OPCODE(0xce, o_putActorAtObject); + OPCODE(0xcf, o2_setState02); + /* D0 */ + OPCODE(0xd0, o_nop); + OPCODE(0xd1, o_animateActor); + OPCODE(0xd2, o5_actorFollowCamera); + OPCODE(0xd3, o_unlockSound); + /* D4 */ + OPCODE(0xd4, o_setObjectName); + OPCODE(0xd5, o2_actorFromPos); + OPCODE(0xd6, o_getActorMoving); + OPCODE(0xd7, o_setState08); + /* D8 */ + OPCODE(0xd8, o_stopCurrentScript); + OPCODE(0xd9, o_stopCurrentScript); + OPCODE(0xda, o2_add); + OPCODE(0xdb, o_getActorBitVar); + /* DC */ + OPCODE(0xdc, o5_startSound); + OPCODE(0xdd, o_setBitVar); + OPCODE(0xde, o2_walkActorTo); + OPCODE(0xdf, o2_ifNotState04); + /* E0 */ + OPCODE(0xe0, o_cursorCommand); + OPCODE(0xe1, o2_putActor); + OPCODE(0xe2, o2_stopScript); + OPCODE(0xe3, o_stopCurrentScript); + /* E4 */ + OPCODE(0xe4, o_ifActiveObject); + OPCODE(0xe5, o_loadRoomWithEgo); + OPCODE(0xe6, o_stopCurrentScript); + OPCODE(0xe7, o5_getActorFacing); + /* E8 */ + OPCODE(0xe8, o5_isScriptRunning); + OPCODE(0xe9, o_setOwnerOf); + OPCODE(0xea, o_stopCurrentScript); + OPCODE(0xeb, o_setActorBitVar); + /* EC */ + OPCODE(0xec, o_stopCurrentScript); + OPCODE(0xed, o2_putActorInRoom); + OPCODE(0xee, o2_dummy); + OPCODE(0xef, o2_ifNotState08); + /* F0 */ + OPCODE(0xf0, o_lights); + OPCODE(0xf1, o_getBitVar); + OPCODE(0xf2, o_nop); + OPCODE(0xf3, o5_getObjectOwner); + /* F4 */ + OPCODE(0xf4, o5_getDist); + OPCODE(0xf5, o_stopCurrentScript); + OPCODE(0xf6, o2_walkActorToObject); + OPCODE(0xf7, o2_setState04); + /* F8 */ + OPCODE(0xf8, o_isGreater); + OPCODE(0xf9, o_stopCurrentScript); + OPCODE(0xfa, o_stopCurrentScript); + OPCODE(0xfb, o_stopCurrentScript); + /* FC */ + OPCODE(0xfc, o5_isSoundRunning); + OPCODE(0xfd, o_setBitVar); + OPCODE(0xfe, o2_walkActorTo); + OPCODE(0xff, o2_ifState02); } #define SENTENCE_SCRIPT 2 @@ -368,11 +363,6 @@ void ScummEngine_v0::setupOpcodes() { #define PARAM_2 0x40 #define PARAM_3 0x20 -void ScummEngine_v0::executeOpcode(byte i) { - OpcodeProcC64 op = _opcodesC64[i].proc; - (this->*op) (); -} - int ScummEngine_v0::getVarOrDirectWord(byte mask) { return getVarOrDirectByte(mask); } @@ -381,10 +371,6 @@ uint ScummEngine_v0::fetchScriptWord() { return fetchScriptByte(); } -const char *ScummEngine_v0::getOpcodeDesc(byte i) { - return _opcodesC64[i].desc; -} - int ScummEngine_v0::getObjectFlag() { if (_opcode & 0x40) return _activeObject; diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index a06b4c7f2d..57d79438b6 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -26,7 +26,6 @@ #include "scumm/actor.h" #include "scumm/charset.h" -#include "scumm/intern.h" #include "scumm/object.h" #include "scumm/scumm_v2.h" #include "scumm/sound.h" @@ -35,333 +34,329 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v2, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v2, x) void ScummEngine_v2::setupOpcodes() { - static const OpcodeEntryV2 opcodes[256] = { - /* 00 */ - OPCODE(o5_stopObjectCode), - OPCODE(o2_putActor), - OPCODE(o5_startMusic), - OPCODE(o5_getActorRoom), - /* 04 */ - OPCODE(o2_isGreaterEqual), - OPCODE(o2_drawObject), - OPCODE(o2_getActorElevation), - OPCODE(o2_setState08), - /* 08 */ - OPCODE(o5_isNotEqual), - OPCODE(o5_faceActor), - OPCODE(o2_assignVarWordIndirect), - OPCODE(o2_setObjPreposition), - /* 0C */ - OPCODE(o2_resourceRoutines), - OPCODE(o5_walkActorToActor), - OPCODE(o2_putActorAtObject), - OPCODE(o2_ifNotState08), - /* 10 */ - OPCODE(o5_getObjectOwner), - OPCODE(o5_animateActor), - OPCODE(o2_panCameraTo), - OPCODE(o2_actorOps), - /* 14 */ - OPCODE(o5_print), - OPCODE(o2_actorFromPos), - OPCODE(o5_getRandomNr), - OPCODE(o2_clearState02), - /* 18 */ - OPCODE(o5_jumpRelative), - OPCODE(o2_doSentence), - OPCODE(o5_move), - OPCODE(o2_setBitVar), - /* 1C */ - OPCODE(o5_startSound), - OPCODE(o2_ifClassOfIs), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifState02), - /* 20 */ - OPCODE(o5_stopMusic), - OPCODE(o2_putActor), - OPCODE(o5_saveLoadGame), - OPCODE(o2_getActorY), - /* 24 */ - OPCODE(o2_loadRoomWithEgo), - OPCODE(o2_drawObject), - OPCODE(o5_setVarRange), - OPCODE(o2_setState04), - /* 28 */ - OPCODE(o5_equalZero), - OPCODE(o2_setOwnerOf), - OPCODE(o2_addIndirect), - OPCODE(o5_delayVariable), - /* 2C */ - OPCODE(o2_assignVarByte), - OPCODE(o2_putActorInRoom), - OPCODE(o2_delay), - OPCODE(o2_ifNotState04), - /* 30 */ - OPCODE(o2_setBoxFlags), - OPCODE(o2_getBitVar), - OPCODE(o2_setCameraAt), - OPCODE(o2_roomOps), - /* 34 */ - OPCODE(o5_getDist), - OPCODE(o2_findObject), - OPCODE(o2_walkActorToObject), - OPCODE(o2_setState01), - /* 38 */ - OPCODE(o2_isLessEqual), - OPCODE(o2_doSentence), - OPCODE(o2_subtract), - OPCODE(o2_waitForActor), - /* 3C */ - OPCODE(o5_stopSound), - OPCODE(o2_setActorElevation), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifNotState01), - /* 40 */ - OPCODE(o2_cutscene), - OPCODE(o2_putActor), - OPCODE(o2_startScript), - OPCODE(o2_getActorX), - /* 44 */ - OPCODE(o2_isLess), - OPCODE(o2_drawObject), - OPCODE(o5_increment), - OPCODE(o2_clearState08), - /* 48 */ - OPCODE(o5_isEqual), - OPCODE(o5_faceActor), - OPCODE(o2_chainScript), - OPCODE(o2_setObjPreposition), - /* 4C */ - OPCODE(o2_waitForSentence), - OPCODE(o5_walkActorToActor), - OPCODE(o2_putActorAtObject), - OPCODE(o2_ifState08), - /* 50 */ - OPCODE(o2_pickupObject), - OPCODE(o5_animateActor), - OPCODE(o5_actorFollowCamera), - OPCODE(o2_actorOps), - /* 54 */ - OPCODE(o5_setObjectName), - OPCODE(o2_actorFromPos), - OPCODE(o5_getActorMoving), - OPCODE(o2_setState02), - /* 58 */ - OPCODE(o2_beginOverride), - OPCODE(o2_doSentence), - OPCODE(o2_add), - OPCODE(o2_setBitVar), - /* 5C */ - OPCODE(o2_dummy), - OPCODE(o2_ifClassOfIs), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifNotState02), - /* 60 */ - OPCODE(o2_cursorCommand), - OPCODE(o2_putActor), - OPCODE(o2_stopScript), - OPCODE(o5_getActorFacing), - /* 64 */ - OPCODE(o2_loadRoomWithEgo), - OPCODE(o2_drawObject), - OPCODE(o5_getClosestObjActor), - OPCODE(o2_clearState04), - /* 68 */ - OPCODE(o5_isScriptRunning), - OPCODE(o2_setOwnerOf), - OPCODE(o2_subIndirect), - OPCODE(o2_dummy), - /* 6C */ - OPCODE(o2_getObjPreposition), - OPCODE(o2_putActorInRoom), - OPCODE(o2_dummy), - OPCODE(o2_ifState04), - /* 70 */ - OPCODE(o2_lights), - OPCODE(o5_getActorCostume), - OPCODE(o5_loadRoom), - OPCODE(o2_roomOps), - /* 74 */ - OPCODE(o5_getDist), - OPCODE(o2_findObject), - OPCODE(o2_walkActorToObject), - OPCODE(o2_clearState01), - /* 78 */ - OPCODE(o2_isGreater), - OPCODE(o2_doSentence), - OPCODE(o2_verbOps), - OPCODE(o2_getActorWalkBox), - /* 7C */ - OPCODE(o5_isSoundRunning), - OPCODE(o2_setActorElevation), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifState01), - /* 80 */ - OPCODE(o5_breakHere), - OPCODE(o2_putActor), - OPCODE(o5_startMusic), - OPCODE(o5_getActorRoom), - /* 84 */ - OPCODE(o2_isGreaterEqual), - OPCODE(o2_drawObject), - OPCODE(o2_getActorElevation), - OPCODE(o2_setState08), - /* 88 */ - OPCODE(o5_isNotEqual), - OPCODE(o5_faceActor), - OPCODE(o2_assignVarWordIndirect), - OPCODE(o2_setObjPreposition), - /* 8C */ - OPCODE(o2_resourceRoutines), - OPCODE(o5_walkActorToActor), - OPCODE(o2_putActorAtObject), - OPCODE(o2_ifNotState08), - /* 90 */ - OPCODE(o5_getObjectOwner), - OPCODE(o5_animateActor), - OPCODE(o2_panCameraTo), - OPCODE(o2_actorOps), - /* 94 */ - OPCODE(o5_print), - OPCODE(o2_actorFromPos), - OPCODE(o5_getRandomNr), - OPCODE(o2_clearState02), - /* 98 */ - OPCODE(o2_restart), - OPCODE(o2_doSentence), - OPCODE(o5_move), - OPCODE(o2_setBitVar), - /* 9C */ - OPCODE(o5_startSound), - OPCODE(o2_ifClassOfIs), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifState02), - /* A0 */ - OPCODE(o5_stopObjectCode), - OPCODE(o2_putActor), - OPCODE(o5_saveLoadGame), - OPCODE(o2_getActorY), - /* A4 */ - OPCODE(o2_loadRoomWithEgo), - OPCODE(o2_drawObject), - OPCODE(o5_setVarRange), - OPCODE(o2_setState04), - /* A8 */ - OPCODE(o5_notEqualZero), - OPCODE(o2_setOwnerOf), - OPCODE(o2_addIndirect), - OPCODE(o2_switchCostumeSet), - /* AC */ - OPCODE(o2_drawSentence), - OPCODE(o2_putActorInRoom), - OPCODE(o2_waitForMessage), - OPCODE(o2_ifNotState04), - /* B0 */ - OPCODE(o2_setBoxFlags), - OPCODE(o2_getBitVar), - OPCODE(o2_setCameraAt), - OPCODE(o2_roomOps), - /* B4 */ - OPCODE(o5_getDist), - OPCODE(o2_findObject), - OPCODE(o2_walkActorToObject), - OPCODE(o2_setState01), - /* B8 */ - OPCODE(o2_isLessEqual), - OPCODE(o2_doSentence), - OPCODE(o2_subtract), - OPCODE(o2_waitForActor), - /* BC */ - OPCODE(o5_stopSound), - OPCODE(o2_setActorElevation), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifNotState01), - /* C0 */ - OPCODE(o2_endCutscene), - OPCODE(o2_putActor), - OPCODE(o2_startScript), - OPCODE(o2_getActorX), - /* C4 */ - OPCODE(o2_isLess), - OPCODE(o2_drawObject), - OPCODE(o5_decrement), - OPCODE(o2_clearState08), - /* C8 */ - OPCODE(o5_isEqual), - OPCODE(o5_faceActor), - OPCODE(o2_chainScript), - OPCODE(o2_setObjPreposition), - /* CC */ - OPCODE(o5_pseudoRoom), - OPCODE(o5_walkActorToActor), - OPCODE(o2_putActorAtObject), - OPCODE(o2_ifState08), - /* D0 */ - OPCODE(o2_pickupObject), - OPCODE(o5_animateActor), - OPCODE(o5_actorFollowCamera), - OPCODE(o2_actorOps), - /* D4 */ - OPCODE(o5_setObjectName), - OPCODE(o2_actorFromPos), - OPCODE(o5_getActorMoving), - OPCODE(o2_setState02), - /* D8 */ - OPCODE(o5_printEgo), - OPCODE(o2_doSentence), - OPCODE(o2_add), - OPCODE(o2_setBitVar), - /* DC */ - OPCODE(o2_dummy), - OPCODE(o2_ifClassOfIs), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifNotState02), - /* E0 */ - OPCODE(o2_cursorCommand), - OPCODE(o2_putActor), - OPCODE(o2_stopScript), - OPCODE(o5_getActorFacing), - /* E4 */ - OPCODE(o2_loadRoomWithEgo), - OPCODE(o2_drawObject), - OPCODE(o5_getClosestObjActor), - OPCODE(o2_clearState04), - /* E8 */ - OPCODE(o5_isScriptRunning), - OPCODE(o2_setOwnerOf), - OPCODE(o2_subIndirect), - OPCODE(o2_dummy), - /* EC */ - OPCODE(o2_getObjPreposition), - OPCODE(o2_putActorInRoom), - OPCODE(o2_dummy), - OPCODE(o2_ifState04), - /* F0 */ - OPCODE(o2_lights), - OPCODE(o5_getActorCostume), - OPCODE(o5_loadRoom), - OPCODE(o2_roomOps), - /* F4 */ - OPCODE(o5_getDist), - OPCODE(o2_findObject), - OPCODE(o2_walkActorToObject), - OPCODE(o2_clearState01), - /* F8 */ - OPCODE(o2_isGreater), - OPCODE(o2_doSentence), - OPCODE(o2_verbOps), - OPCODE(o2_getActorWalkBox), - /* FC */ - OPCODE(o5_isSoundRunning), - OPCODE(o2_setActorElevation), - OPCODE(o2_walkActorTo), - OPCODE(o2_ifState01) - }; - - _opcodesV2 = opcodes; + /* 00 */ + OPCODE(0x00, o5_stopObjectCode); + OPCODE(0x01, o2_putActor); + OPCODE(0x02, o5_startMusic); + OPCODE(0x03, o5_getActorRoom); + /* 04 */ + OPCODE(0x04, o2_isGreaterEqual); + OPCODE(0x05, o2_drawObject); + OPCODE(0x06, o2_getActorElevation); + OPCODE(0x07, o2_setState08); + /* 08 */ + OPCODE(0x08, o5_isNotEqual); + OPCODE(0x09, o5_faceActor); + OPCODE(0x0a, o2_assignVarWordIndirect); + OPCODE(0x0b, o2_setObjPreposition); + /* 0C */ + OPCODE(0x0c, o2_resourceRoutines); + OPCODE(0x0d, o5_walkActorToActor); + OPCODE(0x0e, o2_putActorAtObject); + OPCODE(0x0f, o2_ifNotState08); + /* 10 */ + OPCODE(0x10, o5_getObjectOwner); + OPCODE(0x11, o5_animateActor); + OPCODE(0x12, o2_panCameraTo); + OPCODE(0x13, o2_actorOps); + /* 14 */ + OPCODE(0x14, o5_print); + OPCODE(0x15, o2_actorFromPos); + OPCODE(0x16, o5_getRandomNr); + OPCODE(0x17, o2_clearState02); + /* 18 */ + OPCODE(0x18, o5_jumpRelative); + OPCODE(0x19, o2_doSentence); + OPCODE(0x1a, o5_move); + OPCODE(0x1b, o2_setBitVar); + /* 1C */ + OPCODE(0x1c, o5_startSound); + OPCODE(0x1d, o2_ifClassOfIs); + OPCODE(0x1e, o2_walkActorTo); + OPCODE(0x1f, o2_ifState02); + /* 20 */ + OPCODE(0x20, o5_stopMusic); + OPCODE(0x21, o2_putActor); + OPCODE(0x22, o5_saveLoadGame); + OPCODE(0x23, o2_getActorY); + /* 24 */ + OPCODE(0x24, o2_loadRoomWithEgo); + OPCODE(0x25, o2_drawObject); + OPCODE(0x26, o5_setVarRange); + OPCODE(0x27, o2_setState04); + /* 28 */ + OPCODE(0x28, o5_equalZero); + OPCODE(0x29, o2_setOwnerOf); + OPCODE(0x2a, o2_addIndirect); + OPCODE(0x2b, o5_delayVariable); + /* 2C */ + OPCODE(0x2c, o2_assignVarByte); + OPCODE(0x2d, o2_putActorInRoom); + OPCODE(0x2e, o2_delay); + OPCODE(0x2f, o2_ifNotState04); + /* 30 */ + OPCODE(0x30, o2_setBoxFlags); + OPCODE(0x31, o2_getBitVar); + OPCODE(0x32, o2_setCameraAt); + OPCODE(0x33, o2_roomOps); + /* 34 */ + OPCODE(0x34, o5_getDist); + OPCODE(0x35, o2_findObject); + OPCODE(0x36, o2_walkActorToObject); + OPCODE(0x37, o2_setState01); + /* 38 */ + OPCODE(0x38, o2_isLessEqual); + OPCODE(0x39, o2_doSentence); + OPCODE(0x3a, o2_subtract); + OPCODE(0x3b, o2_waitForActor); + /* 3C */ + OPCODE(0x3c, o5_stopSound); + OPCODE(0x3d, o2_setActorElevation); + OPCODE(0x3e, o2_walkActorTo); + OPCODE(0x3f, o2_ifNotState01); + /* 40 */ + OPCODE(0x40, o2_cutscene); + OPCODE(0x41, o2_putActor); + OPCODE(0x42, o2_startScript); + OPCODE(0x43, o2_getActorX); + /* 44 */ + OPCODE(0x44, o2_isLess); + OPCODE(0x45, o2_drawObject); + OPCODE(0x46, o5_increment); + OPCODE(0x47, o2_clearState08); + /* 48 */ + OPCODE(0x48, o5_isEqual); + OPCODE(0x49, o5_faceActor); + OPCODE(0x4a, o2_chainScript); + OPCODE(0x4b, o2_setObjPreposition); + /* 4C */ + OPCODE(0x4c, o2_waitForSentence); + OPCODE(0x4d, o5_walkActorToActor); + OPCODE(0x4e, o2_putActorAtObject); + OPCODE(0x4f, o2_ifState08); + /* 50 */ + OPCODE(0x50, o2_pickupObject); + OPCODE(0x51, o5_animateActor); + OPCODE(0x52, o5_actorFollowCamera); + OPCODE(0x53, o2_actorOps); + /* 54 */ + OPCODE(0x54, o5_setObjectName); + OPCODE(0x55, o2_actorFromPos); + OPCODE(0x56, o5_getActorMoving); + OPCODE(0x57, o2_setState02); + /* 58 */ + OPCODE(0x58, o2_beginOverride); + OPCODE(0x59, o2_doSentence); + OPCODE(0x5a, o2_add); + OPCODE(0x5b, o2_setBitVar); + /* 5C */ + OPCODE(0x5c, o2_dummy); + OPCODE(0x5d, o2_ifClassOfIs); + OPCODE(0x5e, o2_walkActorTo); + OPCODE(0x5f, o2_ifNotState02); + /* 60 */ + OPCODE(0x60, o2_cursorCommand); + OPCODE(0x61, o2_putActor); + OPCODE(0x62, o2_stopScript); + OPCODE(0x63, o5_getActorFacing); + /* 64 */ + OPCODE(0x64, o2_loadRoomWithEgo); + OPCODE(0x65, o2_drawObject); + OPCODE(0x66, o5_getClosestObjActor); + OPCODE(0x67, o2_clearState04); + /* 68 */ + OPCODE(0x68, o5_isScriptRunning); + OPCODE(0x69, o2_setOwnerOf); + OPCODE(0x6a, o2_subIndirect); + OPCODE(0x6b, o2_dummy); + /* 6C */ + OPCODE(0x6c, o2_getObjPreposition); + OPCODE(0x6d, o2_putActorInRoom); + OPCODE(0x6e, o2_dummy); + OPCODE(0x6f, o2_ifState04); + /* 70 */ + OPCODE(0x70, o2_lights); + OPCODE(0x71, o5_getActorCostume); + OPCODE(0x72, o5_loadRoom); + OPCODE(0x73, o2_roomOps); + /* 74 */ + OPCODE(0x74, o5_getDist); + OPCODE(0x75, o2_findObject); + OPCODE(0x76, o2_walkActorToObject); + OPCODE(0x77, o2_clearState01); + /* 78 */ + OPCODE(0x78, o2_isGreater); + OPCODE(0x79, o2_doSentence); + OPCODE(0x7a, o2_verbOps); + OPCODE(0x7b, o2_getActorWalkBox); + /* 7C */ + OPCODE(0x7c, o5_isSoundRunning); + OPCODE(0x7d, o2_setActorElevation); + OPCODE(0x7e, o2_walkActorTo); + OPCODE(0x7f, o2_ifState01); + /* 80 */ + OPCODE(0x80, o5_breakHere); + OPCODE(0x81, o2_putActor); + OPCODE(0x82, o5_startMusic); + OPCODE(0x83, o5_getActorRoom); + /* 84 */ + OPCODE(0x84, o2_isGreaterEqual); + OPCODE(0x85, o2_drawObject); + OPCODE(0x86, o2_getActorElevation); + OPCODE(0x87, o2_setState08); + /* 88 */ + OPCODE(0x88, o5_isNotEqual); + OPCODE(0x89, o5_faceActor); + OPCODE(0x8a, o2_assignVarWordIndirect); + OPCODE(0x8b, o2_setObjPreposition); + /* 8C */ + OPCODE(0x8c, o2_resourceRoutines); + OPCODE(0x8d, o5_walkActorToActor); + OPCODE(0x8e, o2_putActorAtObject); + OPCODE(0x8f, o2_ifNotState08); + /* 90 */ + OPCODE(0x90, o5_getObjectOwner); + OPCODE(0x91, o5_animateActor); + OPCODE(0x92, o2_panCameraTo); + OPCODE(0x93, o2_actorOps); + /* 94 */ + OPCODE(0x94, o5_print); + OPCODE(0x95, o2_actorFromPos); + OPCODE(0x96, o5_getRandomNr); + OPCODE(0x97, o2_clearState02); + /* 98 */ + OPCODE(0x98, o2_restart); + OPCODE(0x99, o2_doSentence); + OPCODE(0x9a, o5_move); + OPCODE(0x9b, o2_setBitVar); + /* 9C */ + OPCODE(0x9c, o5_startSound); + OPCODE(0x9d, o2_ifClassOfIs); + OPCODE(0x9e, o2_walkActorTo); + OPCODE(0x9f, o2_ifState02); + /* A0 */ + OPCODE(0xa0, o5_stopObjectCode); + OPCODE(0xa1, o2_putActor); + OPCODE(0xa2, o5_saveLoadGame); + OPCODE(0xa3, o2_getActorY); + /* A4 */ + OPCODE(0xa4, o2_loadRoomWithEgo); + OPCODE(0xa5, o2_drawObject); + OPCODE(0xa6, o5_setVarRange); + OPCODE(0xa7, o2_setState04); + /* A8 */ + OPCODE(0xa8, o5_notEqualZero); + OPCODE(0xa9, o2_setOwnerOf); + OPCODE(0xaa, o2_addIndirect); + OPCODE(0xab, o2_switchCostumeSet); + /* AC */ + OPCODE(0xac, o2_drawSentence); + OPCODE(0xad, o2_putActorInRoom); + OPCODE(0xae, o2_waitForMessage); + OPCODE(0xaf, o2_ifNotState04); + /* B0 */ + OPCODE(0xb0, o2_setBoxFlags); + OPCODE(0xb1, o2_getBitVar); + OPCODE(0xb2, o2_setCameraAt); + OPCODE(0xb3, o2_roomOps); + /* B4 */ + OPCODE(0xb4, o5_getDist); + OPCODE(0xb5, o2_findObject); + OPCODE(0xb6, o2_walkActorToObject); + OPCODE(0xb7, o2_setState01); + /* B8 */ + OPCODE(0xb8, o2_isLessEqual); + OPCODE(0xb9, o2_doSentence); + OPCODE(0xba, o2_subtract); + OPCODE(0xbb, o2_waitForActor); + /* BC */ + OPCODE(0xbc, o5_stopSound); + OPCODE(0xbd, o2_setActorElevation); + OPCODE(0xbe, o2_walkActorTo); + OPCODE(0xbf, o2_ifNotState01); + /* C0 */ + OPCODE(0xc0, o2_endCutscene); + OPCODE(0xc1, o2_putActor); + OPCODE(0xc2, o2_startScript); + OPCODE(0xc3, o2_getActorX); + /* C4 */ + OPCODE(0xc4, o2_isLess); + OPCODE(0xc5, o2_drawObject); + OPCODE(0xc6, o5_decrement); + OPCODE(0xc7, o2_clearState08); + /* C8 */ + OPCODE(0xc8, o5_isEqual); + OPCODE(0xc9, o5_faceActor); + OPCODE(0xca, o2_chainScript); + OPCODE(0xcb, o2_setObjPreposition); + /* CC */ + OPCODE(0xcc, o5_pseudoRoom); + OPCODE(0xcd, o5_walkActorToActor); + OPCODE(0xce, o2_putActorAtObject); + OPCODE(0xcf, o2_ifState08); + /* D0 */ + OPCODE(0xd0, o2_pickupObject); + OPCODE(0xd1, o5_animateActor); + OPCODE(0xd2, o5_actorFollowCamera); + OPCODE(0xd3, o2_actorOps); + /* D4 */ + OPCODE(0xd4, o5_setObjectName); + OPCODE(0xd5, o2_actorFromPos); + OPCODE(0xd6, o5_getActorMoving); + OPCODE(0xd7, o2_setState02); + /* D8 */ + OPCODE(0xd8, o5_printEgo); + OPCODE(0xd9, o2_doSentence); + OPCODE(0xda, o2_add); + OPCODE(0xdb, o2_setBitVar); + /* DC */ + OPCODE(0xdc, o2_dummy); + OPCODE(0xdd, o2_ifClassOfIs); + OPCODE(0xde, o2_walkActorTo); + OPCODE(0xdf, o2_ifNotState02); + /* E0 */ + OPCODE(0xe0, o2_cursorCommand); + OPCODE(0xe1, o2_putActor); + OPCODE(0xe2, o2_stopScript); + OPCODE(0xe3, o5_getActorFacing); + /* E4 */ + OPCODE(0xe4, o2_loadRoomWithEgo); + OPCODE(0xe5, o2_drawObject); + OPCODE(0xe6, o5_getClosestObjActor); + OPCODE(0xe7, o2_clearState04); + /* E8 */ + OPCODE(0xe8, o5_isScriptRunning); + OPCODE(0xe9, o2_setOwnerOf); + OPCODE(0xea, o2_subIndirect); + OPCODE(0xeb, o2_dummy); + /* EC */ + OPCODE(0xec, o2_getObjPreposition); + OPCODE(0xed, o2_putActorInRoom); + OPCODE(0xee, o2_dummy); + OPCODE(0xef, o2_ifState04); + /* F0 */ + OPCODE(0xf0, o2_lights); + OPCODE(0xf1, o5_getActorCostume); + OPCODE(0xf2, o5_loadRoom); + OPCODE(0xf3, o2_roomOps); + /* F4 */ + OPCODE(0xf4, o5_getDist); + OPCODE(0xf5, o2_findObject); + OPCODE(0xf6, o2_walkActorToObject); + OPCODE(0xf7, o2_clearState01); + /* F8 */ + OPCODE(0xf8, o2_isGreater); + OPCODE(0xf9, o2_doSentence); + OPCODE(0xfa, o2_verbOps); + OPCODE(0xfb, o2_getActorWalkBox); + /* FC */ + OPCODE(0xfc, o5_isSoundRunning); + OPCODE(0xfd, o2_setActorElevation); + OPCODE(0xfe, o2_walkActorTo); + OPCODE(0xff, o2_ifState01); } #define SENTENCE_SCRIPT 2 @@ -370,15 +365,6 @@ void ScummEngine_v2::setupOpcodes() { #define PARAM_2 0x40 #define PARAM_3 0x20 -void ScummEngine_v2::executeOpcode(byte i) { - OpcodeProcV2 op = _opcodesV2[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v2::getOpcodeDesc(byte i) { - return _opcodesV2[i].desc; -} - int ScummEngine_v2::getVar() { return readVar(fetchScriptByte()); } diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 7700c13301..ce4ef3dbe8 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -26,7 +26,6 @@ #include "scumm/actor.h" #include "scumm/charset.h" -#include "scumm/intern.h" #include "scumm/object.h" #include "scumm/scumm_v3.h" #include "scumm/scumm_v5.h" @@ -38,348 +37,335 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v5, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v5, x) void ScummEngine_v5::setupOpcodes() { - static const OpcodeEntryV5 opcodes[256] = { - /* 00 */ - OPCODE(o5_stopObjectCode), - OPCODE(o5_putActor), - OPCODE(o5_startMusic), - OPCODE(o5_getActorRoom), - /* 04 */ - OPCODE(o5_isGreaterEqual), - OPCODE(o5_drawObject), - OPCODE(o5_getActorElevation), - OPCODE(o5_setState), - /* 08 */ - OPCODE(o5_isNotEqual), - OPCODE(o5_faceActor), - OPCODE(o5_startScript), - OPCODE(o5_getVerbEntrypoint), - /* 0C */ - OPCODE(o5_resourceRoutines), - OPCODE(o5_walkActorToActor), - OPCODE(o5_putActorAtObject), - OPCODE(o5_getObjectState), - /* 10 */ - OPCODE(o5_getObjectOwner), - OPCODE(o5_animateActor), - OPCODE(o5_panCameraTo), - OPCODE(o5_actorOps), - /* 14 */ - OPCODE(o5_print), - OPCODE(o5_actorFromPos), - OPCODE(o5_getRandomNr), - OPCODE(o5_and), - /* 18 */ - OPCODE(o5_jumpRelative), - OPCODE(o5_doSentence), - OPCODE(o5_move), - OPCODE(o5_multiply), - /* 1C */ - OPCODE(o5_startSound), - OPCODE(o5_ifClassOfIs), - OPCODE(o5_walkActorTo), - OPCODE(o5_isActorInBox), - /* 20 */ - OPCODE(o5_stopMusic), - OPCODE(o5_putActor), - OPCODE(o5_getAnimCounter), - OPCODE(o5_getActorY), - /* 24 */ - OPCODE(o5_loadRoomWithEgo), - OPCODE(o5_pickupObject), - OPCODE(o5_setVarRange), - OPCODE(o5_stringOps), - /* 28 */ - OPCODE(o5_equalZero), - OPCODE(o5_setOwnerOf), - OPCODE(o5_startScript), - OPCODE(o5_delayVariable), - /* 2C */ - OPCODE(o5_cursorCommand), - OPCODE(o5_putActorInRoom), - OPCODE(o5_delay), - OPCODE(o5_ifNotState), - /* 30 */ - OPCODE(o5_matrixOps), - OPCODE(o5_getInventoryCount), - OPCODE(o5_setCameraAt), - OPCODE(o5_roomOps), - /* 34 */ - OPCODE(o5_getDist), - OPCODE(o5_findObject), - OPCODE(o5_walkActorToObject), - OPCODE(o5_startObject), - /* 38 */ - OPCODE(o5_lessOrEqual), - OPCODE(o5_doSentence), - OPCODE(o5_subtract), - OPCODE(o5_getActorScale), - /* 3C */ - OPCODE(o5_stopSound), - OPCODE(o5_findInventory), - OPCODE(o5_walkActorTo), - OPCODE(o5_drawBox), - /* 40 */ - OPCODE(o5_cutscene), - OPCODE(o5_putActor), - OPCODE(o5_chainScript), - OPCODE(o5_getActorX), - /* 44 */ - OPCODE(o5_isLess), - OPCODE(o5_drawObject), - OPCODE(o5_increment), - OPCODE(o5_setState), - /* 48 */ - OPCODE(o5_isEqual), - OPCODE(o5_faceActor), - OPCODE(o5_startScript), - OPCODE(o5_getVerbEntrypoint), - /* 4C */ - OPCODE(o5_soundKludge), - OPCODE(o5_walkActorToActor), - OPCODE(o5_putActorAtObject), - OPCODE(o5_ifState), - /* 50 */ - OPCODE(o5_pickupObjectOld), - OPCODE(o5_animateActor), - OPCODE(o5_actorFollowCamera), - OPCODE(o5_actorOps), - /* 54 */ - OPCODE(o5_setObjectName), - OPCODE(o5_actorFromPos), - OPCODE(o5_getActorMoving), - OPCODE(o5_or), - /* 58 */ - OPCODE(o5_beginOverride), - OPCODE(o5_doSentence), - OPCODE(o5_add), - OPCODE(o5_divide), - /* 5C */ - OPCODE(o5_oldRoomEffect), - OPCODE(o5_setClass), - OPCODE(o5_walkActorTo), - OPCODE(o5_isActorInBox), - /* 60 */ - OPCODE(o5_freezeScripts), - OPCODE(o5_putActor), - OPCODE(o5_stopScript), - OPCODE(o5_getActorFacing), - /* 64 */ - OPCODE(o5_loadRoomWithEgo), - OPCODE(o5_pickupObject), - OPCODE(o5_getClosestObjActor), - OPCODE(o5_getStringWidth), - /* 68 */ - OPCODE(o5_isScriptRunning), - OPCODE(o5_setOwnerOf), - OPCODE(o5_startScript), - OPCODE(o5_debug), - /* 6C */ - OPCODE(o5_getActorWidth), - OPCODE(o5_putActorInRoom), - OPCODE(o5_stopObjectScript), - OPCODE(o5_ifNotState), - /* 70 */ - OPCODE(o5_lights), - OPCODE(o5_getActorCostume), - OPCODE(o5_loadRoom), - OPCODE(o5_roomOps), - /* 74 */ - OPCODE(o5_getDist), - OPCODE(o5_findObject), - OPCODE(o5_walkActorToObject), - OPCODE(o5_startObject), - /* 78 */ - OPCODE(o5_isGreater), - OPCODE(o5_doSentence), - OPCODE(o5_verbOps), - OPCODE(o5_getActorWalkBox), - /* 7C */ - OPCODE(o5_isSoundRunning), - OPCODE(o5_findInventory), - OPCODE(o5_walkActorTo), - OPCODE(o5_drawBox), - /* 80 */ - OPCODE(o5_breakHere), - OPCODE(o5_putActor), - OPCODE(o5_startMusic), - OPCODE(o5_getActorRoom), - /* 84 */ - OPCODE(o5_isGreaterEqual), - OPCODE(o5_drawObject), - OPCODE(o5_getActorElevation), - OPCODE(o5_setState), - /* 88 */ - OPCODE(o5_isNotEqual), - OPCODE(o5_faceActor), - OPCODE(o5_startScript), - OPCODE(o5_getVerbEntrypoint), - /* 8C */ - OPCODE(o5_resourceRoutines), - OPCODE(o5_walkActorToActor), - OPCODE(o5_putActorAtObject), - OPCODE(o5_getObjectState), - /* 90 */ - OPCODE(o5_getObjectOwner), - OPCODE(o5_animateActor), - OPCODE(o5_panCameraTo), - OPCODE(o5_actorOps), - /* 94 */ - OPCODE(o5_print), - OPCODE(o5_actorFromPos), - OPCODE(o5_getRandomNr), - OPCODE(o5_and), - /* 98 */ - OPCODE(o5_systemOps), - OPCODE(o5_doSentence), - OPCODE(o5_move), - OPCODE(o5_multiply), - /* 9C */ - OPCODE(o5_startSound), - OPCODE(o5_ifClassOfIs), - OPCODE(o5_walkActorTo), - OPCODE(o5_isActorInBox), - /* A0 */ - OPCODE(o5_stopObjectCode), - OPCODE(o5_putActor), - OPCODE(o5_getAnimCounter), - OPCODE(o5_getActorY), - /* A4 */ - OPCODE(o5_loadRoomWithEgo), - OPCODE(o5_pickupObject), - OPCODE(o5_setVarRange), - OPCODE(o5_saveLoadVars), - /* A8 */ - OPCODE(o5_notEqualZero), - OPCODE(o5_setOwnerOf), - OPCODE(o5_startScript), - OPCODE(o5_saveRestoreVerbs), - /* AC */ - OPCODE(o5_expression), - OPCODE(o5_putActorInRoom), - OPCODE(o5_wait), - OPCODE(o5_ifNotState), - /* B0 */ - OPCODE(o5_matrixOps), - OPCODE(o5_getInventoryCount), - OPCODE(o5_setCameraAt), - OPCODE(o5_roomOps), - /* B4 */ - OPCODE(o5_getDist), - OPCODE(o5_findObject), - OPCODE(o5_walkActorToObject), - OPCODE(o5_startObject), - /* B8 */ - OPCODE(o5_lessOrEqual), - OPCODE(o5_doSentence), - OPCODE(o5_subtract), - OPCODE(o5_getActorScale), - /* BC */ - OPCODE(o5_stopSound), - OPCODE(o5_findInventory), - OPCODE(o5_walkActorTo), - OPCODE(o5_drawBox), - /* C0 */ - OPCODE(o5_endCutscene), - OPCODE(o5_putActor), - OPCODE(o5_chainScript), - OPCODE(o5_getActorX), - /* C4 */ - OPCODE(o5_isLess), - OPCODE(o5_drawObject), - OPCODE(o5_decrement), - OPCODE(o5_setState), - /* C8 */ - OPCODE(o5_isEqual), - OPCODE(o5_faceActor), - OPCODE(o5_startScript), - OPCODE(o5_getVerbEntrypoint), - /* CC */ - OPCODE(o5_pseudoRoom), - OPCODE(o5_walkActorToActor), - OPCODE(o5_putActorAtObject), - OPCODE(o5_ifState), - /* D0 */ - OPCODE(o5_pickupObjectOld), - OPCODE(o5_animateActor), - OPCODE(o5_actorFollowCamera), - OPCODE(o5_actorOps), - /* D4 */ - OPCODE(o5_setObjectName), - OPCODE(o5_actorFromPos), - OPCODE(o5_getActorMoving), - OPCODE(o5_or), - /* D8 */ - OPCODE(o5_printEgo), - OPCODE(o5_doSentence), - OPCODE(o5_add), - OPCODE(o5_divide), - /* DC */ - OPCODE(o5_oldRoomEffect), - OPCODE(o5_setClass), - OPCODE(o5_walkActorTo), - OPCODE(o5_isActorInBox), - /* E0 */ - OPCODE(o5_freezeScripts), - OPCODE(o5_putActor), - OPCODE(o5_stopScript), - OPCODE(o5_getActorFacing), - /* E4 */ - OPCODE(o5_loadRoomWithEgo), - OPCODE(o5_pickupObject), - OPCODE(o5_getClosestObjActor), - OPCODE(o5_getStringWidth), - /* E8 */ - OPCODE(o5_isScriptRunning), - OPCODE(o5_setOwnerOf), - OPCODE(o5_startScript), - OPCODE(o5_debug), - /* EC */ - OPCODE(o5_getActorWidth), - OPCODE(o5_putActorInRoom), - OPCODE(o5_stopObjectScript), - OPCODE(o5_ifNotState), - /* F0 */ - OPCODE(o5_lights), - OPCODE(o5_getActorCostume), - OPCODE(o5_loadRoom), - OPCODE(o5_roomOps), - /* F4 */ - OPCODE(o5_getDist), - OPCODE(o5_findObject), - OPCODE(o5_walkActorToObject), - OPCODE(o5_startObject), - /* F8 */ - OPCODE(o5_isGreater), - OPCODE(o5_doSentence), - OPCODE(o5_verbOps), - OPCODE(o5_getActorWalkBox), - /* FC */ - OPCODE(o5_isSoundRunning), - OPCODE(o5_findInventory), - OPCODE(o5_walkActorTo), - OPCODE(o5_drawBox) - }; - - _opcodesV5 = opcodes; + /* 00 */ + OPCODE(0x00, o5_stopObjectCode); + OPCODE(0x01, o5_putActor); + OPCODE(0x02, o5_startMusic); + OPCODE(0x03, o5_getActorRoom); + /* 04 */ + OPCODE(0x04, o5_isGreaterEqual); + OPCODE(0x05, o5_drawObject); + OPCODE(0x06, o5_getActorElevation); + OPCODE(0x07, o5_setState); + /* 08 */ + OPCODE(0x08, o5_isNotEqual); + OPCODE(0x09, o5_faceActor); + OPCODE(0x0a, o5_startScript); + OPCODE(0x0b, o5_getVerbEntrypoint); + /* 0C */ + OPCODE(0x0c, o5_resourceRoutines); + OPCODE(0x0d, o5_walkActorToActor); + OPCODE(0x0e, o5_putActorAtObject); + OPCODE(0x0f, o5_getObjectState); + /* 10 */ + OPCODE(0x10, o5_getObjectOwner); + OPCODE(0x11, o5_animateActor); + OPCODE(0x12, o5_panCameraTo); + OPCODE(0x13, o5_actorOps); + /* 14 */ + OPCODE(0x14, o5_print); + OPCODE(0x15, o5_actorFromPos); + OPCODE(0x16, o5_getRandomNr); + OPCODE(0x17, o5_and); + /* 18 */ + OPCODE(0x18, o5_jumpRelative); + OPCODE(0x19, o5_doSentence); + OPCODE(0x1a, o5_move); + OPCODE(0x1b, o5_multiply); + /* 1C */ + OPCODE(0x1c, o5_startSound); + OPCODE(0x1d, o5_ifClassOfIs); + OPCODE(0x1e, o5_walkActorTo); + OPCODE(0x1f, o5_isActorInBox); + /* 20 */ + OPCODE(0x20, o5_stopMusic); + OPCODE(0x21, o5_putActor); + OPCODE(0x22, o5_getAnimCounter); + OPCODE(0x23, o5_getActorY); + /* 24 */ + OPCODE(0x24, o5_loadRoomWithEgo); + OPCODE(0x25, o5_pickupObject); + OPCODE(0x26, o5_setVarRange); + OPCODE(0x27, o5_stringOps); + /* 28 */ + OPCODE(0x28, o5_equalZero); + OPCODE(0x29, o5_setOwnerOf); + OPCODE(0x2a, o5_startScript); + OPCODE(0x2b, o5_delayVariable); + /* 2C */ + OPCODE(0x2c, o5_cursorCommand); + OPCODE(0x2d, o5_putActorInRoom); + OPCODE(0x2e, o5_delay); + OPCODE(0x2f, o5_ifNotState); + /* 30 */ + OPCODE(0x30, o5_matrixOps); + OPCODE(0x31, o5_getInventoryCount); + OPCODE(0x32, o5_setCameraAt); + OPCODE(0x33, o5_roomOps); + /* 34 */ + OPCODE(0x34, o5_getDist); + OPCODE(0x35, o5_findObject); + OPCODE(0x36, o5_walkActorToObject); + OPCODE(0x37, o5_startObject); + /* 38 */ + OPCODE(0x38, o5_lessOrEqual); + OPCODE(0x39, o5_doSentence); + OPCODE(0x3a, o5_subtract); + OPCODE(0x3b, o5_getActorScale); + /* 3C */ + OPCODE(0x3c, o5_stopSound); + OPCODE(0x3d, o5_findInventory); + OPCODE(0x3e, o5_walkActorTo); + OPCODE(0x3f, o5_drawBox); + /* 40 */ + OPCODE(0x40, o5_cutscene); + OPCODE(0x41, o5_putActor); + OPCODE(0x42, o5_chainScript); + OPCODE(0x43, o5_getActorX); + /* 44 */ + OPCODE(0x44, o5_isLess); + OPCODE(0x45, o5_drawObject); + OPCODE(0x46, o5_increment); + OPCODE(0x47, o5_setState); + /* 48 */ + OPCODE(0x48, o5_isEqual); + OPCODE(0x49, o5_faceActor); + OPCODE(0x4a, o5_startScript); + OPCODE(0x4b, o5_getVerbEntrypoint); + /* 4C */ + OPCODE(0x4c, o5_soundKludge); + OPCODE(0x4d, o5_walkActorToActor); + OPCODE(0x4e, o5_putActorAtObject); + OPCODE(0x4f, o5_ifState); + /* 50 */ + OPCODE(0x50, o5_pickupObjectOld); + OPCODE(0x51, o5_animateActor); + OPCODE(0x52, o5_actorFollowCamera); + OPCODE(0x53, o5_actorOps); + /* 54 */ + OPCODE(0x54, o5_setObjectName); + OPCODE(0x55, o5_actorFromPos); + OPCODE(0x56, o5_getActorMoving); + OPCODE(0x57, o5_or); + /* 58 */ + OPCODE(0x58, o5_beginOverride); + OPCODE(0x59, o5_doSentence); + OPCODE(0x5a, o5_add); + OPCODE(0x5b, o5_divide); + /* 5C */ + OPCODE(0x5c, o5_oldRoomEffect); + OPCODE(0x5d, o5_setClass); + OPCODE(0x5e, o5_walkActorTo); + OPCODE(0x5f, o5_isActorInBox); + /* 60 */ + OPCODE(0x60, o5_freezeScripts); + OPCODE(0x61, o5_putActor); + OPCODE(0x62, o5_stopScript); + OPCODE(0x63, o5_getActorFacing); + /* 64 */ + OPCODE(0x64, o5_loadRoomWithEgo); + OPCODE(0x65, o5_pickupObject); + OPCODE(0x66, o5_getClosestObjActor); + OPCODE(0x67, o5_getStringWidth); + /* 68 */ + OPCODE(0x68, o5_isScriptRunning); + OPCODE(0x69, o5_setOwnerOf); + OPCODE(0x6a, o5_startScript); + OPCODE(0x6b, o5_debug); + /* 6C */ + OPCODE(0x6c, o5_getActorWidth); + OPCODE(0x6d, o5_putActorInRoom); + OPCODE(0x6e, o5_stopObjectScript); + OPCODE(0x6f, o5_ifNotState); + /* 70 */ + OPCODE(0x70, o5_lights); + OPCODE(0x71, o5_getActorCostume); + OPCODE(0x72, o5_loadRoom); + OPCODE(0x73, o5_roomOps); + /* 74 */ + OPCODE(0x74, o5_getDist); + OPCODE(0x75, o5_findObject); + OPCODE(0x76, o5_walkActorToObject); + OPCODE(0x77, o5_startObject); + /* 78 */ + OPCODE(0x78, o5_isGreater); + OPCODE(0x79, o5_doSentence); + OPCODE(0x7a, o5_verbOps); + OPCODE(0x7b, o5_getActorWalkBox); + /* 7C */ + OPCODE(0x7c, o5_isSoundRunning); + OPCODE(0x7d, o5_findInventory); + OPCODE(0x7e, o5_walkActorTo); + OPCODE(0x7f, o5_drawBox); + /* 80 */ + OPCODE(0x80, o5_breakHere); + OPCODE(0x81, o5_putActor); + OPCODE(0x82, o5_startMusic); + OPCODE(0x83, o5_getActorRoom); + /* 84 */ + OPCODE(0x84, o5_isGreaterEqual); + OPCODE(0x85, o5_drawObject); + OPCODE(0x86, o5_getActorElevation); + OPCODE(0x87, o5_setState); + /* 88 */ + OPCODE(0x88, o5_isNotEqual); + OPCODE(0x89, o5_faceActor); + OPCODE(0x8a, o5_startScript); + OPCODE(0x8b, o5_getVerbEntrypoint); + /* 8C */ + OPCODE(0x8c, o5_resourceRoutines); + OPCODE(0x8d, o5_walkActorToActor); + OPCODE(0x8e, o5_putActorAtObject); + OPCODE(0x8f, o5_getObjectState); + /* 90 */ + OPCODE(0x90, o5_getObjectOwner); + OPCODE(0x91, o5_animateActor); + OPCODE(0x92, o5_panCameraTo); + OPCODE(0x93, o5_actorOps); + /* 94 */ + OPCODE(0x94, o5_print); + OPCODE(0x95, o5_actorFromPos); + OPCODE(0x96, o5_getRandomNr); + OPCODE(0x97, o5_and); + /* 98 */ + OPCODE(0x98, o5_systemOps); + OPCODE(0x99, o5_doSentence); + OPCODE(0x9a, o5_move); + OPCODE(0x9b, o5_multiply); + /* 9C */ + OPCODE(0x9c, o5_startSound); + OPCODE(0x9d, o5_ifClassOfIs); + OPCODE(0x9e, o5_walkActorTo); + OPCODE(0x9f, o5_isActorInBox); + /* A0 */ + OPCODE(0xa0, o5_stopObjectCode); + OPCODE(0xa1, o5_putActor); + OPCODE(0xa2, o5_getAnimCounter); + OPCODE(0xa3, o5_getActorY); + /* A4 */ + OPCODE(0xa4, o5_loadRoomWithEgo); + OPCODE(0xa5, o5_pickupObject); + OPCODE(0xa6, o5_setVarRange); + OPCODE(0xa7, o5_saveLoadVars); + /* A8 */ + OPCODE(0xa8, o5_notEqualZero); + OPCODE(0xa9, o5_setOwnerOf); + OPCODE(0xaa, o5_startScript); + OPCODE(0xab, o5_saveRestoreVerbs); + /* AC */ + OPCODE(0xac, o5_expression); + OPCODE(0xad, o5_putActorInRoom); + OPCODE(0xae, o5_wait); + OPCODE(0xaf, o5_ifNotState); + /* B0 */ + OPCODE(0xb0, o5_matrixOps); + OPCODE(0xb1, o5_getInventoryCount); + OPCODE(0xb2, o5_setCameraAt); + OPCODE(0xb3, o5_roomOps); + /* B4 */ + OPCODE(0xb4, o5_getDist); + OPCODE(0xb5, o5_findObject); + OPCODE(0xb6, o5_walkActorToObject); + OPCODE(0xb7, o5_startObject); + /* B8 */ + OPCODE(0xb8, o5_lessOrEqual); + OPCODE(0xb9, o5_doSentence); + OPCODE(0xba, o5_subtract); + OPCODE(0xbb, o5_getActorScale); + /* BC */ + OPCODE(0xbc, o5_stopSound); + OPCODE(0xbd, o5_findInventory); + OPCODE(0xbe, o5_walkActorTo); + OPCODE(0xbf, o5_drawBox); + /* C0 */ + OPCODE(0xc0, o5_endCutscene); + OPCODE(0xc1, o5_putActor); + OPCODE(0xc2, o5_chainScript); + OPCODE(0xc3, o5_getActorX); + /* C4 */ + OPCODE(0xc4, o5_isLess); + OPCODE(0xc5, o5_drawObject); + OPCODE(0xc6, o5_decrement); + OPCODE(0xc7, o5_setState); + /* C8 */ + OPCODE(0xc8, o5_isEqual); + OPCODE(0xc9, o5_faceActor); + OPCODE(0xca, o5_startScript); + OPCODE(0xcb, o5_getVerbEntrypoint); + /* CC */ + OPCODE(0xcc, o5_pseudoRoom); + OPCODE(0xcd, o5_walkActorToActor); + OPCODE(0xce, o5_putActorAtObject); + OPCODE(0xcf, o5_ifState); + /* D0 */ + OPCODE(0xd0, o5_pickupObjectOld); + OPCODE(0xd1, o5_animateActor); + OPCODE(0xd2, o5_actorFollowCamera); + OPCODE(0xd3, o5_actorOps); + /* D4 */ + OPCODE(0xd4, o5_setObjectName); + OPCODE(0xd5, o5_actorFromPos); + OPCODE(0xd6, o5_getActorMoving); + OPCODE(0xd7, o5_or); + /* D8 */ + OPCODE(0xd8, o5_printEgo); + OPCODE(0xd9, o5_doSentence); + OPCODE(0xda, o5_add); + OPCODE(0xdb, o5_divide); + /* DC */ + OPCODE(0xdc, o5_oldRoomEffect); + OPCODE(0xdd, o5_setClass); + OPCODE(0xde, o5_walkActorTo); + OPCODE(0xdf, o5_isActorInBox); + /* E0 */ + OPCODE(0xe0, o5_freezeScripts); + OPCODE(0xe1, o5_putActor); + OPCODE(0xe2, o5_stopScript); + OPCODE(0xe3, o5_getActorFacing); + /* E4 */ + OPCODE(0xe4, o5_loadRoomWithEgo); + OPCODE(0xe5, o5_pickupObject); + OPCODE(0xe6, o5_getClosestObjActor); + OPCODE(0xe7, o5_getStringWidth); + /* E8 */ + OPCODE(0xe8, o5_isScriptRunning); + OPCODE(0xe9, o5_setOwnerOf); + OPCODE(0xea, o5_startScript); + OPCODE(0xeb, o5_debug); + /* EC */ + OPCODE(0xec, o5_getActorWidth); + OPCODE(0xed, o5_putActorInRoom); + OPCODE(0xee, o5_stopObjectScript); + OPCODE(0xef, o5_ifNotState); + /* F0 */ + OPCODE(0xf0, o5_lights); + OPCODE(0xf1, o5_getActorCostume); + OPCODE(0xf2, o5_loadRoom); + OPCODE(0xf3, o5_roomOps); + /* F4 */ + OPCODE(0xf4, o5_getDist); + OPCODE(0xf5, o5_findObject); + OPCODE(0xf6, o5_walkActorToObject); + OPCODE(0xf7, o5_startObject); + /* F8 */ + OPCODE(0xf8, o5_isGreater); + OPCODE(0xf9, o5_doSentence); + OPCODE(0xfa, o5_verbOps); + OPCODE(0xfb, o5_getActorWalkBox); + /* FC */ + OPCODE(0xfc, o5_isSoundRunning); + OPCODE(0xfd, o5_findInventory); + OPCODE(0xfe, o5_walkActorTo); + OPCODE(0xff, o5_drawBox); } #define PARAM_1 0x80 #define PARAM_2 0x40 #define PARAM_3 0x20 -void ScummEngine_v5::executeOpcode(byte i) { - OpcodeProcV5 op = _opcodesV5[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v5::getOpcodeDesc(byte i) { - return _opcodesV5[i].desc; -} - int ScummEngine_v5::getVar() { return readVar(fetchScriptWord()); } diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 255e6f0c63..03be7b5fe0 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -34,7 +34,6 @@ #include "scumm/imuse/imuse.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/insane/insane.h" -#include "scumm/intern.h" #include "scumm/object.h" #include "scumm/resource.h" #include "scumm/scumm.h" @@ -50,342 +49,329 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v6, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v6, x) void ScummEngine_v6::setupOpcodes() { - static const OpcodeEntryV6 opcodes[256] = { - /* 00 */ - OPCODE(o6_pushByte), - OPCODE(o6_pushWord), - OPCODE(o6_pushByteVar), - OPCODE(o6_pushWordVar), - /* 04 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayRead), - OPCODE(o6_wordArrayRead), - /* 08 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayIndexedRead), - OPCODE(o6_wordArrayIndexedRead), - /* 0C */ - OPCODE(o6_dup), - OPCODE(o6_not), - OPCODE(o6_eq), - OPCODE(o6_neq), - /* 10 */ - OPCODE(o6_gt), - OPCODE(o6_lt), - OPCODE(o6_le), - OPCODE(o6_ge), - /* 14 */ - OPCODE(o6_add), - OPCODE(o6_sub), - OPCODE(o6_mul), - OPCODE(o6_div), - /* 18 */ - OPCODE(o6_land), - OPCODE(o6_lor), - OPCODE(o6_pop), - OPCODE(o6_invalid), - /* 1C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 20 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 24 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 28 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 2C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 30 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 34 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 38 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 3C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 40 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_writeByteVar), - OPCODE(o6_writeWordVar), - /* 44 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayWrite), - OPCODE(o6_wordArrayWrite), - /* 48 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayIndexedWrite), - OPCODE(o6_wordArrayIndexedWrite), - /* 4C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteVarInc), - OPCODE(o6_wordVarInc), - /* 50 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayInc), - OPCODE(o6_wordArrayInc), - /* 54 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteVarDec), - OPCODE(o6_wordVarDec), - /* 58 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_byteArrayDec), - OPCODE(o6_wordArrayDec), - /* 5C */ - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o6_startScript), - OPCODE(o6_startScriptQuick), - /* 60 */ - OPCODE(o6_startObject), - OPCODE(o6_drawObject), - OPCODE(o6_drawObjectAt), - OPCODE(o6_drawBlastObject), - /* 64 */ - OPCODE(o6_setBlastObjectWindow), - OPCODE(o6_stopObjectCode), - OPCODE(o6_stopObjectCode), - OPCODE(o6_endCutscene), - /* 68 */ - OPCODE(o6_cutscene), - OPCODE(o6_stopMusic), - OPCODE(o6_freezeUnfreeze), - OPCODE(o6_cursorCommand), - /* 6C */ - OPCODE(o6_breakHere), - OPCODE(o6_ifClassOfIs), - OPCODE(o6_setClass), - OPCODE(o6_getState), - /* 70 */ - OPCODE(o6_setState), - OPCODE(o6_setOwner), - OPCODE(o6_getOwner), - OPCODE(o6_jump), - /* 74 */ - OPCODE(o6_startSound), - OPCODE(o6_stopSound), - OPCODE(o6_startMusic), - OPCODE(o6_stopObjectScript), - /* 78 */ - OPCODE(o6_panCameraTo), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_setCameraAt), - OPCODE(o6_loadRoom), - /* 7C */ - OPCODE(o6_stopScript), - OPCODE(o6_walkActorToObj), - OPCODE(o6_walkActorTo), - OPCODE(o6_putActorAtXY), - /* 80 */ - OPCODE(o6_putActorAtObject), - OPCODE(o6_faceActor), - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - /* 84 */ - OPCODE(o6_pickupObject), - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_invalid), - OPCODE(o6_getRandomNumber), - /* 88 */ - OPCODE(o6_getRandomNumberRange), - OPCODE(o6_invalid), - OPCODE(o6_getActorMoving), - OPCODE(o6_isScriptRunning), - /* 8C */ - OPCODE(o6_getActorRoom), - OPCODE(o6_getObjectX), - OPCODE(o6_getObjectY), - OPCODE(o6_getObjectOldDir), - /* 90 */ - OPCODE(o6_getActorWalkBox), - OPCODE(o6_getActorCostume), - OPCODE(o6_findInventory), - OPCODE(o6_getInventoryCount), - /* 94 */ - OPCODE(o6_getVerbFromXY), - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o6_setObjectName), - /* 98 */ - OPCODE(o6_isSoundRunning), - OPCODE(o6_setBoxFlags), - OPCODE(o6_createBoxMatrix), - OPCODE(o6_resourceRoutines), - /* 9C */ - OPCODE(o6_roomOps), - OPCODE(o6_actorOps), - OPCODE(o6_verbOps), - OPCODE(o6_getActorFromXY), - /* A0 */ - OPCODE(o6_findObject), - OPCODE(o6_pseudoRoom), - OPCODE(o6_getActorElevation), - OPCODE(o6_getVerbEntrypoint), - /* A4 */ - OPCODE(o6_arrayOps), - OPCODE(o6_saveRestoreVerbs), - OPCODE(o6_drawBox), - OPCODE(o6_pop), - /* A8 */ - OPCODE(o6_getActorWidth), - OPCODE(o6_wait), - OPCODE(o6_getActorScaleX), - OPCODE(o6_getActorAnimCounter), - /* AC */ - OPCODE(o6_soundKludge), - OPCODE(o6_isAnyOf), - OPCODE(o6_systemOps), - OPCODE(o6_isActorInBox), - /* B0 */ - OPCODE(o6_delay), - OPCODE(o6_delaySeconds), - OPCODE(o6_delayMinutes), - OPCODE(o6_stopSentence), - /* B4 */ - OPCODE(o6_printLine), - OPCODE(o6_printText), - OPCODE(o6_printDebug), - OPCODE(o6_printSystem), - /* B8 */ - OPCODE(o6_printActor), - OPCODE(o6_printEgo), - OPCODE(o6_talkActor), - OPCODE(o6_talkEgo), - /* BC */ - OPCODE(o6_dimArray), - OPCODE(o6_dummy), - OPCODE(o6_startObjectQuick), - OPCODE(o6_startScriptQuick2), - /* C0 */ - OPCODE(o6_dim2dimArray), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C4 */ - OPCODE(o6_abs), - OPCODE(o6_distObjectObject), - OPCODE(o6_distObjectPt), - OPCODE(o6_distPtPt), - /* C8 */ - OPCODE(o6_kernelGetFunctions), - OPCODE(o6_kernelSetFunctions), - OPCODE(o6_delayFrames), - OPCODE(o6_pickOneOf), - /* CC */ - OPCODE(o6_pickOneOfDefault), - OPCODE(o6_stampObject), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* D0 */ - OPCODE(o6_getDateTime), - OPCODE(o6_stopTalking), - OPCODE(o6_getAnimateVariable), - OPCODE(o6_invalid), - /* D4 */ - OPCODE(o6_shuffle), - OPCODE(o6_jumpToScript), - OPCODE(o6_band), - OPCODE(o6_bor), - /* D8 */ - OPCODE(o6_isRoomScriptRunning), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* DC */ - OPCODE(o6_invalid), - OPCODE(o6_findAllObjects), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* E0 */ - OPCODE(o6_invalid), - OPCODE(o6_getPixel), - OPCODE(o6_invalid), - OPCODE(o6_pickVarRandom), - /* E4 */ - OPCODE(o6_setBoxSet), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* E8 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* EC */ - OPCODE(o6_getActorLayer), - OPCODE(o6_getObjectNewDir), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F0 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F4 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* F8 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* FC */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesV6 = opcodes; -} - -void ScummEngine_v6::executeOpcode(byte i) { - OpcodeProcV6 op = _opcodesV6[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v6::getOpcodeDesc(byte i) { - return _opcodesV6[i].desc; + /* 00 */ + OPCODE(0x00, o6_pushByte); + OPCODE(0x01, o6_pushWord); + OPCODE(0x02, o6_pushByteVar); + OPCODE(0x03, o6_pushWordVar); + /* 04 */ + OPCODE(0x04, o6_invalid); + OPCODE(0x05, o6_invalid); + OPCODE(0x06, o6_byteArrayRead); + OPCODE(0x07, o6_wordArrayRead); + /* 08 */ + OPCODE(0x08, o6_invalid); + OPCODE(0x09, o6_invalid); + OPCODE(0x0a, o6_byteArrayIndexedRead); + OPCODE(0x0b, o6_wordArrayIndexedRead); + /* 0C */ + OPCODE(0x0c, o6_dup); + OPCODE(0x0d, o6_not); + OPCODE(0x0e, o6_eq); + OPCODE(0x0f, o6_neq); + /* 10 */ + OPCODE(0x10, o6_gt); + OPCODE(0x11, o6_lt); + OPCODE(0x12, o6_le); + OPCODE(0x13, o6_ge); + /* 14 */ + OPCODE(0x14, o6_add); + OPCODE(0x15, o6_sub); + OPCODE(0x16, o6_mul); + OPCODE(0x17, o6_div); + /* 18 */ + OPCODE(0x18, o6_land); + OPCODE(0x19, o6_lor); + OPCODE(0x1a, o6_pop); + OPCODE(0x1b, o6_invalid); + /* 1C */ + OPCODE(0x1c, o6_invalid); + OPCODE(0x1d, o6_invalid); + OPCODE(0x1e, o6_invalid); + OPCODE(0x1f, o6_invalid); + /* 20 */ + OPCODE(0x20, o6_invalid); + OPCODE(0x21, o6_invalid); + OPCODE(0x22, o6_invalid); + OPCODE(0x23, o6_invalid); + /* 24 */ + OPCODE(0x24, o6_invalid); + OPCODE(0x25, o6_invalid); + OPCODE(0x26, o6_invalid); + OPCODE(0x27, o6_invalid); + /* 28 */ + OPCODE(0x28, o6_invalid); + OPCODE(0x29, o6_invalid); + OPCODE(0x2a, o6_invalid); + OPCODE(0x2b, o6_invalid); + /* 2C */ + OPCODE(0x2c, o6_invalid); + OPCODE(0x2d, o6_invalid); + OPCODE(0x2e, o6_invalid); + OPCODE(0x2f, o6_invalid); + /* 30 */ + OPCODE(0x30, o6_invalid); + OPCODE(0x31, o6_invalid); + OPCODE(0x32, o6_invalid); + OPCODE(0x33, o6_invalid); + /* 34 */ + OPCODE(0x34, o6_invalid); + OPCODE(0x35, o6_invalid); + OPCODE(0x36, o6_invalid); + OPCODE(0x37, o6_invalid); + /* 38 */ + OPCODE(0x38, o6_invalid); + OPCODE(0x39, o6_invalid); + OPCODE(0x3a, o6_invalid); + OPCODE(0x3b, o6_invalid); + /* 3C */ + OPCODE(0x3c, o6_invalid); + OPCODE(0x3d, o6_invalid); + OPCODE(0x3e, o6_invalid); + OPCODE(0x3f, o6_invalid); + /* 40 */ + OPCODE(0x40, o6_invalid); + OPCODE(0x41, o6_invalid); + OPCODE(0x42, o6_writeByteVar); + OPCODE(0x43, o6_writeWordVar); + /* 44 */ + OPCODE(0x44, o6_invalid); + OPCODE(0x45, o6_invalid); + OPCODE(0x46, o6_byteArrayWrite); + OPCODE(0x47, o6_wordArrayWrite); + /* 48 */ + OPCODE(0x48, o6_invalid); + OPCODE(0x49, o6_invalid); + OPCODE(0x4a, o6_byteArrayIndexedWrite); + OPCODE(0x4b, o6_wordArrayIndexedWrite); + /* 4C */ + OPCODE(0x4c, o6_invalid); + OPCODE(0x4d, o6_invalid); + OPCODE(0x4e, o6_byteVarInc); + OPCODE(0x4f, o6_wordVarInc); + /* 50 */ + OPCODE(0x50, o6_invalid); + OPCODE(0x51, o6_invalid); + OPCODE(0x52, o6_byteArrayInc); + OPCODE(0x53, o6_wordArrayInc); + /* 54 */ + OPCODE(0x54, o6_invalid); + OPCODE(0x55, o6_invalid); + OPCODE(0x56, o6_byteVarDec); + OPCODE(0x57, o6_wordVarDec); + /* 58 */ + OPCODE(0x58, o6_invalid); + OPCODE(0x59, o6_invalid); + OPCODE(0x5a, o6_byteArrayDec); + OPCODE(0x5b, o6_wordArrayDec); + /* 5C */ + OPCODE(0x5c, o6_if); + OPCODE(0x5d, o6_ifNot); + OPCODE(0x5e, o6_startScript); + OPCODE(0x5f, o6_startScriptQuick); + /* 60 */ + OPCODE(0x60, o6_startObject); + OPCODE(0x61, o6_drawObject); + OPCODE(0x62, o6_drawObjectAt); + OPCODE(0x63, o6_drawBlastObject); + /* 64 */ + OPCODE(0x64, o6_setBlastObjectWindow); + OPCODE(0x65, o6_stopObjectCode); + OPCODE(0x66, o6_stopObjectCode); + OPCODE(0x67, o6_endCutscene); + /* 68 */ + OPCODE(0x68, o6_cutscene); + OPCODE(0x69, o6_stopMusic); + OPCODE(0x6a, o6_freezeUnfreeze); + OPCODE(0x6b, o6_cursorCommand); + /* 6C */ + OPCODE(0x6c, o6_breakHere); + OPCODE(0x6d, o6_ifClassOfIs); + OPCODE(0x6e, o6_setClass); + OPCODE(0x6f, o6_getState); + /* 70 */ + OPCODE(0x70, o6_setState); + OPCODE(0x71, o6_setOwner); + OPCODE(0x72, o6_getOwner); + OPCODE(0x73, o6_jump); + /* 74 */ + OPCODE(0x74, o6_startSound); + OPCODE(0x75, o6_stopSound); + OPCODE(0x76, o6_startMusic); + OPCODE(0x77, o6_stopObjectScript); + /* 78 */ + OPCODE(0x78, o6_panCameraTo); + OPCODE(0x79, o6_actorFollowCamera); + OPCODE(0x7a, o6_setCameraAt); + OPCODE(0x7b, o6_loadRoom); + /* 7C */ + OPCODE(0x7c, o6_stopScript); + OPCODE(0x7d, o6_walkActorToObj); + OPCODE(0x7e, o6_walkActorTo); + OPCODE(0x7f, o6_putActorAtXY); + /* 80 */ + OPCODE(0x80, o6_putActorAtObject); + OPCODE(0x81, o6_faceActor); + OPCODE(0x82, o6_animateActor); + OPCODE(0x83, o6_doSentence); + /* 84 */ + OPCODE(0x84, o6_pickupObject); + OPCODE(0x85, o6_loadRoomWithEgo); + OPCODE(0x86, o6_invalid); + OPCODE(0x87, o6_getRandomNumber); + /* 88 */ + OPCODE(0x88, o6_getRandomNumberRange); + OPCODE(0x89, o6_invalid); + OPCODE(0x8a, o6_getActorMoving); + OPCODE(0x8b, o6_isScriptRunning); + /* 8C */ + OPCODE(0x8c, o6_getActorRoom); + OPCODE(0x8d, o6_getObjectX); + OPCODE(0x8e, o6_getObjectY); + OPCODE(0x8f, o6_getObjectOldDir); + /* 90 */ + OPCODE(0x90, o6_getActorWalkBox); + OPCODE(0x91, o6_getActorCostume); + OPCODE(0x92, o6_findInventory); + OPCODE(0x93, o6_getInventoryCount); + /* 94 */ + OPCODE(0x94, o6_getVerbFromXY); + OPCODE(0x95, o6_beginOverride); + OPCODE(0x96, o6_endOverride); + OPCODE(0x97, o6_setObjectName); + /* 98 */ + OPCODE(0x98, o6_isSoundRunning); + OPCODE(0x99, o6_setBoxFlags); + OPCODE(0x9a, o6_createBoxMatrix); + OPCODE(0x9b, o6_resourceRoutines); + /* 9C */ + OPCODE(0x9c, o6_roomOps); + OPCODE(0x9d, o6_actorOps); + OPCODE(0x9e, o6_verbOps); + OPCODE(0x9f, o6_getActorFromXY); + /* A0 */ + OPCODE(0xa0, o6_findObject); + OPCODE(0xa1, o6_pseudoRoom); + OPCODE(0xa2, o6_getActorElevation); + OPCODE(0xa3, o6_getVerbEntrypoint); + /* A4 */ + OPCODE(0xa4, o6_arrayOps); + OPCODE(0xa5, o6_saveRestoreVerbs); + OPCODE(0xa6, o6_drawBox); + OPCODE(0xa7, o6_pop); + /* A8 */ + OPCODE(0xa8, o6_getActorWidth); + OPCODE(0xa9, o6_wait); + OPCODE(0xaa, o6_getActorScaleX); + OPCODE(0xab, o6_getActorAnimCounter); + /* AC */ + OPCODE(0xac, o6_soundKludge); + OPCODE(0xad, o6_isAnyOf); + OPCODE(0xae, o6_systemOps); + OPCODE(0xaf, o6_isActorInBox); + /* B0 */ + OPCODE(0xb0, o6_delay); + OPCODE(0xb1, o6_delaySeconds); + OPCODE(0xb2, o6_delayMinutes); + OPCODE(0xb3, o6_stopSentence); + /* B4 */ + OPCODE(0xb4, o6_printLine); + OPCODE(0xb5, o6_printText); + OPCODE(0xb6, o6_printDebug); + OPCODE(0xb7, o6_printSystem); + /* B8 */ + OPCODE(0xb8, o6_printActor); + OPCODE(0xb9, o6_printEgo); + OPCODE(0xba, o6_talkActor); + OPCODE(0xbb, o6_talkEgo); + /* BC */ + OPCODE(0xbc, o6_dimArray); + OPCODE(0xbd, o6_dummy); + OPCODE(0xbe, o6_startObjectQuick); + OPCODE(0xbf, o6_startScriptQuick2); + /* C0 */ + OPCODE(0xc0, o6_dim2dimArray); + OPCODE(0xc1, o6_invalid); + OPCODE(0xc2, o6_invalid); + OPCODE(0xc3, o6_invalid); + /* C4 */ + OPCODE(0xc4, o6_abs); + OPCODE(0xc5, o6_distObjectObject); + OPCODE(0xc6, o6_distObjectPt); + OPCODE(0xc7, o6_distPtPt); + /* C8 */ + OPCODE(0xc8, o6_kernelGetFunctions); + OPCODE(0xc9, o6_kernelSetFunctions); + OPCODE(0xca, o6_delayFrames); + OPCODE(0xcb, o6_pickOneOf); + /* CC */ + OPCODE(0xcc, o6_pickOneOfDefault); + OPCODE(0xcd, o6_stampObject); + OPCODE(0xce, o6_invalid); + OPCODE(0xcf, o6_invalid); + /* D0 */ + OPCODE(0xd0, o6_getDateTime); + OPCODE(0xd1, o6_stopTalking); + OPCODE(0xd2, o6_getAnimateVariable); + OPCODE(0xd3, o6_invalid); + /* D4 */ + OPCODE(0xd4, o6_shuffle); + OPCODE(0xd5, o6_jumpToScript); + OPCODE(0xd6, o6_band); + OPCODE(0xd7, o6_bor); + /* D8 */ + OPCODE(0xd8, o6_isRoomScriptRunning); + OPCODE(0xd9, o6_invalid); + OPCODE(0xda, o6_invalid); + OPCODE(0xdb, o6_invalid); + /* DC */ + OPCODE(0xdc, o6_invalid); + OPCODE(0xdd, o6_findAllObjects); + OPCODE(0xde, o6_invalid); + OPCODE(0xdf, o6_invalid); + /* E0 */ + OPCODE(0xe0, o6_invalid); + OPCODE(0xe1, o6_getPixel); + OPCODE(0xe2, o6_invalid); + OPCODE(0xe3, o6_pickVarRandom); + /* E4 */ + OPCODE(0xe4, o6_setBoxSet); + OPCODE(0xe5, o6_invalid); + OPCODE(0xe6, o6_invalid); + OPCODE(0xe7, o6_invalid); + /* E8 */ + OPCODE(0xe8, o6_invalid); + OPCODE(0xe9, o6_invalid); + OPCODE(0xea, o6_invalid); + OPCODE(0xeb, o6_invalid); + /* EC */ + OPCODE(0xec, o6_getActorLayer); + OPCODE(0xed, o6_getObjectNewDir); + OPCODE(0xee, o6_invalid); + OPCODE(0xef, o6_invalid); + /* F0 */ + OPCODE(0xf0, o6_invalid); + OPCODE(0xf1, o6_invalid); + OPCODE(0xf2, o6_invalid); + OPCODE(0xf3, o6_invalid); + /* F4 */ + OPCODE(0xf4, o6_invalid); + OPCODE(0xf5, o6_invalid); + OPCODE(0xf6, o6_invalid); + OPCODE(0xf7, o6_invalid); + /* F8 */ + OPCODE(0xf8, o6_invalid); + OPCODE(0xf9, o6_invalid); + OPCODE(0xfa, o6_invalid); + OPCODE(0xfb, o6_invalid); + /* FC */ + OPCODE(0xfc, o6_invalid); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } int ScummEngine_v6::popRoomAndObj(int *room) { diff --git a/engines/scumm/script_v8.cpp b/engines/scumm/script_v8.cpp index 1969a3be85..545057914f 100644 --- a/engines/scumm/script_v8.cpp +++ b/engines/scumm/script_v8.cpp @@ -31,7 +31,6 @@ #include "scumm/charset.h" #include "scumm/file.h" #include "scumm/imuse_digi/dimuse.h" -#include "scumm/intern.h" #include "scumm/object.h" #include "scumm/resource.h" #include "scumm/scumm_v8.h" @@ -44,342 +43,329 @@ namespace Scumm { -#define OPCODE(x) _OPCODE(ScummEngine_v8, x) +#define OPCODE(i, x) _opcodes[i]._OPCODE(ScummEngine_v8, x) void ScummEngine_v8::setupOpcodes() { - static const OpcodeEntryV8 opcodes[256] = { - /* 00 */ - OPCODE(o6_invalid), - OPCODE(o6_pushWord), - OPCODE(o6_pushWordVar), - OPCODE(o6_wordArrayRead), - /* 04 */ - OPCODE(o6_wordArrayIndexedRead), - OPCODE(o6_dup), - OPCODE(o6_pop), - OPCODE(o6_not), - /* 08 */ - OPCODE(o6_eq), - OPCODE(o6_neq), - OPCODE(o6_gt), - OPCODE(o6_lt), - /* 0C */ - OPCODE(o6_le), - OPCODE(o6_ge), - OPCODE(o6_add), - OPCODE(o6_sub), - /* 10 */ - OPCODE(o6_mul), - OPCODE(o6_div), - OPCODE(o6_land), - OPCODE(o6_lor), - /* 14 */ - OPCODE(o6_band), - OPCODE(o6_bor), - OPCODE(o8_mod), - OPCODE(o6_invalid), - /* 18 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 1C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 20 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 24 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 28 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 2C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 30 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 34 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 38 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 3C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 40 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 44 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 48 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 4C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 50 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 54 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 58 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 5C */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 60 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 64 */ - OPCODE(o6_if), - OPCODE(o6_ifNot), - OPCODE(o6_jump), - OPCODE(o6_breakHere), - /* 68 */ - OPCODE(o6_delayFrames), - OPCODE(o8_wait), - OPCODE(o6_delay), - OPCODE(o6_delaySeconds), - /* 6C */ - OPCODE(o6_delayMinutes), - OPCODE(o6_writeWordVar), - OPCODE(o6_wordVarInc), - OPCODE(o6_wordVarDec), - /* 70 */ - OPCODE(o8_dimArray), - OPCODE(o6_wordArrayWrite), - OPCODE(o6_wordArrayInc), - OPCODE(o6_wordArrayDec), - /* 74 */ - OPCODE(o8_dim2dimArray), - OPCODE(o6_wordArrayIndexedWrite), - OPCODE(o8_arrayOps), - OPCODE(o6_invalid), - /* 78 */ - OPCODE(o6_invalid), - OPCODE(o6_startScript), - OPCODE(o6_startScriptQuick), - OPCODE(o6_stopObjectCode), - /* 7C */ - OPCODE(o6_stopScript), - OPCODE(o6_jumpToScript), - OPCODE(o6_dummy), // O_RETURN boils down to a NOP - OPCODE(o6_startObject), - /* 80 */ - OPCODE(o6_stopObjectScript), - OPCODE(o6_cutscene), - OPCODE(o6_endCutscene), - OPCODE(o6_freezeUnfreeze), - /* 84 */ - OPCODE(o6_beginOverride), - OPCODE(o6_endOverride), - OPCODE(o6_stopSentence), - OPCODE(o6_invalid), - /* 88 */ - OPCODE(o6_invalid), - OPCODE(o6_setClass), - OPCODE(o6_setState), - OPCODE(o6_setOwner), - /* 8C */ - OPCODE(o6_panCameraTo), - OPCODE(o6_actorFollowCamera), - OPCODE(o6_setCameraAt), - OPCODE(o6_printActor), - /* 90 */ - OPCODE(o6_printEgo), - OPCODE(o6_talkActor), - OPCODE(o6_talkEgo), - OPCODE(o6_printLine), - /* 94 */ - OPCODE(o6_printText), - OPCODE(o6_printDebug), - OPCODE(o6_printSystem), - OPCODE(o8_blastText), - /* 98 */ - OPCODE(o8_drawObject), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* 9C */ - OPCODE(o8_cursorCommand), - OPCODE(o6_loadRoom), - OPCODE(o6_loadRoomWithEgo), - OPCODE(o6_walkActorToObj), - /* A0 */ - OPCODE(o6_walkActorTo), - OPCODE(o6_putActorAtXY), - OPCODE(o6_putActorAtObject), - OPCODE(o6_faceActor), - /* A4 */ - OPCODE(o6_animateActor), - OPCODE(o6_doSentence), - OPCODE(o6_pickupObject), - OPCODE(o6_setBoxFlags), - /* A8 */ - OPCODE(o6_createBoxMatrix), - OPCODE(o6_invalid), - OPCODE(o8_resourceRoutines), - OPCODE(o8_roomOps), - /* AC */ - OPCODE(o8_actorOps), - OPCODE(o8_cameraOps), - OPCODE(o8_verbOps), - OPCODE(o6_startSound), - /* B0 */ - OPCODE(o6_startMusic), - OPCODE(o6_stopSound), - OPCODE(o6_soundKludge), - OPCODE(o8_systemOps), - /* B4 */ - OPCODE(o6_saveRestoreVerbs), - OPCODE(o6_setObjectName), - OPCODE(o6_getDateTime), - OPCODE(o6_drawBox), - /* B8 */ - OPCODE(o6_invalid), - OPCODE(o8_startVideo), - OPCODE(o8_kernelSetFunctions), - OPCODE(o6_invalid), - /* BC */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C0 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C4 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* C8 */ - OPCODE(o6_startScriptQuick2), - OPCODE(o6_startObjectQuick), - OPCODE(o6_pickOneOf), - OPCODE(o6_pickOneOfDefault), - /* CC */ - OPCODE(o6_invalid), - OPCODE(o6_isAnyOf), - OPCODE(o6_getRandomNumber), - OPCODE(o6_getRandomNumberRange), - /* D0 */ - OPCODE(o6_ifClassOfIs), - OPCODE(o6_getState), - OPCODE(o6_getOwner), - OPCODE(o6_isScriptRunning), - /* D4 */ - OPCODE(o6_invalid), - OPCODE(o6_isSoundRunning), - OPCODE(o6_abs), - OPCODE(o6_invalid), - /* D8 */ - OPCODE(o8_kernelGetFunctions), - OPCODE(o6_isActorInBox), - OPCODE(o6_getVerbEntrypoint), - OPCODE(o6_getActorFromXY), - /* DC */ - OPCODE(o6_findObject), - OPCODE(o6_getVerbFromXY), - OPCODE(o6_invalid), - OPCODE(o6_findInventory), - /* E0 */ - OPCODE(o6_getInventoryCount), - OPCODE(o6_getAnimateVariable), - OPCODE(o6_getActorRoom), - OPCODE(o6_getActorWalkBox), - /* E4 */ - OPCODE(o6_getActorMoving), - OPCODE(o6_getActorCostume), - OPCODE(o6_getActorScaleX), - OPCODE(o6_getActorLayer), - /* E8 */ - OPCODE(o6_getActorElevation), - OPCODE(o6_getActorWidth), - OPCODE(o6_getObjectNewDir), - OPCODE(o6_getObjectX), - /* EC */ - OPCODE(o6_getObjectY), - OPCODE(o8_getActorChore), - OPCODE(o6_distObjectObject), - OPCODE(o6_distPtPt), - /* F0 */ - OPCODE(o8_getObjectImageX), - OPCODE(o8_getObjectImageY), - OPCODE(o8_getObjectImageWidth), - OPCODE(o8_getObjectImageHeight), - /* F4 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o8_getStringWidth), - OPCODE(o8_getActorZPlane), - /* F8 */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - /* FC */ - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - OPCODE(o6_invalid), - }; - - _opcodesV8 = opcodes; -} - -void ScummEngine_v8::executeOpcode(byte i) { - OpcodeProcV8 op = _opcodesV8[i].proc; - (this->*op) (); -} - -const char *ScummEngine_v8::getOpcodeDesc(byte i) { - return _opcodesV8[i].desc; + /* 00 */ + OPCODE(0x00, o6_invalid); + OPCODE(0x01, o6_pushWord); + OPCODE(0x02, o6_pushWordVar); + OPCODE(0x03, o6_wordArrayRead); + /* 04 */ + OPCODE(0x04, o6_wordArrayIndexedRead); + OPCODE(0x05, o6_dup); + OPCODE(0x06, o6_pop); + OPCODE(0x07, o6_not); + /* 08 */ + OPCODE(0x08, o6_eq); + OPCODE(0x09, o6_neq); + OPCODE(0x0a, o6_gt); + OPCODE(0x0b, o6_lt); + /* 0C */ + OPCODE(0x0c, o6_le); + OPCODE(0x0d, o6_ge); + OPCODE(0x0e, o6_add); + OPCODE(0x0f, o6_sub); + /* 10 */ + OPCODE(0x10, o6_mul); + OPCODE(0x11, o6_div); + OPCODE(0x12, o6_land); + OPCODE(0x13, o6_lor); + /* 14 */ + OPCODE(0x14, o6_band); + OPCODE(0x15, o6_bor); + OPCODE(0x16, o8_mod); + OPCODE(0x17, o6_invalid); + /* 18 */ + OPCODE(0x18, o6_invalid); + OPCODE(0x19, o6_invalid); + OPCODE(0x1a, o6_invalid); + OPCODE(0x1b, o6_invalid); + /* 1C */ + OPCODE(0x1c, o6_invalid); + OPCODE(0x1d, o6_invalid); + OPCODE(0x1e, o6_invalid); + OPCODE(0x1f, o6_invalid); + /* 20 */ + OPCODE(0x20, o6_invalid); + OPCODE(0x21, o6_invalid); + OPCODE(0x22, o6_invalid); + OPCODE(0x23, o6_invalid); + /* 24 */ + OPCODE(0x24, o6_invalid); + OPCODE(0x25, o6_invalid); + OPCODE(0x26, o6_invalid); + OPCODE(0x27, o6_invalid); + /* 28 */ + OPCODE(0x28, o6_invalid); + OPCODE(0x29, o6_invalid); + OPCODE(0x2a, o6_invalid); + OPCODE(0x2b, o6_invalid); + /* 2C */ + OPCODE(0x2c, o6_invalid); + OPCODE(0x2d, o6_invalid); + OPCODE(0x2e, o6_invalid); + OPCODE(0x2f, o6_invalid); + /* 30 */ + OPCODE(0x30, o6_invalid); + OPCODE(0x31, o6_invalid); + OPCODE(0x32, o6_invalid); + OPCODE(0x33, o6_invalid); + /* 34 */ + OPCODE(0x34, o6_invalid); + OPCODE(0x35, o6_invalid); + OPCODE(0x36, o6_invalid); + OPCODE(0x37, o6_invalid); + /* 38 */ + OPCODE(0x38, o6_invalid); + OPCODE(0x39, o6_invalid); + OPCODE(0x3a, o6_invalid); + OPCODE(0x3b, o6_invalid); + /* 3C */ + OPCODE(0x3c, o6_invalid); + OPCODE(0x3d, o6_invalid); + OPCODE(0x3e, o6_invalid); + OPCODE(0x3f, o6_invalid); + /* 40 */ + OPCODE(0x40, o6_invalid); + OPCODE(0x41, o6_invalid); + OPCODE(0x42, o6_invalid); + OPCODE(0x43, o6_invalid); + /* 44 */ + OPCODE(0x44, o6_invalid); + OPCODE(0x45, o6_invalid); + OPCODE(0x46, o6_invalid); + OPCODE(0x47, o6_invalid); + /* 48 */ + OPCODE(0x48, o6_invalid); + OPCODE(0x49, o6_invalid); + OPCODE(0x4a, o6_invalid); + OPCODE(0x4b, o6_invalid); + /* 4C */ + OPCODE(0x4c, o6_invalid); + OPCODE(0x4d, o6_invalid); + OPCODE(0x4e, o6_invalid); + OPCODE(0x4f, o6_invalid); + /* 50 */ + OPCODE(0x50, o6_invalid); + OPCODE(0x51, o6_invalid); + OPCODE(0x52, o6_invalid); + OPCODE(0x53, o6_invalid); + /* 54 */ + OPCODE(0x54, o6_invalid); + OPCODE(0x55, o6_invalid); + OPCODE(0x56, o6_invalid); + OPCODE(0x57, o6_invalid); + /* 58 */ + OPCODE(0x58, o6_invalid); + OPCODE(0x59, o6_invalid); + OPCODE(0x5a, o6_invalid); + OPCODE(0x5b, o6_invalid); + /* 5C */ + OPCODE(0x5c, o6_invalid); + OPCODE(0x5d, o6_invalid); + OPCODE(0x5e, o6_invalid); + OPCODE(0x5f, o6_invalid); + /* 60 */ + OPCODE(0x60, o6_invalid); + OPCODE(0x61, o6_invalid); + OPCODE(0x62, o6_invalid); + OPCODE(0x63, o6_invalid); + /* 64 */ + OPCODE(0x64, o6_if); + OPCODE(0x65, o6_ifNot); + OPCODE(0x66, o6_jump); + OPCODE(0x67, o6_breakHere); + /* 68 */ + OPCODE(0x68, o6_delayFrames); + OPCODE(0x69, o8_wait); + OPCODE(0x6a, o6_delay); + OPCODE(0x6b, o6_delaySeconds); + /* 6C */ + OPCODE(0x6c, o6_delayMinutes); + OPCODE(0x6d, o6_writeWordVar); + OPCODE(0x6e, o6_wordVarInc); + OPCODE(0x6f, o6_wordVarDec); + /* 70 */ + OPCODE(0x70, o8_dimArray); + OPCODE(0x71, o6_wordArrayWrite); + OPCODE(0x72, o6_wordArrayInc); + OPCODE(0x73, o6_wordArrayDec); + /* 74 */ + OPCODE(0x74, o8_dim2dimArray); + OPCODE(0x75, o6_wordArrayIndexedWrite); + OPCODE(0x76, o8_arrayOps); + OPCODE(0x77, o6_invalid); + /* 78 */ + OPCODE(0x78, o6_invalid); + OPCODE(0x79, o6_startScript); + OPCODE(0x7a, o6_startScriptQuick); + OPCODE(0x7b, o6_stopObjectCode); + /* 7C */ + OPCODE(0x7c, o6_stopScript); + OPCODE(0x7d, o6_jumpToScript); + OPCODE(0x7e, o6_dummy); // O_RETURN boils down to a NOP + OPCODE(0x7f, o6_startObject); + /* 80 */ + OPCODE(0x80, o6_stopObjectScript); + OPCODE(0x81, o6_cutscene); + OPCODE(0x82, o6_endCutscene); + OPCODE(0x83, o6_freezeUnfreeze); + /* 84 */ + OPCODE(0x84, o6_beginOverride); + OPCODE(0x85, o6_endOverride); + OPCODE(0x86, o6_stopSentence); + OPCODE(0x87, o6_invalid); + /* 88 */ + OPCODE(0x88, o6_invalid); + OPCODE(0x89, o6_setClass); + OPCODE(0x8a, o6_setState); + OPCODE(0x8b, o6_setOwner); + /* 8C */ + OPCODE(0x8c, o6_panCameraTo); + OPCODE(0x8d, o6_actorFollowCamera); + OPCODE(0x8e, o6_setCameraAt); + OPCODE(0x8f, o6_printActor); + /* 90 */ + OPCODE(0x90, o6_printEgo); + OPCODE(0x91, o6_talkActor); + OPCODE(0x92, o6_talkEgo); + OPCODE(0x93, o6_printLine); + /* 94 */ + OPCODE(0x94, o6_printText); + OPCODE(0x95, o6_printDebug); + OPCODE(0x96, o6_printSystem); + OPCODE(0x97, o8_blastText); + /* 98 */ + OPCODE(0x98, o8_drawObject); + OPCODE(0x99, o6_invalid); + OPCODE(0x9a, o6_invalid); + OPCODE(0x9b, o6_invalid); + /* 9C */ + OPCODE(0x9c, o8_cursorCommand); + OPCODE(0x9d, o6_loadRoom); + OPCODE(0x9e, o6_loadRoomWithEgo); + OPCODE(0x9f, o6_walkActorToObj); + /* A0 */ + OPCODE(0xa0, o6_walkActorTo); + OPCODE(0xa1, o6_putActorAtXY); + OPCODE(0xa2, o6_putActorAtObject); + OPCODE(0xa3, o6_faceActor); + /* A4 */ + OPCODE(0xa4, o6_animateActor); + OPCODE(0xa5, o6_doSentence); + OPCODE(0xa6, o6_pickupObject); + OPCODE(0xa7, o6_setBoxFlags); + /* A8 */ + OPCODE(0xa8, o6_createBoxMatrix); + OPCODE(0xa9, o6_invalid); + OPCODE(0xaa, o8_resourceRoutines); + OPCODE(0xab, o8_roomOps); + /* AC */ + OPCODE(0xac, o8_actorOps); + OPCODE(0xad, o8_cameraOps); + OPCODE(0xae, o8_verbOps); + OPCODE(0xaf, o6_startSound); + /* B0 */ + OPCODE(0xb0, o6_startMusic); + OPCODE(0xb1, o6_stopSound); + OPCODE(0xb2, o6_soundKludge); + OPCODE(0xb3, o8_systemOps); + /* B4 */ + OPCODE(0xb4, o6_saveRestoreVerbs); + OPCODE(0xb5, o6_setObjectName); + OPCODE(0xb6, o6_getDateTime); + OPCODE(0xb7, o6_drawBox); + /* B8 */ + OPCODE(0xb8, o6_invalid); + OPCODE(0xb9, o8_startVideo); + OPCODE(0xba, o8_kernelSetFunctions); + OPCODE(0xbb, o6_invalid); + /* BC */ + OPCODE(0xbc, o6_invalid); + OPCODE(0xbd, o6_invalid); + OPCODE(0xbe, o6_invalid); + OPCODE(0xbf, o6_invalid); + /* C0 */ + OPCODE(0xc0, o6_invalid); + OPCODE(0xc1, o6_invalid); + OPCODE(0xc2, o6_invalid); + OPCODE(0xc3, o6_invalid); + /* C4 */ + OPCODE(0xc4, o6_invalid); + OPCODE(0xc5, o6_invalid); + OPCODE(0xc6, o6_invalid); + OPCODE(0xc7, o6_invalid); + /* C8 */ + OPCODE(0xc8, o6_startScriptQuick2); + OPCODE(0xc9, o6_startObjectQuick); + OPCODE(0xca, o6_pickOneOf); + OPCODE(0xcb, o6_pickOneOfDefault); + /* CC */ + OPCODE(0xcc, o6_invalid); + OPCODE(0xcd, o6_isAnyOf); + OPCODE(0xce, o6_getRandomNumber); + OPCODE(0xcf, o6_getRandomNumberRange); + /* D0 */ + OPCODE(0xd0, o6_ifClassOfIs); + OPCODE(0xd1, o6_getState); + OPCODE(0xd2, o6_getOwner); + OPCODE(0xd3, o6_isScriptRunning); + /* D4 */ + OPCODE(0xd4, o6_invalid); + OPCODE(0xd5, o6_isSoundRunning); + OPCODE(0xd6, o6_abs); + OPCODE(0xd7, o6_invalid); + /* D8 */ + OPCODE(0xd8, o8_kernelGetFunctions); + OPCODE(0xd9, o6_isActorInBox); + OPCODE(0xda, o6_getVerbEntrypoint); + OPCODE(0xdb, o6_getActorFromXY); + /* DC */ + OPCODE(0xdc, o6_findObject); + OPCODE(0xdd, o6_getVerbFromXY); + OPCODE(0xde, o6_invalid); + OPCODE(0xdf, o6_findInventory); + /* E0 */ + OPCODE(0xe0, o6_getInventoryCount); + OPCODE(0xe1, o6_getAnimateVariable); + OPCODE(0xe2, o6_getActorRoom); + OPCODE(0xe3, o6_getActorWalkBox); + /* E4 */ + OPCODE(0xe4, o6_getActorMoving); + OPCODE(0xe5, o6_getActorCostume); + OPCODE(0xe6, o6_getActorScaleX); + OPCODE(0xe7, o6_getActorLayer); + /* E8 */ + OPCODE(0xe8, o6_getActorElevation); + OPCODE(0xe9, o6_getActorWidth); + OPCODE(0xea, o6_getObjectNewDir); + OPCODE(0xeb, o6_getObjectX); + /* EC */ + OPCODE(0xec, o6_getObjectY); + OPCODE(0xed, o8_getActorChore); + OPCODE(0xee, o6_distObjectObject); + OPCODE(0xef, o6_distPtPt); + /* F0 */ + OPCODE(0xf0, o8_getObjectImageX); + OPCODE(0xf1, o8_getObjectImageY); + OPCODE(0xf2, o8_getObjectImageWidth); + OPCODE(0xf3, o8_getObjectImageHeight); + /* F4 */ + OPCODE(0xf4, o6_invalid); + OPCODE(0xf5, o6_invalid); + OPCODE(0xf6, o8_getStringWidth); + OPCODE(0xf7, o8_getActorZPlane); + /* F8 */ + OPCODE(0xf8, o6_invalid); + OPCODE(0xf9, o6_invalid); + OPCODE(0xfa, o6_invalid); + OPCODE(0xfb, o6_invalid); + /* FC */ + OPCODE(0xfc, o6_invalid); + OPCODE(0xfd, o6_invalid); + OPCODE(0xfe, o6_invalid); + OPCODE(0xff, o6_invalid); } // In V8, the word size is 4 byte, not 2 bytes as in V6/V7 games diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index bd1ea0791f..7453198782 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -680,9 +680,11 @@ protected: int _resultVarNumber, _scummStackPos; int _vmStack[150]; + OpcodeEntry _opcodes[256]; + virtual void setupOpcodes() = 0; - virtual void executeOpcode(byte i) = 0; - virtual const char *getOpcodeDesc(byte i) = 0; + void executeOpcode(byte i); + const char *getOpcodeDesc(byte i); void initializeLocals(int slot, int *vars); int getScriptSlot(); diff --git a/engines/scumm/scumm_v0.h b/engines/scumm/scumm_v0.h index c9837028da..13e99b8591 100644 --- a/engines/scumm/scumm_v0.h +++ b/engines/scumm/scumm_v0.h @@ -35,15 +35,8 @@ namespace Scumm { */ class ScummEngine_v0 : public ScummEngine_v2 { protected: - typedef void (ScummEngine_v0::*OpcodeProcC64)(); - struct OpcodeEntryC64 { - OpcodeProcC64 proc; - const char *desc; - }; - - const OpcodeEntryC64 *_opcodesC64; - int _currentMode; + public: ScummEngine_v0(OSystem *syst, const DetectorResult &dr); @@ -53,8 +46,6 @@ protected: virtual void resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL); virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void setupScummVars(); virtual void resetScummVars(); diff --git a/engines/scumm/scumm_v2.h b/engines/scumm/scumm_v2.h index 6b7fff3cb9..5a29ecee88 100644 --- a/engines/scumm/scumm_v2.h +++ b/engines/scumm/scumm_v2.h @@ -35,14 +35,6 @@ namespace Scumm { */ class ScummEngine_v2 : public ScummEngine_v3old { protected: - typedef void (ScummEngine_v2::*OpcodeProcV2)(); - struct OpcodeEntryV2 { - OpcodeProcV2 proc; - const char *desc; - }; - - const OpcodeEntryV2 *_opcodesV2; - struct V2MouseoverBox { Common::Rect rect; byte color; @@ -69,8 +61,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void setupScummVars(); virtual void resetScummVars(); diff --git a/engines/scumm/scumm_v5.h b/engines/scumm/scumm_v5.h index 78562cd1e9..71f5ae22c1 100644 --- a/engines/scumm/scumm_v5.h +++ b/engines/scumm/scumm_v5.h @@ -32,14 +32,6 @@ namespace Scumm { class ScummEngine_v5 : public ScummEngine { protected: - typedef void (ScummEngine_v5::*OpcodeProcV5)(); - struct OpcodeEntryV5 { - OpcodeProcV5 proc; - const char *desc; - }; - - const OpcodeEntryV5 *_opcodesV5; - uint16 _cursorImages[4][17]; byte _cursorHotspots[2 * 4]; @@ -61,8 +53,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void scummLoop_handleActors(); virtual void scummLoop_handleSaveLoad(); diff --git a/engines/scumm/scumm_v6.h b/engines/scumm/scumm_v6.h index 8d6d81b4d1..ce0f6f8374 100644 --- a/engines/scumm/scumm_v6.h +++ b/engines/scumm/scumm_v6.h @@ -32,12 +32,6 @@ namespace Scumm { class ScummEngine_v6 : public ScummEngine { protected: - typedef void (ScummEngine_v6::*OpcodeProcV6)(); - struct OpcodeEntryV6 { - OpcodeProcV6 proc; - const char *desc; - }; - enum ArrayType { kBitArray = 1, kNibbleArray = 2, @@ -58,8 +52,6 @@ protected: #include "common/pack-end.h" // END STRUCT PACKING - const OpcodeEntryV6 *_opcodesV6; - struct TextObject { int16 xpos, ypos; byte color; @@ -109,8 +101,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void scummLoop_handleActors(); virtual void processKeyboard(Common::KeyState lastKeyHit); diff --git a/engines/scumm/scumm_v8.h b/engines/scumm/scumm_v8.h index abd53b44ff..94619eb7ac 100644 --- a/engines/scumm/scumm_v8.h +++ b/engines/scumm/scumm_v8.h @@ -34,14 +34,6 @@ namespace Scumm { class ScummEngine_v8 : public ScummEngine_v7 { protected: - typedef void (ScummEngine_v8::*OpcodeProcV8)(); - struct OpcodeEntryV8 { - OpcodeProcV8 proc; - const char *desc; - }; - - const OpcodeEntryV8 *_opcodesV8; - struct ObjectNameId { char name[40]; int id; @@ -57,8 +49,6 @@ public: protected: virtual void setupOpcodes(); - virtual void executeOpcode(byte i); - virtual const char *getOpcodeDesc(byte i); virtual void printString(int m, const byte *msg); |