[Scummvm-cvs-logs] SF.net SVN: scummvm: [27337] scummvm/trunk/engines/saga/actor.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Jun 11 03:22:46 CEST 2007


Revision: 27337
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27337&view=rev
Author:   thebluegr
Date:     2007-06-10 18:22:45 -0700 (Sun, 10 Jun 2007)

Log Message:
-----------
Fix for stacked objects in IHNM. It is now possible to interact with the chalk in Ted's chapter 

Modified Paths:
--------------
    scummvm/trunk/engines/saga/actor.cpp

Modified: scummvm/trunk/engines/saga/actor.cpp
===================================================================
--- scummvm/trunk/engines/saga/actor.cpp	2007-06-11 00:14:37 UTC (rev 27336)
+++ scummvm/trunk/engines/saga/actor.cpp	2007-06-11 01:22:45 UTC (rev 27337)
@@ -1671,6 +1671,20 @@
 	// fine to interact with. For example, the door entrance at the glass
 	// makers's house in ITE's ferret village.
 
+	// Note that in IHNM, there are some items that overlap on other items
+	// Since we're checking the draw list from the FIRST item drawn to the
+	// LAST one, sometimes the object drawn first is incorrectly returned.
+	// An example is the chalk on the magic circle in Ted's chapter, which
+	// is drawn AFTER the circle, but HitTest incorrectly returns the circle
+	// id in this case, even though the chalk was drawn after the circle.
+	// Therefore, for IHNM, we iterate through the whole draw list and
+	// return the last match found, not the first one.
+	// Unfortunately, it is only possible to search items in the sorted draw 
+	// list from start to end, not reverse, so it's necessary to search
+	// through the whole list to get the item drawn last
+	
+	uint16 result = ID_NOTHING;
+
 	if (!_vm->_scene->getSceneClip().contains(testPoint))
 		return ID_NOTHING;
 
@@ -1690,10 +1704,12 @@
 			continue;
 		}
 		if (_vm->_sprite->hitTest(*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, testPoint)) {
-			return drawObject->_id;
+			result = drawObject->_id;
+			if (_vm->getGameType() == GType_ITE)
+				return result;		// in ITE, return the first result found (read above)
 		}
 	}
-	return ID_NOTHING;
+	return result;					// in IHNM, return the last result found (read above)
 }
 
 void Actor::createDrawOrderList() {


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