From a755ce6e9215006bbafbcb28f46c30a03b464a4d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 27 Jan 2015 22:57:46 -0500 Subject: XEEN: Implement hilight/unhilightChar, bufixes for Tavern display --- engines/xeen/interface.cpp | 24 ++++++++++++++++++++++-- engines/xeen/interface.h | 1 + engines/xeen/town.cpp | 20 +++++++++++--------- engines/xeen/town.h | 2 +- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index 0126cd6d17..ece8ff3054 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -781,11 +781,31 @@ void Interface::doFalling() { } void Interface::highlightChar(int charId) { - error("TODO: highlightChar"); + Screen &screen = *_vm->_screen; + + if (charId != _hiliteChar && _hiliteChar != HILIGHT_CHAR_DISABLED) { + // Handle deselecting any previusly selected char + if (_hiliteChar != -1) { + _globalSprites.draw(screen, 9 + _hiliteChar, + Common::Point(CHAR_FACES_X[_hiliteChar] - 1, 149)); + } + + // Highlight new character + _globalSprites.draw(screen, 8, Common::Point(CHAR_FACES_X[charId] - 1, 149)); + _hiliteChar = charId; + screen._windows[33].update(); + } } void Interface::unhighlightChar() { - error("TODO: unhighlight"); + Screen &screen = *_vm->_screen; + + if (_hiliteChar != -1) { + _globalSprites.draw(screen, _hiliteChar + 9, + Common::Point(CHAR_FACES_X[_hiliteChar] - 1, 149)); + _hiliteChar = -1; + screen._windows[33].update(); + } } bool Interface::checkMoveDirection(int key) { diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h index ab30654065..1630e80f69 100644 --- a/engines/xeen/interface.h +++ b/engines/xeen/interface.h @@ -34,6 +34,7 @@ namespace Xeen { class XeenEngine; #define MINIMAP_SIZE 7 +#define HILIGHT_CHAR_DISABLED -2 class Interface: public ButtonContainer, public InterfaceMap { private: diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index 81cc88bb2c..af93d0016c 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -292,9 +292,11 @@ int Town::townWait() { EventsManager &events = *_vm->_events; Interface &intf = *_vm->_interface; + _buttonValue = 0; while (!_vm->shouldQuit() && !_buttonValue) { events.updateGameCounter(); while (!_vm->shouldQuit() && !_buttonValue && events.timeElapsed() < 3) { + events.pollEventsAndWait(); checkEvents(_vm); } if (!_buttonValue) @@ -343,7 +345,7 @@ Common::String Town::createTownText(Character &ch) { case 1: // Blacksmith return Common::String::format(BLACKSMITH_TEXT, - XeenEngine::printMil(party._gold)); + XeenEngine::printMil(party._gold).c_str()); case 2: // Guild @@ -352,7 +354,7 @@ Common::String Town::createTownText(Character &ch) { case 3: // Tavern - return Common::String::format(TAVERN_TEXT, ch._name, + return Common::String::format(TAVERN_TEXT, ch._name.c_str(), FOOD_AND_DRINK, XeenEngine::printMil(party._gold).c_str()); case 4: @@ -564,12 +566,12 @@ Character *Town::doGuildOptions(Character *c) { } else if (_buttonValue == Common::KEYCODE_s) { if (c->guildMember()) - c = showAvailableSpells(c); + c = showAvailableSpells(c, 0x80); _buttonValue = 0; } else if (_buttonValue == Common::KEYCODE_c) { if (!c->noActions()) { if (c->guildMember()) - c = showAvailableSpells(c); + c = showAvailableSpells(c, 0); _buttonValue = 0; } } @@ -612,7 +614,7 @@ Character *Town::doTavernOptions(Character *c) { screen._windows[10].writeString(Common::String::format(TAVERN_TEXT, c->_name.c_str(), GOOD_STUFF, - XeenEngine::printMil(party._gold))); + XeenEngine::printMil(party._gold).c_str())); drawButtons(&screen._windows[0]); screen._windows[10].update(); @@ -728,7 +730,7 @@ Character *Town::doTavernOptions(Character *c) { if (!_v21) { screen._windows[10].writeString(Common::String::format(TAVERN_TEXT, c->_name.c_str(), HAVE_A_DRINK, - XeenEngine::printMil(party._gold))); + XeenEngine::printMil(party._gold).c_str())); drawButtons(&screen); screen._windows[10].update(); townWait(); @@ -737,7 +739,7 @@ Character *Town::doTavernOptions(Character *c) { if (c->_conditions[DRUNK]) { screen._windows[10].writeString(Common::String::format(TAVERN_TEXT, c->_name.c_str(), YOURE_DRUNK, - XeenEngine::printMil(party._gold))); + XeenEngine::printMil(party._gold).c_str())); drawButtons(&screen); screen._windows[10].update(); townWait(); @@ -1036,7 +1038,7 @@ void Town::depositWithdrawl(int choice) { sound.playSample(&voc, 0); msg = Common::String::format(GOLD_GEMS_2, DEPOSIT_WITHDRAWL[choice], - XeenEngine::printMil(gold), XeenEngine::printMil(gems)); + XeenEngine::printMil(gold).c_str(), XeenEngine::printMil(gems).c_str()); screen._windows[35].writeString(msg); screen._windows[35].update(); } @@ -1120,7 +1122,7 @@ Character *Town::showItems(Character *c, int v2) { error("TODO: showItems"); } -Character *Town::showAvailableSpells(Character *c) { +Character *Town::showAvailableSpells(Character *c, int v2) { error("TODO: showAvailableSpells"); } diff --git a/engines/xeen/town.h b/engines/xeen/town.h index 950d702d4a..88031cab8e 100644 --- a/engines/xeen/town.h +++ b/engines/xeen/town.h @@ -101,7 +101,7 @@ private: Character *showItems(Character *c, int v2); - Character *showAvailableSpells(Character *c); + Character *showAvailableSpells(Character *c, int v2); public: Town(XeenEngine *vm); -- cgit v1.2.3