hedgewars/uLand.pas
changeset 5717 6d513913b7a9
parent 5687 fac606654317
child 5718 e74de0528ef4
--- a/hedgewars/uLand.pas	Wed Aug 31 11:08:03 2011 -0400
+++ b/hedgewars/uLand.pas	Wed Aug 31 14:47:01 2011 -0400
@@ -30,6 +30,7 @@
 
 procedure initModule;
 procedure freeModule;
+procedure DrawBottomBorder;
 procedure GenMap;
 function  GenPreview: TPreview;
 
@@ -1222,6 +1223,25 @@
 LoadMask(mapname);
 end;
 
+procedure DrawBottomBorder; // broken out from other borders for doing a floor-only map, or possibly updating bottom during SD
+var x, y, w, c: Longword;
+begin
+for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade
+    for x:= leftX to rightX do
+        begin
+        Land[cWaterLine-1 - w, x]:= lfIndestructible;
+        if (x + w) mod 32 < 16 then
+            c:= AMask
+        else
+            c:= AMask or RMask or GMask; // FF00FFFF
+
+        if (cReducedQuality and rqBlurryLand) = 0 then
+            LandPixels[cWaterLine-1 - w, x]:= c
+        else
+            LandPixels[(cWaterLine-1 - w) div 2, x div 2]:= c
+        end;
+end;
+
 procedure GenMap;
 var x, y, w, c: Longword;
 begin
@@ -1272,7 +1292,7 @@
     for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade
         begin
         for y:= topY to LAND_HEIGHT - 1 do
-            begin
+                begin
                 Land[y, leftX + w]:= lfIndestructible;
                 Land[y, rightX - w]:= lfIndestructible;
                 if (y + w) mod 32 < 16 then
@@ -1281,33 +1301,35 @@
                     c:= AMask or RMask or GMask; // FF00FFFF
 
                 if (cReducedQuality and rqBlurryLand) = 0 then
-                begin
+                    begin
                     LandPixels[y, leftX + w]:= c;
                     LandPixels[y, rightX - w]:= c;
-                end
+                    end
                 else
-                begin
+                    begin
                     LandPixels[y div 2, (leftX + w) div 2]:= c;
                     LandPixels[y div 2, (rightX - w) div 2]:= c;
+                    end;
                 end;
-            end;
 
         for x:= leftX to rightX do
             begin
-                Land[topY + w, x]:= lfIndestructible;
-                if (x + w) mod 32 < 16 then
-                    c:= AMask
-                else
-                    c:= AMask or RMask or GMask; // FF00FFFF
+            Land[topY + w, x]:= lfIndestructible;
+            if (x + w) mod 32 < 16 then
+                c:= AMask
+            else
+                c:= AMask or RMask or GMask; // FF00FFFF
 
-                if (cReducedQuality and rqBlurryLand) = 0 then
-                    LandPixels[topY + w, x]:= c
-                else
-                    LandPixels[(topY + w) div 2, x div 2]:= c;
+            if (cReducedQuality and rqBlurryLand) = 0 then
+                LandPixels[topY + w, x]:= c
+            else
+                LandPixels[(topY + w) div 2, x div 2]:= c;
             end;
         end;
     end;
 
+if (GameFlags and gfBottomBorder) <> 0 then DrawBottomBorder;
+
 if (GameFlags and gfDisableGirders) <> 0 then hasGirders:= false;
 
 if ((GameFlags and gfForts) = 0)