aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock
diff options
context:
space:
mode:
authorPaul Gilbert2015-04-22 17:23:14 -0500
committerPaul Gilbert2015-04-22 17:23:14 -0500
commit214cd61afd6ab60f749263a54127dfbd629147dd (patch)
tree831559387d33a4e90118847e717793eb856dcd6b /engines/sherlock
parent4f04f90a97965e278f5cbda6fbbd36fa493655cb (diff)
downloadscummvm-rg350-214cd61afd6ab60f749263a54127dfbd629147dd.tar.gz
scummvm-rg350-214cd61afd6ab60f749263a54127dfbd629147dd.tar.bz2
scummvm-rg350-214cd61afd6ab60f749263a54127dfbd629147dd.zip
SHERLOCK: Fixes for multi-point walking routes
Diffstat (limited to 'engines/sherlock')
-rw-r--r--engines/sherlock/map.cpp6
-rw-r--r--engines/sherlock/objects.cpp2
-rw-r--r--engines/sherlock/people.cpp18
-rw-r--r--engines/sherlock/people.h4
4 files changed, 16 insertions, 14 deletions
diff --git a/engines/sherlock/map.cpp b/engines/sherlock/map.cpp
index 6fd169f43a..6fff48a1d3 100644
--- a/engines/sherlock/map.cpp
+++ b/engines/sherlock/map.cpp
@@ -399,8 +399,10 @@ void Map::walkTheStreets() {
people._walkTo.clear();
if (!reversePath) {
- people._walkTo = tempPath;
- people._walkDest = tempPath[0];
+ for (int idx = 0; idx < (int)tempPath.size(); ++idx)
+ people._walkTo.push(tempPath[idx]);
+
+ people._walkDest = tempPath.front();
} else {
for (int idx = 0; idx < ((int)tempPath.size() - 1); ++idx)
people._walkTo.push(tempPath[idx]);
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 82daa90a38..ec8bb4f551 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -291,7 +291,7 @@ void Sprite::checkSprite() {
break;
case WALK_AROUND:
- if (objBounds.contains(people._walkTo.top())) {
+ if (objBounds.contains(people._walkTo.front())) {
// Reached zone
people.gotoStand(*this);
} else {
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index 86c560a1d9..0212be69b2 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -554,7 +554,7 @@ void People::goAllTheWay() {
++i;
// See how many points there are between the src and dest zones
- if (!count || count == 255) {
+ if (!count || count == -1) {
// There are none, so just walk to the new zone
setWalking();
} else {
@@ -563,22 +563,22 @@ void People::goAllTheWay() {
_walkTo.clear();
if (scene._walkDirectory[_srcZone][_destZone] != -1) {
- for (int idx = 0; idx < count; ++idx, i += 3) {
+ i += 3 * (count - 1);
+ for (int idx = 0; idx < count; ++idx, i -= 3) {
_walkTo.push(Common::Point(READ_LE_UINT16(&scene._walkData[i]),
scene._walkData[i + 2]));
}
} else {
- for (int idx = 0; idx < count; ++idx)
- _walkTo.push(Common::Point());
-
- for (int idx = count - 1; idx >= 0; --idx, i += 3) {
- _walkTo[idx].x = READ_LE_UINT16(&scene._walkData[i]);
- _walkTo[idx].y = scene._walkData[i + 2];
+ for (int idx = 0; idx < count; ++idx, i += 3) {
+ _walkTo.push(Common::Point(READ_LE_UINT16(&scene._walkData[i]), scene._walkData[i + 2]));
}
}
+ // Final position
+ _walkTo.push(_walkDest);
+
// Start walking
- _walkDest = _walkTo.top();
+ _walkDest = _walkTo.pop();
setWalking();
}
}
diff --git a/engines/sherlock/people.h b/engines/sherlock/people.h
index 94f1d05c0d..8a7476a33a 100644
--- a/engines/sherlock/people.h
+++ b/engines/sherlock/people.h
@@ -25,7 +25,7 @@
#include "common/scummsys.h"
#include "common/serializer.h"
-#include "common/stack.h"
+#include "common/queue.h"
#include "sherlock/objects.h"
namespace Sherlock {
@@ -74,7 +74,7 @@ private:
public:
ImageFile *_talkPics;
Common::Point _walkDest;
- Common::Stack<Common::Point> _walkTo;
+ Common::Queue<Common::Point> _walkTo;
Person &_player;
bool _holmesOn;
bool _portraitLoaded;