diff options
author | Chris Apers | 2009-02-15 18:53:27 +0000 |
---|---|---|
committer | Chris Apers | 2009-02-15 18:53:27 +0000 |
commit | 3ceb1482dbc8559dde0346f3c38b93be6bc1f976 (patch) | |
tree | 5b67598aa778699f195531a17aaef8eb2ae8b0b7 /engines | |
parent | 17014c4f472a2325fa75b4a14cf1acace3464020 (diff) | |
download | scummvm-rg350-3ceb1482dbc8559dde0346f3c38b93be6bc1f976.tar.gz scummvm-rg350-3ceb1482dbc8559dde0346f3c38b93be6bc1f976.tar.bz2 scummvm-rg350-3ceb1482dbc8559dde0346f3c38b93be6bc1f976.zip |
Quick dirty hack to make the engine run again on PalmOS
svn-id: r38278
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/script.h | 14 | ||||
-rw-r--r-- | engines/cine/script_fw.cpp | 326 | ||||
-rw-r--r-- | engines/cine/script_os.cpp | 438 |
3 files changed, 399 insertions, 379 deletions
diff --git a/engines/cine/script.h b/engines/cine/script.h index 19576e4c1a..0559720ecd 100644 --- a/engines/cine/script.h +++ b/engines/cine/script.h @@ -147,10 +147,10 @@ private: ScriptVars &_globalVars; ///< Global variables reference FWScriptInfo *_info; ///< Script info - static const Opcode _opcodeTable[]; - static const unsigned int _numOpcodes; - protected: + static Opcode *_opcodeTable; + static unsigned int _numOpcodes; + int o1_modifyObjectParam(); int o1_getObjectParam(); int o1_addObjectParam(); @@ -278,6 +278,8 @@ protected: public: int16 _index; ///< Index in script table + static void setupTable(); + FWScript(const RawScript &script, int16 index); // FWScript(const RawObjectScript &script, int16 index); FWScript(const FWScript &src); @@ -298,13 +300,15 @@ public: */ class OSScript : public FWScript { private: - static const Opcode _opcodeTable[]; - static const unsigned int _numOpcodes; + static Opcode *_opcodeTable; + static unsigned int _numOpcodes; protected: void load(const ScriptVars &labels, const ScriptVars &local, uint16 compare, uint16 pos); public: + static void setupTable(); + OSScript(const RawScript &script, int16 index); OSScript(RawObjectScript &script, int16 index); OSScript(const OSScript &src); diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp index e90dd6f151..b4c4d72701 100644 --- a/engines/cine/script_fw.cpp +++ b/engines/cine/script_fw.cpp @@ -48,164 +48,172 @@ ScriptVars globalVars(NUM_MAX_VAR + 1); uint16 compareVars(int16 a, int16 b); -const Opcode FWScript::_opcodeTable[] = { - /* 00 */ - { &FWScript::o1_modifyObjectParam, "bbw" }, - { &FWScript::o1_getObjectParam, "bbb" }, - { &FWScript::o1_addObjectParam, "bbw" }, - { &FWScript::o1_subObjectParam, "bbw" }, - /* 04 */ - { &FWScript::o1_mulObjectParam, "bbw" }, - { &FWScript::o1_divObjectParam, "bbw" }, - { &FWScript::o1_compareObjectParam, "bbw" }, - { &FWScript::o1_setupObject, "bwwww" }, - /* 08 */ - { &FWScript::o1_checkCollision, "bwwww" }, - { &FWScript::o1_loadVar, "bc" }, - { &FWScript::o1_addVar, "bc" }, - { &FWScript::o1_subVar, "bc" }, - /* 0C */ - { &FWScript::o1_mulVar, "bc" }, - { &FWScript::o1_divVar, "bc" }, - { &FWScript::o1_compareVar, "bc" }, - { &FWScript::o1_modifyObjectParam2, "bbb" }, - /* 10 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_loadMask0, "b" }, - /* 14 */ - { &FWScript::o1_unloadMask0, "b" }, - { &FWScript::o1_addToBgList, "b" }, - { &FWScript::o1_loadMask1, "b" }, - { &FWScript::o1_unloadMask1, "b" }, - /* 18 */ - { &FWScript::o1_loadMask4, "b" }, - { &FWScript::o1_unloadMask4, "b" }, - { &FWScript::o1_addSpriteFilledToBgList, "b" }, - { &FWScript::o1_op1B, "" }, - /* 1C */ - { 0, 0 }, - { &FWScript::o1_label, "l" }, - { &FWScript::o1_goto, "b" }, - { &FWScript::o1_gotoIfSup, "b" }, - /* 20 */ - { &FWScript::o1_gotoIfSupEqu, "b" }, - { &FWScript::o1_gotoIfInf, "b" }, - { &FWScript::o1_gotoIfInfEqu, "b" }, - { &FWScript::o1_gotoIfEqu, "b" }, - /* 24 */ - { &FWScript::o1_gotoIfDiff, "b" }, - { &FWScript::o1_removeLabel, "b" }, - { &FWScript::o1_loop, "bb" }, - { 0, 0 }, - /* 28 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 2C */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 30 */ - { 0, 0 }, - { &FWScript::o1_startGlobalScript, "b" }, - { &FWScript::o1_endGlobalScript, "b" }, - { 0, 0 }, - /* 34 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 38 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_loadAnim, "s" }, - /* 3C */ - { &FWScript::o1_loadBg, "s" }, - { &FWScript::o1_loadCt, "s" }, - { 0, 0 }, - { &FWScript::o1_loadPart, "s" }, - /* 40 */ - { &FWScript::o1_closePart, "" }, - { &FWScript::o1_loadNewPrcName, "bs" }, - { &FWScript::o1_requestCheckPendingDataLoad, "" }, - { 0, 0 }, - /* 44 */ - { 0, 0 }, - { &FWScript::o1_blitAndFade, "" }, - { &FWScript::o1_fadeToBlack, "" }, - { &FWScript::o1_transformPaletteRange, "bbwww" }, - /* 48 */ - { 0, 0 }, - { &FWScript::o1_setDefaultMenuBgColor, "b" }, - { &FWScript::o1_palRotate, "bbb" }, - { 0, 0 }, - /* 4C */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_break, "" }, - /* 50 */ - { &FWScript::o1_endScript, "x" }, - { &FWScript::o1_message, "bwwww" }, - { &FWScript::o1_loadGlobalVar, "bc" }, - { &FWScript::o1_compareGlobalVar, "bc" }, - /* 54 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 58 */ - { 0, 0 }, - { &FWScript::o1_declareFunctionName, "s" }, - { &FWScript::o1_freePartRange, "bb" }, - { &FWScript::o1_unloadAllMasks, "" }, - /* 5C */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 60 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_setScreenDimensions, "wwww" }, - /* 64 */ - { &FWScript::o1_displayBackground, "" }, - { &FWScript::o1_initializeZoneData, "" }, - { &FWScript::o1_setZoneDataEntry, "bw" }, - { &FWScript::o1_getZoneDataEntry, "bb" }, - /* 68 */ - { &FWScript::o1_setPlayerCommandPosY, "b" }, - { &FWScript::o1_allowPlayerInput, "" }, - { &FWScript::o1_disallowPlayerInput, "" }, - { &FWScript::o1_changeDataDisk, "b" }, - /* 6C */ - { 0, 0 }, - { &FWScript::o1_loadMusic, "s" }, - { &FWScript::o1_playMusic, "" }, - { &FWScript::o1_fadeOutMusic, "" }, - /* 70 */ - { &FWScript::o1_stopSample, "" }, - { &FWScript::o1_op71, "bw" }, - { &FWScript::o1_op72, "wbw" }, - { &FWScript::o1_op73, "wbw" }, - /* 74 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_playSample, "bbwbww" }, - /* 78 */ - { &FWScript::o1_playSample, "bbwbww" }, - { &FWScript::o1_disableSystemMenu, "b" }, - { &FWScript::o1_loadMask5, "b" }, - { &FWScript::o1_unloadMask5, "b" } -}; -const unsigned int FWScript::_numOpcodes = ARRAYSIZE(FWScript::_opcodeTable); + +Opcode *FWScript::_opcodeTable = 0; +unsigned int FWScript::_numOpcodes = 0; + +void FWScript::setupTable() { + static const Opcode opcodeTable[] = { + /* 00 */ + { &FWScript::o1_modifyObjectParam, "bbw" }, + { &FWScript::o1_getObjectParam, "bbb" }, + { &FWScript::o1_addObjectParam, "bbw" }, + { &FWScript::o1_subObjectParam, "bbw" }, + /* 04 */ + { &FWScript::o1_mulObjectParam, "bbw" }, + { &FWScript::o1_divObjectParam, "bbw" }, + { &FWScript::o1_compareObjectParam, "bbw" }, + { &FWScript::o1_setupObject, "bwwww" }, + /* 08 */ + { &FWScript::o1_checkCollision, "bwwww" }, + { &FWScript::o1_loadVar, "bc" }, + { &FWScript::o1_addVar, "bc" }, + { &FWScript::o1_subVar, "bc" }, + /* 0C */ + { &FWScript::o1_mulVar, "bc" }, + { &FWScript::o1_divVar, "bc" }, + { &FWScript::o1_compareVar, "bc" }, + { &FWScript::o1_modifyObjectParam2, "bbb" }, + /* 10 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_loadMask0, "b" }, + /* 14 */ + { &FWScript::o1_unloadMask0, "b" }, + { &FWScript::o1_addToBgList, "b" }, + { &FWScript::o1_loadMask1, "b" }, + { &FWScript::o1_unloadMask1, "b" }, + /* 18 */ + { &FWScript::o1_loadMask4, "b" }, + { &FWScript::o1_unloadMask4, "b" }, + { &FWScript::o1_addSpriteFilledToBgList, "b" }, + { &FWScript::o1_op1B, "" }, + /* 1C */ + { 0, 0 }, + { &FWScript::o1_label, "l" }, + { &FWScript::o1_goto, "b" }, + { &FWScript::o1_gotoIfSup, "b" }, + /* 20 */ + { &FWScript::o1_gotoIfSupEqu, "b" }, + { &FWScript::o1_gotoIfInf, "b" }, + { &FWScript::o1_gotoIfInfEqu, "b" }, + { &FWScript::o1_gotoIfEqu, "b" }, + /* 24 */ + { &FWScript::o1_gotoIfDiff, "b" }, + { &FWScript::o1_removeLabel, "b" }, + { &FWScript::o1_loop, "bb" }, + { 0, 0 }, + /* 28 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 2C */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 30 */ + { 0, 0 }, + { &FWScript::o1_startGlobalScript, "b" }, + { &FWScript::o1_endGlobalScript, "b" }, + { 0, 0 }, + /* 34 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 38 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_loadAnim, "s" }, + /* 3C */ + { &FWScript::o1_loadBg, "s" }, + { &FWScript::o1_loadCt, "s" }, + { 0, 0 }, + { &FWScript::o1_loadPart, "s" }, + /* 40 */ + { &FWScript::o1_closePart, "" }, + { &FWScript::o1_loadNewPrcName, "bs" }, + { &FWScript::o1_requestCheckPendingDataLoad, "" }, + { 0, 0 }, + /* 44 */ + { 0, 0 }, + { &FWScript::o1_blitAndFade, "" }, + { &FWScript::o1_fadeToBlack, "" }, + { &FWScript::o1_transformPaletteRange, "bbwww" }, + /* 48 */ + { 0, 0 }, + { &FWScript::o1_setDefaultMenuBgColor, "b" }, + { &FWScript::o1_palRotate, "bbb" }, + { 0, 0 }, + /* 4C */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_break, "" }, + /* 50 */ + { &FWScript::o1_endScript, "x" }, + { &FWScript::o1_message, "bwwww" }, + { &FWScript::o1_loadGlobalVar, "bc" }, + { &FWScript::o1_compareGlobalVar, "bc" }, + /* 54 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 58 */ + { 0, 0 }, + { &FWScript::o1_declareFunctionName, "s" }, + { &FWScript::o1_freePartRange, "bb" }, + { &FWScript::o1_unloadAllMasks, "" }, + /* 5C */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 60 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_setScreenDimensions, "wwww" }, + /* 64 */ + { &FWScript::o1_displayBackground, "" }, + { &FWScript::o1_initializeZoneData, "" }, + { &FWScript::o1_setZoneDataEntry, "bw" }, + { &FWScript::o1_getZoneDataEntry, "bb" }, + /* 68 */ + { &FWScript::o1_setPlayerCommandPosY, "b" }, + { &FWScript::o1_allowPlayerInput, "" }, + { &FWScript::o1_disallowPlayerInput, "" }, + { &FWScript::o1_changeDataDisk, "b" }, + /* 6C */ + { 0, 0 }, + { &FWScript::o1_loadMusic, "s" }, + { &FWScript::o1_playMusic, "" }, + { &FWScript::o1_fadeOutMusic, "" }, + /* 70 */ + { &FWScript::o1_stopSample, "" }, + { &FWScript::o1_op71, "bw" }, + { &FWScript::o1_op72, "wbw" }, + { &FWScript::o1_op73, "wbw" }, + /* 74 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_playSample, "bbwbww" }, + /* 78 */ + { &FWScript::o1_playSample, "bbwbww" }, + { &FWScript::o1_disableSystemMenu, "b" }, + { &FWScript::o1_loadMask5, "b" }, + { &FWScript::o1_unloadMask5, "b" } + }; + + FWScript::_opcodeTable = (Opcode *)opcodeTable; + FWScript::_numOpcodes = ARRAYSIZE(opcodeTable); +} FWScriptInfo *scriptInfo; ///< Script factory RawScriptArray scriptTable; ///< Table of script bytecode @@ -216,8 +224,10 @@ void setupOpcodes() { static FWScriptInfo fw; static OSScriptInfo os; if (g_cine->getGameType() == Cine::GType_FW) { + FWScript::setupTable(); scriptInfo = &fw; } else { + OSScript::setupTable(); scriptInfo = &os; } } diff --git a/engines/cine/script_os.cpp b/engines/cine/script_os.cpp index 792e75b42f..28bb70c36c 100644 --- a/engines/cine/script_os.cpp +++ b/engines/cine/script_os.cpp @@ -38,222 +38,228 @@ namespace Cine { -const Opcode OSScript::_opcodeTable[] = { - /* 00 */ - { &FWScript::o1_modifyObjectParam, "bbw" }, - { &FWScript::o1_getObjectParam, "bbb" }, - { &FWScript::o1_addObjectParam, "bbw" }, - { &FWScript::o1_subObjectParam, "bbw" }, - /* 04 */ - { &FWScript::o1_mulObjectParam, "bbw" }, - { &FWScript::o1_divObjectParam, "bbw" }, - { &FWScript::o1_compareObjectParam, "bbw" }, - { &FWScript::o1_setupObject, "bwwww" }, - /* 08 */ - { &FWScript::o1_checkCollision, "bwwww" }, - { &FWScript::o1_loadVar, "bc" }, - { &FWScript::o1_addVar, "bc" }, - { &FWScript::o1_subVar, "bc" }, - /* 0C */ - { &FWScript::o1_mulVar, "bc" }, - { &FWScript::o1_divVar, "bc" }, - { &FWScript::o1_compareVar, "bc" }, - { &FWScript::o1_modifyObjectParam2, "bbb" }, - /* 10 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_loadMask0, "b" }, - /* 14 */ - { &FWScript::o1_unloadMask0, "b" }, - { &FWScript::o1_addToBgList, "b" }, - { &FWScript::o1_loadMask1, "b" }, - { &FWScript::o1_unloadMask1, "b" }, - /* 18 */ - { &FWScript::o1_loadMask4, "b" }, - { &FWScript::o1_unloadMask4, "b" }, - { &FWScript::o1_addSpriteFilledToBgList, "b" }, - { &FWScript::o1_op1B, "" }, /* TODO: Name this opcode properly. */ - /* 1C */ - { 0, 0 }, - { &FWScript::o1_label, "l" }, - { &FWScript::o1_goto, "b" }, - { &FWScript::o1_gotoIfSup, "b" }, - /* 20 */ - { &FWScript::o1_gotoIfSupEqu, "b" }, - { &FWScript::o1_gotoIfInf, "b" }, - { &FWScript::o1_gotoIfInfEqu, "b" }, - { &FWScript::o1_gotoIfEqu, "b" }, - /* 24 */ - { &FWScript::o1_gotoIfDiff, "b" }, - { &FWScript::o1_removeLabel, "b" }, - { &FWScript::o1_loop, "bb" }, - { 0, 0 }, - /* 28 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 2C */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 30 */ - { 0, 0 }, - { &FWScript::o1_startGlobalScript, "b" }, - { &FWScript::o1_endGlobalScript, "b" }, - { 0, 0 }, - /* 34 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 38 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_loadAnim, "s" }, - /* 3C */ - { &FWScript::o1_loadBg, "s" }, - { &FWScript::o2_loadCt, "s" }, - { 0, 0 }, - { &FWScript::o2_loadPart, "s" }, - /* 40 */ - { 0, 0 }, /* o1_closePart, triggered by some scripts (STARTA.PRC 4 for ex.) */ - { &FWScript::o1_loadNewPrcName, "bs" }, - { &FWScript::o1_requestCheckPendingDataLoad, "" }, - { 0, 0 }, - /* 44 */ - { 0, 0 }, - { &FWScript::o1_blitAndFade, "" }, - { &FWScript::o1_fadeToBlack, "" }, - { &FWScript::o1_transformPaletteRange, "bbwww" }, - /* 48 */ - { 0, 0 }, - { &FWScript::o1_setDefaultMenuBgColor, "b" }, - { &FWScript::o1_palRotate, "bbb" }, - { 0, 0 }, - /* 4C */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_break, "" }, - /* 50 */ - { &FWScript::o1_endScript, "x" }, - { &FWScript::o1_message, "bwwww" }, - { &FWScript::o1_loadGlobalVar, "bc" }, - { &FWScript::o1_compareGlobalVar, "bc" }, - /* 54 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 58 */ - { 0, 0 }, - { &FWScript::o1_declareFunctionName, "s" }, - { &FWScript::o1_freePartRange, "bb" }, - { &FWScript::o1_unloadAllMasks, "" }, - /* 5C */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - /* 60 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o1_setScreenDimensions, "wwww" }, - /* 64 */ - { &FWScript::o1_displayBackground, "" }, - { &FWScript::o1_initializeZoneData, "" }, - { &FWScript::o1_setZoneDataEntry, "bw" }, - { &FWScript::o1_getZoneDataEntry, "bb" }, - /* 68 */ - { &FWScript::o1_setPlayerCommandPosY, "b" }, - { &FWScript::o1_allowPlayerInput, "" }, - { &FWScript::o1_disallowPlayerInput, "" }, - { &FWScript::o1_changeDataDisk, "b" }, /* Same as opcodes 0x95 and 0xA9. */ - /* 6C */ - { 0, 0 }, - { &FWScript::o1_loadMusic, "s" }, - { &FWScript::o1_playMusic, "" }, - { &FWScript::o1_fadeOutMusic, "" }, - /* 70 */ - { &FWScript::o1_stopSample, "" }, - { &FWScript::o1_op71, "bw" }, /* TODO: Name this opcode properly. */ - { &FWScript::o1_op72, "wbw" }, /* Same as opcode 0x73. TODO: Name this opcode properly. */ - { &FWScript::o1_op72, "wbw" }, /* Same as opcode 0x72. */ - /* 74 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o2_playSample, "bbwbww" }, - /* 78 */ - { &FWScript::o2_playSampleAlt, "bbwbww" }, - { &FWScript::o1_disableSystemMenu, "b" }, - { &FWScript::o1_loadMask5, "b" }, - { &FWScript::o1_unloadMask5, "b" }, /* Last opcode used by Future Wars. */ - /* 7C */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { &FWScript::o2_addSeqListElement, "bbbbwww" }, - /* 80 */ - { &FWScript::o2_removeSeq, "bb" }, - { &FWScript::o2_op81, "" }, /* TODO: Name this opcode properly. */ - { &FWScript::o2_modifySeqListElement, "bbwwb" }, - { &FWScript::o2_isSeqRunning, "bb" }, - /* 84 */ - { &FWScript::o2_gotoIfSupNearest, "b" }, - { &FWScript::o2_gotoIfSupEquNearest, "b" }, - { &FWScript::o2_gotoIfInfNearest, "b" }, - { &FWScript::o2_gotoIfInfEquNearest, "b" }, - /* 88 */ - { &FWScript::o2_gotoIfEquNearest, "b" }, - { &FWScript::o2_gotoIfDiffNearest, "b" }, - { 0, 0 }, - { &FWScript::o2_startObjectScript, "b" }, - /* 8C */ - { &FWScript::o2_stopObjectScript, "b" }, - { &FWScript::o2_op8D, "wwwwwwww" }, /* TODO: Name this opcode properly. */ - { &FWScript::o2_addBackground, "bs" }, - { &FWScript::o2_removeBackground, "b" }, - /* 90 */ - { &FWScript::o2_loadAbs, "bs" }, - { &FWScript::o2_loadBg, "b" }, - { 0, 0 }, - { 0, 0 }, - /* 94 */ - { 0, 0 }, - { &FWScript::o1_changeDataDisk, "b" }, /* Same as opcodes 0x6B and 0xA9. */ - { 0, 0 }, - { 0, 0 }, - /* 98 */ - { 0, 0 }, - { 0, 0 }, - { &FWScript::o2_wasZoneChecked, "b" }, - { &FWScript::o2_op9B, "wwwwwwww" }, /* TODO: Name this opcode properly. */ - /* 9C */ - { &FWScript::o2_op9C, "wwww" }, /* TODO: Name this opcode properly. */ - { &FWScript::o2_useBgScroll, "b" }, - { &FWScript::o2_setAdditionalBgVScroll, "c" }, - { &FWScript::o2_op9F, "ww" }, /* TODO: Name this opcode properly. */ - /* A0 */ - { &FWScript::o2_addGfxElementType20, "ww" }, /* TODO: Name this opcode properly. */ - { &FWScript::o2_removeGfxElementType20, "ww" }, /* TODO: Name this opcode properly. */ - { &FWScript::o2_addGfxElementType21, "ww" }, /* TODO: Name this opcode properly. */ - { &FWScript::o2_removeGfxElementType21, "ww" }, /* TODO: Name this opcode properly. */ - /* A4 */ - { &FWScript::o2_loadMask22, "b" }, /* TODO: Name this opcode properly. */ - { &FWScript::o2_unloadMask22, "b" }, /* TODO: Name this opcode properly. */ - { 0, 0 }, - { 0, 0 }, - /* A8 */ - { 0, 0 }, - { &FWScript::o1_changeDataDisk, "b" } /* Same as opcodes 0x6B and 0x95. */ -}; -const unsigned int OSScript::_numOpcodes = ARRAYSIZE(OSScript::_opcodeTable); +Opcode *OSScript::_opcodeTable = 0; +unsigned int OSScript::_numOpcodes = 0; + +void OSScript::setupTable() { + static const Opcode opcodeTable[] = { + /* 00 */ + { &FWScript::o1_modifyObjectParam, "bbw" }, + { &FWScript::o1_getObjectParam, "bbb" }, + { &FWScript::o1_addObjectParam, "bbw" }, + { &FWScript::o1_subObjectParam, "bbw" }, + /* 04 */ + { &FWScript::o1_mulObjectParam, "bbw" }, + { &FWScript::o1_divObjectParam, "bbw" }, + { &FWScript::o1_compareObjectParam, "bbw" }, + { &FWScript::o1_setupObject, "bwwww" }, + /* 08 */ + { &FWScript::o1_checkCollision, "bwwww" }, + { &FWScript::o1_loadVar, "bc" }, + { &FWScript::o1_addVar, "bc" }, + { &FWScript::o1_subVar, "bc" }, + /* 0C */ + { &FWScript::o1_mulVar, "bc" }, + { &FWScript::o1_divVar, "bc" }, + { &FWScript::o1_compareVar, "bc" }, + { &FWScript::o1_modifyObjectParam2, "bbb" }, + /* 10 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_loadMask0, "b" }, + /* 14 */ + { &FWScript::o1_unloadMask0, "b" }, + { &FWScript::o1_addToBgList, "b" }, + { &FWScript::o1_loadMask1, "b" }, + { &FWScript::o1_unloadMask1, "b" }, + /* 18 */ + { &FWScript::o1_loadMask4, "b" }, + { &FWScript::o1_unloadMask4, "b" }, + { &FWScript::o1_addSpriteFilledToBgList, "b" }, + { &FWScript::o1_op1B, "" }, /* TODO: Name this opcode properly. */ + /* 1C */ + { 0, 0 }, + { &FWScript::o1_label, "l" }, + { &FWScript::o1_goto, "b" }, + { &FWScript::o1_gotoIfSup, "b" }, + /* 20 */ + { &FWScript::o1_gotoIfSupEqu, "b" }, + { &FWScript::o1_gotoIfInf, "b" }, + { &FWScript::o1_gotoIfInfEqu, "b" }, + { &FWScript::o1_gotoIfEqu, "b" }, + /* 24 */ + { &FWScript::o1_gotoIfDiff, "b" }, + { &FWScript::o1_removeLabel, "b" }, + { &FWScript::o1_loop, "bb" }, + { 0, 0 }, + /* 28 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 2C */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 30 */ + { 0, 0 }, + { &FWScript::o1_startGlobalScript, "b" }, + { &FWScript::o1_endGlobalScript, "b" }, + { 0, 0 }, + /* 34 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 38 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_loadAnim, "s" }, + /* 3C */ + { &FWScript::o1_loadBg, "s" }, + { &FWScript::o2_loadCt, "s" }, + { 0, 0 }, + { &FWScript::o2_loadPart, "s" }, + /* 40 */ + { 0, 0 }, /* o1_closePart, triggered by some scripts (STARTA.PRC 4 for ex.) */ + { &FWScript::o1_loadNewPrcName, "bs" }, + { &FWScript::o1_requestCheckPendingDataLoad, "" }, + { 0, 0 }, + /* 44 */ + { 0, 0 }, + { &FWScript::o1_blitAndFade, "" }, + { &FWScript::o1_fadeToBlack, "" }, + { &FWScript::o1_transformPaletteRange, "bbwww" }, + /* 48 */ + { 0, 0 }, + { &FWScript::o1_setDefaultMenuBgColor, "b" }, + { &FWScript::o1_palRotate, "bbb" }, + { 0, 0 }, + /* 4C */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_break, "" }, + /* 50 */ + { &FWScript::o1_endScript, "x" }, + { &FWScript::o1_message, "bwwww" }, + { &FWScript::o1_loadGlobalVar, "bc" }, + { &FWScript::o1_compareGlobalVar, "bc" }, + /* 54 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 58 */ + { 0, 0 }, + { &FWScript::o1_declareFunctionName, "s" }, + { &FWScript::o1_freePartRange, "bb" }, + { &FWScript::o1_unloadAllMasks, "" }, + /* 5C */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + /* 60 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o1_setScreenDimensions, "wwww" }, + /* 64 */ + { &FWScript::o1_displayBackground, "" }, + { &FWScript::o1_initializeZoneData, "" }, + { &FWScript::o1_setZoneDataEntry, "bw" }, + { &FWScript::o1_getZoneDataEntry, "bb" }, + /* 68 */ + { &FWScript::o1_setPlayerCommandPosY, "b" }, + { &FWScript::o1_allowPlayerInput, "" }, + { &FWScript::o1_disallowPlayerInput, "" }, + { &FWScript::o1_changeDataDisk, "b" }, /* Same as opcodes 0x95 and 0xA9. */ + /* 6C */ + { 0, 0 }, + { &FWScript::o1_loadMusic, "s" }, + { &FWScript::o1_playMusic, "" }, + { &FWScript::o1_fadeOutMusic, "" }, + /* 70 */ + { &FWScript::o1_stopSample, "" }, + { &FWScript::o1_op71, "bw" }, /* TODO: Name this opcode properly. */ + { &FWScript::o1_op72, "wbw" }, /* Same as opcode 0x73. TODO: Name this opcode properly. */ + { &FWScript::o1_op72, "wbw" }, /* Same as opcode 0x72. */ + /* 74 */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o2_playSample, "bbwbww" }, + /* 78 */ + { &FWScript::o2_playSampleAlt, "bbwbww" }, + { &FWScript::o1_disableSystemMenu, "b" }, + { &FWScript::o1_loadMask5, "b" }, + { &FWScript::o1_unloadMask5, "b" }, /* Last opcode used by Future Wars. */ + /* 7C */ + { 0, 0 }, + { 0, 0 }, + { 0, 0 }, + { &FWScript::o2_addSeqListElement, "bbbbwww" }, + /* 80 */ + { &FWScript::o2_removeSeq, "bb" }, + { &FWScript::o2_op81, "" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_modifySeqListElement, "bbwwb" }, + { &FWScript::o2_isSeqRunning, "bb" }, + /* 84 */ + { &FWScript::o2_gotoIfSupNearest, "b" }, + { &FWScript::o2_gotoIfSupEquNearest, "b" }, + { &FWScript::o2_gotoIfInfNearest, "b" }, + { &FWScript::o2_gotoIfInfEquNearest, "b" }, + /* 88 */ + { &FWScript::o2_gotoIfEquNearest, "b" }, + { &FWScript::o2_gotoIfDiffNearest, "b" }, + { 0, 0 }, + { &FWScript::o2_startObjectScript, "b" }, + /* 8C */ + { &FWScript::o2_stopObjectScript, "b" }, + { &FWScript::o2_op8D, "wwwwwwww" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_addBackground, "bs" }, + { &FWScript::o2_removeBackground, "b" }, + /* 90 */ + { &FWScript::o2_loadAbs, "bs" }, + { &FWScript::o2_loadBg, "b" }, + { 0, 0 }, + { 0, 0 }, + /* 94 */ + { 0, 0 }, + { &FWScript::o1_changeDataDisk, "b" }, /* Same as opcodes 0x6B and 0xA9. */ + { 0, 0 }, + { 0, 0 }, + /* 98 */ + { 0, 0 }, + { 0, 0 }, + { &FWScript::o2_wasZoneChecked, "b" }, + { &FWScript::o2_op9B, "wwwwwwww" }, /* TODO: Name this opcode properly. */ + /* 9C */ + { &FWScript::o2_op9C, "wwww" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_useBgScroll, "b" }, + { &FWScript::o2_setAdditionalBgVScroll, "c" }, + { &FWScript::o2_op9F, "ww" }, /* TODO: Name this opcode properly. */ + /* A0 */ + { &FWScript::o2_addGfxElementType20, "ww" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_removeGfxElementType20, "ww" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_addGfxElementType21, "ww" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_removeGfxElementType21, "ww" }, /* TODO: Name this opcode properly. */ + /* A4 */ + { &FWScript::o2_loadMask22, "b" }, /* TODO: Name this opcode properly. */ + { &FWScript::o2_unloadMask22, "b" }, /* TODO: Name this opcode properly. */ + { 0, 0 }, + { 0, 0 }, + /* A8 */ + { 0, 0 }, + { &FWScript::o1_changeDataDisk, "b" } /* Same as opcodes 0x6B and 0x95. */ + }; + OSScript::_opcodeTable = (Opcode *)opcodeTable; + OSScript::_numOpcodes = ARRAYSIZE(opcodeTable); +} /*! \brief Contructor for global scripts * \param script Script bytecode reference |