aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kpathing.cpp
diff options
context:
space:
mode:
authorMax Horn2009-10-13 18:53:11 +0000
committerMax Horn2009-10-13 18:53:11 +0000
commitc77be11ccd81afb92e5f2e2620295fa65dc3124d (patch)
tree492d7972d55f47ef1a04141dc8ec31fb030dca5b /engines/sci/engine/kpathing.cpp
parent8126f81b6f11982ae696d861a26387a7169923d0 (diff)
downloadscummvm-rg350-c77be11ccd81afb92e5f2e2620295fa65dc3124d.tar.gz
scummvm-rg350-c77be11ccd81afb92e5f2e2620295fa65dc3124d.tar.bz2
scummvm-rg350-c77be11ccd81afb92e5f2e2620295fa65dc3124d.zip
SCI: cleanup
svn-id: r45040
Diffstat (limited to 'engines/sci/engine/kpathing.cpp')
-rw-r--r--engines/sci/engine/kpathing.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 1df6b086ff..faba652f8a 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -33,6 +33,9 @@
namespace Sci {
+// FIXME: Is AVOIDPATH_DYNMEM_STRING still needed?
+#define AVOIDPATH_DYNMEM_STRING "AvoidPath polyline"
+
#define POLY_LAST_POINT 0x7777
#define POLY_POINT_SIZE 4
//#define DEBUG_AVOIDPATH //enable for avoidpath debugging
@@ -255,8 +258,6 @@ struct PathfindingState {
};
-static Vertex *s_vertex_cur; // FIXME: Avoid non-const global vars
-
static Common::Point read_point(SegManager *segMan, reg_t list, int offset) {
SegmentRef list_r = segMan->dereference(list);
if (!list_r.isValid()) {
@@ -603,6 +604,8 @@ static void fix_vertex_order(Polygon *polygon) {
}
}
+static Vertex *s_vertex_cur = 0; // FIXME: Avoid non-const global vars
+
static int vertex_compare(const void *a, const void *b) {
// Compares two vertices by angle (first) and distance (second) in relation
// to s_vertex_cur. The angle is relative to the horizontal line extending
@@ -815,6 +818,7 @@ static VertexList *visible_vertices(PathfindingState *s, Vertex *vertex_cur) {
Vertex *v1;
// Compute visibility of vertex_index[i]
+ assert(vertex_cur == s_vertex_cur); // FIXME: We should be able to replace s_vertex_cur by vertex_cur
is_visible = visible(s_vertex_cur, s->vertex_index[i], s->vertex_index[i - 1], is_visible, intersected);
// Update visibility matrix
@@ -845,6 +849,8 @@ static VertexList *visible_vertices(PathfindingState *s, Vertex *vertex_cur) {
}
}
+ s_vertex_cur = 0;
+
return visVerts;
}