diff options
author | Matthew Hoops | 2010-01-03 05:29:30 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-01-03 05:29:30 +0000 |
commit | 986a75b7ee11ef74746a9291c469016dec5dd764 (patch) | |
tree | 9554ed5f14dcc0add67ee6dd87a65256355f1a84 | |
parent | 7d5e91337e31f89b28a85b65ce09d88b0e698040 (diff) | |
download | scummvm-rg350-986a75b7ee11ef74746a9291c469016dec5dd764.tar.gz scummvm-rg350-986a75b7ee11ef74746a9291c469016dec5dd764.tar.bz2 scummvm-rg350-986a75b7ee11ef74746a9291c469016dec5dd764.zip |
Implement kInPolygon for SCI32. GK1 now responds when you click on things.
svn-id: r46918
-rw-r--r-- | engines/sci/engine/kernel.cpp | 1 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 1 | ||||
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 6 |
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; |