hedgewars/uLandGraphics.pas
changeset 1849 2a989e5abda6
parent 1809 77923087a1ce
child 1861 98de5dc5fda7
equal deleted inserted replaced
1848:1eb88d41ccc6 1849:2a989e5abda6
   133 procedure FillLandCircleLines0(x, y, dx, dy: LongInt);
   133 procedure FillLandCircleLines0(x, y, dx, dy: LongInt);
   134 var i: LongInt;
   134 var i: LongInt;
   135 begin
   135 begin
   136 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   136 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   137     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do 
   137     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do 
   138         if Land[y + dy, i] <> COLOR_INDESTRUCTIBLE then
   138         if Land[y + dy, i] = COLOR_LAND then
   139             LandPixels[y + dy, i]:= 0;
   139             LandPixels[y + dy, i]:= 0;
   140 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
   140 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
   141     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do 
   141     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do 
   142         if Land[y - dy, i] <> COLOR_INDESTRUCTIBLE then
   142         if Land[y - dy, i] = COLOR_LAND then
   143              LandPixels[y - dy, i]:= 0;
   143              LandPixels[y - dy, i]:= 0;
   144 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
   144 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
   145     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do 
   145     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do 
   146         if Land[y + dx, i] <> COLOR_INDESTRUCTIBLE then
   146         if Land[y + dx, i] = COLOR_LAND then
   147             LandPixels[y + dx, i]:= 0;
   147             LandPixels[y + dx, i]:= 0;
   148 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
   148 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
   149     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do 
   149     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do 
   150         if Land[y - dx, i] <> COLOR_INDESTRUCTIBLE then
   150         if Land[y - dx, i] = COLOR_LAND then
   151              LandPixels[y - dx, i]:= 0;
   151              LandPixels[y - dx, i]:= 0;
   152 end;
   152 end;
   153 
   153 
   154 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt);
   154 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt);
   155 var i: LongInt;
   155 var i: LongInt;
   189 end;
   189 end;
   190 
   190 
   191 procedure DrawExplosion(X, Y, Radius: LongInt);
   191 procedure DrawExplosion(X, Y, Radius: LongInt);
   192 var dx, dy, ty, tx, d: LongInt;
   192 var dx, dy, ty, tx, d: LongInt;
   193 begin
   193 begin
   194 FillRoundInLand(X, Y, Radius, 0);
       
   195 
       
   196   dx:= 0;
   194   dx:= 0;
   197   dy:= Radius;
   195   dy:= Radius;
   198   d:= 3 - 2 * Radius;
   196   d:= 3 - 2 * Radius;
   199   while (dx < dy) do
   197   while (dx < dy) do
   200      begin
   198      begin
   206           dec(dy)
   204           dec(dy)
   207           end;
   205           end;
   208      inc(dx)
   206      inc(dx)
   209      end;
   207      end;
   210   if (dx = dy) then FillLandCircleLines0(x, y, dx, dy);
   208   if (dx = dy) then FillLandCircleLines0(x, y, dx, dy);
       
   209   // FillRoundInLand after erasing land pixels to allow Land 0 check for mask.png to function
       
   210   FillRoundInLand(X, Y, Radius, 0);
   211   inc(Radius, 4);
   211   inc(Radius, 4);
   212   dx:= 0;
   212   dx:= 0;
   213   dy:= Radius;
   213   dy:= Radius;
   214   d:= 3 - 2 * Radius;
   214   d:= 3 - 2 * Radius;
   215   while (dx < dy) do
   215   while (dx < dy) do
   237 begin
   237 begin
   238 for i:= 0 to Pred(Count) do
   238 for i:= 0 to Pred(Count) do
   239     begin
   239     begin
   240     for ty:= max(y - Radius, 0) to min(y + Radius, LAND_HEIGHT) do
   240     for ty:= max(y - Radius, 0) to min(y + Radius, LAND_HEIGHT) do
   241         for tx:= max(0, ar^[i].Left - Radius) to min(LAND_WIDTH, ar^[i].Right + Radius) do
   241         for tx:= max(0, ar^[i].Left - Radius) to min(LAND_WIDTH, ar^[i].Right + Radius) do
   242             if Land[ty, tx] <> COLOR_INDESTRUCTIBLE then
   242             if Land[ty, tx] = COLOR_LAND then
   243                 LandPixels[ty, tx]:= 0;
   243                 LandPixels[ty, tx]:= 0;
   244     inc(y, dY)
   244     inc(y, dY)
   245     end;
   245     end;
   246 
   246 
   247 inc(Radius, 4);
   247 inc(Radius, 4);