diff options
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 15 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.h | 5 | ||||
-rw-r--r-- | engines/sherlock/talk.cpp | 43 | ||||
-rw-r--r-- | engines/sherlock/talk.h | 5 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_people.cpp | 3 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_talk.cpp | 2 |
6 files changed, 47 insertions, 26 deletions
diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 23937decd5..f630534af7 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -492,6 +492,21 @@ OpcodeReturn ScalpelTalk::cmdCarriageReturn(const byte *&str) { return RET_SUCCESS; } +void ScalpelTalk::talkWait(const byte *&str) { + UserInterface &ui = *_vm->_ui; + bool pauseFlag = _pauseFlag; + + Talk::talkWait(str); + + // Clear the window unless the wait was due to a PAUSE command + if (!pauseFlag && _wait != -1 && str < _scriptEnd && str[0] != _opcodes[OP_SFX_COMMAND]) { + if (!_talkStealth) + ui.clearWindow(); + _yp = CONTROLS_Y + 12; + _charCount = _line = 0; + } +} + } // End of namespace Scalpel } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_talk.h b/engines/sherlock/scalpel/scalpel_talk.h index 6a11824ee3..a3ac0f2845 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -56,6 +56,11 @@ protected: * Display the talk interface window */ virtual void talkInterface(const byte *&str); + + /** + * Pause when displaying a talk dialog on-screen + */ + virtual void talkWait(const byte *&str); public: ScalpelTalk(SherlockEngine *vm); virtual ~ScalpelTalk() {} diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index d1e92a7fa5..3a009e9160 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -1073,31 +1073,9 @@ void Talk::doScript(const Common::String &script) { _openTalkWindow = false; } - if (_wait) { + if (_wait) // Handling pausing - if (!_pauseFlag && _charCount < 160) - _charCount = 160; - - _wait = waitForMore(_charCount); - if (_wait == -1) - _endStr = true; - - // If a key was pressed to finish the window, see if further voice files should be skipped - if (_wait >= 0 && _wait < 254) { - if (str[0] == _opcodes[OP_SFX_COMMAND]) - str += 9; - } - - // Clear the window unless the wait was due to a PAUSE command - if (!_pauseFlag && _wait != -1 && str < _scriptEnd && str[0] != _opcodes[OP_SFX_COMMAND]) { - if (!_talkStealth) - ui.clearWindow(); - _yp = CONTROLS_Y + 12; - _charCount = _line = 0; - } - - _pauseFlag = false; - } + talkWait(str); } while (!_vm->shouldQuit() && !_endStr); if (_wait != -1) { @@ -1490,4 +1468,21 @@ OpcodeReturn Talk::cmdWalkToCoords(const byte *&str) { return RET_SUCCESS; } +void Talk::talkWait(const byte *&str) { + if (!_pauseFlag && _charCount < 160) + _charCount = 160; + + _wait = waitForMore(_charCount); + if (_wait == -1) + _endStr = true; + + // If a key was pressed to finish the window, see if further voice files should be skipped + if (_wait >= 0 && _wait < 254) { + if (str[0] == _opcodes[OP_SFX_COMMAND]) + str += 9; + } + + _pauseFlag = false; +} + } // End of namespace Sherlock diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h index fbcc9e7ab2..5385ab0fe6 100644 --- a/engines/sherlock/talk.h +++ b/engines/sherlock/talk.h @@ -256,6 +256,11 @@ protected: * Display the talk interface window */ virtual void talkInterface(const byte *&str) = 0; + + /** + * Pause when displaying a talk dialog on-screen + */ + virtual void talkWait(const byte *&str); public: TalkSequence _talkSequenceStack[TALK_SEQUENCE_STACK_SIZE]; bool _talkToAbort; diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp index b253afd1da..4e4f11b983 100644 --- a/engines/sherlock/tattoo/tattoo_people.cpp +++ b/engines/sherlock/tattoo/tattoo_people.cpp @@ -186,8 +186,7 @@ void TattooPeople::setTalkSequence(int speaker, int sequenceNum) { // See if the NPC's sequence has to wait for an Abort Talk Code if (person.hasAborts()) { person._gotoSeq = newDir; - } - else { + } else { if (person._seqTo) { // Reset to previous value person._walkSequences[person._sequenceNumber]._sequences[person._frameNumber] = person._seqTo; diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp index 3a066712f5..8e57ad5d93 100644 --- a/engines/sherlock/tattoo/tattoo_talk.cpp +++ b/engines/sherlock/tattoo/tattoo_talk.cpp @@ -215,6 +215,8 @@ OpcodeReturn TattooTalk::cmdSwitchSpeaker(const byte *&str) { people.setListenSequence(_speaker, 129); _speaker = *++str - 1; + ++str; + people.setTalkSequence(_speaker, 1); return RET_SUCCESS; |