[Scummvm-cvs-logs] SF.net SVN: scummvm:[46614] scummvm/trunk/engines/sci/engine/kernel32.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Dec 27 04:58:00 CET 2009


Revision: 46614
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46614&view=rev
Author:   thebluegr
Date:     2009-12-27 03:57:59 +0000 (Sun, 27 Dec 2009)

Log Message:
-----------
SCI32: Partially implemented kOnMe. Now the main menu in GK1 works

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel32.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel32.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel32.cpp	2009-12-27 02:57:03 UTC (rev 46613)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2009-12-27 03:57:59 UTC (rev 46614)
@@ -759,13 +759,23 @@
 }
 
 reg_t kOnMe(EngineState *s, int argc, reg_t *argv) {
-	// This kernel function looks like it calls a function in the object (arg 2) with
-	// the x/y coordinates supplied in args 0/1. Arg 3 seems to be 0.
-	
-	// TODO
+	// Tests if the cursor is on the passed object
 
-	//warning("kOnMe: (%d, %d) on object %04x:%04x", argv[0].toUint16(), argv[1].toUint16(), PRINT_REG(argv[2]));
-	return s->r_acc;
+	uint16 x = argv[0].toUint16();
+	uint16 y = argv[1].toUint16();
+	reg_t targetObject = argv[2];
+	// TODO: argv[3] - it's usually 0
+	Common::Rect nsRect;
+
+	// Get the bounding rectangle of the object
+	nsRect.left = GET_SEL32V(s->_segMan, targetObject, nsLeft);
+	nsRect.top = GET_SEL32V(s->_segMan, targetObject, nsTop);
+	nsRect.right = GET_SEL32V(s->_segMan, targetObject, nsRight);
+	nsRect.bottom = GET_SEL32V(s->_segMan, targetObject, nsBottom);
+
+	//warning("kOnMe: (%d, %d) on object %04x:%04x, parameter %d", argv[0].toUint16(), argv[1].toUint16(), PRINT_REG(argv[2]), argv[3].toUint16());
+
+	return make_reg(0, nsRect.contains(x, y));
 }
 
 } // End of namespace Sci


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list