[Scummvm-cvs-logs] SF.net SVN: scummvm:[40590] scummvm/trunk/engines/cruise

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Fri May 15 06:54:45 CEST 2009


Revision: 40590
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40590&view=rev
Author:   dreammaster
Date:     2009-05-15 04:54:45 +0000 (Fri, 15 May 2009)

Log Message:
-----------
Fixes for the backupBackground method when X < 0

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/backgroundIncrust.cpp
    scummvm/trunk/engines/cruise/backgroundIncrust.h

Modified: scummvm/trunk/engines/cruise/backgroundIncrust.cpp
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.cpp	2009-05-15 04:36:04 UTC (rev 40589)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.cpp	2009-05-15 04:54:45 UTC (rev 40590)
@@ -52,7 +52,11 @@
 	pIncrust->ptr = (uint8*)malloc(width * height);
 	for (int i = 0; i < height; i++) {
 		for (int j = 0; j < width; j++) {
-			pIncrust->ptr[i * width + j] = pBackground[(i+Y) * 320 + j + X];
+			int xp = j + X;
+			int yp = i + Y;
+
+			pIncrust->ptr[i * width + j] = ((xp < 0) || (yp < 0) || (xp >= 320) || (yp >= 200)) ?
+				0 : pBackground[yp * 320 + xp];
 		}
 	}
 }

Modified: scummvm/trunk/engines/cruise/backgroundIncrust.h
===================================================================
--- scummvm/trunk/engines/cruise/backgroundIncrust.h	2009-05-15 04:36:04 UTC (rev 40589)
+++ scummvm/trunk/engines/cruise/backgroundIncrust.h	2009-05-15 04:54:45 UTC (rev 40590)
@@ -35,8 +35,8 @@
 	uint16 objectIdx;
 	int16 type;
 	uint16 overlayIdx;
-	uint16 X;
-	uint16 Y;
+	int16 X;
+	int16 Y;
 	uint16 field_E;
 	uint16 scale;
 	uint16 backgroundIdx;


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