[Scummvm-cvs-logs] SF.net SVN: scummvm:[34135] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Aug 25 08:32:09 CEST 2008


Revision: 34135
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34135&view=rev
Author:   peres001
Date:     2008-08-25 06:32:08 +0000 (Mon, 25 Aug 2008)

Log Message:
-----------
Added workaround for bug 2070751, long standing issue with item matching exposed after revision 32873.

Revision Links:
--------------
    http://scummvm.svn.sourceforge.net/scummvm/?rev=32873&view=rev

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/parallaction.h

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-08-25 06:01:55 UTC (rev 34134)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-08-25 06:32:08 UTC (rev 34135)
@@ -686,6 +686,36 @@
 }
 
 // FIXME: input coordinates must be offseted to handle scrolling!
+bool Parallaction::checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y) {
+	// not a special zone
+	if ((z->getX() != -2) && (z->getX() != -3)) {
+		return false;
+	}
+
+	// WORKAROUND: this huge condition is needed because we made TypeData a collection of structs
+	// instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine,
+	// but we need to check it separately here. The same workaround is applied in freeZones.
+	if ((((z->_type & 0xFFFF) == kZoneMerge) && (((x == z->u.merge->_obj1) && (y == z->u.merge->_obj2)) || ((x == z->u.merge->_obj2) && (y == z->u.merge->_obj1)))) ||
+		(((z->_type & 0xFFFF) == kZoneGet) && ((x == z->u.get->_icon) || (y == z->u.get->_icon)))) {
+
+		// WORKAROUND for bug 2070751: special zones are only used in NS, to allow the
+		// the EXAMINE/USE action to be applied on some particular item in the inventory.
+		// The usage a verb requires at least an item match, so type can't be 0, as it
+		// was in the original code. This bug has been here since the beginning, and was
+		// hidden by label code, which filtered the bogus matches produced here.
+
+		// look for action + item match
+		if (z->_type == type)
+			return true;
+		// look for item match, but don't accept 0 types
+		if (((z->_type & 0xFFFF0000) == type) && (type))
+			return true;
+	}
+
+	return false;
+}
+
+// FIXME: input coordinates must be offseted to handle scrolling!
 bool Parallaction::checkZoneBox(ZonePtr z, uint32 type, uint x, uint y) {
 	if (z->_flags & kFlagsRemove)
 		return false;
@@ -701,26 +731,10 @@
 
 	if (!r.contains(x, y)) {
 
-		// out of Zone, so look for special values
-		if ((z->getX() == -2) || (z->getX() == -3)) {
+		// check for special zones (items defined in common.loc)
+		if (checkSpecialZoneBox(z, type, x, y))
+			return true;
 
-			// WORKAROUND: this huge condition is needed because we made TypeData a collection of structs
-			// instead of an union. So, merge->_obj1 and get->_icon were just aliases in the original engine,
-			// but we need to check it separately here. The same workaround is applied in freeZones.
-			if ((((z->_type & 0xFFFF) == kZoneMerge) && (((x == z->u.merge->_obj1) && (y == z->u.merge->_obj2)) || ((x == z->u.merge->_obj2) && (y == z->u.merge->_obj1)))) ||
-				(((z->_type & 0xFFFF) == kZoneGet) && ((x == z->u.get->_icon) || (y == z->u.get->_icon)))) {
-
-				// special Zone
-				if ((type == 0) && ((z->_type & 0xFFFF0000) == 0))
-					return true;
-				if (z->_type == type)
-					return true;
-				if ((z->_type & 0xFFFF0000) == type)
-					return true;
-
-			}
-		}
-
 		if (z->getX() != -1)
 			return false;
 		if ((int)x < _char._ani->getFrameX())
@@ -731,7 +745,6 @@
 			return false;
 		if ((int)y > (_char._ani->getFrameY() + _char._ani->height()))
 			return false;
-
 	}
 
 	// normal Zone

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-08-25 06:01:55 UTC (rev 34134)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-08-25 06:32:08 UTC (rev 34135)
@@ -262,6 +262,7 @@
 	void		pauseJobs();
 	void		resumeJobs();
 
+	bool 		checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y);
 	bool 		checkZoneBox(ZonePtr z, uint32 type, uint x, uint y);
 	bool 		checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y);
 	ZonePtr		findZone(const char *name);


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