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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Thu Sep 9 22:07:53 CEST 2010


Revision: 52664
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52664&view=rev
Author:   m_kiewitz
Date:     2010-09-09 20:07:53 +0000 (Thu, 09 Sep 2010)

Log Message:
-----------
SCI: kIsOnMe is kOnMe, merge both into kIsOnMe

and map kOnMe for SCI2 to kIsOnMe, remove commented out hacks. fix signatures for those 2 functions, added TODO - someone should fix the SCI32 signatures

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/kernel_tables.h
    scummvm/trunk/engines/sci/engine/kgraphics.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2010-09-09 18:34:27 UTC (rev 52663)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2010-09-09 20:07:53 UTC (rev 52664)
@@ -446,11 +446,11 @@
 reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv);
 reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv);
 reg_t kFrameOut(EngineState *s, int argc, reg_t *argv);
+reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv); // kOnMe for SCI2, kIsOnMe for SCI2.1
 reg_t kListIndexOf(EngineState *s, int argc, reg_t *argv);
 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
@@ -459,7 +459,6 @@
 reg_t kList(EngineState *s, int argc, reg_t *argv);
 reg_t kRobot(EngineState *s, int argc, reg_t *argv);
 reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv);
-reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv);
 reg_t kCD(EngineState *s, int argc, reg_t *argv);
 reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv);
 reg_t kGetWindowsOption(EngineState *s, int argc, reg_t *argv);

Modified: scummvm/trunk/engines/sci/engine/kernel_tables.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel_tables.h	2010-09-09 18:34:27 UTC (rev 52663)
+++ scummvm/trunk/engines/sci/engine/kernel_tables.h	2010-09-09 20:07:53 UTC (rev 52664)
@@ -469,6 +469,7 @@
 
 #ifdef ENABLE_SCI32
     // SCI2 Kernel Functions
+	// TODO: whoever knows his way through those calls, fix the signatures.
     { MAP_CALL(AddPlane),          SIG_EVERYWHERE,           "o",                     NULL,            NULL },
     { MAP_CALL(AddScreenItem),     SIG_EVERYWHERE,           "o",                     NULL,            NULL },
     { MAP_CALL(Array),             SIG_EVERYWHERE,           "(.*)",                  NULL,            NULL },
@@ -484,7 +485,7 @@
     { MAP_CALL(ListEachElementDo), SIG_EVERYWHERE,           "li(.*)",                NULL,            NULL },
     { MAP_CALL(ListFirstTrue),     SIG_EVERYWHERE,           "li(.*)",                NULL,            NULL },
     { MAP_CALL(ListIndexOf),       SIG_EVERYWHERE,           "l[o0]",                 NULL,            NULL },
-    { MAP_CALL(OnMe),              SIG_EVERYWHERE,           "iio(.*)",               NULL,            NULL },
+    { "OnMe", kIsOnMe,             SIG_EVERYWHERE,           "iioi",                  NULL,            NULL },
     { MAP_CALL(RepaintPlane),      SIG_EVERYWHERE,           "o",                     NULL,            NULL },
     { MAP_CALL(String),            SIG_EVERYWHERE,           "(.*)",                  NULL,            NULL },
     { MAP_CALL(UpdatePlane),       SIG_EVERYWHERE,           "o",                     NULL,            NULL },
@@ -492,7 +493,7 @@
 
     // SCI2.1 Kernel Functions
     { MAP_CALL(CD),           	   SIG_EVERYWHERE,           "(.*)",                  NULL,            NULL },
