hedgewars/uLandObjects.pas
changeset 1182 e2e13aa055c1
parent 1181 3ae244bffef9
child 1183 540cea859395
--- a/hedgewars/uLandObjects.pas	Fri Aug 08 19:39:22 2008 +0000
+++ b/hedgewars/uLandObjects.pas	Fri Aug 08 20:13:32 2008 +0000
@@ -62,7 +62,7 @@
 
 
 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY: Longword; Image: PSDL_Surface);
-var p: PByteArray;
+var p: PLongwordArray;
     x, y: Longword;
     bpp: LongInt;
     r: TSDL_Rect;
@@ -76,17 +76,17 @@
 
 bpp:= Image^.format^.BytesPerPixel;
 TryDo(bpp = 4, 'Land object should be 32bit', true);
+
 p:= Image^.pixels;
-
 for y:= 0 to Pred(Image^.h) do
 	begin
 	for x:= 0 to Pred(Image^.w) do
 		if LandPixels[cpY + y, cpX + x] = 0 then
 			begin
-			LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^;
-			if (PLongword(@(p^[x * 4]))^ and $FF000000) <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND;
+			LandPixels[cpY + y, cpX + x]:= p^[x];
+			if (p^[x] and $FF000000) <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND;
 			end;
-	p:= @(p^[Image^.pitch]);
+	p:= @(p^[Image^.pitch div 4]);
 	end;
 
 if SDL_MustLock(Image) then