# HG changeset patch # User nemo # Date 1308617187 14400 # Node ID 941da059472b10ff6414a23b758a6a0a5d4f4719 # Parent 102728b20c4d30b0560b33a5501adccfa8260610 Avoid desyncing on blurry land diff -r 102728b20c4d -r 941da059472b hedgewars/uLand.pas --- a/hedgewars/uLand.pas Mon Jun 20 19:00:19 2011 -0400 +++ b/hedgewars/uLand.pas Mon Jun 20 20:46:27 2011 -0400 @@ -1062,35 +1062,40 @@ LandSurface2LandPixels(tmpsurf); SDL_FreeSurface(tmpsurf); - if (cReducedQuality and rqBlurryLand) = 0 then - for x:= leftX+2 to rightX-2 do - for y:= topY+2 to LAND_HEIGHT-3 do - if (Land[y, x] = 0) and - (((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or - ((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then - begin + for x:= leftX+2 to rightX-2 do + for y:= topY+2 to LAND_HEIGHT-3 do + if (Land[y, x] = 0) and + (((Land[y, x-1] = lfBasic) and ((Land[y+1,x] = lfBasic)) or (Land[y-1,x] = lfBasic)) or + ((Land[y, x+1] = lfBasic) and ((Land[y-1,x] = lfBasic) or (Land[y+1,x] = lfBasic)))) then + begin + if (cReducedQuality and rqBlurryLand) = 0 then + begin if Land[y, x-1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x-1] else if Land[y, x+1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x+1]; - LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift); - Land[y,x]:= lfObject - end - else if (Land[y, x] = 0) and - (((Land[y, x-1] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y+2,x] = lfBasic)) or - ((Land[y, x-1] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y-2,x] = lfBasic)) or - ((Land[y, x+1] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y+2,x] = lfBasic)) or - ((Land[y, x+1] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y-2,x] = lfBasic)) or - ((Land[y+1, x] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or - ((Land[y-1, x] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or - ((Land[y+1, x] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic)) or - ((Land[y-1, x] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic))) then - begin + LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift) + end; + Land[y,x]:= lfObject + end + else if (Land[y, x] = 0) and + (((Land[y, x-1] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y+2,x] = lfBasic)) or + ((Land[y, x-1] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y-2,x] = lfBasic)) or + ((Land[y, x+1] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y+2,x] = lfBasic)) or + ((Land[y, x+1] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y-2,x] = lfBasic)) or + ((Land[y+1, x] = lfBasic) and (Land[y+1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or + ((Land[y-1, x] = lfBasic) and (Land[y-1,x+1] = lfBasic) and (Land[y,x+2] = lfBasic)) or + ((Land[y+1, x] = lfBasic) and (Land[y+1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic)) or + ((Land[y-1, x] = lfBasic) and (Land[y-1,x-1] = lfBasic) and (Land[y,x-2] = lfBasic))) then + begin + if (cReducedQuality and rqBlurryLand) = 0 then + begin if Land[y, x-1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x-1] else if Land[y, x+1] = lfBasic then LandPixels[y, x]:= LandPixels[y, x+1] else if Land[y+1, x] = lfBasic then LandPixels[y, x]:= LandPixels[y+1, x] else if Land[y-1, x] = lfBasic then LandPixels[y, x]:= LandPixels[y-1, x]; - LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift); - Land[y,x]:= lfObject - end; + LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift) + end; + Land[y,x]:= lfObject + end; AddProgress(); end; diff -r 102728b20c4d -r 941da059472b hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Mon Jun 20 19:00:19 2011 -0400 +++ b/hedgewars/uLandGraphics.pas Mon Jun 20 20:46:27 2011 -0400 @@ -755,18 +755,21 @@ 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 +if (Land[Y, X] = 0) and (Y > topY+1) and (Y < LAND_HEIGHT-2) and (X>leftX+1) and (X 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0)) or (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then begin - if (LandPixels[y,x] = 0) then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (128 shl AShift) - else - LandPixels[y,x]:= - (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or - (((((LandPixels[y,x] and GMask shr GShift) div 2)+((cExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or - (((((LandPixels[y,x] and BMask shr BShift) div 2)+((cExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift); + if (cReducedQuality and rqBlurryLand) = 0 then + begin + if (LandPixels[y,x] = 0) then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (128 shl AShift) + else + LandPixels[y,x]:= + (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or + (((((LandPixels[y,x] and GMask shr GShift) div 2)+((cExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or + (((((LandPixels[y,x] and BMask shr BShift) div 2)+((cExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift) + end; Land[y,x]:= lfBasic end else if ((((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0)) or @@ -778,12 +781,15 @@ (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0)) or (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))) then begin - if (LandPixels[y,x] = 0) then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (64 shl AShift) - else - LandPixels[y,x]:= - (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or - (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((cExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or - (((((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); + if (cReducedQuality and rqBlurryLand) = 0 then + begin + if (LandPixels[y,x] = 0) then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (64 shl AShift) + else + LandPixels[y,x]:= + (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or + (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((cExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or + (((((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) + end; Land[y,x]:= lfBasic end end