diff options
| -rw-r--r-- | engines/sherlock/people.cpp | 67 | ||||
| -rw-r--r-- | engines/sherlock/people.h | 10 | ||||
| -rw-r--r-- | engines/sherlock/scalpel/scalpel_scene.cpp | 2 | ||||
| -rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 2 | ||||
| -rw-r--r-- | engines/sherlock/scalpel/scalpel_user_interface.cpp | 6 | ||||
| -rw-r--r-- | engines/sherlock/talk.cpp | 6 | ||||
| -rw-r--r-- | engines/sherlock/tattoo/tattoo_talk.cpp | 2 | 
7 files changed, 47 insertions, 48 deletions
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp index 2945d37a25..00d77d9f43 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 09022b10c8..3d035b6b7b 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 a1943e59a0..f053747a56 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 17b251fe47..5d2ece611b 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 dfe4d252cc..cb2bf65342 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 65d9d21919..0e9feedd87 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 f01cdb0979..28c0132dd9 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;  | 
