hedgewars/uLandGraphics.pas
changeset 4690 490cf71b436a
parent 4688 f63433ba3064
child 4695 ac2cb3b99d70
--- a/hedgewars/uLandGraphics.pas	Sun Dec 26 10:31:10 2010 -0500
+++ b/hedgewars/uLandGraphics.pas	Sun Dec 26 10:47:03 2010 -0500
@@ -185,14 +185,12 @@
 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 large and ((Land[t, i] and lfBasic) <> 0) then
+       if ((Land[t, i] and lfBasic) <> 0) then
            begin
            inc(cnt);
            if (cReducedQuality and rqBlurryLand) = 0 then
@@ -200,18 +198,17 @@
            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;
+       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 - dy;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-       if large and ((Land[t, i] and lfBasic) <> 0) then
+       if ((Land[t, i] and lfBasic) <> 0) then
            begin
            inc(cnt);
            if (cReducedQuality and rqBlurryLand) = 0 then
@@ -219,18 +216,35 @@
            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;
+       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 large and ((Land[t, i] and lfBasic) <> 0) then
+       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
            begin
            inc(cnt);
            if (cReducedQuality and rqBlurryLand) = 0 then
@@ -238,32 +252,12 @@
            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;
-
-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;
+       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;
 FillLandCircleLinesBG:= cnt;
 end;
 
@@ -273,7 +267,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 or lfObject)) <> 0 then
+       if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
             LandPixels[t, i]:= cExplosionBorderColor
@@ -288,7 +282,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 or lfObject)) <> 0 then
+       if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
               LandPixels[t, i]:= cExplosionBorderColor
@@ -302,7 +296,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 or lfObject)) <> 0 then
+       if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
            begin
            if (cReducedQuality and rqBlurryLand) = 0 then
            LandPixels[t, i]:= cExplosionBorderColor
@@ -317,7 +311,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 or lfObject)) <> 0 then
+       if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
           LandPixels[t, i]:= cExplosionBorderColor
@@ -420,13 +414,12 @@
                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
                 else
                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
-            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;
+            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;
     inc(y, dY)
     end;
 
@@ -437,7 +430,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 or lfObject)) <> 0 then
+            if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then
                 begin
                     if (cReducedQuality and rqBlurryLand) = 0 then
                         LandPixels[ty, tx]:= cExplosionBorderColor
@@ -481,12 +474,13 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
+       (((Land[ty, tx] and lfBasic) <> 0) or
+       ((Land[ty, tx] and 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;
@@ -506,13 +500,15 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
+       (((Land[ty, tx] and lfBasic) <> 0) or
+       ((Land[ty, tx] and 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;
@@ -530,13 +526,12 @@
                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
                 else
                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
-            else if not isMap or ((Land[ty, tx] and lfObject) <> 0) then
-                begin
+            else
+              if (Land[ty, tx] and lfObject) <> 0 then
                 if (cReducedQuality and rqBlurryLand) = 0 then
-                     LandPixels[ty, tx]:= 0
+                LandPixels[ty, tx]:= 0
                 else
-                     LandPixels[ty div 2, tx div 2]:= 0
-                end;
+                LandPixels[ty div 2, tx div 2]:= 0;
 
             Land[ty, tx]:= 0;
             end
@@ -549,13 +544,15 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
+       (((Land[ty, tx] and lfBasic) <> 0) or
+       ((Land[ty, tx] and 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;
@@ -574,13 +571,14 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
+       (((Land[ty, tx] and lfBasic) <> 0) or
+       ((Land[ty, tx] and 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;
@@ -691,16 +689,14 @@
     if c < 4 then // 0-3 neighbours
         begin
         if (cReducedQuality and rqBlurryLand) = 0 then
-            begin
-           (* if (Land[Y, X] and lfBasic) <> 0 then
+            if (Land[Y, X] and lfBasic) <> 0 then
                 LandPixels[Y, X]:= LandBackPixel(X, Y)
-            else if not isMap or ((Land[Y, X] and lfObject) <> 0) then*)
+            else
                 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 if not isMap or ((Land[Y, X] and lfObject) <> 0) then*)
+            else
                 LandPixels[Y div 2, X div 2]:= 0;
 
         Land[Y, X]:= 0;