aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kernel.cpp1
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/kernel32.cpp5
-rw-r--r--engines/sci/engine/kpathing.cpp6
4 files changed, 13 insertions, 0 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index ad335c2cb8..43451728f4 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -356,6 +356,7 @@ SciKernelFunction kfunct_mappers[] = {
DEFUN("ListAllTrue", kListAllTrue, "li.*"),
DEFUN("ListIndexOf", kListIndexOf, "lo"),
DEFUN("OnMe", kOnMe, "iio.*"),
+ DEFUN("InPolygon", kInPolygon, "iio"),
// SCI2.1 Kernel Functions
DEFUN("Save", kSave, ".*"),
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 2cc7ae8e57..520f7284a9 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -411,6 +411,7 @@ reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv);
reg_t kListFirstTrue(EngineState *s, int argc, reg_t *argv);
reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv);
reg_t kOnMe(EngineState *s, int argc, reg_t *argv);
+reg_t kInPolygon(EngineState *s, int argc, reg_t *argv);
// SCI2.1 Kernel Functions
reg_t kSave(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp
index d984bf4117..80f87a5ad2 100644
--- a/engines/sci/engine/kernel32.cpp
+++ b/engines/sci/engine/kernel32.cpp
@@ -791,6 +791,11 @@ reg_t kOnMe(EngineState *s, int argc, reg_t *argv) {
return make_reg(0, nsRect.contains(x, y));
}
+reg_t kInPolygon(EngineState *s, int argc, reg_t *argv) {
+ // kAvoidPath already implements this
+ return kAvoidPath(s, argc, argv);
+}
+
} // End of namespace Sci
#endif // ENABLE_SCI32
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 2895f4afb6..b19d6d7b8c 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1285,6 +1285,12 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
reg_t points = GET_SEL32(segMan, polygon, points);
int size = GET_SEL32(segMan, polygon, size).toUint16();
+#ifdef ENABLE_SCI32
+ // SCI32 stores the actual points in the data property of points (in a new array)
+ if (segMan->isHeapObject(points))
+ points = GET_SEL32(segMan, points, data);
+#endif
+
if (size == 0) {
// If the polygon has no vertices, we skip it
return NULL;