From 55dd109653c56c2847a06f9acb2fc3bf3834f730 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 Oct 2009 14:43:44 +0000 Subject: Changed kAvoidPath() to always avoid screen edges, after talking with waltervn. Also, formatted the comments of the dijkstra() function svn-id: r45272 --- engines/sci/engine/kpathing.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index a72064dbf0..b2d396c08a 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -1496,12 +1496,15 @@ static int intersecting_polygons(PathfindingState *s) { return 0; } +/** + * Computes a shortest path from vertex_start to vertex_end. The caller can + * construct the resulting path by following the path_prev links from + * vertex_end back to vertex_start. If no path exists vertex_end->path_prev + * will be NULL + * Parameters: (PathfindingState *) s: The pathfinding state + * (bool) avoidScreenEdge: Avoid screen edges (default behavior) + */ static void dijkstra(PathfindingState *s, bool avoidScreenEdge) { - // Computes a shortest path from vertex_start to vertex_end. The caller can - // construct the resulting path by following the path_prev links from - // vertex_end back to vertex_start. If no path exists vertex_end->path_prev - // will be NULL - // Parameters: (PathfindingState *) s: The pathfinding state Polygon *polygon; // Vertices of which the shortest path is known @@ -1712,16 +1715,8 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) { return output; } - // Early pathfinding-enabled games exclude edges on screen borders. - // FIXME: Enable this selectively for those games that need it. - bool avoidScreenEdge = false; - - // This is certainly needed for LSL5 room 640, otherwise Patti walks off-screen - // and reenters through the wall - if (s->_gameName == "lsl5" && s->currentRoomNumber() == 640) - avoidScreenEdge = true; - - dijkstra(p, avoidScreenEdge); + // Apply Dijkstra, avoiding screen edges + dijkstra(p, true); output = output_path(p, s); delete p; -- cgit v1.2.3