diff options
author | Paul Gilbert | 2015-06-06 21:31:48 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-06 21:31:48 -0400 |
commit | 3511f30a2621af4773df5271cdffb6275b9e829e (patch) | |
tree | 7a49bb802aecb9e64a2ba5c30f6314e54ff22f05 /engines/sherlock/scalpel | |
parent | 75610e7119b415779380805912de40101e3be656 (diff) | |
download | scummvm-rg350-3511f30a2621af4773df5271cdffb6275b9e829e.tar.gz scummvm-rg350-3511f30a2621af4773df5271cdffb6275b9e829e.tar.bz2 scummvm-rg350-3511f30a2621af4773df5271cdffb6275b9e829e.zip |
SHERLOCK: Created common base class for Sprite and Object
Diffstat (limited to 'engines/sherlock/scalpel')
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 29 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.h | 7 |
2 files changed, 35 insertions, 1 deletions
diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 0b0259ce0f..65f7a76049 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -325,6 +325,35 @@ 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 8121e1985e..1947e2cd79 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -36,7 +36,7 @@ namespace Sherlock { namespace Scalpel { class ScalpelTalk : public Talk { -protected: +private: OpcodeReturn cmdAssignPortraitLocation(const byte *&str); OpcodeReturn cmdClearInfoLine(const byte *&str); OpcodeReturn cmdClearWindow(const byte *&str); @@ -49,6 +49,11 @@ protected: OpcodeReturn cmdSfxCommand(const byte *&str); OpcodeReturn cmdSummonWindow(const byte *&str); 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); public: ScalpelTalk(SherlockEngine *vm); virtual ~ScalpelTalk() {} |