From c36eddd91a9c33b95329e1de12f6c8948f9b2c09 Mon Sep 17 00:00:00 2001 From: Chris Apers Date: Sat, 5 Nov 2005 19:42:50 +0000 Subject: - Move opcode table to a method so that it is correctly initialized with PalmOS ARM svn-id: r19477 --- sword1/logic.cpp | 210 ++++++++++++++++++++++++++++--------------------------- sword1/logic.h | 3 +- 2 files changed, 110 insertions(+), 103 deletions(-) diff --git a/sword1/logic.cpp b/sword1/logic.cpp index 886bc59448..3125496101 100644 --- a/sword1/logic.cpp +++ b/sword1/logic.cpp @@ -62,6 +62,8 @@ Logic::Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, _eventMan = NULL; _system = system; _mixer = mixer; + + setupMcodeTable(); } Logic::~Logic(void) { @@ -681,108 +683,112 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc } } -BSMcodeTable Logic::_mcodeTable[100] = { - &Logic::fnBackground, - &Logic::fnForeground, - &Logic::fnSort, - &Logic::fnNoSprite, - &Logic::fnMegaSet, - &Logic::fnAnim, - &Logic::fnSetFrame, - &Logic::fnFullAnim, - &Logic::fnFullSetFrame, - &Logic::fnFadeDown, - &Logic::fnFadeUp, - &Logic::fnCheckFade, - &Logic::fnSetSpritePalette, - &Logic::fnSetWholePalette, - &Logic::fnSetFadeTargetPalette, - &Logic::fnSetPaletteToFade, - &Logic::fnSetPaletteToCut, - &Logic::fnPlaySequence, - &Logic::fnIdle, - &Logic::fnPause, - &Logic::fnPauseSeconds, - &Logic::fnQuit, - &Logic::fnKillId, - &Logic::fnSuicide, - &Logic::fnNewScript, - &Logic::fnSubScript, - &Logic::fnRestartScript, - &Logic::fnSetBookmark, - &Logic::fnGotoBookmark, - &Logic::fnSendSync, - &Logic::fnWaitSync, - &Logic::cfnClickInteract, - &Logic::cfnSetScript, - &Logic::cfnPresetScript, - &Logic::fnInteract, - &Logic::fnIssueEvent, - &Logic::fnCheckForEvent, - &Logic::fnWipeHands, - &Logic::fnISpeak, - &Logic::fnTheyDo, - &Logic::fnTheyDoWeWait, - &Logic::fnWeWait, - &Logic::fnChangeSpeechText, - &Logic::fnTalkError, - &Logic::fnStartTalk, - &Logic::fnCheckForTextLine, - &Logic::fnAddTalkWaitStatusBit, - &Logic::fnRemoveTalkWaitStatusBit, - &Logic::fnNoHuman, - &Logic::fnAddHuman, - &Logic::fnBlankMouse, - &Logic::fnNormalMouse, - &Logic::fnLockMouse, - &Logic::fnUnlockMouse, - &Logic::fnSetMousePointer, - &Logic::fnSetMouseLuggage, - &Logic::fnMouseOn, - &Logic::fnMouseOff, - &Logic::fnChooser, - &Logic::fnEndChooser, - &Logic::fnStartMenu, - &Logic::fnEndMenu, - &Logic::cfnReleaseMenu, - &Logic::fnAddSubject, - &Logic::fnAddObject, - &Logic::fnRemoveObject, - &Logic::fnEnterSection, - &Logic::fnLeaveSection, - &Logic::fnChangeFloor, - &Logic::fnWalk, - &Logic::fnTurn, - &Logic::fnStand, - &Logic::fnStandAt, - &Logic::fnFace, - &Logic::fnFaceXy, - &Logic::fnIsFacing, - &Logic::fnGetTo, - &Logic::fnGetToError, - &Logic::fnGetPos, - &Logic::fnGetGamepadXy, - &Logic::fnPlayFx, - &Logic::fnStopFx, - &Logic::fnPlayMusic, - &Logic::fnStopMusic, - &Logic::fnInnerSpace, - &Logic::fnRandom, - &Logic::fnSetScreen, - &Logic::fnPreload, - &Logic::fnCheckCD, - &Logic::fnRestartGame, - &Logic::fnQuitGame, - &Logic::fnDeathScreen, - &Logic::fnSetParallax, - &Logic::fnTdebug, - &Logic::fnRedFlash, - &Logic::fnBlueFlash, - &Logic::fnYellow, - &Logic::fnGreen, - &Logic::fnPurple, - &Logic::fnBlack -}; +void Logic::setupMcodeTable() { + static const BSMcodeTable mcodeTable[100] = { + &Logic::fnBackground, + &Logic::fnForeground, + &Logic::fnSort, + &Logic::fnNoSprite, + &Logic::fnMegaSet, + &Logic::fnAnim, + &Logic::fnSetFrame, + &Logic::fnFullAnim, + &Logic::fnFullSetFrame, + &Logic::fnFadeDown, + &Logic::fnFadeUp, + &Logic::fnCheckFade, + &Logic::fnSetSpritePalette, + &Logic::fnSetWholePalette, + &Logic::fnSetFadeTargetPalette, + &Logic::fnSetPaletteToFade, + &Logic::fnSetPaletteToCut, + &Logic::fnPlaySequence, + &Logic::fnIdle, + &Logic::fnPause, + &Logic::fnPauseSeconds, + &Logic::fnQuit, + &Logic::fnKillId, + &Logic::fnSuicide, + &Logic::fnNewScript, + &Logic::fnSubScript, + &Logic::fnRestartScript, + &Logic::fnSetBookmark, + &Logic::fnGotoBookmark, + &Logic::fnSendSync, + &Logic::fnWaitSync, + &Logic::cfnClickInteract, + &Logic::cfnSetScript, + &Logic::cfnPresetScript, + &Logic::fnInteract, + &Logic::fnIssueEvent, + &Logic::fnCheckForEvent, + &Logic::fnWipeHands, + &Logic::fnISpeak, + &Logic::fnTheyDo, + &Logic::fnTheyDoWeWait, + &Logic::fnWeWait, + &Logic::fnChangeSpeechText, + &Logic::fnTalkError, + &Logic::fnStartTalk, + &Logic::fnCheckForTextLine, + &Logic::fnAddTalkWaitStatusBit, + &Logic::fnRemoveTalkWaitStatusBit, + &Logic::fnNoHuman, + &Logic::fnAddHuman, + &Logic::fnBlankMouse, + &Logic::fnNormalMouse, + &Logic::fnLockMouse, + &Logic::fnUnlockMouse, + &Logic::fnSetMousePointer, + &Logic::fnSetMouseLuggage, + &Logic::fnMouseOn, + &Logic::fnMouseOff, + &Logic::fnChooser, + &Logic::fnEndChooser, + &Logic::fnStartMenu, + &Logic::fnEndMenu, + &Logic::cfnReleaseMenu, + &Logic::fnAddSubject, + &Logic::fnAddObject, + &Logic::fnRemoveObject, + &Logic::fnEnterSection, + &Logic::fnLeaveSection, + &Logic::fnChangeFloor, + &Logic::fnWalk, + &Logic::fnTurn, + &Logic::fnStand, + &Logic::fnStandAt, + &Logic::fnFace, + &Logic::fnFaceXy, + &Logic::fnIsFacing, + &Logic::fnGetTo, + &Logic::fnGetToError, + &Logic::fnGetPos, + &Logic::fnGetGamepadXy, + &Logic::fnPlayFx, + &Logic::fnStopFx, + &Logic::fnPlayMusic, + &Logic::fnStopMusic, + &Logic::fnInnerSpace, + &Logic::fnRandom, + &Logic::fnSetScreen, + &Logic::fnPreload, + &Logic::fnCheckCD, + &Logic::fnRestartGame, + &Logic::fnQuitGame, + &Logic::fnDeathScreen, + &Logic::fnSetParallax, + &Logic::fnTdebug, + &Logic::fnRedFlash, + &Logic::fnBlueFlash, + &Logic::fnYellow, + &Logic::fnGreen, + &Logic::fnPurple, + &Logic::fnBlack + }; + + _mcodeTable = mcodeTable; +} int Logic::fnBackground(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) { diff --git a/sword1/logic.h b/sword1/logic.h index 29bda2c270..c5844c8dd0 100644 --- a/sword1/logic.h +++ b/sword1/logic.h @@ -88,7 +88,8 @@ private: int fullAnimDriver(Object *compact); int animDriver(Object *compact); - static BSMcodeTable _mcodeTable[100]; + void setupMcodeTable(); + const BSMcodeTable *_mcodeTable; uint16 inRange(uint16 a, uint16 b, uint16 c); -- cgit v1.2.3