aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2011-10-19 19:52:21 +0300
committerFilippos Karapetis2011-10-19 20:29:02 +0300
commit85af217a5b8feab661f5ea4317ad3073aba6874c (patch)
tree7e4a4829034dcbeb57ddd265980dcf90e90c364c /engines/sci
parent722ce77675dcd512a0ba28ab632f51d14b566a94 (diff)
downloadscummvm-rg350-85af217a5b8feab661f5ea4317ad3073aba6874c.tar.gz
scummvm-rg350-85af217a5b8feab661f5ea4317ad3073aba6874c.tar.bz2
scummvm-rg350-85af217a5b8feab661f5ea4317ad3073aba6874c.zip
SCI: Implemented kObjectIntersect()
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/kernel_tables.h2
-rw-r--r--engines/sci/engine/kgraphics.cpp6
3 files changed, 8 insertions, 1 deletions
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();