diff options
author | Filippos Karapetis | 2009-10-20 14:43:44 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-10-20 14:43:44 +0000 |
commit | 55dd109653c56c2847a06f9acb2fc3bf3834f730 (patch) | |
tree | 2e66a67b51be7223d3a77713956e2d43d66f5e55 /engines/sci/engine/kpathing.cpp | |
parent | 8870b5dbbfbe7763a3dedc70fda9733ab467ad11 (diff) | |
download | scummvm-rg350-55dd109653c56c2847a06f9acb2fc3bf3834f730.tar.gz scummvm-rg350-55dd109653c56c2847a06f9acb2fc3bf3834f730.tar.bz2 scummvm-rg350-55dd109653c56c2847a06f9acb2fc3bf3834f730.zip |
Changed kAvoidPath() to always avoid screen edges, after talking with waltervn. Also, formatted the comments of the dijkstra() function
svn-id: r45272
Diffstat (limited to 'engines/sci/engine/kpathing.cpp')
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
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; |