# HG changeset patch # User nemo # Date 1307052530 14400 # Node ID d38211100f4dda191981863acdd6a4f761dfcfe5 # Parent 6e8fbbfb0de54078fd7d4ef314190b45a4ed8ce0 Experiment in making the land less jagg-y diff -r 6e8fbbfb0de5 -r d38211100f4d hedgewars/uLand.pas --- a/hedgewars/uLand.pas Mon May 30 01:14:25 2011 +0200 +++ b/hedgewars/uLand.pas Thu Jun 02 18:08:50 2011 -0400 @@ -1039,6 +1039,7 @@ procedure GenLandSurface; var tmpsurf: PSDL_Surface; + x,y: Longword; begin WriteLnToConsole('Generating land...'); case cMapGen of @@ -1057,7 +1058,33 @@ AddOnLandObjects(tmpsurf); 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] <> 0) and ((Land[y+1,x]<>0)) or (Land[y-1,x]<>0)) or + ((Land[y, x+1] <> 0) and ((Land[y-1,x]<>0) or (Land[y+1,x]<>0)))) then + begin + if Land[y, x-1] <> 0 then LandPixels[y, x]:= LandPixels[y, x-1] + else if Land[y, x+1] <> 0 then LandPixels[y, x]:= LandPixels[y, x+1]; + LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift) + end + else if (Land[y, x] = 0) and + (((Land[y, x-1] <> 0) and (Land[y+1,x-1]<>0) and (Land[y+2,x]<>0)) or + ((Land[y, x-1] <> 0) and (Land[y-1,x-1]<>0) and (Land[y-2,x]<>0)) or + ((Land[y, x+1] <> 0) and (Land[y+1,x+1]<>0) and (Land[y+2,x]<>0)) or + ((Land[y, x+1] <> 0) and (Land[y-1,x+1]<>0) and (Land[y-2,x]<>0)) or + ((Land[y+1, x] <> 0) and (Land[y+1,x+1]<>0) and (Land[y,x+2]<>0)) or + ((Land[y-1, x] <> 0) and (Land[y-1,x+1]<>0) and (Land[y,x+2]<>0)) or + ((Land[y+1, x] <> 0) and (Land[y+1,x-1]<>0) and (Land[y,x-2]<>0)) or + ((Land[y-1, x] <> 0) and (Land[y-1,x-1]<>0) and (Land[y,x-2]<>0))) then + begin + if Land[y, x-1] <> 0 then LandPixels[y, x]:= LandPixels[y, x-1] + else if Land[y, x+1] <> 0 then LandPixels[y, x]:= LandPixels[y, x+1] + else if Land[y+1, x] <> 0 then LandPixels[y, x]:= LandPixels[y+1, x] + else if Land[y-1, x] <> 0 then LandPixels[y, x]:= LandPixels[y-1, x]; + LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift) + end; AddProgress(); end; diff -r 6e8fbbfb0de5 -r d38211100f4d hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Mon May 30 01:14:25 2011 +0200 +++ b/hedgewars/uLandObjects.pas Thu Jun 02 18:08:50 2011 -0400 @@ -88,11 +88,13 @@ begin if (cReducedQuality and rqBlurryLand) = 0 then begin - if LandPixels[cpY + y, cpX + x] = 0 then + if (LandPixels[cpY + y, cpX + x] = 0) or + (((p^[x] and AMask) <> 0) and (((LandPixels[cpY + y, cpX + x] and AMask) shr AShift) < 255)) then LandPixels[cpY + y, cpX + x]:= p^[x]; end else - if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then + if (LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0) or + (((p^[x] and AMask) <> 0) and (((LandPixels[(cpY + y) div 2, (cpX + x) div 2] and AMask) shr AShift) < 255)) 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