diff options
-rw-r--r-- | engines/kyra/gui_v1.cpp | 14 | ||||
-rw-r--r-- | engines/kyra/gui_v3.cpp | 16 | ||||
-rw-r--r-- | engines/kyra/kyra.cpp | 25 | ||||
-rw-r--r-- | engines/kyra/kyra.h | 4 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 102 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.h | 324 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.cpp | 52 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.h | 340 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.cpp | 18 | ||||
-rw-r--r-- | engines/kyra/kyra_v3.h | 240 | ||||
-rw-r--r-- | engines/kyra/scene_v1.cpp | 46 | ||||
-rw-r--r-- | engines/kyra/scene_v2.cpp | 64 | ||||
-rw-r--r-- | engines/kyra/scene_v3.cpp | 70 | ||||
-rw-r--r-- | engines/kyra/script.cpp | 66 | ||||
-rw-r--r-- | engines/kyra/script.h | 64 | ||||
-rw-r--r-- | engines/kyra/script_v1.cpp | 318 | ||||
-rw-r--r-- | engines/kyra/script_v2.cpp | 336 | ||||
-rw-r--r-- | engines/kyra/script_v3.cpp | 242 | ||||
-rw-r--r-- | engines/kyra/sequences_v3.cpp | 24 | ||||
-rw-r--r-- | engines/kyra/text_v2.cpp | 24 | ||||
-rw-r--r-- | engines/kyra/text_v3.cpp | 54 | ||||
-rw-r--r-- | engines/kyra/timer_v3.cpp | 8 |
22 files changed, 1217 insertions, 1234 deletions
diff --git a/engines/kyra/gui_v1.cpp b/engines/kyra/gui_v1.cpp index e5800832cb..e5a0c42281 100644 --- a/engines/kyra/gui_v1.cpp +++ b/engines/kyra/gui_v1.cpp @@ -119,15 +119,15 @@ int KyraEngine_v1::buttonAmuletCallback(Button *caller) { drawJewelsFadeOutStart(); drawJewelsFadeOutEnd(jewel); - _scriptInterpreter->initScript(_scriptClick, _scriptClickData); - _scriptClick->regs[3] = 0; - _scriptClick->regs[6] = jewel; - _scriptInterpreter->startScript(_scriptClick, 4); + _emc->init(&_scriptClick, &_scriptClickData); + _scriptClick.regs[3] = 0; + _scriptClick.regs[6] = jewel; + _emc->start(&_scriptClick, 4); - while (_scriptInterpreter->validScript(_scriptClick)) - _scriptInterpreter->runScript(_scriptClick); + while (_emc->isValid(&_scriptClick)) + _emc->run(&_scriptClick); - if (_scriptClick->regs[3]) + if (_scriptClick.regs[3]) return 1; _unkAmuletVar = 1; diff --git a/engines/kyra/gui_v3.cpp b/engines/kyra/gui_v3.cpp index 51cd3bbc9a..0c9a2ef9f1 100644 --- a/engines/kyra/gui_v3.cpp +++ b/engines/kyra/gui_v3.cpp @@ -525,26 +525,26 @@ int KyraEngine_v3::buttonMoodChange(Button *button) { drawMalcolmsMoodText(); updateDlgIndex(); - ScriptData data; - ScriptState state; + EMCData data; + EMCState state; memset(&data, 0, sizeof(data)); memset(&state, 0, sizeof(state)); _res->exists("_ACTOR.EMC", true); - _scriptInterpreter->loadScript("_ACTOR.EMC", &data, &_opcodes); - _scriptInterpreter->initScript(&state, &data); - _scriptInterpreter->startScript(&state, 1); + _emc->load("_ACTOR.EMC", &data, &_opcodes); + _emc->init(&state, &data); + _emc->start(&state, 1); int vocHigh = _vocHigh; _vocHigh = 200; _useActorBuffer = true; - while (_scriptInterpreter->validScript(&state)) - _scriptInterpreter->runScript(&state); + while (_emc->isValid(&state)) + _emc->run(&state); _useActorBuffer = false; _vocHigh = vocHigh; - _scriptInterpreter->unloadScript(&data); + _emc->unload(&data); } return 0; diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index f3d6467984..05d8b79a4e 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -45,7 +45,7 @@ KyraEngine::KyraEngine(OSystem *system, const GameFlags &flags) _text = 0; _staticres = 0; _timer = 0; - _scriptInterpreter = 0; + _emc = 0; _gameSpeed = 60; _tickLength = (uint8)(1000.0 / _gameSpeed); @@ -145,8 +145,8 @@ int KyraEngine::init() { _timer = new TimerManager(this, _system); assert(_timer); setupTimers(); - _scriptInterpreter = new ScriptHelper(this); - assert(_scriptInterpreter); + _emc = new EMCInterpreter(this); + assert(_emc); setupOpcodeTable(); readSettings(); @@ -200,7 +200,7 @@ KyraEngine::~KyraEngine() { delete _sound; delete _text; delete _timer; - delete _scriptInterpreter; + delete _emc; } void KyraEngine::quitGame() { @@ -273,8 +273,10 @@ void KyraEngine::readSettings() { } _configSounds = ConfMan.getBool("sfx_mute") ? 0 : 1; - _sound->enableMusic(_configMusic); - _sound->enableSFX(_configSounds); + if (_sound) { + _sound->enableMusic(_configMusic); + _sound->enableSFX(_configSounds); + } bool speechMute = ConfMan.getBool("speech_mute"); bool subtitles = ConfMan.getBool("subtitles"); @@ -313,11 +315,12 @@ void KyraEngine::writeSettings() { break; } - if (!_configMusic) - _sound->beginFadeOut(); - - _sound->enableMusic(_configMusic); - _sound->enableSFX(_configSounds); + if (_sound) { + if (!_configMusic) + _sound->beginFadeOut(); + _sound->enableMusic(_configMusic); + _sound->enableSFX(_configSounds); + } ConfMan.setBool("speech_mute", speechMute); ConfMan.setBool("subtitles", subtitles); diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index a865bf2c3b..18a4a52fe2 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -72,7 +72,7 @@ struct AudioDataStruct { // in the future we maybe merge some flags and/or create new ones enum kDebugLevels { kDebugLevelScriptFuncs = 1 << 0, // prints debug output of o#_* functions - kDebugLevelScript = 1 << 1, // prints debug output of "ScriptHelper" functions + kDebugLevelScript = 1 << 1, // prints debug output of "EMCInterpreter" functions kDebugLevelSprites = 1 << 2, // prints debug output of "Sprites" functions kDebugLevelScreen = 1 << 3, // prints debug output of "Screen" functions kDebugLevelSound = 1 << 4, // prints debug output of "Sound" functions @@ -175,7 +175,7 @@ protected: TextDisplayer *_text; StaticResource *_staticres; TimerManager *_timer; - ScriptHelper *_scriptInterpreter; + EMCInterpreter *_emc; // config specific virtual void registerDefaultSettings(); diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 3d10710b16..182f52fa3c 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -81,10 +81,6 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags) _sprites = 0; _animator = 0; _seq = 0; - _npcScriptData = 0; - _scriptMain = 0; - _scriptClickData = 0; - _scriptClick = 0; _characterList = 0; _movFacingTable = 0; _buttonData = 0; @@ -94,7 +90,6 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags) _finalA = _finalB = _finalC = 0; _endSequenceBackUpRect = 0; memset(_panPagesTable, 0, sizeof(_panPagesTable)); - _npcScriptData = _scriptClickData = 0; memset(_sceneAnimTable, 0, sizeof(_sceneAnimTable)); _currHeadShape = 0; @@ -110,9 +105,9 @@ KyraEngine_v1::~KyraEngine_v1() { } closeFinalWsa(); - if (_scriptInterpreter) { - _scriptInterpreter->unloadScript(_npcScriptData); - _scriptInterpreter->unloadScript(_scriptClickData); + if (_emc) { + _emc->unload(&_npcScriptData); + _emc->unload(&_scriptClickData); } Common::clearAllSpecialDebugLevels(); @@ -123,12 +118,6 @@ KyraEngine_v1::~KyraEngine_v1() { delete _animator; delete _seq; - delete _npcScriptData; - delete _scriptMain; - - delete _scriptClickData; - delete _scriptClick; - delete [] _characterList; delete [] _movFacingTable; @@ -212,23 +201,12 @@ int KyraEngine_v1::init() { _characterList[0].facing = 3; _characterList[0].currentAnimFrame = 7; - _npcScriptData = new ScriptData; - memset(_npcScriptData, 0, sizeof(ScriptData)); - assert(_npcScriptData); - _npcScript = new ScriptState; - assert(_npcScript); - memset(_npcScript, 0, sizeof(ScriptState)); - - _scriptMain = new ScriptState; - assert(_scriptMain); - memset(_scriptMain, 0, sizeof(ScriptState)); + memset(&_npcScriptData, 0, sizeof(EMCData)); + memset(&_scriptClickData, 0, sizeof(EMCData)); - _scriptClickData = new ScriptData; - assert(_scriptClickData); - memset(_scriptClickData, 0, sizeof(ScriptData)); - _scriptClick = new ScriptState; - assert(_scriptClick); - memset(_scriptClick, 0, sizeof(ScriptState)); + memset(&_npcScript, 0, sizeof(EMCState)); + memset(&_scriptMain, 0, sizeof(EMCState)); + memset(&_scriptClick, 0, sizeof(EMCState)); _debugger = new Debugger_v1(this); assert(_debugger); @@ -387,19 +365,19 @@ void KyraEngine_v1::startup() { _animator->initAnimStateList(); setCharactersInDefaultScene(); - if (!_scriptInterpreter->loadScript("_STARTUP.EMC", _npcScriptData, &_opcodes)) + if (!_emc->load("_STARTUP.EMC", &_npcScriptData, &_opcodes)) error("Could not load \"_STARTUP.EMC\" script"); - _scriptInterpreter->initScript(_scriptMain, _npcScriptData); + _emc->init(&_scriptMain, &_npcScriptData); - if (!_scriptInterpreter->startScript(_scriptMain, 0)) + if (!_emc->start(&_scriptMain, 0)) error("Could not start script function 0 of script \"_STARTUP.EMC\""); - while (_scriptInterpreter->validScript(_scriptMain)) - _scriptInterpreter->runScript(_scriptMain); + while (_emc->isValid(&_scriptMain)) + _emc->run(&_scriptMain); - _scriptInterpreter->unloadScript(_npcScriptData); + _emc->unload(&_npcScriptData); - if (!_scriptInterpreter->loadScript("_NPC.EMC", _npcScriptData, &_opcodes)) + if (!_emc->load("_NPC.EMC", &_npcScriptData, &_opcodes)) error("Could not load \"_NPC.EMC\" script"); snd_playTheme(1, -1); @@ -785,17 +763,17 @@ int KyraEngine_v1::processInputHelper(int xpos, int ypos) { int KyraEngine_v1::clickEventHandler(int xpos, int ypos) { debugC(9, kDebugLevelMain, "KyraEngine_v1::clickEventHandler(%d, %d)", xpos, ypos); - _scriptInterpreter->initScript(_scriptClick, _scriptClickData); - _scriptClick->regs[1] = xpos; - _scriptClick->regs[2] = ypos; - _scriptClick->regs[3] = 0; - _scriptClick->regs[4] = _itemInHand; - _scriptInterpreter->startScript(_scriptClick, 1); + _emc->init(&_scriptClick, &_scriptClickData); + _scriptClick.regs[1] = xpos; + _scriptClick.regs[2] = ypos; + _scriptClick.regs[3] = 0; + _scriptClick.regs[4] = _itemInHand; + _emc->start(&_scriptClick, 1); - while (_scriptInterpreter->validScript(_scriptClick)) - _scriptInterpreter->runScript(_scriptClick); + while (_emc->isValid(&_scriptClick)) + _emc->run(&_scriptClick); - return _scriptClick->regs[3]; + return _scriptClick.regs[3]; } void KyraEngine_v1::updateMousePointer(bool forceUpdate) { @@ -929,15 +907,15 @@ void KyraEngine_v1::clickEventHandler2() { Common::Point mouse = getMousePos(); - _scriptInterpreter->initScript(_scriptClick, _scriptClickData); - _scriptClick->regs[0] = _currentCharacter->sceneId; - _scriptClick->regs[1] = mouse.x; - _scriptClick->regs[2] = mouse.y; - _scriptClick->regs[4] = _itemInHand; - _scriptInterpreter->startScript(_scriptClick, 6); + _emc->init(&_scriptClick, &_scriptClickData); + _scriptClick.regs[0] = _currentCharacter->sceneId; + _scriptClick.regs[1] = mouse.x; + _scriptClick.regs[2] = mouse.y; + _scriptClick.regs[4] = _itemInHand; + _emc->start(&_scriptClick, 6); - while (_scriptInterpreter->validScript(_scriptClick)) - _scriptInterpreter->runScript(_scriptClick); + while (_emc->isValid(&_scriptClick)) + _emc->run(&_scriptClick); } int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) { @@ -991,14 +969,14 @@ int KyraEngine_v1::checkForNPCScriptRun(int xpos, int ypos) { void KyraEngine_v1::runNpcScript(int func) { debugC(9, kDebugLevelMain, "KyraEngine_v1::runNpcScript(%d)", func); - _scriptInterpreter->initScript(_npcScript, _npcScriptData); - _scriptInterpreter->startScript(_npcScript, func); - _npcScript->regs[0] = _currentCharacter->sceneId; - _npcScript->regs[4] = _itemInHand; - _npcScript->regs[5] = func; - - while (_scriptInterpreter->validScript(_npcScript)) - _scriptInterpreter->runScript(_npcScript); + _emc->init(&_npcScript, &_npcScriptData); + _emc->start(&_npcScript, func); + _npcScript.regs[0] = _currentCharacter->sceneId; + _npcScript.regs[4] = _itemInHand; + _npcScript.regs[5] = func; + + while (_emc->isValid(&_npcScript)) + _emc->run(&_npcScript); } void KyraEngine_v1::checkAmuletAnimFlags() { diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 4adaf21838..1805efc127 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -482,13 +482,13 @@ protected: Screen_v1 *_screen; Debugger *_debugger; - ScriptState *_scriptMain; + EMCState _scriptMain; - ScriptState *_npcScript; - ScriptData *_npcScriptData; + EMCState _npcScript; + EMCData _npcScriptData; - ScriptState *_scriptClick; - ScriptData *_scriptClickData; + EMCState _scriptClick; + EMCData _scriptClickData; Character *_characterList; Character *_currentCharacter; @@ -656,163 +656,163 @@ protected: 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); + int o1_magicInMouseItem(EMCState *script); + int o1_characterSays(EMCState *script); + int o1_pauseTicks(EMCState *script); + int o1_drawSceneAnimShape(EMCState *script); + int o1_queryGameFlag(EMCState *script); + int o1_setGameFlag(EMCState *script); + int o1_resetGameFlag(EMCState *script); + int o1_runNPCScript(EMCState *script); + int o1_setSpecialExitList(EMCState *script); + int o1_blockInWalkableRegion(EMCState *script); + int o1_blockOutWalkableRegion(EMCState *script); + int o1_walkPlayerToPoint(EMCState *script); + int o1_dropItemInScene(EMCState *script); + int o1_drawAnimShapeIntoScene(EMCState *script); + int o1_createMouseItem(EMCState *script); + int o1_savePageToDisk(EMCState *script); + int o1_sceneAnimOn(EMCState *script); + int o1_sceneAnimOff(EMCState *script); + int o1_getElapsedSeconds(EMCState *script); + int o1_mouseIsPointer(EMCState *script); + int o1_destroyMouseItem(EMCState *script); + int o1_runSceneAnimUntilDone(EMCState *script); + int o1_fadeSpecialPalette(EMCState *script); + int o1_playAdlibSound(EMCState *script); + int o1_playAdlibScore(EMCState *script); + int o1_phaseInSameScene(EMCState *script); + int o1_setScenePhasingFlag(EMCState *script); + int o1_resetScenePhasingFlag(EMCState *script); + int o1_queryScenePhasingFlag(EMCState *script); + int o1_sceneToDirection(EMCState *script); + int o1_setBirthstoneGem(EMCState *script); + int o1_placeItemInGenericMapScene(EMCState *script); + int o1_setBrandonStatusBit(EMCState *script); + int o1_pauseSeconds(EMCState *script); + int o1_getCharactersLocation(EMCState *script); + int o1_runNPCSubscript(EMCState *script); + int o1_magicOutMouseItem(EMCState *script); + int o1_internalAnimOn(EMCState *script); + int o1_forceBrandonToNormal(EMCState *script); + int o1_poisonDeathNow(EMCState *script); + int o1_setScaleMode(EMCState *script); + int o1_openWSAFile(EMCState *script); + int o1_closeWSAFile(EMCState *script); + int o1_runWSAFromBeginningToEnd(EMCState *script); + int o1_displayWSAFrame(EMCState *script); + int o1_enterNewScene(EMCState *script); + int o1_setSpecialEnterXAndY(EMCState *script); + int o1_runWSAFrames(EMCState *script); + int o1_popBrandonIntoScene(EMCState *script); + int o1_restoreAllObjectBackgrounds(EMCState *script); + int o1_setCustomPaletteRange(EMCState *script); + int o1_loadPageFromDisk(EMCState *script); + int o1_customPrintTalkString(EMCState *script); + int o1_restoreCustomPrintBackground(EMCState *script); + int o1_hideMouse(EMCState *script); + int o1_showMouse(EMCState *script); + int o1_getCharacterX(EMCState *script); + int o1_getCharacterY(EMCState *script); + int o1_changeCharactersFacing(EMCState *script); + int o1_copyWSARegion(EMCState *script); + int o1_printText(EMCState *script); + int o1_random(EMCState *script); + int o1_loadSoundFile(EMCState *script); + int o1_displayWSAFrameOnHidPage(EMCState *script); + int o1_displayWSASequentialFrames(EMCState *script); + int o1_drawCharacterStanding(EMCState *script); + int o1_internalAnimOff(EMCState *script); + int o1_changeCharactersXAndY(EMCState *script); + int o1_clearSceneAnimatorBeacon(EMCState *script); + int o1_querySceneAnimatorBeacon(EMCState *script); + int o1_refreshSceneAnimator(EMCState *script); + int o1_placeItemInOffScene(EMCState *script); + int o1_wipeDownMouseItem(EMCState *script); + int o1_placeCharacterInOtherScene(EMCState *script); + int o1_getKey(EMCState *script); + int o1_specificItemInInventory(EMCState *script); + int o1_popMobileNPCIntoScene(EMCState *script); + int o1_mobileCharacterInScene(EMCState *script); + int o1_hideMobileCharacter(EMCState *script); + int o1_unhideMobileCharacter(EMCState *script); + int o1_setCharactersLocation(EMCState *script); + int o1_walkCharacterToPoint(EMCState *script); + int o1_specialEventDisplayBrynnsNote(EMCState *script); + int o1_specialEventRemoveBrynnsNote(EMCState *script); + int o1_setLogicPage(EMCState *script); + int o1_fatPrint(EMCState *script); + int o1_preserveAllObjectBackgrounds(EMCState *script); + int o1_updateSceneAnimations(EMCState *script); + int o1_sceneAnimationActive(EMCState *script); + int o1_setCharactersMovementDelay(EMCState *script); + int o1_getCharactersFacing(EMCState *script); + int o1_bkgdScrollSceneAndMasksRight(EMCState *script); + int o1_dispelMagicAnimation(EMCState *script); + int o1_findBrightestFireberry(EMCState *script); + int o1_setFireberryGlowPalette(EMCState *script); + int o1_setDeathHandlerFlag(EMCState *script); + int o1_drinkPotionAnimation(EMCState *script); + int o1_makeAmuletAppear(EMCState *script); + int o1_drawItemShapeIntoScene(EMCState *script); + int o1_setCharactersCurrentFrame(EMCState *script); + int o1_waitForConfirmationMouseClick(EMCState *script); + int o1_pageFlip(EMCState *script); + int o1_setSceneFile(EMCState *script); + int o1_getItemInMarbleVase(EMCState *script); + int o1_setItemInMarbleVase(EMCState *script); + int o1_addItemToInventory(EMCState *script); + int o1_intPrint(EMCState *script); + int o1_shakeScreen(EMCState *script); + int o1_createAmuletJewel(EMCState *script); + int o1_setSceneAnimCurrXY(EMCState *script); + int o1_poisonBrandonAndRemaps(EMCState *script); + int o1_fillFlaskWithWater(EMCState *script); + int o1_getCharactersMovementDelay(EMCState *script); + int o1_getBirthstoneGem(EMCState *script); + int o1_queryBrandonStatusBit(EMCState *script); + int o1_playFluteAnimation(EMCState *script); + int o1_playWinterScrollSequence(EMCState *script); + int o1_getIdolGem(EMCState *script); + int o1_setIdolGem(EMCState *script); + int o1_totalItemsInScene(EMCState *script); + int o1_restoreBrandonsMovementDelay(EMCState *script); + int o1_setMousePos(EMCState *script); + int o1_getMouseState(EMCState *script); + int o1_setEntranceMouseCursorTrack(EMCState *script); + int o1_itemAppearsOnGround(EMCState *script); + int o1_setNoDrawShapesFlag(EMCState *script); + int o1_fadeEntirePalette(EMCState *script); + int o1_itemOnGroundHere(EMCState *script); + int o1_queryCauldronState(EMCState *script); + int o1_setCauldronState(EMCState *script); + int o1_queryCrystalState(EMCState *script); + int o1_setCrystalState(EMCState *script); + int o1_setPaletteRange(EMCState *script); + int o1_shrinkBrandonDown(EMCState *script); + int o1_growBrandonUp(EMCState *script); + int o1_setBrandonScaleXAndY(EMCState *script); + int o1_resetScaleMode(EMCState *script); + int o1_getScaleDepthTableValue(EMCState *script); + int o1_setScaleDepthTableValue(EMCState *script); + int o1_message(EMCState *script); + int o1_checkClickOnNPC(EMCState *script); + int o1_getFoyerItem(EMCState *script); + int o1_setFoyerItem(EMCState *script); + int o1_setNoItemDropRegion(EMCState *script); + int o1_walkMalcolmOn(EMCState *script); + int o1_passiveProtection(EMCState *script); + int o1_setPlayingLoop(EMCState *script); + int o1_brandonToStoneSequence(EMCState *script); + int o1_brandonHealingSequence(EMCState *script); + int o1_protectCommandLine(EMCState *script); + int o1_pauseMusicSeconds(EMCState *script); + int o1_resetMaskRegion(EMCState *script); + int o1_setPaletteChangeFlag(EMCState *script); + int o1_fillRect(EMCState *script); + int o1_dummy(EMCState *script); + int o1_vocUnload(EMCState *script); + int o1_vocLoad(EMCState *script); }; } // end of namespace Kyra diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 2d1ab536bc..8d4a64e1a7 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -584,17 +584,17 @@ bool KyraEngine_v2::handleInputUnkSub(int x, int y) { objectChat(getTableString(0xFC, _cCodeBuffer, 1), 0, 0x83, 0xFC); return true; } else { - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); + _emc->init(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[1] = x; _sceneScriptState.regs[2] = y; _sceneScriptState.regs[3] = 0; _sceneScriptState.regs[4] = _itemInHand; - _scriptInterpreter->startScript(&_sceneScriptState, 1); + _emc->start(&_sceneScriptState, 1); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); //XXXsys_unkKeyboad (flush? wait? whatever...) @@ -1205,16 +1205,18 @@ void KyraEngine_v2::runStartScript(int script, int unk1) { strcpy(filename, "_START0X.EMC"); filename[7] = script + '0'; - ScriptData scriptData; - ScriptState scriptState; + EMCData scriptData; + EMCState scriptState; + memset(&scriptData, 0, sizeof(EMCData)); + memset(&scriptState, 0, sizeof(EMCState)); - _scriptInterpreter->loadScript(filename, &scriptData, &_opcodes); - _scriptInterpreter->initScript(&scriptState, &scriptData); + _emc->load(filename, &scriptData, &_opcodes); + _emc->init(&scriptState, &scriptData); scriptState.regs[6] = unk1; - _scriptInterpreter->startScript(&scriptState, 0); - while (_scriptInterpreter->validScript(&scriptState)) - _scriptInterpreter->runScript(&scriptState); - _scriptInterpreter->unloadScript(&scriptData); + _emc->start(&scriptState, 0); + while (_emc->isValid(&scriptState)) + _emc->run(&scriptState); + _emc->unload(&scriptData); } void KyraEngine_v2::loadNPCScript() { @@ -1244,18 +1246,18 @@ void KyraEngine_v2::loadNPCScript() { }; } - _scriptInterpreter->loadScript(filename, &_npcScriptData, &_opcodes); + _emc->load(filename, &_npcScriptData, &_opcodes); } void KyraEngine_v2::runTemporaryScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload) { memset(&_temporaryScriptData, 0, sizeof(_temporaryScriptData)); memset(&_temporaryScriptState, 0, sizeof(_temporaryScriptState)); - if (!_scriptInterpreter->loadScript(filename, &_temporaryScriptData, &_opcodesTemporary)) + if (!_emc->load(filename, &_temporaryScriptData, &_opcodesTemporary)) error("Couldn't load temporary script '%s'", filename); - _scriptInterpreter->initScript(&_temporaryScriptState, &_temporaryScriptData); - _scriptInterpreter->startScript(&_temporaryScriptState, 0); + _emc->init(&_temporaryScriptState, &_temporaryScriptData); + _emc->start(&_temporaryScriptState, 0); _newShapeFlag = -1; @@ -1265,8 +1267,8 @@ void KyraEngine_v2::runTemporaryScript(const char *filename, int allowSkip, int _newShapeCount = 0; } - while (_scriptInterpreter->validScript(&_temporaryScriptState)) - _scriptInterpreter->runScript(&_temporaryScriptState); + while (_emc->isValid(&_temporaryScriptState)) + _emc->run(&_temporaryScriptState); uint8 *fileData = 0; @@ -1276,7 +1278,7 @@ void KyraEngine_v2::runTemporaryScript(const char *filename, int allowSkip, int fileData = _newShapeFiledata; if (!fileData) { - _scriptInterpreter->unloadScript(&_temporaryScriptData); + _emc->unload(&_temporaryScriptData); return; } @@ -1291,7 +1293,7 @@ void KyraEngine_v2::runTemporaryScript(const char *filename, int allowSkip, int _newShapeFiledata = 0; } - _scriptInterpreter->unloadScript(&_temporaryScriptData); + _emc->unload(&_temporaryScriptData); } #pragma mark - @@ -1639,15 +1641,15 @@ int KyraEngine_v2::initNewShapes(uint8 *filedata) { void KyraEngine_v2::processNewShapes(int allowSkip, int resetChar) { setCharacterAnimDim(_newShapeWidth, _newShapeHeight); - _scriptInterpreter->initScript(&_temporaryScriptState, &_temporaryScriptData); - _scriptInterpreter->startScript(&_temporaryScriptState, 1); + _emc->init(&_temporaryScriptState, &_temporaryScriptData); + _emc->start(&_temporaryScriptState, 1); resetSkipFlag(); - while (_scriptInterpreter->validScript(&_temporaryScriptState)) { + while (_emc->isValid(&_temporaryScriptState)) { _temporaryScriptExecBit = false; - while (_scriptInterpreter->validScript(&_temporaryScriptState) && !_temporaryScriptExecBit) - _scriptInterpreter->runScript(&_temporaryScriptState); + while (_emc->isValid(&_temporaryScriptState) && !_temporaryScriptExecBit) + _emc->run(&_temporaryScriptState); if (_newShapeAnimFrame < 0) continue; diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index 36ec1563ad..7cd1f609dd 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -410,7 +410,7 @@ protected: WSAMovieV2 *_sceneAnimMovie[10]; bool _specialSceneScriptState[10]; bool _specialSceneScriptStateBackup[10]; - ScriptState _sceneSpecialScripts[10]; + EMCState _sceneSpecialScripts[10]; uint32 _sceneSpecialScriptsTimer[10]; int _lastProcessedSceneScript; bool _specialSceneScriptRunFlag; @@ -771,8 +771,8 @@ protected: uint32 _chatEndTime; int _chatVocHigh, _chatVocLow; - ScriptData _chatScriptData; - ScriptState _chatScriptState; + EMCData _chatScriptData; + EMCState _chatScriptState; int chatGetType(const char *text); int chatCalcDuration(const char *text); @@ -886,171 +886,171 @@ protected: void displayInvWsaLastFrame(); // opcodes - int o2_setCharacterFacingRefresh(ScriptState *script); - int o2_setCharacterPos(ScriptState *script); - int o2_defineObject(ScriptState *script); - int o2_refreshCharacter(ScriptState *script); - int o2_getCharacterX(ScriptState *script); - int o2_getCharacterY(ScriptState *script); - int o2_getCharacterFacing(ScriptState *script); - int o2_getCharacterScene(ScriptState *script); - int o2_setSceneComment(ScriptState *script); - int o2_setCharacterAnimFrame(ScriptState *script); - int o2_setCharacterFacing(ScriptState *script); - int o2_trySceneChange(ScriptState *script); - int o2_moveCharacter(ScriptState *script); - int o2_customCharacterChat(ScriptState *script); - int o2_soundFadeOut(ScriptState *script); - int o2_showChapterMessage(ScriptState *script); - int o2_restoreTalkTextMessageBkgd(ScriptState *script); - int o2_wsaClose(ScriptState *script); - int o2_meanWhileScene(ScriptState *script); - int o2_backUpScreen(ScriptState *script); - int o2_restoreScreen(ScriptState *script); - int o2_displayWsaFrame(ScriptState *script); - int o2_displayWsaSequentialFramesLooping(ScriptState *script); - int o2_wsaOpen(ScriptState *script); - int o2_displayWsaSequentialFrames(ScriptState *script); - int o2_displayWsaSequence(ScriptState *script); - int o2_addItemToInventory(ScriptState *script); - int o2_drawShape(ScriptState *script); - int o2_addItemToCurScene(ScriptState *script); - int o2_checkForItem(ScriptState *script); - int o2_loadSoundFile(ScriptState *script); - int o2_removeItemSlotFromInventory(ScriptState *script); - int o2_defineItem(ScriptState *script); - int o2_removeItemFromInventory(ScriptState *script); - int o2_countItemInInventory(ScriptState *script); - int o2_countItemsInScene(ScriptState *script); - int o2_queryGameFlag(ScriptState *script); - int o2_resetGameFlag(ScriptState *script); - int o2_setGameFlag(ScriptState *script); - int o2_setHandItem(ScriptState *script); - int o2_removeHandItem(ScriptState *script); - int o2_handItemSet(ScriptState *script); - int o2_hideMouse(ScriptState *script); - int o2_addSpecialExit(ScriptState *script); - int o2_setMousePos(ScriptState *script); - int o2_showMouse(ScriptState *script); - int o2_wipeDownMouseItem(ScriptState *script); - int o2_getElapsedSecs(ScriptState *script); - int o2_getTimerDelay(ScriptState *script); - //int o2_playSoundEffect(ScriptState *script); - int o2_delaySecs(ScriptState *script); - int o2_delay(ScriptState *script); - int o2_setTimerDelay(ScriptState *script); - int o2_setScaleTableItem(ScriptState *script); - int o2_setDrawLayerTableItem(ScriptState *script); - int o2_setCharPalEntry(ScriptState *script); - int o2_loadZShapes(ScriptState *script); - int o2_drawSceneShape(ScriptState *script); - int o2_drawSceneShapeOnPage(ScriptState *script); - int o2_disableAnimObject(ScriptState *script); - int o2_enableAnimObject(ScriptState *script); - int o2_loadPalette384(ScriptState *script); - int o2_setPalette384(ScriptState *script); - int o2_restoreBackBuffer(ScriptState *script); - int o2_backUpInventoryGfx(ScriptState *script); - int o2_disableSceneAnim(ScriptState *script); - int o2_enableSceneAnim(ScriptState *script); - int o2_restoreInventoryGfx(ScriptState *script); - int o2_setSceneAnimPos2(ScriptState *script); - int o2_update(ScriptState *script); - int o2_fadeScenePal(ScriptState *script); - int o2_enterNewSceneEx(ScriptState *script); - int o2_switchScene(ScriptState *script); - int o2_getShapeFlag1(ScriptState *script); - int o2_setPathfinderFlag(ScriptState *script); - int o2_getSceneExitToFacing(ScriptState *script); - int o2_setLayerFlag(ScriptState *script); - int o2_setZanthiaPos(ScriptState *script); - int o2_loadMusicTrack(ScriptState *script); - int o2_playWanderScoreViaMap(ScriptState *script); - int o2_playSoundEffect(ScriptState *script); - int o2_setSceneAnimPos(ScriptState *script); - int o2_blockInRegion(ScriptState *script); - int o2_blockOutRegion(ScriptState *script); - int o2_setCauldronState(ScriptState *script); - int o2_showItemString(ScriptState *script); - int o2_getRand(ScriptState *script); - int o2_isAnySoundPlaying(ScriptState *script); - int o2_setDeathHandlerFlag(ScriptState *script); - int o2_setDrawNoShapeFlag(ScriptState *script); - int o2_setRunFlag(ScriptState *script); - int o2_showLetter(ScriptState *script); - int o2_fillRect(ScriptState *script); - int o2_waitForConfirmationClick(ScriptState *script); - int o2_encodeShape(ScriptState *script); - int o2_defineRoomEntrance(ScriptState *script); - int o2_runTemporaryScript(ScriptState *script); - int o2_setSpecialSceneScriptRunTime(ScriptState *script); - int o2_defineSceneAnim(ScriptState *script); - int o2_updateSceneAnim(ScriptState *script); - int o2_addToSceneAnimPosAndUpdate(ScriptState *script); - int o2_useItemOnMainChar(ScriptState *script); - int o2_startDialogue(ScriptState *script); - int o2_zanthRandomChat(ScriptState *script); - int o2_setupDialogue(ScriptState *script); - int o2_getDlgIndex(ScriptState *script); - int o2_defineRoom(ScriptState *script); - int o2_addCauldronStateTableEntry(ScriptState *script); - int o2_setCountDown(ScriptState *script); - int o2_getCountDown(ScriptState *script); - int o2_pressColorKey(ScriptState *script); - int o2_objectChat(ScriptState *script); - int o2_chapterChange(ScriptState *script); - int o2_getColorCodeFlag1(ScriptState *script); - int o2_setColorCodeFlag1(ScriptState *script); - int o2_getColorCodeFlag2(ScriptState *script); - int o2_setColorCodeFlag2(ScriptState *script); - int o2_getColorCodeValue(ScriptState *script); - int o2_setColorCodeValue(ScriptState *script); - int o2_countItemInstances(ScriptState *script); - int o2_removeItemFromScene(ScriptState *script); - int o2_initObject(ScriptState *script); - int o2_npcChat(ScriptState *script); - int o2_deinitObject(ScriptState *script); - int o2_playTimSequence(ScriptState *script); - int o2_makeBookOrCauldronAppear(ScriptState *script); - int o2_setSpecialSceneScriptState(ScriptState *script); - int o2_clearSpecialSceneScriptState(ScriptState *script); - int o2_querySpecialSceneScriptState(ScriptState *script); - int o2_resetInputColorCode(ScriptState *script); - int o2_setHiddenItemsEntry(ScriptState *script); - int o2_getHiddenItemsEntry(ScriptState *script); - int o2_mushroomEffect(ScriptState *script); - int o2_customChat(ScriptState *script); - int o2_customChatFinish(ScriptState *script); - int o2_setupSceneAnimation(ScriptState *script); - int o2_stopSceneAnimation(ScriptState *script); - int o2_disableTimer(ScriptState *script); - int o2_enableTimer(ScriptState *script); - int o2_setTimerCountdown(ScriptState *script); - int o2_processPaletteIndex(ScriptState *script); - int o2_updateTwoSceneAnims(ScriptState *script); - int o2_getRainbowRoomData(ScriptState *script); - int o2_drawSceneShapeEx(ScriptState *script); - int o2_getBoolFromStack(ScriptState *script); - int o2_getSfxDriver(ScriptState *script); - int o2_getVocSupport(ScriptState *script); - int o2_getMusicDriver(ScriptState *script); - int o2_setVocHigh(ScriptState *script); - int o2_getVocHigh(ScriptState *script); - int o2_zanthiaChat(ScriptState *script); - int o2_isVoiceEnabled(ScriptState *script); - int o2_isVoicePlaying(ScriptState *script); - int o2_stopVoicePlaying(ScriptState *script); - int o2_getGameLanguage(ScriptState *script); - int o2_demoFinale(ScriptState *script); - int o2_dummy(ScriptState *script); + int o2_setCharacterFacingRefresh(EMCState *script); + int o2_setCharacterPos(EMCState *script); + int o2_defineObject(EMCState *script); + int o2_refreshCharacter(EMCState *script); + int o2_getCharacterX(EMCState *script); + int o2_getCharacterY(EMCState *script); + int o2_getCharacterFacing(EMCState *script); + int o2_getCharacterScene(EMCState *script); + int o2_setSceneComment(EMCState *script); + int o2_setCharacterAnimFrame(EMCState *script); + int o2_setCharacterFacing(EMCState *script); + int o2_trySceneChange(EMCState *script); + int o2_moveCharacter(EMCState *script); + int o2_customCharacterChat(EMCState *script); + int o2_soundFadeOut(EMCState *script); + int o2_showChapterMessage(EMCState *script); + int o2_restoreTalkTextMessageBkgd(EMCState *script); + int o2_wsaClose(EMCState *script); + int o2_meanWhileScene(EMCState *script); + int o2_backUpScreen(EMCState *script); + int o2_restoreScreen(EMCState *script); + int o2_displayWsaFrame(EMCState *script); + int o2_displayWsaSequentialFramesLooping(EMCState *script); + int o2_wsaOpen(EMCState *script); + int o2_displayWsaSequentialFrames(EMCState *script); + int o2_displayWsaSequence(EMCState *script); + int o2_addItemToInventory(EMCState *script); + int o2_drawShape(EMCState *script); + int o2_addItemToCurScene(EMCState *script); + int o2_checkForItem(EMCState *script); + int o2_loadSoundFile(EMCState *script); + int o2_removeItemSlotFromInventory(EMCState *script); + int o2_defineItem(EMCState *script); + int o2_removeItemFromInventory(EMCState *script); + int o2_countItemInInventory(EMCState *script); + int o2_countItemsInScene(EMCState *script); + int o2_queryGameFlag(EMCState *script); + int o2_resetGameFlag(EMCState *script); + int o2_setGameFlag(EMCState *script); + int o2_setHandItem(EMCState *script); + int o2_removeHandItem(EMCState *script); + int o2_handItemSet(EMCState *script); + int o2_hideMouse(EMCState *script); + int o2_addSpecialExit(EMCState *script); + int o2_setMousePos(EMCState *script); + int o2_showMouse(EMCState *script); + int o2_wipeDownMouseItem(EMCState *script); + int o2_getElapsedSecs(EMCState *script); + int o2_getTimerDelay(EMCState *script); + //int o2_playSoundEffect(EMCState *script); + int o2_delaySecs(EMCState *script); + int o2_delay(EMCState *script); + int o2_setTimerDelay(EMCState *script); + int o2_setScaleTableItem(EMCState *script); + int o2_setDrawLayerTableItem(EMCState *script); + int o2_setCharPalEntry(EMCState *script); + int o2_loadZShapes(EMCState *script); + int o2_drawSceneShape(EMCState *script); + int o2_drawSceneShapeOnPage(EMCState *script); + int o2_disableAnimObject(EMCState *script); + int o2_enableAnimObject(EMCState *script); + int o2_loadPalette384(EMCState *script); + int o2_setPalette384(EMCState *script); + int o2_restoreBackBuffer(EMCState *script); + int o2_backUpInventoryGfx(EMCState *script); + int o2_disableSceneAnim(EMCState *script); + int o2_enableSceneAnim(EMCState *script); + int o2_restoreInventoryGfx(EMCState *script); + int o2_setSceneAnimPos2(EMCState *script); + int o2_update(EMCState *script); + int o2_fadeScenePal(EMCState *script); + int o2_enterNewSceneEx(EMCState *script); + int o2_switchScene(EMCState *script); + int o2_getShapeFlag1(EMCState *script); + int o2_setPathfinderFlag(EMCState *script); + int o2_getSceneExitToFacing(EMCState *script); + int o2_setLayerFlag(EMCState *script); + int o2_setZanthiaPos(EMCState *script); + int o2_loadMusicTrack(EMCState *script); + int o2_playWanderScoreViaMap(EMCState *script); + int o2_playSoundEffect(EMCState *script); + int o2_setSceneAnimPos(EMCState *script); + int o2_blockInRegion(EMCState *script); + int o2_blockOutRegion(EMCState *script); + int o2_setCauldronState(EMCState *script); + int o2_showItemString(EMCState *script); + int o2_getRand(EMCState *script); + int o2_isAnySoundPlaying(EMCState *script); + int o2_setDeathHandlerFlag(EMCState *script); + int o2_setDrawNoShapeFlag(EMCState *script); + int o2_setRunFlag(EMCState *script); + int o2_showLetter(EMCState *script); + int o2_fillRect(EMCState *script); + int o2_waitForConfirmationClick(EMCState *script); + int o2_encodeShape(EMCState *script); + int o2_defineRoomEntrance(EMCState *script); + int o2_runTemporaryScript(EMCState *script); + int o2_setSpecialSceneScriptRunTime(EMCState *script); + int o2_defineSceneAnim(EMCState *script); + int o2_updateSceneAnim(EMCState *script); + int o2_addToSceneAnimPosAndUpdate(EMCState *script); + int o2_useItemOnMainChar(EMCState *script); + int o2_startDialogue(EMCState *script); + int o2_zanthRandomChat(EMCState *script); + int o2_setupDialogue(EMCState *script); + int o2_getDlgIndex(EMCState *script); + int o2_defineRoom(EMCState *script); + int o2_addCauldronStateTableEntry(EMCState *script); + int o2_setCountDown(EMCState *script); + int o2_getCountDown(EMCState *script); + int o2_pressColorKey(EMCState *script); + int o2_objectChat(EMCState *script); + int o2_chapterChange(EMCState *script); + int o2_getColorCodeFlag1(EMCState *script); + int o2_setColorCodeFlag1(EMCState *script); + int o2_getColorCodeFlag2(EMCState *script); + int o2_setColorCodeFlag2(EMCState *script); + int o2_getColorCodeValue(EMCState *script); + int o2_setColorCodeValue(EMCState *script); + int o2_countItemInstances(EMCState *script); + int o2_removeItemFromScene(EMCState *script); + int o2_initObject(EMCState *script); + int o2_npcChat(EMCState *script); + int o2_deinitObject(EMCState *script); + int o2_playTimSequence(EMCState *script); + int o2_makeBookOrCauldronAppear(EMCState *script); + int o2_setSpecialSceneScriptState(EMCState *script); + int o2_clearSpecialSceneScriptState(EMCState *script); + int o2_querySpecialSceneScriptState(EMCState *script); + int o2_resetInputColorCode(EMCState *script); + int o2_setHiddenItemsEntry(EMCState *script); + int o2_getHiddenItemsEntry(EMCState *script); + int o2_mushroomEffect(EMCState *script); + int o2_customChat(EMCState *script); + int o2_customChatFinish(EMCState *script); + int o2_setupSceneAnimation(EMCState *script); + int o2_stopSceneAnimation(EMCState *script); + int o2_disableTimer(EMCState *script); + int o2_enableTimer(EMCState *script); + int o2_setTimerCountdown(EMCState *script); + int o2_processPaletteIndex(EMCState *script); + int o2_updateTwoSceneAnims(EMCState *script); + int o2_getRainbowRoomData(EMCState *script); + int o2_drawSceneShapeEx(EMCState *script); + int o2_getBoolFromStack(EMCState *script); + int o2_getSfxDriver(EMCState *script); + int o2_getVocSupport(EMCState *script); + int o2_getMusicDriver(EMCState *script); + int o2_setVocHigh(EMCState *script); + int o2_getVocHigh(EMCState *script); + int o2_zanthiaChat(EMCState *script); + int o2_isVoiceEnabled(EMCState *script); + int o2_isVoicePlaying(EMCState *script); + int o2_stopVoicePlaying(EMCState *script); + int o2_getGameLanguage(EMCState *script); + int o2_demoFinale(EMCState *script); + int o2_dummy(EMCState *script); // opcodes temporary // TODO: rename it from temporary to something more appropriate - int o2t_defineNewShapes(ScriptState *script); - int o2t_setCurrentFrame(ScriptState *script); - int o2t_playSoundEffect(ScriptState *script); - int o2t_fadeScenePal(ScriptState *script); - int o2t_setShapeFlag(ScriptState *script); + int o2t_defineNewShapes(EMCState *script); + int o2t_setCurrentFrame(EMCState *script); + int o2t_playSoundEffect(EMCState *script); + int o2t_fadeScenePal(EMCState *script); + int o2t_setShapeFlag(EMCState *script); // script void runStartScript(int script, int unk1); @@ -1058,13 +1058,13 @@ protected: bool _noScriptEnter; - ScriptData _npcScriptData; + EMCData _npcScriptData; - ScriptData _sceneScriptData; - ScriptState _sceneScriptState; + EMCData _sceneScriptData; + EMCState _sceneScriptState; - ScriptData _temporaryScriptData; - ScriptState _temporaryScriptState; + EMCData _temporaryScriptData; + EMCState _temporaryScriptState; bool _temporaryScriptExecBit; Common::Array<const Opcode*> _opcodesTemporary; diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp index 9ca23d0a9d..1cfeaf3b71 100644 --- a/engines/kyra/kyra_v3.cpp +++ b/engines/kyra/kyra_v3.cpp @@ -176,7 +176,7 @@ KyraEngine_v3::~KyraEngine_v3() { } _gameShapes.clear(); - _scriptInterpreter->unloadScript(&_sceneScriptData); + _emc->unload(&_sceneScriptData); delete [] _sceneStrings; delete [] _talkObjectList; @@ -714,23 +714,23 @@ void KyraEngine_v3::initItems() { void KyraEngine_v3::runStartupScript(int script, int unk1) { debugC(9, kDebugLevelMain, "KyraEngine_v3::runStartupScript(%d, %d)", script, unk1); - ScriptState state; - ScriptData data; + EMCState state; + EMCData data; memset(&state, 0, sizeof(state)); memset(&data, 0, sizeof(data)); char filename[13]; strcpy(filename, "_START0X.EMC"); filename[7] = (script % 10) + '0'; - _scriptInterpreter->loadScript(filename, &data, &_opcodes); - _scriptInterpreter->initScript(&state, &data); - _scriptInterpreter->startScript(&state, 0); + _emc->load(filename, &data, &_opcodes); + _emc->init(&state, &data); + _emc->start(&state, 0); state.regs[6] = unk1; - while (_scriptInterpreter->validScript(&state)) - _scriptInterpreter->runScript(&state); + while (_emc->isValid(&state)) + _emc->run(&state); - _scriptInterpreter->unloadScript(&data); + _emc->unload(&data); } void KyraEngine_v3::openTalkFile(int file) { diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h index 3ea2130ef9..c666f25eba 100644 --- a/engines/kyra/kyra_v3.h +++ b/engines/kyra/kyra_v3.h @@ -459,12 +459,12 @@ private: int _sceneMinX, _sceneMaxX; int _maskPageMinY, _maskPageMaxY; - ScriptState _sceneScriptState; - ScriptData _sceneScriptData; + EMCState _sceneScriptState; + EMCData _sceneScriptData; bool _specialSceneScriptState[10]; bool _specialSceneScriptStateBackup[10]; - ScriptState _sceneSpecialScripts[10]; + EMCState _sceneSpecialScripts[10]; uint32 _sceneSpecialScriptsTimer[10]; int _lastProcessedSceneScript; bool _specialSceneScriptRunFlag; @@ -560,8 +560,8 @@ private: uint32 _chatEndTime; int _chatVocHigh, _chatVocLow; - ScriptData _chatScriptData; - ScriptState _chatScriptState; + EMCData _chatScriptData; + EMCState _chatScriptState; int chatGetType(const char *text); int chatCalcDuration(const char *text); @@ -596,8 +596,8 @@ private: bool _isStartupDialog; void processDialog(int vocHighIndex, int vocHighBase, int funcNum); - ScriptData _dialogScriptData; - ScriptState _dialogScriptState; + EMCData _dialogScriptData; + EMCState _dialogScriptState; int _dialogSceneAnim; int _dialogSceneScript; int _dialogScriptFuncStart, _dialogScriptFuncProc, _dialogScriptFuncEnd; @@ -609,8 +609,8 @@ private: Common::Array<const Opcode *> _opcodesDialog; - int o3d_updateAnim(ScriptState *script); - int o3d_delay(ScriptState *script); + int o3d_updateAnim(EMCState *script); + int o3d_delay(EMCState *script); void malcolmRandomChat(); void runDialog(int dlgIndex, int funcNum); @@ -640,12 +640,12 @@ private: Common::Array<const Opcode *> _opcodesTemporary; - int o3t_defineNewShapes(ScriptState *script); - int o3t_setCurrentFrame(ScriptState *script); - int o3t_setNewShapeFlag(ScriptState *script); + int o3t_defineNewShapes(EMCState *script); + int o3t_setCurrentFrame(EMCState *script); + int o3t_setNewShapeFlag(EMCState *script); - ScriptData _temporaryScriptData; - ScriptState _temporaryScriptState; + EMCData _temporaryScriptData; + EMCState _temporaryScriptState; void runTemporaryScript(const char *filename, int allowSkip, int resetChar, int newShapes, int shapeUnload); @@ -705,112 +705,112 @@ private: void loadGame(const char *fileName); // opcodes - int o3_getMalcolmShapes(ScriptState *script); - int o3_setCharacterPos(ScriptState *script); - int o3_defineObject(ScriptState *script); - int o3_refreshCharacter(ScriptState *script); - int o3_getCharacterX(ScriptState *script); - int o3_getCharacterY(ScriptState *script); - int o3_getCharacterFacing(ScriptState *script); - int o3_getCharacterScene(ScriptState *script); - int o3_getMalcolmsMood(ScriptState *script); - int o3_getCharacterFrameFromFacing(ScriptState *script); - int o3_setCharacterFacingOverwrite(ScriptState *script); - int o3_trySceneChange(ScriptState *script); - int o3_moveCharacter(ScriptState *script); - int o3_setCharacterFacing(ScriptState *script); - int o3_showSceneFileMessage(ScriptState *script); - int o3_setCharacterAnimFrameFromFacing(ScriptState *script); - int o3_showBadConscience(ScriptState *script); - int o3_hideBadConscience(ScriptState *script); - int o3_setInventorySlot(ScriptState *script); - int o3_getInventorySlot(ScriptState *script); - int o3_addItemToInventory(ScriptState *script); - int o3_addItemToCurScene(ScriptState *script); - int o3_objectChat(ScriptState *script); - int o3_checkForItem(ScriptState *script); - int o3_resetInventory(ScriptState *script); - int o3_defineItem(ScriptState *script); - int o3_removeInventoryItemInstances(ScriptState *script); - int o3_countInventoryItemInstances(ScriptState *script); - int o3_npcChatSequence(ScriptState *script); - int o3_queryGameFlag(ScriptState *script); - int o3_resetGameFlag(ScriptState *script); - int o3_setGameFlag(ScriptState *script); - int o3_setHandItem(ScriptState *script); - int o3_removeHandItem(ScriptState *script); - int o3_handItemSet(ScriptState *script); - int o3_hideMouse(ScriptState *script); - int o3_addSpecialExit(ScriptState *script); - int o3_setMousePos(ScriptState *script); - int o3_showMouse(ScriptState *script); - int o3_badConscienceChat(ScriptState *script); - int o3_wipeDownMouseItem(ScriptState *script); - int o3_setMalcolmsMood(ScriptState *script); - int o3_delay(ScriptState *script); - int o3_updateScore(ScriptState *script); - int o3_makeSecondChanceSave(ScriptState *script); - int o3_setSceneFilename(ScriptState *script); - int o3_removeItemsFromScene(ScriptState *script); - int o3_disguiseMalcolm(ScriptState *script); - int o3_drawSceneShape(ScriptState *script); - int o3_drawSceneShapeOnPage(ScriptState *script); - int o3_checkInRect(ScriptState *script); - int o3_updateConversations(ScriptState *script); - int o3_setSceneDim(ScriptState *script); - int o3_update(ScriptState *script); - int o3_setSceneAnimPosAndFrame(ScriptState *script); - int o3_removeItemInstances(ScriptState *script); - int o3_disableInventory(ScriptState *script); - int o3_enableInventory(ScriptState *script); - int o3_enterNewScene(ScriptState *script); - int o3_switchScene(ScriptState *script); - int o3_getShapeFlag1(ScriptState *script); - int o3_setMalcolmPos(ScriptState *script); - int o3_stopMusic(ScriptState *script); - int o3_playWanderScoreViaMap(ScriptState *script); - int o3_playSoundEffect(ScriptState *script); - int o3_getScore(ScriptState *script); - int o3_blockOutRegion(ScriptState *script); - int o3_showSceneStringsMessage(ScriptState *script); - int o3_getRand(ScriptState *script); - int o3_setDeathHandler(ScriptState *script); - int o3_showGoodConscience(ScriptState *script); - int o3_goodConscienceChat(ScriptState *script); - int o3_hideGoodConscience(ScriptState *script); - int o3_waitForConfirmationClick(ScriptState *script); - int o3_defineRoomEntrance(ScriptState *script); - int o3_runTemporaryScript(ScriptState *script); - int o3_setSpecialSceneScriptRunTime(ScriptState *script); - int o3_defineSceneAnim(ScriptState *script); - int o3_updateSceneAnim(ScriptState *script); - int o3_runActorScript(ScriptState *script); - int o3_runDialog(ScriptState *script); - int o3_malcolmRandomChat(ScriptState *script); - int o3_setDlgIndex(ScriptState *script); - int o3_getDlgIndex(ScriptState *script); - int o3_defineScene(ScriptState *script); - int o3_setConversationState(ScriptState *script); - int o3_getConversationState(ScriptState *script); - int o3_changeChapter(ScriptState *script); - int o3_countItemInstances(ScriptState *script); - int o3_dialogStartScript(ScriptState *script); - int o3_dialogEndScript(ScriptState *script); - int o3_setSpecialSceneScriptState(ScriptState *script); - int o3_clearSpecialSceneScriptState(ScriptState *script); - int o3_querySpecialSceneScriptState(ScriptState *script); - int o3_setHiddenItemsEntry(ScriptState *script); - int o3_getHiddenItemsEntry(ScriptState *script); - int o3_customChat(ScriptState *script); - int o3_customChatFinish(ScriptState *script); - int o3_setupSceneAnimObject(ScriptState *script); - int o3_removeSceneAnimObject(ScriptState *script); - int o3_disableTimer(ScriptState *script); - int o3_enableTimer(ScriptState *script); - int o3_setTimerCountdown(ScriptState *script); - int o3_setVocHigh(ScriptState *script); - int o3_getVocHigh(ScriptState *script); - int o3_dummy(ScriptState *script); + int o3_getMalcolmShapes(EMCState *script); + int o3_setCharacterPos(EMCState *script); + int o3_defineObject(EMCState *script); + int o3_refreshCharacter(EMCState *script); + int o3_getCharacterX(EMCState *script); + int o3_getCharacterY(EMCState *script); + int o3_getCharacterFacing(EMCState *script); + int o3_getCharacterScene(EMCState *script); + int o3_getMalcolmsMood(EMCState *script); + int o3_getCharacterFrameFromFacing(EMCState *script); + int o3_setCharacterFacingOverwrite(EMCState *script); + int o3_trySceneChange(EMCState *script); + int o3_moveCharacter(EMCState *script); + int o3_setCharacterFacing(EMCState *script); + int o3_showSceneFileMessage(EMCState *script); + int o3_setCharacterAnimFrameFromFacing(EMCState *script); + int o3_showBadConscience(EMCState *script); + int o3_hideBadConscience(EMCState *script); + int o3_setInventorySlot(EMCState *script); + int o3_getInventorySlot(EMCState *script); + int o3_addItemToInventory(EMCState *script); + int o3_addItemToCurScene(EMCState *script); + int o3_objectChat(EMCState *script); + int o3_checkForItem(EMCState *script); + int o3_resetInventory(EMCState *script); + int o3_defineItem(EMCState *script); + int o3_removeInventoryItemInstances(EMCState *script); + int o3_countInventoryItemInstances(EMCState *script); + int o3_npcChatSequence(EMCState *script); + int o3_queryGameFlag(EMCState *script); + int o3_resetGameFlag(EMCState *script); + int o3_setGameFlag(EMCState *script); + int o3_setHandItem(EMCState *script); + int o3_removeHandItem(EMCState *script); + int o3_handItemSet(EMCState *script); + int o3_hideMouse(EMCState *script); + int o3_addSpecialExit(EMCState *script); + int o3_setMousePos(EMCState *script); + int o3_showMouse(EMCState *script); + int o3_badConscienceChat(EMCState *script); + int o3_wipeDownMouseItem(EMCState *script); + int o3_setMalcolmsMood(EMCState *script); + int o3_delay(EMCState *script); + int o3_updateScore(EMCState *script); + int o3_makeSecondChanceSave(EMCState *script); + int o3_setSceneFilename(EMCState *script); + int o3_removeItemsFromScene(EMCState *script); + int o3_disguiseMalcolm(EMCState *script); + int o3_drawSceneShape(EMCState *script); + int o3_drawSceneShapeOnPage(EMCState *script); + int o3_checkInRect(EMCState *script); + int o3_updateConversations(EMCState *script); + int o3_setSceneDim(EMCState *script); + int o3_update(EMCState *script); + int o3_setSceneAnimPosAndFrame(EMCState *script); + int o3_removeItemInstances(EMCState *script); + int o3_disableInventory(EMCState *script); + int o3_enableInventory(EMCState *script); + int o3_enterNewScene(EMCState *script); + int o3_switchScene(EMCState *script); + int o3_getShapeFlag1(EMCState *script); + int o3_setMalcolmPos(EMCState *script); + int o3_stopMusic(EMCState *script); + int o3_playWanderScoreViaMap(EMCState *script); + int o3_playSoundEffect(EMCState *script); + int o3_getScore(EMCState *script); + int o3_blockOutRegion(EMCState *script); + int o3_showSceneStringsMessage(EMCState *script); + int o3_getRand(EMCState *script); + int o3_setDeathHandler(EMCState *script); + int o3_showGoodConscience(EMCState *script); + int o3_goodConscienceChat(EMCState *script); + int o3_hideGoodConscience(EMCState *script); + int o3_waitForConfirmationClick(EMCState *script); + int o3_defineRoomEntrance(EMCState *script); + int o3_runTemporaryScript(EMCState *script); + int o3_setSpecialSceneScriptRunTime(EMCState *script); + int o3_defineSceneAnim(EMCState *script); + int o3_updateSceneAnim(EMCState *script); + int o3_runActorScript(EMCState *script); + int o3_runDialog(EMCState *script); + int o3_malcolmRandomChat(EMCState *script); + int o3_setDlgIndex(EMCState *script); + int o3_getDlgIndex(EMCState *script); + int o3_defineScene(EMCState *script); + int o3_setConversationState(EMCState *script); + int o3_getConversationState(EMCState *script); + int o3_changeChapter(EMCState *script); + int o3_countItemInstances(EMCState *script); + int o3_dialogStartScript(EMCState *script); + int o3_dialogEndScript(EMCState *script); + int o3_setSpecialSceneScriptState(EMCState *script); + int o3_clearSpecialSceneScriptState(EMCState *script); + int o3_querySpecialSceneScriptState(EMCState *script); + int o3_setHiddenItemsEntry(EMCState *script); + int o3_getHiddenItemsEntry(EMCState *script); + int o3_customChat(EMCState *script); + int o3_customChatFinish(EMCState *script); + int o3_setupSceneAnimObject(EMCState *script); + int o3_removeSceneAnimObject(EMCState *script); + int o3_disableTimer(EMCState *script); + int o3_enableTimer(EMCState *script); + int o3_setTimerCountdown(EMCState *script); + int o3_setVocHigh(EMCState *script); + int o3_getVocHigh(EMCState *script); + int o3_dummy(EMCState *script); // misc TextDisplayer_v3 *_text; diff --git a/engines/kyra/scene_v1.cpp b/engines/kyra/scene_v1.cpp index c531ac11e5..e3af434a5b 100644 --- a/engines/kyra/scene_v1.cpp +++ b/engines/kyra/scene_v1.cpp @@ -135,10 +135,10 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i _movieObjects[i]->close(); if (!brandonAlive) { - _scriptInterpreter->initScript(_scriptClick, _scriptClickData); - _scriptInterpreter->startScript(_scriptClick, 5); - while (_scriptInterpreter->validScript(_scriptClick)) - _scriptInterpreter->runScript(_scriptClick); + _emc->init(&_scriptClick, &_scriptClickData); + _emc->start(&_scriptClick, 5); + while (_emc->isValid(&_scriptClick)) + _emc->run(&_scriptClick); } memset(_entranceMouseCursorTracks, 0xFFFF, sizeof(uint16)*4); @@ -159,7 +159,7 @@ void KyraEngine_v1::enterNewScene(int sceneId, int facing, int unk1, int unk2, i strcat(fileNameBuffer, ".DAT"); _sprites->loadDat(fileNameBuffer, _sceneExits); _sprites->setupSceneAnims(); - _scriptInterpreter->unloadScript(_scriptClickData); + _emc->unload(&_scriptClickData); loadSceneMsc(); _walkBlockNorth = currentRoom->northExit; @@ -424,18 +424,18 @@ void KyraEngine_v1::startSceneScript(int brandonAlive) { _scaleTable[i] = 256; clearNoDropRects(); - _scriptInterpreter->initScript(_scriptClick, _scriptClickData); + _emc->init(&_scriptClick, &_scriptClickData); strcpy(fileNameBuffer, _roomFilenameTable[tableId]); strcat(fileNameBuffer, ".EMC"); _res->exists(fileNameBuffer, true); - _scriptInterpreter->unloadScript(_scriptClickData); - _scriptInterpreter->loadScript(fileNameBuffer, _scriptClickData, &_opcodes); - _scriptInterpreter->startScript(_scriptClick, 0); - _scriptClick->regs[0] = _currentCharacter->sceneId; - _scriptClick->regs[7] = brandonAlive; - - while (_scriptInterpreter->validScript(_scriptClick)) - _scriptInterpreter->runScript(_scriptClick); + _emc->unload(&_scriptClickData); + _emc->load(fileNameBuffer, &_scriptClickData, &_opcodes); + _emc->start(&_scriptClick, 0); + _scriptClick.regs[0] = _currentCharacter->sceneId; + _scriptClick.regs[7] = brandonAlive; + + while (_emc->isValid(&_scriptClick)) + _emc->run(&_scriptClick); } void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) { @@ -601,11 +601,11 @@ void KyraEngine_v1::initSceneData(int facing, int unk1, int brandonAlive) { if (unk1 && brandonAlive == 0) moveCharacterToPos(0, facing, xpos2, ypos2); - _scriptClick->regs[4] = _itemInHand; - _scriptClick->regs[7] = brandonAlive; - _scriptInterpreter->startScript(_scriptClick, 3); - while (_scriptInterpreter->validScript(_scriptClick)) - _scriptInterpreter->runScript(_scriptClick); + _scriptClick.regs[4] = _itemInHand; + _scriptClick.regs[7] = brandonAlive; + _emc->start(&_scriptClick, 3); + while (_emc->isValid(&_scriptClick)) + _emc->run(&_scriptClick); } void KyraEngine_v1::initSceneObjectList(int brandonAlive) { @@ -827,13 +827,13 @@ void KyraEngine_v1::initSceneScreen(int brandonAlive) { } } - if (!_scriptInterpreter->startScript(_scriptClick, 2)) + if (!_emc->start(&_scriptClick, 2)) error("Could not start script function 2 of scene script"); - _scriptClick->regs[7] = brandonAlive; + _scriptClick.regs[7] = brandonAlive; - while (_scriptInterpreter->validScript(_scriptClick)) - _scriptInterpreter->runScript(_scriptClick); + while (_emc->isValid(&_scriptClick)) + _emc->run(&_scriptClick); setTextFadeTimerCountdown(-1); if (_currentCharacter->sceneId == 210) { diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp index 80353eb468..f46d993719 100644 --- a/engines/kyra/scene_v2.cpp +++ b/engines/kyra/scene_v2.cpp @@ -91,10 +91,10 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk _chatAltFlag = false; if (!unk3) { - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); - _scriptInterpreter->startScript(&_sceneScriptState, 5); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->init(&_sceneScriptState, &_sceneScriptData); + _emc->start(&_sceneScriptState, 5); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); } Common::for_each(_wsaSlots, _wsaSlots+ARRAYSIZE(_wsaSlots), Common::mem_fun(&WSAMovieV2::close)); @@ -391,7 +391,7 @@ int KyraEngine_v2::checkSceneChange() { void KyraEngine_v2::unloadScene() { debugC(9, kDebugLevelMain, "KyraEngine_v2::unloadScene()"); - _scriptInterpreter->unloadScript(&_sceneScriptData); + _emc->unload(&_sceneScriptData); freeSceneShapePtrs(); freeSceneAnims(); } @@ -446,27 +446,27 @@ void KyraEngine_v2::startSceneScript(int unk1) { _sceneEnterY4 = 72; _sceneCommentString = "Undefined scene comment string!"; - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); + _emc->init(&_sceneScriptState, &_sceneScriptData); strcpy(filename, _sceneList[sceneId].filename); strcat(filename, "."); strcat(filename, _scriptLangExt[(_flags.platform == Common::kPlatformPC && !_flags.isTalkie) ? 0 : _lang]); _res->exists(filename, true); - _scriptInterpreter->loadScript(filename, &_sceneScriptData, &_opcodes); + _emc->load(filename, &_sceneScriptData, &_opcodes); runSceneScript7(); - _scriptInterpreter->startScript(&_sceneScriptState, 0); + _emc->start(&_sceneScriptState, 0); _sceneScriptState.regs[0] = sceneId; _sceneScriptState.regs[5] = unk1; - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); memcpy(_gamePlayBuffer, _screen->getCPagePtr(3), 46080); for (int i = 0; i < 10; ++i) { - _scriptInterpreter->initScript(&_sceneSpecialScripts[i], &_sceneScriptData); - _scriptInterpreter->startScript(&_sceneSpecialScripts[i], i+8); + _emc->init(&_sceneSpecialScripts[i], &_sceneScriptData); + _emc->start(&_sceneSpecialScripts[i], i+8); _sceneSpecialScriptsTimer[i] = 0; } @@ -482,12 +482,12 @@ void KyraEngine_v2::startSceneScript(int unk1) { void KyraEngine_v2::runSceneScript2() { debugC(9, kDebugLevelMain, "KyraEngine_v2::runSceneScript2()"); - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); + _emc->init(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[4] = _itemInHand; - _scriptInterpreter->startScript(&_sceneScriptState, 2); + _emc->start(&_sceneScriptState, 2); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); } void KyraEngine_v2::runSceneScript4(int unk1) { @@ -495,23 +495,23 @@ void KyraEngine_v2::runSceneScript4(int unk1) { _sceneScriptState.regs[4] = _itemInHand; _sceneScriptState.regs[5] = unk1; - _scriptInterpreter->startScript(&_sceneScriptState, 4); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->start(&_sceneScriptState, 4); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); } void KyraEngine_v2::runSceneScript6() { debugC(9, kDebugLevelMain, "KyraEngine_v2::runSceneScript6()"); - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); + _emc->init(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[0] = _mainCharacter.sceneId; _sceneScriptState.regs[1] = _mouseX; _sceneScriptState.regs[2] = _mouseY; _sceneScriptState.regs[4] = _itemInHand; - _scriptInterpreter->startScript(&_sceneScriptState, 6); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->start(&_sceneScriptState, 6); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); } void KyraEngine_v2::runSceneScript7() { @@ -519,9 +519,9 @@ void KyraEngine_v2::runSceneScript7() { int oldPage = _screen->_curPage; _screen->_curPage = 2; - _scriptInterpreter->startScript(&_sceneScriptState, 7); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->start(&_sceneScriptState, 7); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); _screen->_curPage = oldPage; } @@ -706,10 +706,10 @@ void KyraEngine_v2::initSceneScreen(int unk1) { updateCharPal(0); - _scriptInterpreter->startScript(&_sceneScriptState, 3); + _emc->start(&_sceneScriptState, 3); _sceneScriptState.regs[5] = unk1; - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); } void KyraEngine_v2::updateSpecialSceneScripts() { @@ -723,13 +723,13 @@ void KyraEngine_v2::updateSpecialSceneScripts() { _specialSceneScriptRunFlag = true; while (_specialSceneScriptRunFlag && _sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis()) { - if (!_scriptInterpreter->runScript(&_sceneSpecialScripts[_lastProcessedSceneScript])) + if (!_emc->run(&_sceneSpecialScripts[_lastProcessedSceneScript])) _specialSceneScriptRunFlag = false; } } - if (!_scriptInterpreter->validScript(&_sceneSpecialScripts[_lastProcessedSceneScript])) { - _scriptInterpreter->startScript(&_sceneSpecialScripts[_lastProcessedSceneScript], 8+_lastProcessedSceneScript); + if (!_emc->isValid(&_sceneSpecialScripts[_lastProcessedSceneScript])) { + _emc->start(&_sceneSpecialScripts[_lastProcessedSceneScript], 8+_lastProcessedSceneScript); _specialSceneScriptRunFlag = false; } diff --git a/engines/kyra/scene_v3.cpp b/engines/kyra/scene_v3.cpp index 37a439ddce..b74e9da22e 100644 --- a/engines/kyra/scene_v3.cpp +++ b/engines/kyra/scene_v3.cpp @@ -91,10 +91,10 @@ void KyraEngine_v3::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2 //XXX if (!unk3) { - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); - _scriptInterpreter->startScript(&_sceneScriptState, 5); - while (_scriptInterpreter->validScript(&_sceneScriptState)) { - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->init(&_sceneScriptState, &_sceneScriptData); + _emc->start(&_sceneScriptState, 5); + while (_emc->isValid(&_sceneScriptState)) { + _emc->run(&_sceneScriptState); musicUpdate(0); } } @@ -313,7 +313,7 @@ void KyraEngine_v3::unloadScene() { delete [] _sceneStrings; _sceneStrings = 0; musicUpdate(0); - _scriptInterpreter->unloadScript(&_sceneScriptData); + _emc->unload(&_sceneScriptData); musicUpdate(0); freeSceneShapes(); musicUpdate(0); @@ -456,12 +456,12 @@ void KyraEngine_v3::initSceneScript(int unk1) { _sceneMinX = 0; _sceneMaxX = 319; - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); + _emc->init(&_sceneScriptState, &_sceneScriptData); strcpy(filename, scene.filename2); strcat(filename, ".EMC"); musicUpdate(0); _res->exists(filename, true); - _scriptInterpreter->loadScript(filename, &_sceneScriptData, &_opcodes); + _emc->load(filename, &_sceneScriptData, &_opcodes); strcpy(filename, scene.filename2); strcat(filename, "."); @@ -469,18 +469,18 @@ void KyraEngine_v3::initSceneScript(int unk1) { musicUpdate(0); runSceneScript8(); - _scriptInterpreter->startScript(&_sceneScriptState, 0); + _emc->start(&_sceneScriptState, 0); _sceneScriptState.regs[0] = _mainCharacter.sceneId; _sceneScriptState.regs[5] = unk1; - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); _screen->copyRegionToBuffer(3, 0, 0, 320, 200, _gamePlayBuffer); musicUpdate(0); for (int i = 0; i < 10; ++i) { - _scriptInterpreter->initScript(&_sceneSpecialScripts[i], &_sceneScriptData); - _scriptInterpreter->startScript(&_sceneSpecialScripts[i], i+9); + _emc->init(&_sceneSpecialScripts[i], &_sceneScriptData); + _emc->start(&_sceneSpecialScripts[i], i+9); musicUpdate(0); _sceneSpecialScriptsTimer[i] = 0; } @@ -642,11 +642,11 @@ void KyraEngine_v3::initSceneScreen(int unk1) { updateCharPal(0); if (1/*!_menuDirectlyToLoad*/) { - _scriptInterpreter->startScript(&_sceneScriptState, 3); + _emc->start(&_sceneScriptState, 3); _sceneScriptState.regs[5] = unk1; - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); } } @@ -661,13 +661,13 @@ void KyraEngine_v3::updateSpecialSceneScripts() { _specialSceneScriptRunFlag = true; while (_specialSceneScriptRunFlag && _sceneSpecialScriptsTimer[_lastProcessedSceneScript] <= _system->getMillis()) { - if (!_scriptInterpreter->runScript(&_sceneSpecialScripts[_lastProcessedSceneScript])) + if (!_emc->run(&_sceneSpecialScripts[_lastProcessedSceneScript])) _specialSceneScriptRunFlag = false; } } - if (!_scriptInterpreter->validScript(&_sceneSpecialScripts[_lastProcessedSceneScript])) { - _scriptInterpreter->startScript(&_sceneSpecialScripts[_lastProcessedSceneScript], 9+_lastProcessedSceneScript); + if (!_emc->isValid(&_sceneSpecialScripts[_lastProcessedSceneScript])) { + _emc->start(&_sceneSpecialScripts[_lastProcessedSceneScript], 9+_lastProcessedSceneScript); _specialSceneScriptRunFlag = false; } @@ -798,15 +798,15 @@ int KyraEngine_v3::runSceneScript1(int x, int y) { if (_deathHandler >= 0) return 0; - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); + _emc->init(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[1] = x; _sceneScriptState.regs[2] = y; _sceneScriptState.regs[3] = 0; _sceneScriptState.regs[4] = _itemInHand; - _scriptInterpreter->startScript(&_sceneScriptState, 1); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->start(&_sceneScriptState, 1); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); return _sceneScriptState.regs[3]; } @@ -818,9 +818,9 @@ int KyraEngine_v3::runSceneScript2() { _sceneScriptState.regs[3] = 0; _sceneScriptState.regs[4] = _itemInHand; - _scriptInterpreter->startScript(&_sceneScriptState, 2); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->start(&_sceneScriptState, 2); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); return _sceneScriptState.regs[3]; } @@ -832,9 +832,9 @@ void KyraEngine_v3::runSceneScript4(int unk1) { _sceneScriptState.regs[3] = 0; _noStartupChat = false; - _scriptInterpreter->startScript(&_sceneScriptState, 4); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->start(&_sceneScriptState, 4); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); if (_sceneScriptState.regs[3]) _noStartupChat = true; @@ -842,24 +842,24 @@ void KyraEngine_v3::runSceneScript4(int unk1) { void KyraEngine_v3::runSceneScript6() { debugC(9, kDebugLevelMain, "KyraEngine_v3::runSceneScript6()"); - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); + _emc->init(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[0] = _mainCharacter.sceneId; _sceneScriptState.regs[1] = _mouseX; _sceneScriptState.regs[2] = _mouseY; _sceneScriptState.regs[3] = _itemInHand; - _scriptInterpreter->startScript(&_sceneScriptState, 6); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->start(&_sceneScriptState, 6); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); } void KyraEngine_v3::runSceneScript8() { debugC(9, kDebugLevelMain, "KyraEngine_v3::runSceneScript8()"); - _scriptInterpreter->startScript(&_sceneScriptState, 8); - while (_scriptInterpreter->validScript(&_sceneScriptState)) { + _emc->start(&_sceneScriptState, 8); + while (_emc->isValid(&_sceneScriptState)) { musicUpdate(0); - _scriptInterpreter->runScript(&_sceneScriptState); + _emc->run(&_sceneScriptState); } } diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp index 8db71a7b5e..e9dc34e581 100644 --- a/engines/kyra/script.cpp +++ b/engines/kyra/script.cpp @@ -33,8 +33,8 @@ #include "kyra/script.h" namespace Kyra { -ScriptHelper::ScriptHelper(KyraEngine *vm) : _vm(vm) { -#define COMMAND(x) { &ScriptHelper::x, #x } +EMCInterpreter::EMCInterpreter(KyraEngine *vm) : _vm(vm) { +#define COMMAND(x) { &EMCInterpreter::x, #x } static CommandEntry commandProcs[] = { // 0x00 COMMAND(cmd_jmpTo), @@ -65,14 +65,14 @@ ScriptHelper::ScriptHelper(KyraEngine *vm) : _vm(vm) { #undef COMMAND } -bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, const Common::Array<const Opcode*> *opcodes) { +bool EMCInterpreter::load(const char *filename, EMCData *scriptData, const Common::Array<const Opcode*> *opcodes) { ScriptFileParser file(filename, _vm->resource()); if (!file) { error("Couldn't open script file '%s'", filename); return false; } - memset(scriptData, 0, sizeof(ScriptData)); + memset(scriptData, 0, sizeof(EMCData)); uint32 formBlockSize = file.getFORMBlockSize(); if (formBlockSize == (uint32)-1) { @@ -85,7 +85,7 @@ bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, cons scriptData->text = new byte[chunkSize]; if (!file.loadIFFBlock(TEXT_CHUNK, scriptData->text, chunkSize)) { - unloadScript(scriptData); + unload(scriptData); error("Couldn't load TEXT chunk from file: '%s'", filename); return false; } @@ -93,7 +93,7 @@ bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, cons chunkSize = file.getIFFBlockSize(ORDR_CHUNK); if (chunkSize == (uint32)-1) { - unloadScript(scriptData); + unload(scriptData); error("No ORDR chunk found in file: '%s'", filename); return false; } @@ -102,7 +102,7 @@ bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, cons scriptData->ordr = new uint16[chunkSize]; if (!file.loadIFFBlock(ORDR_CHUNK, scriptData->ordr, chunkSize << 1)) { - unloadScript(scriptData); + unload(scriptData); error("Couldn't load ORDR chunk from file: '%s'", filename); return false; } @@ -112,7 +112,7 @@ bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, cons chunkSize = file.getIFFBlockSize(DATA_CHUNK); if (chunkSize == (uint32)-1) { - unloadScript(scriptData); + unload(scriptData); error("No DATA chunk found in file: '%s'", filename); return false; } @@ -121,7 +121,7 @@ bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, cons scriptData->data = new uint16[chunkSize]; if (!file.loadIFFBlock(DATA_CHUNK, scriptData->data, chunkSize << 1)) { - unloadScript(scriptData); + unload(scriptData); error("Couldn't load DATA chunk from file: '%s'", filename); return false; } @@ -135,7 +135,7 @@ bool ScriptHelper::loadScript(const char *filename, ScriptData *scriptData, cons return true; } -void ScriptHelper::unloadScript(ScriptData *data) { +void EMCInterpreter::unload(EMCData *data) { if (!data) return; @@ -147,7 +147,7 @@ void ScriptHelper::unloadScript(ScriptData *data) { data->ordr = data->data = 0; } -void ScriptHelper::initScript(ScriptState *scriptStat, const ScriptData *data) { +void EMCInterpreter::init(EMCState *scriptStat, const EMCData *data) { scriptStat->dataPtr = data; scriptStat->ip = 0; scriptStat->stack[60] = 0; @@ -155,7 +155,7 @@ void ScriptHelper::initScript(ScriptState *scriptStat, const ScriptData *data) { scriptStat->sp = 60; } -bool ScriptHelper::startScript(ScriptState *script, int function) { +bool EMCInterpreter::start(EMCState *script, int function) { if (!script->dataPtr) return false; @@ -175,13 +175,13 @@ bool ScriptHelper::startScript(ScriptState *script, int function) { return true; } -bool ScriptHelper::validScript(ScriptState *script) { +bool EMCInterpreter::isValid(EMCState *script) { if (!script->ip || !script->dataPtr || _vm->quit()) return false; return true; } -bool ScriptHelper::runScript(ScriptState *script) { +bool EMCInterpreter::run(EMCState *script) { _parameter = 0; if (!script->ip) @@ -207,7 +207,7 @@ bool ScriptHelper::runScript(ScriptState *script) { if (opcode > 18) { error("Script unknown command: %d", opcode); } else { - debugC(5, kDebugLevelScript, "[0x%.08X] ScriptHelper::%s([%d/%u])", instOffset, _commands[opcode].desc, _parameter, (uint)_parameter); + debugC(5, kDebugLevelScript, "[0x%.08X] EMCInterpreter::%s([%d/%u])", instOffset, _commands[opcode].desc, _parameter, (uint)_parameter); (this->*(_commands[opcode].proc))(script); } @@ -295,15 +295,15 @@ bool ScriptFileParser::loadIFFBlock(const uint32 chunkName, void *loadTo, uint32 #pragma mark - Command implementations #pragma mark - -void ScriptHelper::cmd_jmpTo(ScriptState* script) { +void EMCInterpreter::cmd_jmpTo(EMCState* script) { script->ip = script->dataPtr->data + _parameter; } -void ScriptHelper::cmd_setRetValue(ScriptState* script) { +void EMCInterpreter::cmd_setRetValue(EMCState* script) { script->retValue = _parameter; } -void ScriptHelper::cmd_pushRetOrPos(ScriptState* script) { +void EMCInterpreter::cmd_pushRetOrPos(EMCState* script) { switch (_parameter) { case 0: script->stack[--script->sp] = script->retValue; @@ -321,23 +321,23 @@ void ScriptHelper::cmd_pushRetOrPos(ScriptState* script) { } } -void ScriptHelper::cmd_push(ScriptState* script) { +void EMCInterpreter::cmd_push(EMCState* script) { script->stack[--script->sp] = _parameter; } -void ScriptHelper::cmd_pushReg(ScriptState* script) { +void EMCInterpreter::cmd_pushReg(EMCState* script) { script->stack[--script->sp] = script->regs[_parameter]; } -void ScriptHelper::cmd_pushBPNeg(ScriptState* script) { +void EMCInterpreter::cmd_pushBPNeg(EMCState* script) { script->stack[--script->sp] = script->stack[(-(int32)(_parameter + 2)) + script->bp]; } -void ScriptHelper::cmd_pushBPAdd(ScriptState* script) { +void EMCInterpreter::cmd_pushBPAdd(EMCState* script) { script->stack[--script->sp] = script->stack[(_parameter - 1) + script->bp]; } -void ScriptHelper::cmd_popRetOrPos(ScriptState* script) { +void EMCInterpreter::cmd_popRetOrPos(EMCState* script) { switch (_parameter) { case 0: script->retValue = script->stack[script->sp++]; @@ -358,27 +358,27 @@ void ScriptHelper::cmd_popRetOrPos(ScriptState* script) { } } -void ScriptHelper::cmd_popReg(ScriptState* script) { +void EMCInterpreter::cmd_popReg(EMCState* script) { script->regs[_parameter] = script->stack[script->sp++]; } -void ScriptHelper::cmd_popBPNeg(ScriptState* script) { +void EMCInterpreter::cmd_popBPNeg(EMCState* script) { script->stack[(-(int32)(_parameter + 2)) + script->bp] = script->stack[script->sp++]; } -void ScriptHelper::cmd_popBPAdd(ScriptState* script) { +void EMCInterpreter::cmd_popBPAdd(EMCState* script) { script->stack[(_parameter - 1) + script->bp] = script->stack[script->sp++]; } -void ScriptHelper::cmd_addSP(ScriptState* script) { +void EMCInterpreter::cmd_addSP(EMCState* script) { script->sp += _parameter; } -void ScriptHelper::cmd_subSP(ScriptState* script) { +void EMCInterpreter::cmd_subSP(EMCState* script) { script->sp -= _parameter; } -void ScriptHelper::cmd_execOpcode(ScriptState* script) { +void EMCInterpreter::cmd_execOpcode(EMCState* script) { uint8 opcode = _parameter; assert(script->dataPtr->opcodes); @@ -392,14 +392,14 @@ void ScriptHelper::cmd_execOpcode(ScriptState* script) { } } -void ScriptHelper::cmd_ifNotJmp(ScriptState* script) { +void EMCInterpreter::cmd_ifNotJmp(EMCState* script) { if (!script->stack[script->sp++]) { _parameter &= 0x7FFF; script->ip = script->dataPtr->data + _parameter; } } -void ScriptHelper::cmd_negate(ScriptState* script) { +void EMCInterpreter::cmd_negate(EMCState* script) { int16 value = script->stack[script->sp]; switch (_parameter) { case 0: @@ -424,7 +424,7 @@ void ScriptHelper::cmd_negate(ScriptState* script) { } } -void ScriptHelper::cmd_eval(ScriptState* script) { +void EMCInterpreter::cmd_eval(EMCState* script) { int16 ret = 0; bool error = false; @@ -540,7 +540,7 @@ void ScriptHelper::cmd_eval(ScriptState* script) { script->stack[--script->sp] = ret; } -void ScriptHelper::cmd_setRetAndJmp(ScriptState* script) { +void EMCInterpreter::cmd_setRetAndJmp(EMCState* script) { if (script->sp >= 60) { script->ip = 0; } else { diff --git a/engines/kyra/script.h b/engines/kyra/script.h index bc92aebc5e..df86ec79c3 100644 --- a/engines/kyra/script.h +++ b/engines/kyra/script.h @@ -31,10 +31,10 @@ namespace Kyra { -struct ScriptState; -typedef Common::Functor1<ScriptState*, int> Opcode; +struct EMCState; +typedef Common::Functor1<EMCState*, int> Opcode; -struct ScriptData { +struct EMCData { byte *text; uint16 *data; uint16 *ordr; @@ -43,9 +43,9 @@ struct ScriptData { const Common::Array<const Opcode*> *opcodes; }; -struct ScriptState { +struct EMCState { uint16 *ip; - const ScriptData *dataPtr; + const EMCData *dataPtr; int16 retValue; uint16 bp; uint16 sp; @@ -87,24 +87,24 @@ private: uint32 _endOffset; }; -class ScriptHelper { +class EMCInterpreter { public: - ScriptHelper(KyraEngine *vm); + EMCInterpreter(KyraEngine *vm); - bool loadScript(const char *filename, ScriptData *data, const Common::Array<const Opcode*> *opcodes); - void unloadScript(ScriptData *data); + bool load(const char *filename, EMCData *data, const Common::Array<const Opcode*> *opcodes); + void unload(EMCData *data); - void initScript(ScriptState *scriptState, const ScriptData *data); - bool startScript(ScriptState *script, int function); + void init(EMCState *scriptState, const EMCData *data); + bool start(EMCState *script, int function); - bool validScript(ScriptState *script); + bool isValid(EMCState *script); - bool runScript(ScriptState *script); + bool run(EMCState *script); protected: KyraEngine *_vm; int16 _parameter; - typedef void (ScriptHelper::*CommandProc)(ScriptState*); + typedef void (EMCInterpreter::*CommandProc)(EMCState*); struct CommandEntry { CommandProc proc; const char *desc; @@ -112,24 +112,24 @@ protected: const CommandEntry *_commands; private: - void cmd_jmpTo(ScriptState*); - void cmd_setRetValue(ScriptState*); - void cmd_pushRetOrPos(ScriptState*); - void cmd_push(ScriptState*); - void cmd_pushReg(ScriptState*); - void cmd_pushBPNeg(ScriptState*); - void cmd_pushBPAdd(ScriptState*); - void cmd_popRetOrPos(ScriptState*); - void cmd_popReg(ScriptState*); - void cmd_popBPNeg(ScriptState*); - void cmd_popBPAdd(ScriptState*); - void cmd_addSP(ScriptState*); - void cmd_subSP(ScriptState*); - void cmd_execOpcode(ScriptState*); - void cmd_ifNotJmp(ScriptState*); - void cmd_negate(ScriptState*); - void cmd_eval(ScriptState*); - void cmd_setRetAndJmp(ScriptState*); + void cmd_jmpTo(EMCState*); + void cmd_setRetValue(EMCState*); + void cmd_pushRetOrPos(EMCState*); + void cmd_push(EMCState*); + void cmd_pushReg(EMCState*); + void cmd_pushBPNeg(EMCState*); + void cmd_pushBPAdd(EMCState*); + void cmd_popRetOrPos(EMCState*); + void cmd_popReg(EMCState*); + void cmd_popBPNeg(EMCState*); + void cmd_popBPAdd(EMCState*); + void cmd_addSP(EMCState*); + void cmd_subSP(EMCState*); + void cmd_execOpcode(EMCState*); + void cmd_ifNotJmp(EMCState*); + void cmd_negate(EMCState*); + void cmd_eval(EMCState*); + void cmd_setRetAndJmp(EMCState*); }; } // end of namespace Kyra diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp index 50ad1b8b0c..6f39e843e9 100644 --- a/engines/kyra/script_v1.cpp +++ b/engines/kyra/script_v1.cpp @@ -37,13 +37,13 @@ #include "kyra/timer.h" namespace Kyra { -int KyraEngine_v1::o1_magicInMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_magicInMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_magicInMouseItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); magicInMouseItem(stackPos(0), stackPos(1), -1); return 0; } -int KyraEngine_v1::o1_characterSays(ScriptState *script) { +int KyraEngine_v1::o1_characterSays(EMCState *script) { _skipFlag = false; if (_flags.isTalkie) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_characterSays(%p) (%d, '%s', %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3)); @@ -74,7 +74,7 @@ int KyraEngine_v1::o1_characterSays(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_pauseTicks(ScriptState *script) { +int KyraEngine_v1::o1_pauseTicks(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_pauseTicks(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); if (stackPos(1)) { warning("STUB: special o1_pauseTicks"); @@ -86,33 +86,33 @@ int KyraEngine_v1::o1_pauseTicks(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_drawSceneAnimShape(ScriptState *script) { +int KyraEngine_v1::o1_drawSceneAnimShape(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_queryGameFlag(ScriptState *script) { +int KyraEngine_v1::o1_queryGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_queryGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); return queryGameFlag(stackPos(0)); } -int KyraEngine_v1::o1_setGameFlag(ScriptState *script) { +int KyraEngine_v1::o1_setGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); return setGameFlag(stackPos(0)); } -int KyraEngine_v1::o1_resetGameFlag(ScriptState *script) { +int KyraEngine_v1::o1_resetGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_resetGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); return resetGameFlag(stackPos(0)); } -int KyraEngine_v1::o1_runNPCScript(ScriptState *script) { +int KyraEngine_v1::o1_runNPCScript(EMCState *script) { warning("STUB: o1_runNPCScript"); return 0; } -int KyraEngine_v1::o1_setSpecialExitList(ScriptState *script) { +int KyraEngine_v1::o1_setSpecialExitList(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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) @@ -122,19 +122,19 @@ int KyraEngine_v1::o1_setSpecialExitList(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_blockInWalkableRegion(ScriptState *script) { +int KyraEngine_v1::o1_blockInWalkableRegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_blockOutWalkableRegion(ScriptState *script) { +int KyraEngine_v1::o1_blockOutWalkableRegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_walkPlayerToPoint(ScriptState *script) { +int KyraEngine_v1::o1_walkPlayerToPoint(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_walkPlayerToPoint(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int normalTimers = stackPos(2); @@ -153,7 +153,7 @@ int KyraEngine_v1::o1_walkPlayerToPoint(ScriptState *script) { } if (reinitScript) - _scriptInterpreter->initScript(script, script->dataPtr); + _emc->init(script, script->dataPtr); if (_sceneChangeState) { _sceneChangeState = 0; @@ -162,7 +162,7 @@ int KyraEngine_v1::o1_walkPlayerToPoint(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_dropItemInScene(ScriptState *script) { +int KyraEngine_v1::o1_dropItemInScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_dropItemInScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); int item = stackPos(0); int xpos = stackPos(1); @@ -187,7 +187,7 @@ int KyraEngine_v1::o1_dropItemInScene(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_drawAnimShapeIntoScene(ScriptState *script) { +int KyraEngine_v1::o1_drawAnimShapeIntoScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_drawAnimShapeIntoScene(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); _screen->hideMouse(); _animator->restoreAllObjectBackgrounds(); @@ -205,49 +205,49 @@ int KyraEngine_v1::o1_drawAnimShapeIntoScene(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_createMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_createMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_createMouseItem(%p) (%d)", (const void *)script, stackPos(0)); createMouseItem(stackPos(0)); return 0; } -int KyraEngine_v1::o1_savePageToDisk(ScriptState *script) { +int KyraEngine_v1::o1_savePageToDisk(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_savePageToDisk(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); _screen->savePageToDisk(stackPosString(0), stackPos(1)); return 0; } -int KyraEngine_v1::o1_sceneAnimOn(ScriptState *script) { +int KyraEngine_v1::o1_sceneAnimOn(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_sceneAnimOn(%p) (%d)", (const void *)script, stackPos(0)); _sprites->_anims[stackPos(0)].play = true; return 0; } -int KyraEngine_v1::o1_sceneAnimOff(ScriptState *script) { +int KyraEngine_v1::o1_sceneAnimOff(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_sceneAnimOff(%p) (%d)", (const void *)script, stackPos(0)); _sprites->_anims[stackPos(0)].play = false; return 0; } -int KyraEngine_v1::o1_getElapsedSeconds(ScriptState *script) { +int KyraEngine_v1::o1_getElapsedSeconds(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getElapsedSeconds(%p) ()", (const void *)script); return _system->getMillis() / 1000; } -int KyraEngine_v1::o1_mouseIsPointer(ScriptState *script) { +int KyraEngine_v1::o1_mouseIsPointer(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_mouseIsPointer(%p) ()", (const void *)script); if (_itemInHand == -1) return 1; return 0; } -int KyraEngine_v1::o1_destroyMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_destroyMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_destroyMouseItem(%p) ()", (const void *)script); destroyMouseItem(); return 0; } -int KyraEngine_v1::o1_runSceneAnimUntilDone(ScriptState *script) { +int KyraEngine_v1::o1_runSceneAnimUntilDone(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_runSceneAnimUntilDone(%p) (%d)", (const void *)script, stackPos(0)); _screen->hideMouse(); _animator->restoreAllObjectBackgrounds(); @@ -265,7 +265,7 @@ int KyraEngine_v1::o1_runSceneAnimUntilDone(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_fadeSpecialPalette(ScriptState *script) { +int KyraEngine_v1::o1_fadeSpecialPalette(EMCState *script) { if (_flags.platform == Common::kPlatformAmiga) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_fadeSpecialPalette(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); if (_currentCharacter->sceneId != 45) { @@ -283,42 +283,42 @@ int KyraEngine_v1::o1_fadeSpecialPalette(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_playAdlibSound(ScriptState *script) { +int KyraEngine_v1::o1_playAdlibSound(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_playAdlibSound(%p) (%d)", (const void *)script, stackPos(0)); snd_playSoundEffect(stackPos(0)); return 0; } -int KyraEngine_v1::o1_playAdlibScore(ScriptState *script) { +int KyraEngine_v1::o1_playAdlibScore(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_playAdlibScore(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); snd_playWanderScoreViaMap(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v1::o1_phaseInSameScene(ScriptState *script) { +int KyraEngine_v1::o1_phaseInSameScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_phaseInSameScene(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); transcendScenes(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v1::o1_setScenePhasingFlag(ScriptState *script) { +int KyraEngine_v1::o1_setScenePhasingFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setScenePhasingFlag(%p) ()", (const void *)script); _scenePhasingFlag = 1; return 1; } -int KyraEngine_v1::o1_resetScenePhasingFlag(ScriptState *script) { +int KyraEngine_v1::o1_resetScenePhasingFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_resetScenePhasingFlag(%p) ()", (const void *)script); _scenePhasingFlag = 0; return 0; } -int KyraEngine_v1::o1_queryScenePhasingFlag(ScriptState *script) { +int KyraEngine_v1::o1_queryScenePhasingFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_queryScenePhasingFlag(%p) ()", (const void *)script); return _scenePhasingFlag; } -int KyraEngine_v1::o1_sceneToDirection(ScriptState *script) { +int KyraEngine_v1::o1_sceneToDirection(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_sceneToDirection(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < _roomTableSize); Room *curRoom = &_roomTable[stackPos(0)]; @@ -348,7 +348,7 @@ int KyraEngine_v1::o1_sceneToDirection(ScriptState *script) { return returnValue; } -int KyraEngine_v1::o1_setBirthstoneGem(ScriptState *script) { +int KyraEngine_v1::o1_setBirthstoneGem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setBirthstoneGem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int index = stackPos(0); if (index < 4 && index >= 0) { @@ -358,19 +358,19 @@ int KyraEngine_v1::o1_setBirthstoneGem(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_placeItemInGenericMapScene(ScriptState *script) { +int KyraEngine_v1::o1_placeItemInGenericMapScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_placeItemInGenericMapScene(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); placeItemInGenericMapScene(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v1::o1_setBrandonStatusBit(ScriptState *script) { +int KyraEngine_v1::o1_setBrandonStatusBit(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setBrandonStatusBit(%p) (%d)", (const void *)script, stackPos(0)); _brandonStatusBit |= stackPos(0); return 0; } -int KyraEngine_v1::o1_pauseSeconds(ScriptState *script) { +int KyraEngine_v1::o1_pauseSeconds(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_pauseSeconds(%p) (%d)", (const void *)script, stackPos(0)); if (stackPos(0) > 0 && !_skipFlag) delay(stackPos(0)*1000, true); @@ -378,41 +378,41 @@ int KyraEngine_v1::o1_pauseSeconds(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_getCharactersLocation(ScriptState *script) { +int KyraEngine_v1::o1_getCharactersLocation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getCharactersLocation(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].sceneId; } -int KyraEngine_v1::o1_runNPCSubscript(ScriptState *script) { +int KyraEngine_v1::o1_runNPCSubscript(EMCState *script) { warning("STUB: o1_runNPCSubscript"); return 0; } -int KyraEngine_v1::o1_magicOutMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_magicOutMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_magicOutMouseItem(%p) (%d)", (const void *)script, stackPos(0)); magicOutMouseItem(stackPos(0), -1); return 0; } -int KyraEngine_v1::o1_internalAnimOn(ScriptState *script) { +int KyraEngine_v1::o1_internalAnimOn(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_internalAnimOn(%p) (%d)", (const void *)script, stackPos(0)); _animator->sprites()[stackPos(0)].active = 1; return 0; } -int KyraEngine_v1::o1_forceBrandonToNormal(ScriptState *script) { +int KyraEngine_v1::o1_forceBrandonToNormal(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_forceBrandonToNormal(%p) ()", (const void *)script); checkAmuletAnimFlags(); return 0; } -int KyraEngine_v1::o1_poisonDeathNow(ScriptState *script) { +int KyraEngine_v1::o1_poisonDeathNow(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_poisonDeathNow(%p) ()", (const void *)script); seq_poisonDeathNow(1); return 0; } -int KyraEngine_v1::o1_setScaleMode(ScriptState *script) { +int KyraEngine_v1::o1_setScaleMode(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -430,7 +430,7 @@ int KyraEngine_v1::o1_setScaleMode(ScriptState *script) { return _scaleMode; } -int KyraEngine_v1::o1_openWSAFile(ScriptState *script) { +int KyraEngine_v1::o1_openWSAFile(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_openWSAFile(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3)); const char *filename = stackPosString(0); @@ -442,7 +442,7 @@ int KyraEngine_v1::o1_openWSAFile(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_closeWSAFile(ScriptState *script) { +int KyraEngine_v1::o1_closeWSAFile(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_closeWSAFile(%p) (%d)", (const void *)script, stackPos(0)); int wsaIndex = stackPos(0); @@ -452,7 +452,7 @@ int KyraEngine_v1::o1_closeWSAFile(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_runWSAFromBeginningToEnd(ScriptState *script) { +int KyraEngine_v1::o1_runWSAFromBeginningToEnd(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_runWSAFromBeginningToEnd(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); _screen->hideMouse(); @@ -493,7 +493,7 @@ int KyraEngine_v1::o1_runWSAFromBeginningToEnd(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_displayWSAFrame(ScriptState *script) { +int KyraEngine_v1::o1_displayWSAFrame(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -520,13 +520,13 @@ int KyraEngine_v1::o1_displayWSAFrame(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_enterNewScene(ScriptState *script) { +int KyraEngine_v1::o1_enterNewScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_setSpecialEnterXAndY(ScriptState *script) { +int KyraEngine_v1::o1_setSpecialEnterXAndY(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setSpecialEnterXAndY(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _brandonPosX = stackPos(0); _brandonPosY = stackPos(1); @@ -535,7 +535,7 @@ int KyraEngine_v1::o1_setSpecialEnterXAndY(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_runWSAFrames(ScriptState *script) { +int KyraEngine_v1::o1_runWSAFrames(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -562,7 +562,7 @@ int KyraEngine_v1::o1_runWSAFrames(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_popBrandonIntoScene(ScriptState *script) { +int KyraEngine_v1::o1_popBrandonIntoScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -611,7 +611,7 @@ int KyraEngine_v1::o1_popBrandonIntoScene(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_restoreAllObjectBackgrounds(ScriptState *script) { +int KyraEngine_v1::o1_restoreAllObjectBackgrounds(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_restoreAllObjectBackgrounds(%p) (%d)", (const void *)script, stackPos(0)); int disable = stackPos(0); int activeBackup = 0; @@ -625,20 +625,20 @@ int KyraEngine_v1::o1_restoreAllObjectBackgrounds(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_setCustomPaletteRange(ScriptState *script) { +int KyraEngine_v1::o1_setCustomPaletteRange(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_loadPageFromDisk(ScriptState *script) { +int KyraEngine_v1::o1_loadPageFromDisk(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_customPrintTalkString(ScriptState *script) { +int KyraEngine_v1::o1_customPrintTalkString(EMCState *script) { if (_flags.isTalkie) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_customPrintTalkString(%p) (%d, '%s', %d, %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4) & 0xFF); @@ -659,35 +659,35 @@ int KyraEngine_v1::o1_customPrintTalkString(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_restoreCustomPrintBackground(ScriptState *script) { +int KyraEngine_v1::o1_restoreCustomPrintBackground(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_restoreCustomPrintBackground(%p) ()", (const void *)script); _text->restoreTalkTextMessageBkgd(2, 0); return 0; } -int KyraEngine_v1::o1_hideMouse(ScriptState *script) { +int KyraEngine_v1::o1_hideMouse(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_hideMouse(%p) ()", (const void *)script); _screen->hideMouse(); return 0; } -int KyraEngine_v1::o1_showMouse(ScriptState *script) { +int KyraEngine_v1::o1_showMouse(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_showMouse(%p) ()", (const void *)script); _screen->showMouse(); return 0; } -int KyraEngine_v1::o1_getCharacterX(ScriptState *script) { +int KyraEngine_v1::o1_getCharacterX(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getCharacterX(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].x1; } -int KyraEngine_v1::o1_getCharacterY(ScriptState *script) { +int KyraEngine_v1::o1_getCharacterY(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getCharacterY(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].y1; } -int KyraEngine_v1::o1_changeCharactersFacing(ScriptState *script) { +int KyraEngine_v1::o1_changeCharactersFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_changeCharactersFacing(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); int character = stackPos(0); int facing = stackPos(1); @@ -705,7 +705,7 @@ int KyraEngine_v1::o1_changeCharactersFacing(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_copyWSARegion(ScriptState *script) { +int KyraEngine_v1::o1_copyWSARegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -718,7 +718,7 @@ int KyraEngine_v1::o1_copyWSARegion(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_printText(ScriptState *script) { +int KyraEngine_v1::o1_printText(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -728,18 +728,18 @@ int KyraEngine_v1::o1_printText(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_random(ScriptState *script) { +int KyraEngine_v1::o1_random(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_loadSoundFile(ScriptState *script) { +int KyraEngine_v1::o1_loadSoundFile(EMCState *script) { warning("STUB: o1_loadSoundFile"); return 0; } -int KyraEngine_v1::o1_displayWSAFrameOnHidPage(ScriptState *script) { +int KyraEngine_v1::o1_displayWSAFrameOnHidPage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -768,7 +768,7 @@ int KyraEngine_v1::o1_displayWSAFrameOnHidPage(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_displayWSASequentialFrames(ScriptState *script) { +int KyraEngine_v1::o1_displayWSASequentialFrames(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -844,7 +844,7 @@ int KyraEngine_v1::o1_displayWSASequentialFrames(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_drawCharacterStanding(ScriptState *script) { +int KyraEngine_v1::o1_drawCharacterStanding(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -859,13 +859,13 @@ int KyraEngine_v1::o1_drawCharacterStanding(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_internalAnimOff(ScriptState *script) { +int KyraEngine_v1::o1_internalAnimOff(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_internalAnimOff(%p) (%d)", (const void *)script, stackPos(0)); _animator->sprites()[stackPos(0)].active = 0; return 0; } -int KyraEngine_v1::o1_changeCharactersXAndY(ScriptState *script) { +int KyraEngine_v1::o1_changeCharactersXAndY(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_changeCharactersXAndY(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); Character *ch = &_characterList[stackPos(0)]; int16 x = stackPos(1); @@ -881,25 +881,25 @@ int KyraEngine_v1::o1_changeCharactersXAndY(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_clearSceneAnimatorBeacon(ScriptState *script) { +int KyraEngine_v1::o1_clearSceneAnimatorBeacon(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_clearSceneAnimatorBeacon(%p) ()", (const void *)script); _sprites->_sceneAnimatorBeaconFlag = 0; return 0; } -int KyraEngine_v1::o1_querySceneAnimatorBeacon(ScriptState *script) { +int KyraEngine_v1::o1_querySceneAnimatorBeacon(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_querySceneAnimatorBeacon(%p) ()", (const void *)script); return _sprites->_sceneAnimatorBeaconFlag; } -int KyraEngine_v1::o1_refreshSceneAnimator(ScriptState *script) { +int KyraEngine_v1::o1_refreshSceneAnimator(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_refreshSceneAnimator(%p) ()", (const void *)script); _sprites->updateSceneAnims(); _animator->updateAllObjectShapes(); return 0; } -int KyraEngine_v1::o1_placeItemInOffScene(ScriptState *script) { +int KyraEngine_v1::o1_placeItemInOffScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -918,7 +918,7 @@ int KyraEngine_v1::o1_placeItemInOffScene(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_wipeDownMouseItem(ScriptState *script) { +int KyraEngine_v1::o1_wipeDownMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_wipeDownMouseItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); _screen->hideMouse(); wipeDownMouseItem(stackPos(1), stackPos(2)); @@ -927,7 +927,7 @@ int KyraEngine_v1::o1_wipeDownMouseItem(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_placeCharacterInOtherScene(ScriptState *script) { +int KyraEngine_v1::o1_placeCharacterInOtherScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -944,18 +944,18 @@ int KyraEngine_v1::o1_placeCharacterInOtherScene(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_getKey(ScriptState *script) { +int KyraEngine_v1::o1_getKey(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getKey(%p) ()", (const void *)script); waitForEvent(); return 0; } -int KyraEngine_v1::o1_specificItemInInventory(ScriptState *script) { +int KyraEngine_v1::o1_specificItemInInventory(EMCState *script) { warning("STUB: o1_specificItemInInventory"); return 0; } -int KyraEngine_v1::o1_popMobileNPCIntoScene(ScriptState *script) { +int KyraEngine_v1::o1_popMobileNPCIntoScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -976,22 +976,22 @@ int KyraEngine_v1::o1_popMobileNPCIntoScene(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_mobileCharacterInScene(ScriptState *script) { +int KyraEngine_v1::o1_mobileCharacterInScene(EMCState *script) { warning("STUB: o1_mobileCharacterInScene"); return 0; } -int KyraEngine_v1::o1_hideMobileCharacter(ScriptState *script) { +int KyraEngine_v1::o1_hideMobileCharacter(EMCState *script) { warning("STUB: o1_hideMobileCharacter"); return 0; } -int KyraEngine_v1::o1_unhideMobileCharacter(ScriptState *script) { +int KyraEngine_v1::o1_unhideMobileCharacter(EMCState *script) { warning("STUB: o1_unhideMobileCharacter"); return 0; } -int KyraEngine_v1::o1_setCharactersLocation(ScriptState *script) { +int KyraEngine_v1::o1_setCharactersLocation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setCharactersLocation(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); Character *ch = &_characterList[stackPos(0)]; AnimObject *animObj = &_animator->actors()[stackPos(0)]; @@ -1008,7 +1008,7 @@ int KyraEngine_v1::o1_setCharactersLocation(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_walkCharacterToPoint(ScriptState *script) { +int KyraEngine_v1::o1_walkCharacterToPoint(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_walkCharacterToPoint(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); int character = stackPos(0); int toX = stackPos(1); @@ -1090,7 +1090,7 @@ int KyraEngine_v1::o1_walkCharacterToPoint(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_specialEventDisplayBrynnsNote(ScriptState *script) { +int KyraEngine_v1::o1_specialEventDisplayBrynnsNote(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_specialEventDisplayBrynnsNote(%p) ()", (const void *)script); _screen->hideMouse(); _screen->savePageToDisk("HIDPAGE.TMP", 2); @@ -1112,7 +1112,7 @@ int KyraEngine_v1::o1_specialEventDisplayBrynnsNote(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_specialEventRemoveBrynnsNote(ScriptState *script) { +int KyraEngine_v1::o1_specialEventRemoveBrynnsNote(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_specialEventRemoveBrynnsNote(%p) ()", (const void *)script); _screen->hideMouse(); _screen->loadPageFromDisk("SEENPAGE.TMP", 0); @@ -1123,13 +1123,13 @@ int KyraEngine_v1::o1_specialEventRemoveBrynnsNote(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_setLogicPage(ScriptState *script) { +int KyraEngine_v1::o1_setLogicPage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setLogicPage(%p) (%d)", (const void *)script, stackPos(0)); _screen->_curPage = stackPos(0); return stackPos(0); } -int KyraEngine_v1::o1_fatPrint(ScriptState *script) { +int KyraEngine_v1::o1_fatPrint(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_fatPrint(%p) ('%s', %d, %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); // Workaround for bug #1582672 ("KYRA1: Text crippled and drawn wrong") @@ -1142,13 +1142,13 @@ int KyraEngine_v1::o1_fatPrint(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_preserveAllObjectBackgrounds(ScriptState *script) { +int KyraEngine_v1::o1_preserveAllObjectBackgrounds(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_preserveAllObjectBackgrounds(%p) ()", (const void *)script); _animator->preserveAllBackgrounds(); return 0; } -int KyraEngine_v1::o1_updateSceneAnimations(ScriptState *script) { +int KyraEngine_v1::o1_updateSceneAnimations(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_updateSceneAnimations(%p) (%d)", (const void *)script, stackPos(0)); int times = stackPos(0); while (times--) { @@ -1158,23 +1158,23 @@ int KyraEngine_v1::o1_updateSceneAnimations(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_sceneAnimationActive(ScriptState *script) { +int KyraEngine_v1::o1_sceneAnimationActive(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_sceneAnimationActive(%p) (%d)", (const void *)script, stackPos(0)); return _sprites->_anims[stackPos(0)].play; } -int KyraEngine_v1::o1_setCharactersMovementDelay(ScriptState *script) { +int KyraEngine_v1::o1_setCharactersMovementDelay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setCharactersMovementDelay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _timer->setDelay(stackPos(0)+5, stackPos(1)); return 0; } -int KyraEngine_v1::o1_getCharactersFacing(ScriptState *script) { +int KyraEngine_v1::o1_getCharactersFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getCharactersFacing(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].facing; } -int KyraEngine_v1::o1_bkgdScrollSceneAndMasksRight(ScriptState *script) { +int KyraEngine_v1::o1_bkgdScrollSceneAndMasksRight(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_bkgdScrollSceneAndMasksRight(%p) (%d)", (const void *)script, stackPos(0)); _screen->copyBackgroundBlock(stackPos(0), 2, 0); _screen->copyBackgroundBlock2(stackPos(0)); @@ -1188,13 +1188,13 @@ int KyraEngine_v1::o1_bkgdScrollSceneAndMasksRight(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_dispelMagicAnimation(ScriptState *script) { +int KyraEngine_v1::o1_dispelMagicAnimation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_dispelMagicAnimation(%p) ()", (const void *)script); seq_dispelMagicAnimation(); return 0; } -int KyraEngine_v1::o1_findBrightestFireberry(ScriptState *script) { +int KyraEngine_v1::o1_findBrightestFireberry(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_findBrightestFireberry(%p) ()", (const void *)script); if (_currentCharacter->sceneId >= 187 && _currentCharacter->sceneId <= 198) return 29; @@ -1238,7 +1238,7 @@ int KyraEngine_v1::o1_findBrightestFireberry(ScriptState *script) { return brightestFireberry; } -int KyraEngine_v1::o1_setFireberryGlowPalette(ScriptState *script) { +int KyraEngine_v1::o1_setFireberryGlowPalette(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setFireberryGlowPalette(%p) (%d)", (const void *)script, stackPos(0)); int palIndex = 0; switch (stackPos(0)) { @@ -1275,19 +1275,19 @@ int KyraEngine_v1::o1_setFireberryGlowPalette(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_setDeathHandlerFlag(ScriptState *script) { +int KyraEngine_v1::o1_setDeathHandlerFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setDeathHandlerFlag(%p) (%d)", (const void *)script, stackPos(0)); _deathHandler = stackPos(0); return 0; } -int KyraEngine_v1::o1_drinkPotionAnimation(ScriptState *script) { +int KyraEngine_v1::o1_drinkPotionAnimation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_makeAmuletAppear(ScriptState *script) { +int KyraEngine_v1::o1_makeAmuletAppear(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_makeAmuletAppear(%p) ()", (const void *)script); WSAMovieV1 amulet(this); amulet.open("AMULET.WSA", 1, 0); @@ -1328,7 +1328,7 @@ int KyraEngine_v1::o1_makeAmuletAppear(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_drawItemShapeIntoScene(ScriptState *script) { +int KyraEngine_v1::o1_drawItemShapeIntoScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -1355,13 +1355,13 @@ int KyraEngine_v1::o1_drawItemShapeIntoScene(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_setCharactersCurrentFrame(ScriptState *script) { +int KyraEngine_v1::o1_setCharactersCurrentFrame(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setCharactersCurrentFrame(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _characterList[stackPos(0)].currentAnimFrame = stackPos(1); return 0; } -int KyraEngine_v1::o1_waitForConfirmationMouseClick(ScriptState *script) { +int KyraEngine_v1::o1_waitForConfirmationMouseClick(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_waitForConfirmationMouseClick(%p) ()", (const void *)script); // if (mouseEnabled) { while (!_mousePressFlag) { @@ -1386,39 +1386,39 @@ int KyraEngine_v1::o1_waitForConfirmationMouseClick(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_pageFlip(ScriptState *script) { +int KyraEngine_v1::o1_pageFlip(EMCState *script) { warning("STUB: o1_pageFlip"); return 0; } -int KyraEngine_v1::o1_setSceneFile(ScriptState *script) { +int KyraEngine_v1::o1_setSceneFile(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setSceneFile(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setSceneFile(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v1::o1_getItemInMarbleVase(ScriptState *script) { +int KyraEngine_v1::o1_getItemInMarbleVase(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getItemInMarbleVase(%p) ()", (const void *)script); return _marbleVaseItem; } -int KyraEngine_v1::o1_setItemInMarbleVase(ScriptState *script) { +int KyraEngine_v1::o1_setItemInMarbleVase(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setItemInMarbleVase(%p) (%d)", (const void *)script, stackPos(0)); _marbleVaseItem = stackPos(0); return 0; } -int KyraEngine_v1::o1_addItemToInventory(ScriptState *script) { +int KyraEngine_v1::o1_addItemToInventory(EMCState *script) { warning("STUB: o1_addItemToInventory"); return 0; } -int KyraEngine_v1::o1_intPrint(ScriptState *script) { +int KyraEngine_v1::o1_intPrint(EMCState *script) { warning("STUB: o1_intPrint"); return 0; } -int KyraEngine_v1::o1_shakeScreen(ScriptState *script) { +int KyraEngine_v1::o1_shakeScreen(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_shakeScreen(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int waitTicks = stackPos(1); int times = stackPos(0); @@ -1431,57 +1431,57 @@ int KyraEngine_v1::o1_shakeScreen(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_createAmuletJewel(ScriptState *script) { +int KyraEngine_v1::o1_createAmuletJewel(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_createAmuletJewel(%p) (%d)", (const void *)script, stackPos(0)); seq_createAmuletJewel(stackPos(0), 0, 0, 0); return 0; } -int KyraEngine_v1::o1_setSceneAnimCurrXY(ScriptState *script) { +int KyraEngine_v1::o1_setSceneAnimCurrXY(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_poisonBrandonAndRemaps(ScriptState *script) { +int KyraEngine_v1::o1_poisonBrandonAndRemaps(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_poisonBrandonAndRemaps(%p) ()", (const void *)script); setBrandonPoisonFlags(1); return 0; } -int KyraEngine_v1::o1_fillFlaskWithWater(ScriptState *script) { +int KyraEngine_v1::o1_fillFlaskWithWater(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_fillFlaskWithWater(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); seq_fillFlaskWithWater(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v1::o1_getCharactersMovementDelay(ScriptState *script) { +int KyraEngine_v1::o1_getCharactersMovementDelay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getCharactersMovementDelay(%p) (%d)", (const void *)script, stackPos(0)); return _timer->getDelay(stackPos(0)+5); } -int KyraEngine_v1::o1_getBirthstoneGem(ScriptState *script) { +int KyraEngine_v1::o1_getBirthstoneGem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getBirthstoneGem(%p) (%d)", (const void *)script, stackPos(0)); if (stackPos(0) < 4) return _birthstoneGemTable[stackPos(0)]; return 0; } -int KyraEngine_v1::o1_queryBrandonStatusBit(ScriptState *script) { +int KyraEngine_v1::o1_queryBrandonStatusBit(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_queryBrandonStatusBit(%p) (%d)", (const void *)script, stackPos(0)); if (_brandonStatusBit & stackPos(0)) return 1; return 0; } -int KyraEngine_v1::o1_playFluteAnimation(ScriptState *script) { +int KyraEngine_v1::o1_playFluteAnimation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_playFluteAnimation(%p) ()", (const void *)script); seq_playFluteAnimation(); return 0; } -int KyraEngine_v1::o1_playWinterScrollSequence(ScriptState *script) { +int KyraEngine_v1::o1_playWinterScrollSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_playWinterScrollSequence(%p) (%d)", (const void *)script, stackPos(0)); if (!stackPos(0)) seq_winterScroll2(); @@ -1490,40 +1490,40 @@ int KyraEngine_v1::o1_playWinterScrollSequence(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_getIdolGem(ScriptState *script) { +int KyraEngine_v1::o1_getIdolGem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getIdolGem(%p) (%d)", (const void *)script, stackPos(0)); return _idolGemsTable[stackPos(0)]; } -int KyraEngine_v1::o1_setIdolGem(ScriptState *script) { +int KyraEngine_v1::o1_setIdolGem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setIdolGem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _idolGemsTable[stackPos(0)] = stackPos(1); return 0; } -int KyraEngine_v1::o1_totalItemsInScene(ScriptState *script) { +int KyraEngine_v1::o1_totalItemsInScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_totalItemsInScene(%p) (%d)", (const void *)script, stackPos(0)); return countItemsInScene(stackPos(0)); } -int KyraEngine_v1::o1_restoreBrandonsMovementDelay(ScriptState *script) { +int KyraEngine_v1::o1_restoreBrandonsMovementDelay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_restoreBrandonsMovementDelay(%p) ()", (const void *)script); setWalkspeed(_configWalkspeed); return 0; } -int KyraEngine_v1::o1_setMousePos(ScriptState *script) { +int KyraEngine_v1::o1_setMousePos(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _system->warpMouse(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v1::o1_getMouseState(ScriptState *script) { +int KyraEngine_v1::o1_getMouseState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getMouseState(%p) ()", (const void *)script); return _mouseState; } -int KyraEngine_v1::o1_setEntranceMouseCursorTrack(ScriptState *script) { +int KyraEngine_v1::o1_setEntranceMouseCursorTrack(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -1533,19 +1533,19 @@ int KyraEngine_v1::o1_setEntranceMouseCursorTrack(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_itemAppearsOnGround(ScriptState *script) { +int KyraEngine_v1::o1_itemAppearsOnGround(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_setNoDrawShapesFlag(ScriptState *script) { +int KyraEngine_v1::o1_setNoDrawShapesFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setNoDrawShapesFlag(%p) (%d)", (const void *)script, stackPos(0)); _animator->_noDrawShapesFlag = stackPos(0); return 0; } -int KyraEngine_v1::o1_fadeEntirePalette(ScriptState *script) { +int KyraEngine_v1::o1_fadeEntirePalette(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_fadeEntirePalette(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int cmd = stackPos(0); uint8 *fadePal = 0; @@ -1585,7 +1585,7 @@ int KyraEngine_v1::o1_fadeEntirePalette(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_itemOnGroundHere(ScriptState *script) { +int KyraEngine_v1::o1_itemOnGroundHere(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_itemOnGroundHere(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < _roomTableSize); Room *curRoom = &_roomTable[stackPos(0)]; @@ -1596,18 +1596,18 @@ int KyraEngine_v1::o1_itemOnGroundHere(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_queryCauldronState(ScriptState *script) { +int KyraEngine_v1::o1_queryCauldronState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_queryCauldronState(%p) ()", (const void *)script); return _cauldronState; } -int KyraEngine_v1::o1_setCauldronState(ScriptState *script) { +int KyraEngine_v1::o1_setCauldronState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setCauldronState(%p) (%d)", (const void *)script, stackPos(0)); _cauldronState = stackPos(0); return _cauldronState; } -int KyraEngine_v1::o1_queryCrystalState(ScriptState *script) { +int KyraEngine_v1::o1_queryCrystalState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_queryCrystalState(%p) (%d)", (const void *)script, stackPos(0)); if (!stackPos(0)) return _crystalState[0]; @@ -1616,7 +1616,7 @@ int KyraEngine_v1::o1_queryCrystalState(ScriptState *script) { return -1; } -int KyraEngine_v1::o1_setCrystalState(ScriptState *script) { +int KyraEngine_v1::o1_setCrystalState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setCrystalState(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); if (!stackPos(0)) _crystalState[0] = stackPos(1); @@ -1625,12 +1625,12 @@ int KyraEngine_v1::o1_setCrystalState(ScriptState *script) { return stackPos(1); } -int KyraEngine_v1::o1_setPaletteRange(ScriptState *script) { +int KyraEngine_v1::o1_setPaletteRange(EMCState *script) { warning("STUB: o1_setPaletteRange"); return 0; } -int KyraEngine_v1::o1_shrinkBrandonDown(ScriptState *script) { +int KyraEngine_v1::o1_shrinkBrandonDown(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_shrinkBrandonDown(%p) (%d)", (const void *)script, stackPos(0)); int delayTime = stackPos(0); checkAmuletAnimFlags(); @@ -1656,7 +1656,7 @@ int KyraEngine_v1::o1_shrinkBrandonDown(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_growBrandonUp(ScriptState *script) { +int KyraEngine_v1::o1_growBrandonUp(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_growBrandonUp(%p) ()", (const void *)script); int scaleValue = _scaleTable[_currentCharacter->y1]; int scale = 0; @@ -1677,33 +1677,33 @@ int KyraEngine_v1::o1_growBrandonUp(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_setBrandonScaleXAndY(ScriptState *script) { +int KyraEngine_v1::o1_setBrandonScaleXAndY(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setBrandonScaleXAndY(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _animator->_brandonScaleX = stackPos(0); _animator->_brandonScaleY = stackPos(1); return 0; } -int KyraEngine_v1::o1_resetScaleMode(ScriptState *script) { +int KyraEngine_v1::o1_resetScaleMode(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_resetScaleMode(%p) ()", (const void *)script); _scaleMode = 0; return 0; } -int KyraEngine_v1::o1_getScaleDepthTableValue(ScriptState *script) { +int KyraEngine_v1::o1_getScaleDepthTableValue(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getScaleDepthTableValue(%p) (%d)", (const void *)script, stackPos(0)); assert(stackPos(0) < ARRAYSIZE(_scaleTable)); return _scaleTable[stackPos(0)]; } -int KyraEngine_v1::o1_setScaleDepthTableValue(ScriptState *script) { +int KyraEngine_v1::o1_setScaleDepthTableValue(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_message(ScriptState *script) { +int KyraEngine_v1::o1_message(EMCState *script) { if (_flags.isTalkie) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_message(%p) (%d, '%s', %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2)); drawSentenceCommand(stackPosString(1), stackPos(2)); @@ -1715,65 +1715,65 @@ int KyraEngine_v1::o1_message(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_checkClickOnNPC(ScriptState *script) { +int KyraEngine_v1::o1_checkClickOnNPC(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_checkClickOnNPC(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return checkForNPCScriptRun(stackPos(0), stackPos(1)); } -int KyraEngine_v1::o1_getFoyerItem(ScriptState *script) { +int KyraEngine_v1::o1_getFoyerItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getFoyerItem(%p) (%d)", (const void *)script, stackPos(0)); assert(stackPos(0) < ARRAYSIZE(_foyerItemTable)); return _foyerItemTable[stackPos(0)]; } -int KyraEngine_v1::o1_setFoyerItem(ScriptState *script) { +int KyraEngine_v1::o1_setFoyerItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_setNoItemDropRegion(ScriptState *script) { +int KyraEngine_v1::o1_setNoItemDropRegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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_v1::o1_walkMalcolmOn(ScriptState *script) { +int KyraEngine_v1::o1_walkMalcolmOn(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_walkMalcolmOn(%p) ()", (const void *)script); if (!_malcolmFlag) _malcolmFlag = 1; return 0; } -int KyraEngine_v1::o1_passiveProtection(ScriptState *script) { +int KyraEngine_v1::o1_passiveProtection(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_passiveProtection(%p) ()", (const void *)script); return 1; } -int KyraEngine_v1::o1_setPlayingLoop(ScriptState *script) { +int KyraEngine_v1::o1_setPlayingLoop(EMCState *script) { warning("STUB: o1_setPlayingLoop"); return 0; } -int KyraEngine_v1::o1_brandonToStoneSequence(ScriptState *script) { +int KyraEngine_v1::o1_brandonToStoneSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_brandonToStoneSequence(%p) ()", (const void *)script); seq_brandonToStone(); return 0; } -int KyraEngine_v1::o1_brandonHealingSequence(ScriptState *script) { +int KyraEngine_v1::o1_brandonHealingSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_brandonHealingSequence(%p) ()", (const void *)script); seq_brandonHealing(); return 0; } -int KyraEngine_v1::o1_protectCommandLine(ScriptState *script) { +int KyraEngine_v1::o1_protectCommandLine(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_protectCommandLine(%p) (%d)", (const void *)script, stackPos(0)); return stackPos(0); } -int KyraEngine_v1::o1_pauseMusicSeconds(ScriptState *script) { +int KyraEngine_v1::o1_pauseMusicSeconds(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_pauseMusicSeconds(%p) ()", (const void *)script); // if music disabled // return @@ -1781,18 +1781,18 @@ int KyraEngine_v1::o1_pauseMusicSeconds(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_resetMaskRegion(ScriptState *script) { +int KyraEngine_v1::o1_resetMaskRegion(EMCState *script) { warning("STUB: o1_resetMaskRegion"); return 0; } -int KyraEngine_v1::o1_setPaletteChangeFlag(ScriptState *script) { +int KyraEngine_v1::o1_setPaletteChangeFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setPaletteChangeFlag(%p) (%d)", (const void *)script, stackPos(0)); _paletteChanged = stackPos(0); return _paletteChanged; } -int KyraEngine_v1::o1_fillRect(ScriptState *script) { +int KyraEngine_v1::o1_fillRect(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::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); @@ -1801,26 +1801,26 @@ int KyraEngine_v1::o1_fillRect(ScriptState *script) { return 0; } -int KyraEngine_v1::o1_vocUnload(ScriptState *script) { +int KyraEngine_v1::o1_vocUnload(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_vocUnload(%p) ()", (const void *)script); // this should unload all voc files (not needed) return 0; } -int KyraEngine_v1::o1_vocLoad(ScriptState *script) { +int KyraEngine_v1::o1_vocLoad(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_vocLoad(%p) (%d)", (const void *)script, stackPos(0)); // this should load the specified voc file (not needed) return 0; } -int KyraEngine_v1::o1_dummy(ScriptState *script) { +int KyraEngine_v1::o1_dummy(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_dummy(%p) ()", (const void *)script); return 0; } #pragma mark - -typedef Common::Functor1Mem<ScriptState*, int, KyraEngine_v1> OpcodeV1; +typedef Common::Functor1Mem<EMCState*, int, KyraEngine_v1> OpcodeV1; #define SetOpcodeTable(x) table = &x; #define Opcode(x) table->push_back(new OpcodeV1(this, &KyraEngine_v1::x)) void KyraEngine_v1::setupOpcodeTable() { diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index e0b863a60d..585ce98295 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -34,7 +34,7 @@ namespace Kyra { -int KyraEngine_v2::o2_setCharacterFacingRefresh(ScriptState *script) { +int KyraEngine_v2::o2_setCharacterFacingRefresh(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCharacterFacingRefresh(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2)); int animFrame = stackPos(2); if (animFrame >= 0) @@ -45,7 +45,7 @@ int KyraEngine_v2::o2_setCharacterFacingRefresh(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_setCharacterPos(ScriptState *script) { +int KyraEngine_v2::o2_setCharacterPos(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCharacterFacingRefresh(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2)); int x = stackPos(1); int y = stackPos(2); @@ -61,7 +61,7 @@ int KyraEngine_v2::o2_setCharacterPos(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_defineObject(ScriptState *script) { +int KyraEngine_v2::o2_defineObject(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineObject(%p) (%d, '%s', %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); TalkObject *object = &_talkObjectList[stackPos(0)]; @@ -73,7 +73,7 @@ int KyraEngine_v2::o2_defineObject(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_refreshCharacter(ScriptState *script) { +int KyraEngine_v2::o2_refreshCharacter(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_refreshCharacter(%p) (-, %d, %d, %d)", (const void *)script, stackPos(1), stackPos(2), stackPos(3)); int unk = stackPos(1); int facing = stackPos(2); @@ -88,33 +88,33 @@ int KyraEngine_v2::o2_refreshCharacter(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_getCharacterX(ScriptState *script) { +int KyraEngine_v2::o2_getCharacterX(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCharacterX(%p) ()", (const void *)script); return _mainCharacter.x1; } -int KyraEngine_v2::o2_getCharacterY(ScriptState *script) { +int KyraEngine_v2::o2_getCharacterY(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCharacterY(%p) ()", (const void *)script); return _mainCharacter.y1; } -int KyraEngine_v2::o2_getCharacterFacing(ScriptState *script) { +int KyraEngine_v2::o2_getCharacterFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCharacterFacing(%p) ()", (const void *)script); return _mainCharacter.facing; } -int KyraEngine_v2::o2_getCharacterScene(ScriptState *script) { +int KyraEngine_v2::o2_getCharacterScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCharacterScene(%p) ()", (const void *)script); return _mainCharacter.sceneId; } -int KyraEngine_v2::o2_setSceneComment(ScriptState *script) { +int KyraEngine_v2::o2_setSceneComment(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setSceneComment(%p) ('%s')", (const void *)script, stackPosString(0)); _sceneCommentString = stackPosString(0); return 0; } -int KyraEngine_v2::o2_setCharacterAnimFrame(ScriptState *script) { +int KyraEngine_v2::o2_setCharacterAnimFrame(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCharacterAnimFrame(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2)); int animFrame = stackPos(1); int updateAnim = stackPos(2); @@ -126,14 +126,14 @@ int KyraEngine_v2::o2_setCharacterAnimFrame(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_setCharacterFacing(ScriptState *script) { +int KyraEngine_v2::o2_setCharacterFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCharacterFacing(%p) (%d)", (const void *)script, stackPos(0)); _mainCharacter.facing = stackPos(0); _overwriteSceneFacing = 1; return 0; } -int KyraEngine_v2::o2_trySceneChange(ScriptState *script) { +int KyraEngine_v2::o2_trySceneChange(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); @@ -142,7 +142,7 @@ int KyraEngine_v2::o2_trySceneChange(ScriptState *script) { _unkHandleSceneChangeFlag = 0; if (success) { - _scriptInterpreter->initScript(script, script->dataPtr); + _emc->init(script, script->dataPtr); _unk4 = 0; _unk3 = -1; _unk5 = 1; @@ -152,45 +152,45 @@ int KyraEngine_v2::o2_trySceneChange(ScriptState *script) { } } -int KyraEngine_v2::o2_moveCharacter(ScriptState *script) { +int KyraEngine_v2::o2_moveCharacter(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_moveCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); moveCharacter(stackPos(0), stackPos(1), stackPos(2)); return 0; } -int KyraEngine_v2::o2_customCharacterChat(ScriptState *script) { +int KyraEngine_v2::o2_customCharacterChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_customCharacterChat(%p) ('%s', %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); playVoice(_vocHigh, stackPos(4)); _text->printCustomCharacterText(stackPosString(0), stackPos(1), stackPos(2), stackPos(3), 0, 2); return 0; } -int KyraEngine_v2::o2_soundFadeOut(ScriptState *script) { +int KyraEngine_v2::o2_soundFadeOut(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_soundFadeOut(%p) ()", (const void *)script); _sound->beginFadeOut(); return 0; } -int KyraEngine_v2::o2_showChapterMessage(ScriptState *script) { +int KyraEngine_v2::o2_showChapterMessage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_showChapterMessage(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); showChapterMessage(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_restoreTalkTextMessageBkgd(ScriptState *script) { +int KyraEngine_v2::o2_restoreTalkTextMessageBkgd(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_restoreTalkTextMessageBkgd(%p) ()", (const void *)script); _text->restoreTalkTextMessageBkgd(2, 0); return 0; } -int KyraEngine_v2::o2_wsaClose(ScriptState *script) { +int KyraEngine_v2::o2_wsaClose(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_wsaClose(%p) (%d)", (const void *)script, stackPos(0)); assert(stackPos(0) >= 0 && stackPos(0) < ARRAYSIZE(_wsaSlots)); _wsaSlots[stackPos(0)]->close(); return 0; } -int KyraEngine_v2::o2_meanWhileScene(ScriptState *script) { +int KyraEngine_v2::o2_meanWhileScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_meanWhileScene(%p) (%d)", (const void *)script, stackPos(0)); static const uint8 jpSubtitle[] = { 0x88, 0xEA, 0x95, 0xFB, 0x81, 0x45, 0x81, 0x45, 0x81, 0x45 }; const char *cpsfile = stackPosString(0); @@ -211,19 +211,19 @@ int KyraEngine_v2::o2_meanWhileScene(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_backUpScreen(ScriptState *script) { +int KyraEngine_v2::o2_backUpScreen(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_backUpScreen(%p) (%d)", (const void *)script, stackPos(0)); _screen->copyRegionToBuffer(stackPos(0), 0, 0, 320, 144, _screenBuffer); return 0; } -int KyraEngine_v2::o2_restoreScreen(ScriptState *script) { +int KyraEngine_v2::o2_restoreScreen(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_restoreScreen(%p) (%d)", (const void *)script, stackPos(0)); _screen->copyBlockToPage(stackPos(0), 0, 0, 320, 144, _screenBuffer); return 0; } -int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) { +int KyraEngine_v2::o2_displayWsaFrame(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_displayWsaFrame(%p) (%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)); int frame = stackPos(0); @@ -258,7 +258,7 @@ int KyraEngine_v2::o2_displayWsaFrame(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_displayWsaSequentialFramesLooping(ScriptState *script) { +int KyraEngine_v2::o2_displayWsaSequentialFramesLooping(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_displayWsaSequentialFramesLooping(%p) (%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)); int startFrame = stackPos(0); @@ -321,14 +321,14 @@ int KyraEngine_v2::o2_displayWsaSequentialFramesLooping(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_wsaOpen(ScriptState *script) { +int KyraEngine_v2::o2_wsaOpen(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_wsaOpen(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); assert(stackPos(1) >= 0 && stackPos(1) < ARRAYSIZE(_wsaSlots)); _wsaSlots[stackPos(1)]->open(stackPosString(0), 1, 0); return 0; } -int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) { +int KyraEngine_v2::o2_displayWsaSequentialFrames(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_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)); uint16 frameDelay = stackPos(2) * _tickLength; @@ -358,7 +358,7 @@ int KyraEngine_v2::o2_displayWsaSequentialFrames(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_displayWsaSequence(ScriptState *script) { +int KyraEngine_v2::o2_displayWsaSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_displayWsaSequence(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); const int frameDelay = stackPos(2) * _tickLength; @@ -392,7 +392,7 @@ int KyraEngine_v2::o2_displayWsaSequence(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_addItemToInventory(ScriptState *script) { +int KyraEngine_v2::o2_addItemToInventory(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addItemToInventory(%p) (%d, -, %d)", (const void *)script, stackPos(0), stackPos(2)); int slot = findFreeVisibleInventorySlot(); if (slot != -1) { @@ -403,7 +403,7 @@ int KyraEngine_v2::o2_addItemToInventory(ScriptState *script) { return slot; } -int KyraEngine_v2::o2_drawShape(ScriptState *script) { +int KyraEngine_v2::o2_drawShape(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_drawShape(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); uint8 *shp = getShapePtr(stackPos(0) + 64); @@ -430,7 +430,7 @@ int KyraEngine_v2::o2_drawShape(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_addItemToCurScene(ScriptState *script) { +int KyraEngine_v2::o2_addItemToCurScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addItemToCurScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); const int16 id = stackPos(0); int x = stackPos(1); @@ -452,25 +452,25 @@ int KyraEngine_v2::o2_addItemToCurScene(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_checkForItem(ScriptState *script) { +int KyraEngine_v2::o2_checkForItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_checkForItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1; } -int KyraEngine_v2::o2_loadSoundFile(ScriptState *script) { +int KyraEngine_v2::o2_loadSoundFile(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_loadSoundFile(%p) (%d)", (const void *)script, stackPos(0)); if (_sound->hasSoundFile(stackPos(0))) snd_playTheme(stackPos(0), -1); return 0; } -int KyraEngine_v2::o2_removeItemSlotFromInventory(ScriptState *script) { +int KyraEngine_v2::o2_removeItemSlotFromInventory(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_removeItemSlotFromInventory(%p) (%d)", (const void *)script, stackPos(0)); removeItemFromInventory(stackPos(0)); return 0; } -int KyraEngine_v2::o2_defineItem(ScriptState *script) { +int KyraEngine_v2::o2_defineItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineItem(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int freeItem = findFreeItem(); @@ -485,7 +485,7 @@ int KyraEngine_v2::o2_defineItem(ScriptState *script) { return freeItem; } -int KyraEngine_v2::o2_removeItemFromInventory(ScriptState *script) { +int KyraEngine_v2::o2_removeItemFromInventory(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_removeItemFromInventory(%p) (%d)", (const void *)script, stackPos(0)); uint16 item = stackPos(0); int slot = -1; @@ -494,7 +494,7 @@ int KyraEngine_v2::o2_removeItemFromInventory(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) { +int KyraEngine_v2::o2_countItemInInventory(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_countItemInInventory(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); uint16 item = stackPos(1); int count = 0; @@ -510,7 +510,7 @@ int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) { return count; } -int KyraEngine_v2::o2_countItemsInScene(ScriptState *script) { +int KyraEngine_v2::o2_countItemsInScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_countItemsInScene(%p) (%d)", (const void *)script, stackPos(0)); int count = 0; for (int i = 0; i < 30; ++i) { @@ -520,45 +520,45 @@ int KyraEngine_v2::o2_countItemsInScene(ScriptState *script) { return count; } -int KyraEngine_v2::o2_queryGameFlag(ScriptState *script) { +int KyraEngine_v2::o2_queryGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_queryGameFlag(%p) (%d)", (const void *)script, stackPos(0)); return queryGameFlag(stackPos(0)); } -int KyraEngine_v2::o2_resetGameFlag(ScriptState *script) { +int KyraEngine_v2::o2_resetGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_resetGameFlag(%p) (%d)", (const void *)script, stackPos(0)); return resetGameFlag(stackPos(0)); } -int KyraEngine_v2::o2_setGameFlag(ScriptState *script) { +int KyraEngine_v2::o2_setGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setGameFlag(%p) (%d)", (const void *)script, stackPos(0)); return setGameFlag(stackPos(0)); } -int KyraEngine_v2::o2_setHandItem(ScriptState *script) { +int KyraEngine_v2::o2_setHandItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setHandItem(%p) (%d)", (const void *)script, stackPos(0)); setHandItem(stackPos(0)); return 0; } -int KyraEngine_v2::o2_removeHandItem(ScriptState *script) { +int KyraEngine_v2::o2_removeHandItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_removeHandItem(%p) ()", (const void *)script); removeHandItem(); return 0; } -int KyraEngine_v2::o2_handItemSet(ScriptState *script) { +int KyraEngine_v2::o2_handItemSet(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_handItemSet(%p) ()", (const void *)script); return _handItemSet; } -int KyraEngine_v2::o2_hideMouse(ScriptState *script) { +int KyraEngine_v2::o2_hideMouse(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_hideMouse(%p) ()", (const void *)script); _screen->hideMouse(); return 0; } -int KyraEngine_v2::o2_addSpecialExit(ScriptState *script) { +int KyraEngine_v2::o2_addSpecialExit(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addSpecialExit(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); if (_specialExitCount < 5) { @@ -572,19 +572,19 @@ int KyraEngine_v2::o2_addSpecialExit(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_setMousePos(ScriptState *script) { +int KyraEngine_v2::o2_setMousePos(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setMousePos(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_showMouse(ScriptState *script) { +int KyraEngine_v2::o2_showMouse(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_showMouse(%p) ()", (const void *)script); _screen->showMouse(); return 0; } -int KyraEngine_v2::o2_wipeDownMouseItem(ScriptState *script) { +int KyraEngine_v2::o2_wipeDownMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_wipeDownMouseItem(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2)); _screen->hideMouse(); const int x = stackPos(1) - 8; @@ -611,23 +611,23 @@ int KyraEngine_v2::o2_wipeDownMouseItem(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_getElapsedSecs(ScriptState *script) { +int KyraEngine_v2::o2_getElapsedSecs(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getElapsedSecs(%p) ()", (const void *)script); return _system->getMillis() / 1000; } -int KyraEngine_v2::o2_getTimerDelay(ScriptState *script) { +int KyraEngine_v2::o2_getTimerDelay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getTimerDelay(%p) (%d)", (const void *)script, stackPos(0)); return _timer->getDelay(stackPos(0)); } -int KyraEngine_v2::o2_delaySecs(ScriptState *script) { +int KyraEngine_v2::o2_delaySecs(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_delaySecs(%p) (%d)", (const void *)script, stackPos(0)); delay(stackPos(0) * 1000, true); return 0; } -int KyraEngine_v2::o2_delay(ScriptState *script) { +int KyraEngine_v2::o2_delay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); if (stackPos(1)) { uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength; @@ -650,37 +650,37 @@ int KyraEngine_v2::o2_delay(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_setTimerDelay(ScriptState *script) { +int KyraEngine_v2::o2_setTimerDelay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setTimerDelay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _timer->setDelay(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_setScaleTableItem(ScriptState *script) { +int KyraEngine_v2::o2_setScaleTableItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setScaleTableItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setScaleTableItem(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_setDrawLayerTableItem(ScriptState *script) { +int KyraEngine_v2::o2_setDrawLayerTableItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setDrawLayerTableItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setDrawLayerTableEntry(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_setCharPalEntry(ScriptState *script) { +int KyraEngine_v2::o2_setCharPalEntry(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCharPalEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setCharPalEntry(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_loadZShapes(ScriptState *script) { +int KyraEngine_v2::o2_loadZShapes(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_loadZShapes(%p) (%d)", (const void *)script, stackPos(0)); loadZShapes(stackPos(0)); return 0; } -int KyraEngine_v2::o2_drawSceneShape(ScriptState *script) { +int KyraEngine_v2::o2_drawSceneShape(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_drawSceneShape(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); @@ -705,7 +705,7 @@ int KyraEngine_v2::o2_drawSceneShape(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_drawSceneShapeOnPage(ScriptState *script) { +int KyraEngine_v2::o2_drawSceneShapeOnPage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_drawSceneShapeOnPage(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); int shape = stackPos(0); @@ -718,33 +718,33 @@ int KyraEngine_v2::o2_drawSceneShapeOnPage(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_disableAnimObject(ScriptState *script) { +int KyraEngine_v2::o2_disableAnimObject(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_disableAnimObject(%p) (%d)", (const void *)script, stackPos(0)); _animObjects[stackPos(0)+1].enabled = false; return 0; } -int KyraEngine_v2::o2_enableAnimObject(ScriptState *script) { +int KyraEngine_v2::o2_enableAnimObject(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_enableAnimObject(%p) (%d)", (const void *)script, stackPos(0)); _animObjects[stackPos(0)+1].enabled = true; return 0; } -int KyraEngine_v2::o2_loadPalette384(ScriptState *script) { +int KyraEngine_v2::o2_loadPalette384(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_loadPalette384(%p) ('%s')", (const void *)script, stackPosString(0)); memcpy(_screen->getPalette(1), _screen->getPalette(0), 768); _res->loadFileToBuf(stackPosString(0), _screen->getPalette(1), 384); return 0; } -int KyraEngine_v2::o2_setPalette384(ScriptState *script) { +int KyraEngine_v2::o2_setPalette384(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setPalette384(%p) ()", (const void *)script); memcpy(_screen->getPalette(0), _screen->getPalette(1), 384); _screen->setScreenPalette(_screen->getPalette(0)); return 0; } -int KyraEngine_v2::o2_restoreBackBuffer(ScriptState *script) { +int KyraEngine_v2::o2_restoreBackBuffer(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_restoreBackBuffer(%p) (%d)", (const void *)script, stackPos(0)); int disable = stackPos(0); int oldState = 0; @@ -762,40 +762,40 @@ int KyraEngine_v2::o2_restoreBackBuffer(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_backUpInventoryGfx(ScriptState *script) { +int KyraEngine_v2::o2_backUpInventoryGfx(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_backUpInventoryGfx(%p) ()", (const void *)script); _screen->copyRegionToBuffer(1, 0, 144, 320, 56, _screenBuffer); _inventorySaved = true; return 0; } -int KyraEngine_v2::o2_disableSceneAnim(ScriptState *script) { +int KyraEngine_v2::o2_disableSceneAnim(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_disableSceneAnim(%p) (%d)", (const void *)script, stackPos(0)); _sceneAnims[stackPos(0)].flags &= ~1; return 0; } -int KyraEngine_v2::o2_enableSceneAnim(ScriptState *script) { +int KyraEngine_v2::o2_enableSceneAnim(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_enableSceneAnim(%p) (%d)", (const void *)script, stackPos(0)); _sceneAnims[stackPos(0)].flags |= 1; return 0; } -int KyraEngine_v2::o2_restoreInventoryGfx(ScriptState *script) { +int KyraEngine_v2::o2_restoreInventoryGfx(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_restoreInventoryGfx(%p) ()", (const void *)script); _screen->copyBlockToPage(1, 0, 144, 320, 56, _screenBuffer); _inventorySaved = false; return 0; } -int KyraEngine_v2::o2_setSceneAnimPos2(ScriptState *script) { +int KyraEngine_v2::o2_setSceneAnimPos2(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setSceneAnimPos2(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); _sceneAnims[stackPos(0)].x2 = stackPos(1); _sceneAnims[stackPos(0)].y2 = stackPos(2); return 0; } -int KyraEngine_v2::o2_update(ScriptState *script) { +int KyraEngine_v2::o2_update(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_update(%p) (%d)", (const void *)script, stackPos(0)); int times = stackPos(0); @@ -809,13 +809,13 @@ int KyraEngine_v2::o2_update(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_fadeScenePal(ScriptState *script) { +int KyraEngine_v2::o2_fadeScenePal(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_fadeScenePal(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); fadeScenePal(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_enterNewSceneEx(ScriptState *script) { +int KyraEngine_v2::o2_enterNewSceneEx(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_enterNewSceneEx(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); @@ -835,7 +835,7 @@ int KyraEngine_v2::o2_enterNewSceneEx(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_switchScene(ScriptState *script) { +int KyraEngine_v2::o2_switchScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_switchScene(%p) (%d)", (const void *)script, stackPos(0)); setGameFlag(0x1EF); _mainCharX = _mainCharacter.x1; @@ -846,18 +846,18 @@ int KyraEngine_v2::o2_switchScene(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_getShapeFlag1(ScriptState *script) { +int KyraEngine_v2::o2_getShapeFlag1(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getShapeFlag1(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return _screen->getShapeFlag1(stackPos(0), stackPos(1)); } -int KyraEngine_v2::o2_setPathfinderFlag(ScriptState *script) { +int KyraEngine_v2::o2_setPathfinderFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setPathfinderFlag(%p) (%d)", (const void *)script, stackPos(0)); _pathfinderFlag = stackPos(0); return 0; } -int KyraEngine_v2::o2_getSceneExitToFacing(ScriptState *script) { +int KyraEngine_v2::o2_getSceneExitToFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getSceneExitToFacing(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int scene = stackPos(0); const int facing = stackPos(1); @@ -873,7 +873,7 @@ int KyraEngine_v2::o2_getSceneExitToFacing(ScriptState *script) { return -1; } -int KyraEngine_v2::o2_setLayerFlag(ScriptState *script) { +int KyraEngine_v2::o2_setLayerFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setLayerFlag(%p) (%d)", (const void *)script, stackPos(0)); int layer = stackPos(0); if (layer >= 1 && layer <= 16) @@ -881,7 +881,7 @@ int KyraEngine_v2::o2_setLayerFlag(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_setZanthiaPos(ScriptState *script) { +int KyraEngine_v2::o2_setZanthiaPos(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setZanthiaPos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _mainCharX = stackPos(0); _mainCharY = stackPos(1); @@ -894,51 +894,51 @@ int KyraEngine_v2::o2_setZanthiaPos(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_loadMusicTrack(ScriptState *script) { +int KyraEngine_v2::o2_loadMusicTrack(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_loadMusicTrack(%p) (%d)", (const void *)script, stackPos(0)); snd_loadSoundFile(stackPos(0)); return 0; } -int KyraEngine_v2::o2_playWanderScoreViaMap(ScriptState *script) { +int KyraEngine_v2::o2_playWanderScoreViaMap(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_playWanderScoreViaMap(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); snd_playWanderScoreViaMap(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_playSoundEffect(ScriptState *script) { +int KyraEngine_v2::o2_playSoundEffect(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0)); snd_playSoundEffect(stackPos(0)); return 0; } -int KyraEngine_v2::o2_setSceneAnimPos(ScriptState *script) { +int KyraEngine_v2::o2_setSceneAnimPos(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setSceneAnimPos(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); _sceneAnims[stackPos(0)].x = stackPos(1); _sceneAnims[stackPos(0)].y = stackPos(2); return 0; } -int KyraEngine_v2::o2_blockInRegion(ScriptState *script) { +int KyraEngine_v2::o2_blockInRegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_blockInRegion(%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_v2::o2_blockOutRegion(ScriptState *script) { +int KyraEngine_v2::o2_blockOutRegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_blockOutRegion(%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_v2::o2_setCauldronState(ScriptState *script) { +int KyraEngine_v2::o2_setCauldronState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCauldronState(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setCauldronState(stackPos(0), stackPos(1) != 0); clearCauldronTable(); return 0; } -int KyraEngine_v2::o2_showItemString(ScriptState *script) { +int KyraEngine_v2::o2_showItemString(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_showItemString(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int item = stackPos(0); @@ -959,30 +959,30 @@ int KyraEngine_v2::o2_showItemString(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_getRand(ScriptState *script) { +int KyraEngine_v2::o2_getRand(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < stackPos(1)); return _rnd.getRandomNumberRng(stackPos(0), stackPos(1)); } -int KyraEngine_v2::o2_isAnySoundPlaying(ScriptState *script) { +int KyraEngine_v2::o2_isAnySoundPlaying(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_isAnySoundPlaying(%p) ()", (const void *)script); return _sound->voiceIsPlaying(); } -int KyraEngine_v2::o2_setDeathHandlerFlag(ScriptState *script) { +int KyraEngine_v2::o2_setDeathHandlerFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setDeathHandlerFlag(%p) (%d)", (const void *)script, stackPos(0)); _deathHandler = stackPos(0); return 0; } -int KyraEngine_v2::o2_setDrawNoShapeFlag(ScriptState *script) { +int KyraEngine_v2::o2_setDrawNoShapeFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setDrawNoShapeFlag(%p) (%d)", (const void *)script, stackPos(0)); _drawNoShapeFlag = (stackPos(0) != 0); return 0; } -int KyraEngine_v2::o2_setRunFlag(ScriptState *script) { +int KyraEngine_v2::o2_setRunFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setRunFlag(%p) (%d)", (const void *)script, stackPos(0)); // this is usually just _runFlag, but since this is just used when the game should play the credits // we handle it a bit different :-) @@ -991,7 +991,7 @@ int KyraEngine_v2::o2_setRunFlag(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_showLetter(ScriptState *script) { +int KyraEngine_v2::o2_showLetter(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_showLetter(%p) (%d)", (const void *)script, stackPos(0)); const int letter = stackPos(0); char filename[16]; @@ -1051,13 +1051,13 @@ int KyraEngine_v2::o2_showLetter(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_fillRect(ScriptState *script) { +int KyraEngine_v2::o2_fillRect(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_fillRect(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); _screen->fillRect(stackPos(1), stackPos(2), stackPos(1)+stackPos(3), stackPos(2)+stackPos(4), stackPos(5), stackPos(0)); return 0; } -int KyraEngine_v2::o2_waitForConfirmationClick(ScriptState *script) { +int KyraEngine_v2::o2_waitForConfirmationClick(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_waitForConfirmationClick(%p) (%d)", (const void *)script, stackPos(0)); resetSkipFlag(); uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength; @@ -1081,14 +1081,14 @@ int KyraEngine_v2::o2_waitForConfirmationClick(ScriptState *script) { return 1; } -int KyraEngine_v2::o2_encodeShape(ScriptState *script) { +int KyraEngine_v2::o2_encodeShape(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_encodeShape(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); _sceneShapeTable[stackPos(0)] = _screen->encodeShape(stackPos(1), stackPos(2), stackPos(3), stackPos(4), 2); return 0; } -int KyraEngine_v2::o2_defineRoomEntrance(ScriptState *script) { +int KyraEngine_v2::o2_defineRoomEntrance(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineRoomEntrance(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); switch (stackPos(0)) { case 0: @@ -1117,7 +1117,7 @@ int KyraEngine_v2::o2_defineRoomEntrance(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_runTemporaryScript(ScriptState *script) { +int KyraEngine_v2::o2_runTemporaryScript(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_runTemporaryScript(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3)); @@ -1125,14 +1125,14 @@ int KyraEngine_v2::o2_runTemporaryScript(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_setSpecialSceneScriptRunTime(ScriptState *script) { +int KyraEngine_v2::o2_setSpecialSceneScriptRunTime(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setSpecialSceneScriptRunTime(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) >= 0 && stackPos(0) < 10); _sceneSpecialScriptsTimer[stackPos(0)] = _system->getMillis() + stackPos(1) * _tickLength; return 0; } -int KyraEngine_v2::o2_defineSceneAnim(ScriptState *script) { +int KyraEngine_v2::o2_defineSceneAnim(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineSceneAnim(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPosString(12)); @@ -1165,7 +1165,7 @@ int KyraEngine_v2::o2_defineSceneAnim(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_updateSceneAnim(ScriptState *script) { +int KyraEngine_v2::o2_updateSceneAnim(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_updateSceneAnim(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); updateSceneAnim(stackPos(0), stackPos(1)); @@ -1189,7 +1189,7 @@ int KyraEngine_v2::o2_updateSceneAnim(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_addToSceneAnimPosAndUpdate(ScriptState *script) { +int KyraEngine_v2::o2_addToSceneAnimPosAndUpdate(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addToSceneAnimPosAndUpdate(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); const int anim = stackPos(0); _sceneAnims[anim].x2 += stackPos(1); @@ -1203,48 +1203,48 @@ int KyraEngine_v2::o2_addToSceneAnimPosAndUpdate(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_useItemOnMainChar(ScriptState *script) { - ScriptState tmpScript; - _scriptInterpreter->initScript(&tmpScript, &_npcScriptData); - _scriptInterpreter->startScript(&tmpScript, 0); +int KyraEngine_v2::o2_useItemOnMainChar(EMCState *script) { + EMCState tmpScript; + _emc->init(&tmpScript, &_npcScriptData); + _emc->start(&tmpScript, 0); tmpScript.regs[4] = _itemInHand; tmpScript.regs[0] = _mainCharacter.sceneId; int oldVocH = _vocHigh; _vocHigh = 0x5a; - while(_scriptInterpreter->validScript(&tmpScript)) - _scriptInterpreter->runScript(&tmpScript); + while(_emc->isValid(&tmpScript)) + _emc->run(&tmpScript); _vocHigh = oldVocH; return 0; } -int KyraEngine_v2::o2_startDialogue(ScriptState *script) { +int KyraEngine_v2::o2_startDialogue(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_startDialogue(%p) (%d)", (const void *)script, stackPos(0)); startDialogue(stackPos(0)); return 0; } -int KyraEngine_v2::o2_zanthRandomChat(ScriptState *script) { +int KyraEngine_v2::o2_zanthRandomChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_zanthRandomChat(%p)", (const void *)script); zanthRandomIdleChat(); return 0; } -int KyraEngine_v2::o2_setupDialogue(ScriptState *script) { +int KyraEngine_v2::o2_setupDialogue(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setupDialogue(%p) (%d)", (const void *)script, stackPos(0)); setNewDlgIndex(stackPos(0)); return 0; } -int KyraEngine_v2::o2_getDlgIndex(ScriptState *script) { +int KyraEngine_v2::o2_getDlgIndex(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setNewDlgIndex(%p) (%d)", (const void *)script, stackPos(0)); return _mainCharacter.dlgIndex; } -int KyraEngine_v2::o2_defineRoom(ScriptState *script) { +int KyraEngine_v2::o2_defineRoom(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_defineRoom(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7)); SceneDesc *scene = &_sceneList[stackPos(0)]; @@ -1266,24 +1266,24 @@ int KyraEngine_v2::o2_defineRoom(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_addCauldronStateTableEntry(ScriptState *script) { +int KyraEngine_v2::o2_addCauldronStateTableEntry(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addCauldronStateTableEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return addToCauldronStateTable(stackPos(0), stackPos(1)) ? 1 : 0; } -int KyraEngine_v2::o2_setCountDown(ScriptState *script) { +int KyraEngine_v2::o2_setCountDown(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setCountDown(%p) (%d)", (const void *)script, stackPos(0)); _scriptCountDown = _system->getMillis() + stackPos(0) * _tickLength; return 0; } -int KyraEngine_v2::o2_getCountDown(ScriptState *script) { +int KyraEngine_v2::o2_getCountDown(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getCountDown(%p)", (const void *)script); uint32 time = _system->getMillis(); return (time > _scriptCountDown) ? 0 : (_scriptCountDown - time) / _tickLength; } -int KyraEngine_v2::o2_pressColorKey(ScriptState *script) { +int KyraEngine_v2::o2_pressColorKey(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_pressColorKey(%p) (%d)", (const void *)script, stackPos(0)); for (int i = 6; i; i--) _inputColorCode[i] = _inputColorCode[i - 1]; @@ -1295,7 +1295,7 @@ int KyraEngine_v2::o2_pressColorKey(ScriptState *script) { return 1; } -int KyraEngine_v2::o2_objectChat(ScriptState *script) { +int KyraEngine_v2::o2_objectChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_objectChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); if (_flags.isTalkie) warning("Unexpected call: o2_objectChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); @@ -1304,7 +1304,7 @@ int KyraEngine_v2::o2_objectChat(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_chapterChange(ScriptState *script) { +int KyraEngine_v2::o2_chapterChange(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_chapterChange(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int chapter = stackPos(0); const int scene = stackPos(1); @@ -1326,40 +1326,40 @@ int KyraEngine_v2::o2_chapterChange(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_getColorCodeFlag1(ScriptState *script) { +int KyraEngine_v2::o2_getColorCodeFlag1(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getColorCodeFlag1(%p) ()", (const void *)script); return _colorCodeFlag1; } -int KyraEngine_v2::o2_setColorCodeFlag1(ScriptState *script) { +int KyraEngine_v2::o2_setColorCodeFlag1(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getColorCodeFlag1(%p) (%d)", (const void *)script, stackPos(0)); _colorCodeFlag1 = stackPos(0); return 0; } -int KyraEngine_v2::o2_getColorCodeFlag2(ScriptState *script) { +int KyraEngine_v2::o2_getColorCodeFlag2(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getColorCodeFlag2(%p) ()", (const void *)script); return _colorCodeFlag2; } -int KyraEngine_v2::o2_setColorCodeFlag2(ScriptState *script) { +int KyraEngine_v2::o2_setColorCodeFlag2(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getColorCodeFlag2(%p) (%d)", (const void *)script, stackPos(0)); _colorCodeFlag2 = stackPos(0); return 0; } -int KyraEngine_v2::o2_getColorCodeValue(ScriptState *script) { +int KyraEngine_v2::o2_getColorCodeValue(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getColorCodeValue(%p) (%d)", (const void *)script, stackPos(0)); return _presetColorCode[stackPos(0)]; } -int KyraEngine_v2::o2_setColorCodeValue(ScriptState *script) { +int KyraEngine_v2::o2_setColorCodeValue(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setColorCodeValue(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _presetColorCode[stackPos(0)] = stackPos(1) & 0xff; return stackPos(1) & 0xff; } -int KyraEngine_v2::o2_countItemInstances(ScriptState *script) { +int KyraEngine_v2::o2_countItemInstances(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_countItemInstances(%p) (%d)", (const void *)script, stackPos(0)); uint16 item = stackPos(0); @@ -1391,7 +1391,7 @@ int KyraEngine_v2::o2_countItemInstances(ScriptState *script) { return count; } -int KyraEngine_v2::o2_removeItemFromScene(ScriptState *script) { +int KyraEngine_v2::o2_removeItemFromScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_removeItemFromScene(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int scene = stackPos(0); const uint16 item = stackPos(1); @@ -1402,13 +1402,13 @@ int KyraEngine_v2::o2_removeItemFromScene(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_initObject(ScriptState *script) { +int KyraEngine_v2::o2_initObject(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_initObject(%p) (%d)", (const void *)script, stackPos(0)); initTalkObject(stackPos(0)); return 0; } -int KyraEngine_v2::o2_npcChat(ScriptState *script) { +int KyraEngine_v2::o2_npcChat(EMCState *script) { if (_flags.isTalkie) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_npcChat(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), _vocHigh, stackPos(2)); npcChatSequence(stackPosString(0), stackPos(1), _vocHigh, stackPos(2)); @@ -1419,58 +1419,58 @@ int KyraEngine_v2::o2_npcChat(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_deinitObject(ScriptState *script) { +int KyraEngine_v2::o2_deinitObject(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_deinitObject(%p) (%d)", (const void *)script, stackPos(0)); deinitTalkObject(stackPos(0)); return 0; } -int KyraEngine_v2::o2_playTimSequence(ScriptState *script) { +int KyraEngine_v2::o2_playTimSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_playTimSequence(%p) ('%s')", (const void *)script, stackPosString(0)); playTim(stackPosString(0)); return 0; } -int KyraEngine_v2::o2_makeBookOrCauldronAppear(ScriptState *script) { +int KyraEngine_v2::o2_makeBookOrCauldronAppear(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_makeBookOrCauldronAppear(%p) (%d)", (const void *)script, stackPos(0)); seq_makeBookOrCauldronAppear(stackPos(0)); return 0; } -int KyraEngine_v2::o2_setSpecialSceneScriptState(ScriptState *script) { +int KyraEngine_v2::o2_setSpecialSceneScriptState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0)); _specialSceneScriptState[stackPos(0)] = 1; return 1; } -int KyraEngine_v2::o2_clearSpecialSceneScriptState(ScriptState *script) { +int KyraEngine_v2::o2_clearSpecialSceneScriptState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_clearSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0)); _specialSceneScriptState[stackPos(0)] = 0; return 0; } -int KyraEngine_v2::o2_querySpecialSceneScriptState(ScriptState *script) { +int KyraEngine_v2::o2_querySpecialSceneScriptState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_querySpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0)); return _specialSceneScriptState[stackPos(0)]; } -int KyraEngine_v2::o2_resetInputColorCode(ScriptState *script) { +int KyraEngine_v2::o2_resetInputColorCode(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_resetInputColorCode(%p)", (const void *)script); memset(_inputColorCode, 255, 7); return 0; } -int KyraEngine_v2::o2_setHiddenItemsEntry(ScriptState *script) { +int KyraEngine_v2::o2_setHiddenItemsEntry(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setHiddenItemsEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return (_hiddenItems[stackPos(0)] = stackPos(1)); } -int KyraEngine_v2::o2_getHiddenItemsEntry(ScriptState *script) { +int KyraEngine_v2::o2_getHiddenItemsEntry(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getHiddenItemsEntry(%p) (%d)", (const void *)script, stackPos(0)); return _hiddenItems[stackPos(0)]; } -int KyraEngine_v2::o2_mushroomEffect(ScriptState *script) { +int KyraEngine_v2::o2_mushroomEffect(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_mushroomEffect(%p)", (const void *)script); memcpy(_screen->getPalette(2), _screen->_currentPalette, 768); @@ -1495,7 +1495,7 @@ int KyraEngine_v2::o2_mushroomEffect(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_customChat(ScriptState *script) { +int KyraEngine_v2::o2_customChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_customChat(%p) ('%s', %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2)); strcpy((char*)_unkBuf500Bytes, stackPosString(0)); _chatText = (char*)_unkBuf500Bytes; @@ -1507,7 +1507,7 @@ int KyraEngine_v2::o2_customChat(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_customChatFinish(ScriptState *script) { +int KyraEngine_v2::o2_customChatFinish(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_customChatFinish(%p) ()", (const void *)script); _text->restoreScreen(); _chatText = 0; @@ -1515,7 +1515,7 @@ int KyraEngine_v2::o2_customChatFinish(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_setupSceneAnimation(ScriptState *script) { +int KyraEngine_v2::o2_setupSceneAnimation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setupSceneAnimation(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPosString(12)); const int index = stackPos(0); @@ -1589,7 +1589,7 @@ int KyraEngine_v2::o2_setupSceneAnimation(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_stopSceneAnimation(ScriptState *script) { +int KyraEngine_v2::o2_stopSceneAnimation(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_stopSceneAnimation(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int index = stackPos(0); AnimObj &obj = _animObjects[1+index]; @@ -1609,25 +1609,25 @@ int KyraEngine_v2::o2_stopSceneAnimation(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_disableTimer(ScriptState *script) { +int KyraEngine_v2::o2_disableTimer(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_disableTimer(%p) (%d)", (const void *)script, stackPos(0)); _timer->disable(stackPos(0)); return 0; } -int KyraEngine_v2::o2_enableTimer(ScriptState *script) { +int KyraEngine_v2::o2_enableTimer(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_enableTimer(%p) (%d)", (const void *)script, stackPos(0)); _timer->enable(stackPos(0)); return 0; } -int KyraEngine_v2::o2_setTimerCountdown(ScriptState *script) { +int KyraEngine_v2::o2_setTimerCountdown(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setTimerCountdown(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _timer->setCountdown(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2_processPaletteIndex(ScriptState *script) { +int KyraEngine_v2::o2_processPaletteIndex(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_processPaletteIndex(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); uint8 *palette = _screen->getPalette(0); const int index = stackPos(0); @@ -1645,7 +1645,7 @@ int KyraEngine_v2::o2_processPaletteIndex(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_updateTwoSceneAnims(ScriptState *script) { +int KyraEngine_v2::o2_updateTwoSceneAnims(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_updateTwoSceneAnims(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); updateSceneAnim(stackPos(0), stackPos(1)); updateSceneAnim(stackPos(2), stackPos(3)); @@ -1653,12 +1653,12 @@ int KyraEngine_v2::o2_updateTwoSceneAnims(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_getRainbowRoomData(ScriptState *script) { +int KyraEngine_v2::o2_getRainbowRoomData(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getRainbowRoomData(%p) (%d)", (const void *)script, stackPos(0)); return _rainbowRoomData[stackPos(0)]; } -int KyraEngine_v2::o2_drawSceneShapeEx(ScriptState *script) { +int KyraEngine_v2::o2_drawSceneShapeEx(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_drawSceneShapeEx(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); const int itemShape = stackPos(0) + 64; const int x = stackPos(1); @@ -1676,12 +1676,12 @@ int KyraEngine_v2::o2_drawSceneShapeEx(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_getBoolFromStack(ScriptState *script) { +int KyraEngine_v2::o2_getBoolFromStack(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getBoolFromStack(%p) ()", (const void *)script); return stackPos(0) ? 1 : 0; } -int KyraEngine_v2::o2_getSfxDriver(ScriptState *script) { +int KyraEngine_v2::o2_getSfxDriver(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getSfxDriver(%p) ()", (const void *)script); if (_sound->getSfxType() == Sound::kAdlib) return 1; @@ -1693,13 +1693,13 @@ int KyraEngine_v2::o2_getSfxDriver(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_getVocSupport(ScriptState *script) { +int KyraEngine_v2::o2_getVocSupport(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getVocSupport(%p) ()", (const void *)script); // we always support VOC file playback return 1; } -int KyraEngine_v2::o2_getMusicDriver(ScriptState *script) { +int KyraEngine_v2::o2_getMusicDriver(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getMusicDriver(%p) ()", (const void *)script); if (_sound->getMusicType() == Sound::kAdlib) return 1; @@ -1711,45 +1711,45 @@ int KyraEngine_v2::o2_getMusicDriver(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_setVocHigh(ScriptState *script) { +int KyraEngine_v2::o2_setVocHigh(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setVocHigh(%p) (%d)", (const void *)script, stackPos(0)); _vocHigh = stackPos(0); return _vocHigh; } -int KyraEngine_v2::o2_getVocHigh(ScriptState *script) { +int KyraEngine_v2::o2_getVocHigh(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getVocHigh(%p) ()", (const void *)script); return _vocHigh; } -int KyraEngine_v2::o2_zanthiaChat(ScriptState *script) { +int KyraEngine_v2::o2_zanthiaChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_zanthiaChat(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); objectChat(stackPosString(0), 0, _vocHigh, stackPos(1)); return 0; } -int KyraEngine_v2::o2_isVoiceEnabled(ScriptState *script) { +int KyraEngine_v2::o2_isVoiceEnabled(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_isVoiceEnabled(%p) ()", (const void *)script); return speechEnabled() ? 1 : 0; } -int KyraEngine_v2::o2_isVoicePlaying(ScriptState *script) { +int KyraEngine_v2::o2_isVoicePlaying(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_isVoicePlaying(%p) ()", (const void *)script); return (snd_voiceIsPlaying() && !skipFlag()) ? 1 : 0; } -int KyraEngine_v2::o2_stopVoicePlaying(ScriptState *script) { +int KyraEngine_v2::o2_stopVoicePlaying(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_stopVoicePlaying(%p) ()", (const void *)script); snd_stopVoice(); return 0; } -int KyraEngine_v2::o2_getGameLanguage(ScriptState *script) { +int KyraEngine_v2::o2_getGameLanguage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getGameLanguage(%p) ()", (const void *)script); return _lang; } -int KyraEngine_v2::o2_demoFinale(ScriptState *script) { +int KyraEngine_v2::o2_demoFinale(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_demoFinale(%p) ()", (const void *)script); if (!_flags.isDemo) return 0; @@ -1783,14 +1783,14 @@ int KyraEngine_v2::o2_demoFinale(ScriptState *script) { return 0; } -int KyraEngine_v2::o2_dummy(ScriptState *script) { +int KyraEngine_v2::o2_dummy(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_dummy(%p) ()", (const void *)script); return 0; } #pragma mark - -int KyraEngine_v2::o2t_defineNewShapes(ScriptState *script) { +int KyraEngine_v2::o2t_defineNewShapes(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2t_defineNewShapes(%p) ('%s', %d, %d, %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6)); @@ -1805,7 +1805,7 @@ int KyraEngine_v2::o2t_defineNewShapes(ScriptState *script) { return 0; } -int KyraEngine_v2::o2t_setCurrentFrame(ScriptState *script) { +int KyraEngine_v2::o2t_setCurrentFrame(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2t_setCurrentFrame(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _newShapeAnimFrame = stackPos(0); _newShapeDelay = stackPos(1); @@ -1813,19 +1813,19 @@ int KyraEngine_v2::o2t_setCurrentFrame(ScriptState *script) { return 0; } -int KyraEngine_v2::o2t_playSoundEffect(ScriptState *script) { +int KyraEngine_v2::o2t_playSoundEffect(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2t_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0)); snd_playSoundEffect(stackPos(0)); return 0; } -int KyraEngine_v2::o2t_fadeScenePal(ScriptState *script) { +int KyraEngine_v2::o2t_fadeScenePal(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2t_fadeScenePal(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); fadeScenePal(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v2::o2t_setShapeFlag(ScriptState *script) { +int KyraEngine_v2::o2t_setShapeFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2t_setShapeFlag(%p) (%d)", (const void *)script, stackPos(0)); if (_flags.isTalkie) _newShapeFlag = stackPos(0); @@ -1872,7 +1872,7 @@ int KyraEngine_v2::t2_playSoundEffect(const TIM *tim, const uint16 *param) { #pragma mark - -typedef Common::Functor1Mem<ScriptState*, int, KyraEngine_v2> OpcodeV2; +typedef Common::Functor1Mem<EMCState*, int, KyraEngine_v2> OpcodeV2; #define SetOpcodeTable(x) table = &x; #define Opcode(x) table->push_back(new OpcodeV2(this, &KyraEngine_v2::x)) #define OpcodeUnImpl() table->push_back(new OpcodeV2(this, 0)) diff --git a/engines/kyra/script_v3.cpp b/engines/kyra/script_v3.cpp index c15a49b89a..6cd469bdcd 100644 --- a/engines/kyra/script_v3.cpp +++ b/engines/kyra/script_v3.cpp @@ -34,12 +34,12 @@ namespace Kyra { -int KyraEngine_v3::o3_getMalcolmShapes(ScriptState *script) { +int KyraEngine_v3::o3_getMalcolmShapes(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getMaloclmShapes(%p) ()", (const void *)script); return _malcolmShapes; } -int KyraEngine_v3::o3_setCharacterPos(ScriptState *script) { +int KyraEngine_v3::o3_setCharacterPos(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setCharacterPos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int x = stackPos(0); int y = stackPos(1); @@ -55,7 +55,7 @@ int KyraEngine_v3::o3_setCharacterPos(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_defineObject(ScriptState *script) { +int KyraEngine_v3::o3_defineObject(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_defineObject(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7)); TalkObject &obj = _talkObjectList[stackPos(0)]; @@ -69,7 +69,7 @@ int KyraEngine_v3::o3_defineObject(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_refreshCharacter(ScriptState *script) { +int KyraEngine_v3::o3_refreshCharacter(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_refreshCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); const int frame = stackPos(0); const int facing = stackPos(1); @@ -90,44 +90,44 @@ int KyraEngine_v3::o3_refreshCharacter(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_getCharacterX(ScriptState *script) { +int KyraEngine_v3::o3_getCharacterX(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getCharacterX(%p) ()", (const void *)script); return _mainCharacter.x1; } -int KyraEngine_v3::o3_getCharacterY(ScriptState *script) { +int KyraEngine_v3::o3_getCharacterY(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getCharacterY(%p) ()", (const void *)script); return _mainCharacter.y1; } -int KyraEngine_v3::o3_getCharacterFacing(ScriptState *script) { +int KyraEngine_v3::o3_getCharacterFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getCharacterFacing(%p) ()", (const void *)script); return _mainCharacter.facing; } -int KyraEngine_v3::o3_getCharacterScene(ScriptState *script) { +int KyraEngine_v3::o3_getCharacterScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getCharacterScene(%p) ()", (const void *)script); return _mainCharacter.sceneId; } -int KyraEngine_v3::o3_getMalcolmsMood(ScriptState *script) { +int KyraEngine_v3::o3_getMalcolmsMood(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getMalcolmsMood(%p) ()", (const void *)script); return _malcolmsMood; } -int KyraEngine_v3::o3_getCharacterFrameFromFacing(ScriptState *script) { +int KyraEngine_v3::o3_getCharacterFrameFromFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getCharacterFrameFromFacing(%p) ()", (const void *)script); return _characterFrameTable[_mainCharacter.facing]; } -int KyraEngine_v3::o3_setCharacterFacingOverwrite(ScriptState *script) { +int KyraEngine_v3::o3_setCharacterFacingOverwrite(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setCharacterFacingOverwrite(%p) (%d)", (const void *)script, stackPos(0)); _mainCharacter.facing = stackPos(0); _overwriteSceneFacing = true; return 0; } -int KyraEngine_v3::o3_trySceneChange(ScriptState *script) { +int KyraEngine_v3::o3_trySceneChange(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_trySceneChange(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); @@ -136,7 +136,7 @@ int KyraEngine_v3::o3_trySceneChange(ScriptState *script) { _unkHandleSceneChangeFlag = 0; if (success) { - _scriptInterpreter->initScript(script, script->dataPtr); + _emc->init(script, script->dataPtr); _unk4 = 0; _unk3 = -1; _unk5 = 1; @@ -146,25 +146,25 @@ int KyraEngine_v3::o3_trySceneChange(ScriptState *script) { } } -int KyraEngine_v3::o3_moveCharacter(ScriptState *script) { +int KyraEngine_v3::o3_moveCharacter(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_moveCharacter(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); moveCharacter(stackPos(0), stackPos(1), stackPos(2)); return 0; } -int KyraEngine_v3::o3_setCharacterFacing(ScriptState *script) { +int KyraEngine_v3::o3_setCharacterFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setCharacterFacing(%p) (%d)", (const void *)script, stackPos(0)); _mainCharacter.facing = stackPos(0); return 0; } -int KyraEngine_v3::o3_showSceneFileMessage(ScriptState *script) { +int KyraEngine_v3::o3_showSceneFileMessage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_showSceneFileMessage(%p) (%d)", (const void *)script, stackPos(0)); showMessage((const char*)getTableEntry(_scenesFile, stackPos(0)), 0xFF, 0xF0); return 0; } -int KyraEngine_v3::o3_setCharacterAnimFrameFromFacing(ScriptState *script) { +int KyraEngine_v3::o3_setCharacterAnimFrameFromFacing(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setCharacterAnimFrameFromFacing(%p) ()", (const void *)script); updateCharPal(0); _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; @@ -173,30 +173,30 @@ int KyraEngine_v3::o3_setCharacterAnimFrameFromFacing(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_showBadConscience(ScriptState *script) { +int KyraEngine_v3::o3_showBadConscience(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_showBadConscience(%p) ()", (const void *)script); showBadConscience(); return 0; } -int KyraEngine_v3::o3_hideBadConscience(ScriptState *script) { +int KyraEngine_v3::o3_hideBadConscience(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_hideBadConscience(%p) ()", (const void *)script); hideBadConscience(); return 0; } -int KyraEngine_v3::o3_setInventorySlot(ScriptState *script) { +int KyraEngine_v3::o3_setInventorySlot(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setInventorySlot(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int slot = MAX<int16>(0, MIN<int16>(10, stackPos(0))); return (_mainCharacter.inventory[slot] = stackPos(1)); } -int KyraEngine_v3::o3_getInventorySlot(ScriptState *script) { +int KyraEngine_v3::o3_getInventorySlot(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getInventorySlot(%p) (%d)", (const void *)script, stackPos(0)); return _mainCharacter.inventory[stackPos(0)]; } -int KyraEngine_v3::o3_addItemToInventory(ScriptState *script) { +int KyraEngine_v3::o3_addItemToInventory(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_addItemToInventory(%p) (%d)", (const void *)script, stackPos(0)); int slot = findFreeInventorySlot(); if (slot >= 0) { @@ -210,7 +210,7 @@ int KyraEngine_v3::o3_addItemToInventory(ScriptState *script) { return slot; } -int KyraEngine_v3::o3_addItemToCurScene(ScriptState *script) { +int KyraEngine_v3::o3_addItemToCurScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_addItemToCurScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); const uint16 item = stackPos(0); int x = stackPos(1); @@ -239,7 +239,7 @@ int KyraEngine_v3::o3_addItemToCurScene(ScriptState *script) { return itemSlot; } -int KyraEngine_v3::o3_objectChat(ScriptState *script) { +int KyraEngine_v3::o3_objectChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_objectChat(%p) (%d)", (const void *)script, stackPos(0)); int id = stackPos(0); const char *str = (const char*)getTableEntry(_useActorBuffer ? _actorFile : _sceneStrings, id); @@ -250,18 +250,18 @@ int KyraEngine_v3::o3_objectChat(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_checkForItem(ScriptState *script) { +int KyraEngine_v3::o3_checkForItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_checkForItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1; } -int KyraEngine_v3::o3_resetInventory(ScriptState *script) { +int KyraEngine_v3::o3_resetInventory(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_resetInventory(%p) ()", (const void *)script); memset(_mainCharacter.inventory, -1, sizeof(_mainCharacter.inventory)); return 0; } -int KyraEngine_v3::o3_defineItem(ScriptState *script) { +int KyraEngine_v3::o3_defineItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_defineItem(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); int freeItem = findFreeItem(); if (freeItem != -1) { @@ -273,7 +273,7 @@ int KyraEngine_v3::o3_defineItem(ScriptState *script) { return freeItem; } -int KyraEngine_v3::o3_removeInventoryItemInstances(ScriptState *script) { +int KyraEngine_v3::o3_removeInventoryItemInstances(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_removeInventoryItemInstances(%p) (%d)", (const void *)script, stackPos(0)); const int item = stackPos(0); for (int i = 0; i < 10; ++i) { @@ -283,7 +283,7 @@ int KyraEngine_v3::o3_removeInventoryItemInstances(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_countInventoryItemInstances(ScriptState *script) { +int KyraEngine_v3::o3_countInventoryItemInstances(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_countInventoryItemInstances(%p) (%d)", (const void *)script, stackPos(0)); const int item = stackPos(0); int count = 0; @@ -299,7 +299,7 @@ int KyraEngine_v3::o3_countInventoryItemInstances(ScriptState *script) { return count; } -int KyraEngine_v3::o3_npcChatSequence(ScriptState *script) { +int KyraEngine_v3::o3_npcChatSequence(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_npcChatSequence(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int id = stackPos(0); const char *str = (const char*)getTableEntry(_sceneStrings, id); @@ -308,47 +308,47 @@ int KyraEngine_v3::o3_npcChatSequence(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_queryGameFlag(ScriptState *script) { +int KyraEngine_v3::o3_queryGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_queryGameFlag(%p) (%d)", (const void *)script, stackPos(0)); return queryGameFlag(stackPos(0)); } -int KyraEngine_v3::o3_resetGameFlag(ScriptState *script) { +int KyraEngine_v3::o3_resetGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_resetGameFlag(%p) (%d)", (const void *)script, stackPos(0)); resetGameFlag(stackPos(0)); return 0; } -int KyraEngine_v3::o3_setGameFlag(ScriptState *script) { +int KyraEngine_v3::o3_setGameFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setGameFlag(%p) (%d)", (const void *)script, stackPos(0)); setGameFlag(stackPos(0)); return 1; } -int KyraEngine_v3::o3_setHandItem(ScriptState *script) { +int KyraEngine_v3::o3_setHandItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setHandItem(%p) (%d)", (const void *)script, stackPos(0)); setHandItem(stackPos(0)); return 0; } -int KyraEngine_v3::o3_removeHandItem(ScriptState *script) { +int KyraEngine_v3::o3_removeHandItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_removeHandItem(%p) ()", (const void *)script); removeHandItem(); return 0; } -int KyraEngine_v3::o3_handItemSet(ScriptState *script) { +int KyraEngine_v3::o3_handItemSet(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_handItemSet(%p) ()", (const void *)script); return _handItemSet; } -int KyraEngine_v3::o3_hideMouse(ScriptState *script) { +int KyraEngine_v3::o3_hideMouse(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_hideMouse(%p) ()", (const void *)script); _screen->hideMouse(); return 0; } -int KyraEngine_v3::o3_addSpecialExit(ScriptState *script) { +int KyraEngine_v3::o3_addSpecialExit(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_addSpecialExit(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); if (_specialExitCount < 5) { @@ -362,19 +362,19 @@ int KyraEngine_v3::o3_addSpecialExit(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_setMousePos(ScriptState *script) { +int KyraEngine_v3::o3_setMousePos(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); setMousePos(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v3::o3_showMouse(ScriptState *script) { +int KyraEngine_v3::o3_showMouse(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_showMouse(%p) ()", (const void *)script); _screen->showMouse(); return 0; } -int KyraEngine_v3::o3_badConscienceChat(ScriptState *script) { +int KyraEngine_v3::o3_badConscienceChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_badConscienceChat(%p) (%d)", (const void *)script, stackPos(0)); int id = stackPos(0); const char *str = (const char*)getTableEntry(_useActorBuffer ? _actorFile : _sceneStrings, id); @@ -382,7 +382,7 @@ int KyraEngine_v3::o3_badConscienceChat(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_wipeDownMouseItem(ScriptState *script) { +int KyraEngine_v3::o3_wipeDownMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_wipeDownMouseItem(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2)); _screen->hideMouse(); const int x = stackPos(1) - 12; @@ -409,12 +409,12 @@ int KyraEngine_v3::o3_wipeDownMouseItem(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_setMalcolmsMood(ScriptState *script) { +int KyraEngine_v3::o3_setMalcolmsMood(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setMalcolmsMood(%p) (%d)", (const void *)script, stackPos(0)); return (_malcolmsMood = stackPos(0)); } -int KyraEngine_v3::o3_delay(ScriptState *script) { +int KyraEngine_v3::o3_delay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); if (stackPos(1)) { uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength; @@ -437,25 +437,25 @@ int KyraEngine_v3::o3_delay(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_updateScore(ScriptState *script) { +int KyraEngine_v3::o3_updateScore(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_updateScore(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return updateScore(stackPos(0), stackPos(1)) ? 1 : 0; } -int KyraEngine_v3::o3_makeSecondChanceSave(ScriptState *script) { +int KyraEngine_v3::o3_makeSecondChanceSave(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_makeSecondChanceSave(%p) ()", (const void *)script); saveGame(getSavegameFilename(999), "SECOND CHANCE SAVE GAME"); return 0; } -int KyraEngine_v3::o3_setSceneFilename(ScriptState *script) { +int KyraEngine_v3::o3_setSceneFilename(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setSceneFilename(%p) (%d, '%s')", (const void *)script, stackPos(0), stackPosString(1)); strcpy(_sceneList[stackPos(0)].filename1, stackPosString(1)); _sceneList[stackPos(0)].filename1[9] = 0; return 0; } -int KyraEngine_v3::o3_removeItemsFromScene(ScriptState *script) { +int KyraEngine_v3::o3_removeItemsFromScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_removeItemsFromScene(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); const uint16 itemId = stackPos(0); const uint16 sceneId = stackPos(1); @@ -475,14 +475,14 @@ int KyraEngine_v3::o3_removeItemsFromScene(ScriptState *script) { return retValue; } -int KyraEngine_v3::o3_disguiseMalcolm(ScriptState *script) { +int KyraEngine_v3::o3_disguiseMalcolm(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_disguiseMalcolm(%p) (%d)", (const void *)script, stackPos(0)); loadMalcolmShapes(stackPos(0)); updateDlgIndex(); return 0; } -int KyraEngine_v3::o3_drawSceneShape(ScriptState *script) { +int KyraEngine_v3::o3_drawSceneShape(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_drawSceneShape(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); int shape = stackPos(0); @@ -506,7 +506,7 @@ int KyraEngine_v3::o3_drawSceneShape(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_drawSceneShapeOnPage(ScriptState *script) { +int KyraEngine_v3::o3_drawSceneShapeOnPage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_drawSceneShapeOnPage(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); const int shape = stackPos(0); @@ -516,7 +516,7 @@ int KyraEngine_v3::o3_drawSceneShapeOnPage(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_checkInRect(ScriptState *script) { +int KyraEngine_v3::o3_checkInRect(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_checkInRect(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); const int x1 = stackPos(0); @@ -541,7 +541,7 @@ int KyraEngine_v3::o3_checkInRect(ScriptState *script) { } } -int KyraEngine_v3::o3_updateConversations(ScriptState *script) { +int KyraEngine_v3::o3_updateConversations(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_updateConversations(%p) (%d)", (const void *)script, stackPos(0)); int dlgIndex = stackPos(0); switch (_currentChapter-2) { @@ -745,14 +745,14 @@ int KyraEngine_v3::o3_updateConversations(ScriptState *script) { return 1; } -int KyraEngine_v3::o3_setSceneDim(ScriptState *script) { +int KyraEngine_v3::o3_setSceneDim(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setSceneDim(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _sceneMinX = stackPos(0); _sceneMaxX = stackPos(1); return 0; } -int KyraEngine_v3::o3_setSceneAnimPosAndFrame(ScriptState *script) { +int KyraEngine_v3::o3_setSceneAnimPosAndFrame(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setSceneAnimPosAndFrame(%p) (%d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); SceneAnim &anim = _sceneAnims[stackPos(0)]; @@ -781,7 +781,7 @@ int KyraEngine_v3::o3_setSceneAnimPosAndFrame(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_update(ScriptState *script) { +int KyraEngine_v3::o3_update(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_update(%p) (%d)", (const void *)script, stackPos(0)); for (int times = stackPos(0); times != 0; --times) { if (_chatText) @@ -792,7 +792,7 @@ int KyraEngine_v3::o3_update(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_removeItemInstances(ScriptState *script) { +int KyraEngine_v3::o3_removeItemInstances(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_removeItemInstances(%p) (%d)", (const void *)script, stackPos(0)); const int16 item = stackPos(0); @@ -820,19 +820,19 @@ int KyraEngine_v3::o3_removeItemInstances(ScriptState *script) { return deleted; } -int KyraEngine_v3::o3_disableInventory(ScriptState *script) { +int KyraEngine_v3::o3_disableInventory(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_disableInventory(%p) ()", (const void *)script); _enableInventory = false; return 0; } -int KyraEngine_v3::o3_enableInventory(ScriptState *script) { +int KyraEngine_v3::o3_enableInventory(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_enableInventory(%p) ()", (const void *)script); _enableInventory = true; return 1; } -int KyraEngine_v3::o3_enterNewScene(ScriptState *script) { +int KyraEngine_v3::o3_enterNewScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_enterNewScene(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); @@ -850,7 +850,7 @@ int KyraEngine_v3::o3_enterNewScene(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_switchScene(ScriptState *script) { +int KyraEngine_v3::o3_switchScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_switchScene(%p) (%d)", (const void *)script, stackPos(0)); setGameFlag(1); _mainCharX = _mainCharacter.x1; @@ -861,12 +861,12 @@ int KyraEngine_v3::o3_switchScene(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_getShapeFlag1(ScriptState *script) { +int KyraEngine_v3::o3_getShapeFlag1(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getShapeFlag1(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return _screen->getShapeFlag1(stackPos(0), stackPos(1)); } -int KyraEngine_v3::o3_setMalcolmPos(ScriptState *script) { +int KyraEngine_v3::o3_setMalcolmPos(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setMalcolmPos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _mainCharX = stackPos(0); _mainCharY = stackPos(1); @@ -879,30 +879,30 @@ int KyraEngine_v3::o3_setMalcolmPos(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_stopMusic(ScriptState *script) { +int KyraEngine_v3::o3_stopMusic(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_stopMusic(%p) ()", (const void *)script); stopMusicTrack(); return 0; } -int KyraEngine_v3::o3_playWanderScoreViaMap(ScriptState *script) { +int KyraEngine_v3::o3_playWanderScoreViaMap(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_playWanderScoreViaMap(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); snd_playWanderScoreViaMap(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v3::o3_playSoundEffect(ScriptState *script) { +int KyraEngine_v3::o3_playSoundEffect(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_playSoundEffect(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); snd_playSoundEffect(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v3::o3_getScore(ScriptState *script) { +int KyraEngine_v3::o3_getScore(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getScore(%p) ()", (const void *)script); return _score; } -int KyraEngine_v3::o3_blockOutRegion(ScriptState *script) { +int KyraEngine_v3::o3_blockOutRegion(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_blockOutRegion(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); const int x1 = stackPos(0); int y1 = stackPos(1); @@ -918,31 +918,31 @@ int KyraEngine_v3::o3_blockOutRegion(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_showSceneStringsMessage(ScriptState *script) { +int KyraEngine_v3::o3_showSceneStringsMessage(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_showSceneStringsMessage(%p) (%d)", (const void *)script, stackPos(0)); showMessage((const char*)getTableEntry(_sceneStrings, stackPos(0)), 0xFF, 0xF0); return 0; } -int KyraEngine_v3::o3_getRand(ScriptState *script) { +int KyraEngine_v3::o3_getRand(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) < stackPos(1)); return _rnd.getRandomNumberRng(stackPos(0), stackPos(1)); } -int KyraEngine_v3::o3_setDeathHandler(ScriptState *script) { +int KyraEngine_v3::o3_setDeathHandler(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setDeathHandler(%p) (%d)", (const void *)script, stackPos(0)); _deathHandler = stackPos(0); return 0; } -int KyraEngine_v3::o3_showGoodConscience(ScriptState *script) { +int KyraEngine_v3::o3_showGoodConscience(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_showGoodConscience(%p) ()", (const void *)script); showGoodConscience(); return 0; } -int KyraEngine_v3::o3_goodConscienceChat(ScriptState *script) { +int KyraEngine_v3::o3_goodConscienceChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_goodConscienceChat(%p) (%d)", (const void *)script, stackPos(0)); int id = stackPos(0); const char *str = (const char*)getTableEntry(_useActorBuffer ? _actorFile : _sceneStrings, id); @@ -950,13 +950,13 @@ int KyraEngine_v3::o3_goodConscienceChat(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_hideGoodConscience(ScriptState *script) { +int KyraEngine_v3::o3_hideGoodConscience(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_hideGoodConscience(%p) ()", (const void *)script); hideGoodConscience(); return 0; } -int KyraEngine_v3::o3_waitForConfirmationClick(ScriptState *script) { +int KyraEngine_v3::o3_waitForConfirmationClick(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o2_waitForConfirmationClick(%p) (%d)", (const void *)script, stackPos(0)); resetSkipFlag(); uint32 maxWaitTime = _system->getMillis() + stackPos(0) * _tickLength; @@ -980,7 +980,7 @@ int KyraEngine_v3::o3_waitForConfirmationClick(ScriptState *script) { return 1; } -int KyraEngine_v3::o3_defineRoomEntrance(ScriptState *script) { +int KyraEngine_v3::o3_defineRoomEntrance(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_defineRoomEntrance(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); switch (stackPos(0)) { case 0: @@ -1009,7 +1009,7 @@ int KyraEngine_v3::o3_defineRoomEntrance(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_runTemporaryScript(ScriptState *script) { +int KyraEngine_v3::o3_runTemporaryScript(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_runTemporaryScript(%p) ('%s', %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3)); const int newShapes = stackPos(1); @@ -1019,14 +1019,14 @@ int KyraEngine_v3::o3_runTemporaryScript(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_setSpecialSceneScriptRunTime(ScriptState *script) { +int KyraEngine_v3::o3_setSpecialSceneScriptRunTime(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setSpecialSceneScriptRunTime(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); assert(stackPos(0) >= 0 && stackPos(0) < 10); _sceneSpecialScriptsTimer[stackPos(0)] = _system->getMillis() + stackPos(1) * _tickLength; return 0; } -int KyraEngine_v3::o3_defineSceneAnim(ScriptState *script) { +int KyraEngine_v3::o3_defineSceneAnim(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_defineSceneAnim(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPosString(12)); @@ -1083,24 +1083,24 @@ int KyraEngine_v3::o3_defineSceneAnim(ScriptState *script) { return 9; } -int KyraEngine_v3::o3_updateSceneAnim(ScriptState *script) { +int KyraEngine_v3::o3_updateSceneAnim(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_updateSceneAnim(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); updateSceneAnim(stackPos(0), stackPos(1)); _specialSceneScriptRunFlag = false; return 0; } -int KyraEngine_v3::o3_runActorScript(ScriptState *script) { +int KyraEngine_v3::o3_runActorScript(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_runActorScript(%p) ()", (const void *)script); - ScriptData data; - ScriptState state; + EMCData data; + EMCState state; memset(&data, 0, sizeof(data)); memset(&state, 0, sizeof(state)); _res->exists("_ACTOR.EMC", true); - _scriptInterpreter->loadScript("_ACTOR.EMC", &data, &_opcodes); - _scriptInterpreter->initScript(&state, &data); - _scriptInterpreter->startScript(&state, 0); + _emc->load("_ACTOR.EMC", &data, &_opcodes); + _emc->init(&state, &data); + _emc->start(&state, 0); state.regs[4] = _itemInHand; state.regs[0] = _mainCharacter.sceneId; @@ -1109,12 +1109,12 @@ int KyraEngine_v3::o3_runActorScript(ScriptState *script) { _vocHigh = 200; _useActorBuffer = true; - while (_scriptInterpreter->validScript(&state)) - _scriptInterpreter->runScript(&state); + while (_emc->isValid(&state)) + _emc->run(&state); _useActorBuffer = false; _vocHigh = vocHigh; - _scriptInterpreter->unloadScript(&data); + _emc->unload(&data); if (queryGameFlag(0x218)) { resetGameFlag(0x218); @@ -1124,30 +1124,30 @@ int KyraEngine_v3::o3_runActorScript(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_runDialog(ScriptState *script) { +int KyraEngine_v3::o3_runDialog(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_runDialog(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); runDialog(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v3::o3_malcolmRandomChat(ScriptState *script) { +int KyraEngine_v3::o3_malcolmRandomChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_malcolmRandomChat(%p) ()", (const void *)script); malcolmRandomChat(); return 0; } -int KyraEngine_v3::o3_setDlgIndex(ScriptState *script) { +int KyraEngine_v3::o3_setDlgIndex(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setDlgIndex(%p) (%d)", (const void *)script, stackPos(0)); setDlgIndex(stackPos(0)); return 0; } -int KyraEngine_v3::o3_getDlgIndex(ScriptState *script) { +int KyraEngine_v3::o3_getDlgIndex(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getDlgIndex(%p) ()", (const void *)script); return _mainCharacter.dlgIndex; } -int KyraEngine_v3::o3_defineScene(ScriptState *script) { +int KyraEngine_v3::o3_defineScene(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_defineScene(%p) (%d, '%s', %d, %d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPosString(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7)); const int scene = stackPos(0); @@ -1173,7 +1173,7 @@ int KyraEngine_v3::o3_defineScene(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_setConversationState(ScriptState *script) { +int KyraEngine_v3::o3_setConversationState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setConversationState(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); int id = stackPos(0); const int dlgIndex = stackPos(1); @@ -1203,7 +1203,7 @@ int KyraEngine_v3::o3_setConversationState(ScriptState *script) { return (_conversationState[id][dlgIndex] = value); } -int KyraEngine_v3::o3_getConversationState(ScriptState *script) { +int KyraEngine_v3::o3_getConversationState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getConversationState(%p) (%d)", (const void *)script, stackPos(0)); int id = stackPos(0); const int dlgIndex = _mainCharacter.dlgIndex; @@ -1232,13 +1232,13 @@ int KyraEngine_v3::o3_getConversationState(ScriptState *script) { return _conversationState[id][dlgIndex]; } -int KyraEngine_v3::o3_changeChapter(ScriptState *script) { +int KyraEngine_v3::o3_changeChapter(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_changeChapter(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3)); changeChapter(stackPos(0), stackPos(1), stackPos(2), stackPos(3)); return 0; } -int KyraEngine_v3::o3_countItemInstances(ScriptState *script) { +int KyraEngine_v3::o3_countItemInstances(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_countItemInstances(%p) (%d)", (const void *)script, stackPos(0)); int count = 0; const int16 item = stackPos(0); @@ -1259,46 +1259,46 @@ int KyraEngine_v3::o3_countItemInstances(ScriptState *script) { return count; } -int KyraEngine_v3::o3_dialogStartScript(ScriptState *script) { +int KyraEngine_v3::o3_dialogStartScript(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_dialogStartScript(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); dialogStartScript(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v3::o3_dialogEndScript(ScriptState *script) { +int KyraEngine_v3::o3_dialogEndScript(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_dialogEndScript(%p) (%d)", (const void *)script, stackPos(0)); dialogEndScript(stackPos(0)); return 0; } -int KyraEngine_v3::o3_setSpecialSceneScriptState(ScriptState *script) { +int KyraEngine_v3::o3_setSpecialSceneScriptState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0)); _specialSceneScriptState[stackPos(0)] = 1; return 1; } -int KyraEngine_v3::o3_clearSpecialSceneScriptState(ScriptState *script) { +int KyraEngine_v3::o3_clearSpecialSceneScriptState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_clearSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0)); _specialSceneScriptState[stackPos(0)] = 0; return 0; } -int KyraEngine_v3::o3_querySpecialSceneScriptState(ScriptState *script) { +int KyraEngine_v3::o3_querySpecialSceneScriptState(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_querySpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0)); return _specialSceneScriptState[stackPos(0)]; } -int KyraEngine_v3::o3_setHiddenItemsEntry(ScriptState *script) { +int KyraEngine_v3::o3_setHiddenItemsEntry(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setHiddenItemsEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); return (_hiddenItems[stackPos(0)] = (uint16)stackPos(1)); } -int KyraEngine_v3::o3_getHiddenItemsEntry(ScriptState *script) { +int KyraEngine_v3::o3_getHiddenItemsEntry(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getHiddenItemsEntry(%p) (%d)", (const void *)script, stackPos(0)); return (int16)_hiddenItems[stackPos(0)]; } -int KyraEngine_v3::o3_customChat(ScriptState *script) { +int KyraEngine_v3::o3_customChat(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_customChat(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); const int id = stackPos(0); const int object = stackPos(1); @@ -1316,7 +1316,7 @@ int KyraEngine_v3::o3_customChat(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_customChatFinish(ScriptState *script) { +int KyraEngine_v3::o3_customChatFinish(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_customChatFinish(%p) ()", (const void *)script); _text->restoreScreen(); _chatText = 0; @@ -1324,7 +1324,7 @@ int KyraEngine_v3::o3_customChatFinish(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_setupSceneAnimObject(ScriptState *script) { +int KyraEngine_v3::o3_setupSceneAnimObject(EMCState *script) { debugC(9, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setupSceneAnimObject(%p) (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s')", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5), stackPos(6), stackPos(7), stackPos(8), stackPos(9), stackPos(10), stackPos(11), stackPosString(12)); @@ -1334,49 +1334,49 @@ int KyraEngine_v3::o3_setupSceneAnimObject(ScriptState *script) { return 0; } -int KyraEngine_v3::o3_removeSceneAnimObject(ScriptState *script) { +int KyraEngine_v3::o3_removeSceneAnimObject(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_removeSceneAnimObject(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); removeSceneAnimObject(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v3::o3_disableTimer(ScriptState *script) { +int KyraEngine_v3::o3_disableTimer(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_disableTimer(%p) (%d)", (const void *)script, stackPos(0)); _timer->disable(stackPos(0)); return 0; } -int KyraEngine_v3::o3_enableTimer(ScriptState *script) { +int KyraEngine_v3::o3_enableTimer(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_enableTimer(%p) (%d)", (const void *)script, stackPos(0)); _timer->enable(stackPos(0)); return 0; } -int KyraEngine_v3::o3_setTimerCountdown(ScriptState *script) { +int KyraEngine_v3::o3_setTimerCountdown(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setTimerCountdown(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); _timer->setCountdown(stackPos(0), stackPos(1)); return 0; } -int KyraEngine_v3::o3_setVocHigh(ScriptState *script) { +int KyraEngine_v3::o3_setVocHigh(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_setVocHigh(%p) (%d)", (const void *)script, stackPos(0)); _vocHigh = stackPos(0); return 0; } -int KyraEngine_v3::o3_getVocHigh(ScriptState *script) { +int KyraEngine_v3::o3_getVocHigh(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_getVocHigh(%p) ()", (const void *)script); return _vocHigh; } -int KyraEngine_v3::o3_dummy(ScriptState *script) { +int KyraEngine_v3::o3_dummy(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3_dummy(%p) ()", (const void *)script); return 0; } #pragma mark - -int KyraEngine_v3::o3t_defineNewShapes(ScriptState *script) { +int KyraEngine_v3::o3t_defineNewShapes(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3t_defineNewShapes(%p) ('%s', %d, %d, %d, %d, %d)", (const void *)script, stackPosString(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); strcpy(_newShapeFilename, stackPosString(0)); @@ -1388,7 +1388,7 @@ int KyraEngine_v3::o3t_defineNewShapes(ScriptState *script) { return 0; } -int KyraEngine_v3::o3t_setCurrentFrame(ScriptState *script) { +int KyraEngine_v3::o3t_setCurrentFrame(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3t_setCurrentFrame(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); static const uint8 frameTable[] = { 0x58, 0xD8, 0xD8, 0x98, 0x78, 0x78, 0xB8, 0xB8 @@ -1403,7 +1403,7 @@ int KyraEngine_v3::o3t_setCurrentFrame(ScriptState *script) { return 0; } -int KyraEngine_v3::o3t_setNewShapeFlag(ScriptState *script) { +int KyraEngine_v3::o3t_setNewShapeFlag(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3t_setNewShapeFlag(%p) (%d)", (const void *)script, stackPos(0)); _newShapeFlag = stackPos(0); return 0; @@ -1411,14 +1411,14 @@ int KyraEngine_v3::o3t_setNewShapeFlag(ScriptState *script) { #pragma mark - -int KyraEngine_v3::o3d_updateAnim(ScriptState *script) { +int KyraEngine_v3::o3d_updateAnim(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3d_updateAnim(%p) (%d)", (const void *)script, stackPos(0)); if (_dialogSceneAnim >= 0) updateSceneAnim(_dialogSceneAnim, stackPos(0)); return 0; } -int KyraEngine_v3::o3d_delay(ScriptState *script) { +int KyraEngine_v3::o3d_delay(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v3::o3d_delay(%p) (%d)", (const void *)script, stackPos(0)); const uint32 endTime = _system->getMillis() + stackPos(0) * _tickLength; while (_system->getMillis() < endTime) { @@ -1433,7 +1433,7 @@ int KyraEngine_v3::o3d_delay(ScriptState *script) { #pragma mark - -typedef Common::Functor1Mem<ScriptState*, int, KyraEngine_v3> OpcodeV3; +typedef Common::Functor1Mem<EMCState*, int, KyraEngine_v3> OpcodeV3; #define SetOpcodeTable(x) table = &x; #define Opcode(x) table->push_back(new OpcodeV3(this, &KyraEngine_v3::x)) #define OpcodeUnImpl() table->push_back(new OpcodeV3(this, 0)) diff --git a/engines/kyra/sequences_v3.cpp b/engines/kyra/sequences_v3.cpp index 827d48d7ac..5a67c3bd68 100644 --- a/engines/kyra/sequences_v3.cpp +++ b/engines/kyra/sequences_v3.cpp @@ -188,11 +188,11 @@ void KyraEngine_v3::runTemporaryScript(const char *filename, int allowSkip, int memset(&_temporaryScriptData, 0, sizeof(_temporaryScriptData)); memset(&_temporaryScriptState, 0, sizeof(_temporaryScriptState)); - if (!_scriptInterpreter->loadScript(filename, &_temporaryScriptData, &_opcodesTemporary)) + if (!_emc->load(filename, &_temporaryScriptData, &_opcodesTemporary)) error("Couldn't load temporary script '%s'", filename); - _scriptInterpreter->initScript(&_temporaryScriptState, &_temporaryScriptData); - _scriptInterpreter->startScript(&_temporaryScriptState, 0); + _emc->init(&_temporaryScriptState, &_temporaryScriptData); + _emc->start(&_temporaryScriptState, 0); _newShapeFlag = -1; @@ -202,8 +202,8 @@ void KyraEngine_v3::runTemporaryScript(const char *filename, int allowSkip, int _newShapeCount = 0; } - while (_scriptInterpreter->validScript(&_temporaryScriptState)) - _scriptInterpreter->runScript(&_temporaryScriptState); + while (_emc->isValid(&_temporaryScriptState)) + _emc->run(&_temporaryScriptState); uint8 *fileData = 0; @@ -213,7 +213,7 @@ void KyraEngine_v3::runTemporaryScript(const char *filename, int allowSkip, int fileData = _newShapeFiledata; if (!fileData) { - _scriptInterpreter->unloadScript(&_temporaryScriptData); + _emc->unload(&_temporaryScriptData); return; } @@ -228,7 +228,7 @@ void KyraEngine_v3::runTemporaryScript(const char *filename, int allowSkip, int _newShapeFiledata = 0; } - _scriptInterpreter->unloadScript(&_temporaryScriptData); + _emc->unload(&_temporaryScriptData); } void KyraEngine_v3::eelScript() { @@ -289,15 +289,15 @@ void KyraEngine_v3::processNewShapes(int allowSkip, int resetChar) { debugC(9, kDebugLevelAnimator, "KyraEngine_v3::processNewShapes(%d, %d)", allowSkip, resetChar); setCharacterAnimDim(_newShapeWidth, _newShapeHeight); - _scriptInterpreter->initScript(&_temporaryScriptState, &_temporaryScriptData); - _scriptInterpreter->startScript(&_temporaryScriptState, 1); + _emc->init(&_temporaryScriptState, &_temporaryScriptData); + _emc->start(&_temporaryScriptState, 1); resetSkipFlag(); - while (_scriptInterpreter->validScript(&_temporaryScriptState)) { + while (_emc->isValid(&_temporaryScriptState)) { _temporaryScriptExecBit = false; - while (_scriptInterpreter->validScript(&_temporaryScriptState) && !_temporaryScriptExecBit) - _scriptInterpreter->runScript(&_temporaryScriptState); + while (_emc->isValid(&_temporaryScriptState) && !_temporaryScriptExecBit) + _emc->run(&_temporaryScriptState); if (_newShapeAnimFrame < 0) continue; diff --git a/engines/kyra/text_v2.cpp b/engines/kyra/text_v2.cpp index 3dbcd8b4cc..0fa1d3cd9f 100644 --- a/engines/kyra/text_v2.cpp +++ b/engines/kyra/text_v2.cpp @@ -299,11 +299,11 @@ void KyraEngine_v2::objectChatProcess(const char *script) { memset(&_chatScriptData, 0, sizeof(_chatScriptData)); memset(&_chatScriptState, 0, sizeof(_chatScriptState)); - _scriptInterpreter->loadScript(script, &_chatScriptData, &_opcodesTemporary); - _scriptInterpreter->initScript(&_chatScriptState, &_chatScriptData); - _scriptInterpreter->startScript(&_chatScriptState, 0); - while (_scriptInterpreter->validScript(&_chatScriptState)) - _scriptInterpreter->runScript(&_chatScriptState); + _emc->load(script, &_chatScriptData, &_opcodesTemporary); + _emc->init(&_chatScriptState, &_chatScriptData); + _emc->start(&_chatScriptState, 0); + while (_emc->isValid(&_chatScriptState)) + _emc->run(&_chatScriptState); _newShapeFilename[2] = _loadedZTable + '0'; uint8 *shapeBuffer = _res->fileData(_newShapeFilename, 0); @@ -322,27 +322,27 @@ void KyraEngine_v2::objectChatProcess(const char *script) { warning("couldn't load file '%s'", _newShapeFilename); } - _scriptInterpreter->unloadScript(&_chatScriptData); + _emc->unload(&_chatScriptData); } void KyraEngine_v2::objectChatWaitToFinish() { int charAnimFrame = _mainCharacter.animFrame; setCharacterAnimDim(_newShapeWidth, _newShapeHeight); - _scriptInterpreter->initScript(&_chatScriptState, &_chatScriptData); - _scriptInterpreter->startScript(&_chatScriptState, 1); + _emc->init(&_chatScriptState, &_chatScriptData); + _emc->start(&_chatScriptState, 1); bool running = true; const uint32 endTime = _chatEndTime; resetSkipFlag(); while (running && !_quitFlag) { - if (!_scriptInterpreter->validScript(&_chatScriptState)) - _scriptInterpreter->startScript(&_chatScriptState, 1); + if (!_emc->isValid(&_chatScriptState)) + _emc->start(&_chatScriptState, 1); _temporaryScriptExecBit = false; - while (!_temporaryScriptExecBit && _scriptInterpreter->validScript(&_chatScriptState)) - _scriptInterpreter->runScript(&_chatScriptState); + while (!_temporaryScriptExecBit && _emc->isValid(&_chatScriptState)) + _emc->run(&_chatScriptState); int curFrame = _newShapeAnimFrame; uint32 delayTime = _newShapeDelay; diff --git a/engines/kyra/text_v3.cpp b/engines/kyra/text_v3.cpp index 69568d718f..47301eacec 100644 --- a/engines/kyra/text_v3.cpp +++ b/engines/kyra/text_v3.cpp @@ -312,11 +312,11 @@ void KyraEngine_v3::objectChatProcess(const char *script) { memset(&_chatScriptData, 0, sizeof(_chatScriptData)); memset(&_chatScriptState, 0, sizeof(_chatScriptState)); - _scriptInterpreter->loadScript(script, &_chatScriptData, &_opcodesTemporary); - _scriptInterpreter->initScript(&_chatScriptState, &_chatScriptData); - _scriptInterpreter->startScript(&_chatScriptState, 0); - while (_scriptInterpreter->validScript(&_chatScriptState)) - _scriptInterpreter->runScript(&_chatScriptState); + _emc->load(script, &_chatScriptData, &_opcodesTemporary); + _emc->init(&_chatScriptState, &_chatScriptData); + _emc->start(&_chatScriptState, 0); + while (_emc->isValid(&_chatScriptState)) + _emc->run(&_chatScriptState); if (_chatVocHigh >= 0) { playVoice(_chatVocHigh, _chatVocLow); @@ -327,7 +327,7 @@ void KyraEngine_v3::objectChatProcess(const char *script) { objectChatWaitToFinish(); _useFrameTable = false; - _scriptInterpreter->unloadScript(&_chatScriptData); + _emc->unload(&_chatScriptData); } void KyraEngine_v3::objectChatWaitToFinish() { @@ -335,21 +335,21 @@ void KyraEngine_v3::objectChatWaitToFinish() { int charAnimFrame = _mainCharacter.animFrame; setCharacterAnimDim(_newShapeWidth, _newShapeHeight); - _scriptInterpreter->initScript(&_chatScriptState, &_chatScriptData); - _scriptInterpreter->startScript(&_chatScriptState, 1); + _emc->init(&_chatScriptState, &_chatScriptData); + _emc->start(&_chatScriptState, 1); bool running = true; const uint32 endTime = _chatEndTime; resetSkipFlag(); while (running && !_quitFlag) { - if (!_scriptInterpreter->validScript(&_chatScriptState)) - _scriptInterpreter->startScript(&_chatScriptState, 1); + if (!_emc->isValid(&_chatScriptState)) + _emc->start(&_chatScriptState, 1); _temporaryScriptExecBit = false; - while (!_temporaryScriptExecBit && _scriptInterpreter->validScript(&_chatScriptState)) { + while (!_temporaryScriptExecBit && _emc->isValid(&_chatScriptState)) { musicUpdate(0); - _scriptInterpreter->runScript(&_chatScriptState); + _emc->run(&_chatScriptState); } int curFrame = _newShapeAnimFrame; @@ -676,33 +676,33 @@ void KyraEngine_v3::dialogStartScript(int object, int funcNum) { _specialSceneScriptState[_dialogSceneScript] = true; } - _scriptInterpreter->initScript(&_dialogScriptState, &_dialogScriptData); - _scriptInterpreter->loadScript(_talkObjectList[object].filename, &_dialogScriptData, &_opcodesDialog); + _emc->init(&_dialogScriptState, &_dialogScriptData); + _emc->load(_talkObjectList[object].filename, &_dialogScriptData, &_opcodesDialog); _dialogScriptFuncStart = funcNum * 3 + 0; _dialogScriptFuncProc = funcNum * 3 + 1; _dialogScriptFuncEnd = funcNum * 3 + 2; - _scriptInterpreter->startScript(&_dialogScriptState, _dialogScriptFuncStart); - while (_scriptInterpreter->validScript(&_dialogScriptState)) - _scriptInterpreter->runScript(&_dialogScriptState); + _emc->start(&_dialogScriptState, _dialogScriptFuncStart); + while (_emc->isValid(&_dialogScriptState)) + _emc->run(&_dialogScriptState); } void KyraEngine_v3::dialogEndScript(int object) { debugC(9, kDebugLevelMain, "KyraEngine_v3::dialogEndScript(%d)", object); - _scriptInterpreter->initScript(&_dialogScriptState, &_dialogScriptData); - _scriptInterpreter->startScript(&_dialogScriptState, _dialogScriptFuncEnd); + _emc->init(&_dialogScriptState, &_dialogScriptData); + _emc->start(&_dialogScriptState, _dialogScriptFuncEnd); - while (_scriptInterpreter->validScript(&_dialogScriptState)) - _scriptInterpreter->runScript(&_dialogScriptState); + while (_emc->isValid(&_dialogScriptState)) + _emc->run(&_dialogScriptState); if (_dialogSceneAnim >= 0 && _dialogSceneScript >= 0) { _specialSceneScriptState[_dialogSceneScript] = _specialSceneScriptStateBackup[_dialogSceneScript]; _dialogSceneScript = _dialogSceneAnim = -1; } - _scriptInterpreter->unloadScript(&_dialogScriptData); + _emc->unload(&_dialogScriptData); } void KyraEngine_v3::npcChatSequence(const char *str, int object, int vocHigh, int vocLow) { @@ -719,17 +719,17 @@ void KyraEngine_v3::npcChatSequence(const char *str, int object, int vocHigh, in _chatVocHigh = _chatVocLow = -1; } - _scriptInterpreter->initScript(&_dialogScriptState, &_dialogScriptData); - _scriptInterpreter->startScript(&_dialogScriptState, _dialogScriptFuncProc); + _emc->init(&_dialogScriptState, &_dialogScriptData); + _emc->start(&_dialogScriptState, _dialogScriptFuncProc); resetSkipFlag(); uint32 endTime = _chatEndTime; bool running = true; while (running) { - if (!_scriptInterpreter->runScript(&_dialogScriptState)) { - _scriptInterpreter->initScript(&_dialogScriptState, &_dialogScriptData); - _scriptInterpreter->startScript(&_dialogScriptState, _dialogScriptFuncProc); + if (!_emc->run(&_dialogScriptState)) { + _emc->init(&_dialogScriptState, &_dialogScriptData); + _emc->start(&_dialogScriptState, _dialogScriptFuncProc); } const uint32 curTime = _system->getMillis(); diff --git a/engines/kyra/timer_v3.cpp b/engines/kyra/timer_v3.cpp index 5f93a00c8a..5688895758 100644 --- a/engines/kyra/timer_v3.cpp +++ b/engines/kyra/timer_v3.cpp @@ -51,15 +51,15 @@ void KyraEngine_v3::timerRestoreCommandLine(int arg) { void KyraEngine_v3::timerRunSceneScript7(int arg) { debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v3::timerRunSceneScript7(%d)", arg); - _scriptInterpreter->initScript(&_sceneScriptState, &_sceneScriptData); + _emc->init(&_sceneScriptState, &_sceneScriptData); _sceneScriptState.regs[1] = _mouseX; _sceneScriptState.regs[2] = _mouseY; _sceneScriptState.regs[3] = 0; _sceneScriptState.regs[4] = _itemInHand; - _scriptInterpreter->startScript(&_sceneScriptState, 7); + _emc->start(&_sceneScriptState, 7); - while (_scriptInterpreter->validScript(&_sceneScriptState)) - _scriptInterpreter->runScript(&_sceneScriptState); + while (_emc->isValid(&_sceneScriptState)) + _emc->run(&_sceneScriptState); } void KyraEngine_v3::timerFleaDeath(int arg) { |