[Scummvm-cvs-logs] scummvm master -> 8abce6b025b1b4d8f50605875967f234b4b58312

dreammaster dreammaster at scummvm.org
Thu Jun 18 02:46:41 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:
8abce6b025 SHERLOCK: RT: Implement walkToCoords


Commit: 8abce6b025b1b4d8f50605875967f234b4b58312
    https://github.com/scummvm/scummvm/commit/8abce6b025b1b4d8f50605875967f234b4b58312
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-17T20:45:37-04:00

Commit Message:
SHERLOCK: RT: Implement walkToCoords

Changed paths:
    engines/sherlock/people.cpp
    engines/sherlock/people.h
    engines/sherlock/scalpel/scalpel_people.cpp
    engines/sherlock/scalpel/scalpel_people.h
    engines/sherlock/tattoo/tattoo_people.cpp
    engines/sherlock/tattoo/tattoo_people.h



diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index b3ae135..cab4abf 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -152,39 +152,6 @@ 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);
-
-	_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) {
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 39eb106..257c9b3 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -85,7 +85,7 @@ public:
 	/**
 	 * Walk to the co-ordinates passed, and then face the given direction
 	 */
-	void walkToCoords(const Point32 &destPos, int destDir);
+	virtual void walkToCoords(const Point32 &destPos, int destDir) = 0;
 };
 
 class SherlockEngine;
diff --git a/engines/sherlock/scalpel/scalpel_people.cpp b/engines/sherlock/scalpel/scalpel_people.cpp
index af2bdc0..94042e7 100644
--- a/engines/sherlock/scalpel/scalpel_people.cpp
+++ b/engines/sherlock/scalpel/scalpel_people.cpp
@@ -333,6 +333,39 @@ void ScalpelPerson::setWalking() {
 		_frameNumber = oldFrame;
 }
 
