diff options
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/animator_hof.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/animator_mr.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/gui_hof.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/gui_mr.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/items_hof.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/items_lok.cpp | 12 | ||||
-rw-r--r-- | engines/kyra/items_mr.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/items_v2.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_hof.cpp | 14 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/kyra_lok.h | 15 | ||||
-rw-r--r-- | engines/kyra/kyra_mr.cpp | 22 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.h | 17 | ||||
-rw-r--r-- | engines/kyra/kyra_v2.h | 11 | ||||
-rw-r--r-- | engines/kyra/saveload_lok.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/scene_mr.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/script_hof.cpp | 20 | ||||
-rw-r--r-- | engines/kyra/script_lok.cpp | 64 | ||||
-rw-r--r-- | engines/kyra/script_mr.cpp | 26 | ||||
-rw-r--r-- | engines/kyra/script_v1.cpp | 87 | ||||
-rw-r--r-- | engines/kyra/script_v2.cpp | 56 |
22 files changed, 177 insertions, 205 deletions
diff --git a/engines/kyra/animator_hof.cpp b/engines/kyra/animator_hof.cpp index f9fe281179..1192145530 100644 --- a/engines/kyra/animator_hof.cpp +++ b/engines/kyra/animator_hof.cpp @@ -139,7 +139,7 @@ void KyraEngine_HoF::updateItemAnimations() { return; uint16 shpIdx = s->frames[a->currentFrame].index + 64; - if (s->itemIndex == _handItemSet && s->itemIndex == _itemInHand && _screen->isMouseVisible()) { + if (s->itemIndex == _mouseState && s->itemIndex == _itemInHand && _screen->isMouseVisible()) { nextFrame = true; _screen->setMouseCursor(8, 15, getShapePtr(shpIdx)); } diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp index 5952f8df5a..f04ca0345d 100644 --- a/engines/kyra/animator_mr.cpp +++ b/engines/kyra/animator_mr.cpp @@ -216,7 +216,7 @@ void KyraEngine_MR::updateItemAnimations() { return; uint16 shpIdx = s->frames[a->currentFrame].index + 248; - if (s->itemIndex == _handItemSet && s->itemIndex == _itemInHand && _screen->isMouseVisible()) { + if (s->itemIndex == _mouseState && s->itemIndex == _itemInHand && _screen->isMouseVisible()) { nextFrame = true; _screen->setMouseCursor(12, 19, getShapePtr(shpIdx)); } diff --git a/engines/kyra/gui_hof.cpp b/engines/kyra/gui_hof.cpp index d60b353de3..d983bce0d7 100644 --- a/engines/kyra/gui_hof.cpp +++ b/engines/kyra/gui_hof.cpp @@ -348,7 +348,7 @@ int KyraEngine_HoF::bookButton(Button *button) { return 0; } - if (_handItemSet != -1) { + if (_mouseState != -1) { snd_playSoundEffect(0x0D); return 0; } @@ -601,7 +601,7 @@ int KyraEngine_HoF::cauldronButton(Button *button) { return 0; } - if (!_screen->isMouseVisible() || _handItemSet < -1) + if (!_screen->isMouseVisible() || _mouseState < -1) return 0; if (queryGameFlag(0xE4)) { @@ -681,8 +681,8 @@ int GUI_HoF::optionsButton(Button *button) { _vm->showMessage(0, 0xCF); - if (_vm->_handItemSet < -1) { - _vm->_handItemSet = -1; + if (_vm->_mouseState < -1) { + _vm->_mouseState = -1; _screen->hideMouse(); _screen->setMouseCursor(1, 1, _vm->getShapePtr(0)); _screen->showMouse(); diff --git a/engines/kyra/gui_mr.cpp b/engines/kyra/gui_mr.cpp index d0a39df0b2..0384b3c138 100644 --- a/engines/kyra/gui_mr.cpp +++ b/engines/kyra/gui_mr.cpp @@ -194,7 +194,7 @@ void KyraEngine_MR::showInventory() { _screen->hideMouse(); if (_itemInHand < 0) { - _handItemSet = -1; + _mouseState = -1; _screen->setMouseCursor(0, 0, getShapePtr(0)); } @@ -684,7 +684,7 @@ int KyraEngine_MR::buttonJesterStaff(Button *button) { void KyraEngine_MR::showAlbum() { debugC(9, kDebugLevelMain, "KyraEngine_MR::showAlbum()"); - if (!_screen->isMouseVisible() || queryGameFlag(4) || _handItemSet != -1) + if (!_screen->isMouseVisible() || queryGameFlag(4) || _mouseState != -1) return; if (!loadLanguageFile("ALBUM.", _album.file)) @@ -1262,8 +1262,8 @@ int GUI_MR::optionsButton(Button *button) { _vm->showMessage(0, 0xF0, 0xF0); - if (_vm->_handItemSet < -1) { - _vm->_handItemSet = -1; + if (_vm->_mouseState < -1) { + _vm->_mouseState = -1; _screen->hideMouse(); _screen->setMouseCursor(1, 1, _vm->getShapePtr(0)); _screen->showMouse(); diff --git a/engines/kyra/items_hof.cpp b/engines/kyra/items_hof.cpp index da3062fe2c..4dfc73a5ad 100644 --- a/engines/kyra/items_hof.cpp +++ b/engines/kyra/items_hof.cpp @@ -83,7 +83,7 @@ void KyraEngine_HoF::updateWaterFlasks() { bool KyraEngine_HoF::dropItem(int unk1, uint16 item, int x, int y, int unk2) { debugC(9, kDebugLevelMain, "KyraEngine_HoF::dropItem(%d, %u, %d, %d, %d)", unk1, item, x, y, unk2); - if (_handItemSet <= -1) + if (_mouseState <= -1) return false; bool success = processItemDrop(_mainCharacter.sceneId, item, x, y, unk1, unk2); diff --git a/engines/kyra/items_lok.cpp b/engines/kyra/items_lok.cpp index c468a6e197..e86be25707 100644 --- a/engines/kyra/items_lok.cpp +++ b/engines/kyra/items_lok.cpp @@ -175,16 +175,16 @@ void KyraEngine_LoK::placeItemInGenericMapScene(int item, int index) { } } -void KyraEngine_LoK::createMouseItem(int item) { - debugC(9, kDebugLevelMain, "KyraEngine_LoK::createMouseItem(%d)", item); +void KyraEngine_LoK::setHandItem(uint16 item) { + debugC(9, kDebugLevelMain, "KyraEngine_LoK::setHandItem(%d)", item); _screen->hideMouse(); setMouseItem(item); _itemInHand = item; _screen->showMouse(); } -void KyraEngine_LoK::destroyMouseItem() { - debugC(9, kDebugLevelMain, "KyraEngine_LoK::destroyMouseItem()"); +void KyraEngine_LoK::removeHandItem() { + debugC(9, kDebugLevelMain, "KyraEngine_LoK::removeHandItem()"); _screen->hideMouse(); _screen->setMouseCursor(1, 1, _shapes[0]); _itemInHand = -1; @@ -222,7 +222,7 @@ void KyraEngine_LoK::wipeDownMouseItem(int xpos, int ypos) { } restoreItemRect1(xpos, ypos); _screen->resetShapeHeight(_shapes[216+_itemInHand]); - destroyMouseItem(); + removeHandItem(); _screen->showMouse(); } @@ -420,7 +420,7 @@ int KyraEngine_LoK::processItemDrop(uint16 sceneId, uint8 item, int x, int y, in itemSpecialFX(x, y, item); if (unk1 == 0) - destroyMouseItem(); + removeHandItem(); itemDropDown(x, y, destX, destY, freeItem, item); diff --git a/engines/kyra/items_mr.cpp b/engines/kyra/items_mr.cpp index 8ace9f8a3c..299c826e80 100644 --- a/engines/kyra/items_mr.cpp +++ b/engines/kyra/items_mr.cpp @@ -97,7 +97,7 @@ void KyraEngine_MR::setMouseCursor(uint16 item) { void KyraEngine_MR::setItemMouseCursor() { debugC(9, kDebugLevelMain, "KyraEngine_MR::setItemMouseCursor()"); - _handItemSet = _itemInHand; + _mouseState = _itemInHand; if (_itemInHand == -1) _screen->setMouseCursor(0, 0, _gameShapes[0]); else @@ -107,7 +107,7 @@ void KyraEngine_MR::setItemMouseCursor() { bool KyraEngine_MR::dropItem(int unk1, uint16 item, int x, int y, int unk2) { debugC(9, kDebugLevelMain, "KyraEngine_MR::dropItem(%d, %d, %d, %d, %d)", unk1, item, x, y, unk2); - if (_handItemSet <= -1) + if (_mouseState <= -1) return false; if (processItemDrop(_mainCharacter.sceneId, item, x, y, unk1, unk2)) diff --git a/engines/kyra/items_v2.cpp b/engines/kyra/items_v2.cpp index 923bf876b1..83f637b06f 100644 --- a/engines/kyra/items_v2.cpp +++ b/engines/kyra/items_v2.cpp @@ -112,7 +112,7 @@ void KyraEngine_v2::removeHandItem() { scr->hideMouse(); scr->setMouseCursor(0, 0, getShapePtr(0)); _itemInHand = -1; - _handItemSet = -1; + _mouseState = -1; scr->showMouse(); } diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index f1b74a7bdb..0bc5162e94 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -81,7 +81,7 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn _oldTalkFile = -1; _currentTalkFile = 0; _lastSfxTrack = -1; - _handItemSet = -1; + _mouseState = -1; _unkHandleSceneChangeFlag = false; _pathfinderFlag = 0; _mouseX = _mouseY = 0; @@ -449,7 +449,7 @@ void KyraEngine_HoF::runLoop() { update(); if (inputFlag == 198 || inputFlag == 199) { - _unk3 = _handItemSet; + _unk3 = _mouseState; handleInput(_mouseX, _mouseY); } @@ -568,7 +568,7 @@ bool KyraEngine_HoF::handleInputUnkSub(int x, int y) { if (y > 143 || _deathHandler > -1 || queryGameFlag(0x164)) return false; - if (_handItemSet <= -3 && findItem(_mainCharacter.sceneId, 13) >= 0) { + if (_mouseState <= -3 && findItem(_mainCharacter.sceneId, 13) >= 0) { updateCharFacing(); objectChat(getTableString(0xFC, _cCodeBuffer, 1), 0, 0x83, 0xFC); return true; @@ -723,16 +723,16 @@ void KyraEngine_HoF::updateMouse() { yOffset = 9; } - if (type != 0 && _handItemSet != type && _screen->isMouseVisible()) { - _handItemSet = type; + if (type != 0 && _mouseState != type && _screen->isMouseVisible()) { + _mouseState = type; _screen->hideMouse(); _screen->setMouseCursor(xOffset, yOffset, getShapePtr(shapeIndex)); _screen->showMouse(); } - if (type == 0 && _handItemSet != _itemInHand && _screen->isMouseVisible()) { + if (type == 0 && _mouseState != _itemInHand && _screen->isMouseVisible()) { if ((mouse.y > 145) || (mouse.x > 6 && mouse.x < 312 && mouse.y > 6 && mouse.y < 135)) { - _handItemSet = _itemInHand; + _mouseState = _itemInHand; _screen->hideMouse(); if (_itemInHand == -1) _screen->setMouseCursor(0, 0, getShapePtr(0)); diff --git a/engines/kyra/kyra_lok.cpp b/engines/kyra/kyra_lok.cpp index 6ab2db5492..6636b8ba6d 100644 --- a/engines/kyra/kyra_lok.cpp +++ b/engines/kyra/kyra_lok.cpp @@ -247,7 +247,7 @@ int KyraEngine_LoK::init() { _marbleVaseItem = -1; memset(_foyerItemTable, -1, sizeof(_foyerItemTable)); - _mouseState = _itemInHand = -1; + _itemInHand = -1; _handleInput = false; _currentRoom = 0xFFFF; @@ -414,7 +414,7 @@ void KyraEngine_LoK::mainLoop() { snd_playSoundEffect(49); _screen->hideMouse(); _screen->setMouseCursor(1, 1, _shapes[0]); - destroyMouseItem(); + removeHandItem(); _screen->showMouse(); _gui->buttonMenuCallback(0); _deathHandler = 0xFF; diff --git a/engines/kyra/kyra_lok.h b/engines/kyra/kyra_lok.h index eed2f71ab0..cb63f8ef2f 100644 --- a/engines/kyra/kyra_lok.h +++ b/engines/kyra/kyra_lok.h @@ -282,8 +282,8 @@ protected: void placeItemInGenericMapScene(int item, int index); // -> mouse item - void createMouseItem(int item); - void destroyMouseItem(); + void setHandItem(uint16 item); + void removeHandItem(); void setMouseItem(int item); // -> graphics effects @@ -392,7 +392,6 @@ protected: uint8 *_itemBkgBackUp[2]; uint8 *_shapes[373]; int8 _itemInHand; - int _mouseState; bool _handleInput; bool _changedScene; int _unkScreenVar1, _unkScreenVar2, _unkScreenVar3; @@ -658,9 +657,6 @@ protected: 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); @@ -668,13 +664,11 @@ protected: 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); @@ -708,14 +702,11 @@ protected: 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); @@ -775,8 +766,6 @@ protected: 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); diff --git a/engines/kyra/kyra_mr.cpp b/engines/kyra/kyra_mr.cpp index f53192d68a..88f9b307a2 100644 --- a/engines/kyra/kyra_mr.cpp +++ b/engines/kyra/kyra_mr.cpp @@ -99,7 +99,7 @@ KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngi _unk5 = 0; _unkSceneScreenFlag1 = false; _noScriptEnter = true; - _itemInHand = _handItemSet = -1; + _itemInHand = _mouseState = -1; _unk3 = -1; _unk4 = 0; _loadingState = false; @@ -999,7 +999,7 @@ void KyraEngine_MR::runLoop() { _timer->update(); if (inputFlag == 198 || inputFlag == 199) { - _unk3 = _handItemSet; + _unk3 = _mouseState; Common::Point mouse = getMousePos(); handleInput(mouse.x, mouse.y); } @@ -1181,13 +1181,13 @@ void KyraEngine_MR::updateMouse() { if (mouse.y > 187) { bool setItemCursor = false; - if (_handItemSet == -6) { + if (_mouseState == -6) { if (mouse.x < 311) setItemCursor = true; - } else if (_handItemSet == -5) { + } else if (_mouseState == -5) { if (mouse.x < _sceneMinX || mouse.x > _sceneMaxX) setItemCursor = true; - } else if (_handItemSet == -4) { + } else if (_mouseState == -4) { if (mouse.x > 8) setItemCursor = true; } @@ -1204,8 +1204,8 @@ void KyraEngine_MR::updateMouse() { hideInventory(); } - if (hasItemCollision && _handItemSet < -1 && _itemInHand < 0) { - _handItemSet = -1; + if (hasItemCollision && _mouseState < -1 && _itemInHand < 0) { + _mouseState = -1; _itemInHand = -1; _screen->setMouseCursor(0, 0, _gameShapes[0]); } @@ -1282,12 +1282,12 @@ void KyraEngine_MR::updateMouse() { } } - if (type != 0 && type != _handItemSet && !hasItemCollision) { - _handItemSet = type; + if (type != 0 && type != _mouseState && !hasItemCollision) { + _mouseState = type; _screen->setMouseCursor(offsetX, offsetY, _gameShapes[shape]); - } else if (type == 0 && _handItemSet != _itemInHand && mouse.x > 8 && mouse.x < 311 && mouse.y < 171 && mouse.y > 8) { + } else if (type == 0 && _mouseState != _itemInHand && mouse.x > 8 && mouse.x < 311 && mouse.y < 171 && mouse.y > 8) { setItemMouseCursor(); - } else if (mouse.y > 187 && _handItemSet > -4 && type == 0 && !_inventoryState) { + } else if (mouse.y > 187 && _mouseState > -4 && type == 0 && !_inventoryState) { showInventory(); } } diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 8109ab0e26..76b68d5164 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -62,6 +62,8 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags) _gameToLoad = -1; + _mouseState = -1; + memset(_flagsTable, 0, sizeof(_flagsTable)); // sets up all engine specific debug levels diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 076c6bbd54..1b410d1907 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -212,6 +212,23 @@ protected: virtual void setupOpcodeTable() = 0; Common::Array<const Opcode*> _opcodes; + int o1_queryGameFlag(EMCState *script); + int o1_setGameFlag(EMCState *script); + int o1_resetGameFlag(EMCState *script); + int o1_getRand(EMCState *script); + int o1_hideMouse(EMCState *script); + int o1_showMouse(EMCState *script); + int o1_setMousePos(EMCState *script); + int o1_setHandItem(EMCState *script); + int o1_removeHandItem(EMCState *script); + int o1_getMouseState(EMCState *script); + + // items + int _mouseState; + + virtual void setHandItem(uint16 item) = 0; + virtual void removeHandItem() = 0; + // game flags uint8 _flagsTable[100]; // TODO: check this value diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index f487799744..44eb06ce57 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -318,7 +318,6 @@ protected: int _itemListSize; int _itemInHand; - int _handItemSet; int findFreeItem(); int countAllItems(); @@ -393,21 +392,11 @@ protected: int o2_moveCharacter(EMCState *script); int o2_checkForItem(EMCState *script); int o2_defineItem(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_delay(EMCState *script); int o2_update(EMCState *script); int o2_getShapeFlag1(EMCState *script); int o2_playWanderScoreViaMap(EMCState *script); - int o2_getRand(EMCState *script); int o2_setDeathHandler(EMCState *script); int o2_waitForConfirmationClick(EMCState *script); int o2_randomSceneChat(EMCState *script); diff --git a/engines/kyra/saveload_lok.cpp b/engines/kyra/saveload_lok.cpp index 6f1fc484fd..8af73acc61 100644 --- a/engines/kyra/saveload_lok.cpp +++ b/engines/kyra/saveload_lok.cpp @@ -183,7 +183,7 @@ void KyraEngine_LoK::loadGame(const char *fileName) { _screen->copyRegion(0, 0, 0, 0, 320, 200, 8, 0); } - createMouseItem(_itemInHand); + setHandItem(_itemInHand); _animator->setBrandonAnimSeqSize(3, 48); redrawInventory(0); _animator->_noDrawShapesFlag = 1; diff --git a/engines/kyra/scene_mr.cpp b/engines/kyra/scene_mr.cpp index 16b5f1fd4d..e4a3a5c54e 100644 --- a/engines/kyra/scene_mr.cpp +++ b/engines/kyra/scene_mr.cpp @@ -182,7 +182,7 @@ void KyraEngine_MR::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2 if (_itemInHand < 0) { _itemInHand = -1; - _handItemSet = -1; + _mouseState = -1; _screen->setMouseCursor(0, 0, _gameShapes[0]); } diff --git a/engines/kyra/script_hof.cpp b/engines/kyra/script_hof.cpp index 4525d71548..b6835ab044 100644 --- a/engines/kyra/script_hof.cpp +++ b/engines/kyra/script_hof.cpp @@ -1560,19 +1560,19 @@ void KyraEngine_HoF::setupOpcodeTable() { Opcode(o2_removeItemFromInventory); Opcode(o2_countItemInInventory); Opcode(o2_countItemsInScene); - Opcode(o2_queryGameFlag); + Opcode(o1_queryGameFlag); // 0x28 - Opcode(o2_resetGameFlag); - Opcode(o2_setGameFlag); - Opcode(o2_setHandItem); - Opcode(o2_removeHandItem); + Opcode(o1_resetGameFlag); + Opcode(o1_setGameFlag); + Opcode(o1_setHandItem); + Opcode(o1_removeHandItem); // 0x2c - Opcode(o2_handItemSet); - Opcode(o2_hideMouse); + Opcode(o1_getMouseState); + Opcode(o1_hideMouse); Opcode(o2_addSpecialExit); - Opcode(o2_setMousePos); + Opcode(o1_setMousePos); // 0x30 - Opcode(o2_showMouse); + Opcode(o1_showMouse); OpcodeUnImpl(); Opcode(o2_wipeDownMouseItem); Opcode(o2_getElapsedSecs); @@ -1632,7 +1632,7 @@ void KyraEngine_HoF::setupOpcodeTable() { Opcode(o2_setCauldronState); Opcode(o2_showItemString); // 0x60 - Opcode(o2_getRand); + Opcode(o1_getRand); Opcode(o2_isAnySoundPlaying); Opcode(o2_setDeathHandler); Opcode(o2_setDrawNoShapeFlag); diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp index 3f578d9e0f..f944e59b4a 100644 --- a/engines/kyra/script_lok.cpp +++ b/engines/kyra/script_lok.cpp @@ -92,21 +92,6 @@ int KyraEngine_LoK::o1_drawSceneAnimShape(EMCState *script) { return 0; } -int KyraEngine_LoK::o1_queryGameFlag(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_queryGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); - return queryGameFlag(stackPos(0)); -} - -int KyraEngine_LoK::o1_setGameFlag(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_setGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); - return setGameFlag(stackPos(0)); -} - -int KyraEngine_LoK::o1_resetGameFlag(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_resetGameFlag(%p) (0x%X)", (const void *)script, stackPos(0)); - return resetGameFlag(stackPos(0)); -} - int KyraEngine_LoK::o1_runNPCScript(EMCState *script) { warning("STUB: o1_runNPCScript"); return 0; @@ -205,12 +190,6 @@ int KyraEngine_LoK::o1_drawAnimShapeIntoScene(EMCState *script) { return 0; } -int KyraEngine_LoK::o1_createMouseItem(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_createMouseItem(%p) (%d)", (const void *)script, stackPos(0)); - createMouseItem(stackPos(0)); - return 0; -} - int KyraEngine_LoK::o1_savePageToDisk(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_savePageToDisk(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); _screen->savePageToDisk(stackPosString(0), stackPos(1)); @@ -241,12 +220,6 @@ int KyraEngine_LoK::o1_mouseIsPointer(EMCState *script) { return 0; } -int KyraEngine_LoK::o1_destroyMouseItem(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_destroyMouseItem(%p) ()", (const void *)script); - destroyMouseItem(); - return 0; -} - int KyraEngine_LoK::o1_runSceneAnimUntilDone(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_runSceneAnimUntilDone(%p) (%d)", (const void *)script, stackPos(0)); _screen->hideMouse(); @@ -665,18 +638,6 @@ int KyraEngine_LoK::o1_restoreCustomPrintBackground(EMCState *script) { return 0; } -int KyraEngine_LoK::o1_hideMouse(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_hideMouse(%p) ()", (const void *)script); - _screen->hideMouse(); - return 0; -} - -int KyraEngine_LoK::o1_showMouse(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_showMouse(%p) ()", (const void *)script); - _screen->showMouse(); - return 0; -} - int KyraEngine_LoK::o1_getCharacterX(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_getCharacterX(%p) (%d)", (const void *)script, stackPos(0)); return _characterList[stackPos(0)].x1; @@ -728,12 +689,6 @@ int KyraEngine_LoK::o1_printText(EMCState *script) { return 0; } -int KyraEngine_LoK::o1_random(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::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_LoK::o1_loadSoundFile(EMCState *script) { warning("STUB: o1_loadSoundFile"); return 0; @@ -922,7 +877,7 @@ int KyraEngine_LoK::o1_wipeDownMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_wipeDownMouseItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); _screen->hideMouse(); wipeDownMouseItem(stackPos(1), stackPos(2)); - destroyMouseItem(); + removeHandItem(); _screen->showMouse(); return 0; } @@ -1512,17 +1467,6 @@ int KyraEngine_LoK::o1_restoreBrandonsMovementDelay(EMCState *script) { return 0; } -int KyraEngine_LoK::o1_setMousePos(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); - _system->warpMouse(stackPos(0), stackPos(1)); - return 0; -} - -int KyraEngine_LoK::o1_getMouseState(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_getMouseState(%p) ()", (const void *)script); - return _mouseState; -} - int KyraEngine_LoK::o1_setEntranceMouseCursorTrack(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::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); @@ -1845,7 +1789,7 @@ void KyraEngine_LoK::setupOpcodeTable() { // 0x0c Opcode(o1_dropItemInScene); Opcode(o1_drawAnimShapeIntoScene); - Opcode(o1_createMouseItem); + Opcode(o1_setHandItem); Opcode(o1_savePageToDisk); // 0x10 Opcode(o1_sceneAnimOn); @@ -1853,7 +1797,7 @@ void KyraEngine_LoK::setupOpcodeTable() { Opcode(o1_getElapsedSeconds); Opcode(o1_mouseIsPointer); // 0x14 - Opcode(o1_destroyMouseItem); + Opcode(o1_removeHandItem); Opcode(o1_runSceneAnimUntilDone); Opcode(o1_fadeSpecialPalette); Opcode(o1_playAdlibSound); @@ -1904,7 +1848,7 @@ void KyraEngine_LoK::setupOpcodeTable() { Opcode(o1_copyWSARegion); // 0x3c Opcode(o1_printText); - Opcode(o1_random); + Opcode(o1_getRand); Opcode(o1_loadSoundFile); Opcode(o1_displayWSAFrameOnHidPage); // 0x40 diff --git a/engines/kyra/script_mr.cpp b/engines/kyra/script_mr.cpp index 0142a06b7d..af0bde24c1 100644 --- a/engines/kyra/script_mr.cpp +++ b/engines/kyra/script_mr.cpp @@ -1199,19 +1199,19 @@ void KyraEngine_MR::setupOpcodeTable() { Opcode(o3_removeInventoryItemInstances); Opcode(o3_countInventoryItemInstances); Opcode(o3_npcChatSequence); - Opcode(o2_queryGameFlag); + Opcode(o1_queryGameFlag); // 0x28 - Opcode(o2_resetGameFlag); - Opcode(o2_setGameFlag); - Opcode(o2_setHandItem); - Opcode(o2_removeHandItem); + Opcode(o1_resetGameFlag); + Opcode(o1_setGameFlag); + Opcode(o1_setHandItem); + Opcode(o1_removeHandItem); // 0x2c - Opcode(o2_handItemSet); - Opcode(o2_hideMouse); + Opcode(o1_getMouseState); + Opcode(o1_hideMouse); Opcode(o2_addSpecialExit); - Opcode(o2_setMousePos); + Opcode(o1_setMousePos); // 0x30 - Opcode(o2_showMouse); + Opcode(o1_showMouse); Opcode(o3_badConscienceChat); Opcode(o3_wipeDownMouseItem); Opcode(o3_dummy); @@ -1271,7 +1271,7 @@ void KyraEngine_MR::setupOpcodeTable() { Opcode(o3_showSceneStringsMessage); OpcodeUnImpl(); // 0x60 - Opcode(o2_getRand); + Opcode(o1_getRand); Opcode(o3_dummy); Opcode(o2_setDeathHandler); Opcode(o3_showGoodConscience); @@ -1379,7 +1379,7 @@ void KyraEngine_MR::setupOpcodeTable() { Opcode(o3_dummy); // 0x0a Opcode(o2a_setResetFrame); - Opcode(o2_getRand); + Opcode(o1_getRand); Opcode(o3_getMalcolmShapes); Opcode(o3_dummy); @@ -1387,8 +1387,8 @@ void KyraEngine_MR::setupOpcodeTable() { // 0x00 Opcode(o3d_updateAnim); Opcode(o3d_delay); - Opcode(o2_getRand); - Opcode(o2_queryGameFlag); + Opcode(o1_getRand); + Opcode(o1_queryGameFlag); // 0x04 Opcode(o3_dummy); } diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp new file mode 100644 index 0000000000..150b736865 --- /dev/null +++ b/engines/kyra/script_v1.cpp @@ -0,0 +1,87 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "kyra/kyra_v1.h" + +namespace Kyra { + +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(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(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_getRand(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_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_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(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_showMouse(%p) ()", (const void *)script); + _screen->showMouse(); + return 0; +} + +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_setHandItem(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setHandItem(%p) (%d)", (const void *)script, stackPos(0)); + setHandItem(stackPos(0)); + return 0; +} + +int KyraEngine_v1::o1_removeHandItem(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_removeHandItem(%p) ()", (const void *)script); + removeHandItem(); + return 0; +} + +int KyraEngine_v1::o1_getMouseState(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getMouseState(%p) ()", (const void *)script); + return _mouseState; +} + +} // end of namespace Kyra + diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index fcfb34561f..8c412cd560 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -103,44 +103,6 @@ int KyraEngine_v2::o2_defineItem(EMCState *script) { return freeItem; } -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(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(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(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(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_removeHandItem(%p) ()", (const void *)script); - removeHandItem(); - return 0; -} - -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(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_hideMouse(%p) ()", (const void *)script); - screen()->hideMouse(); - return 0; -} - 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)); @@ -155,18 +117,6 @@ int KyraEngine_v2::o2_addSpecialExit(EMCState *script) { return 0; } -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(EMCState *script) { - debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_showMouse(%p) ()", (const void *)script); - screen()->showMouse(); - return 0; -} - 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)) { @@ -212,12 +162,6 @@ int KyraEngine_v2::o2_playWanderScoreViaMap(EMCState *script) { return 0; } -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_setDeathHandler(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setDeathHandler(%p) (%d)", (const void *)script, stackPos(0)); _deathHandler = stackPos(0); |