[Scummvm-cvs-logs] scummvm master -> 724fe7e4f68b796bd0e5b79cd28c873ba32cdff4

dreammaster dreammaster at scummvm.org
Sun Jun 14 18:11:27 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:
724fe7e4f6 SHERLOCK: Move _walkDest from People to Person


Commit: 724fe7e4f68b796bd0e5b79cd28c873ba32cdff4
    https://github.com/scummvm/scummvm/commit/724fe7e4f68b796bd0e5b79cd28c873ba32cdff4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-14T12:10:26-04:00

Commit Message:
SHERLOCK: Move _walkDest from People to Person

Changed paths:
    engines/sherlock/objects.cpp
    engines/sherlock/people.cpp
    engines/sherlock/people.h
    engines/sherlock/scalpel/scalpel_map.cpp
    engines/sherlock/scalpel/scalpel_people.cpp
    engines/sherlock/scalpel/scalpel_user_interface.cpp
    engines/sherlock/scene.cpp
    engines/sherlock/tattoo/tattoo_people.cpp
    engines/sherlock/tattoo/tattoo_user_interface.cpp



diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 21ab01d..e9c6b00 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -822,7 +822,7 @@ void Sprite::checkSprite() {
 						}
 
 						walkPos.x += people[HOLMES]._imageFrame->_frame.w / 2;
