aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-10-13 18:53:11 +0000
committerMax Horn2009-10-13 18:53:11 +0000
commitc77be11ccd81afb92e5f2e2620295fa65dc3124d (patch)
tree492d7972d55f47ef1a04141dc8ec31fb030dca5b
parent8126f81b6f11982ae696d861a26387a7169923d0 (diff)
downloadscummvm-rg350-c77be11ccd81afb92e5f2e2620295fa65dc3124d.tar.gz
scummvm-rg350-c77be11ccd81afb92e5f2e2620295fa65dc3124d.tar.bz2
scummvm-rg350-c77be11ccd81afb92e5f2e2620295fa65dc3124d.zip
SCI: cleanup
svn-id: r45040
-rw-r--r--engines/sci/engine/kernel.h3
-rw-r--r--engines/sci/engine/kpathing.cpp10
2 files changed, 9 insertions, 4 deletions
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 12003c650a..750a2b9a34 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -40,7 +40,6 @@ namespace Sci {
struct Node; // from segment.h
struct List; // from segment.h
-#define AVOIDPATH_DYNMEM_STRING "AvoidPath polyline"
//#define DEBUG_PARSER // enable for parser debugging
/* Generic description: */
@@ -162,7 +161,7 @@ enum SelectorInvocation {
*/
#define PUT_SEL32(_o_, _slc_, _val_) write_selector(segMan, _o_, ((SciEngine*)g_engine)->getKernel()->_selectorCache._slc_, _val_, __FILE__, __LINE__)
-#define PUT_SEL32V(_o_, _slc_, _val_) write_selector(segMan, _o_, ((SciEngine*)g_engine)->getKernel()->_selectorCache._slc_, make_reg(0, _val_), __FILE__, __LINE__)
+#define PUT_SEL32V(_o_, _slc_, _val_) PUT_SEL32(_o_, _slc_, make_reg(0, _val_))
/* Writes a selector value to an object
** Parameters: (reg_t) object: The address of the object which the selector should be written to
** (selector_name) selector: The selector to read
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;
}