hedgewars/uLandGraphics.pas
changeset 4647 20b982afbe6e
parent 4640 bc30434ae156
child 4659 ce5897f53072
--- a/hedgewars/uLandGraphics.pas	Thu Dec 23 17:47:50 2010 +0100
+++ b/hedgewars/uLandGraphics.pas	Thu Dec 23 20:26:31 2010 +0100
@@ -198,12 +198,13 @@
            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;
+       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 - dy;
 if (t and LAND_HEIGHT_MASK) = 0 then
@@ -216,12 +217,13 @@
            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;
+       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
@@ -230,16 +232,17 @@
            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)
+               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
+       else if not isMap or ((Land[t, i] and lfObject) <> 0) then
+            begin
             if (cReducedQuality and rqBlurryLand) = 0 then
-          LandPixels[t, i]:= 0
+          	    LandPixels[t, i]:= 0
             else
-           LandPixels[t div 2, i div 2]:= 0;
+           	    LandPixels[t div 2, i div 2]:= 0
+            end;
 
 t:= y - dx;
 if (t and LAND_HEIGHT_MASK) = 0 then
@@ -252,12 +255,13 @@
            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;
+       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;
 FillLandCircleLinesBG:= cnt;
 end;
 
@@ -267,7 +271,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) <> 0) or ((Land[t, i] and lfObject) <> 0) then
+       if (Land[t, i] and (lfBasic or lfObject)) <> 0 then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
             LandPixels[t, i]:= cExplosionBorderColor
@@ -282,7 +286,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) <> 0) or ((Land[t, i] and lfObject) <> 0) then
+       if (Land[t, i] and (lfBasic or lfObject)) <> 0 then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
               LandPixels[t, i]:= cExplosionBorderColor
@@ -296,7 +300,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) <> 0) or ((Land[t, i] and lfObject) <> 0) then
+       if (Land[t, i] and (lfBasic or lfObject)) <> 0 then
            begin
            if (cReducedQuality and rqBlurryLand) = 0 then
            LandPixels[t, i]:= cExplosionBorderColor
@@ -311,7 +315,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) <> 0) or ((Land[t, i] and lfObject) <> 0) then
+       if (Land[t, i] and (lfBasic or lfObject)) <> 0 then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
           LandPixels[t, i]:= cExplosionBorderColor
@@ -414,12 +418,13 @@
                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
                 else
                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
-            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;
+            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;
     inc(y, dY)
     end;
 
@@ -430,7 +435,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) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then
+            if (Land[ty, tx] and (lfBasic or lfObject)) <> 0 then
                 begin
                     if (cReducedQuality and rqBlurryLand) = 0 then
                         LandPixels[ty, tx]:= cExplosionBorderColor
@@ -474,13 +479,12 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       (((Land[ty, tx] and lfBasic) <> 0) or
-       ((Land[ty, tx] and lfObject) <> 0)) then
+       ((Land[ty, tx] and (lfBasic or 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;
@@ -500,15 +504,13 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       (((Land[ty, tx] and lfBasic) <> 0) or
-       ((Land[ty, tx] and lfObject) <> 0)) then
+       ((Land[ty, tx] and (lfBasic or 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;
@@ -526,12 +528,13 @@
                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
                 else
                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
-            else
-              if (Land[ty, tx] and lfObject) <> 0 then
+            else if not isMap or ((Land[ty, tx] and lfObject) <> 0) then
+                begin
                 if (cReducedQuality and rqBlurryLand) = 0 then
-                LandPixels[ty, tx]:= 0
+                     LandPixels[ty, tx]:= 0
                 else
-                LandPixels[ty div 2, tx div 2]:= 0;
+                     LandPixels[ty div 2, tx div 2]:= 0
+                end;
 
             Land[ty, tx]:= 0;
             end
@@ -544,15 +547,13 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       (((Land[ty, tx] and lfBasic) <> 0) or
-       ((Land[ty, tx] and lfObject) <> 0)) then
+       ((Land[ty, tx] and (lfBasic or 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;
@@ -571,14 +572,13 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       (((Land[ty, tx] and lfBasic) <> 0) or
-       ((Land[ty, tx] and lfObject) <> 0)) then
+       ((Land[ty, tx] and (lfBasic or 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;
@@ -689,14 +689,16 @@
     if c < 4 then // 0-3 neighbours
         begin
         if (cReducedQuality and rqBlurryLand) = 0 then
+            begin
             if (Land[Y, X] and lfBasic) <> 0 then
                 LandPixels[Y, X]:= LandBackPixel(X, Y)
-            else
+            else if not isMap or ((Land[Y, X] and lfObject) <> 0) then
                 LandPixels[Y, X]:= 0
+            end
         else
             if (Land[Y, X] and lfBasic) <> 0 then
                 LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y)
-            else
+            else if not isMap or ((Land[Y, X] and lfObject) <> 0) then
                 LandPixels[Y div 2, X div 2]:= 0;
 
         Land[Y, X]:= 0;