hedgewars/uLandGraphics.pas
changeset 10510 9329dab04490
parent 10490 b30b8d39d662
child 10541 7b74aa1bb58d
equal deleted inserted replaced
10509:d62d3c706947 10510:9329dab04490
   658 case bpp of
   658 case bpp of
   659     4: for y:= 0 to Pred(h) do
   659     4: for y:= 0 to Pred(h) do
   660         begin
   660         begin
   661         for x:= 0 to Pred(w) do
   661         for x:= 0 to Pred(w) do
   662             if ((PLongword(@(p^[x * 4]))^) and AMask) <> 0 then
   662             if ((PLongword(@(p^[x * 4]))^) and AMask) <> 0 then
   663                 if (outOfMap and 
   663                 if (outOfMap and
   664                    ((cpY + y) < LAND_HEIGHT) and ((cpY + y) >= 0) and
   664                    ((cpY + y) < LAND_HEIGHT) and ((cpY + y) >= 0) and
   665                    ((cpX + x) < LAND_WIDTH) and ((cpX + x) >= 0) and
   665                    ((cpX + x) < LAND_WIDTH) and ((cpX + x) >= 0) and
   666                    ((not force) and (Land[cpY + y, cpX + x] <> 0))) or
   666                    ((not force) and (Land[cpY + y, cpX + x] <> 0))) or
   667 
   667 
   668                    (not outOfMap and
   668                    (not outOfMap and
   669                        (((cpY + y) <= Longint(topY)) or ((cpY + y) >= LAND_HEIGHT) or
   669                        (((cpY + y) <= Longint(topY)) or ((cpY + y) >= LAND_HEIGHT) or
   670                        ((cpX + x) <= Longint(leftX)) or ((cpX + x) >= Longint(rightX)) or 
   670                        ((cpX + x) <= Longint(leftX)) or ((cpX + x) >= Longint(rightX)) or
   671                        ((not force) and (Land[cpY + y, cpX + x] <> 0)))) then
   671                        ((not force) and (Land[cpY + y, cpX + x] <> 0)))) then
   672                    begin
   672                    begin
   673                    if SDL_MustLock(Image) then
   673                    if SDL_MustLock(Image) then
   674                        SDL_UnlockSurface(Image);
   674                        SDL_UnlockSurface(Image);
   675                    exit
   675                    exit
  1093 
  1093 
  1094 function DrawDots(x, y, xx, yy: Longint; Color: Longword): Longword; inline;
  1094 function DrawDots(x, y, xx, yy: Longint; Color: Longword): Longword; inline;
  1095 begin
  1095 begin
  1096     DrawDots:= 0;
  1096     DrawDots:= 0;
  1097 
  1097 
  1098     if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x + xx] <> Color) then 
  1098     if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x + xx] <> Color) then
  1099         begin inc(DrawDots); Land[y + yy, x + xx]:= Color; end;
  1099         begin inc(DrawDots); Land[y + yy, x + xx]:= Color; end;
  1100     if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x + xx] <> Color) then 
  1100     if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x + xx] <> Color) then
  1101         begin inc(DrawDots); Land[y - yy, x + xx]:= Color; end;
  1101         begin inc(DrawDots); Land[y - yy, x + xx]:= Color; end;
  1102     if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x - xx] <> Color) then 
  1102     if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x - xx] <> Color) then
  1103         begin inc(DrawDots); Land[y + yy, x - xx]:= Color; end;
  1103         begin inc(DrawDots); Land[y + yy, x - xx]:= Color; end;
  1104     if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x - xx] <> Color) then 
  1104     if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x - xx] <> Color) then
  1105         begin inc(DrawDots); Land[y - yy, x - xx]:= Color; end;
  1105         begin inc(DrawDots); Land[y - yy, x - xx]:= Color; end;
  1106     if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (Land[y + xx, x + yy] <> Color) then 
  1106     if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (Land[y + xx, x + yy] <> Color) then
  1107         begin inc(DrawDots); Land[y + xx, x + yy]:= Color; end;
  1107         begin inc(DrawDots); Land[y + xx, x + yy]:= Color; end;
  1108     if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (Land[y - xx, x + yy] <> Color) then 
  1108     if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (Land[y - xx, x + yy] <> Color) then
  1109         begin inc(DrawDots); Land[y - xx, x + yy]:= Color; end;
  1109         begin inc(DrawDots); Land[y - xx, x + yy]:= Color; end;
  1110     if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (Land[y + xx, x - yy] <> Color) then 
  1110     if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (Land[y + xx, x - yy] <> Color) then
  1111         begin inc(DrawDots); Land[y + xx, x - yy]:= Color; end;
  1111         begin inc(DrawDots); Land[y + xx, x - yy]:= Color; end;
  1112     if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (Land[y - xx, x - yy] <> Color) then 
  1112     if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (Land[y - xx, x - yy] <> Color) then
  1113         begin inc(DrawDots); Land[y - xx, x - yy]:= Color; end;
  1113         begin inc(DrawDots); Land[y - xx, x - yy]:= Color; end;
  1114 end;
  1114 end;
  1115 
  1115 
  1116 function DrawLines(X1, Y1, X2, Y2, XX, YY: LongInt; color: Longword): Longword;
  1116 function DrawLines(X1, Y1, X2, Y2, XX, YY: LongInt; color: Longword): Longword;
  1117 var
  1117 var