[Scummvm-cvs-logs] SF.net SVN: scummvm: [26887] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun May 20 14:39:17 CEST 2007


Revision: 26887
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26887&view=rev
Author:   dreammaster
Date:     2007-05-20 05:39:15 -0700 (Sun, 20 May 2007)

Log Message:
-----------
Fixed several room change, NPC behaviour, and door closing code

Modified Paths:
--------------
    scummvm/trunk/engines/lure/hotspots.cpp
    scummvm/trunk/engines/lure/res_struct.cpp

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2007-05-20 11:50:06 UTC (rev 26886)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2007-05-20 12:39:15 UTC (rev 26887)
@@ -477,7 +477,8 @@
 		_charRectY = 0;
 		break;
 	default:
-		break;
+		// No need to change
+		return;
 	}
 
 	setFrameNumber(newFrameNumber);
@@ -547,7 +548,7 @@
 	// Try up to 20 times to find an unoccupied destination 
 	for (int tryCtr = 0; tryCtr < 20; ++tryCtr) {
 		xp = rect.left + rnd.getRandomNumber(rect.right - rect.left);
-		yp = rect.left + rnd.getRandomNumber(rect.bottom - rect.top);
+		yp = rect.top + rnd.getRandomNumber(rect.bottom - rect.top);
 		setDestPosition(xp, yp);
 		setDestHotspot(0);
 
@@ -1033,15 +1034,16 @@
 		if ((hsCurrent->hotspotId() == 0xfffe) || (hsCurrent->hotspotId() == 0xffff))
 			continue;
 
-		// Check the dimensions of the animation
-		if ((hsCurrent->x() < bounds.right) &&
-			((hsCurrent->x() + hsCurrent->widthCopy()) > bounds.left) &&
-			((hsCurrent->y() + hsCurrent->heightCopy() + hsCurrent->charRectY()) >= bounds.top) &&
-			((hsCurrent->y() + hsCurrent->heightCopy() - hsCurrent->charRectY()
-			- hsCurrent->yCorrection()) > bounds.bottom)) {
-			// Return false - the door can't be closed
-			return false;
-		}
+		// Check to see if the character is intersecting the door area
+		int tempY = hsCurrent->y() + hsCurrent->heightCopy();
+		if ((hsCurrent->x() >= bounds.right) ||
+			(hsCurrent->x() + hsCurrent->widthCopy() <= bounds.left) ||
+			(tempY + hsCurrent->charRectY() < bounds.top) ||
+			(tempY - hsCurrent->yCorrection() - hsCurrent->charRectY() > bounds.bottom))
+			continue;
+
+		// At this point we know a character is blocking door, so return false
+		return false;
 	}
 
 	// No blocking characters, so return true that the door can be closed
@@ -3736,6 +3738,7 @@
 				add(LEFT, -_xDestPos);
 
 			_inProgress = false;
+			result = PF_OK;
 			goto final_step;
 		}
 

Modified: scummvm/trunk/engines/lure/res_struct.cpp
===================================================================
--- scummvm/trunk/engines/lure/res_struct.cpp	2007-05-20 11:50:06 UTC (rev 26886)
+++ scummvm/trunk/engines/lure/res_struct.cpp	2007-05-20 12:39:15 UTC (rev 26887)
@@ -218,7 +218,7 @@
 	// Handle padding for last row, including left/right edge padding, as
 	// well as the right column of the second row
 	for (paddingCtr = 0; paddingCtr < (DECODED_PATHS_WIDTH + 1); ++paddingCtr)
-		*pOut-- = 0xffff;
+		*pOut-- = 0;
 
 	for (int y = 0; y < ROOM_PATHS_HEIGHT; ++y) {
 		charState = false;
@@ -258,15 +258,15 @@
 		}
 
 		// Store 2 words to allow off-screen row-start/prior row end
-		*pOut-- = 0xffff;
-		*pOut-- = 0xffff;
+		*pOut-- = 0;
+		*pOut-- = 0;
 		charState = false;
 	}
 
 	// Handle padding for final top row - no need for end column, as end of prior
 	// row provided padding for it
 	for (paddingCtr = 0; paddingCtr < (ROOM_PATHS_WIDTH + 1); ++paddingCtr)
-		*pOut-- = 0xffff;
+		*pOut-- = 0;
 }
 
 // Room data class


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