Removed redundant information from the opcode list. I thought having the

number of parameters to a function would be useful for debugging, but that
information is already available in the script data itself.

svn-id: r11360
This commit is contained in:
Torbjörn Andersson 2003-11-24 07:34:07 +00:00
parent 509235e176
commit 1fc58a5ca0
2 changed files with 119 additions and 123 deletions

View file

@ -35,158 +35,158 @@ namespace Sword2 {
#define MAX_FN_NUMBER 117 #define MAX_FN_NUMBER 117
#define OPCODE(x, y) { x, &Logic::y, #y } #define OPCODE(x) { &Logic::x, #x }
void Logic::setupOpcodes(void) { void Logic::setupOpcodes(void) {
static const OpcodeEntry opcodes[MAX_FN_NUMBER + 1] = { static const OpcodeEntry opcodes[MAX_FN_NUMBER + 1] = {
/* 00 */ /* 00 */
OPCODE(1, fnTestFunction), OPCODE(fnTestFunction),
OPCODE(1, fnTestFlags), OPCODE(fnTestFlags),
OPCODE(2, fnRegisterStartPoint), OPCODE(fnRegisterStartPoint),
OPCODE(2, fnInitBackground), OPCODE(fnInitBackground),
/* 04 */ /* 04 */
OPCODE(1, fnSetSession), OPCODE(fnSetSession),
OPCODE(1, fnBackSprite), OPCODE(fnBackSprite),
OPCODE(1, fnSortSprite), OPCODE(fnSortSprite),
OPCODE(1, fnForeSprite), OPCODE(fnForeSprite),
/* 08 */ /* 08 */
OPCODE(1, fnRegisterMouse), OPCODE(fnRegisterMouse),
OPCODE(3, fnAnim), OPCODE(fnAnim),
OPCODE(2, fnRandom), OPCODE(fnRandom),
OPCODE(1, fnPreLoad), OPCODE(fnPreLoad),
/* 0C */ /* 0C */
OPCODE(2, fnAddSubject), OPCODE(fnAddSubject),
OPCODE(1, fnInteract), OPCODE(fnInteract),
OPCODE(0, fnChoose), OPCODE(fnChoose),
OPCODE(7, fnWalk), OPCODE(fnWalk),
/* 10 */ /* 10 */
OPCODE(5, fnWalkToAnim), OPCODE(fnWalkToAnim),
OPCODE(6, fnTurn), OPCODE(fnTurn),
OPCODE(5, fnStandAt), OPCODE(fnStandAt),
OPCODE(3, fnStand), OPCODE(fnStand),
/* 14 */ /* 14 */
OPCODE(3, fnStandAfterAnim), OPCODE(fnStandAfterAnim),
OPCODE(2, fnPause), OPCODE(fnPause),
OPCODE(4, fnMegaTableAnim), OPCODE(fnMegaTableAnim),
OPCODE(1, fnAddMenuObject), OPCODE(fnAddMenuObject),
/* 18 */ /* 18 */
OPCODE(0, fnStartConversation), OPCODE(fnStartConversation),
OPCODE(0, fnEndConversation), OPCODE(fnEndConversation),
OPCODE(3, fnSetFrame), OPCODE(fnSetFrame),
OPCODE(3, fnRandomPause), OPCODE(fnRandomPause),
/* 1C */ /* 1C */
OPCODE(3, fnRegisterFrame), OPCODE(fnRegisterFrame),
OPCODE(1, fnNoSprite), OPCODE(fnNoSprite),
OPCODE(2, fnSendSync), OPCODE(fnSendSync),
OPCODE(1, fnUpdatePlayerStats), OPCODE(fnUpdatePlayerStats),
/* 20 */ /* 20 */
OPCODE(1, fnPassGraph), OPCODE(fnPassGraph),
OPCODE(1, fnInitFloorMouse), OPCODE(fnInitFloorMouse),
OPCODE(1, fnPassMega), OPCODE(fnPassMega),
OPCODE(6, fnFaceXY), OPCODE(fnFaceXY),
/* 24 */ /* 24 */
OPCODE(1, fnEndSession), OPCODE(fnEndSession),
OPCODE(0, fnNoHuman), OPCODE(fnNoHuman),
OPCODE(0, fnAddHuman), OPCODE(fnAddHuman),
OPCODE(1, fnWeWait), OPCODE(fnWeWait),
/* 28 */ /* 28 */
OPCODE(8, fnTheyDoWeWait), OPCODE(fnTheyDoWeWait),
OPCODE(7, fnTheyDo), OPCODE(fnTheyDo),
OPCODE(6, fnWalkToTalkToMega), OPCODE(fnWalkToTalkToMega),
OPCODE(0, fnFadeDown), OPCODE(fnFadeDown),
/* 2C */ /* 2C */
OPCODE(0, fnISpeak), OPCODE(fnISpeak),
OPCODE(0, fnTotalRestart), OPCODE(fnTotalRestart),
OPCODE(0, fnSetWalkGrid), OPCODE(fnSetWalkGrid),
OPCODE(5, fnSpeechProcess), OPCODE(fnSpeechProcess),
/* 30 */ /* 30 */
OPCODE(3, fnSetScaling), OPCODE(fnSetScaling),
OPCODE(0, fnStartEvent), OPCODE(fnStartEvent),
OPCODE(0, fnCheckEventWaiting), OPCODE(fnCheckEventWaiting),
OPCODE(1, fnRequestSpeech), OPCODE(fnRequestSpeech),
/* 34 */ /* 34 */
OPCODE(1, fnGosub), OPCODE(fnGosub),
OPCODE(3, fnTimedWait), OPCODE(fnTimedWait),
OPCODE(5, fnPlayFx), OPCODE(fnPlayFx),
OPCODE(1, fnStopFx), OPCODE(fnStopFx),
/* 38 */ /* 38 */
OPCODE(2, fnPlayMusic), OPCODE(fnPlayMusic),
OPCODE(0, fnStopMusic), OPCODE(fnStopMusic),
OPCODE(2, fnSetValue), OPCODE(fnSetValue),
OPCODE(1, fnNewScript), OPCODE(fnNewScript),
/* 3C */ /* 3C */
OPCODE(0, fnGetSync), OPCODE(fnGetSync),
OPCODE(0, fnWaitSync), OPCODE(fnWaitSync),
OPCODE(0, fnRegisterWalkGrid), OPCODE(fnRegisterWalkGrid),
OPCODE(4, fnReverseMegaTableAnim), OPCODE(fnReverseMegaTableAnim),
/* 40 */ /* 40 */
OPCODE(3, fnReverseAnim), OPCODE(fnReverseAnim),
OPCODE(0, fnAddToKillList), OPCODE(fnAddToKillList),
OPCODE(3, fnSetStandbyCoords), OPCODE(fnSetStandbyCoords),
OPCODE(1, fnBackPar0Sprite), OPCODE(fnBackPar0Sprite),
/* 44 */ /* 44 */
OPCODE(1, fnBackPar1Sprite), OPCODE(fnBackPar1Sprite),
OPCODE(1, fnForePar0Sprite), OPCODE(fnForePar0Sprite),
OPCODE(1, fnForePar1Sprite), OPCODE(fnForePar1Sprite),
OPCODE(1, fnSetPlayerActionEvent), OPCODE(fnSetPlayerActionEvent),
/* 48 */ /* 48 */
OPCODE(2, fnSetScrollCoordinate), OPCODE(fnSetScrollCoordinate),
OPCODE(3, fnStandAtAnim), OPCODE(fnStandAtAnim),
OPCODE(1, fnSetScrollLeftMouse), OPCODE(fnSetScrollLeftMouse),
OPCODE(1, fnSetScrollRightMouse), OPCODE(fnSetScrollRightMouse),
/* 4C */ /* 4C */
OPCODE(1, fnColour), OPCODE(fnColour),
OPCODE(1, fnFlash), OPCODE(fnFlash),
OPCODE(1, fnPreFetch), OPCODE(fnPreFetch),
OPCODE(3, fnGetPlayerSaveData), OPCODE(fnGetPlayerSaveData),
/* 50 */ /* 50 */
OPCODE(3, fnPassPlayerSaveData), OPCODE(fnPassPlayerSaveData),
OPCODE(2, fnSendEvent), OPCODE(fnSendEvent),
OPCODE(1, fnAddWalkGrid), OPCODE(fnAddWalkGrid),
OPCODE(1, fnRemoveWalkGrid), OPCODE(fnRemoveWalkGrid),
/* 54 */ /* 54 */
OPCODE(0, fnCheckForEvent), OPCODE(fnCheckForEvent),
OPCODE(2, fnPauseForEvent), OPCODE(fnPauseForEvent),
OPCODE(0, fnClearEvent), OPCODE(fnClearEvent),
OPCODE(5, fnFaceMega), OPCODE(fnFaceMega),
/* 58 */ /* 58 */
OPCODE(2, fnPlaySequence), OPCODE(fnPlaySequence),
OPCODE(1, fnShadedSprite), OPCODE(fnShadedSprite),
OPCODE(1, fnUnshadedSprite), OPCODE(fnUnshadedSprite),
OPCODE(0, fnFadeUp), OPCODE(fnFadeUp),
/* 60 */ /* 60 */
OPCODE(1, fnDisplayMsg), OPCODE(fnDisplayMsg),
OPCODE(0, fnSetObjectHeld), OPCODE(fnSetObjectHeld),
OPCODE(3, fnAddSequenceText), OPCODE(fnAddSequenceText),
OPCODE(0, fnResetGlobals), OPCODE(fnResetGlobals),
/* 64 */ /* 64 */
OPCODE(1, fnSetPalette), OPCODE(fnSetPalette),
OPCODE(1, fnRegisterPointerText), OPCODE(fnRegisterPointerText),
OPCODE(1, fnFetchWait), OPCODE(fnFetchWait),
OPCODE(1, fnRelease), OPCODE(fnRelease),
/* 68 */ /* 68 */
OPCODE(1, fnPrepareMusic), OPCODE(fnPrepareMusic),
OPCODE(1, fnSoundFetch), OPCODE(fnSoundFetch),
OPCODE(1, fnPrepareMusic), // Again, apparently OPCODE(fnPrepareMusic), // Again, apparently
OPCODE(1, fnSmackerLeadIn), OPCODE(fnSmackerLeadIn),
/* 6C */ /* 6C */
OPCODE(1, fnSmackerLeadOut), OPCODE(fnSmackerLeadOut),
OPCODE(0, fnStopAllFx), OPCODE(fnStopAllFx),
OPCODE(1, fnCheckPlayerActivity), OPCODE(fnCheckPlayerActivity),
OPCODE(0, fnResetPlayerActivityDelay), OPCODE(fnResetPlayerActivityDelay),
/* 70 */ /* 70 */
OPCODE(0, fnCheckMusicPlaying), OPCODE(fnCheckMusicPlaying),
OPCODE(0, fnPlayCredits), OPCODE(fnPlayCredits),
OPCODE(0, fnSetScrollSpeedNormal), OPCODE(fnSetScrollSpeedNormal),
OPCODE(0, fnSetScrollSpeedSlow), OPCODE(fnSetScrollSpeedSlow),
/* 74 */ /* 74 */
OPCODE(0, fnRemoveChooser), OPCODE(fnRemoveChooser),
OPCODE(3, fnSetFxVolAndPan), OPCODE(fnSetFxVolAndPan),
OPCODE(3, fnSetFxVol), OPCODE(fnSetFxVol),
OPCODE(0, fnRestoreGame), OPCODE(fnRestoreGame),
/* 78 */ /* 78 */
OPCODE(0, fnRefreshInventory), OPCODE(fnRefreshInventory),
OPCODE(0, fnChangeShadows) OPCODE(fnChangeShadows)
}; };
_opcodes = opcodes; _opcodes = opcodes;

View file

@ -59,12 +59,8 @@ private:
// Set this to turn debugging on // Set this to turn debugging on
bool _debugFlag; bool _debugFlag;
// FIXME: Some opcodes pass pointers in integer variables. I don't
// think that's entirely portable.
typedef int32 (Logic::*OpcodeProc)(int32 *); typedef int32 (Logic::*OpcodeProc)(int32 *);
struct OpcodeEntry { struct OpcodeEntry {
byte numArgs;
OpcodeProc proc; OpcodeProc proc;
const char *desc; const char *desc;
}; };