aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter van Niftrik2010-11-13 14:46:27 +0000
committerWalter van Niftrik2010-11-13 14:46:27 +0000
commitecaab84cb5cb90e599b147359986abaf3202fa10 (patch)
treebb96d5753ead9659e58881952f3a1e4c74b027a1
parentc64a4ce058983278949cb8b4c390355ca02e49db (diff)
downloadscummvm-rg350-ecaab84cb5cb90e599b147359986abaf3202fa10.tar.gz
scummvm-rg350-ecaab84cb5cb90e599b147359986abaf3202fa10.tar.bz2
scummvm-rg350-ecaab84cb5cb90e599b147359986abaf3202fa10.zip
SCI: Fixup pathfinding start point when on polygon edge.
We now also fixup the start point when it's on the edge of an obstacle. If the start point is also on the edge of the screen, the actor is now allowed to walk through that obstacle to find his way to clear territory. This is based on observation of SSCI behavior. svn-id: r54230
-rw-r--r--engines/sci/engine/kpathing.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 567f9fadfa..2b3b7f8f01 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -938,7 +938,7 @@ static Common::Point *fixup_start_point(PathfindingState *s, const Common::Point
// Fall through
case POLY_BARRED_ACCESS:
case POLY_NEAREST_ACCESS:
- if (cont == CONT_INSIDE) {
+ if (cont != CONT_OUTSIDE) {
if (s->_prependPoint != NULL) {
// We shouldn't get here twice.
// We need to break in this case, otherwise we'll end in an infinite
@@ -958,7 +958,8 @@ static Common::Point *fixup_start_point(PathfindingState *s, const Common::Point
// The original start position is in an invalid location, so we
// use the moved point and add the original one to the final path
// later on.
- s->_prependPoint = new Common::Point(start);
+ if (start != *new_start)
+ s->_prependPoint = new Common::Point(start);
}
}
@@ -1014,7 +1015,7 @@ static Common::Point *fixup_end_point(PathfindingState *s, const Common::Point &
// For near-point access polygons we need to add the original end point
// to the path after pathfinding.
- if (type == POLY_NEAREST_ACCESS)
+ if ((type == POLY_NEAREST_ACCESS) && (end != *new_end))
s->_appendPoint = new Common::Point(end);
}
}