world edge tweakes/fixes
authorsheepluva
Thu, 11 Dec 2014 20:46:45 +0100
changeset 10661 0da243c01bde
parent 10660 79fa79c77c38
child 10662 e0d7d499c851
world edge tweakes/fixes
hedgewars/uConsts.pas
hedgewars/uLand.pas
--- a/hedgewars/uConsts.pas	Thu Dec 11 17:50:05 2014 +0100
+++ b/hedgewars/uConsts.pas	Thu Dec 11 20:46:45 2014 +0100
@@ -319,7 +319,7 @@
     kSystemSoundID_Vibrate = $00000FFF;
 
     cMinPlayWidth = 200;
-    cWorldEdgeDist = 150;
+    cWorldEdgeDist = 200;
 
 implementation
 
--- a/hedgewars/uLand.pas	Thu Dec 11 17:50:05 2014 +0100
+++ b/hedgewars/uLand.pas	Thu Dec 11 20:46:45 2014 +0100
@@ -578,10 +578,19 @@
 
 if hasBorder then
     begin
-    for y:= 0 to LAND_HEIGHT - 1 do
-        for x:= 0 to LAND_WIDTH - 1 do
-            if (y < topY) or (x < leftX) or (x > rightX) then
+    if WorldEdge = weNone then
+        begin
+        for y:= 0 to LAND_HEIGHT - 1 do
+            for x:= 0 to LAND_WIDTH - 1 do
+                if (y < topY) or (x < leftX) or (x > rightX) then
+                    Land[y, x]:= lfIndestructible;
+        end
+    else if topY > 0 then
+        begin
+        for y:= 0 to LongInt(topY) - 1 do
+            for x:= 0 to LAND_WIDTH - 1 do
                 Land[y, x]:= lfIndestructible;
+        end;
     // experiment hardcoding cave
     // also try basing cave dimensions on map/template dimensions, if they exist
     for w:= 0 to 5 do // width of 3 allowed hogs to be knocked through with grenade
@@ -666,7 +675,9 @@
 
 PrettifyLandAlpha();
 
-InitWorldEdges();
+// adjust world edges for borderless maps
+if (WorldEdge <> weNone) and (not hasBorder) then
+    InitWorldEdges();
 
 end;