diff options
author | Paul Gilbert | 2015-06-07 11:37:15 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-07 11:37:15 -0400 |
commit | 02ff4ce4950e09afb634feae4a7a854644418019 (patch) | |
tree | f5f5c2469438450f0ba656a9dd8a9b72e2e8df23 /engines/sherlock/scalpel | |
parent | 6cc469dc5c1021764f0cf4a4e0a46e83f760ae5f (diff) | |
download | scummvm-rg350-02ff4ce4950e09afb634feae4a7a854644418019.tar.gz scummvm-rg350-02ff4ce4950e09afb634feae4a7a854644418019.tar.bz2 scummvm-rg350-02ff4ce4950e09afb634feae4a7a854644418019.zip |
SHERLOCK: Implemented talk/listen sequence methods
Diffstat (limited to 'engines/sherlock/scalpel')
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.cpp | 30 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.h | 5 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 34 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.h | 5 |
4 files changed, 38 insertions, 36 deletions
diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp index 5e661fe16a..08100fef11 100644 --- a/engines/sherlock/scalpel/scalpel_people.cpp +++ b/engines/sherlock/scalpel/scalpel_people.cpp @@ -86,6 +86,36 @@ void ScalpelPeople::setTalking(int speaker) { } } +void ScalpelPeople::setTalkSequence(int speaker, int sequenceNum) { + People &people = *_vm->_people; + Scene &scene = *_vm->_scene; + + // If no speaker is specified, then nothing needs to be done + if (speaker == -1) + return; + + if (speaker) { + int objNum = people.findSpeaker(speaker); + if (objNum != -1) { + Object &obj = scene._bgShapes[objNum]; + + if (obj._seqSize < MAX_TALK_SEQUENCES) { + warning("Tried to copy too many talk frames"); + } + else { + for (int idx = 0; idx < MAX_TALK_SEQUENCES; ++idx) { + obj._sequences[idx] = people._characters[speaker]._talkSequences[idx]; + if (idx > 0 && !obj._sequences[idx] && !obj._sequences[idx - 1]) + return; + + obj._frameNumber = 0; + obj._sequenceNumber = 0; + } + } + } + } +} + } // End of namespace Scalpel } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_people.h b/engines/sherlock/scalpel/scalpel_people.h index 0e9eec10fe..b2267790e0 100644 --- a/engines/sherlock/scalpel/scalpel_people.h +++ b/engines/sherlock/scalpel/scalpel_people.h @@ -50,6 +50,11 @@ public: * Setup the data for an animating speaker portrait at the top of the screen */ void setTalking(int speaker); + + /** + * Change the sequence of the scene background object associated with the specified speaker. + */ + virtual void setTalkSequence(int speaker, int sequenceNum = 1); }; } // End of namespace Scalpel diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 2923359415..89efc70803 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -97,7 +97,8 @@ const byte SCALPEL_OPCODES[] = { 0, // OP_NPC_VERB_SCRIPT 0, // OP_RESTORE_PEOPLE_SEQUENCE 0, // OP_NPC_VERB_TARGET - 0 // OP_TURN_SOUNDS_OFF + 0, // OP_TURN_SOUNDS_OFF + 0 // OP_NULL }; /*----------------------------------------------------------------*/ @@ -281,7 +282,7 @@ OpcodeReturn ScalpelTalk::cmdSwitchSpeaker(const byte *&str) { people.setTalking(_speaker); pullSequence(); pushSequence(_speaker); - setSequence(_speaker); + people.setTalkSequence(_speaker); return RET_SUCCESS; } @@ -457,35 +458,6 @@ OpcodeReturn ScalpelTalk::cmdCarriageReturn(const byte *&str) { return RET_SUCCESS; } -void ScalpelTalk::setSequence(int speaker, int sequenceNum) { - People &people = *_vm->_people; - Scene &scene = *_vm->_scene; - - // If no speaker is specified, then nothing needs to be done - if (speaker == -1) - return; - - if (speaker) { - int objNum = people.findSpeaker(speaker); - if (objNum != -1) { - Object &obj = scene._bgShapes[objNum]; - - if (obj._seqSize < MAX_TALK_SEQUENCES) { - warning("Tried to copy too many talk frames"); - } else { - for (int idx = 0; idx < MAX_TALK_SEQUENCES; ++idx) { - obj._sequences[idx] = people._characters[speaker]._talkSequences[idx]; - if (idx > 0 && !obj._sequences[idx] && !obj._sequences[idx - 1]) - return; - - obj._frameNumber = 0; - obj._sequenceNumber = 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 6dc104de08..eb97b5760d 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -52,11 +52,6 @@ private: OpcodeReturn cmdCarriageReturn(const byte *&str); protected: /** - * Change the sequence of the scene background object associated with the current speaker. - */ - virtual void setSequence(int speaker, int sequenceNum = 1); - - /** * Display the talk interface window */ virtual void talkInterface(const byte *&str); |