diff options
Diffstat (limited to 'engines/sherlock')
-rw-r--r-- | engines/sherlock/people.h | 11 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.cpp | 30 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_people.h | 11 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 3 | ||||
-rw-r--r-- | engines/sherlock/talk.cpp | 34 | ||||
-rw-r--r-- | engines/sherlock/talk.h | 6 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_people.h | 22 |
7 files changed, 67 insertions, 50 deletions
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h index d790e4ccb0..c47d45145a 100644 --- a/engines/sherlock/people.h +++ b/engines/sherlock/people.h @@ -166,6 +166,17 @@ public: * Restrict passed point to zone using Sherlock's positioning rules */ virtual const Common::Point restrictToZone(int zoneId, const Common::Point &destPos) = 0; + + /** + * If the specified speaker is a background object, it will set it so that it uses + * the Listen Sequence (specified by the sequence number). If the current sequence + * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object + * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code, + * the Listen Sequence will begin immediately. + * @param speaker Who is speaking + * @param sequenceNum Which listen sequence to use + */ + virtual void setListenSequence(int speaker, int sequenceNum = 1) = 0; }; } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp index 0b8caf3721..0a9d510df5 100644 --- a/engines/sherlock/scalpel/scalpel_people.cpp +++ b/engines/sherlock/scalpel/scalpel_people.cpp @@ -533,6 +533,36 @@ const Common::Point ScalpelPeople::restrictToZone(int zoneId, const Common::Poin (pt.y - delta.y * 2) / FIXED_INT_MULTIPLIER); } +void ScalpelPeople::setListenSequence(int speaker, int sequenceNum) { + People &people = *_vm->_people; + Scene &scene = *_vm->_scene; + + // Don't bother doing anything if no specific speaker is specified + 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 few still frames"); + } else { + for (uint idx = 0; idx < MAX_TALK_SEQUENCES; ++idx) { + obj._sequences[idx] = people._characters[speaker]._stillSequences[idx]; + if (idx > 0 && !people._characters[speaker]._talkSequences[idx] && + !people._characters[speaker]._talkSequences[idx - 1]) + break; + } + + obj._frameNumber = 0; + obj._seqTo = 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 ad9a6a5296..941c2dc274 100644 --- a/engines/sherlock/scalpel/scalpel_people.h +++ b/engines/sherlock/scalpel/scalpel_people.h @@ -110,6 +110,17 @@ public: * Load the walking images for Sherlock */ virtual bool loadWalk(); + + /** + * If the specified speaker is a background object, it will set it so that it uses + * the Listen Sequence (specified by the sequence number). If the current sequence + * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object + * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code, + * the Listen Sequence will begin immediately. + * @param speaker Who is speaking + * @param sequenceNum Which listen sequence to use + */ + virtual void setListenSequence(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 b844979ffb..61e736483c 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -806,6 +806,7 @@ int ScalpelTalk::talkLine(int lineNum, int stateNum, byte color, int lineY, bool void ScalpelTalk::showTalk() { FixedText &fixedText = *_vm->_fixedText; + People &people = *_vm->_people; ScalpelScreen &screen = *(ScalpelScreen *)_vm->_screen; ScalpelUserInterface &ui = *(ScalpelUserInterface *)_vm->_ui; Common::String fixedText_Exit = fixedText.getText(kFixedText_Window_Exit); @@ -813,7 +814,7 @@ void ScalpelTalk::showTalk() { clearSequences(); pushSequence(_talkTo); - setStillSeq(_talkTo); + people.setListenSequence(_talkTo); ui._selector = ui._oldSelector = -1; diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index 5213445cc7..a2d6d8a353 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -500,7 +500,7 @@ void Talk::talk(int objNum) { Object &obj = scene._bgShapes[objNum]; clearSequences(); pushSequence(_talkTo); - setStillSeq(_talkTo); + people.setListenSequence(_talkTo, 129); events.setCursor(WAIT); if (obj._lookPosition.y != 0) @@ -521,7 +521,7 @@ void Talk::talk(int objNum) { Object &obj = scene._bgShapes[objNum]; clearSequences(); pushSequence(_talkTo); - setStillSeq(_talkTo); + people.setListenSequence(_talkTo, 129); events.setCursor(WAIT); if (obj._lookPosition.y != 0) @@ -694,36 +694,6 @@ void Talk::pushTalkSequence(Object *obj) { error("Ran out of talk sequence stack space"); } -void Talk::setStillSeq(int speaker) { - People &people = *_vm->_people; - Scene &scene = *_vm->_scene; - - // Don't bother doing anything if no specific speaker is specified - 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 few still frames"); - } else { - for (uint idx = 0; idx < MAX_TALK_SEQUENCES; ++idx) { - obj._sequences[idx] = people._characters[speaker]._stillSequences[idx]; - if (idx > 0 && !people._characters[speaker]._talkSequences[idx] && - !people._characters[speaker]._talkSequences[idx - 1]) - break; - } - - obj._frameNumber = 0; - obj._seqTo = 0; - } - } - } -} - void Talk::doScript(const Common::String &script) { People &people = *_vm->_people; Scene &scene = *_vm->_scene; diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h index d765b80484..dcc970a2ba 100644 --- a/engines/sherlock/talk.h +++ b/engines/sherlock/talk.h @@ -321,12 +321,6 @@ public: void loadTalkFile(const Common::String &filename); /** - * Change the sequence of a background object corresponding to a given speaker. - * The new sequence will display the character as "listening" - */ - void setStillSeq(int speaker); - - /** * Clears the stack of pending object sequences associated with speakers in the scene */ void clearSequences(); diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h index 4e57cfe9b2..66123a7f72 100644 --- a/engines/sherlock/tattoo/tattoo_people.h +++ b/engines/sherlock/tattoo/tattoo_people.h @@ -232,17 +232,6 @@ public: TattooPerson &operator[](int idx) { return *(TattooPerson *)_data[idx]; } /** - * If the specified speaker is a background object, it will set it so that it uses - * the Listen Sequence (specified by the sequence number). If the current sequence - * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object - * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code, - * the Listen Sequence will begin immediately. - * @param speaker Who is speaking - * @param sequenceNum Which listen sequence to use - */ - void setListenSequence(int speaker, int sequenceNum = 1); - - /** * Restore any saved NPC walk path data from any of the NPCs */ void pullNPCPaths(); @@ -271,6 +260,17 @@ public: * Restrict passed point to zone using Sherlock's positioning rules */ virtual const Common::Point restrictToZone(int zoneId, const Common::Point &destPos); + + /** + * If the specified speaker is a background object, it will set it so that it uses + * the Listen Sequence (specified by the sequence number). If the current sequence + * has an Allow Talk Code in it, the _gotoSeq field will be set so that the object + * begins listening as soon as it hits the Allow Talk Code. If there is no Abort Code, + * the Listen Sequence will begin immediately. + * @param speaker Who is speaking + * @param sequenceNum Which listen sequence to use + */ + virtual void setListenSequence(int speaker, int sequenceNum = 1); }; } // End of namespace Scalpel |