From ecaab84cb5cb90e599b147359986abaf3202fa10 Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Sat, 13 Nov 2010 14:46:27 +0000 Subject: 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 --- engines/sci/engine/kpathing.cpp | 7 ++++--- 1 file 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); } } -- cgit v1.2.3