Ignore:
Timestamp:
May 9, 2020, 4:02:07 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved HighDPI branch. Imported new changes from trunk branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/IsoEngine.pas

    r179 r210  
    55
    66uses
    7   Protocol, ClientTools, ScreenTools, Tribes, UDpiControls,
    8 {$IFNDEF SCR}Term, {$ENDIF}
    9   LCLIntf, LCLType, SysUtils, Classes, Graphics;
     7  UDpiControls, Protocol, ClientTools, ScreenTools, Tribes, {$IFNDEF SCR}Term, {$ENDIF}
     8  LCLIntf, LCLType, SysUtils, Classes, Graphics, UPixelPointer;
    109
    1110type
     
    2423    procedure PaintCity(x, y: integer; const CityInfo: TCityInfo;
    2524      accessory: boolean = true);
    26     procedure BitBlt(Src: TDpiBitmap; x, y, Width, Height, xSrc, ySrc,
     25    procedure BitBltBitmap(Src: TDpiBitmap; x, y, Width, Height, xSrc, ySrc,
    2726      Rop: integer);
    2827
     
    4039    FLeft, FTop, FRight, FBottom, RealTop, RealBottom, AttLoc, DefLoc,
    4140      DefHealth, FAdviceLoc: integer;
    42     DataDC, MaskDC: HDC;
     41    DataCanvas: TDpiCanvas;
     42    MaskCanvas: TDpiCanvas;
    4343    function Connection4(Loc, Mask, Value: integer): integer;
    4444    function Connection8(Loc, Mask: integer): integer;
     
    8989
    9090  // sprites indexes
    91   spDeadLands = 2 * TerrainIconCols + 6;
     91  spRow2 = 2 * TerrainIconCols + 6;
    9292  spBlink1 = 1 * TerrainIconCols + 8;
    9393  spBlink2 = 2 * TerrainIconCols + 8;
     
    107107  spPollution = 12 * TerrainIconCols + 6;
    108108  spFortBack = 12 * TerrainIconCols + 7;
     109  spMinerals = 12 * TerrainIconCols + 8;
    109110  spRiver = 13 * TerrainIconCols;
     111  spRiverMouths = 15 * TerrainIconCols;
     112  spGrid = 15 * TerrainIconCols + 6;
    110113  spJungle = 18 * TerrainIconCols;
     114  spCanalMouths = 20 * TerrainIconCols;
    111115
    112116var
     
    137141  i, x, y, xSrc, ySrc, HGrTerrainNew, HGrCitiesNew, age, size: integer;
    138142  LandMore, OceanMore, DitherMask, Mask24: TDpiBitmap;
    139   MaskLine: array [0 .. 32 * 3 - 1] of TPixelPointer; // 32 = assumed maximum for yyt
     143  MaskLine: array [0 .. 50 * 3 - 1] of TPixelPointer; // 32 = assumed maximum for yyt
    140144  Border: boolean;
    141145begin
     
    191195  DitherMask.SetSize(xxt * 2, yyt * 2);
    192196  DitherMask.Canvas.FillRect(0, 0, DitherMask.Width, DitherMask.Height);
    193   BitBlt(DitherMask.Canvas.Handle, 0, 0, xxt * 2, yyt * 2,
    194     GrExt[HGrTerrain].Mask.Canvas.Handle, 1 + 7 * (xxt * 2 + 1),
     197  DpiBitCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt * 2,
     198    GrExt[HGrTerrain].Mask.Canvas, 1 + 7 * (xxt * 2 + 1),
    195199    1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    196200
     
    213217    end;
    214218    for y := -1 to 6 do
    215       BitBlt(LandPatch.Canvas.Handle, (x + 2) * (xxt * 2), (y + 2) * yyt,
    216         xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas.Handle, xSrc, ySrc,
    217         SRCCOPY);
     219      DpiBitCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
     220        xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);
    218221    for y := -2 to 6 do
    219       BitBlt(LandPatch.Canvas.Handle, (x + 2) * (xxt * 2), (y + 2) * yyt, xxt,
    220         yyt, GrExt[HGrTerrain].Data.Canvas.Handle, xSrc + xxt, ySrc + yyt,
     222      DpiBitCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt, xxt,
     223        yyt, GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,
    221224        SRCPAINT);
    222225    for y := -2 to 6 do
    223       BitBlt(LandPatch.Canvas.Handle, (x + 2) * (xxt * 2) + xxt, (y + 2) * yyt,
    224         xxt, yyt, GrExt[HGrTerrain].Data.Canvas.Handle, xSrc, ySrc + yyt,
     226      DpiBitCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2) + xxt, (y + 2) * yyt,
     227        xxt, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt,
    225228        SRCPAINT);
    226229    for y := -2 to 6 do
    227       BitBlt(LandPatch.Canvas.Handle, (x + 2) * (xxt * 2), (y + 2) * yyt, xxt,
    228         yyt, DitherMask.Canvas.Handle, xxt, yyt, SRCAND);
     230      DpiBitCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt, xxt,
     231        yyt, DitherMask.Canvas, xxt, yyt, SRCAND);
    229232    for y := -2 to 6 do
    230       BitBlt(LandPatch.Canvas.Handle, (x + 2) * (xxt * 2) + xxt, (y + 2) * yyt,
    231         xxt, yyt, DitherMask.Canvas.Handle, 0, yyt, SRCAND);
     233      DpiBitCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2) + xxt, (y + 2) * yyt,
     234        xxt, yyt, DitherMask.Canvas, 0, yyt, SRCAND);
    232235  end;
    233236
     
    250253    end;
    251254    for x := -2 to 6 do
    252       BitBlt(LandMore.Canvas.Handle, (x + 2) * (xxt * 2), (y + 2) * yyt,
    253         xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas.Handle, xSrc, ySrc,
    254         SRCCOPY);
    255     BitBlt(LandMore.Canvas.Handle, xxt * 2, (y + 2) * yyt, xxt, yyt,
    256       GrExt[HGrTerrain].Data.Canvas.Handle, xSrc + xxt, ySrc + yyt, SRCPAINT);
     255      DpiBitCanvas(LandMore.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
     256        xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);
     257    DpiBitCanvas(LandMore.Canvas, xxt * 2, (y + 2) * yyt, xxt, yyt,
     258      GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt, SRCPAINT);
    257259    for x := 0 to 7 do
    258       BitBlt(LandMore.Canvas.Handle, (x + 2) * (xxt * 2) - xxt, (y + 2) * yyt,
    259         xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas.Handle, xSrc, ySrc + yyt,
     260      DpiBitCanvas(LandMore.Canvas, (x + 2) * (xxt * 2) - xxt, (y + 2) * yyt,
     261        xxt * 2, yyt, GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt,
    260262        SRCPAINT);
    261263    for x := -2 to 6 do
    262       BitBlt(LandMore.Canvas.Handle, (x + 2) * (xxt * 2), (y + 2) * yyt,
    263         xxt * 2, yyt, DitherMask.Canvas.Handle, 0, 0, SRCAND);
     264      DpiBitCanvas(LandMore.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
     265        xxt * 2, yyt, DitherMask.Canvas, 0, 0, SRCAND);
    264266  end;
    265267
     
    273275      ySrc := 1 + yyt;
    274276      if (x >= 1) = (y >= 2) then
    275         BitBlt(OceanPatch.Canvas.Handle, x * (xxt * 2), y * yyt, xxt * 2, yyt,
    276           GrExt[HGrTerrain].Data.Canvas.Handle, xSrc, ySrc, SRCCOPY);
     277        DpiBitCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     278          GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);
    277279      if (x >= 1) and ((y < 2) or (x >= 2)) then
    278280      begin
    279         BitBlt(OceanPatch.Canvas.Handle, x * (xxt * 2), y * yyt, xxt, yyt,
    280           GrExt[HGrTerrain].Data.Canvas.Handle, xSrc + xxt, ySrc + yyt,
     281        DpiBitCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
     282          GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,
    281283          SRCPAINT);
    282         BitBlt(OceanPatch.Canvas.Handle, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
    283           GrExt[HGrTerrain].Data.Canvas.Handle, xSrc, ySrc + yyt, SRCPAINT);
     284        DpiBitCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
     285          GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);
    284286      end;
    285       BitBlt(OceanPatch.Canvas.Handle, x * (xxt * 2), y * yyt, xxt, yyt,
    286         DitherMask.Canvas.Handle, xxt, yyt, SRCAND);
    287       BitBlt(OceanPatch.Canvas.Handle, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
    288         DitherMask.Canvas.Handle, 0, yyt, SRCAND);
     287      DpiBitCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
     288        DitherMask.Canvas, xxt, yyt, SRCAND);
     289      DpiBitCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
     290        DitherMask.Canvas, 0, yyt, SRCAND);
    289291    end;
    290292
     
    298300      ySrc := 1 + yyt;
    299301      if (x < 1) or (y >= 2) then
    300         BitBlt(OceanMore.Canvas.Handle, x * (xxt * 2), y * yyt, xxt * 2, yyt,
    301           GrExt[HGrTerrain].Data.Canvas.Handle, xSrc, ySrc, SRCCOPY);
     302        DpiBitCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     303          GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc);
    302304      if (x = 1) and (y < 2) or (x >= 2) and (y >= 1) then
    303305      begin
    304         BitBlt(OceanMore.Canvas.Handle, x * (xxt * 2), y * yyt, xxt, yyt,
    305           GrExt[HGrTerrain].Data.Canvas.Handle, xSrc + xxt, ySrc + yyt,
     306        DpiBitCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
     307          GrExt[HGrTerrain].Data.Canvas, xSrc + xxt, ySrc + yyt,
    306308          SRCPAINT);
    307         BitBlt(OceanMore.Canvas.Handle, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
    308           GrExt[HGrTerrain].Data.Canvas.Handle, xSrc, ySrc + yyt, SRCPAINT);
     309        DpiBitCanvas(OceanMore.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
     310          GrExt[HGrTerrain].Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);
    309311      end;
    310       BitBlt(OceanMore.Canvas.Handle, x * (xxt * 2), y * yyt, xxt * 2, yyt,
    311         DitherMask.Canvas.Handle, 0, 0, SRCAND);
     312      DpiBitCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     313        DitherMask.Canvas, 0, 0, SRCAND);
    312314    end;
    313315
    314   BitBlt(DitherMask.Canvas.Handle, 0, 0, xxt * 2, yyt * 2,
    315     DitherMask.Canvas.Handle, 0, 0, DSTINVERT); { invert dither mask }
    316   BitBlt(DitherMask.Canvas.Handle, 0, 0, xxt * 2, yyt * 2,
    317     GrExt[HGrTerrain].Mask.Canvas.Handle, 1, 1 + yyt, SRCPAINT);
     316  DpiBitCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt * 2,
     317    DitherMask.Canvas, 0, 0, DSTINVERT); { invert dither mask }
     318  DpiBitCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt * 2,
     319    GrExt[HGrTerrain].Mask.Canvas, 1, 1 + yyt, SRCPAINT);
    318320
    319321  for x := -1 to 6 do
    320322    for y := -2 to 6 do
    321       BitBlt(LandPatch.Canvas.Handle, (x + 2) * (xxt * 2), (y + 2) * yyt,
    322         xxt * 2, yyt, DitherMask.Canvas.Handle, 0, 0, SRCAND);
     323      DpiBitCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
     324        xxt * 2, yyt, DitherMask.Canvas, 0, 0, SRCAND);
    323325
    324326  for y := -1 to 6 do
    325327    for x := -2 to 7 do
    326       BitBlt(LandMore.Canvas.Handle, (x + 2) * (xxt * 2) - xxt, (y + 2) * yyt,
    327         xxt * 2, yyt, DitherMask.Canvas.Handle, 0, yyt, SRCAND);
    328 
    329   BitBlt(LandPatch.Canvas.Handle, 0, 0, (xxt * 2) * 9, yyt * 9,
    330     LandMore.Canvas.Handle, 0, 0, SRCPAINT);
     328      DpiBitCanvas(LandMore.Canvas, (x + 2) * (xxt * 2) - xxt, (y + 2) * yyt,
     329        xxt * 2, yyt, DitherMask.Canvas, 0, yyt, SRCAND);
     330
     331  DpiBitCanvas(LandPatch.Canvas, 0, 0, (xxt * 2) * 9, yyt * 9,
     332    LandMore.Canvas, 0, 0, SRCPAINT);
    331333
    332334  for x := 0 to 3 do
    333335    for y := 0 to 3 do
    334       BitBlt(OceanPatch.Canvas.Handle, x * (xxt * 2), y * yyt, xxt * 2, yyt,
    335         DitherMask.Canvas.Handle, 0, 0, SRCAND);
     336      DpiBitCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     337        DitherMask.Canvas, 0, 0, SRCAND);
    336338
    337339  for y := 0 to 3 do
    338340    for x := 0 to 4 do
    339       BitBlt(OceanMore.Canvas.Handle, x * (xxt * 2) - xxt, y * yyt, xxt * 2,
    340         yyt, DitherMask.Canvas.Handle, 0, yyt, SRCAND);
    341 
    342   BitBlt(OceanPatch.Canvas.Handle, 0, 0, (xxt * 2) * 4, yyt * 4,
    343     OceanMore.Canvas.Handle, 0, 0, SRCPAINT);
     341      DpiBitCanvas(OceanMore.Canvas, x * (xxt * 2) - xxt, y * yyt, xxt * 2,
     342        yyt, DitherMask.Canvas, 0, yyt, SRCAND);
     343
     344  DpiBitCanvas(OceanPatch.Canvas, 0, 0, (xxt * 2) * 4, yyt * 4,
     345    OceanMore.Canvas, 0, 0, SRCPAINT);
    344346
    345347  with DitherMask.Canvas do
     
    348350    FillRect(Rect(0, 0, xxt * 2, yyt));
    349351  end;
    350   BitBlt(DitherMask.Canvas.Handle, 0, 0, xxt * 2, yyt,
    351     GrExt[HGrTerrain].Mask.Canvas.Handle, 1, 1 + yyt, SRCCOPY);
     352  DpiBitCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt,
     353    GrExt[HGrTerrain].Mask.Canvas, 1, 1 + yyt);
    352354
    353355  for x := 0 to 6 do
    354     BitBlt(LandPatch.Canvas.Handle, (x + 2) * (xxt * 2), yyt, xxt * 2, yyt,
    355       DitherMask.Canvas.Handle, 0, 0, SRCAND);
    356   BitBlt(DitherMask.Canvas.Handle, 0, 0, xxt * 2, yyt, DitherMask.Canvas.Handle,
     356    DpiBitCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), yyt, xxt * 2, yyt,
     357      DitherMask.Canvas, 0, 0, SRCAND);
     358  DpiBitCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt, DitherMask.Canvas,
    357359    0, 0, DSTINVERT);
    358360
    359361  for y := 0 to 6 do
    360     BitBlt(LandPatch.Canvas.Handle, xxt * 2, (y + 2) * yyt, xxt * 2, yyt,
    361       DitherMask.Canvas.Handle, 0, 0, SRCAND);
     362    DpiBitCanvas(LandPatch.Canvas, xxt * 2, (y + 2) * yyt, xxt * 2, yyt,
     363      DitherMask.Canvas, 0, 0, SRCAND);
    362364
    363365  LandMore.Free;
     
    373375  begin
    374376    for i := 0 to yyt * 3 - 1 do
    375       MaskLine[i].Init(Mask24, 0, 1 + ySrc * (yyt * 3 + 1) + i);
     377      MaskLine[i] := PixelPointer(Mask24, 0, 1 + ySrc * (yyt * 3 + 1) + i);
    376378    for xSrc := 0 to 9 - 1 do
    377379    begin
     
    422424  Borders := TDpiBitmap.Create;
    423425  Borders.PixelFormat := pf24bit;
    424   Borders.SetSize(xxt * 2,(yyt * 2) * nPl);
     426  Borders.SetSize(xxt * 2, (yyt * 2) * nPl);
    425427  Borders.Canvas.FillRect(0, 0, Borders.Width, Borders.Height);
    426428  BordersOK := 0;
     
    474476  begin
    475477    Width := Width - (FLeft - x);
    476     x := FLeft
     478    x := FLeft;
    477479  end;
    478480  if y < FTop then
    479481  begin
    480482    Height := Height - (FTop - y);
    481     y := FTop
     483    y := FTop;
    482484  end;
    483485  if x + Width >= FRight then
     
    499501end;
    500502
    501 procedure TIsoMap.BitBlt(Src: TDpiBitmap; x, y, Width, Height, xSrc, ySrc,
     503procedure TIsoMap.BitBltBitmap(Src: TDpiBitmap; x, y, Width, Height, xSrc, ySrc,
    502504  Rop: integer);
    503505begin
     
    506508    Width := Width - (FLeft - x);
    507509    xSrc := xSrc + (FLeft - x);
    508     x := FLeft
     510    x := FLeft;
    509511  end;
    510512  if y < FTop then
     
    512514    Height := Height - (FTop - y);
    513515    ySrc := ySrc + (FTop - y);
    514     y := FTop
     516    y := FTop;
    515517  end;
    516518  if x + Width >= FRight then
     
    521523    exit;
    522524
    523   DpiBitBlt(FOutput.Canvas.Handle, x, y, Width, Height, Src.Canvas.Handle,
    524     xSrc, ySrc, Rop);
     525  DpiBitCanvas(FOutput.Canvas, x, y, Width, Height, Src.Canvas, xSrc, ySrc, Rop);
    525526end;
    526527
    527528procedure TIsoMap.Sprite(HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
    528529begin
    529   BitBlt(GrExt[HGr].Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND);
    530   BitBlt(GrExt[HGr].Data, xDst, yDst, Width, Height, xGr, yGr, SRCPAINT);
     530  BitBltBitmap(GrExt[HGr].Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND);
     531  BitBltBitmap(GrExt[HGr].Data, xDst, yDst, Width, Height, xGr, yGr, SRCPAINT);
    531532end;
    532533
     
    561562    exit;
    562563
    563   DpiBitBlt(FOutput.Canvas.Handle, xDst, yDst, Width, Height, MaskDC, xSrc, ySrc, SRCAND);
     564  DpiBitCanvas(FOutput.Canvas, xDst, yDst, Width, Height, MaskCanvas, xSrc, ySrc, SRCAND);
    564565  if not PureBlack then
    565     DpiBitBlt(FOutput.Canvas.Handle, xDst, yDst, Width, Height, DataDC, xSrc, ySrc,
    566       SRCPAINT);
     566    DpiBitCanvas(FOutput.Canvas, xDst, yDst, Width, Height, DataCanvas, xSrc, ySrc, SRCPAINT);
    567567end;
    568568
     
    612612        xGr := 121 + j mod 7 * 9;
    613613        yGr := 1 + j div 7 * 9;
    614         BitBlt(GrExt[HGrSystem].Mask, x + xsh + 3, y + ysh + 9, 8, 8, xGr,
     614        BitBltBitmap(GrExt[HGrSystem].Mask, x + xsh + 3, y + ysh + 9, 8, 8, xGr,
    615615          yGr, SRCAND);
    616616        Sprite(HGrSystem, x + xsh + 2, y + ysh + 8, 8, 8, xGr, yGr);
     
    620620      if Flags and unFortified <> 0 then
    621621      begin
    622         { DataDC:=GrExt[HGrTerrain].Data.Canvas.Handle;
    623           MaskDC:=GrExt[HGrTerrain].Mask.Canvas.Handle;
     622        { DataCanvas:=GrExt[HGrTerrain].Data.Canvas;
     623          MaskCanvas:=GrExt[HGrTerrain].Mask.Canvas;
    624624          TSprite(x,y+16,12*9+7); }
    625625        Sprite(HGrStdUnits, x, y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1);
    626       end
    627     end
     626      end;
     627    end;
    628628end; { PaintUnit }
    629629
     
    819819    exit;
    820820
    821   BitBlt(GrExt[HGrTerrain].Data, x + xxt div 2, y, xxt, yyt,
     821  BitBltBitmap(GrExt[HGrTerrain].Data, x + xxt div 2, y, xxt, yyt,
    822822    1 + (Conn shr 6 + Conn and 1 shl 2) * (xxt * 2 + 1),
    823823    1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    824   BitBlt(GrExt[HGrTerrain].Data, x + xxt, y + yyt div 2, xxt, yyt,
     824  BitBltBitmap(GrExt[HGrTerrain].Data, x + xxt, y + yyt div 2, xxt, yyt,
    825825    1 + (Conn and 7) * (xxt * 2 + 1) + xxt,
    826826    1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    827   BitBlt(GrExt[HGrTerrain].Data, x + xxt div 2, y + yyt, xxt, yyt,
     827  BitBltBitmap(GrExt[HGrTerrain].Data, x + xxt div 2, y + yyt, xxt, yyt,
    828828    1 + (Conn shr 2 and 7) * (xxt * 2 + 1) + xxt,
    829829    1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    830   BitBlt(GrExt[HGrTerrain].Data, x, y + yyt div 2, xxt, yyt,
     830  BitBltBitmap(GrExt[HGrTerrain].Data, x, y + yyt div 2, xxt, yyt,
    831831    1 + (Conn shr 4 and 7) * (xxt * 2 + 1),
    832832    1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    833833  Conn := Connection4(Loc, fTerrain, fUNKNOWN); { dither to black }
    834834  if Conn and 1 <> 0 then
    835     BitBlt(GrExt[HGrTerrain].Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +
     835    BitBltBitmap(GrExt[HGrTerrain].Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +
    836836      xxt, 1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    837837  if Conn and 2 <> 0 then
    838     BitBlt(GrExt[HGrTerrain].Mask, x + xxt, y + yyt, xxt, yyt,
     838    BitBltBitmap(GrExt[HGrTerrain].Mask, x + xxt, y + yyt, xxt, yyt,
    839839      1 + 7 * (xxt * 2 + 1) + xxt, 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND);
    840840  if Conn and 4 <> 0 then
    841     BitBlt(GrExt[HGrTerrain].Mask, x, y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
     841    BitBltBitmap(GrExt[HGrTerrain].Mask, x, y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
    842842      1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND);
    843843  if Conn and 8 <> 0 then
    844     BitBlt(GrExt[HGrTerrain].Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
     844    BitBltBitmap(GrExt[HGrTerrain].Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
    845845      1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    846846end;
     
    876876  end
    877877  else if Tile and fDeadLands <> 0 then
    878     TSprite(x, y, spDeadLands);
     878    TSprite(x, y, spRow2);
    879879
    880880  if ShowObjects then
     
    898898    for Dir := 0 to 3 do
    899899      if Conn and (1 shl Dir) <> 0 then { river mouths }
    900         TSprite(x, y, 15 * TerrainIconCols + Dir);
     900        TSprite(x, y, spRiverMouths + Dir);
    901901    if ShowObjects then
    902902    begin
     
    904904      for Dir := 0 to 7 do
    905905        if Conn and (1 shl Dir) <> 0 then { canal mouths }
    906           TSprite(x, y, 20 * TerrainIconCols + 1 + Dir);
     906          TSprite(x, y, spCanalMouths + 1 + Dir);
    907907    end
    908908  end;
     
    10071007        if BordersOK and (1 shl p1) = 0 then
    10081008        begin
    1009           // Clearing before bitblt SRCCOPY shouldn't be neccesary but for some
     1009          // Clearing before BitBltBitmap SRCCOPY shouldn't be neccesary but for some
    10101010          // reason without it code works different then under Delphi
    10111011          Borders.Canvas.FillRect(Bounds(0, p1 * (yyt * 2), xxt * 2, yyt * 2));
    10121012
    1013           DpiBitBlt(Borders.Canvas.Handle, 0, p1 * (yyt * 2), xxt * 2,
    1014             yyt * 2, GrExt[HGrTerrain].Data.Canvas.Handle,
    1015             1 + 8 * (xxt * 2 + 1), 1 + yyt + 16 * (yyt * 3 + 1), SRCCOPY);
     1013          DpiBitCanvas(Borders.Canvas, 0, p1 * (yyt * 2), xxt * 2,
     1014            yyt * 2, GrExt[HGrTerrain].Data.Canvas,
     1015            1 + 8 * (xxt * 2 + 1), 1 + yyt + 16 * (yyt * 3 + 1));
    10161016          Borders.BeginUpdate;
    10171017          for dy := 0 to yyt * 2 - 1 do
    10181018          begin
    1019             PixelPtr.Init(Borders, 0, p1 * (yyt * 2) + dy);
     1019            PixelPtr := PixelPointer(Borders, 0, p1 * (yyt * 2) + dy);
    10201020            for dx := 0 to xxt * 2 - 1 do begin
    10211021              if PixelPtr.Pixel^.B = 99 then begin
     
    10431043              if p2 <> p1 then
    10441044              begin
    1045                 BitBlt(GrExt[HGrTerrain].Mask, x + dx * xxt, y + dy * yyt, xxt,
     1045                BitBltBitmap(GrExt[HGrTerrain].Mask, x + dx * xxt, y + dy * yyt, xxt,
    10461046                  yyt, 1 + 8 * (xxt * 2 + 1) + dx * xxt,
    10471047                  1 + yyt + 16 * (yyt * 3 + 1) + dy * yyt, SRCAND);
    1048                 BitBlt(Borders, x + dx * xxt, y + dy * yyt, xxt, yyt, dx * xxt,
     1048                BitBltBitmap(Borders, x + dx * xxt, y + dy * yyt, xxt, yyt, dx * xxt,
    10491049                  p1 * (yyt * 2) + dy * yyt, SRCPAINT);
    10501050              end
     
    11121112    end;
    11131113  end;
    1114   if Tile and fDeadLands <> 0 then
    1115     TSprite(x, y, (12 + Tile shr 25 and 3) * TerrainIconCols + 8);
     1114  if (Tile and fDeadLands) <> 0 then
     1115    TSprite(x, y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols);
    11161116
    11171117  if Options and (1 shl moEditMode) <> 0 then
     
    11311131        1 + yyt + 15 * (yyt * 3 + 1))
    11321132    else
    1133       TSprite(x, y, 6 + TerrainIconCols * 15, xxt <> 33);
     1133      TSprite(x, y, spGrid, xxt <> 33);
    11341134
    11351135  if FoW and (Tile and fObserved = 0) then
     
    13401340  FOutput.BeginUpdate;
    13411341  for y := y0 to y1 - 1 do begin
    1342     Line.Init(FOutput, 0, y);
     1342    Line := PixelPointer(FOutput, 0, y);
    13431343    y_n := (y - ym) / yyt;
    13441344    if abs(y_n) < rShade then begin
     
    14871487                  bix := 0
    14881488                end;
    1489               BitBlt(OceanPatch, x + dx * xxt, y + dy * yyt, xxt, yyt,
     1489              BitBltBitmap(OceanPatch, x + dx * xxt, y + dy * yyt, xxt, yyt,
    14901490                Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY)
    14911491            end
     
    15351535                bix := Aix;
    15361536            if Aix = -1 then
    1537               BitBlt(GrExt[HGrTerrain].Data, x + dx * xxt, y + dy * yyt, xxt,
     1537              BitBltBitmap(GrExt[HGrTerrain].Data, x + dx * xxt, y + dy * yyt, xxt,
    15381538                yyt, 1 + 6 * (xxt * 2 + 1) + (dx + dy + 1) and 1 * xxt, 1 + yyt,
    15391539                SRCCOPY) // arctic <-> ocean
    15401540            else if bix = -1 then
    1541               BitBlt(GrExt[HGrTerrain].Data, x + dx * xxt, y + dy * yyt, xxt,
     1541              BitBltBitmap(GrExt[HGrTerrain].Data, x + dx * xxt, y + dy * yyt, xxt,
    15421542                yyt, 1 + 6 * (xxt * 2 + 1) + xxt - (dx + dy + 1) and 1 * xxt,
    15431543                1 + yyt * 2, SRCCOPY) // arctic <-> ocean
    15441544            else
    1545               BitBlt(LandPatch, x + dx * xxt, y + dy * yyt, xxt, yyt,
     1545              BitBltBitmap(LandPatch, x + dx * xxt, y + dy * yyt, xxt, yyt,
    15461546                Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY)
    15471547          end
    15481548      end;
    15491549
    1550   DataDC := GrExt[HGrTerrain].Data.Canvas.Handle;
    1551   MaskDC := GrExt[HGrTerrain].Mask.Canvas.Handle;
     1550  DataCanvas := GrExt[HGrTerrain].Data.Canvas;
     1551  MaskCanvas := GrExt[HGrTerrain].Mask.Canvas;
    15521552  for dy := -2 to ny + 1 do
    15531553    for dx := -1 to nx do
Note: See TracChangeset for help on using the changeset viewer.