From 515b69ddb87e5f7236f0e6ec98f65e7c6b4705d3 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 24 Dec 2005 18:00:35 +0000 Subject: Started to implement button handling (atm only the inventory works) Also implemented following opcodes: - cmd_waitForConfirmationMouseClick - cmd_drawItemShapeIntoScene - cmd_setFireberryGlowPalette - cmd_findBrightestFireberry - cmd_sceneToDirection - cmd_createAmuletJewel - cmd_getCharactersMovementDelay - cmd_setNoDrawShapesFlag - cmd_checkClickOnNPC - cmd_getFoyerItem - cmd_setFoyerItem - cmd_passiveProtection - cmd_fillRect Fixed bugs in some opcodes (mostly wrong debug calls) Also changed debuglevel of all sprite functions to level 6 (from 5). svn-id: r19831 --- kyra/kyra.cpp | 309 +++++++++++++++++++++++++++++++++++++++++++++++++++-- kyra/kyra.h | 60 ++++++++++- kyra/screen.h | 5 +- kyra/script_v1.cpp | 215 +++++++++++++++++++++++++++++++------ kyra/sprites.cpp | 94 ++++++++-------- kyra/staticres.cpp | 43 +++++++- 6 files changed, 630 insertions(+), 96 deletions(-) (limited to 'kyra') diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp index b150121309..fe7cc76eb3 100644 --- a/kyra/kyra.cpp +++ b/kyra/kyra.cpp @@ -282,6 +282,7 @@ int KyraEngine::init(GameDetector &detector) { assert(_characterList); for (int i = 0; i < 11; ++i) { memset(&_characterList[i], 0, sizeof(Character)); + memset(_characterList[i].inventoryItems, 0xFF, sizeof(_characterList[i].inventoryItems)); } _characterList[0].sceneId = 5; _characterList[0].height = 48; @@ -339,6 +340,7 @@ int KyraEngine::init(GameDetector &detector) { memset(_currSentenceColor, 0, 3); _startSentencePalIndex = -1; _fadeText = false; + _noDrawShapesFlag = 0; _brandonPosX = _brandonPosY = -1; _brandonDrawFrame = 113; @@ -358,6 +360,7 @@ int KyraEngine::init(GameDetector &detector) { _configTalkspeed = 1; _marbleVaseItem = -1; + memset(_foyerItemTable, -1, sizeof(_foyerItemTable)); _mouseState = _itemInHand = -1; _handleInput = false; @@ -373,6 +376,7 @@ int KyraEngine::init(GameDetector &detector) { _unkScreenVar3 = 0; memset(_specialPalettes, 0, sizeof(_specialPalettes)); + _mousePressFlag = false; return 0; } @@ -398,6 +402,13 @@ KyraEngine::~KyraEngine() { delete [] _movFacingTable; + free(_buttonShape0); + free(_buttonShape1); + free(_buttonShape2); + free(_buttonShape3); + free(_buttonShape4); + free(_buttonShape5); + for (int i = 0; i < ARRAYSIZE(_shapes); ++i) { if (_shapes[i] != 0) { free(_shapes[i]); @@ -492,6 +503,8 @@ void KyraEngine::startup() { loadCharacterShapes(); loadSpecialEffectShapes(); loadItems(); + loadButtonShapes(); + initMainButtonList(); loadMainScreen(); setupTimers(); loadPalette("PALETTE.COL", _screen->_currentPalette); @@ -528,6 +541,7 @@ void KyraEngine::delay(uint32 amount, bool update) { OSystem::Event event; char saveLoadSlot[20]; + _mousePressFlag = false; uint32 start = _system->getMillis(); do { while (_system->pollEvent(event)) { @@ -556,6 +570,7 @@ void KyraEngine::delay(uint32 amount, bool update) { quitGame(); break; case OSystem::EVENT_LBUTTONDOWN: + _mousePressFlag = true; if (_abortWalkFlag2) { _abortWalkFlag = true; _mouseX = event.mouse.x; @@ -627,6 +642,7 @@ void KyraEngine::mainLoop() { while (!_quitFlag) { int32 frameTime = (int32)_system->getMillis(); + processButtonList(_buttonList); updateMousePointer(); updateGameTimers(); _sprites->updateSceneAnims(); @@ -718,6 +734,18 @@ void KyraEngine::waitTicks(int ticks) { } while (!_fastMode && _system->getMillis() < end); } +void KyraEngine::delayWithTicks(int ticks) { + uint32 nextTime = _system->getMillis() + ticks * _tickLength; + while (_system->getMillis() < nextTime) { + _sprites->updateSceneAnims(); + updateAllObjectShapes(); + //if (_currentCharacter->sceneId == 210) { + // updateKyragemFading(); + // seq_playEnd(); + //} + } +} + void KyraEngine::seq_demo() { debug(9, "KyraEngine::seq_demo()"); @@ -893,6 +921,66 @@ void KyraEngine::seq_introKallakMalcolm() { _seq->playSequence(_seq_KallakMalcolm, true); } +void KyraEngine::seq_createAmuletJewel(int jewel, int page, int noSound, int drawOnly) { + debug(9, "seq_createAmuletJewel(%d, %d, %d, %d)", jewel, page, noSound, drawOnly); + const static uint16 specialJewelTable[] = { + 0x167, 0x162, 0x15D, 0x158, 0x153, 0xFFFF + }; + const static uint16 specialJewelTable1[] = { + 0x14F, 0x154, 0x159, 0x15E, 0x163, 0xFFFF + }; + const static uint16 specialJewelTable2[] = { + 0x150, 0x155, 0x15A, 0x15F, 0x164, 0xFFFF + }; + const static uint16 specialJewelTable3[] = { + 0x151, 0x156, 0x15B, 0x160, 0x165, 0xFFFF + }; + const static uint16 specialJewelTable4[] = { + 0x152, 0x157, 0x15C, 0x161, 0x166, 0xFFFF + }; + if (!noSound) + // snd_playSoundEffect(0x5F) + _screen->hideMouse(); + if (!drawOnly) { + for (int i = 0; specialJewelTable[i] != 0xFFFF; ++i) { + _screen->drawShape(page, _shapes[4+specialJewelTable[i]], _amuletX2[jewel], _amuletY2[jewel], 0, 0); + _screen->updateScreen(); + delayWithTicks(3); + } + + const uint16 *opcodes = 0; + switch (jewel - 1) { + case 0: + opcodes = specialJewelTable1; + break; + + case 1: + opcodes = specialJewelTable2; + break; + + case 2: + opcodes = specialJewelTable3; + break; + + case 3: + opcodes = specialJewelTable4; + break; + } + + if (opcodes) { + for (int i = 0; opcodes[i] != 0xFFFF; ++i) { + _screen->drawShape(page, _shapes[4+opcodes[i]], _amuletX2[jewel], _amuletY2[jewel], 0, 0); + _screen->updateScreen(); + delayWithTicks(3); + } + } + } + _screen->drawShape(page, _shapes[327+jewel], _amuletX2[jewel], _amuletY2[jewel], 0, 0); + _screen->updateScreen(); + _screen->showMouse(); + setGameFlag(0x55+jewel); +} + bool KyraEngine::seq_skipSequence() const { debug(9, "KyraEngine::seq_skipSequence()"); return _quitFlag || _abortIntroFlag; @@ -1080,6 +1168,25 @@ void KyraEngine::loadItems() { delete[] fileData; } +void KyraEngine::loadButtonShapes() { + loadBitmap("BUTTONS2.CPS", 3, 3, 0); + _screen->_curPage = 2; + _buttonShape0 = _screen->encodeShape(0, 0, 24, 14, 1); + _buttonShape1 = _screen->encodeShape(24, 0, 24, 14, 1); + _buttonShape2 = _screen->encodeShape(48, 0, 24, 14, 1); + _buttonShape3 = _screen->encodeShape(0, 15, 24, 14, 1); + _buttonShape4 = _screen->encodeShape(24, 15, 24, 14, 1); + _buttonShape5 = _screen->encodeShape(48, 15, 24, 14, 1); + _screen->_curPage = 0; +} + +void KyraEngine::initMainButtonList() { + _buttonList = &_buttonData[0]; + for (int i = 0; _buttonDataListPtr[i]; ++i) { + _buttonList = initButton(_buttonList, _buttonDataListPtr[i]); + } +} + void KyraEngine::loadMainScreen() { if ((_features & GF_ENGLISH) && (_features & GF_TALKIE)) loadBitmap("MAIN_ENG.CPS", 3, 3, 0); @@ -1177,6 +1284,8 @@ void KyraEngine::enterNewScene(int sceneId, int facing, int unk1, int unk2, int debug(9, "enterNewScene(%d, %d, %d, %d, %d)", sceneId, facing, unk1, unk2, brandonAlive); int unkVar1 = 1; _screen->hideMouse(); + _handleInput = false; + _abortWalkFlag = false; _abortWalkFlag2 = false; if (_currentCharacter->sceneId == 7 && sceneId == 24) { _newMusicTheme = 2; @@ -1336,8 +1445,9 @@ void KyraEngine::enterNewScene(int sceneId, int facing, int unk1, int unk2, int _screen->showMouse(); if (!brandonAlive) { // XXX seq_poisionDeathNow - } + } updateMousePointer(true); + _changedScene = true; } void KyraEngine::transcendScenes(int roomIndex, int roomName) { @@ -2786,12 +2896,12 @@ void KyraEngine::wipeDownMouseItem(int xpos, int ypos) { while (height >= 0) { restoreRect1(xpos, ypos); _screen->setNewShapeHeight(_shapes[220+_itemInHand], height); + uint32 nextTime = _system->getMillis() + 1 * _tickLength; _screen->drawShape(0, _shapes[220+_itemInHand], xpos, y, 0, 0); _screen->updateScreen(); y += 2; height -= 2; - // XXX - waitTicks(1); + while (_system->getMillis() < nextTime) {} } restoreRect1(xpos, ypos); _screen->resetShapeHeight(_shapes[220+_itemInHand]); @@ -3579,7 +3689,8 @@ void KyraEngine::prepDrawAllObjects() { AnimObject *curObject = _objectQueue; int drawPage = 2; int flagUnk1 = 0, flagUnk2 = 0, flagUnk3 = 0; - // XXX + if (_noDrawShapesFlag) + return; if (_brandonStatusBit & 0x20) flagUnk1 = 0x200; if (_brandonStatusBit & 0x40) @@ -4583,6 +4694,7 @@ int KyraEngine::processSceneChange(int *table, int unk1, int frameReset) { int returnValue = 0; uint32 nextFrame = 0; _abortWalkFlag = false; + _mousePressFlag = false; while (running) { if (_abortWalkFlag) { *table = 8; @@ -4611,14 +4723,17 @@ int KyraEngine::processSceneChange(int *table, int unk1, int frameReset) { break; } - returnValue = (changeScene(_currentCharacter->facing) != 0); + returnValue = changeScene(_currentCharacter->facing); if (returnValue) { running = false; + _abortWalkFlag = false; } if (unk1) { - // XXX running = false; - _sceneChangeState = 1; + if (_mousePressFlag) { + running = false; + _sceneChangeState = 1; + } } if (forceContinue || !running) { @@ -5030,7 +5145,9 @@ void KyraEngine::processInput(int xpos, int ypos) { } uint8 item = findItemAtPos(xpos, ypos); if (item == 0xFF) { - if (clickEventHandler(xpos, ypos)) + _changedScene = false; + clickEventHandler(xpos, ypos); + if (_changedScene) return; } @@ -5114,10 +5231,11 @@ int KyraEngine::clickEventHandler(int xpos, int ypos) { _scriptClick->variables[3] = 0; _scriptClick->variables[4] = _itemInHand; _scriptInterpreter->startScript(_scriptClick, 1); - + while (_scriptInterpreter->validScript(_scriptClick)) { _scriptInterpreter->runScript(_scriptClick); } + return _scriptClick->variables[3]; } @@ -5479,4 +5597,177 @@ void KyraEngine::saveGame(const char *fileName, const char *saveName) { delete out; } +#pragma mark - +#pragma mark - Button handling +#pragma mark - + +Button *KyraEngine::initButton(Button *list, Button *newButton) { + if (!newButton) + return list; + if (!list) + return newButton; + Button *cur = list; + while (true) { + if (!cur->nextButton) { + break; + } + cur = cur->nextButton; + } + cur->nextButton = newButton; + return list; +} + +int KyraEngine::buttonInventoryCallback(Button *caller) { + int itemOffset = caller->specialValue - 2; + uint8 inventoryItem = _currentCharacter->inventoryItems[itemOffset]; + if (_itemInHand == -1) { + if (inventoryItem == 0xFF) { + // snd_playSoundEffect(0x36); + return 0; + } else { + _screen->hideMouse(); + _screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, 12); + // snd_playSoundEffect(0x35); + setMouseItem(inventoryItem); + updateSentenceCommand(_itemList[inventoryItem], _takenList[0], 179); + _itemInHand = inventoryItem; + _screen->showMouse(); + _currentCharacter->inventoryItems[itemOffset] = 0xFF; + } + } else { + if (inventoryItem != 0xFF) { + // snd_playSoundEffect(0x35); + _screen->hideMouse(); + _screen->fillRect(_itemPosX[itemOffset], _itemPosY[itemOffset], _itemPosX[itemOffset] + 15, _itemPosY[itemOffset] + 15, 12); + _screen->drawShape(0, _shapes[220+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0); + setMouseItem(inventoryItem); + updateSentenceCommand(_itemList[inventoryItem], _takenList[1], 179); + _screen->showMouse(); + _currentCharacter->inventoryItems[itemOffset] = _itemInHand; + _itemInHand = inventoryItem; + } else { + // snd_playSoundEffect(0x32); + _screen->hideMouse(); + _screen->drawShape(0, _shapes[220+_itemInHand], _itemPosX[itemOffset], _itemPosY[itemOffset], 0, 0); + _screen->setMouseCursor(1, 1, _shapes[4]); + updateSentenceCommand(_itemList[_itemInHand], _placedList[0], 179); + _screen->showMouse(); + _currentCharacter->inventoryItems[itemOffset] = _itemInHand; + _itemInHand = -1; + } + } + _screen->updateScreen(); + // XXX clearKyrandiaButtonIO + return 0; +} + +void KyraEngine::processButtonList(Button *list) { + while (list) { + if (list->flags & 8) { + list = list->nextButton; + continue; + } + + int x = list->x; + int y = list->y; + assert(list->dimTableIndex < _screen->_screenDimTableCount); + if (x < 0) { + x += _screen->_screenDimTable[list->dimTableIndex].w << 3; + } + x += _screen->_screenDimTable[list->dimTableIndex].sx << 3; + + if (y < 0) { + y += _screen->_screenDimTable[list->dimTableIndex].h; + } + y += _screen->_screenDimTable[list->dimTableIndex].sy; + + if (_mouseX >= x && _mouseY >= y && x + list->width >= _mouseX && y + list->height >= _mouseY) { + int processMouseClick = 0; + if (list->flags & 0x400) { + if (_mousePressFlag) { + if (!(list->flags2 & 1)) { + list->flags2 |= 1; + processButton(list); + } + } else { + if (list->flags2 & 1) { + list->flags2 &= 0xFFFE; + processButton(list); + processMouseClick = 1; + } + } + } else if (_mousePressFlag) { + processMouseClick = 1; + } + + if (processMouseClick) { + if (list->buttonCallback) { + if ((this->*(list->buttonCallback))(list)) { + break; + } + } + } + } else { + if (list->flags2 & 1) { + list->flags2 &= 0xFFFE; + processButton(list); + } + list = list->nextButton; + continue; + } + + list = list->nextButton; + } +} + +void KyraEngine::processButton(Button *button) { + if (!button) + return; + + int processType = 0; + uint8 *shape = 0; + Button::ButtonCallback callback = 0; + + int flags = (button->flags2 & 5); + if (flags == 1) { + processType = button->process2; + if (processType == 1) { + shape = button->process2PtrShape; + } else if (processType == 4) { + callback = button->process2PtrCallback; + } + } else if (flags == 4 || flags == 5) { + processType = button->process1; + if (processType == 1) { + shape = button->process1PtrShape; + } else if (processType == 4) { + callback = button->process1PtrCallback; + } + } else { + processType = button->process0; + if (processType == 1) { + shape = button->process0PtrShape; + } else if (processType == 4) { + callback = button->process0PtrCallback; + } + } + + int x = button->x; + int y = button->y; + assert(button->dimTableIndex < _screen->_screenDimTableCount); + if (x < 0) { + x += _screen->_screenDimTable[button->dimTableIndex].w << 3; + } + + if (y < 0) { + y += _screen->_screenDimTable[button->dimTableIndex].h; + } + + if (processType == 1 && shape) { + _screen->drawShape(_screen->_curPage, shape, x, y, button->dimTableIndex, 0x10); + } else if (processType == 4 && callback) { + (this->*callback)(button); + } +} + } // End of namespace Kyra diff --git a/kyra/kyra.h b/kyra/kyra.h index df93c76ca2..3f27e66514 100644 --- a/kyra/kyra.h +++ b/kyra/kyra.h @@ -152,6 +152,34 @@ struct Timer { void (KyraEngine::*func)(int timerNum); }; +struct Button { + Button *nextButton; + uint16 specialValue; + // uint8 unk[4]; + uint8 process0; + uint8 process1; + uint8 process2; + // uint8 unk + uint16 flags; + typedef int (KyraEngine::*ButtonCallback)(Button*); + // using 6 pointers instead of 3 as in the orignal here (safer for use with classes) + uint8 *process0PtrShape; + uint8 *process1PtrShape; + uint8 *process2PtrShape; + ButtonCallback process0PtrCallback; + ButtonCallback process1PtrCallback; + ButtonCallback process2PtrCallback; + uint16 dimTableIndex; + uint16 x; + uint16 y; + uint16 width; + uint16 height; + // uint8 unk[8]; + uint32 flags2; + ButtonCallback buttonCallback; + // uint8 unk[8]; +}; + class KyraEngine : public Engine { friend class MusicPlayer; friend class Debugger; @@ -225,6 +253,7 @@ public: void wsa_play(WSAMovieV1 *wsa, int frameNum, int x, int y, int pageNum); void waitTicks(int ticks); + void delayWithTicks(int ticks); void updateAllObjectShapes(); void flagAllObjectsForRefresh(); void animRefreshNPC(int character); @@ -520,6 +549,7 @@ protected: void seq_introMalcolmTree(); void seq_introKallakWriting(); void seq_introKallakMalcolm(); + void seq_createAmuletJewel(int jewel, int page, int noSound, int drawOnly); void wsa_processFrame(WSAMovieV1 *wsa, int frameNum, uint8 *dst); @@ -550,6 +580,8 @@ protected: void loadCharacterShapes(); void loadSpecialEffectShapes(); void loadItems(); + void loadButtonShapes(); + void initMainButtonList(); void loadMainScreen(); void setCharactersInDefaultScene(); void resetBrandonPosionFlags(); @@ -567,6 +599,12 @@ protected: void timerFadeText(int timerNum); void drawAmulet(); void setTextFadeTimerCountdown(int16 countdown); + + int buttonInventoryCallback(Button *caller); + Button *initButton(Button *list, Button *newButton); + void processButtonList(Button *list); + void processButton(Button *button); + uint8 _game; bool _fastMode; bool _quitFlag; @@ -574,6 +612,7 @@ protected: bool _abortIntroFlag; bool _abortWalkFlag; bool _abortWalkFlag2; + bool _mousePressFlag; char _talkBuffer[300]; char _talkSubstrings[TALK_SUBSTRING_LEN * TALK_SUBSTRING_NUM]; TalkCoords _talkCoords; @@ -592,7 +631,9 @@ protected: int _mouseState; bool _handleInput; bool _updateScreen; + bool _changedScene; int _unkScreenVar1, _unkScreenVar2, _unkScreenVar3; + int _noDrawShapesFlag; WSAMovieV1 *_wsaObjects[10]; uint16 _entranceMouseCursorTracks[8]; @@ -610,6 +651,7 @@ protected: uint8 _idolGemsTable[3]; int16 _marbleVaseItem; + int16 _foyerItemTable[3]; uint16 _brandonStatusBit; uint8 _unkBrandonPoisonFlags[256]; // this seem not to be posion flags, it is used for drawing once @@ -680,6 +722,15 @@ protected: Character *_characterList; + Button *_buttonList; + + uint8 *_buttonShape0; + uint8 *_buttonShape1; + uint8 *_buttonShape2; + uint8 *_buttonShape3; + uint8 *_buttonShape4; + uint8 *_buttonShape5; + uint8 *_seq_Forest; uint8 *_seq_KallakWriting; uint8 *_seq_KyrandiaLogo; @@ -739,8 +790,11 @@ protected: static const int8 _addYPosTable[]; // positions of the inventory - static const int16 _itemPosX[]; - static const int8 _itemPosY[]; + static const uint16 _itemPosX[]; + static const uint8 _itemPosY[]; + + static Button _buttonData[]; + static Button *_buttonDataListPtr[]; static const uint8 _magicMouseItemStartFrame[]; static const uint8 _magicMouseItemEndFrame[]; @@ -749,6 +803,8 @@ protected: static const uint16 _amuletX[]; static const uint16 _amuletY[]; + static const uint16 _amuletX2[]; + static const uint16 _amuletY2[]; }; } // End of namespace Kyra diff --git a/kyra/screen.h b/kyra/screen.h index f64a0fb07d..e853b324b4 100644 --- a/kyra/screen.h +++ b/kyra/screen.h @@ -138,6 +138,8 @@ public: uint8 *_currentPalette; uint8 *_shapePages[2]; + static const ScreenDim _screenDimTable[]; + static const int _screenDimTableCount; private: int16 encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size); void restoreMouseRect(); @@ -160,9 +162,6 @@ private: OSystem *_system; KyraEngine *_vm; - - static const ScreenDim _screenDimTable[]; - static const int _screenDimTableCount; }; } // End of namespace Kyra diff --git a/kyra/script_v1.cpp b/kyra/script_v1.cpp index 7bbef65157..cd2109182f 100644 --- a/kyra/script_v1.cpp +++ b/kyra/script_v1.cpp @@ -402,6 +402,11 @@ int KyraEngine::cmd_walkPlayerToPoint(ScriptState *script) { if (reinitScript) { _scriptInterpreter->initScript(script, script->dataPtr); } + + if (_sceneChangeState) { + _sceneChangeState = 0; + return 1; + } return 0; } @@ -450,7 +455,7 @@ int KyraEngine::cmd_drawAnimShapeIntoScene(ScriptState *script) { } int KyraEngine::cmd_createMouseItem(ScriptState *script) { - debug(3, "cmd_createMouseItem(0x%X) (%d)", stackPos(0)); + debug(3, "cmd_createMouseItem(0x%X) (%d)", script, stackPos(0)); createMouseItem(stackPos(0)); return 0; } @@ -473,7 +478,7 @@ int KyraEngine::cmd_sceneAnimOff(ScriptState *script) { } int KyraEngine::cmd_getElapsedSeconds(ScriptState *script) { - debug(3, "cmd_getElapsedSeconds(0x%X) ()"); + debug(3, "cmd_getElapsedSeconds(0x%X) ()", script); return _system->getMillis() / 1000; } @@ -531,25 +536,50 @@ int KyraEngine::cmd_phaseInSameScene(ScriptState *script) { } int KyraEngine::cmd_setScenePhasingFlag(ScriptState *script) { - debug(3, "cmd_setScenePhasingFlag(0x%X) ()"); + debug(3, "cmd_setScenePhasingFlag(0x%X) ()", script); _scenePhasingFlag = 1; return 1; } int KyraEngine::cmd_resetScenePhasingFlag(ScriptState *script) { - debug(3, "cmd_resetScenePhasingFlag(0x%X) ()"); + debug(3, "cmd_resetScenePhasingFlag(0x%X) ()", script); _scenePhasingFlag = 0; return 0; } int KyraEngine::cmd_queryScenePhasingFlag(ScriptState *script) { - debug(3, "cmd_queryScenePhasingFlag(0x%X) ()"); + debug(3, "cmd_queryScenePhasingFlag(0x%X) ()", script); return _scenePhasingFlag; } int KyraEngine::cmd_sceneToDirection(ScriptState *script) { - warning("STUB: cmd_sceneToDirection"); - return 0; + debug(3, "cmd_sceneToDirection(0x%X) (%d, %d)", script, stackPos(0), stackPos(1)); + assert(stackPos(0) < _roomTableSize); + Room *curRoom = &_roomTable[stackPos(0)]; + uint16 returnValue = 0xFFFF; + switch (stackPos(1)) { + case 0: + returnValue = curRoom->northExit; + break; + + case 2: + returnValue = curRoom->eastExit; + break; + + case 4: + returnValue = curRoom->southExit; + break; + + case 6: + returnValue = curRoom->westExit; + break; + + default: + break; + } + if (returnValue == 0xFFFF) + return -1; + return returnValue; } int KyraEngine::cmd_setBirthstoneGem(ScriptState *script) { @@ -943,20 +973,22 @@ int KyraEngine::cmd_displayWSASequentialFrames(ScriptState *script) { while (_system->getMillis() < continueTime) { _sprites->updateSceneAnims(); updateAllObjectShapes(); - delay(10); + if (continueTime - _system->getMillis() >= 10) + delay(10); } ++frame; } } else { - int frame = endFrame; - while (startFrame <= frame) { + int frame = startFrame; + while (endFrame <= frame) { wsa_play(_wsaObjects[wsaIndex], frame, xpos, ypos, 0); _updateScreen = true; uint32 continueTime = waitTime * _tickLength + _system->getMillis(); while (_system->getMillis() < continueTime) { _sprites->updateSceneAnims(); updateAllObjectShapes(); - delay(10); + if (continueTime - _system->getMillis() >= 10) + delay(10); } --frame; } @@ -1008,18 +1040,18 @@ int KyraEngine::cmd_changeCharactersXAndY(ScriptState *script) { } int KyraEngine::cmd_clearSceneAnimatorBeacon(ScriptState *script) { - debug(3, "cmd_clearSceneAnimatorBeacon(0x%X) ()"); + debug(3, "cmd_clearSceneAnimatorBeacon(0x%X) ()", script); _sprites->_sceneAnimatorBeaconFlag = 0; return 0; } int KyraEngine::cmd_querySceneAnimatorBeacon(ScriptState *script) { - debug(3, "cmd_querySceneAnimatorBeacon(0x%X) ()"); + debug(3, "cmd_querySceneAnimatorBeacon(0x%X) ()", script); return _sprites->_sceneAnimatorBeaconFlag; } int KyraEngine::cmd_refreshSceneAnimator(ScriptState *script) { - debug(3, "cmd_refreshSceneAnimator(0x%X) ()"); + debug(3, "cmd_refreshSceneAnimator(0x%X) ()", script); _sprites->updateSceneAnims(); updateAllObjectShapes(); return 0; @@ -1071,7 +1103,7 @@ int KyraEngine::cmd_placeCharacterInOtherScene(ScriptState *script) { } int KyraEngine::cmd_getKey(ScriptState *script) { - debug(3, "cmd_getKey(0x%X) ()"); + debug(3, "cmd_getKey(0x%X) ()", script); waitForEvent(); return 0; } @@ -1314,12 +1346,83 @@ int KyraEngine::cmd_dispelMagicAnimation(ScriptState *script) { } int KyraEngine::cmd_findBrightestFireberry(ScriptState *script) { - warning("STUB: cmd_findBrightestFireberry"); - return 0; + debug(3, "cmd_findBrightestFireberry(0x%X) ()", script); + if (_currentCharacter->sceneId >= 187 && _currentCharacter->sceneId <= 198) { + return 29; + } + if (_currentCharacter->sceneId == 133 || _currentCharacter->sceneId == 137 || + _currentCharacter->sceneId == 165 || _currentCharacter->sceneId == 173) { + return 29; + } + if (_itemInHand == 28) + return 28; + int brightestFireberry = 107; + if (_itemInHand >= 29 && _itemInHand <= 33) + brightestFireberry = _itemInHand; + for (int i = 0; i < 10; ++i) { + uint8 item = _currentCharacter->inventoryItems[i]; + if (item == 0xFF) + continue; + if (item == 28) + return 28; + if (item >= 29 && item <= 33) { + if (item < brightestFireberry) + brightestFireberry = item; + } + } + assert(_currentCharacter->sceneId < _roomTableSize); + Room *curRoom = &_roomTable[_currentCharacter->sceneId]; + for (int i = 0; i < 12; ++i) { + uint8 item = curRoom->itemsTable[i]; + if (item == 0xFF) + continue; + if (item == 28) + return 28; + if (item >= 29 && item <= 33) { + if (item < brightestFireberry) + brightestFireberry = item; + } + } + if (brightestFireberry == 107) + return -1; + return brightestFireberry; } int KyraEngine::cmd_setFireberryGlowPalette(ScriptState *script) { - warning("STUB: cmd_setFireberryGlowPalette"); + debug(3, "cmd_setFireberryGlowPalette(0x%X) (%d)", script, stackPos(0)); + int palIndex = 0; + switch (stackPos(0)) { + case 0x1E: + palIndex = 9; + break; + + case 0x1F: + palIndex = 10; + break; + + case 0x20: + palIndex = 11; + break; + + case 0x21: + case -1: + palIndex = 12; + break; + + default: + palIndex = 8; + break; + } + if (_brandonStatusBit & 2) { + if (_currentCharacter->sceneId != 133 && _currentCharacter->sceneId != 137 && + _currentCharacter->sceneId != 165 && _currentCharacter->sceneId != 173 && + (_currentCharacter->sceneId < 187 || _currentCharacter->sceneId > 198)) { + palIndex = 14; + } + } + uint8 *palette = _specialPalettes[palIndex]; + memcpy(&_screen->_currentPalette[684], palette, 44); + _screen->setScreenPalette(_screen->_currentPalette); return 0; } @@ -1373,7 +1476,26 @@ int KyraEngine::cmd_makeAmuletAppear(ScriptState *script) { } int KyraEngine::cmd_drawItemShapeIntoScene(ScriptState *script) { - warning("STUB: cmd_drawItemShapeIntoScene"); + debug(3, "cmd_drawItemShapeIntoScene(0x%X) (%d, %d, %d, %d, %d)", script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); + int item = stackPos(0); + int x = stackPos(1); + int y = stackPos(2); + int flags = stackPos(3); + int onlyHidPage = stackPos(4); + if (flags) + flags = 1; + if (onlyHidPage) { + _screen->drawShape(2, _shapes[220+item], x, y, 0, flags); + } else { + _screen->hideMouse(); + restoreAllObjectBackgrounds(); + _screen->drawShape(2, _shapes[220+item], x, y, 0, flags); + _screen->drawShape(0, _shapes[220+item], x, y, 0, flags); + flagAllObjectsForBkgdChange(); + flagAllObjectsForRefresh(); + updateAllObjectShapes(); + _screen->showMouse(); + } return 0; } @@ -1384,7 +1506,25 @@ int KyraEngine::cmd_setCharactersCurrentFrame(ScriptState *script) { } int KyraEngine::cmd_waitForConfirmationMouseClick(ScriptState *script) { - warning("STUB: cmd_waitForConfirmationMouseClick"); + debug(3, "cmd_waitForConfirmationMouseClick(0x%X) ()", script); + // if (mouseEnabled) { + while (!_mousePressFlag) { + updateMousePointer(); + _sprites->updateSceneAnims(); + updateAllObjectShapes(); + delay(10); + } + + while (_mousePressFlag) { + updateMousePointer(); + _sprites->updateSceneAnims(); + updateAllObjectShapes(); + delay(10); + } + // } + // XXX processButtonList calls + script->variables[1] = _mouseX; + script->variables[2] = _mouseY; return 0; } @@ -1426,7 +1566,8 @@ int KyraEngine::cmd_shakeScreen(ScriptState *script) { } int KyraEngine::cmd_createAmuletJewel(ScriptState *script) { - warning("STUB: cmd_createAmuletJewel"); + debug(3, "cmd_createAmuletJewel(0x%X) (%d)", script, stackPos(0)); + seq_createAmuletJewel(stackPos(0), 0, 0, 0); return 0; } @@ -1448,8 +1589,8 @@ int KyraEngine::cmd_fillFlaskWithWater(ScriptState *script) { } int KyraEngine::cmd_getCharactersMovementDelay(ScriptState *script) { - warning("STUB: cmd_getCharactersMovementDelay"); - return 0; + debug(3, "cmd_getCharactersMovementDelay(0x%X) (%d)", script, stackPos(0)); + return getTimerDelay(stackPos(0)+5); } int KyraEngine::cmd_getBirthstoneGem(ScriptState *script) { @@ -1526,7 +1667,8 @@ int KyraEngine::cmd_itemAppearsOnGround(ScriptState *script) { } int KyraEngine::cmd_setNoDrawShapesFlag(ScriptState *script) { - warning("STUB: cmd_setNoDrawShapesFlag"); + debug(3, "cmd_setNoDrawShapesFlag(0x%X) (%d)", script, stackPos(0)); + _noDrawShapesFlag = stackPos(0); return 0; } @@ -1608,18 +1750,21 @@ int KyraEngine::cmd_message(ScriptState *script) { } int KyraEngine::cmd_checkClickOnNPC(ScriptState *script) { - warning("STUB: cmd_checkClickOnNPC"); - return 0; + debug(3, "cmd_checkClickOnNPC(0x%X) (%d, %d)", script, stackPos(0), stackPos(1)); + return checkForNPCScriptRun(stackPos(0), stackPos(1)); } int KyraEngine::cmd_getFoyerItem(ScriptState *script) { - warning("STUB: cmd_getFoyerItem"); - return 0; + debug(3, "cmd_getFoyerItem(0x%X) (%d)", stackPos(0)); + assert(stackPos(0) < ARRAYSIZE(_foyerItemTable)); + return _foyerItemTable[stackPos(0)]; } int KyraEngine::cmd_setFoyerItem(ScriptState *script) { - warning("STUB: cmd_setFoyerItem"); - return 0; + debug(3, "cmd_setFoyerItem(0x%X) (%d, %d)", stackPos(0), stackPos(1)); + assert(stackPos(0) < ARRAYSIZE(_foyerItemTable)); + _foyerItemTable[stackPos(0)] = stackPos(1); + return stackPos(1); } int KyraEngine::cmd_setNoItemDropRegion(ScriptState *script) { @@ -1634,8 +1779,8 @@ int KyraEngine::cmd_walkMalcolmOn(ScriptState *script) { } int KyraEngine::cmd_passiveProtection(ScriptState *script) { - warning("STUB: cmd_passiveProtection"); - return 0; + debug(3, "cmd_passiveProtection(0x%X) ()", script); + return 1; } int KyraEngine::cmd_setPlayingLoop(ScriptState *script) { @@ -1675,7 +1820,11 @@ int KyraEngine::cmd_setPaletteChangeFlag(ScriptState *script) { } int KyraEngine::cmd_fillRect(ScriptState *script) { - warning("STUB: cmd_fillRect"); + debug(3, "cmd_fillRect(0x%X) (%d, %d, %d, %d, %d, 0x%X)", script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); + int videoPageBackup = _screen->_curPage; + _screen->_curPage = stackPos(0); + _screen->fillRect(stackPos(1), stackPos(2), stackPos(3), stackPos(4), stackPos(5)); + _screen->_curPage = videoPageBackup; return 0; } diff --git a/kyra/sprites.cpp b/kyra/sprites.cpp index 968a1ac6e6..1b739e144b 100644 --- a/kyra/sprites.cpp +++ b/kyra/sprites.cpp @@ -149,16 +149,16 @@ void Sprites::updateSceneAnims() { switch (READ_LE_UINT16(data)) { case 0xFF88: data += 2; - debug(5, "func: Set sprite image."); - debug(5, "Sprite index %i", READ_LE_UINT16(data)); + debug(6, "func: Set sprite image."); + debug(6, "Sprite index %i", READ_LE_UINT16(data)); _anims[i].sprite = READ_LE_UINT16(data); data += 2; - //debug(5, "Unused %i", READ_LE_UINT16(data)); + //debug(6, "Unused %i", READ_LE_UINT16(data)); data += 2; - debug(5, "X %i", READ_LE_UINT16(data)); + debug(6, "X %i", READ_LE_UINT16(data)); _anims[i].x = READ_LE_UINT16(data); data += 2; - debug(5, "Y %i", READ_LE_UINT16(data)); + debug(6, "Y %i", READ_LE_UINT16(data)); _anims[i].y = READ_LE_UINT16(data); data += 2; _anims[i].flipX = false; @@ -166,16 +166,16 @@ void Sprites::updateSceneAnims() { break; case 0xFF8D: data += 2; - debug(5, "func: Set sprite image, flipped."); - debug(5, "Sprite index %i", READ_LE_UINT16(data)); + debug(6, "func: Set sprite image, flipped."); + debug(6, "Sprite index %i", READ_LE_UINT16(data)); _anims[i].sprite = READ_LE_UINT16(data); data += 2; //debug(9, "Unused %i", READ_LE_UINT16(data)); data += 2; - debug(5, "X %i", READ_LE_UINT16(data)); + debug(6, "X %i", READ_LE_UINT16(data)); _anims[i].x = READ_LE_UINT16(data); data += 2; - debug(5, "Y %i", READ_LE_UINT16(data)); + debug(6, "Y %i", READ_LE_UINT16(data)); _anims[i].y = READ_LE_UINT16(data); data += 2; _anims[i].flipX = true; @@ -183,24 +183,24 @@ void Sprites::updateSceneAnims() { break; case 0xFF8A: data += 2; - debug(5, "func: Set time to wait"); - debug(5, "Time %i", READ_LE_UINT16(data)); + debug(6, "func: Set time to wait"); + debug(6, "Time %i", READ_LE_UINT16(data)); _anims[i].nextRun = _system->getMillis() + READ_LE_UINT16(data) * _animDelay; data += 2; break; case 0xFFB3: data += 2; - debug(5, "func: Set time to wait to random value"); + debug(6, "func: Set time to wait to random value"); rndNr = READ_LE_UINT16(data) + _rnd.getRandomNumber( READ_LE_UINT16(data) + 2); - debug(5, "Minimum time %i", READ_LE_UINT16(data)); + debug(6, "Minimum time %i", READ_LE_UINT16(data)); data += 2; - debug(5, "Maximum time %i", READ_LE_UINT16(data)); + debug(6, "Maximum time %i", READ_LE_UINT16(data)); data += 2; _anims[i].nextRun = _system->getMillis() + rndNr * _animDelay; break; case 0xFF8C: data += 2; - debug(5, "func: Wait until wait time has elapsed"); + debug(6, "func: Wait until wait time has elapsed"); _anims[i].reentry = data; endLoop = true; //assert( _anims[i].nextRun > _system->getMillis()); @@ -217,35 +217,35 @@ void Sprites::updateSceneAnims() { break; case 0xFF97: data += 2; - debug(5, "func: Set default X coordinate of sprite"); - debug(5, "X %i", READ_LE_UINT16(data)); + debug(6, "func: Set default X coordinate of sprite"); + debug(6, "X %i", READ_LE_UINT16(data)); _anims[i].x = READ_LE_UINT16(data); data += 2; break; case 0xFF98: data += 2; - debug(5, "func: Set default Y coordinate of sprite"); - debug(5, "Y %i", READ_LE_UINT16(data)); + debug(6, "func: Set default Y coordinate of sprite"); + debug(6, "Y %i", READ_LE_UINT16(data)); _anims[i].y = READ_LE_UINT16(data); data += 2; break; case 0xFF8B: - debug(5, "func: Jump to start of script section"); + debug(6, "func: Jump to start of script section"); //data = scriptStart; _anims[i].nextRun = _system->getMillis(); endLoop = true; break; case 0xFF8E: data += 2; - debug(5, "func: Begin for () loop"); - debug(5, "Iterations: %i", READ_LE_UINT16(data)); + debug(6, "func: Begin for () loop"); + debug(6, "Iterations: %i", READ_LE_UINT16(data)); _anims[i].loopsLeft = READ_LE_UINT16(data); data += 2; _anims[i].loopStart = data; break; case 0xFF8F: data += 2; - debug(5, "func: End for () loop"); + debug(6, "func: End for () loop"); if (_anims[i].loopsLeft > 0) { _anims[i].loopsLeft--; data = _anims[i].loopStart; @@ -253,8 +253,8 @@ void Sprites::updateSceneAnims() { break; case 0xFF90: data += 2; - debug(5, "func: Set sprite image using default X and Y"); - debug(5, "Sprite index %i", READ_LE_UINT16(data)); + debug(6, "func: Set sprite image using default X and Y"); + debug(6, "Sprite index %i", READ_LE_UINT16(data)); _anims[i].sprite = READ_LE_UINT16(data); _anims[i].flipX = false; data += 2; @@ -262,8 +262,8 @@ void Sprites::updateSceneAnims() { break; case 0xFF91: data += 2; - debug(5, "func: Set sprite image using default X and Y, flipped."); - debug(5, "Sprite index %i", READ_LE_UINT16(data)); + debug(6, "func: Set sprite image using default X and Y, flipped."); + debug(6, "Sprite index %i", READ_LE_UINT16(data)); _anims[i].sprite = READ_LE_UINT16(data); _anims[i].flipX = true; data += 2; @@ -271,29 +271,29 @@ void Sprites::updateSceneAnims() { break; case 0xFF92: data += 2; - debug(5, "func: Increase value of default X-coordinate"); - debug(5, "Increment %i", READ_LE_UINT16(data)); + debug(6, "func: Increase value of default X-coordinate"); + debug(6, "Increment %i", READ_LE_UINT16(data)); _anims[i].x += READ_LE_UINT16(data); data += 2; break; case 0xFF93: data += 2; - debug(5, "func: Increase value of default Y-coordinate"); - debug(5, "Increment %i", READ_LE_UINT16(data)); + debug(6, "func: Increase value of default Y-coordinate"); + debug(6, "Increment %i", READ_LE_UINT16(data)); _anims[i].y += READ_LE_UINT16(data); data += 2; break; case 0xFF94: data += 2; - debug(5, "func: Decrease value of default X-coordinate"); - debug(5, "Decrement %i", READ_LE_UINT16(data)); + debug(6, "func: Decrease value of default X-coordinate"); + debug(6, "Decrement %i", READ_LE_UINT16(data)); _anims[i].x -= READ_LE_UINT16(data); data += 2; break; case 0xFF95: data += 2; - debug(5, "func: Decrease value of default Y-coordinate"); - debug(5, "Decrement %i", READ_LE_UINT16(data)); + debug(6, "func: Decrease value of default Y-coordinate"); + debug(6, "Decrement %i", READ_LE_UINT16(data)); _anims[i].y -= READ_LE_UINT16(data); data += 2; break; @@ -312,22 +312,22 @@ void Sprites::updateSceneAnims() { break;*/ case 0xFFAD: data += 2; - debug(5, "func: Set Brandon's X coordinate"); - debug(5, "X %i", READ_LE_UINT16(data)); + debug(6, "func: Set Brandon's X coordinate"); + debug(6, "X %i", READ_LE_UINT16(data)); _engine->_currentCharacter->x1 = READ_LE_UINT16(data); data += 2; break; case 0xFFAE: data += 2; - debug(5, "func: Set Brandon's Y coordinate"); - debug(5, "Y %i", READ_LE_UINT16(data)); + debug(6, "func: Set Brandon's Y coordinate"); + debug(6, "Y %i", READ_LE_UINT16(data)); _engine->_currentCharacter->y1 = READ_LE_UINT16(data); data += 2; break; case 0xFFAF: data += 2; - debug(5, "func: Set Brandon's sprite"); - debug(5, "Sprite %i", READ_LE_UINT16(data)); + debug(6, "func: Set Brandon's sprite"); + debug(6, "Sprite %i", READ_LE_UINT16(data)); _engine->_currentCharacter->currentAnimFrame = READ_LE_UINT16(data); data += 2; break; @@ -337,15 +337,15 @@ void Sprites::updateSceneAnims() { break; case 0xFFAB: data += 2; - debug(5, "func: Update Brandon's sprite"); + debug(6, "func: Update Brandon's sprite"); _engine->animRefreshNPC(0); _engine->flagAllObjectsForRefresh(); _engine->updateAllObjectShapes(); break; case 0xFFB0: data += 2; - debug(5, "func: Play sound"); - debug(5, "Sound index %i", READ_LE_UINT16(data)); + debug(6, "func: Play sound"); + debug(6, "Sound index %i", READ_LE_UINT16(data)); //_engine->snd_playSoundEffect(READ_LE_UINT16(data)); data += 2; break; @@ -359,11 +359,11 @@ void Sprites::updateSceneAnims() { break; case 0xFFB4: data += 2; - debug(5, "func: Play (at random) a certain sound at a certain percentage of time"); - debug(5, "Sound index %i", READ_LE_UINT16(data)); + debug(6, "func: Play (at random) a certain sound at a certain percentage of time"); + debug(6, "Sound index %i", READ_LE_UINT16(data)); sound = READ_LE_UINT16(data); data += 2; - debug(5, "Percentage %i", READ_LE_UINT16(data)); + debug(6, "Percentage %i", READ_LE_UINT16(data)); rndNr = _rnd.getRandomNumber(100); //if (rndNr <= READ_LE_UINT16(data)) //_engine->snd_playSoundEffect(sound); diff --git a/kyra/staticres.cpp b/kyra/staticres.cpp index 60bd198048..3158f2048f 100644 --- a/kyra/staticres.cpp +++ b/kyra/staticres.cpp @@ -653,14 +653,50 @@ const int8 KyraEngine::_addYPosTable[] = { 0, -2, -2, -2, 0, 2, 2, 2 }; -const int16 KyraEngine::_itemPosX[] = { +const uint16 KyraEngine::_itemPosX[] = { 95, 115, 135, 155, 175, 95, 115, 135, 155, 175 }; -const int8 KyraEngine::_itemPosY[] = { +const uint8 KyraEngine::_itemPosY[] = { 160, 160, 160, 160, 160, 181, 181, 181, 181, 181 }; +Button KyraEngine::_buttonData[] = { + { 0, 0x02, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x05D, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x01, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x009, 0xA4, 0x36, 0x1E, /*XXX,*/ 0, 0/*opt_handleMenu, XXX*/ }, + { 0, 0x03, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x071, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x04, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x085, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x05, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x099, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x06, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x0AD, 0x9E, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x07, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x05D, 0xB3, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x08, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x071, 0xB3, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x09, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x085, 0xB3, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x0A, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x099, 0xB3, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x0B, /*XXX,*/0, 0, 0, /*XXX,*/ 0x0400, 0, 0, 0, 0, 0, 0, 0, 0x0AD, 0xB3, 0x13, 0x14, /*XXX,*/ 0, &KyraEngine::buttonInventoryCallback/*, XXX*/ }, + { 0, 0x15, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x0FD, 0x9C, 0x1A, 0x12, /*XXX,*/ 0, 0/*buttonAmuletCallback, XXX*/ }, + { 0, 0x16, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x0E7, 0xAA, 0x1A, 0x12, /*XXX,*/ 0, 0/*buttonAmuletCallback, XXX*/ }, + { 0, 0x17, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x0FD, 0xB5, 0x1A, 0x12, /*XXX,*/ 0, 0/*buttonAmuletCallback, XXX*/ }, + { 0, 0x18, /*XXX,*/1, 1, 1, /*XXX,*/ 0x0487, 0, 0, 0, 0, 0, 0, 0, 0x113, 0xAA, 0x1A, 0x12, /*XXX,*/ 0, 0/*buttonAmuletCallback, XXX*/ } +}; + +Button *KyraEngine::_buttonDataListPtr[] = { + &_buttonData[1], + &_buttonData[2], + &_buttonData[3], + &_buttonData[4], + &_buttonData[5], + &_buttonData[6], + &_buttonData[7], + &_buttonData[8], + &_buttonData[9], + &_buttonData[10], + &_buttonData[11], + &_buttonData[12], + &_buttonData[13], + &_buttonData[14], + 0 +}; + const uint8 KyraEngine::_magicMouseItemStartFrame[] = { 0xAD, 0xB7, 0xBE, 0x00 }; @@ -679,4 +715,7 @@ const uint8 KyraEngine::_magicMouseItemEndFrame2[] = { const uint16 KyraEngine::_amuletX[] = { 231, 275, 253, 253 }; const uint16 KyraEngine::_amuletY[] = { 170, 170, 159, 181 }; + +const uint16 KyraEngine::_amuletX2[] = { 0x000, 0x0FD, 0x0E7, 0x0FD, 0x113, 0x000 }; +const uint16 KyraEngine::_amuletY2[] = { 0x000, 0x09F, 0x0AA, 0x0B5, 0x0AA, 0x000 }; } // End of namespace Kyra -- cgit v1.2.3