From 85af217a5b8feab661f5ea4317ad3073aba6874c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 19 Oct 2011 19:52:21 +0300 Subject: SCI: Implemented kObjectIntersect() --- engines/sci/engine/kernel.h | 1 + engines/sci/engine/kernel_tables.h | 2 +- engines/sci/engine/kgraphics.cpp | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 2ed705465f..8cb294e166 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -456,6 +456,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 kInPolygon(EngineState *s, int argc, reg_t *argv); +reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv); // SCI2.1 Kernel Functions reg_t kText(EngineState *s, int argc, reg_t *argv); diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 6692fa7536..afe6b176e5 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -498,13 +498,13 @@ static SciKernelMapEntry s_kernelMap[] = { { MAP_CALL(String), SIG_EVERYWHERE, "(.*)", NULL, NULL }, { MAP_CALL(UpdatePlane), SIG_EVERYWHERE, "o", NULL, NULL }, { MAP_CALL(UpdateScreenItem), SIG_EVERYWHERE, "o", NULL, NULL }, + { MAP_CALL(ObjectIntersect), SIG_EVERYWHERE, "oo", NULL, NULL }, // SCI2 unmapped functions - TODO! // SetScroll - called by script 64909, Styler::doit() // PalCycle - called by Game::newRoom. Related to RemapColors. // VibrateMouse - used in QFG4 - // ObjectIntersect - used in QFG4 // SCI2 Empty functions diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index fd8e9ee9f0..ed3a86684a 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1339,6 +1339,12 @@ reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } +reg_t kObjectIntersect(EngineState *s, int argc, reg_t *argv) { + Common::Rect objRect1 = g_sci->_gfxCompare->getNSRect(argv[0]); + Common::Rect objRect2 = g_sci->_gfxCompare->getNSRect(argv[1]); + return make_reg(0, objRect1.intersects(objRect2)); +} + // Tests if the coordinate is on the passed object reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) { uint16 x = argv[0].toUint16(); -- cgit v1.2.3