[Scummvm-cvs-logs] scummvm master -> 2b19dba460a90d5081948785cdd56cf46554968b

dreammaster dreammaster at scummvm.org
Sat Aug 15 13:01:19 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2b19dba460 SHERLOCK: RT: Fix resetting sprite sequences


Commit: 2b19dba460a90d5081948785cdd56cf46554968b
    https://github.com/scummvm/scummvm/commit/2b19dba460a90d5081948785cdd56cf46554968b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-15T07:00:23-04:00

Commit Message:
SHERLOCK: RT: Fix resetting sprite sequences

Changed paths:
    engines/sherlock/objects.cpp
    engines/sherlock/objects.h
    engines/sherlock/tattoo/tattoo_scene.cpp



diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index e5d97c1..a2210cc 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 996054b..337d320 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 e249e0e..9c76df0 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();






More information about the Scummvm-git-logs mailing list