[Scummvm-cvs-logs] scummvm master -> 6221c1de82bae650158b54a4b04f8f319416ac63

dreammaster dreammaster at scummvm.org
Sat Jun 13 05:14:22 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:
6221c1de82 SHERLOCK: Move walkToCoords from People to Person


Commit: 6221c1de82bae650158b54a4b04f8f319416ac63
    https://github.com/scummvm/scummvm/commit/6221c1de82bae650158b54a4b04f8f319416ac63
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-12T23:13:21-04:00

Commit Message:
SHERLOCK: Move walkToCoords from People to Person

Changed paths:
    engines/sherlock/people.cpp
    engines/sherlock/people.h
    engines/sherlock/scalpel/scalpel_scene.cpp
    engines/sherlock/scalpel/scalpel_talk.cpp
    engines/sherlock/scalpel/scalpel_user_interface.cpp
    engines/sherlock/talk.cpp
    engines/sherlock/tattoo/tattoo_talk.cpp



diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 2945d37..00d77d9 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -158,6 +158,39 @@ void Person::goAllTheWay() {
 	}
 }
 
+void Person::walkToCoords(const Point32 &destPos, int destDir) {
+	Events &events = *_vm->_events;
+	People &people = *_vm->_people;
+	Scene &scene = *_vm->_scene;
+	Talk &talk = *_vm->_talk;
+
+	CursorId oldCursor = events.getCursor();
+	events.setCursor(WAIT);
+
+	people._walkDest = Common::Point(destPos.x / FIXED_INT_MULTIPLIER + 10, destPos.y / FIXED_INT_MULTIPLIER);
+	people._allowWalkAbort = true;
+	goAllTheWay();
+
+	// Keep calling doBgAnim until the walk is done
+	do {
+		events.pollEventsAndWait();
+		scene.doBgAnim();
+	} while (!_vm->shouldQuit() && _walkCount);
+
+	if (!talk._talkToAbort) {
+		// Put character exactly on destination position, and set direction
+		_position = destPos;
+		_sequenceNumber = destDir;
+		gotoStand();
+
+		// Draw Holmes facing the new direction
+		scene.doBgAnim();
+
+		if (!talk._talkToAbort)
+			events.setCursor(oldCursor);
+	}
+}
+
 /*----------------------------------------------------------------*/
 
 People *People::init(SherlockEngine *vm) {
@@ -270,40 +303,6 @@ bool People::freeWalk() {
 	return result;
 }
 
-void People::walkToCoords(const Point32 &destPos, int destDir) {
-	Events &events = *_vm->_events;
-	Scene &scene = *_vm->_scene;
-	Talk &talk = *_vm->_talk;
-
-	CursorId oldCursor = events.getCursor();
-	events.setCursor(WAIT);
-
-	_walkDest = Common::Point(destPos.x / FIXED_INT_MULTIPLIER + 10, destPos.y / FIXED_INT_MULTIPLIER);
-	_allowWalkAbort = true;
-	_data[PLAYER]->goAllTheWay();
-
-	// Keep calling doBgAnim until the walk is done
-	do {
-		events.pollEventsAndWait();
-		scene.doBgAnim();
-	} while (!_vm->shouldQuit() && _data[PLAYER]->_walkCount);
-
-	if (!talk._talkToAbort) {
-		// Put player exactly on destination position, and set direction
-		_data[PLAYER]->_position = destPos;
-assert(_data[PLAYER]->_position.y >= 10000);/***DEBUG****/
-
-		_data[PLAYER]->_sequenceNumber = destDir;
-		_data[PLAYER]->gotoStand();
-
-		// Draw Holmes facing the new direction
-		scene.doBgAnim();
-
-		if (!talk._talkToAbort)
-			events.setCursor(oldCursor);
-	}
-}
-
 int People::findSpeaker(int speaker) {
 	Scene &scene = *_vm->_scene;
 	const char *portrait = _characters[speaker]._portrait;
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 09022b1..3d035b6 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -74,6 +74,11 @@ public:
 	 * of steps to walk to get to that position.
 	 */
 	void goAllTheWay();
+
+	/**
+	 * Walk to the co-ordinates passed, and then face the given direction
+	 */
+	void walkToCoords(const Point32 &destPos, int destDir);
 };
 
 class SherlockEngine;
@@ -122,11 +127,6 @@ public:
 	bool freeWalk();
 
 	/**
-	 * Walk to the co-ordinates passed, and then face the given direction
-	 */
-	void walkToCoords(const Point32 &destPos, int destDir);
-
-	/**
 	 * Turn off any currently active portraits, and removes them from being drawn
 	 */
 	void clearTalking();
diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp
index a1943e5..f053747 100644
--- a/engines/sherlock/scalpel/scalpel_scene.cpp
+++ b/engines/sherlock/scalpel/scalpel_scene.cpp
@@ -526,7 +526,7 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) {
 	if (walkPos.x != -1) {
 		// Holmes must walk to the walk point before the cAnimation is started
 		if (people[PLAYER]._position != walkPos)
-			people.walkToCoords(walkPos, walkDir);
+			people[PLAYER].walkToCoords(walkPos, walkDir);
 	}
 
 	if (talk._talkToAbort)
diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp
index 17b251f..5d2ece6 100644
--- a/engines/sherlock/scalpel/scalpel_talk.cpp
+++ b/engines/sherlock/scalpel/scalpel_talk.cpp
@@ -456,7 +456,7 @@ OpcodeReturn ScalpelTalk::cmdWalkToCoords(const byte *&str) {
 	People &people = *_vm->_people;
 	++str;
 
-	people.walkToCoords(Point32(((str[0] - 1) * 256 + str[1] - 1) * FIXED_INT_MULTIPLIER,
+	people[PLAYER].walkToCoords(Point32(((str[0] - 1) * 256 + str[1] - 1) * FIXED_INT_MULTIPLIER,
 		str[2] * FIXED_INT_MULTIPLIER), str[3] - 1);
 	if (_talkToAbort)
 		return RET_EXIT;
diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp
index dfe4d25..cb2bf65 100644
--- a/engines/sherlock/scalpel/scalpel_user_interface.cpp
+++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp
@@ -511,7 +511,7 @@ void ScalpelUserInterface::examine() {
 			scene.startCAnim(_cNum, canimSpeed);
 		} else if (obj._lookPosition.y != 0) {
 			// Need to walk to the object to be examined
-			people.walkToCoords(obj._lookPosition, obj._lookFacing);
+			people[PLAYER].walkToCoords(obj._lookPosition, obj._lookFacing);
 		}
 
 		if (!talk._talkToAbort) {
@@ -2236,7 +2236,7 @@ void ScalpelUserInterface::checkAction(ActionType &action, const char *const mes
 					printed = true;
 					if (pt.x != -1)
 						// Holmes needs to walk to object before the action is done
-						people.walkToCoords(pt, dir);
+						people[PLAYER].walkToCoords(pt, dir);
 
 					if (!talk._talkToAbort) {
 						// Ensure Holmes is on the exact intended location
@@ -2255,7 +2255,7 @@ void ScalpelUserInterface::checkAction(ActionType &action, const char *const mes
 		if (doCAnim && !talk._talkToAbort) {
 			if (pt.x != -1)
 				// Holmes needs to walk to object before the action is done
-				people.walkToCoords(pt, dir);
+				people[PLAYER].walkToCoords(pt, dir);
 		}
 
 		for (int nameIdx = 0; nameIdx < NAMES_COUNT; ++nameIdx) {
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index 65d9d21..0e9feed 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -501,7 +501,7 @@ void Talk::talk(int objNum) {
 		events.setCursor(WAIT);
 		if (obj._lookPosition.y != 0)
 			// Need to walk to character first
-			people.walkToCoords(obj._lookPosition, obj._lookFacing);
+			people[PLAYER].walkToCoords(obj._lookPosition, obj._lookFacing);
 		events.setCursor(ARROW);
 
 		if (!_talkToAbort)
@@ -516,7 +516,7 @@ void Talk::talk(int objNum) {
 		events.setCursor(WAIT);
 		if (obj._lookPosition.y != 0)
 			// Walk over to person to talk to
-			people.walkToCoords(obj._lookPosition, obj._lookFacing);
+			people[PLAYER].walkToCoords(obj._lookPosition, obj._lookFacing);
 		events.setCursor(ARROW);
 
 		if (!_talkToAbort) {
@@ -1452,7 +1452,7 @@ OpcodeReturn Talk::cmdWalkToCAnimation(const byte *&str) {
 
 	++str;
 	CAnim &animation = scene._cAnim[str[0] - 1];
-	people.walkToCoords(animation._goto[0], animation._goto[0]._facing);
+	people[PLAYER].walkToCoords(animation._goto[0], animation._goto[0]._facing);
 	
 	return _talkToAbort ? RET_EXIT : RET_SUCCESS;
 }
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index f01cdb0..28c0132 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -243,7 +243,7 @@ OpcodeReturn TattooTalk::cmdWalkHolmesToCoords(const byte *&str) {
 		x = -1 * (x - 16384);
 	// TODO: The RT walkToCoords call has an extra parameter, person, which is 0 (Holmes) here
 	warning("TODO: cmdWalkHolmesToCoords - call RT walkToCoords variant");
-	people.walkToCoords(Point32(x * FIXED_INT_MULTIPLIER,
+	people[PLAYER].walkToCoords(Point32(x * FIXED_INT_MULTIPLIER,
 		((str[2] - 1) * 256 + str[3] - 1) * FIXED_INT_MULTIPLIER), DIRECTION_CONVERSION[str[4] - 1]);
 	if (_talkToAbort)
 		return RET_EXIT;






More information about the Scummvm-git-logs mailing list