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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Mar 17 22:17:00 CET 2007


Revision: 26186
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26186&view=rev
Author:   peres001
Date:     2007-03-17 14:17:00 -0700 (Sat, 17 Mar 2007)

Log Message:
-----------
added getRect() to Zone to slightly simplify hitZone condition check

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

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-03-17 21:06:19 UTC (rev 26185)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-03-17 21:17:00 UTC (rev 26186)
@@ -581,11 +581,15 @@
 
 		if (z->_flags & kFlagsRemove) continue;
 
-		if ((_si >= z->_right)	||
-			(_si <= z->_left)	||
-			(_di >= z->_bottom) ||
-			(_di <= z->_top)) {
+		Common::Rect r;
+		z->getRect(r);
+		r.right++;		// adjust border because Common::Rect doesn't include bottom-right edge
+		r.bottom++;
 
+		r.grow(-1);		// allows some tolerance for mouse click
+
+		if (!r.contains(_si, _di)) {
+
 			// out of Zone, so look for special values
 			if ((z->_left == -2) || (z->_left == -3)) {
 

Modified: scummvm/trunk/engines/parallaction/zone.h
===================================================================
--- scummvm/trunk/engines/parallaction/zone.h	2007-03-17 21:06:19 UTC (rev 26185)
+++ scummvm/trunk/engines/parallaction/zone.h	2007-03-17 21:17:00 UTC (rev 26186)
@@ -141,6 +141,13 @@
 	Command 		*_commands;
 	Point			_moveTo;
 
+	void getRect(Common::Rect& r) const {
+		r.left = _left;
+		r.right = _right;
+		r.top = _top;
+		r.bottom = _bottom;
+	}
+
 	void translate(int16 x, int16 y) {
 		_left += x;
 		_right += x;


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