# HG changeset patch # User nemo # Date 1293377470 18000 # Node ID f63433ba306429b2dc8f4fe045ed55f40c664369 # Parent 3682db294daee505ca701d201628463277605c5e disable landbackpixel on small explosions diff -r 3682db294dae -r f63433ba3064 hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Sun Dec 26 00:28:23 2010 -0500 +++ b/hedgewars/uLandGraphics.pas Sun Dec 26 10:31:10 2010 -0500 @@ -185,12 +185,14 @@ function FillLandCircleLinesBG(x, y, dx, dy: LongInt): Longword; var i, t: LongInt; cnt: Longword; + large: boolean; begin cnt:= 0; t:= y + dy; +large:= (dx > 4) and (dy > 4); // hack to disable landbackpixels on fire if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) then + if large and ((Land[t, i] and lfBasic) <> 0) then begin inc(cnt); if (cReducedQuality and rqBlurryLand) = 0 then @@ -198,17 +200,18 @@ else LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) end - else - if ((Land[t, i] and lfObject) <> 0) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= 0 - else - LandPixels[t div 2, i div 2]:= 0; + else if not isMap or ((Land[t, i] and lfObject) <> 0) then + begin + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[t, i]:= 0 + else + LandPixels[t div 2, i div 2]:= 0 + end; t:= y - dy; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) then + if large and ((Land[t, i] and lfBasic) <> 0) then begin inc(cnt); if (cReducedQuality and rqBlurryLand) = 0 then @@ -216,35 +219,18 @@ else LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) end - else - if ((Land[t, i] and lfObject) <> 0) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= 0 - else - LandPixels[t div 2, i div 2]:= 0; + else if not isMap or ((Land[t, i] and lfObject) <> 0) then + begin + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[t, i]:= 0 + else + LandPixels[t div 2, i div 2]:= 0 + end; t:= y + dx; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) then - begin - inc(cnt); - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= LandBackPixel(i, t) - else - LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) - end - else - if ((Land[t, i] and lfObject) <> 0) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= 0 - else - LandPixels[t div 2, i div 2]:= 0; - -t:= y - dx; -if (t and LAND_HEIGHT_MASK) = 0 then - for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) then + if large and ((Land[t, i] and lfBasic) <> 0) then begin inc(cnt); if (cReducedQuality and rqBlurryLand) = 0 then @@ -252,12 +238,32 @@ else LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) end - else - if ((Land[t, i] and lfObject) <> 0) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= 0 - else - LandPixels[t div 2, i div 2]:= 0; + else if not isMap or ((Land[t, i] and lfObject) <> 0) then + begin + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[t, i]:= 0 + else + LandPixels[t div 2, i div 2]:= 0 + end; + +t:= y - dx; +if (t and LAND_HEIGHT_MASK) = 0 then + for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do + if large and ((Land[t, i] and lfBasic) <> 0) then + begin + inc(cnt); + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[t, i]:= LandBackPixel(i, t) + else + LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) + end + else if not isMap or ((Land[t, i] and lfObject) <> 0) then + begin + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[t, i]:= 0 + else + LandPixels[t div 2, i div 2]:= 0 + end; FillLandCircleLinesBG:= cnt; end; @@ -267,7 +273,7 @@ t:= y + dy; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then + if (Land[t, i] and (lfBasic or lfObject)) <> 0 then begin if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= cExplosionBorderColor @@ -282,7 +288,7 @@ t:= y - dy; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then + if (Land[t, i] and (lfBasic or lfObject)) <> 0 then begin if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= cExplosionBorderColor @@ -296,7 +302,7 @@ t:= y + dx; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then + if (Land[t, i] and (lfBasic or lfObject)) <> 0 then begin if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= cExplosionBorderColor @@ -311,7 +317,7 @@ t:= y - dx; if (t and LAND_HEIGHT_MASK) = 0 then for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do - if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then + if (Land[t, i] and (lfBasic or lfObject)) <> 0 then begin if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= cExplosionBorderColor @@ -414,12 +420,13 @@ LandPixels[ty, tx]:= LandBackPixel(tx, ty) else LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty) - else - if (Land[ty, tx] and lfObject) <> 0 then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[ty, tx]:= 0 - else - LandPixels[ty div 2, tx div 2]:= 0; + else if not isMap then + begin + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[ty, tx]:= 0 + else + LandPixels[ty div 2, tx div 2]:= 0 + end; inc(y, dY) end; @@ -430,7 +437,7 @@ begin for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do - if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then + if (Land[ty, tx] and (lfBasic or lfObject)) <> 0 then begin if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[ty, tx]:= cExplosionBorderColor @@ -474,13 +481,12 @@ ty:= hwRound(Y); if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and - (((Land[ty, tx] and lfBasic) <> 0) or - ((Land[ty, tx] and lfObject) <> 0)) then + ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then begin Land[ty, tx]:= Land[ty, tx] or lfDamaged; - if (cReducedQuality and rqBlurryLand) = 0 then + if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[ty, tx]:= cExplosionBorderColor - else + else LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor end end; @@ -500,15 +506,13 @@ ty:= hwRound(Y); if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and - (((Land[ty, tx] and lfBasic) <> 0) or - ((Land[ty, tx] and lfObject) <> 0)) then + ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then begin Land[ty, tx]:= Land[ty, tx] or lfDamaged; - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[ty, tx]:= cExplosionBorderColor - else - LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor - + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[ty, tx]:= cExplosionBorderColor + else + LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor end end; X:= nx; @@ -526,12 +530,13 @@ LandPixels[ty, tx]:= LandBackPixel(tx, ty) else LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty) - else - if (Land[ty, tx] and lfObject) <> 0 then + else if not isMap or ((Land[ty, tx] and lfObject) <> 0) then + begin if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[ty, tx]:= 0 + LandPixels[ty, tx]:= 0 else - LandPixels[ty div 2, tx div 2]:= 0; + LandPixels[ty div 2, tx div 2]:= 0 + end; Land[ty, tx]:= 0; end @@ -544,15 +549,13 @@ ty:= hwRound(Y); if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and - (((Land[ty, tx] and lfBasic) <> 0) or - ((Land[ty, tx] and lfObject) <> 0)) then + ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then begin Land[ty, tx]:= Land[ty, tx] or lfDamaged; if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[ty, tx]:= cExplosionBorderColor + LandPixels[ty, tx]:= cExplosionBorderColor else - LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor - + LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor end end; nx:= nx - dY; @@ -571,14 +574,13 @@ ty:= hwRound(Y); if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and - (((Land[ty, tx] and lfBasic) <> 0) or - ((Land[ty, tx] and lfObject) <> 0)) then + ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then begin Land[ty, tx]:= Land[ty, tx] or lfDamaged; if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[ty, tx]:= cExplosionBorderColor + LandPixels[ty, tx]:= cExplosionBorderColor else - LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor + LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor end end; nx:= nx - dY; @@ -689,14 +691,16 @@ if c < 4 then // 0-3 neighbours begin if (cReducedQuality and rqBlurryLand) = 0 then - if (Land[Y, X] and lfBasic) <> 0 then + begin + (* if (Land[Y, X] and lfBasic) <> 0 then LandPixels[Y, X]:= LandBackPixel(X, Y) - else + else if not isMap or ((Land[Y, X] and lfObject) <> 0) then*) LandPixels[Y, X]:= 0 + end else - if (Land[Y, X] and lfBasic) <> 0 then + (* if (Land[Y, X] and lfBasic) <> 0 then LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y) - else + else if not isMap or ((Land[Y, X] and lfObject) <> 0) then*) LandPixels[Y div 2, X div 2]:= 0; Land[Y, X]:= 0;