hedgewars/uLandGraphics.pas
changeset 8601 7668f92734b8
parent 8598 9d21bab30893
child 8602 f510cca2b988
equal deleted inserted replaced
8599:6bd1950de78b 8601:7668f92734b8
   326                     begin
   326                     begin
   327                     px:= i div 2; py:= t div 2
   327                     px:= i div 2; py:= t div 2
   328                     end;
   328                     end;
   329                 if isLandscapeEdge(getPixelWeight(i, t)) then
   329                 if isLandscapeEdge(getPixelWeight(i, t)) then
   330                     begin
   330                     begin
   331                     if Land[t, i] > 255 then Land[t, i] := Land[t, i] or lfIce and not lfDamaged;
       
   332                     if (LandPixels[py, px] and AMask < 255) and (LandPixels[py, px] and AMask > 0) then
   331                     if (LandPixels[py, px] and AMask < 255) and (LandPixels[py, px] and AMask > 0) then
   333                         LandPixels[py, px] := (IceEdgeColor and not AMask) or (LandPixels[py, px] and AMask)
   332                         LandPixels[py, px] := (IceEdgeColor and not AMask) or (LandPixels[py, px] and AMask)
   334                     else if (LandPixels[py, px] and AMask < 255) or (Land[t, i] > 255) then
   333                     else if (LandPixels[py, px] and AMask < 255) or (Land[t, i] > 255) then
   335                         LandPixels[py, px] := IceEdgeColor
   334                         LandPixels[py, px] := IceEdgeColor
   336                     end
   335                     end
   337                 else if Land[t, i] > 255 then
   336                 else if Land[t, i] > 255 then
   338                     begin
   337                     begin
   339                     Land[t, i] := Land[t, i] or lfIce and not lfDamaged;
       
   340                     drawIcePixel(py, px)
   338                     drawIcePixel(py, px)
   341                     end
   339                     end
   342                 end
   340                 end;
       
   341                 if Land[t, i] > 255 then Land[t, i] := Land[t, i] or lfIce and not lfDamaged;
   343     end
   342     end
   344 end;
   343 end;
   345 
   344 
   346 procedure FillRoundInLandWithIce(X, Y, Radius: LongInt);
   345 procedure FillRoundInLandWithIce(X, Y, Radius: LongInt);
   347 var dx, dy, d: LongInt;
   346 var dx, dy, d: LongInt;
       
   347     landRect: TSDL_Rect;
   348 begin
   348 begin
   349 dx:= 0;
   349 dx:= 0;
   350 dy:= Radius;
   350 dy:= Radius;
   351 d:= 3 - 2 * Radius;
   351 d:= 3 - 2 * Radius;
   352     while (dx < dy) do
   352 while (dx < dy) do
   353         begin
   353     begin
   354         FillLandCircleLinesIce(x, y, dx, dy);
   354     FillLandCircleLinesIce(x, y, dx, dy);
   355         if (d < 0) then
   355     if (d < 0) then
   356             d:= d + 4 * dx + 6
   356         d:= d + 4 * dx + 6
   357         else
   357     else
   358             begin
   358         begin
   359             d:= d + 4 * (dx - dy) + 10;
   359         d:= d + 4 * (dx - dy) + 10;
   360             dec(dy)
   360         dec(dy)
   361             end;
   361         end;
   362         inc(dx)
   362     inc(dx)
   363         end;
   363     end;
   364     if (dx = dy) then
   364 if (dx = dy) then
   365         FillLandCircleLinesIce(x, y, dx, dy);
   365     FillLandCircleLinesIce(x, y, dx, dy);
       
   366 landRect.x := min(max(x - Radius, 0), LAND_WIDTH - 1);
       
   367 landRect.y := min(max(y - Radius, 0), LAND_HEIGHT - 1);
       
   368 landRect.w := min(2*Radius, LAND_WIDTH - landRect.x - 1);
       
   369 landRect.h := min(2*Radius, LAND_HEIGHT - landRect.y - 1);
       
   370 UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true);        
   366 end;
   371 end;
   367 
   372 
   368 
   373 
   369 function FillLandCircleLinesBG(x, y, dx, dy: LongInt): Longword;
   374 function FillLandCircleLinesBG(x, y, dx, dy: LongInt): Longword;
   370 var i, t, by, bx: LongInt;
   375 var i, t, by, bx: LongInt;