diff options
author | Johannes Schickel | 2007-05-05 12:18:02 +0000 |
---|---|---|
committer | Johannes Schickel | 2007-05-05 12:18:02 +0000 |
commit | 776423ff823c28f0b7ef5929af6caa679b11e067 (patch) | |
tree | ea8e43cb1b46b4cb68aa1a645e0ad27bf5a8c120 /engines/kyra | |
parent | ae24e0e99f6ae8e7ebc854a3debe691ad963bdf7 (diff) | |
download | scummvm-rg350-776423ff823c28f0b7ef5929af6caa679b11e067.tar.gz scummvm-rg350-776423ff823c28f0b7ef5929af6caa679b11e067.tar.bz2 scummvm-rg350-776423ff823c28f0b7ef5929af6caa679b11e067.zip |
- started to move v1 specific functions to KyraEngine_v1 (just opcodes yet)
- reworked script opcode handling
svn-id: r26749
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/detection.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/kyra.cpp | 31 | ||||
-rw-r--r-- | engines/kyra/kyra.h | 178 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 241 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.h | 203 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.h | 3 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.h | 2 | ||||
-rw-r--r-- | engines/kyra/module.mk | 1 | ||||
-rw-r--r-- | engines/kyra/scene.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/script.cpp | 16 | ||||
-rw-r--r-- | engines/kyra/script.h | 32 | ||||
-rw-r--r-- | engines/kyra/script_v1.cpp | 316 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 206 |
13 files changed, 663 insertions, 569 deletions
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index 48515dd6ae..3bd1021e5d 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -20,6 +20,7 @@ */ #include "kyra/kyra.h" +#include "kyra/kyra_v1.h" #include "kyra/kyra_v2.h" #include "kyra/kyra_v3.h" diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index a0f28ff6ff..fd3b32c2f8 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -49,10 +49,6 @@ namespace Kyra { KyraEngine::KyraEngine(OSystem *system, const GameFlags &flags) : Engine(system) { - setupOpcodeTable(); - setupButtonData(); - setupMenu(); - _flags = flags; _seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm = @@ -124,10 +120,6 @@ KyraEngine::KyraEngine(OSystem *system, const GameFlags &flags) Common::addSpecialDebugLevel(kDebugLevelMovie, "Movie", "Movie debug level"); } -KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags) - : KyraEngine(system, flags) { -} - int KyraEngine::init() { // Setup mixer if (!_mixer->isReady()) @@ -215,6 +207,10 @@ int KyraEngine::init() { _sound->setVolume(255); _sound->loadSoundFile(0); + setupOpcodeTable(); + setupButtonData(); + setupMenu(); + _paletteChanged = 1; _currentCharacter = 0; _characterList = new Character[11]; @@ -423,10 +419,6 @@ KyraEngine::~KyraEngine() { delete [] _sceneAnimTable[i]; } -KyraEngine_v1::~KyraEngine_v1() { - -} - int KyraEngine::go() { if (_res->getFileSize("6.FNT")) _screen->loadFont(Screen::FID_6_FNT, "6.FNT"); @@ -503,7 +495,7 @@ void KyraEngine::startup() { _animator->initAnimStateList(); setCharactersInDefaultScene(); - if (!_scriptInterpreter->loadScript("_STARTUP.EMC", _npcScriptData)) + if (!_scriptInterpreter->loadScript("_STARTUP.EMC", _npcScriptData, &_opcodes)) error("Could not load \"_STARTUP.EMC\" script"); _scriptInterpreter->initScript(_scriptMain, _npcScriptData); @@ -515,7 +507,7 @@ void KyraEngine::startup() { _scriptInterpreter->unloadScript(_npcScriptData); - if (!_scriptInterpreter->loadScript("_NPC.EMC", _npcScriptData)) + if (!_scriptInterpreter->loadScript("_NPC.EMC", _npcScriptData, &_opcodes)) error("Could not load \"_NPC.EMC\" script"); snd_playTheme(1); @@ -1143,16 +1135,5 @@ void KyraEngine::runNpcScript(int func) { _scriptInterpreter->runScript(_npcScript); } -int KyraEngine::runOpcode(ScriptState *script, uint8 opcode) { - debugC(9, kDebugLevelMain | kDebugLevelScript, "KyraEngine::runOpcode(%p, %d)", (void *)script, opcode); - assert(script); - assert(opcode < _opcodeTableSize); - - if (_opcodeTable[opcode] == &KyraEngine::o1_dummy) - warning("calling unimplemented opcode(0x%.02X)", opcode); - - return (this->*_opcodeTable[opcode])(script); -} - } // End of namespace Kyra diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index b42a00d510..fe0067a5b4 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -25,6 +25,7 @@ #include "engines/engine.h" #include "common/rect.h" +#include "common/array.h" namespace Kyra { @@ -43,6 +44,7 @@ class TextDisplayer; class KyraEngine; class StaticResource; +struct Opcode; struct ScriptState; struct ScriptData; @@ -262,7 +264,6 @@ public: int16 _northExitHeight; typedef void (KyraEngine::*IntroProc)(); - typedef int (KyraEngine::*OpcodeProc)(ScriptState *script); // static data access const char * const*seqWSATable() { return _seq_WSATable; } @@ -277,7 +278,7 @@ public: // -> misc bool seq_skipSequence() const; -private: +protected: // -> demo void seq_demo(); @@ -360,168 +361,6 @@ public: int setGameFlag(int flag); int queryGameFlag(int flag); int resetGameFlag(int flag); - - virtual int runOpcode(ScriptState *script, uint8 opcode); -protected: - // Opcodes - int o1_magicInMouseItem(ScriptState *script); - int o1_characterSays(ScriptState *script); - int o1_pauseTicks(ScriptState *script); - int o1_drawSceneAnimShape(ScriptState *script); - int o1_queryGameFlag(ScriptState *script); - int o1_setGameFlag(ScriptState *script); - int o1_resetGameFlag(ScriptState *script); - int o1_runNPCScript(ScriptState *script); - int o1_setSpecialExitList(ScriptState *script); - int o1_blockInWalkableRegion(ScriptState *script); - int o1_blockOutWalkableRegion(ScriptState *script); - int o1_walkPlayerToPoint(ScriptState *script); - int o1_dropItemInScene(ScriptState *script); - int o1_drawAnimShapeIntoScene(ScriptState *script); - int o1_createMouseItem(ScriptState *script); - int o1_savePageToDisk(ScriptState *script); - int o1_sceneAnimOn(ScriptState *script); - int o1_sceneAnimOff(ScriptState *script); - int o1_getElapsedSeconds(ScriptState *script); - int o1_mouseIsPointer(ScriptState *script); - int o1_destroyMouseItem(ScriptState *script); - int o1_runSceneAnimUntilDone(ScriptState *script); - int o1_fadeSpecialPalette(ScriptState *script); - int o1_playAdlibSound(ScriptState *script); - int o1_playAdlibScore(ScriptState *script); - int o1_phaseInSameScene(ScriptState *script); - int o1_setScenePhasingFlag(ScriptState *script); - int o1_resetScenePhasingFlag(ScriptState *script); - int o1_queryScenePhasingFlag(ScriptState *script); - int o1_sceneToDirection(ScriptState *script); - int o1_setBirthstoneGem(ScriptState *script); - int o1_placeItemInGenericMapScene(ScriptState *script); - int o1_setBrandonStatusBit(ScriptState *script); - int o1_pauseSeconds(ScriptState *script); - int o1_getCharactersLocation(ScriptState *script); - int o1_runNPCSubscript(ScriptState *script); - int o1_magicOutMouseItem(ScriptState *script); - int o1_internalAnimOn(ScriptState *script); - int o1_forceBrandonToNormal(ScriptState *script); - int o1_poisonDeathNow(ScriptState *script); - int o1_setScaleMode(ScriptState *script); - int o1_openWSAFile(ScriptState *script); - int o1_closeWSAFile(ScriptState *script); - int o1_runWSAFromBeginningToEnd(ScriptState *script); - int o1_displayWSAFrame(ScriptState *script); - int o1_enterNewScene(ScriptState *script); - int o1_setSpecialEnterXAndY(ScriptState *script); - int o1_runWSAFrames(ScriptState *script); - int o1_popBrandonIntoScene(ScriptState *script); - int o1_restoreAllObjectBackgrounds(ScriptState *script); - int o1_setCustomPaletteRange(ScriptState *script); - int o1_loadPageFromDisk(ScriptState *script); - int o1_customPrintTalkString(ScriptState *script); - int o1_restoreCustomPrintBackground(ScriptState *script); - int o1_hideMouse(ScriptState *script); - int o1_showMouse(ScriptState *script); - int o1_getCharacterX(ScriptState *script); - int o1_getCharacterY(ScriptState *script); - int o1_changeCharactersFacing(ScriptState *script); - int o1_copyWSARegion(ScriptState *script); - int o1_printText(ScriptState *script); - int o1_random(ScriptState *script); - int o1_loadSoundFile(ScriptState *script); - int o1_displayWSAFrameOnHidPage(ScriptState *script); - int o1_displayWSASequentialFrames(ScriptState *script); - int o1_drawCharacterStanding(ScriptState *script); - int o1_internalAnimOff(ScriptState *script); - int o1_changeCharactersXAndY(ScriptState *script); - int o1_clearSceneAnimatorBeacon(ScriptState *script); - int o1_querySceneAnimatorBeacon(ScriptState *script); - int o1_refreshSceneAnimator(ScriptState *script); - int o1_placeItemInOffScene(ScriptState *script); - int o1_wipeDownMouseItem(ScriptState *script); - int o1_placeCharacterInOtherScene(ScriptState *script); - int o1_getKey(ScriptState *script); - int o1_specificItemInInventory(ScriptState *script); - int o1_popMobileNPCIntoScene(ScriptState *script); - int o1_mobileCharacterInScene(ScriptState *script); - int o1_hideMobileCharacter(ScriptState *script); - int o1_unhideMobileCharacter(ScriptState *script); - int o1_setCharactersLocation(ScriptState *script); - int o1_walkCharacterToPoint(ScriptState *script); - int o1_specialEventDisplayBrynnsNote(ScriptState *script); - int o1_specialEventRemoveBrynnsNote(ScriptState *script); - int o1_setLogicPage(ScriptState *script); - int o1_fatPrint(ScriptState *script); - int o1_preserveAllObjectBackgrounds(ScriptState *script); - int o1_updateSceneAnimations(ScriptState *script); - int o1_sceneAnimationActive(ScriptState *script); - int o1_setCharactersMovementDelay(ScriptState *script); - int o1_getCharactersFacing(ScriptState *script); - int o1_bkgdScrollSceneAndMasksRight(ScriptState *script); - int o1_dispelMagicAnimation(ScriptState *script); - int o1_findBrightestFireberry(ScriptState *script); - int o1_setFireberryGlowPalette(ScriptState *script); - int o1_setDeathHandlerFlag(ScriptState *script); - int o1_drinkPotionAnimation(ScriptState *script); - int o1_makeAmuletAppear(ScriptState *script); - int o1_drawItemShapeIntoScene(ScriptState *script); - int o1_setCharactersCurrentFrame(ScriptState *script); - int o1_waitForConfirmationMouseClick(ScriptState *script); - int o1_pageFlip(ScriptState *script); - int o1_setSceneFile(ScriptState *script); - int o1_getItemInMarbleVase(ScriptState *script); - int o1_setItemInMarbleVase(ScriptState *script); - int o1_addItemToInventory(ScriptState *script); - int o1_intPrint(ScriptState *script); - int o1_shakeScreen(ScriptState *script); - int o1_createAmuletJewel(ScriptState *script); - int o1_setSceneAnimCurrXY(ScriptState *script); - int o1_poisonBrandonAndRemaps(ScriptState *script); - int o1_fillFlaskWithWater(ScriptState *script); - int o1_getCharactersMovementDelay(ScriptState *script); - int o1_getBirthstoneGem(ScriptState *script); - int o1_queryBrandonStatusBit(ScriptState *script); - int o1_playFluteAnimation(ScriptState *script); - int o1_playWinterScrollSequence(ScriptState *script); - int o1_getIdolGem(ScriptState *script); - int o1_setIdolGem(ScriptState *script); - int o1_totalItemsInScene(ScriptState *script); - int o1_restoreBrandonsMovementDelay(ScriptState *script); - int o1_setMousePos(ScriptState *script); - int o1_getMouseState(ScriptState *script); - int o1_setEntranceMouseCursorTrack(ScriptState *script); - int o1_itemAppearsOnGround(ScriptState *script); - int o1_setNoDrawShapesFlag(ScriptState *script); - int o1_fadeEntirePalette(ScriptState *script); - int o1_itemOnGroundHere(ScriptState *script); - int o1_queryCauldronState(ScriptState *script); - int o1_setCauldronState(ScriptState *script); - int o1_queryCrystalState(ScriptState *script); - int o1_setCrystalState(ScriptState *script); - int o1_setPaletteRange(ScriptState *script); - int o1_shrinkBrandonDown(ScriptState *script); - int o1_growBrandonUp(ScriptState *script); - int o1_setBrandonScaleXAndY(ScriptState *script); - int o1_resetScaleMode(ScriptState *script); - int o1_getScaleDepthTableValue(ScriptState *script); - int o1_setScaleDepthTableValue(ScriptState *script); - int o1_message(ScriptState *script); - int o1_checkClickOnNPC(ScriptState *script); - int o1_getFoyerItem(ScriptState *script); - int o1_setFoyerItem(ScriptState *script); - int o1_setNoItemDropRegion(ScriptState *script); - int o1_walkMalcolmOn(ScriptState *script); - int o1_passiveProtection(ScriptState *script); - int o1_setPlayingLoop(ScriptState *script); - int o1_brandonToStoneSequence(ScriptState *script); - int o1_brandonHealingSequence(ScriptState *script); - int o1_protectCommandLine(ScriptState *script); - int o1_pauseMusicSeconds(ScriptState *script); - int o1_resetMaskRegion(ScriptState *script); - int o1_setPaletteChangeFlag(ScriptState *script); - int o1_fillRect(ScriptState *script); - int o1_dummy(ScriptState *script); - int o1_vocUnload(ScriptState *script); - int o1_vocLoad(ScriptState *script); - protected: virtual int go(); virtual int init(); @@ -668,9 +507,8 @@ protected: int checkForNPCScriptRun(int xpos, int ypos); void runNpcScript(int func); - void setupOpcodeTable(); - const OpcodeProc *_opcodeTable; - int _opcodeTableSize; + virtual void setupOpcodeTable() = 0; + Common::Array<const Opcode*> _opcodes; void loadMouseShapes(); void loadCharacterShapes(); @@ -1076,12 +914,6 @@ protected: static const uint16 _amuletY2[]; }; -class KyraEngine_v1 : public KyraEngine { -public: - KyraEngine_v1(OSystem *system, const GameFlags &flags); - ~KyraEngine_v1(); -}; - } // End of namespace Kyra #endif diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp new file mode 100644 index 0000000000..f0c0c1200d --- /dev/null +++ b/engines/kyra/kyra_v1.cpp @@ -0,0 +1,241 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2004-2007 The ScummVM project + * + * 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$ + * + */ + +#include "kyra/kyra_v1.h" + +namespace Kyra { + +KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags) + : KyraEngine(system, flags) { +} + +KyraEngine_v1::~KyraEngine_v1() { +} + +#define Opcode(x) OpcodeV1(this, &KyraEngine_v1::x) +void KyraEngine_v1::setupOpcodeTable() { + static const OpcodeV1 opcodeTable[] = { + // 0x00 + Opcode(o1_magicInMouseItem), + Opcode(o1_characterSays), + Opcode(o1_pauseTicks), + Opcode(o1_drawSceneAnimShape), + // 0x04 + Opcode(o1_queryGameFlag), + Opcode(o1_setGameFlag), + Opcode(o1_resetGameFlag), + Opcode(o1_runNPCScript), + // 0x08 + Opcode(o1_setSpecialExitList), + Opcode(o1_blockInWalkableRegion), + Opcode(o1_blockOutWalkableRegion), + Opcode(o1_walkPlayerToPoint), + // 0x0c + Opcode(o1_dropItemInScene), + Opcode(o1_drawAnimShapeIntoScene), + Opcode(o1_createMouseItem), + Opcode(o1_savePageToDisk), + // 0x10 + Opcode(o1_sceneAnimOn), + Opcode(o1_sceneAnimOff), + Opcode(o1_getElapsedSeconds), + Opcode(o1_mouseIsPointer), + // 0x14 + Opcode(o1_destroyMouseItem), + Opcode(o1_runSceneAnimUntilDone), + Opcode(o1_fadeSpecialPalette), + Opcode(o1_playAdlibSound), + // 0x18 + Opcode(o1_playAdlibScore), + Opcode(o1_phaseInSameScene), + Opcode(o1_setScenePhasingFlag), + Opcode(o1_resetScenePhasingFlag), + // 0x1c + Opcode(o1_queryScenePhasingFlag), + Opcode(o1_sceneToDirection), + Opcode(o1_setBirthstoneGem), + Opcode(o1_placeItemInGenericMapScene), + // 0x20 + Opcode(o1_setBrandonStatusBit), + Opcode(o1_pauseSeconds), + Opcode(o1_getCharactersLocation), + Opcode(o1_runNPCSubscript), + // 0x24 + Opcode(o1_magicOutMouseItem), + Opcode(o1_internalAnimOn), + Opcode(o1_forceBrandonToNormal), + Opcode(o1_poisonDeathNow), + // 0x28 + Opcode(o1_setScaleMode), + Opcode(o1_openWSAFile), + Opcode(o1_closeWSAFile), + Opcode(o1_runWSAFromBeginningToEnd), + // 0x2c + Opcode(o1_displayWSAFrame), + Opcode(o1_enterNewScene), + Opcode(o1_setSpecialEnterXAndY), + Opcode(o1_runWSAFrames), + // 0x30 + Opcode(o1_popBrandonIntoScene), + Opcode(o1_restoreAllObjectBackgrounds), + Opcode(o1_setCustomPaletteRange), + Opcode(o1_loadPageFromDisk), + // 0x34 + Opcode(o1_customPrintTalkString), + Opcode(o1_restoreCustomPrintBackground), + Opcode(o1_hideMouse), + Opcode(o1_showMouse), + // 0x38 + Opcode(o1_getCharacterX), + Opcode(o1_getCharacterY), + Opcode(o1_changeCharactersFacing), + Opcode(o1_copyWSARegion), + // 0x3c + Opcode(o1_printText), + Opcode(o1_random), + Opcode(o1_loadSoundFile), + Opcode(o1_displayWSAFrameOnHidPage), + // 0x40 + Opcode(o1_displayWSASequentialFrames), + Opcode(o1_drawCharacterStanding), + Opcode(o1_internalAnimOff), + Opcode(o1_changeCharactersXAndY), + // 0x44 + Opcode(o1_clearSceneAnimatorBeacon), + Opcode(o1_querySceneAnimatorBeacon), + Opcode(o1_refreshSceneAnimator), + Opcode(o1_placeItemInOffScene), + // 0x48 + Opcode(o1_wipeDownMouseItem), + Opcode(o1_placeCharacterInOtherScene), + Opcode(o1_getKey), + Opcode(o1_specificItemInInventory), + // 0x4c + Opcode(o1_popMobileNPCIntoScene), + Opcode(o1_mobileCharacterInScene), + Opcode(o1_hideMobileCharacter), + Opcode(o1_unhideMobileCharacter), + // 0x50 + Opcode(o1_setCharactersLocation), + Opcode(o1_walkCharacterToPoint), + Opcode(o1_specialEventDisplayBrynnsNote), + Opcode(o1_specialEventRemoveBrynnsNote), + // 0x54 + Opcode(o1_setLogicPage), + Opcode(o1_fatPrint), + Opcode(o1_preserveAllObjectBackgrounds), + Opcode(o1_updateSceneAnimations), + // 0x58 + Opcode(o1_sceneAnimationActive), + Opcode(o1_setCharactersMovementDelay), + Opcode(o1_getCharactersFacing), + Opcode(o1_bkgdScrollSceneAndMasksRight), + // 0x5c + Opcode(o1_dispelMagicAnimation), + Opcode(o1_findBrightestFireberry), + Opcode(o1_setFireberryGlowPalette), + Opcode(o1_setDeathHandlerFlag), + // 0x60 + Opcode(o1_drinkPotionAnimation), + Opcode(o1_makeAmuletAppear), + Opcode(o1_drawItemShapeIntoScene), + Opcode(o1_setCharactersCurrentFrame), + // 0x64 + Opcode(o1_waitForConfirmationMouseClick), + Opcode(o1_pageFlip), + Opcode(o1_setSceneFile), + Opcode(o1_getItemInMarbleVase), + // 0x68 + Opcode(o1_setItemInMarbleVase), + Opcode(o1_addItemToInventory), + Opcode(o1_intPrint), + Opcode(o1_shakeScreen), + // 0x6c + Opcode(o1_createAmuletJewel), + Opcode(o1_setSceneAnimCurrXY), + Opcode(o1_poisonBrandonAndRemaps), + Opcode(o1_fillFlaskWithWater), + // 0x70 + Opcode(o1_getCharactersMovementDelay), + Opcode(o1_getBirthstoneGem), + Opcode(o1_queryBrandonStatusBit), + Opcode(o1_playFluteAnimation), + // 0x74 + Opcode(o1_playWinterScrollSequence), + Opcode(o1_getIdolGem), + Opcode(o1_setIdolGem), + Opcode(o1_totalItemsInScene), + // 0x78 + Opcode(o1_restoreBrandonsMovementDelay), + Opcode(o1_setMousePos), + Opcode(o1_getMouseState), + Opcode(o1_setEntranceMouseCursorTrack), + // 0x7c + Opcode(o1_itemAppearsOnGround), + Opcode(o1_setNoDrawShapesFlag), + Opcode(o1_fadeEntirePalette), + Opcode(o1_itemOnGroundHere), + // 0x80 + Opcode(o1_queryCauldronState), + Opcode(o1_setCauldronState), + Opcode(o1_queryCrystalState), + Opcode(o1_setCrystalState), + // 0x84 + Opcode(o1_setPaletteRange), + Opcode(o1_shrinkBrandonDown), + Opcode(o1_growBrandonUp), + Opcode(o1_setBrandonScaleXAndY), + // 0x88 + Opcode(o1_resetScaleMode), + Opcode(o1_getScaleDepthTableValue), + Opcode(o1_setScaleDepthTableValue), + Opcode(o1_message), + // 0x8c + Opcode(o1_checkClickOnNPC), + Opcode(o1_getFoyerItem), + Opcode(o1_setFoyerItem), + Opcode(o1_setNoItemDropRegion), + // 0x90 + Opcode(o1_walkMalcolmOn), + Opcode(o1_passiveProtection), + Opcode(o1_setPlayingLoop), + Opcode(o1_brandonToStoneSequence), + // 0x94 + Opcode(o1_brandonHealingSequence), + Opcode(o1_protectCommandLine), + Opcode(o1_pauseMusicSeconds), + Opcode(o1_resetMaskRegion), + // 0x98 + Opcode(o1_setPaletteChangeFlag), + Opcode(o1_fillRect), + Opcode(o1_vocUnload), + Opcode(o1_vocLoad), + Opcode(o1_dummy) + }; + + for (int i = 0; i < ARRAYSIZE(opcodeTable); ++i) + _opcodes.push_back(&opcodeTable[i]); +} +#undef Opcode + +} // end of namespace Kyra + diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h new file mode 100644 index 0000000000..1bf18298e9 --- /dev/null +++ b/engines/kyra/kyra_v1.h @@ -0,0 +1,203 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2004-2007 The ScummVM project + * + * 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 KYRA_KYRA_V1_H +#define KYRA_KYRA_V1_H + +#include "kyra.h" +#include "script.h" + +namespace Kyra { + +class KyraEngine_v1 : public KyraEngine { +public: + KyraEngine_v1(OSystem *system, const GameFlags &flags); + ~KyraEngine_v1(); + +protected: + typedef OpcodeImpl<KyraEngine_v1> OpcodeV1; + void setupOpcodeTable(); + + // Opcodes + int o1_magicInMouseItem(ScriptState *script); + int o1_characterSays(ScriptState *script); + int o1_pauseTicks(ScriptState *script); + int o1_drawSceneAnimShape(ScriptState *script); + int o1_queryGameFlag(ScriptState *script); + int o1_setGameFlag(ScriptState *script); + int o1_resetGameFlag(ScriptState *script); + int o1_runNPCScript(ScriptState *script); + int o1_setSpecialExitList(ScriptState *script); + int o1_blockInWalkableRegion(ScriptState *script); + int o1_blockOutWalkableRegion(ScriptState *script); + int o1_walkPlayerToPoint(ScriptState *script); + int o1_dropItemInScene(ScriptState *script); + int o1_drawAnimShapeIntoScene(ScriptState *script); + int o1_createMouseItem(ScriptState *script); + int o1_savePageToDisk(ScriptState *script); + int o1_sceneAnimOn(ScriptState *script); + int o1_sceneAnimOff(ScriptState *script); + int o1_getElapsedSeconds(ScriptState *script); + int o1_mouseIsPointer(ScriptState *script); + int o1_destroyMouseItem(ScriptState *script); + int o1_runSceneAnimUntilDone(ScriptState *script); + int o1_fadeSpecialPalette(ScriptState *script); + int o1_playAdlibSound(ScriptState *script); + int o1_playAdlibScore(ScriptState *script); + int o1_phaseInSameScene(ScriptState *script); + int o1_setScenePhasingFlag(ScriptState *script); + int o1_resetScenePhasingFlag(ScriptState *script); + int o1_queryScenePhasingFlag(ScriptState *script); + int o1_sceneToDirection(ScriptState *script); + int o1_setBirthstoneGem(ScriptState *script); + int o1_placeItemInGenericMapScene(ScriptState *script); + int o1_setBrandonStatusBit(ScriptState *script); + int o1_pauseSeconds(ScriptState *script); + int o1_getCharactersLocation(ScriptState *script); + int o1_runNPCSubscript(ScriptState *script); + int o1_magicOutMouseItem(ScriptState *script); + int o1_internalAnimOn(ScriptState *script); + int o1_forceBrandonToNormal(ScriptState *script); + int o1_poisonDeathNow(ScriptState *script); + int o1_setScaleMode(ScriptState *script); + int o1_openWSAFile(ScriptState *script); + int o1_closeWSAFile(ScriptState *script); + int o1_runWSAFromBeginningToEnd(ScriptState *script); + int o1_displayWSAFrame(ScriptState *script); + int o1_enterNewScene(ScriptState *script); + int o1_setSpecialEnterXAndY(ScriptState *script); + int o1_runWSAFrames(ScriptState *script); + int o1_popBrandonIntoScene(ScriptState *script); + int o1_restoreAllObjectBackgrounds(ScriptState *script); + int o1_setCustomPaletteRange(ScriptState *script); + int o1_loadPageFromDisk(ScriptState *script); + int o1_customPrintTalkString(ScriptState *script); + int o1_restoreCustomPrintBackground(ScriptState *script); + int o1_hideMouse(ScriptState *script); + int o1_showMouse(ScriptState *script); + int o1_getCharacterX(ScriptState *script); + int o1_getCharacterY(ScriptState *script); + int o1_changeCharactersFacing(ScriptState *script); + int o1_copyWSARegion(ScriptState *script); + int o1_printText(ScriptState *script); + int o1_random(ScriptState *script); + int o1_loadSoundFile(ScriptState *script); + int o1_displayWSAFrameOnHidPage(ScriptState *script); + int o1_displayWSASequentialFrames(ScriptState *script); + int o1_drawCharacterStanding(ScriptState *script); + int o1_internalAnimOff(ScriptState *script); + int o1_changeCharactersXAndY(ScriptState *script); + int o1_clearSceneAnimatorBeacon(ScriptState *script); + int o1_querySceneAnimatorBeacon(ScriptState *script); + int o1_refreshSceneAnimator(ScriptState *script); + int o1_placeItemInOffScene(ScriptState *script); + int o1_wipeDownMouseItem(ScriptState *script); + int o1_placeCharacterInOtherScene(ScriptState *script); + int o1_getKey(ScriptState *script); + int o1_specificItemInInventory(ScriptState *script); + int o1_popMobileNPCIntoScene(ScriptState *script); + int o1_mobileCharacterInScene(ScriptState *script); + int o1_hideMobileCharacter(ScriptState *script); + int o1_unhideMobileCharacter(ScriptState *script); + int o1_setCharactersLocation(ScriptState *script); + int o1_walkCharacterToPoint(ScriptState *script); + int o1_specialEventDisplayBrynnsNote(ScriptState *script); + int o1_specialEventRemoveBrynnsNote(ScriptState *script); + int o1_setLogicPage(ScriptState *script); + int o1_fatPrint(ScriptState *script); + int o1_preserveAllObjectBackgrounds(ScriptState *script); + int o1_updateSceneAnimations(ScriptState *script); + int o1_sceneAnimationActive(ScriptState *script); + int o1_setCharactersMovementDelay(ScriptState *script); + int o1_getCharactersFacing(ScriptState *script); + int o1_bkgdScrollSceneAndMasksRight(ScriptState *script); + int o1_dispelMagicAnimation(ScriptState *script); + int o1_findBrightestFireberry(ScriptState *script); + int o1_setFireberryGlowPalette(ScriptState *script); + int o1_setDeathHandlerFlag(ScriptState *script); + int o1_drinkPotionAnimation(ScriptState *script); + int o1_makeAmuletAppear(ScriptState *script); + int o1_drawItemShapeIntoScene(ScriptState *script); + int o1_setCharactersCurrentFrame(ScriptState *script); + int o1_waitForConfirmationMouseClick(ScriptState *script); + int o1_pageFlip(ScriptState *script); + int o1_setSceneFile(ScriptState *script); + int o1_getItemInMarbleVase(ScriptState *script); + int o1_setItemInMarbleVase(ScriptState *script); + int o1_addItemToInventory(ScriptState *script); + int o1_intPrint(ScriptState *script); + int o1_shakeScreen(ScriptState *script); + int o1_createAmuletJewel(ScriptState *script); + int o1_setSceneAnimCurrXY(ScriptState *script); + int o1_poisonBrandonAndRemaps(ScriptState *script); + int o1_fillFlaskWithWater(ScriptState *script); + int o1_getCharactersMovementDelay(ScriptState *script); + int o1_getBirthstoneGem(ScriptState *script); + int o1_queryBrandonStatusBit(ScriptState *script); + int o1_playFluteAnimation(ScriptState *script); + int o1_playWinterScrollSequence(ScriptState *script); + int o1_getIdolGem(ScriptState *script); + int o1_setIdolGem(ScriptState *script); + int o1_totalItemsInScene(ScriptState *script); + int o1_restoreBrandonsMovementDelay(ScriptState *script); + int o1_setMousePos(ScriptState *script); + int o1_getMouseState(ScriptState *script); + int o1_setEntranceMouseCursorTrack(ScriptState *script); + int o1_itemAppearsOnGround(ScriptState *script); + int o1_setNoDrawShapesFlag(ScriptState *script); + int o1_fadeEntirePalette(ScriptState *script); + int o1_itemOnGroundHere(ScriptState *script); + int o1_queryCauldronState(ScriptState *script); + int o1_setCauldronState(ScriptState *script); + int o1_queryCrystalState(ScriptState *script); + int o1_setCrystalState(ScriptState *script); + int o1_setPaletteRange(ScriptState *script); + int o1_shrinkBrandonDown(ScriptState *script); + int o1_growBrandonUp(ScriptState *script); + int o1_setBrandonScaleXAndY(ScriptState *script); + int o1_resetScaleMode(ScriptState *script); + int o1_getScaleDepthTableValue(ScriptState *script); + int o1_setScaleDepthTableValue(ScriptState *script); + int o1_message(ScriptState *script); + int o1_checkClickOnNPC(ScriptState *script); + int o1_getFoyerItem(ScriptState *script); + int o1_setFoyerItem(ScriptState *script); + int o1_setNoItemDropRegion(ScriptState *script); + int o1_walkMalcolmOn(ScriptState *script); + int o1_passiveProtection(ScriptState *script); + int o1_setPlayingLoop(ScriptState *script); + int o1_brandonToStoneSequence(ScriptState *script); + int o1_brandonHealingSequence(ScriptState *script); + int o1_protectCommandLine(ScriptState *script); + int o1_pauseMusicSeconds(ScriptState *script); + int o1_resetMaskRegion(ScriptState *script); + int o1_setPaletteChangeFlag(ScriptState *script); + int o1_fillRect(ScriptState *script); + int o1_dummy(ScriptState *script); + int o1_vocUnload(ScriptState *script); + int o1_vocLoad(ScriptState *script); +}; + +} // end of namespace Kyra + +#endif + diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 18da31c4a7..65c9f32c1b 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -81,6 +81,8 @@ public: int go(); private: + void setupOpcodeTable() {} + void seq_playSequences(int startSeq, int endSeq = -1); int seq_introWestwood(int seqNum); int seq_introTitle(int seqNum); @@ -115,7 +117,6 @@ private: static const int _introStringsSize; int _introStringsDuration[21]; - }; } // end of namespace Kyra diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h index 13cc91211b..009788a5f6 100644 --- a/engines/kyra/kyra_v3.h +++ b/engines/kyra/kyra_v3.h @@ -48,6 +48,8 @@ private: void preinit(); void realInit(); + void setupOpcodeTable() {} + SoundDigital *_soundDigital; // sound specific diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk index f0be5f6934..8303028b27 100644 --- a/engines/kyra/module.mk +++ b/engines/kyra/module.mk @@ -7,6 +7,7 @@ MODULE_OBJS := \ gui.o \ items.o \ kyra.o \ + kyra_v1.o \ kyra_v2.o \ kyra_v3.o \ resource.o \ diff --git a/engines/kyra/scene.cpp b/engines/kyra/scene.cpp index 19330a782c..1cba2e3e68 100644 --- a/engines/kyra/scene.cpp +++ b/engines/kyra/scene.cpp @@ -445,7 +445,7 @@ void KyraEngine::startSceneScript(int brandonAlive) { strcpy(fileNameBuffer, _roomFilenameTable[tableId]); strcat(fileNameBuffer, ".EMC"); _scriptInterpreter->unloadScript(_scriptClickData); - _scriptInterpreter->loadScript(fileNameBuffer, _scriptClickData); + _scriptInterpreter->loadScript(fileNameBuffer, _scriptClickData, &_opcodes); _scriptInterpreter->startScript(_scriptClick, 0); _scriptClick->variables[0] = _currentCharacter->sceneId; _scriptClick->variables[7] = brandonAlive; diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp index 762288a8e0..2f7973f5a2 100644 --- a/engines/kyra/script.cpp +++ b/engines/kyra/script.cpp @@ -68,7 +68,7 @@ ScriptHelper::ScriptHelper(KyraEngine *vm) : _vm(vm) { #undef COMMAND } -bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData) { +bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, const Common::Array<const Opcode*> *opcodes) { uint32 size = 0; uint8 *data = _vm->resource()->fileData(filename, &size); const byte *curData = data; @@ -134,6 +134,8 @@ bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData) { while (chunkSize--) scriptData->data[chunkSize] = READ_BE_UINT16(&scriptData->data[chunkSize]); + + scriptData->opcodes = opcodes; delete [] data; return true; @@ -375,7 +377,17 @@ void ScriptHelper::c1_subSP(ScriptState* script) { } void ScriptHelper::c1_execOpcode(ScriptState* script) { - script->retValue = _vm->runOpcode(script, (uint8)_parameter); + uint8 opcode = _parameter; + + assert(script->dataPtr->opcodes); + assert(opcode < script->dataPtr->opcodes->size()); + + if ((*script->dataPtr->opcodes)[opcode]) { + script->retValue = (*(*script->dataPtr->opcodes)[opcode])(script); + } else { + script->retValue = 0; + warning("calling unimplemented opcode(0x%.02X)", opcode); + } } void ScriptHelper::c1_ifNotJmp(ScriptState* script) { diff --git a/engines/kyra/script.h b/engines/kyra/script.h index 67a57e7590..67aef8361c 100644 --- a/engines/kyra/script.h +++ b/engines/kyra/script.h @@ -26,13 +26,39 @@ #include "kyra/kyra.h" namespace Kyra { + +struct ScriptState; + +struct Opcode { + virtual ~Opcode() {} + + virtual operator bool() const = 0; + + virtual int operator()(ScriptState*) const = 0; +}; + +template<class T> +struct OpcodeImpl : public Opcode { + T *vm; + typedef int (T::*Callback)(ScriptState*); + Callback callback; + + OpcodeImpl(T *v, Callback c) : Opcode(), vm(v), callback(c) {} + + operator bool() const { return callback != 0; } + + int operator()(ScriptState *state) const { + return (vm->*callback)(state); + } +}; + struct ScriptData { byte *text; uint16 *data; uint16 *ordr; uint16 dataSize; - - int opcodeTable; // indicates which opcode table to use (for Kyra3 and Kyra2) + + const Common::Array<const Opcode*> *opcodes; }; struct ScriptState { @@ -49,7 +75,7 @@ class ScriptHelper { public: ScriptHelper(KyraEngine *vm); - bool loadScript(const char *filename, ScriptData *data); + bool loadScript(const char *filename, ScriptData *data, const Common::Array<const Opcode*> *opcodes); void unloadScript(ScriptData *data); void initScript(ScriptState *scriptState, const ScriptData *data); diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp index 987d05db21..00ad96b3f6 100644 --- a/engines/kyra/script_v1.cpp +++ b/engines/kyra/script_v1.cpp @@ -22,7 +22,7 @@ #include "common/stdafx.h" #include "common/endian.h" -#include "kyra/kyra.h" +#include "kyra/kyra_v1.h" #include "kyra/script.h" #include "kyra/screen.h" #include "kyra/sprites.h" @@ -35,13 +35,13 @@ namespace Kyra { #define stackPos(x) script->stack[script->sp+x] #define stackPosString(x) (const char*)&script->dataPtr->text[READ_BE_UINT16(&((uint16 *)script->dataPtr->text)[stackPos(x)])] -int KyraEngine::o1_magicInMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_magicInMouseItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_magicInMouseItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); magicInMouseItem(stackPos(0), stackPos(1), -1); return 0; } -int KyraEngine::o1_characterSays(ScriptState *script) { +int KyraEngine_v1::o1_characterSays(ScriptState *script) { _skipFlag = false; if (_flags.isTalkie) { debugC(3, kDebugLevelScriptFuncs, "o1_characterSays(%p) (%d, '%s', %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3)); @@ -72,7 +72,7 @@ int KyraEngine::o1_characterSays(ScriptState *script) { return 0; } -int KyraEngine::o1_pauseTicks(ScriptState *script) { +int KyraEngine_v1::o1_pauseTicks(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_pauseTicks(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); if (stackPos(1)) { warning("STUB: special o1_pauseTicks"); @@ -84,33 +84,33 @@ int KyraEngine::o1_pauseTicks(ScriptState *script) { return 0; } -int KyraEngine::o1_drawSceneAnimShape(ScriptState *script) { +int KyraEngine_v1::o1_drawSceneAnimShape(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_drawSceneAnimShape(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); _screen->drawShape(stackPos(4), _sprites->_sceneShapes[stackPos(0)], stackPos(1), stackPos(2), 0, (stackPos(3) != 0) ? 1 : 0); return 0; } -int KyraEngine::o1_queryGameFlag(ScriptState *script) { +int KyraEngine_v1::o1_queryGameFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_queryGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); return queryGameFlag(stackPos(0)); } -int KyraEngine::o1_setGameFlag(ScriptState *script) { +int KyraEngine_v1::o1_setGameFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); return setGameFlag(stackPos(0)); } -int KyraEngine::o1_resetGameFlag(ScriptState *script) { +int KyraEngine_v1::o1_resetGameFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_resetGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); return resetGameFlag(stackPos(0)); } -int KyraEngine::o1_runNPCScript(ScriptState *script) { +int KyraEngine_v1::o1_runNPCScript(ScriptState *script) { warning("STUB: o1_runNPCScript"); return 0; } -int KyraEngine::o1_setSpecialExitList(ScriptState *script) { +int KyraEngine_v1::o1_setSpecialExitList(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setSpecialExitList(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9)); for (int i = 0; i < 10; ++i) @@ -120,19 +120,19 @@ int KyraEngine::o1_setSpecialExitList(ScriptState *script) { return 0; } -int KyraEngine::o1_blockInWalkableRegion(ScriptState *script) { +int KyraEngine_v1::o1_blockInWalkableRegion(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_blockInWalkableRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); _screen->blockInRegion(stackPos(0), stackPos(1), stackPos(2)-stackPos(0)+1, stackPos(3)-stackPos(1)+1); return 0; } -int KyraEngine::o1_blockOutWalkableRegion(ScriptState *script) { +int KyraEngine_v1::o1_blockOutWalkableRegion(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_blockOutWalkableRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); _screen->blockOutRegion(stackPos(0), stackPos(1), stackPos(2)-stackPos(0)+1, stackPos(3)-stackPos(1)+1); return 0; } -int KyraEngine::o1_walkPlayerToPoint(ScriptState *script) { +int KyraEngine_v1::o1_walkPlayerToPoint(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_walkPlayerToPoint(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int normalTimers = stackPos(2); @@ -160,7 +160,7 @@ int KyraEngine::o1_walkPlayerToPoint(ScriptState *script) { return 0; } -int KyraEngine::o1_dropItemInScene(ScriptState *script) { +int KyraEngine_v1::o1_dropItemInScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_dropItemInScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); int item = stackPos(0); int xpos = stackPos(1); @@ -185,7 +185,7 @@ int KyraEngine::o1_dropItemInScene(ScriptState *script) { return 0; } -int KyraEngine::o1_drawAnimShapeIntoScene(ScriptState *script) { +int KyraEngine_v1::o1_drawAnimShapeIntoScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_drawAnimShapeIntoScene(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); _screen->hideMouse(); _animator->restoreAllObjectBackgrounds(); @@ -203,49 +203,49 @@ int KyraEngine::o1_drawAnimShapeIntoScene(ScriptState *script) { return 0; } -int KyraEngine::o1_createMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_createMouseItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_createMouseItem(%p) (%d)", (const void *)script, stackPos(0)); createMouseItem(stackPos(0)); return 0; } -int KyraEngine::o1_savePageToDisk(ScriptState *script) { +int KyraEngine_v1::o1_savePageToDisk(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_savePageToDisk(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); _screen->savePageToDisk(stackPosString(0), stackPos(1)); return 0; } -int KyraEngine::o1_sceneAnimOn(ScriptState *script) { +int KyraEngine_v1::o1_sceneAnimOn(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_sceneAnimOn(%p) (%d)", (const void *)script, stackPos(0)); _sprites->_anims[stackPos(0)].play = true; return 0; } -int KyraEngine::o1_sceneAnimOff(ScriptState *script) { +int KyraEngine_v1::o1_sceneAnimOff(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_sceneAnimOff(%p) (%d)", (const void *)script, stackPos(0)); _sprites->_anims[stackPos(0)].play = false; return 0; } -int KyraEngine::o1_getElapsedSeconds(ScriptState *script) { +int KyraEngine_v1::o1_getElapsedSeconds(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getElapsedSeconds(%p) ()", (const void *)script); return _system->getMillis() / 1000; } -int KyraEngine::o1_mouseIsPointer(ScriptState *script) { +int KyraEngine_v1::o1_mouseIsPointer(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_mouseIsPointer(%p) ()", (const void *)script); if (_itemInHand == -1) return 1; return 0; } -int KyraEngine::o1_destroyMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_destroyMouseItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_destroyMouseItem(%p) ()", (const void *)script); destroyMouseItem(); return 0; } -int KyraEngine::o1_runSceneAnimUntilDone(ScriptState *script) { +int KyraEngine_v1::o1_runSceneAnimUntilDone(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_runSceneAnimUntilDone(%p) (%d)", (const void *)script, stackPos(0)); _screen->hideMouse(); _animator->restoreAllObjectBackgrounds(); @@ -263,7 +263,7 @@ int KyraEngine::o1_runSceneAnimUntilDone(ScriptState *script) { return 0; } -int KyraEngine::o1_fadeSpecialPalette(ScriptState *script) { +int KyraEngine_v1::o1_fadeSpecialPalette(ScriptState *script) { if (_flags.platform == Common::kPlatformAmiga) { debugC(3, kDebugLevelScriptFuncs, "o1_fadeSpecialPalette(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); if (_currentCharacter->sceneId != 45) { @@ -281,42 +281,42 @@ int KyraEngine::o1_fadeSpecialPalette(ScriptState *script) { return 0; } -int KyraEngine::o1_playAdlibSound(ScriptState *script) { +int KyraEngine_v1::o1_playAdlibSound(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_playAdlibSound(%p) (%d)", (const void *)script, stackPos(0)); snd_playSoundEffect(stackPos(0)); return 0; } -int KyraEngine::o1_playAdlibScore(ScriptState *script) { +int KyraEngine_v1::o1_playAdlibScore(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_playAdlibScore(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); snd_playWanderScoreViaMap(stackPos(0), stackPos(1)); return 0; } -int KyraEngine::o1_phaseInSameScene(ScriptState *script) { +int KyraEngine_v1::o1_phaseInSameScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_phaseInSameScene(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); transcendScenes(stackPos(0), stackPos(1)); return 0; } -int KyraEngine::o1_setScenePhasingFlag(ScriptState *script) { +int KyraEngine_v1::o1_setScenePhasingFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setScenePhasingFlag(%p) ()", (const void *)script); _scenePhasingFlag = 1; return 1; } -int KyraEngine::o1_resetScenePhasingFlag(ScriptState *script) { +int KyraEngine_v1::o1_resetScenePhasingFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_resetScenePhasingFlag(%p) ()", (const void *)script); _scenePhasingFlag = 0; return 0; } -int KyraEngine::o1_queryScenePhasingFlag(ScriptState *script) { +int KyraEngine_v1::o1_queryScenePhasingFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_queryScenePhasingFlag(%p) ()", (const void *)script); return _scenePhasingFlag; } -int KyraEngine::o1_sceneToDirection(ScriptState *script) { +int KyraEngine_v1::o1_sceneToDirection(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_sceneToDirection(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < _roomTableSize); Room *curRoom = &_roomTable[stackPos(0)]; @@ -346,7 +346,7 @@ int KyraEngine::o1_sceneToDirection(ScriptState *script) { return returnValue; } -int KyraEngine::o1_setBirthstoneGem(ScriptState *script) { +int KyraEngine_v1::o1_setBirthstoneGem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setBirthstoneGem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int index = stackPos(0); if (index < 4 && index >= 0) { @@ -356,19 +356,19 @@ int KyraEngine::o1_setBirthstoneGem(ScriptState *script) { return 0; } -int KyraEngine::o1_placeItemInGenericMapScene(ScriptState *script) { +int KyraEngine_v1::o1_placeItemInGenericMapScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_placeItemInGenericMapScene(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); placeItemInGenericMapScene(stackPos(0), stackPos(1)); return 0; } -int KyraEngine::o1_setBrandonStatusBit(ScriptState *script) { +int KyraEngine_v1::o1_setBrandonStatusBit(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setBrandonStatusBit(%p) (%d)", (const void *)script, stackPos(0)); _brandonStatusBit |= stackPos(0); return 0; } -int KyraEngine::o1_pauseSeconds(ScriptState *script) { +int KyraEngine_v1::o1_pauseSeconds(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_pauseSeconds(%p) (%d)", (const void *)script, stackPos(0)); if (stackPos(0) > 0 && !_skipFlag) delay(stackPos(0)*1000, true); @@ -376,41 +376,41 @@ int KyraEngine::o1_pauseSeconds(ScriptState *script) { return 0; } -int KyraEngine::o1_getCharactersLocation(ScriptState *script) { +int KyraEngine_v1::o1_getCharactersLocation(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getCharactersLocation(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].sceneId; } -int KyraEngine::o1_runNPCSubscript(ScriptState *script) { +int KyraEngine_v1::o1_runNPCSubscript(ScriptState *script) { warning("STUB: o1_runNPCSubscript"); return 0; } -int KyraEngine::o1_magicOutMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_magicOutMouseItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_magicOutMouseItem(%p) (%d)", (const void *)script, stackPos(0)); magicOutMouseItem(stackPos(0), -1); return 0; } -int KyraEngine::o1_internalAnimOn(ScriptState *script) { +int KyraEngine_v1::o1_internalAnimOn(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_internalAnimOn(%p) (%d)", (const void *)script, stackPos(0)); _animator->sprites()[stackPos(0)].active = 1; return 0; } -int KyraEngine::o1_forceBrandonToNormal(ScriptState *script) { +int KyraEngine_v1::o1_forceBrandonToNormal(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_forceBrandonToNormal(%p) ()", (const void *)script); checkAmuletAnimFlags(); return 0; } -int KyraEngine::o1_poisonDeathNow(ScriptState *script) { +int KyraEngine_v1::o1_poisonDeathNow(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_poisonDeathNow(%p) ()", (const void *)script); seq_poisonDeathNow(1); return 0; } -int KyraEngine::o1_setScaleMode(ScriptState *script) { +int KyraEngine_v1::o1_setScaleMode(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setScaleMode(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int len = stackPos(0); int setValue1 = stackPos(1); @@ -428,7 +428,7 @@ int KyraEngine::o1_setScaleMode(ScriptState *script) { return _scaleMode; } -int KyraEngine::o1_openWSAFile(ScriptState *script) { +int KyraEngine_v1::o1_openWSAFile(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_openWSAFile(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3)); const char *filename = stackPosString(0); @@ -440,7 +440,7 @@ int KyraEngine::o1_openWSAFile(ScriptState *script) { return 0; } -int KyraEngine::o1_closeWSAFile(ScriptState *script) { +int KyraEngine_v1::o1_closeWSAFile(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_closeWSAFile(%p) (%d)", (const void *)script, stackPos(0)); int wsaIndex = stackPos(0); @@ -450,7 +450,7 @@ int KyraEngine::o1_closeWSAFile(ScriptState *script) { return 0; } -int KyraEngine::o1_runWSAFromBeginningToEnd(ScriptState *script) { +int KyraEngine_v1::o1_runWSAFromBeginningToEnd(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_runWSAFromBeginningToEnd(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); _screen->hideMouse(); @@ -491,7 +491,7 @@ int KyraEngine::o1_runWSAFromBeginningToEnd(ScriptState *script) { return 0; } -int KyraEngine::o1_displayWSAFrame(ScriptState *script) { +int KyraEngine_v1::o1_displayWSAFrame(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_displayWSAFrame(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); int frame = stackPos(0); int xpos = stackPos(1); @@ -518,13 +518,13 @@ int KyraEngine::o1_displayWSAFrame(ScriptState *script) { return 0; } -int KyraEngine::o1_enterNewScene(ScriptState *script) { +int KyraEngine_v1::o1_enterNewScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_enterNewScene(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); enterNewScene(stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); return 0; } -int KyraEngine::o1_setSpecialEnterXAndY(ScriptState *script) { +int KyraEngine_v1::o1_setSpecialEnterXAndY(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setSpecialEnterXAndY(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _brandonPosX = stackPos(0); _brandonPosY = stackPos(1); @@ -533,7 +533,7 @@ int KyraEngine::o1_setSpecialEnterXAndY(ScriptState *script) { return 0; } -int KyraEngine::o1_runWSAFrames(ScriptState *script) { +int KyraEngine_v1::o1_runWSAFrames(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_runWSAFrames(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); int xpos = stackPos(0); int ypos = stackPos(1); @@ -560,7 +560,7 @@ int KyraEngine::o1_runWSAFrames(ScriptState *script) { return 0; } -int KyraEngine::o1_popBrandonIntoScene(ScriptState *script) { +int KyraEngine_v1::o1_popBrandonIntoScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_popBrandonIntoScene(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int changeScaleMode = stackPos(3); int xpos = (int16)(stackPos(0) & 0xFFFC); @@ -609,7 +609,7 @@ int KyraEngine::o1_popBrandonIntoScene(ScriptState *script) { return 0; } -int KyraEngine::o1_restoreAllObjectBackgrounds(ScriptState *script) { +int KyraEngine_v1::o1_restoreAllObjectBackgrounds(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_restoreAllObjectBackgrounds(%p) (%d)", (const void *)script, stackPos(0)); int disable = stackPos(0); int activeBackup = 0; @@ -623,20 +623,20 @@ int KyraEngine::o1_restoreAllObjectBackgrounds(ScriptState *script) { return 0; } -int KyraEngine::o1_setCustomPaletteRange(ScriptState *script) { +int KyraEngine_v1::o1_setCustomPaletteRange(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setCustomPaletteRange(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); memcpy(_screen->getPalette(1) + stackPos(1)*3, _specialPalettes[stackPos(0)], stackPos(2)*3); return 0; } -int KyraEngine::o1_loadPageFromDisk(ScriptState *script) { +int KyraEngine_v1::o1_loadPageFromDisk(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_loadPageFromDisk(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); _screen->loadPageFromDisk(stackPosString(0), stackPos(1)); _animator->_updateScreen = true; return 0; } -int KyraEngine::o1_customPrintTalkString(ScriptState *script) { +int KyraEngine_v1::o1_customPrintTalkString(ScriptState *script) { if (_flags.isTalkie) { debugC(3, kDebugLevelScriptFuncs, "o1_customPrintTalkString(%p) (%d, '%s', %d, %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4) & 0xFF); @@ -656,7 +656,7 @@ int KyraEngine::o1_customPrintTalkString(ScriptState *script) { return 0; } -int KyraEngine::o1_restoreCustomPrintBackground(ScriptState *script) { +int KyraEngine_v1::o1_restoreCustomPrintBackground(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_restoreCustomPrintBackground(%p) ()", (const void *)script); snd_voiceWaitForFinish(); snd_stopVoice(); @@ -664,29 +664,29 @@ int KyraEngine::o1_restoreCustomPrintBackground(ScriptState *script) { return 0; } -int KyraEngine::o1_hideMouse(ScriptState *script) { +int KyraEngine_v1::o1_hideMouse(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_hideMouse(%p) ()", (const void *)script); _screen->hideMouse(); return 0; } -int KyraEngine::o1_showMouse(ScriptState *script) { +int KyraEngine_v1::o1_showMouse(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_showMouse(%p) ()", (const void *)script); _screen->showMouse(); return 0; } -int KyraEngine::o1_getCharacterX(ScriptState *script) { +int KyraEngine_v1::o1_getCharacterX(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getCharacterX(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].x1; } -int KyraEngine::o1_getCharacterY(ScriptState *script) { +int KyraEngine_v1::o1_getCharacterY(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getCharacterY(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].y1; } -int KyraEngine::o1_changeCharactersFacing(ScriptState *script) { +int KyraEngine_v1::o1_changeCharactersFacing(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_changeCharactersFacing(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); int character = stackPos(0); int facing = stackPos(1); @@ -704,7 +704,7 @@ int KyraEngine::o1_changeCharactersFacing(ScriptState *script) { return 0; } -int KyraEngine::o1_copyWSARegion(ScriptState *script) { +int KyraEngine_v1::o1_copyWSARegion(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_copyWSARegion(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); int xpos = stackPos(0); int ypos = stackPos(1); @@ -717,7 +717,7 @@ int KyraEngine::o1_copyWSARegion(ScriptState *script) { return 0; } -int KyraEngine::o1_printText(ScriptState *script) { +int KyraEngine_v1::o1_printText(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_printText(%p) ('%s', %d, %d, 0x%X, 0x%X)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); if (_flags.lang == Common::JA_JPN && stackPos(3) == 7) _screen->printText(stackPosString(0), stackPos(1), stackPos(2), 0, 0x80); @@ -727,18 +727,18 @@ int KyraEngine::o1_printText(ScriptState *script) { return 0; } -int KyraEngine::o1_random(ScriptState *script) { +int KyraEngine_v1::o1_random(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_random(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < stackPos(1)); return _rnd.getRandomNumberRng(stackPos(0), stackPos(1)); } -int KyraEngine::o1_loadSoundFile(ScriptState *script) { +int KyraEngine_v1::o1_loadSoundFile(ScriptState *script) { warning("STUB: o1_loadSoundFile"); return 0; } -int KyraEngine::o1_displayWSAFrameOnHidPage(ScriptState *script) { +int KyraEngine_v1::o1_displayWSAFrameOnHidPage(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_displayWSAFrameOnHidPage(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); int frame = stackPos(0); int xpos = stackPos(1); @@ -767,7 +767,7 @@ int KyraEngine::o1_displayWSAFrameOnHidPage(ScriptState *script) { return 0; } -int KyraEngine::o1_displayWSASequentialFrames(ScriptState *script) { +int KyraEngine_v1::o1_displayWSASequentialFrames(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_displayWSASequentialFrames(%p) (%d, %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6)); int startFrame = stackPos(0); int endFrame = stackPos(1); @@ -843,7 +843,7 @@ int KyraEngine::o1_displayWSASequentialFrames(ScriptState *script) { return 0; } -int KyraEngine::o1_drawCharacterStanding(ScriptState *script) { +int KyraEngine_v1::o1_drawCharacterStanding(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_drawCharacterStanding(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int character = stackPos(0); int animFrame = stackPos(1); @@ -858,13 +858,13 @@ int KyraEngine::o1_drawCharacterStanding(ScriptState *script) { return 0; } -int KyraEngine::o1_internalAnimOff(ScriptState *script) { +int KyraEngine_v1::o1_internalAnimOff(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_internalAnimOff(%p) (%d)", (const void *)script, stackPos(0)); _animator->sprites()[stackPos(0)].active = 0; return 0; } -int KyraEngine::o1_changeCharactersXAndY(ScriptState *script) { +int KyraEngine_v1::o1_changeCharactersXAndY(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_changeCharactersXAndY(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); Character *ch = &_characterList[stackPos(0)]; int16 x = stackPos(1); @@ -880,25 +880,25 @@ int KyraEngine::o1_changeCharactersXAndY(ScriptState *script) { return 0; } -int KyraEngine::o1_clearSceneAnimatorBeacon(ScriptState *script) { +int KyraEngine_v1::o1_clearSceneAnimatorBeacon(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_clearSceneAnimatorBeacon(%p) ()", (const void *)script); _sprites->_sceneAnimatorBeaconFlag = 0; return 0; } -int KyraEngine::o1_querySceneAnimatorBeacon(ScriptState *script) { +int KyraEngine_v1::o1_querySceneAnimatorBeacon(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_querySceneAnimatorBeacon(%p) ()", (const void *)script); return _sprites->_sceneAnimatorBeaconFlag; } -int KyraEngine::o1_refreshSceneAnimator(ScriptState *script) { +int KyraEngine_v1::o1_refreshSceneAnimator(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_refreshSceneAnimator(%p) ()", (const void *)script); _sprites->updateSceneAnims(); _animator->updateAllObjectShapes(); return 0; } -int KyraEngine::o1_placeItemInOffScene(ScriptState *script) { +int KyraEngine_v1::o1_placeItemInOffScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_placeItemInOffScene(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int item = stackPos(0); int xpos = stackPos(1); @@ -917,7 +917,7 @@ int KyraEngine::o1_placeItemInOffScene(ScriptState *script) { return 0; } -int KyraEngine::o1_wipeDownMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_wipeDownMouseItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_wipeDownMouseItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); _screen->hideMouse(); wipeDownMouseItem(stackPos(1), stackPos(2)); @@ -926,7 +926,7 @@ int KyraEngine::o1_wipeDownMouseItem(ScriptState *script) { return 0; } -int KyraEngine::o1_placeCharacterInOtherScene(ScriptState *script) { +int KyraEngine_v1::o1_placeCharacterInOtherScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_placeCharacterInOtherScene(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); int id = stackPos(0); int sceneId = stackPos(1); @@ -943,18 +943,18 @@ int KyraEngine::o1_placeCharacterInOtherScene(ScriptState *script) { return 0; } -int KyraEngine::o1_getKey(ScriptState *script) { +int KyraEngine_v1::o1_getKey(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getKey(%p) ()", (const void *)script); waitForEvent(); return 0; } -int KyraEngine::o1_specificItemInInventory(ScriptState *script) { +int KyraEngine_v1::o1_specificItemInInventory(ScriptState *script) { warning("STUB: o1_specificItemInInventory"); return 0; } -int KyraEngine::o1_popMobileNPCIntoScene(ScriptState *script) { +int KyraEngine_v1::o1_popMobileNPCIntoScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_popMobileNPCIntoScene(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), (int16)(stackPos(4) & 0xFFFC), (int8)(stackPos(5) & 0xFE)); int character = stackPos(0); int sceneId = stackPos(1); @@ -975,22 +975,22 @@ int KyraEngine::o1_popMobileNPCIntoScene(ScriptState *script) { return 0; } -int KyraEngine::o1_mobileCharacterInScene(ScriptState *script) { +int KyraEngine_v1::o1_mobileCharacterInScene(ScriptState *script) { warning("STUB: o1_mobileCharacterInScene"); return 0; } -int KyraEngine::o1_hideMobileCharacter(ScriptState *script) { +int KyraEngine_v1::o1_hideMobileCharacter(ScriptState *script) { warning("STUB: o1_hideMobileCharacter"); return 0; } -int KyraEngine::o1_unhideMobileCharacter(ScriptState *script) { +int KyraEngine_v1::o1_unhideMobileCharacter(ScriptState *script) { warning("STUB: o1_unhideMobileCharacter"); return 0; } -int KyraEngine::o1_setCharactersLocation(ScriptState *script) { +int KyraEngine_v1::o1_setCharactersLocation(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setCharactersLocation(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); Character *ch = &_characterList[stackPos(0)]; AnimObject *animObj = &_animator->actors()[stackPos(0)]; @@ -1007,7 +1007,7 @@ int KyraEngine::o1_setCharactersLocation(ScriptState *script) { return 0; } -int KyraEngine::o1_walkCharacterToPoint(ScriptState *script) { +int KyraEngine_v1::o1_walkCharacterToPoint(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_walkCharacterToPoint(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); int character = stackPos(0); int toX = stackPos(1); @@ -1089,7 +1089,7 @@ int KyraEngine::o1_walkCharacterToPoint(ScriptState *script) { return 0; } -int KyraEngine::o1_specialEventDisplayBrynnsNote(ScriptState *script) { +int KyraEngine_v1::o1_specialEventDisplayBrynnsNote(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_specialEventDisplayBrynnsNote(%p) ()", (const void *)script); _screen->hideMouse(); _screen->savePageToDisk("HIDPAGE.TMP", 2); @@ -1111,7 +1111,7 @@ int KyraEngine::o1_specialEventDisplayBrynnsNote(ScriptState *script) { return 0; } -int KyraEngine::o1_specialEventRemoveBrynnsNote(ScriptState *script) { +int KyraEngine_v1::o1_specialEventRemoveBrynnsNote(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_specialEventRemoveBrynnsNote(%p) ()", (const void *)script); _screen->hideMouse(); _screen->loadPageFromDisk("SEENPAGE.TMP", 0); @@ -1122,13 +1122,13 @@ int KyraEngine::o1_specialEventRemoveBrynnsNote(ScriptState *script) { return 0; } -int KyraEngine::o1_setLogicPage(ScriptState *script) { +int KyraEngine_v1::o1_setLogicPage(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setLogicPage(%p) (%d)", (const void *)script, stackPos(0)); _screen->_curPage = stackPos(0); return stackPos(0); } -int KyraEngine::o1_fatPrint(ScriptState *script) { +int KyraEngine_v1::o1_fatPrint(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_fatPrint(%p) ('%s', %d, %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); // Workround for bug #1582672 ("KYRA1: Text crippled and drawn wrong") @@ -1141,13 +1141,13 @@ int KyraEngine::o1_fatPrint(ScriptState *script) { return 0; } -int KyraEngine::o1_preserveAllObjectBackgrounds(ScriptState *script) { +int KyraEngine_v1::o1_preserveAllObjectBackgrounds(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_preserveAllObjectBackgrounds(%p) ()", (const void *)script); _animator->preserveAllBackgrounds(); return 0; } -int KyraEngine::o1_updateSceneAnimations(ScriptState *script) { +int KyraEngine_v1::o1_updateSceneAnimations(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_updateSceneAnimations(%p) (%d)", (const void *)script, stackPos(0)); int times = stackPos(0); while (times--) { @@ -1157,23 +1157,23 @@ int KyraEngine::o1_updateSceneAnimations(ScriptState *script) { return 0; } -int KyraEngine::o1_sceneAnimationActive(ScriptState *script) { +int KyraEngine_v1::o1_sceneAnimationActive(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_sceneAnimationActive(%p) (%d)", (const void *)script, stackPos(0)); return _sprites->_anims[stackPos(0)].play; } -int KyraEngine::o1_setCharactersMovementDelay(ScriptState *script) { +int KyraEngine_v1::o1_setCharactersMovementDelay(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setCharactersMovementDelay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setTimerDelay(stackPos(0)+5, stackPos(1)); return 0; } -int KyraEngine::o1_getCharactersFacing(ScriptState *script) { +int KyraEngine_v1::o1_getCharactersFacing(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getCharactersFacing(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].facing; } -int KyraEngine::o1_bkgdScrollSceneAndMasksRight(ScriptState *script) { +int KyraEngine_v1::o1_bkgdScrollSceneAndMasksRight(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_bkgdScrollSceneAndMasksRight(%p) (%d)", (const void *)script, stackPos(0)); _screen->copyBackgroundBlock(stackPos(0), 2, 0); _screen->copyBackgroundBlock2(stackPos(0)); @@ -1183,13 +1183,13 @@ int KyraEngine::o1_bkgdScrollSceneAndMasksRight(ScriptState *script) { return 0; } -int KyraEngine::o1_dispelMagicAnimation(ScriptState *script) { +int KyraEngine_v1::o1_dispelMagicAnimation(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_dispelMagicAnimation(%p) ()", (const void *)script); seq_dispelMagicAnimation(); return 0; } -int KyraEngine::o1_findBrightestFireberry(ScriptState *script) { +int KyraEngine_v1::o1_findBrightestFireberry(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_findBrightestFireberry(%p) ()", (const void *)script); if (_currentCharacter->sceneId >= 187 && _currentCharacter->sceneId <= 198) return 29; @@ -1233,7 +1233,7 @@ int KyraEngine::o1_findBrightestFireberry(ScriptState *script) { return brightestFireberry; } -int KyraEngine::o1_setFireberryGlowPalette(ScriptState *script) { +int KyraEngine_v1::o1_setFireberryGlowPalette(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setFireberryGlowPalette(%p) (%d)", (const void *)script, stackPos(0)); int palIndex = 0; switch (stackPos(0)) { @@ -1270,19 +1270,19 @@ int KyraEngine::o1_setFireberryGlowPalette(ScriptState *script) { return 0; } -int KyraEngine::o1_setDeathHandlerFlag(ScriptState *script) { +int KyraEngine_v1::o1_setDeathHandlerFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setDeathHandlerFlag(%p) (%d)", (const void *)script, stackPos(0)); _deathHandler = stackPos(0); return 0; } -int KyraEngine::o1_drinkPotionAnimation(ScriptState *script) { +int KyraEngine_v1::o1_drinkPotionAnimation(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_drinkPotionAnimation(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); seq_playDrinkPotionAnim(stackPos(0), stackPos(1), stackPos(2)); return 0; } -int KyraEngine::o1_makeAmuletAppear(ScriptState *script) { +int KyraEngine_v1::o1_makeAmuletAppear(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_makeAmuletAppear(%p) ()", (const void *)script); WSAMovieV1 amulet(this); amulet.open("AMULET.WSA", 1, 0); @@ -1323,7 +1323,7 @@ int KyraEngine::o1_makeAmuletAppear(ScriptState *script) { return 0; } -int KyraEngine::o1_drawItemShapeIntoScene(ScriptState *script) { +int KyraEngine_v1::o1_drawItemShapeIntoScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_drawItemShapeIntoScene(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); int item = stackPos(0); int x = stackPos(1); @@ -1350,13 +1350,13 @@ int KyraEngine::o1_drawItemShapeIntoScene(ScriptState *script) { return 0; } -int KyraEngine::o1_setCharactersCurrentFrame(ScriptState *script) { +int KyraEngine_v1::o1_setCharactersCurrentFrame(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setCharactersCurrentFrame(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _characterList[stackPos(0)].currentAnimFrame = stackPos(1); return 0; } -int KyraEngine::o1_waitForConfirmationMouseClick(ScriptState *script) { +int KyraEngine_v1::o1_waitForConfirmationMouseClick(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_waitForConfirmationMouseClick(%p) ()", (const void *)script); // if (mouseEnabled) { while (!_mousePressFlag) { @@ -1381,39 +1381,39 @@ int KyraEngine::o1_waitForConfirmationMouseClick(ScriptState *script) { return 0; } -int KyraEngine::o1_pageFlip(ScriptState *script) { +int KyraEngine_v1::o1_pageFlip(ScriptState *script) { warning("STUB: o1_pageFlip"); return 0; } -int KyraEngine::o1_setSceneFile(ScriptState *script) { +int KyraEngine_v1::o1_setSceneFile(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setSceneFile(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setSceneFile(stackPos(0), stackPos(1)); return 0; } -int KyraEngine::o1_getItemInMarbleVase(ScriptState *script) { +int KyraEngine_v1::o1_getItemInMarbleVase(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getItemInMarbleVase(%p) ()", (const void *)script); return _marbleVaseItem; } -int KyraEngine::o1_setItemInMarbleVase(ScriptState *script) { +int KyraEngine_v1::o1_setItemInMarbleVase(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setItemInMarbleVase(%p) (%d)", (const void *)script, stackPos(0)); _marbleVaseItem = stackPos(0); return 0; } -int KyraEngine::o1_addItemToInventory(ScriptState *script) { +int KyraEngine_v1::o1_addItemToInventory(ScriptState *script) { warning("STUB: o1_addItemToInventory"); return 0; } -int KyraEngine::o1_intPrint(ScriptState *script) { +int KyraEngine_v1::o1_intPrint(ScriptState *script) { warning("STUB: o1_intPrint"); return 0; } -int KyraEngine::o1_shakeScreen(ScriptState *script) { +int KyraEngine_v1::o1_shakeScreen(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_shakeScreen(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int waitTicks = stackPos(1); int times = stackPos(0); @@ -1426,57 +1426,57 @@ int KyraEngine::o1_shakeScreen(ScriptState *script) { return 0; } -int KyraEngine::o1_createAmuletJewel(ScriptState *script) { +int KyraEngine_v1::o1_createAmuletJewel(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_createAmuletJewel(%p) (%d)", (const void *)script, stackPos(0)); seq_createAmuletJewel(stackPos(0), 0, 0, 0); return 0; } -int KyraEngine::o1_setSceneAnimCurrXY(ScriptState *script) { +int KyraEngine_v1::o1_setSceneAnimCurrXY(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setSceneAnimCurrXY(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); _sprites->_anims[stackPos(0)].x = stackPos(1); _sprites->_anims[stackPos(0)].y = stackPos(2); return 0; } -int KyraEngine::o1_poisonBrandonAndRemaps(ScriptState *script) { +int KyraEngine_v1::o1_poisonBrandonAndRemaps(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_poisonBrandonAndRemaps(%p) ()", (const void *)script); setBrandonPoisonFlags(1); return 0; } -int KyraEngine::o1_fillFlaskWithWater(ScriptState *script) { +int KyraEngine_v1::o1_fillFlaskWithWater(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_fillFlaskWithWater(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); seq_fillFlaskWithWater(stackPos(0), stackPos(1)); return 0; } -int KyraEngine::o1_getCharactersMovementDelay(ScriptState *script) { +int KyraEngine_v1::o1_getCharactersMovementDelay(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getCharactersMovementDelay(%p) (%d)", (const void *)script, stackPos(0)); return getTimerDelay(stackPos(0)+5); } -int KyraEngine::o1_getBirthstoneGem(ScriptState *script) { +int KyraEngine_v1::o1_getBirthstoneGem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getBirthstoneGem(%p) (%d)", (const void *)script, stackPos(0)); if (stackPos(0) < 4) return _birthstoneGemTable[stackPos(0)]; return 0; } -int KyraEngine::o1_queryBrandonStatusBit(ScriptState *script) { +int KyraEngine_v1::o1_queryBrandonStatusBit(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_queryBrandonStatusBit(%p) (%d)", (const void *)script, stackPos(0)); if (_brandonStatusBit & stackPos(0)) return 1; return 0; } -int KyraEngine::o1_playFluteAnimation(ScriptState *script) { +int KyraEngine_v1::o1_playFluteAnimation(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_playFluteAnimation(%p) ()", (const void *)script); seq_playFluteAnimation(); return 0; } -int KyraEngine::o1_playWinterScrollSequence(ScriptState *script) { +int KyraEngine_v1::o1_playWinterScrollSequence(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_playWinterScrollSequence(%p) (%d)", (const void *)script, stackPos(0)); if (!stackPos(0)) seq_winterScroll2(); @@ -1485,40 +1485,40 @@ int KyraEngine::o1_playWinterScrollSequence(ScriptState *script) { return 0; } -int KyraEngine::o1_getIdolGem(ScriptState *script) { +int KyraEngine_v1::o1_getIdolGem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getIdolGem(%p) (%d)", (const void *)script, stackPos(0)); return _idolGemsTable[stackPos(0)]; } -int KyraEngine::o1_setIdolGem(ScriptState *script) { +int KyraEngine_v1::o1_setIdolGem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setIdolGem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _idolGemsTable[stackPos(0)] = stackPos(1); return 0; } -int KyraEngine::o1_totalItemsInScene(ScriptState *script) { +int KyraEngine_v1::o1_totalItemsInScene(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_totalItemsInScene(%p) (%d)", (const void *)script, stackPos(0)); return countItemsInScene(stackPos(0)); } -int KyraEngine::o1_restoreBrandonsMovementDelay(ScriptState *script) { +int KyraEngine_v1::o1_restoreBrandonsMovementDelay(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_restoreBrandonsMovementDelay(%p) ()", (const void *)script); setWalkspeed(_configWalkspeed); return 0; } -int KyraEngine::o1_setMousePos(ScriptState *script) { +int KyraEngine_v1::o1_setMousePos(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _system->warpMouse(stackPos(0), stackPos(1)); return 0; } -int KyraEngine::o1_getMouseState(ScriptState *script) { +int KyraEngine_v1::o1_getMouseState(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getMouseState(%p) ()", (const void *)script); return _mouseState; } -int KyraEngine::o1_setEntranceMouseCursorTrack(ScriptState *script) { +int KyraEngine_v1::o1_setEntranceMouseCursorTrack(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setEntranceMouseCursorTrack(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); _entranceMouseCursorTracks[0] = stackPos(0); _entranceMouseCursorTracks[1] = stackPos(1); @@ -1528,19 +1528,19 @@ int KyraEngine::o1_setEntranceMouseCursorTrack(ScriptState *script) { return 0; } -int KyraEngine::o1_itemAppearsOnGround(ScriptState *script) { +int KyraEngine_v1::o1_itemAppearsOnGround(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_itemAppearsOnGround(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); processItemDrop(_currentCharacter->sceneId, stackPos(0), stackPos(1), stackPos(2), 2, 0); return 0; } -int KyraEngine::o1_setNoDrawShapesFlag(ScriptState *script) { +int KyraEngine_v1::o1_setNoDrawShapesFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setNoDrawShapesFlag(%p) (%d)", (const void *)script, stackPos(0)); _animator->_noDrawShapesFlag = stackPos(0); return 0; } -int KyraEngine::o1_fadeEntirePalette(ScriptState *script) { +int KyraEngine_v1::o1_fadeEntirePalette(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_fadeEntirePalette(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int cmd = stackPos(0); uint8 *fadePal = 0; @@ -1580,7 +1580,7 @@ int KyraEngine::o1_fadeEntirePalette(ScriptState *script) { return 0; } -int KyraEngine::o1_itemOnGroundHere(ScriptState *script) { +int KyraEngine_v1::o1_itemOnGroundHere(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_itemOnGroundHere(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < _roomTableSize); Room *curRoom = &_roomTable[stackPos(0)]; @@ -1591,18 +1591,18 @@ int KyraEngine::o1_itemOnGroundHere(ScriptState *script) { return 0; } -int KyraEngine::o1_queryCauldronState(ScriptState *script) { +int KyraEngine_v1::o1_queryCauldronState(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_queryCauldronState(%p) ()", (const void *)script); return _cauldronState; } -int KyraEngine::o1_setCauldronState(ScriptState *script) { +int KyraEngine_v1::o1_setCauldronState(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setCauldronState(%p) (%d)", (const void *)script, stackPos(0)); _cauldronState = stackPos(0); return _cauldronState; } -int KyraEngine::o1_queryCrystalState(ScriptState *script) { +int KyraEngine_v1::o1_queryCrystalState(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_queryCrystalState(%p) (%d)", (const void *)script, stackPos(0)); if (!stackPos(0)) return _crystalState[0]; @@ -1611,7 +1611,7 @@ int KyraEngine::o1_queryCrystalState(ScriptState *script) { return -1; } -int KyraEngine::o1_setCrystalState(ScriptState *script) { +int KyraEngine_v1::o1_setCrystalState(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setCrystalState(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); if (!stackPos(0)) _crystalState[0] = stackPos(1); @@ -1620,12 +1620,12 @@ int KyraEngine::o1_setCrystalState(ScriptState *script) { return stackPos(1); } -int KyraEngine::o1_setPaletteRange(ScriptState *script) { +int KyraEngine_v1::o1_setPaletteRange(ScriptState *script) { warning("STUB: o1_setPaletteRange"); return 0; } -int KyraEngine::o1_shrinkBrandonDown(ScriptState *script) { +int KyraEngine_v1::o1_shrinkBrandonDown(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_shrinkBrandonDown(%p) (%d)", (const void *)script, stackPos(0)); int delayTime = stackPos(0); checkAmuletAnimFlags(); @@ -1651,7 +1651,7 @@ int KyraEngine::o1_shrinkBrandonDown(ScriptState *script) { return 0; } -int KyraEngine::o1_growBrandonUp(ScriptState *script) { +int KyraEngine_v1::o1_growBrandonUp(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_growBrandonUp(%p) ()", (const void *)script); int scaleValue = _scaleTable[_currentCharacter->y1]; int scale = 0; @@ -1672,33 +1672,33 @@ int KyraEngine::o1_growBrandonUp(ScriptState *script) { return 0; } -int KyraEngine::o1_setBrandonScaleXAndY(ScriptState *script) { +int KyraEngine_v1::o1_setBrandonScaleXAndY(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setBrandonScaleXAndY(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _animator->_brandonScaleX = stackPos(0); _animator->_brandonScaleY = stackPos(1); return 0; } -int KyraEngine::o1_resetScaleMode(ScriptState *script) { +int KyraEngine_v1::o1_resetScaleMode(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_resetScaleMode(%p) ()", (const void *)script); _scaleMode = 0; return 0; } -int KyraEngine::o1_getScaleDepthTableValue(ScriptState *script) { +int KyraEngine_v1::o1_getScaleDepthTableValue(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getScaleDepthTableValue(%p) (%d)", (const void *)script, stackPos(0)); assert(stackPos(0) < ARRAYSIZE(_scaleTable)); return _scaleTable[stackPos(0)]; } -int KyraEngine::o1_setScaleDepthTableValue(ScriptState *script) { +int KyraEngine_v1::o1_setScaleDepthTableValue(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setScaleDepthTableValue(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < ARRAYSIZE(_scaleTable)); _scaleTable[stackPos(0)] = stackPos(1); return stackPos(1); } -int KyraEngine::o1_message(ScriptState *script) { +int KyraEngine_v1::o1_message(ScriptState *script) { if (_flags.isTalkie) { debugC(3, kDebugLevelScriptFuncs, "o1_message(%p) (%d, '%s', %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2)); drawSentenceCommand(stackPosString(1), stackPos(2)); @@ -1710,65 +1710,65 @@ int KyraEngine::o1_message(ScriptState *script) { return 0; } -int KyraEngine::o1_checkClickOnNPC(ScriptState *script) { +int KyraEngine_v1::o1_checkClickOnNPC(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_checkClickOnNPC(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return checkForNPCScriptRun(stackPos(0), stackPos(1)); } -int KyraEngine::o1_getFoyerItem(ScriptState *script) { +int KyraEngine_v1::o1_getFoyerItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_getFoyerItem(%p) (%d)", (const void *)script, stackPos(0)); assert(stackPos(0) < ARRAYSIZE(_foyerItemTable)); return _foyerItemTable[stackPos(0)]; } -int KyraEngine::o1_setFoyerItem(ScriptState *script) { +int KyraEngine_v1::o1_setFoyerItem(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setFoyerItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < ARRAYSIZE(_foyerItemTable)); _foyerItemTable[stackPos(0)] = stackPos(1); return stackPos(1); } -int KyraEngine::o1_setNoItemDropRegion(ScriptState *script) { +int KyraEngine_v1::o1_setNoItemDropRegion(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setNoItemDropRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); addToNoDropRects(stackPos(0), stackPos(1), stackPos(2), stackPos(3)); return 0; } -int KyraEngine::o1_walkMalcolmOn(ScriptState *script) { +int KyraEngine_v1::o1_walkMalcolmOn(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_walkMalcolmOn(%p) ()", (const void *)script); if (!_malcolmFlag) _malcolmFlag = 1; return 0; } -int KyraEngine::o1_passiveProtection(ScriptState *script) { +int KyraEngine_v1::o1_passiveProtection(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_passiveProtection(%p) ()", (const void *)script); return 1; } -int KyraEngine::o1_setPlayingLoop(ScriptState *script) { +int KyraEngine_v1::o1_setPlayingLoop(ScriptState *script) { warning("STUB: o1_setPlayingLoop"); return 0; } -int KyraEngine::o1_brandonToStoneSequence(ScriptState *script) { +int KyraEngine_v1::o1_brandonToStoneSequence(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_brandonToStoneSequence(%p) ()", (const void *)script); seq_brandonToStone(); return 0; } -int KyraEngine::o1_brandonHealingSequence(ScriptState *script) { +int KyraEngine_v1::o1_brandonHealingSequence(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_brandonHealingSequence(%p) ()", (const void *)script); seq_brandonHealing(); return 0; } -int KyraEngine::o1_protectCommandLine(ScriptState *script) { +int KyraEngine_v1::o1_protectCommandLine(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_protectCommandLine(%p) (%d)", (const void *)script, stackPos(0)); return stackPos(0); } -int KyraEngine::o1_pauseMusicSeconds(ScriptState *script) { +int KyraEngine_v1::o1_pauseMusicSeconds(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_pauseMusicSeconds(%p) ()", (const void *)script); // if music disabled // return @@ -1776,18 +1776,18 @@ int KyraEngine::o1_pauseMusicSeconds(ScriptState *script) { return 0; } -int KyraEngine::o1_resetMaskRegion(ScriptState *script) { +int KyraEngine_v1::o1_resetMaskRegion(ScriptState *script) { warning("STUB: o1_resetMaskRegion"); return 0; } -int KyraEngine::o1_setPaletteChangeFlag(ScriptState *script) { +int KyraEngine_v1::o1_setPaletteChangeFlag(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_setPaletteChangeFlag(%p) (%d)", (const void *)script, stackPos(0)); _paletteChanged = stackPos(0); return _paletteChanged; } -int KyraEngine::o1_fillRect(ScriptState *script) { +int KyraEngine_v1::o1_fillRect(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_fillRect(%p) (%d, %d, %d, %d, %d, 0x%X)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); int videoPageBackup = _screen->_curPage; _screen->_curPage = stackPos(0); @@ -1796,19 +1796,19 @@ int KyraEngine::o1_fillRect(ScriptState *script) { return 0; } -int KyraEngine::o1_vocUnload(ScriptState *script) { +int KyraEngine_v1::o1_vocUnload(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_vocUnload(%p) ()", (const void *)script); // this should unload all voc files (not needed) return 0; } -int KyraEngine::o1_vocLoad(ScriptState *script) { +int KyraEngine_v1::o1_vocLoad(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_vocLoad(%p) (%d)", (const void *)script, stackPos(0)); // this should load the specified voc file (not needed) return 0; } -int KyraEngine::o1_dummy(ScriptState *script) { +int KyraEngine_v1::o1_dummy(ScriptState *script) { debugC(3, kDebugLevelScriptFuncs, "o1_dummy(%p) ()", (const void *)script); return 0; } diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index 89e07f3d57..1be5895e75 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -875,212 +875,6 @@ const ScreenDim Screen::_screenDimTableK3[] = { const int Screen::_screenDimTableCountK3 = ARRAYSIZE(_screenDimTableK3); -#define Opcode(x) &KyraEngine::x -void KyraEngine::setupOpcodeTable() { - static const OpcodeProc opcodeTable[] = { - // 0x00 - Opcode(o1_magicInMouseItem), - Opcode(o1_characterSays), - Opcode(o1_pauseTicks), - Opcode(o1_drawSceneAnimShape), - // 0x04 - Opcode(o1_queryGameFlag), - Opcode(o1_setGameFlag), - Opcode(o1_resetGameFlag), - Opcode(o1_runNPCScript), - // 0x08 - Opcode(o1_setSpecialExitList), - Opcode(o1_blockInWalkableRegion), - Opcode(o1_blockOutWalkableRegion), - Opcode(o1_walkPlayerToPoint), - // 0x0c - Opcode(o1_dropItemInScene), - Opcode(o1_drawAnimShapeIntoScene), - Opcode(o1_createMouseItem), - Opcode(o1_savePageToDisk), - // 0x10 - Opcode(o1_sceneAnimOn), - Opcode(o1_sceneAnimOff), - Opcode(o1_getElapsedSeconds), - Opcode(o1_mouseIsPointer), - // 0x14 - Opcode(o1_destroyMouseItem), - Opcode(o1_runSceneAnimUntilDone), - Opcode(o1_fadeSpecialPalette), - Opcode(o1_playAdlibSound), - // 0x18 - Opcode(o1_playAdlibScore), - Opcode(o1_phaseInSameScene), - Opcode(o1_setScenePhasingFlag), - Opcode(o1_resetScenePhasingFlag), - // 0x1c - Opcode(o1_queryScenePhasingFlag), - Opcode(o1_sceneToDirection), - Opcode(o1_setBirthstoneGem), - Opcode(o1_placeItemInGenericMapScene), - // 0x20 - Opcode(o1_setBrandonStatusBit), - Opcode(o1_pauseSeconds), - Opcode(o1_getCharactersLocation), - Opcode(o1_runNPCSubscript), - // 0x24 - Opcode(o1_magicOutMouseItem), - Opcode(o1_internalAnimOn), - Opcode(o1_forceBrandonToNormal), - Opcode(o1_poisonDeathNow), - // 0x28 - Opcode(o1_setScaleMode), - Opcode(o1_openWSAFile), - Opcode(o1_closeWSAFile), - Opcode(o1_runWSAFromBeginningToEnd), - // 0x2c - Opcode(o1_displayWSAFrame), - Opcode(o1_enterNewScene), - Opcode(o1_setSpecialEnterXAndY), - Opcode(o1_runWSAFrames), - // 0x30 - Opcode(o1_popBrandonIntoScene), - Opcode(o1_restoreAllObjectBackgrounds), - Opcode(o1_setCustomPaletteRange), - Opcode(o1_loadPageFromDisk), - // 0x34 - Opcode(o1_customPrintTalkString), - Opcode(o1_restoreCustomPrintBackground), - Opcode(o1_hideMouse), - Opcode(o1_showMouse), - // 0x38 - Opcode(o1_getCharacterX), - Opcode(o1_getCharacterY), - Opcode(o1_changeCharactersFacing), - Opcode(o1_copyWSARegion), - // 0x3c - Opcode(o1_printText), - Opcode(o1_random), - Opcode(o1_loadSoundFile), - Opcode(o1_displayWSAFrameOnHidPage), - // 0x40 - Opcode(o1_displayWSASequentialFrames), - Opcode(o1_drawCharacterStanding), - Opcode(o1_internalAnimOff), - Opcode(o1_changeCharactersXAndY), - // 0x44 - Opcode(o1_clearSceneAnimatorBeacon), - Opcode(o1_querySceneAnimatorBeacon), - Opcode(o1_refreshSceneAnimator), - Opcode(o1_placeItemInOffScene), - // 0x48 - Opcode(o1_wipeDownMouseItem), - Opcode(o1_placeCharacterInOtherScene), - Opcode(o1_getKey), - Opcode(o1_specificItemInInventory), - // 0x4c - Opcode(o1_popMobileNPCIntoScene), - Opcode(o1_mobileCharacterInScene), - Opcode(o1_hideMobileCharacter), - Opcode(o1_unhideMobileCharacter), - // 0x50 - Opcode(o1_setCharactersLocation), - Opcode(o1_walkCharacterToPoint), - Opcode(o1_specialEventDisplayBrynnsNote), - Opcode(o1_specialEventRemoveBrynnsNote), - // 0x54 - Opcode(o1_setLogicPage), - Opcode(o1_fatPrint), - Opcode(o1_preserveAllObjectBackgrounds), - Opcode(o1_updateSceneAnimations), - // 0x58 - Opcode(o1_sceneAnimationActive), - Opcode(o1_setCharactersMovementDelay), - Opcode(o1_getCharactersFacing), - Opcode(o1_bkgdScrollSceneAndMasksRight), - // 0x5c - Opcode(o1_dispelMagicAnimation), - Opcode(o1_findBrightestFireberry), - Opcode(o1_setFireberryGlowPalette), - Opcode(o1_setDeathHandlerFlag), - // 0x60 - Opcode(o1_drinkPotionAnimation), - Opcode(o1_makeAmuletAppear), - Opcode(o1_drawItemShapeIntoScene), - Opcode(o1_setCharactersCurrentFrame), - // 0x64 - Opcode(o1_waitForConfirmationMouseClick), - Opcode(o1_pageFlip), - Opcode(o1_setSceneFile), - Opcode(o1_getItemInMarbleVase), - // 0x68 - Opcode(o1_setItemInMarbleVase), - Opcode(o1_addItemToInventory), - Opcode(o1_intPrint), - Opcode(o1_shakeScreen), - // 0x6c - Opcode(o1_createAmuletJewel), - Opcode(o1_setSceneAnimCurrXY), - Opcode(o1_poisonBrandonAndRemaps), - Opcode(o1_fillFlaskWithWater), - // 0x70 - Opcode(o1_getCharactersMovementDelay), - Opcode(o1_getBirthstoneGem), - Opcode(o1_queryBrandonStatusBit), - Opcode(o1_playFluteAnimation), - // 0x74 - Opcode(o1_playWinterScrollSequence), - Opcode(o1_getIdolGem), - Opcode(o1_setIdolGem), - Opcode(o1_totalItemsInScene), - // 0x78 - Opcode(o1_restoreBrandonsMovementDelay), - Opcode(o1_setMousePos), - Opcode(o1_getMouseState), - Opcode(o1_setEntranceMouseCursorTrack), - // 0x7c - Opcode(o1_itemAppearsOnGround), - Opcode(o1_setNoDrawShapesFlag), - Opcode(o1_fadeEntirePalette), - Opcode(o1_itemOnGroundHere), - // 0x80 - Opcode(o1_queryCauldronState), - Opcode(o1_setCauldronState), - Opcode(o1_queryCrystalState), - Opcode(o1_setCrystalState), - // 0x84 - Opcode(o1_setPaletteRange), - Opcode(o1_shrinkBrandonDown), - Opcode(o1_growBrandonUp), - Opcode(o1_setBrandonScaleXAndY), - // 0x88 - Opcode(o1_resetScaleMode), - Opcode(o1_getScaleDepthTableValue), - Opcode(o1_setScaleDepthTableValue), - Opcode(o1_message), - // 0x8c - Opcode(o1_checkClickOnNPC), - Opcode(o1_getFoyerItem), - Opcode(o1_setFoyerItem), - Opcode(o1_setNoItemDropRegion), - // 0x90 - Opcode(o1_walkMalcolmOn), - Opcode(o1_passiveProtection), - Opcode(o1_setPlayingLoop), - Opcode(o1_brandonToStoneSequence), - // 0x94 - Opcode(o1_brandonHealingSequence), - Opcode(o1_protectCommandLine), - Opcode(o1_pauseMusicSeconds), - Opcode(o1_resetMaskRegion), - // 0x98 - Opcode(o1_setPaletteChangeFlag), - Opcode(o1_fillRect), - Opcode(o1_vocUnload), - Opcode(o1_vocLoad), - Opcode(o1_dummy) - }; - - _opcodeTable = opcodeTable; - _opcodeTableSize = ARRAYSIZE(opcodeTable); -} -#undef Opcode - const char *KyraEngine::_soundFiles[] = { "INTRO", "KYRA1A", |