diff options
author | Paul Gilbert | 2015-06-03 21:03:44 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-06-03 21:03:44 -0400 |
commit | 60378fe22883387c9d116764dc631c5cd5a6d3f8 (patch) | |
tree | a1503969168bb2775a29b82fdd57a722a12c5421 /engines/sherlock/talk.cpp | |
parent | bc7127c52222fc98c36f6b33b534acdcb10027c8 (diff) | |
download | scummvm-rg350-60378fe22883387c9d116764dc631c5cd5a6d3f8.tar.gz scummvm-rg350-60378fe22883387c9d116764dc631c5cd5a6d3f8.tar.bz2 scummvm-rg350-60378fe22883387c9d116764dc631c5cd5a6d3f8.zip |
SHERLOCK: Implemented setObjTalkSequence methods
Diffstat (limited to 'engines/sherlock/talk.cpp')
-rw-r--r-- | engines/sherlock/talk.cpp | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index 319cb10850..bb5c11c81f 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -222,12 +222,13 @@ TalkHistoryEntry::TalkHistoryEntry() { /*----------------------------------------------------------------*/ -TalkSequences::TalkSequences(const byte *data) { - Common::copy(data, data + MAX_TALK_SEQUENCES, _data); -} - -void TalkSequences::clear() { - Common::fill(&_data[0], &_data[MAX_TALK_SEQUENCES], 0); +TalkSequence::TalkSequence() { + _obj = nullptr; + _frameNumber = 0; + _sequenceNumber = 0; + _seqStack = 0; + _seqTo = 0; + _seqCounter = _seqCounter2 = 0; } /*----------------------------------------------------------------*/ @@ -1022,6 +1023,31 @@ void Talk::pushSequence(int speaker) { error("script stack overflow"); } +void Talk::pushTalkSequence(Object *obj) { + // Check if the shape is already on the stack + for (uint idx = 0; idx < TALK_SEQUENCE_STACK_SIZE; ++idx) { + if (_talkSequenceStack[idx]._obj = obj) + return; + } + + // Find a free slot and save the details in it + for (uint idx = 0; idx < TALK_SEQUENCE_STACK_SIZE; ++idx) { + TalkSequence &ts = _talkSequenceStack[idx]; + if (ts._obj == nullptr) { + ts._obj = obj; + ts._frameNumber = obj->_frameNumber; + ts._sequenceNumber = obj->_sequenceNumber; + ts._seqStack = obj->_seqStack; + ts._seqTo = obj->_seqTo; + ts._seqCounter = obj->_seqCounter; + ts._seqCounter2 = obj->_seqCounter2; + return; + } + } + + error("Ran out of talk sequence stack space"); +} + void Talk::setSequence(int speaker) { People &people = *_vm->_people; Scene &scene = *_vm->_scene; |