Fix basketball map and hog cannon.
authornemo
Sat, 13 Mar 2010 14:19:34 +0000
changeset 2981 d0471586a616
parent 2980 3cbd5a39aaee
child 2982 4213c6a8aceb
Fix basketball map and hog cannon.
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
--- a/hedgewars/uLand.pas	Fri Mar 12 20:36:12 2010 +0000
+++ b/hedgewars/uLand.pas	Sat Mar 13 14:19:34 2010 +0000
@@ -37,6 +37,7 @@
     LandDirty: TDirtyTag;
     hasBorder: boolean; 
     hasGirders: boolean;  
+    isMap: boolean;  
     playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword;  // idea is that a template can specify height/width.  Or, a map, a height/width by the dimensions of the image.  If the map has pixels near top of image, it triggers border.
     LandBackSurface: PSDL_Surface;
 
@@ -722,6 +723,7 @@
     s: shortstring;
     f: textfile;
 begin
+isMap:= true;
 WriteLnToConsole('Loading land from file...');
 AddProgress;
 tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/map', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps);
@@ -762,7 +764,7 @@
 hasBorder:= false;
 
 LoadThemeConfig;
-
+isMap:= false;
 if (GameFlags and gfForts) = 0 then
    if Pathz[ptMapCurrent] <> '' then LoadMap
                                 else GenLandSurface
--- a/hedgewars/uLandGraphics.pas	Fri Mar 12 20:36:12 2010 +0000
+++ b/hedgewars/uLandGraphics.pas	Sat Mar 13 14:19:34 2010 +0000
@@ -145,19 +145,19 @@
 begin
 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
-        if (Land[y + dy, i] <> COLOR_INDESTRUCTIBLE) then
+        if (not isMap and (Land[y + dy, i] <> COLOR_INDESTRUCTIBLE)) or (Land[y + dy, i] = COLOR_LAND) then
             LandPixels[y + dy, i]:= 0;
 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
-        if (Land[y - dy, i] <> COLOR_INDESTRUCTIBLE) then
+        if (not isMap and (Land[y - dy, i] <> COLOR_INDESTRUCTIBLE)) or (Land[y - dy, i] = COLOR_LAND) then
              LandPixels[y - dy, i]:= 0;
 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
-        if (Land[y + dx, i] <> COLOR_INDESTRUCTIBLE) then
+        if (not isMap and (Land[y + dx, i] <> COLOR_INDESTRUCTIBLE)) or (Land[y + dx, i] = COLOR_LAND) then
             LandPixels[y + dx, i]:= 0;
 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
-        if (Land[y - dx, i] <> COLOR_INDESTRUCTIBLE) then
+        if (not isMap and (Land[y - dx, i] <> COLOR_INDESTRUCTIBLE)) or (Land[y - dx, i] = COLOR_LAND) then
              LandPixels[y - dx, i]:= 0;
 end;
 
@@ -523,7 +523,7 @@
 function Despeckle(X, Y: LongInt): boolean;
 var nx, ny, i, j, c: LongInt;
 begin
-if (Land[Y, X] <> 0) and (Land[Y, X] <> COLOR_INDESTRUCTIBLE) and (LandPixels[Y, X] = cExplosionBorderColor)then // check neighbours
+if (Land[Y, X] > 255) and (Land[Y, X] <> COLOR_INDESTRUCTIBLE) and (LandPixels[Y, X] = cExplosionBorderColor)then // check neighbours
     begin
     c:= 0;
     for i:= -1 to 1 do