diff options
author | Paul Gilbert | 2015-08-18 20:53:31 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-08-18 20:53:31 -0400 |
commit | d4e5e447925d251afca20afec0e090b210740c82 (patch) | |
tree | 8e594456ed56d2bd478c358f214f71fd53f0dd59 /engines/sherlock/scalpel | |
parent | 21666d701e79dd83411a0ba19e00642a5c51e377 (diff) | |
download | scummvm-rg350-d4e5e447925d251afca20afec0e090b210740c82.tar.gz scummvm-rg350-d4e5e447925d251afca20afec0e090b210740c82.tar.bz2 scummvm-rg350-d4e5e447925d251afca20afec0e090b210740c82.zip |
SHERLOCK: Standardize sequence stack code for both games
Diffstat (limited to 'engines/sherlock/scalpel')
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 25 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.h | 14 |
2 files changed, 37 insertions, 2 deletions
diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 61e736483c..4debe7fc26 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -879,7 +879,26 @@ OpcodeReturn ScalpelTalk::cmdCallTalkFile(const byte *&str) { return RET_SUCCESS; } -void ScalpelTalk::pullSequence() { +void ScalpelTalk::pushSequenceEntry(Object *obj) { + Scene &scene = *_vm->_scene; + SequenceEntry seqEntry; + seqEntry._objNum = scene._bgShapes.indexOf(*obj); + + if (seqEntry._objNum != -1) { + Object &obj = scene._bgShapes[seqEntry._objNum]; + for (uint idx = 0; idx < MAX_TALK_SEQUENCES; ++idx) + seqEntry._sequences.push_back(obj._sequences[idx]); + + seqEntry._frameNumber = obj._frameNumber; + seqEntry._seqTo = obj._seqTo; + } + + _sequenceStack.push(seqEntry); + if (_scriptStack.size() >= 5) + error("script stack overflow"); +} + +void ScalpelTalk::pullSequence(int slot) { Scene &scene = *_vm->_scene; if (_sequenceStack.empty()) @@ -901,6 +920,10 @@ void ScalpelTalk::pullSequence() { } } +void ScalpelTalk::clearSequences() { + _sequenceStack.clear(); +} + } // 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 1d70db14b9..9e07b26dc8 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -37,6 +37,8 @@ namespace Scalpel { class ScalpelTalk : public Talk { private: + Common::Stack<SequenceEntry> _sequenceStack; + OpcodeReturn cmdSwitchSpeaker(const byte *&str); OpcodeReturn cmdAssignPortraitLocation(const byte *&str); OpcodeReturn cmdGotoScene(const byte *&str); @@ -103,15 +105,25 @@ public: void talk3DOMovieTrigger(int subIndex); /** + * Push the details of a passed object onto the saved sequences stack + */ + virtual void pushSequenceEntry(Object *obj); + + /** * Pulls a background object sequence from the sequence stack and restore's the * object's sequence */ - virtual void pullSequence(); + virtual void pullSequence(int slot = -1); /** * Returns true if the script stack is empty */ virtual bool isSequencesEmpty() const { return _scriptStack.empty(); } + + /** + * Clears the stack of pending object sequences associated with speakers in the scene + */ + virtual void clearSequences(); }; } // End of namespace Scalpel |