[Scummvm-cvs-logs] scummvm master -> 59bc9f846d639c2794ec41065092e49e8458c5f9

dreammaster dreammaster at scummvm.org
Fri Aug 7 03:41:34 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:
59bc9f846d SHERLOCK: RT: Properly implement cmdWalkHolmesAndNPCToCoords


Commit: 59bc9f846d639c2794ec41065092e49e8458c5f9
    https://github.com/scummvm/scummvm/commit/59bc9f846d639c2794ec41065092e49e8458c5f9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-06T21:40:35-04:00

Commit Message:
SHERLOCK: RT: Properly implement cmdWalkHolmesAndNPCToCoords

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



diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index b0dfa73..3738bbf 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -1111,6 +1111,75 @@ void TattooPerson::walkHolmesToNPC() {
 	}
 }
 
+void TattooPerson::walkBothToCoords(const PositionFacing &holmesDest, const PositionFacing &npcDest) {
+	Events &events = *_vm->_events;
+	TattooPeople &people = *(TattooPeople *)_vm->_people;
+	Scene &scene = *_vm->_scene;
+	Talk &talk = *_vm->_talk;
+	TattooPerson &holmes = people[HOLMES];
+	bool holmesStopped = false, npcStopped = false;
+
+	// Save the current cursor and change to the wait cursor
+	CursorId oldCursor = events.getCursor();
+	events.setCursor(WAIT);
+
+	holmes._centerWalk = false;
+	_centerWalk = false;
+
+	// Start Holmes walking to his dest
+	holmes._walkDest = Common::Point(holmesDest.x / FIXED_INT_MULTIPLIER + 10, holmesDest.y / FIXED_INT_MULTIPLIER);
+	people._allowWalkAbort = true;
+	holmes.goAllTheWay();
+
+	// Start the NPC walking to their dest
+	_walkDest = Common::Point(npcDest.x / FIXED_INT_MULTIPLIER + 10, npcDest.y / FIXED_INT_MULTIPLIER);
+	goAllTheWay();
+
+	// Clear the path variables
+	_npcIndex = _npcPause = 0;
+	Common::fill(&_npcPath[0], &_npcPath[100], 0);
+	_npcFacing = npcDest._facing;
+
+	// Now loop until both stop walking
+	do {
+		events.pollEvents();
+		scene.doBgAnim();
+
+		if (!holmes._walkCount && !holmesStopped) {
+			// Holmes finished walking
+			holmesStopped = true;
+
+			// Ensure Holmes is on the exact destination spot
+			holmes._position = holmesDest;
+			holmes._sequenceNumber = holmesDest._facing;
+			holmes.gotoStand();
+		}
+
+		if (!_walkCount && !npcStopped) {
+			// NPC finished walking
+			npcStopped = true;
+
+			// Ensure NPC is on the exact destination spot
+			_position = npcDest;
+			_sequenceNumber = npcDest._facing;
+			gotoStand();
+		}
+
+	} while (!_vm->shouldQuit() && (holmes._walkCount || _walkCount));
+
+	holmes._centerWalk = true;
+	_centerWalk = true;
+
+	// Do one last frame draw so that the lsat person to stop will be drawn in their final position
+	scene.doBgAnim();
+
+	_updateNPCPath = true;
+
+	if (!talk._talkToAbort)
+		// Restore original mouse cursor
+		events.setCursor(oldCursor);
+}
+
 void TattooPerson::centerScreenOnPerson() {
 	Screen &screen = *_vm->_screen;
 	TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h
index 06c6776..4e57cfe 100644
--- a/engines/sherlock/tattoo/tattoo_people.h
+++ b/engines/sherlock/tattoo/tattoo_people.h
@@ -183,6 +183,11 @@ public:
 	void walkHolmesToNPC();
 
 	/**
+	 * Walk both the specified character and Holmes to specified destination positions
+	 */
+	void walkBothToCoords(const PositionFacing &holmesDest, const PositionFacing &npcDest);
+
+	/**
 	 * This adjusts the sprites position, as well as it's animation sequence:
 	 */
 	virtual void adjustSprite();
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index 260aee8..0d38500 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -862,13 +862,21 @@ OpcodeReturn TattooTalk::cmdWalkHomesAndNPCToCoords(const byte *&str) {
 		person.pushNPCPath();
 	person._npcMoved = true;
 
+	// Get destination position and facing for Holmes
 	int xp = (str[0] - 1) * 256 + str[1] - 1;
 	if (xp > 16384)
 		xp = -1 * (xp - 16384);
 	int yp = (str[2] - 1) * 256 + str[3] - 1;
+	PositionFacing holmesDest(xp * FIXED_INT_MULTIPLIER, yp * FIXED_INT_MULTIPLIER, DIRECTION_CONVERSION[str[4] - 1]);
 
-	person.walkToCoords(Point32(xp * FIXED_INT_MULTIPLIER, yp * FIXED_INT_MULTIPLIER),
-		DIRECTION_CONVERSION[str[4] - 1]);
+	// Get destination position and facing for specified NPC
+	xp = (str[5] - 1) * 256 + str[6] - 1;
+	if (xp > 16384)
+		xp = -1 * (xp - 16384);
+	yp = (str[7] - 1) * 256 + str[8] - 1;
+	PositionFacing npcDest(xp * FIXED_INT_MULTIPLIER, yp * FIXED_INT_MULTIPLIER, DIRECTION_CONVERSION[str[9] - 1]);
+
+	person.walkBothToCoords(holmesDest, npcDest);
 
 	if (_talkToAbort)
 		return RET_EXIT;






More information about the Scummvm-git-logs mailing list