Die speckles, round N. Check that alpha is not basically empty while blending, try to match the damaged land type.
authornemo
Fri, 26 Aug 2011 20:59:55 -0400
changeset 5687 fac606654317
parent 5686 3f2e6ec7719a
child 5688 fba59d6b5b6c
Die speckles, round N. Check that alpha is not basically empty while blending, try to match the damaged land type.
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
--- a/hedgewars/uLand.pas	Fri Aug 26 16:16:27 2011 -0400
+++ b/hedgewars/uLand.pas	Fri Aug 26 20:59:55 2011 -0400
@@ -1070,9 +1070,11 @@
             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)
+                    if (Land[y, x-1] = lfBasic) and (Land[y, x-1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x-1]
+                    else if (Land[y, x+1] = lfBasic) and (Land[y, x+1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x+1]
+                    else if (Land[y-1, x] = lfBasic) and (Land[y-1, x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y-1, x]
+                    else if (Land[y+1, x] = lfBasic) and (Land[y+1, x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y+1, x];
+                    if (((LandPixels[y,x] and AMask) shr AShift) > 10) then LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (128 shl AShift)
                     end;
                 Land[y,x]:= lfObject
             end
@@ -1088,11 +1090,11 @@
             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)
+                    if (Land[y, x-1] = lfBasic) and (Land[y,x-1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x-1]
+                    else if (Land[y, x+1] = lfBasic) and (Land[y,x+1] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y, x+1]
+                    else if (Land[y+1, x] = lfBasic) and (Land[y+1,x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y+1, x]
+                    else if (Land[y-1, x] = lfBasic) and (Land[y-1,x] and AMask <> 0) then LandPixels[y, x]:= LandPixels[y-1, x];
+                    if (((LandPixels[y,x] and AMask) shr AShift) > 10) then LandPixels[y,x]:= (LandPixels[y,x] and not AMask) or (64 shl AShift)
                     end;
                 Land[y,x]:= lfObject
             end;
--- a/hedgewars/uLandGraphics.pas	Fri Aug 26 16:16:27 2011 -0400
+++ b/hedgewars/uLandGraphics.pas	Fri Aug 26 20:59:55 2011 -0400
@@ -782,14 +782,16 @@
         begin
         if (cReducedQuality and rqBlurryLand) = 0 then
             begin
-            if (LandPixels[y,x] = 0) then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (128 shl AShift)
+            if ((LandPixels[y,x] and AMask) shr AShift) < 10 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
+        if (Land[y, x-1] = lfObject) then Land[y,x]:= lfObject
+        else if (Land[y, x+1] = lfObject) then Land[y,x]:= lfObject
+        else 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
             (((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
@@ -802,14 +804,18 @@
         begin
         if (cReducedQuality and rqBlurryLand) = 0 then
             begin
-            if (LandPixels[y,x] = 0) then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (64 shl AShift)
+            if ((LandPixels[y,x] and AMask) shr AShift) < 10 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
+        if (Land[y, x-1] = lfObject) then Land[y, x]:= lfObject
+        else if (Land[y, x+1] = lfObject) then Land[y, x]:= lfObject
+        else if (Land[y+1, x] = lfObject) then Land[y, x]:= lfObject
+        else if (Land[y-1, x] = lfObject) then Land[y, x]:= lfObject
+        else Land[y,x]:= lfBasic
         end
     end
 end;