hedgewars/uLandObjects.pas
changeset 6112 7839a2ae90ae
parent 6081 537bbd5c1a62
child 6113 b3dfb796c3a5
--- a/hedgewars/uLandObjects.pas	Sat Oct 08 23:36:52 2011 -0400
+++ b/hedgewars/uLandObjects.pas	Sun Oct 09 19:36:09 2011 -0400
@@ -25,7 +25,7 @@
 procedure AddObjects();
 procedure FreeLandObjects();
 procedure LoadThemeConfig;
-procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface);
+procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word = 0);
 procedure AddOnLandObjects(Surface: PSDL_Surface);
 
 implementation
@@ -66,7 +66,7 @@
     SprayObjects: TSprayObjects;
 
 
-procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface);
+procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word = 0);
 var p: PLongwordArray;
     x, y: Longword;
     bpp: LongInt;
@@ -96,11 +96,11 @@
                 if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then 
                     LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x];
 
+        Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or extraFlags;
+
         if ((Land[cpY + y, cpX + x] and $FF00) = 0) and ((p^[x] and AMask) <> 0) then
             begin
             Land[cpY + y, cpX + x]:= lfObject;
-            // For testing only. Intent is to flag this on objects with masks, or use it for an ice ray gun
-            if (Theme = 'Snow') or (Theme = 'Christmas') then Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or lfIce
             end;
         end;
     p:= @(p^[Image^.pitch shr 2])
@@ -208,7 +208,11 @@
     rr.x:= x1;
     while rr.x < x2 do
         begin
-        BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf);
+        // For testing only. Intent is to flag this on objects with masks, or use it for an ice ray gun
+        if (Theme = 'Snow') or (Theme = 'Christmas') then 
+            BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf, lfIce)
+        else
+            BlitImageAndGenerateCollisionInfo(rr.x, y, min(x2 - rr.x, tmpsurf^.w), tmpsurf);
         inc(rr.x, tmpsurf^.w);
         end;
     SDL_FreeSurface(tmpsurf);