diff options
-rw-r--r-- | sword2/interpreter.cpp | 238 | ||||
-rw-r--r-- | sword2/logic.h | 4 |
2 files changed, 119 insertions, 123 deletions
diff --git a/sword2/interpreter.cpp b/sword2/interpreter.cpp index f6fde1b095..622f62bf1e 100644 --- a/sword2/interpreter.cpp +++ b/sword2/interpreter.cpp @@ -35,158 +35,158 @@ namespace Sword2 { #define MAX_FN_NUMBER 117 -#define OPCODE(x, y) { x, &Logic::y, #y } +#define OPCODE(x) { &Logic::x, #x } void Logic::setupOpcodes(void) { static const OpcodeEntry opcodes[MAX_FN_NUMBER + 1] = { /* 00 */ - OPCODE(1, fnTestFunction), - OPCODE(1, fnTestFlags), - OPCODE(2, fnRegisterStartPoint), - OPCODE(2, fnInitBackground), + OPCODE(fnTestFunction), + OPCODE(fnTestFlags), + OPCODE(fnRegisterStartPoint), + OPCODE(fnInitBackground), /* 04 */ - OPCODE(1, fnSetSession), - OPCODE(1, fnBackSprite), - OPCODE(1, fnSortSprite), - OPCODE(1, fnForeSprite), + OPCODE(fnSetSession), + OPCODE(fnBackSprite), + OPCODE(fnSortSprite), + OPCODE(fnForeSprite), /* 08 */ - OPCODE(1, fnRegisterMouse), - OPCODE(3, fnAnim), - OPCODE(2, fnRandom), - OPCODE(1, fnPreLoad), + OPCODE(fnRegisterMouse), + OPCODE(fnAnim), + OPCODE(fnRandom), + OPCODE(fnPreLoad), /* 0C */ - OPCODE(2, fnAddSubject), - OPCODE(1, fnInteract), - OPCODE(0, fnChoose), - OPCODE(7, fnWalk), + OPCODE(fnAddSubject), + OPCODE(fnInteract), + OPCODE(fnChoose), + OPCODE(fnWalk), /* 10 */ - OPCODE(5, fnWalkToAnim), - OPCODE(6, fnTurn), - OPCODE(5, fnStandAt), - OPCODE(3, fnStand), + OPCODE(fnWalkToAnim), + OPCODE(fnTurn), + OPCODE(fnStandAt), + OPCODE(fnStand), /* 14 */ - OPCODE(3, fnStandAfterAnim), - OPCODE(2, fnPause), - OPCODE(4, fnMegaTableAnim), - OPCODE(1, fnAddMenuObject), + OPCODE(fnStandAfterAnim), + OPCODE(fnPause), + OPCODE(fnMegaTableAnim), + OPCODE(fnAddMenuObject), /* 18 */ - OPCODE(0, fnStartConversation), - OPCODE(0, fnEndConversation), - OPCODE(3, fnSetFrame), - OPCODE(3, fnRandomPause), + OPCODE(fnStartConversation), + OPCODE(fnEndConversation), + OPCODE(fnSetFrame), + OPCODE(fnRandomPause), /* 1C */ - OPCODE(3, fnRegisterFrame), - OPCODE(1, fnNoSprite), - OPCODE(2, fnSendSync), - OPCODE(1, fnUpdatePlayerStats), + OPCODE(fnRegisterFrame), + OPCODE(fnNoSprite), + OPCODE(fnSendSync), + OPCODE(fnUpdatePlayerStats), /* 20 */ - OPCODE(1, fnPassGraph), - OPCODE(1, fnInitFloorMouse), - OPCODE(1, fnPassMega), - OPCODE(6, fnFaceXY), + OPCODE(fnPassGraph), + OPCODE(fnInitFloorMouse), + OPCODE(fnPassMega), + OPCODE(fnFaceXY), /* 24 */ - OPCODE(1, fnEndSession), - OPCODE(0, fnNoHuman), - OPCODE(0, fnAddHuman), - OPCODE(1, fnWeWait), + OPCODE(fnEndSession), + OPCODE(fnNoHuman), + OPCODE(fnAddHuman), + OPCODE(fnWeWait), /* 28 */ - OPCODE(8, fnTheyDoWeWait), - OPCODE(7, fnTheyDo), - OPCODE(6, fnWalkToTalkToMega), - OPCODE(0, fnFadeDown), + OPCODE(fnTheyDoWeWait), + OPCODE(fnTheyDo), + OPCODE(fnWalkToTalkToMega), + OPCODE(fnFadeDown), /* 2C */ - OPCODE(0, fnISpeak), - OPCODE(0, fnTotalRestart), - OPCODE(0, fnSetWalkGrid), - OPCODE(5, fnSpeechProcess), + OPCODE(fnISpeak), + OPCODE(fnTotalRestart), + OPCODE(fnSetWalkGrid), + OPCODE(fnSpeechProcess), /* 30 */ - OPCODE(3, fnSetScaling), - OPCODE(0, fnStartEvent), - OPCODE(0, fnCheckEventWaiting), - OPCODE(1, fnRequestSpeech), + OPCODE(fnSetScaling), + OPCODE(fnStartEvent), + OPCODE(fnCheckEventWaiting), + OPCODE(fnRequestSpeech), /* 34 */ - OPCODE(1, fnGosub), - OPCODE(3, fnTimedWait), - OPCODE(5, fnPlayFx), - OPCODE(1, fnStopFx), + OPCODE(fnGosub), + OPCODE(fnTimedWait), + OPCODE(fnPlayFx), + OPCODE(fnStopFx), /* 38 */ - OPCODE(2, fnPlayMusic), - OPCODE(0, fnStopMusic), - OPCODE(2, fnSetValue), - OPCODE(1, fnNewScript), + OPCODE(fnPlayMusic), + OPCODE(fnStopMusic), + OPCODE(fnSetValue), + OPCODE(fnNewScript), /* 3C */ - OPCODE(0, fnGetSync), - OPCODE(0, fnWaitSync), - OPCODE(0, fnRegisterWalkGrid), - OPCODE(4, fnReverseMegaTableAnim), + OPCODE(fnGetSync), + OPCODE(fnWaitSync), + OPCODE(fnRegisterWalkGrid), + OPCODE(fnReverseMegaTableAnim), /* 40 */ - OPCODE(3, fnReverseAnim), - OPCODE(0, fnAddToKillList), - OPCODE(3, fnSetStandbyCoords), - OPCODE(1, fnBackPar0Sprite), + OPCODE(fnReverseAnim), + OPCODE(fnAddToKillList), + OPCODE(fnSetStandbyCoords), + OPCODE(fnBackPar0Sprite), /* 44 */ - OPCODE(1, fnBackPar1Sprite), - OPCODE(1, fnForePar0Sprite), - OPCODE(1, fnForePar1Sprite), - OPCODE(1, fnSetPlayerActionEvent), + OPCODE(fnBackPar1Sprite), + OPCODE(fnForePar0Sprite), + OPCODE(fnForePar1Sprite), + OPCODE(fnSetPlayerActionEvent), /* 48 */ - OPCODE(2, fnSetScrollCoordinate), - OPCODE(3, fnStandAtAnim), - OPCODE(1, fnSetScrollLeftMouse), - OPCODE(1, fnSetScrollRightMouse), + OPCODE(fnSetScrollCoordinate), + OPCODE(fnStandAtAnim), + OPCODE(fnSetScrollLeftMouse), + OPCODE(fnSetScrollRightMouse), /* 4C */ - OPCODE(1, fnColour), - OPCODE(1, fnFlash), - OPCODE(1, fnPreFetch), - OPCODE(3, fnGetPlayerSaveData), + OPCODE(fnColour), + OPCODE(fnFlash), + OPCODE(fnPreFetch), + OPCODE(fnGetPlayerSaveData), /* 50 */ - OPCODE(3, fnPassPlayerSaveData), - OPCODE(2, fnSendEvent), - OPCODE(1, fnAddWalkGrid), - OPCODE(1, fnRemoveWalkGrid), + OPCODE(fnPassPlayerSaveData), + OPCODE(fnSendEvent), + OPCODE(fnAddWalkGrid), + OPCODE(fnRemoveWalkGrid), /* 54 */ - OPCODE(0, fnCheckForEvent), - OPCODE(2, fnPauseForEvent), - OPCODE(0, fnClearEvent), - OPCODE(5, fnFaceMega), + OPCODE(fnCheckForEvent), + OPCODE(fnPauseForEvent), + OPCODE(fnClearEvent), + OPCODE(fnFaceMega), /* 58 */ - OPCODE(2, fnPlaySequence), - OPCODE(1, fnShadedSprite), - OPCODE(1, fnUnshadedSprite), - OPCODE(0, fnFadeUp), + OPCODE(fnPlaySequence), + OPCODE(fnShadedSprite), + OPCODE(fnUnshadedSprite), + OPCODE(fnFadeUp), /* 60 */ - OPCODE(1, fnDisplayMsg), - OPCODE(0, fnSetObjectHeld), - OPCODE(3, fnAddSequenceText), - OPCODE(0, fnResetGlobals), + OPCODE(fnDisplayMsg), + OPCODE(fnSetObjectHeld), + OPCODE(fnAddSequenceText), + OPCODE(fnResetGlobals), /* 64 */ - OPCODE(1, fnSetPalette), - OPCODE(1, fnRegisterPointerText), - OPCODE(1, fnFetchWait), - OPCODE(1, fnRelease), + OPCODE(fnSetPalette), + OPCODE(fnRegisterPointerText), + OPCODE(fnFetchWait), + OPCODE(fnRelease), /* 68 */ - OPCODE(1, fnPrepareMusic), - OPCODE(1, fnSoundFetch), - OPCODE(1, fnPrepareMusic), // Again, apparently - OPCODE(1, fnSmackerLeadIn), + OPCODE(fnPrepareMusic), + OPCODE(fnSoundFetch), + OPCODE(fnPrepareMusic), // Again, apparently + OPCODE(fnSmackerLeadIn), /* 6C */ - OPCODE(1, fnSmackerLeadOut), - OPCODE(0, fnStopAllFx), - OPCODE(1, fnCheckPlayerActivity), - OPCODE(0, fnResetPlayerActivityDelay), + OPCODE(fnSmackerLeadOut), + OPCODE(fnStopAllFx), + OPCODE(fnCheckPlayerActivity), + OPCODE(fnResetPlayerActivityDelay), /* 70 */ - OPCODE(0, fnCheckMusicPlaying), - OPCODE(0, fnPlayCredits), - OPCODE(0, fnSetScrollSpeedNormal), - OPCODE(0, fnSetScrollSpeedSlow), + OPCODE(fnCheckMusicPlaying), + OPCODE(fnPlayCredits), + OPCODE(fnSetScrollSpeedNormal), + OPCODE(fnSetScrollSpeedSlow), /* 74 */ - OPCODE(0, fnRemoveChooser), - OPCODE(3, fnSetFxVolAndPan), - OPCODE(3, fnSetFxVol), - OPCODE(0, fnRestoreGame), + OPCODE(fnRemoveChooser), + OPCODE(fnSetFxVolAndPan), + OPCODE(fnSetFxVol), + OPCODE(fnRestoreGame), /* 78 */ - OPCODE(0, fnRefreshInventory), - OPCODE(0, fnChangeShadows) + OPCODE(fnRefreshInventory), + OPCODE(fnChangeShadows) }; _opcodes = opcodes; diff --git a/sword2/logic.h b/sword2/logic.h index 2ed33dc45b..1ed058e4f3 100644 --- a/sword2/logic.h +++ b/sword2/logic.h @@ -59,12 +59,8 @@ private: // Set this to turn debugging on bool _debugFlag; - // FIXME: Some opcodes pass pointers in integer variables. I don't - // think that's entirely portable. - typedef int32 (Logic::*OpcodeProc)(int32 *); struct OpcodeEntry { - byte numArgs; OpcodeProc proc; const char *desc; }; |