--- a/hedgewars/uLandObjects.pas Fri Oct 28 17:41:39 2011 +0200
+++ b/hedgewars/uLandObjects.pas Fri Oct 28 18:26:17 2011 +0200
@@ -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,8 +96,12 @@
if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then
LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x];
+
if ((Land[cpY + y, cpX + x] and $FF00) = 0) and ((p^[x] and AMask) <> 0) then
- Land[cpY + y, cpX + x]:= lfObject
+ begin
+ Land[cpY + y, cpX + x]:= lfObject;
+ Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or extraFlags
+ end;
end;
p:= @(p^[Image^.pitch shr 2])
end;
@@ -204,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);