# HG changeset patch # User nemo # Date 1317436408 14400 # Node ID d8fa5a85d24f449ff4adbca4ccb90b843ca00a98 # Parent e1b4771f647292dd9011b0d7e0c5195e02a7b6ca This prevents girders from erasing landbacktex (square windows in tunnels and such), at the cost of requiring lfBasic and lfObject to be treated the same apart from graphically diff -r e1b4771f6472 -r d8fa5a85d24f hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sat Oct 01 03:06:51 2011 +0200 +++ b/hedgewars/uConsts.pas Fri Sep 30 22:33:28 2011 -0400 @@ -91,7 +91,7 @@ // TODO - set lfBasic for all solid land, ensure all uses of the flags can handle multiple flag bits lfBasic = $8000; // white lfIndestructible = $4000; // red - lfObject = $2000; // no idea + lfObject = $2000; // no idea - lfObject and lfBasic are only to be different *graphically* in all other ways they should be treated the same lfDamaged = $1000; // no idea cMaxPower = 1500; diff -r e1b4771f6472 -r d8fa5a85d24f hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Sat Oct 01 03:06:51 2011 +0200 +++ b/hedgewars/uLandGraphics.pas Fri Sep 30 22:33:28 2011 -0400 @@ -647,7 +647,7 @@ end; function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean; -var X, Y, bpp, h, w, row, col, numFramesFirstCol: LongInt; +var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; p: PByteArray; Image: PSDL_Surface; begin @@ -702,14 +702,23 @@ for x:= 0 to Pred(w) do if PLongword(@(p^[x * 4]))^ <> 0 then begin + if (cReducedQuality and rqBlurryLand) = 0 then + begin + gX:= cpX + x; + gY:= cpY + y; + end + else + begin + gX:= (cpX + x) div 2; + gY:= (cpY + y) div 2; + end; if indestructible then Land[cpY + y, cpX + x]:= lfIndestructible + else if (LandPixels[gY, gX] and AMask) shr AShift = 255 then // This test assumes lfBasic and lfObject differ only graphically + Land[cpY + y, cpX + x]:= lfBasic else Land[cpY + y, cpX + x]:= lfObject; - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^ - else - LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= PLongword(@(p^[x * 4]))^ + LandPixels[gY, gX]:= PLongword(@(p^[x * 4]))^ end; p:= @(p^[Image^.pitch]); end;