-    { MAP_CALL(IsOnMe),            SIG_EVERYWHERE,           "iio(.*)",               NULL,            NULL },
+    { MAP_CALL(IsOnMe),            SIG_EVERYWHERE,           "iioi",                  NULL,            NULL },
     { MAP_CALL(List),              SIG_SCI21, SIGFOR_ALL,    "(.*)",                  kList_subops,    NULL },
     { MAP_CALL(MulDiv),            SIG_EVERYWHERE,           "iii",                   NULL,            NULL },
     { MAP_CALL(PlayVMD),           SIG_EVERYWHERE,           "(.*)",                  NULL,            NULL },

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-09-09 18:34:27 UTC (rev 52663)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-09-09 20:07:53 UTC (rev 52664)
@@ -1305,9 +1305,8 @@
 	return NULL_REG;
 }
 
-reg_t kOnMe(EngineState *s, int argc, reg_t *argv) {
-	// Tests if the cursor is on the passed object
-
+// Tests if the coordinate is on the passed object
+reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
 	uint16 x = argv[0].toUint16();
 	uint16 y = argv[1].toUint16();
 	reg_t targetObject = argv[2];
@@ -1340,75 +1339,9 @@
 		if (g_sci->_gfxCompare->kernelIsItSkip(viewId, loopNo, celNo, Common::Point(x - nsRect.left, y - nsRect.top)))
 			contained = false;
 	}
-// these hacks shouldn't be needed anymore
-//	uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x));
-//	uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y));
-
-	// If top and left are negative, we need to adjust coordinates by
-	// the item's x and y (e.g. happens in GK1, day 1, with detective
-	// Mosely's hotspot in his office)
-
-//	if (nsRect.left < 0)
-//		nsRect.translate(itemX, 0);
-//	
-//	if (nsRect.top < 0)
-//		nsRect.translate(0, itemY);
-
-//	// HACK: nsLeft and nsTop can be invalid, so try and fix them here
-//	// using x and y (e.g. with the inventory screen in GK1)
-//	if (nsRect.left == itemY && nsRect.top == itemX) {
-//		// Swap the values, as they're inversed (eh???)
-//		nsRect.left = itemX;
-//		nsRect.top = itemY;
-//	}
-
 	return make_reg(0, contained);
 }
 
-reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
-	// Tests if the cursor is on the passed object, after adjusting the
-	// coordinates of the object according to the object's plane
-
-	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 = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsLeft));
-	nsRect.top = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsTop));
-	nsRect.right = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsRight));
-	nsRect.bottom = readSelectorValue(s->_segMan, targetObject, SELECTOR(nsBottom));
-
-	// Get the object's plane
-#if 0
-	reg_t planeObject = readSelector(s->_segMan, targetObject, SELECTOR(plane));
-	if (!planeObject.isNull()) {
-		//uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x));
-		//uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y));
-		uint16 planeResY = readSelectorValue(s->_segMan, planeObject, SELECTOR(resY));
-		uint16 planeResX = readSelectorValue(s->_segMan, planeObject, SELECTOR(resX));
-		uint16 planeTop = readSelectorValue(s->_segMan, planeObject, SELECTOR(top));
-		uint16 planeLeft = readSelectorValue(s->_segMan, planeObject, SELECTOR(left));
-		planeTop = (planeTop * g_sci->_gfxScreen->getHeight()) / planeResY;
-		planeLeft = (planeLeft * g_sci->_gfxScreen->getWidth()) / planeResX;
-
-		// Adjust the bounding rectangle of the object by the object's
-		// actual X, Y coordinates
-		nsRect.top = ((nsRect.top * g_sci->_gfxScreen->getHeight()) / planeResY);
-		nsRect.left = ((nsRect.left * g_sci->_gfxScreen->getWidth()) / planeResX);
-		nsRect.bottom = ((nsRect.bottom * g_sci->_gfxScreen->getHeight()) / planeResY);
-		nsRect.right = ((nsRect.right * g_sci->_gfxScreen->getWidth()) / planeResX);
-
-		nsRect.translate(planeLeft, planeTop);
-	}
-#endif
-	//warning("kIsOnMe: (%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));
-}
-
 reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
 	// TODO: argument 0 is usually 0, and arguments 1 and 2 are usually 1
 	switch (argv[0].toUint16()) {


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