[Scummvm-cvs-logs] scummvm master -> dbf82dd92af5f0b8b04dfa4e6175740dc80e24ad

dreammaster dreammaster at scummvm.org
Thu Jul 2 01:21:18 CEST 2015


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

Summary:
704dd8140b SHERLOCK: RT: Fix missing code in setWalking
dbf82dd92a SHERLOCK: RT: Move ADJUST_CORD usage to initial anim loading


Commit: 704dd8140b28668feeb3849c7c13044d8eb122ed
    https://github.com/scummvm/scummvm/commit/704dd8140b28668feeb3849c7c13044d8eb122ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-01T19:18:26-04:00

Commit Message:
SHERLOCK: RT: Fix missing code in setWalking

Changed paths:
    engines/sherlock/tattoo/tattoo_people.cpp



diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index b4c96fe..42a7d26 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -420,6 +420,8 @@ void TattooPerson::setWalking() {
 				if (_sequenceNumber == WALK_LEFT || _sequenceNumber == WALK_RIGHT) {
 					_delta.x = _delta.x / speed.x * diagSpeed.x;
 					_delta.y = (delta.y * FIXED_INT_MULTIPLIER) / (delta.x * 10 / diagSpeed.x);
+
+					_walkCount = delta.x * 10 / diagSpeed.x;
 				}
 
 				switch (_sequenceNumber) {
@@ -434,6 +436,7 @@ void TattooPerson::setWalking() {
 				if (_sequenceNumber == WALK_LEFT || _sequenceNumber == WALK_RIGHT) {
 					_delta.x = _delta.x / speed.x * diagSpeed.x;
 					_delta.y = -1 * (delta.y * FIXED_INT_MULTIPLIER) / (delta.x * 10 / diagSpeed.x);
+
 					_walkCount = (delta.x * 10) / diagSpeed.x;
 				}
 
@@ -453,16 +456,25 @@ void TattooPerson::setWalking() {
 				_sequenceNumber = WALK_UP;
 				_delta.y = speed.y * -FIXED_INT_MULTIPLIER;
 			} else {
+				speed.y = diagSpeed.y;
 				_sequenceNumber = WALK_DOWN;
 				_delta.y = speed.y * FIXED_INT_MULTIPLIER;
 			}
 
 			// Set the delta x
-			_delta.x = (delta.x * FIXED_INT_MULTIPLIER) / (delta.y / speed.y);
-			if (_walkDest.x < (_position.x / FIXED_INT_MULTIPLIER))
+			if (delta.y * 10 / speed.y)
+				_delta.x = (delta.x * FIXED_INT_MULTIPLIER) / (delta.y * 10 / speed.y);
+			else
+				_delta.x = (delta.x * FIXED_INT_MULTIPLIER) / delta.y;
+
+			if (_walkDest.x < _position.y / FIXED_INT_MULTIPLIER)
 				_delta.x = -_delta.x;
 
-			_walkCount = delta.y / speed.y;
+			// Set how many times we should add the delta's to the players position
+			if (delta.y * 10 / speed.y)
+				_walkCount = delta.y * 10 / speed.y;
+			else
+				_walkCount = delta.y;
 		}
 	}
 
@@ -501,7 +513,7 @@ void TattooPerson::walkToCoords(const Point32 &destPos, int destDir) {
 	CursorId oldCursor = events.getCursor();
 	events.setCursor(WAIT);
 
-	_walkDest = Common::Point(_position.x / FIXED_INT_MULTIPLIER, _position.y / FIXED_INT_MULTIPLIER);
+	_walkDest = Common::Point(destPos.x / FIXED_INT_MULTIPLIER, destPos.y / FIXED_INT_MULTIPLIER);
 
 	bool isHolmes = this == &people[HOLMES];
 	if (isHolmes) {


Commit: dbf82dd92af5f0b8b04dfa4e6175740dc80e24ad
    https://github.com/scummvm/scummvm/commit/dbf82dd92af5f0b8b04dfa4e6175740dc80e24ad
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-01T19:20:18-04:00

Commit Message:
SHERLOCK: RT: Move ADJUST_CORD usage to initial anim loading

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



diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 1d2cb1b..a42fce5 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -39,6 +39,12 @@ namespace Sherlock {
 #define CLEAR_DIST_X 5
 #define CLEAR_DIST_Y 0
 
+#define ADJUST_COORD(COORD) \
+	if (COORD.x != -1) \
+		COORD.x *= FIXED_INT_MULTIPLIER; \
+	if (COORD.y != -1) \
+		COORD.y *= FIXED_INT_MULTIPLIER
+
 SherlockEngine *BaseObject::_vm;
 bool BaseObject::_countCAnimFrames;
 
@@ -1430,28 +1436,31 @@ void CAnim::load(Common::SeekableReadStream &s, bool isRoseTattoo, uint32 dataOf
 	_goto[0].x = s.readSint16LE();
 	_goto[0].y = s.readSint16LE();
 	_goto[0]._facing = s.readSint16LE();
+	ADJUST_COORD(_goto[0]);
 
 	if (isRoseTattoo) {
 		// Get Goto position and facing for second NPC
 		_goto[1].x = s.readSint16LE();
 		_goto[1].y = s.readSint16LE();
 		_goto[1]._facing = s.readSint16LE();
+		ADJUST_COORD(_goto[1]);
 	} else {
 		// For Serrated Scalpel, adjust the loaded co-ordinates
 		_goto[0].x = _goto[0].x * FIXED_INT_MULTIPLIER / 100;
 		_goto[0].y = _goto[0].y * FIXED_INT_MULTIPLIER / 100;
-
 	}
 
 	_teleport[0].x = s.readSint16LE();
 	_teleport[0].y = s.readSint16LE();
 	_teleport[0]._facing = s.readSint16LE();
+	ADJUST_COORD(_teleport[0]);
 
 	if (isRoseTattoo) {
 		// Get Teleport position and facing for second NPC
 		_teleport[1].x = s.readSint16LE();
 		_teleport[1].y = s.readSint16LE();
 		_teleport[1]._facing = s.readSint16LE();
+		ADJUST_COORD(_teleport[1]);
 	} else {
 		// For Serrated Scalpel, adjust the loaded co-ordinates
 		_teleport[0].x = _teleport[0].x * FIXED_INT_MULTIPLIER / 100;
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index d41df5e..0f02f3e 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -569,12 +569,6 @@ int TattooScene::getScaleVal(const Point32 &pt) {
 	return result;
 }
 
-#define ADJUST_COORD(COORD) \
-	if (COORD.x != -1) \
-		COORD.x *= FIXED_INT_MULTIPLIER; \
-	if (COORD.y != -1) \
-		COORD.y *= FIXED_INT_MULTIPLIER
-
 int TattooScene::startCAnim(int cAnimNum, int playRate) {
 	TattooEngine &vm = *(TattooEngine *)_vm;
 	Events &events = *_vm->_events;
@@ -595,12 +589,6 @@ int TattooScene::startCAnim(int cAnimNum, int playRate) {
 	PositionFacing teleport1 = cAnim._teleport[0];
 	PositionFacing teleport2 = cAnim._teleport[1];
 
-	// If the co-ordinates are valid (not -1), adjust them by the fixed int multiplier
-	ADJUST_COORD(goto1);
-	ADJUST_COORD(goto2);
-	ADJUST_COORD(teleport1);
-	ADJUST_COORD(teleport2);
-
 	// See if the Player must walk to a position before the animation starts
 	SpriteType savedPlayerType = people[HOLMES]._type;
 	if (goto1.x != -1 && people[HOLMES]._type == CHARACTER) {
@@ -700,8 +688,6 @@ int TattooScene::startCAnim(int cAnimNum, int playRate) {
 	return 1;
 }
 
-#undef ADJUST_COORD
-
 void TattooScene::setNPCPath(int npc) {
 	TattooPeople &people = *(TattooPeople *)_vm->_people;
 	Talk &talk = *_vm->_talk;
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 107eeba..8942d4e 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -86,8 +86,7 @@ void TattooUserInterface::lookAtObject() {
 			scene.startCAnim(cNum);
 		} else if (_bgShape->_lookPosition.y != 0) {
 			// Need to walk to object before looking at it
-			people[HOLMES].walkToCoords(Common::Point(_bgShape->_lookPosition.x * FIXED_INT_MULTIPLIER,
-				_bgShape->_lookPosition.y * FIXED_INT_MULTIPLIER), _bgShape->_lookPosition._facing);
+			people[HOLMES].walkToCoords(_bgShape->_lookPosition, _bgShape->_lookPosition._facing);
 		}
 
 		if (!talk._talkToAbort) {






More information about the Scummvm-git-logs mailing list