From e02fbcebe7a9a04eee14bd2f04da455b0b312140 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jul 2015 17:20:47 -0400 Subject: SHERLOCK: RT: Hook talk widget refresh into talk logic --- engines/sherlock/scalpel/scalpel_talk.cpp | 14 ++++++++++++++ engines/sherlock/talk.cpp | 13 ------------- engines/sherlock/talk.h | 2 +- engines/sherlock/tattoo/tattoo_talk.cpp | 8 ++++++++ engines/sherlock/tattoo/tattoo_talk.h | 5 +++++ engines/sherlock/tattoo/widget_talk.cpp | 3 +++ 6 files changed, 31 insertions(+), 14 deletions(-) diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index a6bb6b6fcd..a8a38fa6b4 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -807,6 +807,20 @@ void ScalpelTalk::showTalk() { Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); byte color = ui._endKeyActive ? COMMAND_FOREGROUND : COMMAND_NULL; + clearSequences(); + pushSequence(_talkTo); + setStillSeq(_talkTo); + + ui._selector = ui._oldSelector = -1; + + if (!ui._windowOpen) { + // Draw the talk interface on the back buffer + drawInterface(); + displayTalk(false); + } else { + displayTalk(true); + } + // If the window is already open, simply draw. Otherwise, do it // to the back buffer and then summon the window if (ui._windowOpen) { diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index abd41b94b9..d7388fc32b 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -376,20 +376,7 @@ void Talk::talkTo(const Common::String &filename) { // to display any choices, since the reply needs to be shown if (!newStatement._statement.hasPrefix("*") && !newStatement._statement.hasPrefix("^")) { - clearSequences(); - pushSequence(_talkTo); - setStillSeq(_talkTo); _talkIndex = select; - ui._selector = ui._oldSelector = -1; - - if (!ui._windowOpen) { - // Draw the talk interface on the back buffer - drawInterface(); - displayTalk(false); - } else { - displayTalk(true); - } - showTalk(); // Break out of loop now that we're waiting for player input diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h index 066a9d8425..4ee7a09e56 100644 --- a/engines/sherlock/talk.h +++ b/engines/sherlock/talk.h @@ -265,7 +265,7 @@ protected: /** * Show the talk display */ - virtual void showTalk() {} + virtual void showTalk() = 0; public: TalkSequence _talkSequenceStack[TALK_SEQUENCE_STACK_SIZE]; Common::Array _statements; diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp index 54d327e92a..3ad64a1757 100644 --- a/engines/sherlock/tattoo/tattoo_talk.cpp +++ b/engines/sherlock/tattoo/tattoo_talk.cpp @@ -861,6 +861,14 @@ OpcodeReturn TattooTalk::cmdWalkHomesAndNPCToCoords(const byte *&str) { return RET_SUCCESS; } +void TattooTalk::showTalk() { + TattooPeople &people = *(TattooPeople *)_vm->_people; + + _sequenceStack.clear(); + people.setListenSequence(_talkTo, 129); + _talkWidget.refresh(); +} + } // End of namespace Tattoo } // End of namespace Sherlock diff --git a/engines/sherlock/tattoo/tattoo_talk.h b/engines/sherlock/tattoo/tattoo_talk.h index e2fa60b384..f9a4d01f4f 100644 --- a/engines/sherlock/tattoo/tattoo_talk.h +++ b/engines/sherlock/tattoo/tattoo_talk.h @@ -91,6 +91,11 @@ protected: * Display the talk interface window */ virtual void talkInterface(const byte *&str); + + /** + * Show the talk display + */ + virtual void showTalk(); public: TattooTalk(SherlockEngine *vm); virtual ~TattooTalk() {} diff --git a/engines/sherlock/tattoo/widget_talk.cpp b/engines/sherlock/tattoo/widget_talk.cpp index 6a3fd4575d..08982a557d 100644 --- a/engines/sherlock/tattoo/widget_talk.cpp +++ b/engines/sherlock/tattoo/widget_talk.cpp @@ -576,6 +576,9 @@ void WidgetTalk::setStatementLines() { } void WidgetTalk::refresh() { + _talkScrollIndex = 0; + _selector = _oldSelector = -1; + setStatementLines(); render(HL_NO_HIGHLIGHTING); } -- cgit v1.2.3