+void ScalpelPerson::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);
+
+	_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);
+	}
+}
+
 Common::Point ScalpelPerson::getSourcePoint() const {
 	return Common::Point(_position.x / FIXED_INT_MULTIPLIER + frameWidth() / 2,
 		_position.y / FIXED_INT_MULTIPLIER);
diff --git a/engines/sherlock/scalpel/scalpel_people.h b/engines/sherlock/scalpel/scalpel_people.h
index dc12583..0f8aa9d 100644
--- a/engines/sherlock/scalpel/scalpel_people.h
+++ b/engines/sherlock/scalpel/scalpel_people.h
@@ -66,6 +66,12 @@ public:
 	 * in a straight line
 	 */
 	virtual void setWalking();
+
+	/**
+	 * Walk to the co-ordinates passed, and then face the given direction
+	 */
+	virtual void walkToCoords(const Point32 &destPos, int destDir);
+
 };
 
 class ScalpelPeople : public People {
diff --git a/engines/sherlock/tattoo/tattoo_people.cpp b/engines/sherlock/tattoo/tattoo_people.cpp
index b582b86..cde17fe 100644
--- a/engines/sherlock/tattoo/tattoo_people.cpp
+++ b/engines/sherlock/tattoo/tattoo_people.cpp
@@ -23,7 +23,7 @@
 #include "sherlock/tattoo/tattoo_people.h"
 #include "sherlock/tattoo/tattoo_scene.h"
 #include "sherlock/tattoo/tattoo_talk.h"
-#include "sherlock/sherlock.h"
+#include "sherlock/tattoo/tattoo.h"
 
 namespace Sherlock {
 
@@ -99,7 +99,7 @@ TattooPerson::TattooPerson() : Person() {
 	_resetNPCPath = true;
 	_savedNpcSequence = 0;
 	_savedNpcFrame = 0;
-	_updateNPCPath = false;
+	_updateNPCPath = true;
 	_npcPause = false;
 }
 
@@ -475,6 +475,101 @@ void TattooPerson::setWalking() {
 		_frameNumber = oldFrame;
 }
 
+void TattooPerson::walkToCoords(const Point32 &destPos, int destDir) {
+	TattooEngine &vm = *(TattooEngine *)_vm;
+	Events &events = *_vm->_events;
+	TattooPeople &people = *(TattooPeople *)_vm->_people;
+	TattooScene &scene = *(TattooScene *)_vm->_scene;
+	Talk &talk = *_vm->_talk;
+
+	CursorId oldCursor = events.getCursor();
+	events.setCursor(WAIT);
+
+	_walkDest = Common::Point(_position.x / FIXED_INT_MULTIPLIER, _position.y / FIXED_INT_MULTIPLIER);
+
+	bool isHolmes = this == &people[HOLMES];
+	if (isHolmes) {
+		people._allowWalkAbort = true;
+	} else {
+		// Clear the path Variables
+		_npcIndex = _npcPause;
+		Common::fill(_npcPath, _npcPath + 100, 0);
+		_npcFacing = destDir;
+	}
+
+	_centerWalk = false;
+
+	// Only move the person if they're going an appreciable distance
+	if (ABS(_walkDest.x - (_position.x / FIXED_INT_MULTIPLIER)) > 8 || 
+			ABS(_walkDest.y - (_position.y / FIXED_INT_MULTIPLIER)) > 4) {
+		goAllTheWay();
+
+		do {
+			// Keep doing animations whilst walk is in progress
+			events.wait(1);
+			scene.doBgAnim();
+
+			if (events.kbHit()) {
+				Common::KeyState keyState = events.getKey();
+
+				if (keyState.keycode == Common::KEYCODE_ESCAPE && vm._runningProlog) {
+					vm.setFlags(-76);
+					vm.setFlags(396);
+					scene._goToScene = 1;
+					talk._talkToAbort = true;
+				}
+			}
+		} while (!_vm->shouldQuit() && _walkCount && !talk._talkToAbort);
+	}
+
+	_centerWalk = true;
+	if (!isHolmes)
+		_updateNPCPath = true;
+
+	if (!talk._talkToAbort) {
+		// put character exactly on right spot
+		_position = destPos;
+
+		if (_sequenceNumber != destDir) {
+			// Facing character to correct ending direction
+			_sequenceNumber = destDir;
+			gotoStand();
+		}
+
+		if (!isHolmes)
+			_updateNPCPath = false;
+
+		// Secondary walking wait loop
+		do {
+			events.wait(1);
+			scene.doBgAnim();
+
+			// See if we're past the initial goto stand sequence
+			for (int idx = 0; idx < _frameNumber; ++idx) {
+				if (_walkSequences[_sequenceNumber][idx] == 0)
+					break;
+			}
+
+			if (events.kbHit()) {
+				Common::KeyState keyState = events.getKey();
+
+				if (keyState.keycode == Common::KEYCODE_ESCAPE && vm._runningProlog) {
+					vm.setFlags(-76);
+					vm.setFlags(396);
+					scene._goToScene = 1;
+					talk._talkToAbort = true;
+				}
+			}
+		} while (!_vm->shouldQuit());
+
+		if (!isHolmes)
+			_updateNPCPath = true;
+
+		if (!talk._talkToAbort)
+			events.setCursor(oldCursor);
+	}
+}
+
 void TattooPerson::clearNPC() {
 	Common::fill(&_npcPath[0], &_npcPath[MAX_NPC_PATH], 0);
 	_npcIndex = _npcStack = 0;
diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h
index eff9038..4c739f1 100644
--- a/engines/sherlock/tattoo/tattoo_people.h
+++ b/engines/sherlock/tattoo/tattoo_people.h
@@ -142,6 +142,11 @@ public:
 	virtual void setWalking();
 
 	/**
+	 * Walk to the co-ordinates passed, and then face the given direction
+	 */
+	virtual void walkToCoords(const Point32 &destPos, int destDir);
+
+	/**
 	 * Adjusts the frame and sequence variables of a sprite that corresponds to the current speaker
 	 * so that it points to the beginning of the sequence number's talk sequence in the object's
 	 * sequence buffer






More information about the Scummvm-git-logs mailing list