Skip to content

Commit

Permalink
SHERLOCK: Fix for switching speakers
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jun 7, 2015
1 parent be46bfd commit 9b837c3
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 26 deletions.
15 changes: 15 additions & 0 deletions engines/sherlock/scalpel/scalpel_talk.cpp
Expand Up @@ -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
5 changes: 5 additions & 0 deletions engines/sherlock/scalpel/scalpel_talk.h
Expand Up @@ -56,6 +56,11 @@ class ScalpelTalk : public Talk {
* 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() {}
Expand Down
43 changes: 19 additions & 24 deletions engines/sherlock/talk.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
5 changes: 5 additions & 0 deletions engines/sherlock/talk.h
Expand Up @@ -256,6 +256,11 @@ class Talk {
* 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;
Expand Down
3 changes: 1 addition & 2 deletions engines/sherlock/tattoo/tattoo_people.cpp
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions engines/sherlock/tattoo/tattoo_talk.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 9b837c3

Please sign in to comment.