# HG changeset patch # User nemo # Date 1308576751 14400 # Node ID e9ae019e9bb455145d683c2ce8ea438667310ac7 # Parent 1c2a7547efaadca751d760f3c3fb2f0b405166f8 move smoothing into separate function, adjust call order diff -r 1c2a7547efaa -r e9ae019e9bb4 hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Mon Jun 20 09:15:24 2011 -0400 +++ b/hedgewars/uLandGraphics.pas Mon Jun 20 09:32:31 2011 -0400 @@ -30,6 +30,7 @@ function addBgColor(OldColor, NewColor: LongWord): LongWord; function SweepDirty: boolean; function Despeckle(X, Y: LongInt): boolean; +procedure Smooth(X, Y: LongInt); function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean; function DrawExplosion(X, Y, Radius: LongInt): Longword; procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte); @@ -748,6 +749,11 @@ if not pixelsweep then exit(true); end; end; +Despeckle:= false +end; + +procedure Smooth(X, Y: LongInt); +begin // a bit of AA for explosions if ((cReducedQuality and rqBlurryLand) = 0) and (Land[Y, X] = 0) and (Y > topY+1) and (Y < LAND_HEIGHT-2) and (X>leftX+1) and (X<rightX-1) then @@ -780,13 +786,12 @@ (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((cExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift); Land[y,x]:= lfBasic end - end; -Despeckle:= false + end end; function SweepDirty: boolean; var x, y, xx, yy, ty, tx: LongInt; - bRes, updateBlock, resweep, recheck: boolean; + bRes, updateBlock, resweep, recheck, firstpass: boolean; begin bRes:= false; reCheck:= true; @@ -802,6 +807,7 @@ begin updateBlock:= false; resweep:= true; + firstpass:= true; ty:= y * 32; tx:= x * 32; while(resweep) do @@ -809,6 +815,7 @@ resweep:= false; for yy:= ty to ty + 31 do for xx:= tx to tx + 31 do + begin if Despeckle(xx, yy) then begin bRes:= true; @@ -835,6 +842,9 @@ recheck:= true; end end; + if firstpass then Smooth(xx,yy); + end; + firstpass:= false end; if updateBlock then UpdateLandTexture(tx, 32, ty, 32); LandDirty[y, x]:= 0;