diff options
author | Paul Gilbert | 2015-06-22 21:38:52 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-22 21:38:52 -0400 |
commit | 239784b13dd12c3f731312c5277dbc9fb0ab47ed (patch) | |
tree | 3cffd9c7017d186c460789c7821e2d639617a1c1 | |
parent | f7644f10aa3b921627a338926a87c35e7114cbea (diff) | |
download | scummvm-rg350-239784b13dd12c3f731312c5277dbc9fb0ab47ed.tar.gz scummvm-rg350-239784b13dd12c3f731312c5277dbc9fb0ab47ed.tar.bz2 scummvm-rg350-239784b13dd12c3f731312c5277dbc9fb0ab47ed.zip |
SHERLOCK: RT: Beginnings of look window display
-rw-r--r-- | engines/sherlock/tattoo/tattoo_journal.cpp | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_talk.cpp | 11 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_talk.h | 2 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.cpp | 12 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_user_interface.h | 7 | ||||
-rw-r--r-- | engines/sherlock/tattoo/widget_base.cpp | 12 |
6 files changed, 36 insertions, 10 deletions
diff --git a/engines/sherlock/tattoo/tattoo_journal.cpp b/engines/sherlock/tattoo/tattoo_journal.cpp index c419b9e50f..e3f681bc3c 100644 --- a/engines/sherlock/tattoo/tattoo_journal.cpp +++ b/engines/sherlock/tattoo/tattoo_journal.cpp @@ -854,7 +854,7 @@ int TattooJournal::getFindName(bool printError) { if (keyState.ascii && keyState.ascii != '@' && name.size() < 50) { if ((cursorX + screen.charWidth(keyState.ascii)) < (r.right - screen.widestChar() * 3)) { cursorX += screen.charWidth(keyState.ascii); - name += keyState.ascii; + name += toupper(keyState.ascii); } } diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp index 2da30057c7..52b6b51213 100644 --- a/engines/sherlock/tattoo/tattoo_talk.cpp +++ b/engines/sherlock/tattoo/tattoo_talk.cpp @@ -22,6 +22,7 @@ #include "sherlock/tattoo/tattoo_talk.h" #include "sherlock/tattoo/tattoo_people.h" +#include "sherlock/tattoo/tattoo_user_interface.h" #include "sherlock/sherlock.h" #include "sherlock/screen.h" @@ -182,7 +183,7 @@ TattooTalk::TattooTalk(SherlockEngine *vm) : Talk(vm) { } void TattooTalk::talkInterface(const byte *&str) { - drawTalk(str); + drawTalk((const char *)str); _charCount = 0; while ((*str < TATTOO_OPCODES[0] || *str == TATTOO_OPCODES[OP_NULL]) && *str) { @@ -193,8 +194,12 @@ void TattooTalk::talkInterface(const byte *&str) { _wait = true; } -void TattooTalk::drawTalk(const byte *str) { - // TODO +void TattooTalk::drawTalk(const char *str) { + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + + ui.banishWindow(); + ui._textWidget.load(str); + ui._textWidget.summonWindow(); } OpcodeReturn TattooTalk::cmdSwitchSpeaker(const byte *&str) { diff --git a/engines/sherlock/tattoo/tattoo_talk.h b/engines/sherlock/tattoo/tattoo_talk.h index d7464c3979..9fd6f05242 100644 --- a/engines/sherlock/tattoo/tattoo_talk.h +++ b/engines/sherlock/tattoo/tattoo_talk.h @@ -74,7 +74,7 @@ private: OpcodeReturn cmdWalkNPCToCoords(const byte *&str); OpcodeReturn cmdWalkHomesAndNPCToCoords(const byte *&str); private: - void drawTalk(const byte *str); + void drawTalk(const char *str); protected: /** * Display the talk interface window diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp index f1b75f45d4..01b0b6386d 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.cpp +++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp @@ -247,7 +247,11 @@ void TattooUserInterface::handleInput() { if (_keyState.keycode == Common::KEYCODE_s && vm._allowFastMode) vm._fastMode = !vm._fastMode; - else if (_keyState.keycode == Common::KEYCODE_ESCAPE && vm._runningProlog && !_lockoutTimer) { + else if (_keyState.keycode == Common::KEYCODE_l && _bgFound != -1) { + // Beging used for testing that Look dialogs work + lookAtObject(); + + } else if (_keyState.keycode == Common::KEYCODE_ESCAPE && vm._runningProlog && !_lockoutTimer) { vm.setFlags(-76); vm.setFlags(396); scene._goToScene = STARTING_GAME_SCENE; @@ -928,6 +932,12 @@ void TattooUserInterface::drawDialogRect(Surface &s, const Common::Rect &r, bool } } +void TattooUserInterface::banishWindow() { + if (_widget != nullptr) + _widget->banishWindow(); + _widget = nullptr; +} + } // End of namespace Tattoo } // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/tattoo_user_interface.h b/engines/sherlock/tattoo/tattoo_user_interface.h index 2ff046bef7..bb9e1d91a2 100644 --- a/engines/sherlock/tattoo/tattoo_user_interface.h +++ b/engines/sherlock/tattoo/tattoo_user_interface.h @@ -59,7 +59,6 @@ private: int _scriptZone; int _cAnimFramePause; WidgetInventory _inventoryWidget; - WidgetText _textWidget; WidgetSceneTooltip _tooltipWidget; WidgetVerbs _verbsWidget; WidgetBase *_widget; @@ -147,6 +146,7 @@ public: Common::Point _maskOffset; int _maskCounter; ImageFile *_interfaceImages; + WidgetText _textWidget; public: TattooUserInterface(SherlockEngine *vm); virtual ~TattooUserInterface(); @@ -221,6 +221,11 @@ public: * Draws all the dialog rectangles for any items that need them */ void drawDialogRect(Surface &s, const Common::Rect &r, bool raised); + + /** + * Banish any active window + */ + void banishWindow(); public: /** * Resets the user interface diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp index 1df14ffe7d..cd4f8e08a2 100644 --- a/engines/sherlock/tattoo/widget_base.cpp +++ b/engines/sherlock/tattoo/widget_base.cpp @@ -36,11 +36,16 @@ void WidgetBase::summonWindow() { TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; ui._widget = this; _outsideMenu = false; + + draw(); } void WidgetBase::banishWindow() { - // TODO + TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui; + + erase(); _surface.free(); + ui._widget = nullptr; } void WidgetBase::erase() { @@ -90,7 +95,7 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA // Loop counting up lines lines.clear(); - while (lines.size() < maxLines) { + do { int width = 0; const char *spaceP = nullptr; const char *lineStartP = strP; @@ -117,7 +122,8 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA // Move the string ahead to the next line if (*strP == ' ' || *strP == 13) ++strP; - } while (*strP && ((byte)*strP < talk._opcodes[OP_SWITCH_SPEAKER] || (byte)*strP == talk._opcodes[OP_NULL])); + } while (*strP && ((int)lines.size() < maxLines) && ((byte)*strP < talk._opcodes[OP_SWITCH_SPEAKER] + || (byte)*strP == talk._opcodes[OP_NULL])); // Return any remaining text left over return *strP ? Common::String(strP) : Common::String(); |