diff options
author | Paul Gilbert | 2015-08-15 07:00:23 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-08-15 07:00:23 -0400 |
commit | 2b19dba460a90d5081948785cdd56cf46554968b (patch) | |
tree | f816b8dc59719f36b88051f03d03bbc109d15d83 | |
parent | 23aba271ff54fff1abf8c4d5680961954762ca29 (diff) | |
download | scummvm-rg350-2b19dba460a90d5081948785cdd56cf46554968b.tar.gz scummvm-rg350-2b19dba460a90d5081948785cdd56cf46554968b.tar.bz2 scummvm-rg350-2b19dba460a90d5081948785cdd56cf46554968b.zip |
SHERLOCK: RT: Fix resetting sprite sequences
-rw-r--r-- | engines/sherlock/objects.cpp | 50 | ||||
-rw-r--r-- | engines/sherlock/objects.h | 3 | ||||
-rw-r--r-- | engines/sherlock/tattoo/tattoo_scene.cpp | 2 |
3 files changed, 41 insertions, 14 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp index e5d97c1279..a2210cc7e2 100644 --- a/engines/sherlock/objects.cpp +++ b/engines/sherlock/objects.cpp @@ -60,6 +60,7 @@ BaseObject::BaseObject() { _sequences = nullptr; _images = nullptr; _imageFrame = nullptr; + _sequenceNumber = 0; _walkCount = 0; _allow = 0; _frameNumber = 0; @@ -427,6 +428,11 @@ void BaseObject::setObjSequence(int seq, bool wait) { if (_frameNumber >= checkFrame) _frameNumber = 0; + // For Rose Tattoo, save the starting frame for new sequences in the _sequenceNumber field, + // to make it easier to reset back for repeats + if (IS_ROSE_TATTOO) + _sequenceNumber = _frameNumber; + _seqCounter = 0; if (_sequences[_frameNumber] == 0) seq = _sequences[_frameNumber + 1]; @@ -434,12 +440,17 @@ void BaseObject::setObjSequence(int seq, bool wait) { return; } else { // Find beginning of sequence - do { - --_frameNumber; - } while (_frameNumber > 0 && _sequences[_frameNumber] != 0); + if (IS_ROSE_TATTOO) { + // Use the sequence number as the index to reset the sequence back to + _frameNumber = _sequenceNumber; + } else { + do { + --_frameNumber; + } while (_frameNumber > 0 && _sequences[_frameNumber] != 0); - if (_frameNumber != 0) - _frameNumber += 2; + if (_frameNumber != 0) + _frameNumber += 2; + } return; } @@ -452,10 +463,28 @@ void BaseObject::setObjSequence(int seq, bool wait) { int seqCc = 0; while (seqCc < seq && idx < checkFrame) { - ++idx; - if (_sequences[idx] == 0) { - ++seqCc; - idx += 2; + if (IS_SERRATED_SCALPEL) { + ++idx; + + if (_sequences[idx] == 0) { + ++seqCc; + idx += 2; + } + } else { + byte s = _sequences[idx]; + + if (s == 0) { + ++seqCc; + ++idx; + } else if (s == MOVE_CODE || s == TELEPORT_CODE) { + idx += 4; + } else if (s == CALL_TALK_CODE) { + idx += 8; + } else if (s == HIDE_CODE) { + idx += 2; + } + + ++idx; } } @@ -589,7 +618,7 @@ void Sprite::clear() { _imageFrame = nullptr; _walkCount = 0; _allow = 0; - _frameNumber = _sequenceNumber = 0; + _frameNumber = 0; _position.x = _position.y = 0; _delta.x = _delta.y = 0; _oldPosition.x = _oldPosition.y = 0; @@ -943,7 +972,6 @@ void UseType::synchronize(Serializer &s) { /*----------------------------------------------------------------*/ Object::Object(): BaseObject() { - _sequenceNumber = 0; _sequenceOffset = 0; _pickup = 0; _defaultCommand = 0; diff --git a/engines/sherlock/objects.h b/engines/sherlock/objects.h index 996054be43..337d320912 100644 --- a/engines/sherlock/objects.h +++ b/engines/sherlock/objects.h @@ -208,6 +208,7 @@ public: byte *_sequences; // Holds animation sequences ImageFile *_images; // Sprite images ImageFrame *_imageFrame; // Pointer to shape in the images + int _sequenceNumber; // Sequence being used int _walkCount; // Walk counter int _allow; // Allowed UI commands int _frameNumber; // Frame number in rame sequence to draw @@ -283,7 +284,6 @@ public: Common::String _pickUp; // Message for if you can't pick up object WalkSequences _walkSequences; // Holds animation sequences - int _sequenceNumber; // Sequence being used Common::Point _noShapeSize; // Size of a NO_SHAPE int _status; // Status: open/closed, moved/not moved int8 _misc; // Miscellaneous use @@ -365,7 +365,6 @@ class Object: public BaseObject { public: Common::String _name; // Name Common::String _examine; // Examine in-depth description - int _sequenceNumber; int _sequenceOffset; int _pickup; int _defaultCommand; // Default right-click command diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp index e249e0eaac..9c76df0b51 100644 --- a/engines/sherlock/tattoo/tattoo_scene.cpp +++ b/engines/sherlock/tattoo/tattoo_scene.cpp @@ -346,7 +346,7 @@ void TattooScene::doBgAnim() { if (people[idx]._type == CHARACTER) people[idx].checkSprite(); } - + for (uint idx = 0; idx < _bgShapes.size(); ++idx) { if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE) _bgShapes[idx].checkObject(); |