-						people._walkDest = walkPos;
+						people[HOLMES]._walkDest = walkPos;
 						people[HOLMES]._walkTo.push(walkPos);
 						people[HOLMES].setWalking();
 					}
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 0db687c..7306ae9 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -71,7 +71,6 @@ Person::Person() : Sprite() {
 }
 
 void Person::goAllTheWay() {
-	People &people = *_vm->_people;
 	Scene &scene = *_vm->_scene;
 	Common::Point srcPt = getSourcePoint();
 
@@ -81,20 +80,20 @@ void Person::goAllTheWay() {
 		_srcZone = scene.closestZone(srcPt);
 
 	// Get the zone of the destination
-	_destZone = scene.whichZone(people._walkDest);
+	_destZone = scene.whichZone(_walkDest);
 	if (_destZone == -1) {
-		_destZone = scene.closestZone(people._walkDest);
+		_destZone = scene.closestZone(_walkDest);
 
 		// The destination isn't in a zone
-		if (people._walkDest.x >= (SHERLOCK_SCREEN_WIDTH - 1))
-			people._walkDest.x = SHERLOCK_SCREEN_WIDTH - 2;
+		if (_walkDest.x >= (SHERLOCK_SCREEN_WIDTH - 1))
+			_walkDest.x = SHERLOCK_SCREEN_WIDTH - 2;
 
 		// Trace a line between the centroid of the found closest zone to
 		// the destination, to find the point at which the zone will be left
 		const Common::Rect &destRect = scene._zones[_destZone];
 		const Common::Point destCenter((destRect.left + destRect.right) / 2,
 			(destRect.top + destRect.bottom) / 2);
-		const Common::Point delta = people._walkDest - destCenter;
+		const Common::Point delta = _walkDest - destCenter;
 		Point32 pt(destCenter.x * FIXED_INT_MULTIPLIER, destCenter.y * FIXED_INT_MULTIPLIER);
 
 		// Move along the line until the zone is left
@@ -104,7 +103,7 @@ void Person::goAllTheWay() {
 
 		// Set the new walk destination to the last point that was in the
 		// zone just before it was left
-		people._walkDest = Common::Point((pt.x - delta.x * 2) / FIXED_INT_MULTIPLIER,
+		_walkDest = Common::Point((pt.x - delta.x * 2) / FIXED_INT_MULTIPLIER,
 			(pt.y - delta.y * 2) / FIXED_INT_MULTIPLIER);
 	}
 
@@ -144,10 +143,10 @@ void Person::goAllTheWay() {
 			}
 
 			// Final position
-			_walkTo.push(people._walkDest);
+			_walkTo.push(_walkDest);
 
 			// Start walking
-			people._walkDest = _walkTo.pop();
+			_walkDest = _walkTo.pop();
 			setWalking();
 		}
 	}
@@ -162,7 +161,7 @@ void Person::walkToCoords(const Point32 &destPos, int destDir) {
 	CursorId oldCursor = events.getCursor();
 	events.setCursor(WAIT);
 
-	people._walkDest = Common::Point(destPos.x / FIXED_INT_MULTIPLIER + 10, destPos.y / FIXED_INT_MULTIPLIER);
+	_walkDest = Common::Point(destPos.x / FIXED_INT_MULTIPLIER + 10, destPos.y / FIXED_INT_MULTIPLIER);
 	people._allowWalkAbort = true;
 	goAllTheWay();
 
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 5b5aac6..39eb106 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -67,6 +67,7 @@ public:
 	int _srcZone, _destZone;
 	bool _walkLoaded;
 	Common::String _portrait;
+	Common::Point _walkDest;
 
 	// Rose Tattoo fields
 	Common::String _walkVGSName;		// Name of walk library person is using
@@ -98,7 +99,6 @@ protected:
 public:
 	Common::Array<PersonData> _characters;
 	ImageFile *_talkPics;
-	Common::Point _walkDest;
 	Point32 _hSavedPos;
 	int _hSavedFacing;
 	bool _holmesOn;
diff --git a/engines/sherlock/scalpel/scalpel_map.cpp b/engines/sherlock/scalpel/scalpel_map.cpp
index 7356deb..08013df 100644
--- a/engines/sherlock/scalpel/scalpel_map.cpp
+++ b/engines/sherlock/scalpel/scalpel_map.cpp
@@ -250,7 +250,7 @@ int ScalpelMap::show() {
 
 		if ((events._released || events._rightReleased) && _point != -1) {
 			if (people[HOLMES]._walkCount == 0) {
-				people._walkDest = _points[_point] + Common::Point(4, 9);
+				people[HOLMES]._walkDest = _points[_point] + Common::Point(4, 9);
 				_charPoint = _point;
 
 				// Start walking to selected location
@@ -454,7 +454,7 @@ void ScalpelMap::walkTheStreets() {
 
 	// Add in destination position
 	people[HOLMES]._walkTo.clear();
-	Common::Point destPos = people._walkDest;
+	Common::Point destPos = people[HOLMES]._walkDest;
 
 	// Check for any intermediate points between the two locations
 	if (path[0] || _charPoint > 50 || _oldCharPoint > 50) {
@@ -488,7 +488,7 @@ void ScalpelMap::walkTheStreets() {
 					people[HOLMES]._walkTo.push(tempPath[idx]);
 			}
 
-			people._walkDest = people[HOLMES]._walkTo.pop() + Common::Point(12, 6);
+			people[HOLMES]._walkDest = people[HOLMES]._walkTo.pop() + Common::Point(12, 6);
 			people[HOLMES].setWalking();
 		}
 	} else {
diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp
index 72d8d32..3c02eb4 100644
--- a/engines/sherlock/scalpel/scalpel_people.cpp
+++ b/engines/sherlock/scalpel/scalpel_people.cpp
@@ -53,7 +53,7 @@ void ScalpelPerson::adjustSprite() {
 			// If there any points left for the character to walk to along the
 			// route to a destination, then move to the next point
 			if (!people[HOLMES]._walkTo.empty()) {
-				people._walkDest = people[HOLMES]._walkTo.pop();
+				_walkDest = people[HOLMES]._walkTo.pop();
 				setWalking();
 			} else {
 				gotoStand();
@@ -189,7 +189,6 @@ void ScalpelPerson::gotoStand() {
 
 void ScalpelPerson::setWalking() {
 	Map &map = *_vm->_map;
-	People &people = *_vm->_people;
 	Scene &scene = *_vm->_scene;
 	int oldDirection, oldFrame;
 	Common::Point speed, delta;
@@ -217,12 +216,12 @@ void ScalpelPerson::setWalking() {
 		// clicked, but characters draw positions start at their left, move
 		// the destination half the character width to draw him centered
 		int temp;
-		if (people._walkDest.x >= (temp = _imageFrame->_frame.w / 2))
-			people._walkDest.x -= temp;
+		if (_walkDest.x >= (temp = _imageFrame->_frame.w / 2))
+			_walkDest.x -= temp;
 
 		delta = Common::Point(
-			ABS(_position.x / FIXED_INT_MULTIPLIER - people._walkDest.x),
-			ABS(_position.y / FIXED_INT_MULTIPLIER - people._walkDest.y)
+			ABS(_position.x / FIXED_INT_MULTIPLIER - _walkDest.x),
+			ABS(_position.y / FIXED_INT_MULTIPLIER - _walkDest.y)
 		);
 
 		// If we're ready to move a sufficient distance, that's it. Otherwise,
@@ -231,7 +230,7 @@ void ScalpelPerson::setWalking() {
 			break;
 
 		// Pop next walk segment off the walk route stack
-		people._walkDest = _walkTo.pop();
+		_walkDest = _walkTo.pop();
 	}
 
 	// If a sufficient move is being done, then start the move
@@ -240,7 +239,7 @@ void ScalpelPerson::setWalking() {
 		if (delta.x >= delta.y) {
 			// Set the initial frame sequence for the left and right, as well
 			// as setting the delta x depending on direction
-			if (people._walkDest.x < (_position.x / FIXED_INT_MULTIPLIER)) {
+			if (_walkDest.x < (_position.x / FIXED_INT_MULTIPLIER)) {
 				_sequenceNumber = (map._active ? (int)MAP_LEFT : (int)WALK_LEFT);
 				_delta.x = speed.x * -FIXED_INT_MULTIPLIER;
 			} else {
@@ -253,7 +252,7 @@ void ScalpelPerson::setWalking() {
 			if (delta.x >= speed.x) {
 				// Det the delta y
 				_delta.y = (delta.y * FIXED_INT_MULTIPLIER) / (delta.x / speed.x);
-				if (people._walkDest.y < (_position.y / FIXED_INT_MULTIPLIER))
+				if (_walkDest.y < (_position.y / FIXED_INT_MULTIPLIER))
 					_delta.y = -_delta.y;
 
 				// Set how many times we should add the delta to the player's position
@@ -262,7 +261,7 @@ void ScalpelPerson::setWalking() {
 				// The delta x was less than the speed (ie. we're really close to
 				// the destination). So set delta to 0 so the player won't move
 				_delta = Point32(0, 0);
-				_position = Point32(people._walkDest.x * FIXED_INT_MULTIPLIER, people._walkDest.y * FIXED_INT_MULTIPLIER);
+				_position = Point32(_walkDest.x * FIXED_INT_MULTIPLIER, _walkDest.y * FIXED_INT_MULTIPLIER);
 
 				_walkCount = 1;
 			}
@@ -294,7 +293,7 @@ void ScalpelPerson::setWalking() {
 		} else {
 			// Major movement is vertical, so set the sequence for up and down,
 			// and set the delta Y depending on the direction
-			if (people._walkDest.y < (_position.y / FIXED_INT_MULTIPLIER)) {
+			if (_walkDest.y < (_position.y / FIXED_INT_MULTIPLIER)) {
 				_sequenceNumber = WALK_UP;
 				_delta.y = speed.y * -FIXED_INT_MULTIPLIER;
 			} else {
@@ -309,7 +308,7 @@ void ScalpelPerson::setWalking() {
 
 			// Set the delta x
 			_delta.x = (delta.x * FIXED_INT_MULTIPLIER) / (delta.y / speed.y);
-			if (people._walkDest.x < (_position.x / FIXED_INT_MULTIPLIER))
+			if (_walkDest.x < (_position.x / FIXED_INT_MULTIPLIER))
 				_delta.x = -_delta.x;
 
 			_walkCount = delta.y / speed.y;
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index 72f40a7..fb8ebe1 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -305,8 +305,8 @@ void ScalpelUserInterface::handleInput() {
 				// Mouse clicked in script zone
 				events._pressed = events._released = false;
 			} else {
-				people._walkDest = pt;
 				people._allowWalkAbort = false;
+				people[HOLMES]._walkDest = pt;
 				people[HOLMES].goAllTheWay();
 			}
 
diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp
index 47e5c89..32da61a 100644
--- a/engines/sherlock/scene.cpp
+++ b/engines/sherlock/scene.cpp
@@ -269,7 +269,7 @@ void Scene::selectScene() {
 		_tempFadeStyle = 0;
 	}
 
-	people._walkDest = Common::Point(people[HOLMES]._position.x / FIXED_INT_MULTIPLIER,
+	people[HOLMES]._walkDest = Common::Point(people[HOLMES]._position.x / FIXED_INT_MULTIPLIER,
 		people[HOLMES]._position.y / FIXED_INT_MULTIPLIER);
 
 	_restoreFlag = true;
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index 3d472bc..bb57ec9 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -83,11 +83,11 @@ void TattooPerson::adjustSprite() {
 		_walkCount = _status;
 		_status = 0;
 
-		people._walkDest = _walkTo.front();
+		_walkDest = _walkTo.front();
 		setWalking();
 	} else if (_type == CHARACTER && _walkCount) {
 		if (_walkCount > 10) {
-			people._walkDest = _walkTo.front();
+			_walkDest = _walkTo.front();
 			setWalking();
 		}
 
@@ -98,7 +98,7 @@ void TattooPerson::adjustSprite() {
 		if (!_walkCount) {
 			// If there are remaining points to walk, move to the next one
 			if (!_walkTo.empty()) {
-				people._walkDest = _walkTo.pop();
+				_walkDest = _walkTo.pop();
 				setWalking();
 			} else {
 				gotoStand();
@@ -271,7 +271,6 @@ void TattooPerson::gotoStand() {
 }
 
 void TattooPerson::setWalking() {
-	People &people = *_vm->_people;
 	TattooScene &scene = *(TattooScene *)_vm->_scene;
 	int oldDirection, oldFrame;
 	Common::Point delta;
@@ -297,8 +296,8 @@ void TattooPerson::setWalking() {
 		if (_centerWalk || !_walkTo.empty()) {
 			// Since we want the player to be centered on the ultimate destination, and the player
 			// is drawn from the left side, move the cursor half the width of the player to center it
-			delta = Common::Point(_position.x / FIXED_INT_MULTIPLIER - people._walkDest.x,
-				_position.y / FIXED_INT_MULTIPLIER - people._walkDest.y);
+			delta = Common::Point(_position.x / FIXED_INT_MULTIPLIER - _walkDest.x,
+				_position.y / FIXED_INT_MULTIPLIER - _walkDest.y);
 
 			int dir;
 			if (ABS(delta.x) > ABS(delta.y))
@@ -306,14 +305,14 @@ void TattooPerson::setWalking() {
 			else
 				dir = (delta.y < 0) ? WALK_UP : WALK_DOWN;
 
-			int scaleVal = scene.getScaleVal(Point32(people._walkDest.x * FIXED_INT_MULTIPLIER,
-				people._walkDest.y * FIXED_INT_MULTIPLIER));
-			people._walkDest.x -= _stopFrames[dir]->sDrawXSize(scaleVal) / 2;
+			int scaleVal = scene.getScaleVal(Point32(_walkDest.x * FIXED_INT_MULTIPLIER,
+				_walkDest.y * FIXED_INT_MULTIPLIER));
+			_walkDest.x -= _stopFrames[dir]->sDrawXSize(scaleVal) / 2;
 		}
 
 		delta = Common::Point(
-			ABS(_position.x / FIXED_INT_MULTIPLIER - people._walkDest.x),
-			ABS(_position.y / FIXED_INT_MULTIPLIER - people._walkDest.y)
+			ABS(_position.x / FIXED_INT_MULTIPLIER - _walkDest.x),
+			ABS(_position.y / FIXED_INT_MULTIPLIER - _walkDest.y)
 			);
 
 		// If we're ready to move a sufficient distance, that's it. Otherwise,
@@ -322,7 +321,7 @@ void TattooPerson::setWalking() {
 			break;
 
 		// Pop next walk segment off the walk route stack
-		people._walkDest = _walkTo.pop();
+		_walkDest = _walkTo.pop();
 	}
 
 	// If a sufficient move is being done, then start the move
@@ -331,7 +330,7 @@ void TattooPerson::setWalking() {
 		if (delta.x >= delta.y) {
 			// Set the initial frame sequence for the left and right, as well
 			// as setting the delta x depending on direction
-			if (people._walkDest.x < (_position.x / FIXED_INT_MULTIPLIER)) {
+			if (_walkDest.x < (_position.x / FIXED_INT_MULTIPLIER)) {
 				_sequenceNumber = WALK_LEFT;
 				_delta.x = speed.x * -(FIXED_INT_MULTIPLIER / 10);
 			} else {
@@ -344,7 +343,7 @@ void TattooPerson::setWalking() {
 			if ((delta.x * 10) >= speed.x) {
 				// Det the delta y
 				_delta.y = (delta.y * FIXED_INT_MULTIPLIER) / ((delta.x * 10) / speed.x);
-				if (people._walkDest.y < (_position.y / FIXED_INT_MULTIPLIER))
+				if (_walkDest.y < (_position.y / FIXED_INT_MULTIPLIER))
 					_delta.y = -_delta.y;
 
 				// Set how many times we should add the delta to the player's position
@@ -353,7 +352,7 @@ void TattooPerson::setWalking() {
 				// The delta x was less than the speed (ie. we're really close to
 				// the destination). So set delta to 0 so the player won't move
 				_delta = Point32(0, 0);
-				_position = Point32(people._walkDest.x * FIXED_INT_MULTIPLIER, people._walkDest.y * FIXED_INT_MULTIPLIER);
+				_position = Point32(_walkDest.x * FIXED_INT_MULTIPLIER, _walkDest.y * FIXED_INT_MULTIPLIER);
 
 				_walkCount = 1;
 			}
@@ -392,7 +391,7 @@ void TattooPerson::setWalking() {
 		} else {
 			// Major movement is vertical, so set the sequence for up and down,
 			// and set the delta Y depending on the direction
-			if (people._walkDest.y < (_position.y / FIXED_INT_MULTIPLIER)) {
+			if (_walkDest.y < (_position.y / FIXED_INT_MULTIPLIER)) {
 				_sequenceNumber = WALK_UP;
 				_delta.y = speed.y * -FIXED_INT_MULTIPLIER;
 			} else {
@@ -402,7 +401,7 @@ void TattooPerson::setWalking() {
 
 			// Set the delta x
 			_delta.x = (delta.x * FIXED_INT_MULTIPLIER) / (delta.y / speed.y);
-			if (people._walkDest.x < (_position.x / FIXED_INT_MULTIPLIER))
+			if (_walkDest.x < (_position.x / FIXED_INT_MULTIPLIER))
 				_delta.x = -_delta.x;
 
 			_walkCount = delta.y / speed.y;
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 915acde..6398be6 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -398,7 +398,7 @@ void TattooUserInterface::doStandardControl() {
 				events._pressed = events._released = false;
 			} else {
 				// Walk to where the mouse was clicked
-				people._walkDest = Common::Point(mousePos.x + _currentScroll.x, mousePos.y);
+				people[HOLMES]._walkDest = Common::Point(mousePos.x + _currentScroll.x, mousePos.y);
 				people[HOLMES].goAllTheWay();
 			}
 		}






More information about the Scummvm-git-logs mailing list