From d2bbfbcc35a1ab8cc3be52dba690a07cbabdf632 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 9 Mar 2008 15:24:47 +0000 Subject: - fixed little glitch when putting items in cauldron - implemented listing of items in cauldron svn-id: r31088 --- engines/kyra/gui_v2.cpp | 4 ++-- engines/kyra/kyra_v2.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ engines/kyra/kyra_v2.h | 1 + 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp index c05987e482..1f997564b7 100644 --- a/engines/kyra/gui_v2.cpp +++ b/engines/kyra/gui_v2.cpp @@ -1018,7 +1018,7 @@ int KyraEngine_v2::cauldronButton(Button *button) { return 0; } - if (!_screen->isMouseVisible() || _handItemSet < 0) + if (!_screen->isMouseVisible() || _handItemSet < -1) return 0; if (queryGameFlag(0xE4)) { @@ -1036,7 +1036,7 @@ int KyraEngine_v2::cauldronButton(Button *button) { } if (_itemInHand == -1) { - //sub_33AAE(); + listItemsInCauldron(); return 0; } diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp index 83bc93c2c4..e9aa61de11 100644 --- a/engines/kyra/kyra_v2.cpp +++ b/engines/kyra/kyra_v2.cpp @@ -1848,6 +1848,7 @@ void KyraEngine_v2::cauldronItemAnim(int item) { mouseY -= 2; uint32 waitEnd = _system->getMillis() + _tickLength; _system->warpMouse(mouseX, mouseY); + _system->updateScreen(); delayUntil(waitEnd); } @@ -1858,6 +1859,7 @@ void KyraEngine_v2::cauldronItemAnim(int item) { mouseX -= 2; uint32 waitEnd = _system->getMillis() + _tickLength; _system->warpMouse(mouseX, mouseY); + _system->updateScreen(); delayUntil(waitEnd); } @@ -1997,6 +1999,50 @@ bool KyraEngine_v2::addToCauldronStateTable(int data, int idx) { return false; } +void KyraEngine_v2::listItemsInCauldron() { + int itemsInCauldron = 0; + for (int i = 0; i < 25; ++i) { + if (_cauldronTable[i] != -1) + ++itemsInCauldron; + else + break; + } + + if (!itemsInCauldron) { + if (!_cauldronState) + objectChat(getTableString(0xF4, _cCodeBuffer, 1), 0, 0x83, 0xF4); + else + objectChat(getTableString(0xF3, _cCodeBuffer, 1), 0, 0x83, 0xF3); + } else { + objectChat(getTableString(0xF7, _cCodeBuffer, 1), 0, 0x83, 0xF7); + + char buffer[80]; + for (int i = 0; i < itemsInCauldron-1; ++i) { + char *str = buffer; + strcpy(str, getTableString(_cauldronTable[i]+54, _cCodeBuffer, 1)); + if (_lang == 1) { + if (*str == 37) + str += 2; + } + strcpy((char*)_unkBuf500Bytes, "..."); + strcat((char*)_unkBuf500Bytes, str); + strcat((char*)_unkBuf500Bytes, "..."); + objectChat((const char*)_unkBuf500Bytes, 0, 0x83, _cauldronTable[i]+54); + } + + char *str = buffer; + strcpy(str, getTableString(_cauldronTable[itemsInCauldron-1]+54, _cCodeBuffer, 1)); + if (_lang == 1) { + if (*str == 37) + str += 2; + } + strcpy((char*)_unkBuf500Bytes, "..."); + strcat((char*)_unkBuf500Bytes, str); + strcat((char*)_unkBuf500Bytes, "."); + objectChat((const char*)_unkBuf500Bytes, 0, 0x83, _cauldronTable[itemsInCauldron-1]+54); + } +} + #pragma mark - void KyraEngine_v2::registerDefaultSettings() { diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h index ac0604ac31..6db213c1b5 100644 --- a/engines/kyra/kyra_v2.h +++ b/engines/kyra/kyra_v2.h @@ -665,6 +665,7 @@ protected: void cauldronItemAnim(int item); void cauldronRndPaletteFade(); bool updateCauldron(); + void listItemsInCauldron(); // localization void loadCCodeBuffer(const char *file); -- cgit v1.2.3