aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-04-24 00:53:19 -0500
committerPaul Gilbert2015-04-24 00:53:19 -0500
commitecaa4c26c953524bdf34fa55cfdf6c55af129bc4 (patch)
tree685855c1bf3bbfead3ffe5a8cb1dc1b0bbb06cdb /engines
parente24ae07a90ccd0139112d5c086d49173834fa4a1 (diff)
downloadscummvm-rg350-ecaa4c26c953524bdf34fa55cfdf6c55af129bc4.tar.gz
scummvm-rg350-ecaa4c26c953524bdf34fa55cfdf6c55af129bc4.tar.bz2
scummvm-rg350-ecaa4c26c953524bdf34fa55cfdf6c55af129bc4.zip
SHERLOCK: Fix pathfinding for movement on map screen
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/map.cpp20
-rw-r--r--engines/sherlock/people.cpp4
2 files changed, 12 insertions, 12 deletions
diff --git a/engines/sherlock/map.cpp b/engines/sherlock/map.cpp
index 0864997dff..6e9982eb62 100644
--- a/engines/sherlock/map.cpp
+++ b/engines/sherlock/map.cpp
@@ -263,9 +263,8 @@ int Map::show() {
freeSprites();
_overPos = people[AL]._position;
- // Reset font and cursor
+ // Reset font
screen.setFont(oldFont);
- events.setCursor(ARROW);
_active = false;
return scene._charPoint;
@@ -451,7 +450,7 @@ void Map::walkTheStreets() {
// Add in destination position
people._walkTo.clear();
- people._walkTo.push(people._walkDest);
+ Common::Point destPos = people._walkDest;
// Check for any intermediate points between the two locations
if (path[0] || scene._charPoint > 50 || scene._oldCharPoint > 50) {
@@ -475,24 +474,23 @@ void Map::walkTheStreets() {
// Load up the path to use
people._walkTo.clear();
- if (!reversePath) {
- for (int idx = 0; idx < (int)tempPath.size(); ++idx)
+ if (reversePath) {
+ for (int idx = (int)tempPath.size() - 1; idx >= 0; --idx)
people._walkTo.push(tempPath[idx]);
-
- people._walkDest = tempPath.front();
} else {
- for (int idx = 0; idx < ((int)tempPath.size() - 1); ++idx)
+ for (int idx = 0; idx < (int)tempPath.size(); ++idx)
people._walkTo.push(tempPath[idx]);
- people._walkDest = tempPath[tempPath.size() - 1];
}
- people._walkDest.x += 12;
- people._walkDest.y += 6;
+ people._walkDest = people._walkTo.pop() + Common::Point(12, 6);
people.setWalking();
}
} else {
people[AL]._walkCount = 0;
}
+
+ // Store the final destination icon position
+ people._walkTo.push(destPos);
}
/**
diff --git a/engines/sherlock/people.cpp b/engines/sherlock/people.cpp
index d247109a28..e126757231 100644
--- a/engines/sherlock/people.cpp
+++ b/engines/sherlock/people.cpp
@@ -389,7 +389,9 @@ void People::setWalking() {
// Set the delta x
_player._delta.x = (delta.x * 100) / (delta.y / speed.y);
if (_walkDest.x < (_player._position.x / 100))
- _player._delta.x = -_player._delta.x;
+ _player._delta.x = -_player._delta.x;;
+
+ _player._walkCount = delta.y / speed.y;
}
}