Ignore:
Timestamp:
May 19, 2022, 10:39:34 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Use first capital letter in identifiers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/IsoEngine.pas

    r442 r447  
    1313
    1414type
    15   TInitEnemyModelEvent = function(emix: integer): boolean;
     15  TInitEnemyModelEvent = function(emix: Integer): Boolean;
    1616  TTileSize = (tsSmall, tsMedium, tsBig);
    1717
     
    3333      Dirx: array [0..7] of Integer = (1, 2, 1, 0, -1, -2, -1, 0);
    3434      Diry: array [0..7] of Integer = (-1, 0, 1, 2, 1, 0, -1, -2);
    35     procedure CityGrid(xm, ym: integer; CityAllowClick: Boolean);
    36     function IsShoreTile(Loc: integer): boolean;
     35    procedure CityGrid(xm, ym: Integer; CityAllowClick: Boolean);
     36    function IsShoreTile(Loc: Integer): Boolean;
    3737    procedure MakeDark(Line: PPixelPointer; Length: Integer);
    3838    procedure SetTileSize(AValue: TTileSize);
    39     procedure ShadeOutside(x0, y0, Width, Height, xm, ym: integer);
     39    procedure ShadeOutside(x0, y0, Width, Height, xm, ym: Integer);
    4040  protected
    4141    FOutput: TBitmap;
     
    6565    ShowDebug: Boolean;
    6666    FoW: Boolean;
    67     function Connection4(Loc, Mask, Value: integer): integer;
    68     function Connection8(Loc, Mask: integer): integer;
    69     function OceanConnection(Loc: integer): integer;
    70     procedure PaintShore(x, y, Loc: integer);
    71     procedure PaintTileExtraTerrain(x, y, Loc: integer);
    72     procedure PaintTileObjects(x, y, Loc, CityLoc, CityOwner: integer;
    73       UseBlink: boolean);
    74     procedure PaintGrid(x, y, nx, ny: integer);
    75     procedure FillRect(x, y, Width, Height, Color: integer);
    76     procedure Textout(x, y, Color: integer; const s: string);
    77     procedure Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);
    78     procedure TSprite(xDst, yDst, grix: integer; PureBlack: boolean = false);
     67    function Connection4(Loc, Mask, Value: Integer): Integer;
     68    function Connection8(Loc, Mask: Integer): Integer;
     69    function OceanConnection(Loc: Integer): Integer;
     70    procedure PaintShore(X, Y, Loc: Integer);
     71    procedure PaintTileExtraTerrain(X, Y, Loc: Integer);
     72    procedure PaintTileObjects(X, Y, Loc, CityLoc, CityOwner: Integer;
     73      UseBlink: Boolean);
     74    procedure PaintGrid(X, Y, nx, ny: Integer);
     75    procedure FillRect(X, Y, Width, Height, Color: Integer);
     76    procedure Textout(X, Y, Color: Integer; const S: string);
     77    procedure Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     78    procedure TSprite(xDst, yDst, grix: Integer; PureBlack: Boolean = False);
    7979    procedure ApplyTileSize(ATileSize: TTileSize);
    8080  public
     
    8989    procedure Reset;
    9090    procedure SetOutput(Output: TBitmap);
    91     procedure SetPaintBounds(Left, Top, Right, Bottom: integer);
    92     procedure Paint(x, y, Loc, nx, ny, CityLoc, CityOwner: integer;
    93       UseBlink: boolean = false; CityAllowClick: boolean = false);
    94     procedure PaintUnit(x, y: integer; const UnitInfo: TUnitInfo;
    95       Status: integer);
    96     procedure PaintCity(x, y: integer; const CityInfo: TCityInfo;
    97       accessory: boolean = true);
    98     procedure BitBltBitmap(Src: TBitmap; x, y, Width, Height, xSrc, ySrc,
    99       Rop: integer);
     91    procedure SetPaintBounds(Left, Top, Right, Bottom: Integer);
     92    procedure Paint(X, Y, Loc, nx, ny, CityLoc, CityOwner: Integer;
     93      UseBlink: Boolean = False; CityAllowClick: Boolean = False);
     94    procedure PaintUnit(X, Y: Integer; const UnitInfo: TUnitInfo;
     95      Status: Integer);
     96    procedure PaintCity(X, Y: Integer; const CityInfo: TCityInfo;
     97      accessory: Boolean = True);
     98    procedure BitBltBitmap(Src: TBitmap; X, Y, Width, Height, xSrc, ySrc,
     99      Rop: Integer);
    100100    procedure AttackBegin(const ShowMove: TShowMove);
    101101    procedure AttackEffect(const ShowMove: TShowMove);
    102102    procedure AttackEnd;
    103103    procedure ReduceTerrainIconsSize;
    104     property AdviceLoc: integer read FAdviceLoc write FAdviceLoc;
     104    property AdviceLoc: Integer read FAdviceLoc write FAdviceLoc;
    105105    property TileSize: TTileSize read FTileSize write SetTileSize;
    106106  end;
     
    127127    (X: 72; Y: 36));
    128128
    129 function IsJungle(y: integer): boolean;
     129function IsJungle(Y: Integer): Boolean;
    130130procedure Init(InitEnemyModelHandler: TInitEnemyModelEvent);
    131131
     
    173173  IsoMapCache: array[TTileSize] of TIsoMapCache;
    174174
    175 function IsJungle(y: integer): boolean;
    176 begin
    177   result := (y > (G.ly - 2) div 4) and (G.ly - 1 - y > (G.ly - 2) div 4)
     175function IsJungle(Y: Integer): Boolean;
     176begin
     177  Result := (Y > (G.ly - 2) div 4) and (G.ly - 1 - Y > (G.ly - 2) div 4)
    178178end;
    179179
     
    254254  Mask24.BeginUpdate;
    255255  for ySrc := 0 to TerrainIconLines - 1 do begin
    256     for i := 0 to yyt * 3 - 1 do
    257       MaskLine[i] := PixelPointer(Mask24, ScaleToNative(0),
    258         ScaleToNative(1 + ySrc * (yyt * 3 + 1) + i));
     256    for I := 0 to yyt * 3 - 1 do
     257      MaskLine[I] := PixelPointer(Mask24, ScaleToNative(0),
     258        ScaleToNative(1 + ySrc * (yyt * 3 + 1) + I));
    259259    for xSrc := 0 to TerrainIconCols - 1 do begin
    260       i := ySrc * 9 + xSrc;
    261       TSpriteSize[i].Left := 0;
     260      I := ySrc * 9 + xSrc;
     261      TSpriteSize[I].Left := 0;
    262262      repeat
    263         Border := true;
    264         for y := 0 to yyt * 3 - 1 do begin
    265           MaskLine[y].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + TSpriteSize[i].Left));
    266           if MaskLine[y].Pixel^.B = 0 then Border := false;
     263        Border := True;
     264        for Y := 0 to yyt * 3 - 1 do begin
     265          MaskLine[Y].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + TSpriteSize[I].Left));
     266          if MaskLine[Y].Pixel^.B = 0 then Border := False;
    267267        end;
    268         if Border then Inc(TSpriteSize[i].Left);
    269       until not Border or (TSpriteSize[i].Left = xxt * 2 - 1);
    270       TSpriteSize[i].Top := 0;
     268        if Border then Inc(TSpriteSize[I].Left);
     269      until not Border or (TSpriteSize[I].Left = xxt * 2 - 1);
     270      TSpriteSize[I].Top := 0;
    271271      repeat
    272         Border := true;
    273         for x := 0 to xxt * 2 - 1 do begin
    274           MaskLine[TSpriteSize[i].Top].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + x));
    275           if MaskLine[TSpriteSize[i].Top].Pixel^.B = 0 then Border := false;
     272        Border := True;
     273        for X := 0 to xxt * 2 - 1 do begin
     274          MaskLine[TSpriteSize[I].Top].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + X));
     275          if MaskLine[TSpriteSize[I].Top].Pixel^.B = 0 then Border := False;
    276276        end;
    277         if Border then inc(TSpriteSize[i].Top);
    278       until not Border or (TSpriteSize[i].Top = yyt * 3 - 1);
    279       TSpriteSize[i].Right := xxt * 2;
     277        if Border then Inc(TSpriteSize[I].Top);
     278      until not Border or (TSpriteSize[I].Top = yyt * 3 - 1);
     279      TSpriteSize[I].Right := xxt * 2;
    280280      repeat
    281         Border := true;
    282         for y := 0 to yyt * 3 - 1 do begin
    283           MaskLine[y].SetX(ScaleToNative(xSrc * (xxt * 2 + 1) + TSpriteSize[i].Right));
    284           if MaskLine[y].Pixel^.B = 0 then Border := false;
     281        Border := True;
     282        for Y := 0 to yyt * 3 - 1 do begin
     283          MaskLine[Y].SetX(ScaleToNative(xSrc * (xxt * 2 + 1) + TSpriteSize[I].Right));
     284          if MaskLine[Y].Pixel^.B = 0 then Border := False;
    285285        end;
    286         if Border then Dec(TSpriteSize[i].Right);
    287       until not Border or (TSpriteSize[i].Right = TSpriteSize[i].Left);
    288       TSpriteSize[i].Bottom := yyt * 3;
     286        if Border then Dec(TSpriteSize[I].Right);
     287      until not Border or (TSpriteSize[I].Right = TSpriteSize[I].Left);
     288      TSpriteSize[I].Bottom := yyt * 3;
    289289      repeat
    290         Border := true;
    291         for x := 0 to xxt * 2 - 1 do begin
    292           MaskLine[TSpriteSize[i].Bottom - 1].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + x));
    293           if MaskLine[TSpriteSize[i].Bottom - 1].Pixel^.B = 0 then Border := false;
     290        Border := True;
     291        for X := 0 to xxt * 2 - 1 do begin
     292          MaskLine[TSpriteSize[I].Bottom - 1].SetX(ScaleToNative(1 + xSrc * (xxt * 2 + 1) + X));
     293          if MaskLine[TSpriteSize[I].Bottom - 1].Pixel^.B = 0 then Border := False;
    294294        end;
    295         if Border then Dec(TSpriteSize[i].Bottom);
    296       until not Border or (TSpriteSize[i].Bottom = TSpriteSize[i].Top);
     295        if Border then Dec(TSpriteSize[I].Bottom);
     296      until not Border or (TSpriteSize[I].Bottom = TSpriteSize[I].Top);
    297297    end;
    298298  end;
     
    303303procedure TIsoMap.ApplyTileSize(ATileSize: TTileSize);
    304304var
    305   x: Integer;
    306   y: Integer;
     305  X: Integer;
     306  Y: Integer;
    307307  xSrc: Integer;
    308308  ySrc: Integer;
     
    361361    1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    362362
    363   for x := -1 to 6 do begin
    364     if x = -1 then begin
     363  for X := -1 to 6 do begin
     364    if X = -1 then begin
    365365      xSrc := ShoreDither * (xxt * 2 + 1) + 1;
    366366      ySrc := 1 + yyt;
    367367    end
    368     else if x = 6 then begin
     368    else if X = 6 then begin
    369369      xSrc := 1 + (xxt * 2 + 1) * 2;
    370370      ySrc := 1 + yyt + (yyt * 3 + 1) * 2;
    371371    end else begin
    372       xSrc := (x + 2) * (xxt * 2 + 1) + 1;
     372      xSrc := (X + 2) * (xxt * 2 + 1) + 1;
    373373      ySrc := 1 + yyt;
    374374    end;
    375     for y := -1 to 6 do
    376       BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
     375    for Y := -1 to 6 do
     376      BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt,
    377377        xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc);
    378     for y := -2 to 6 do
    379       BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt, xxt,
     378    for Y := -2 to 6 do
     379      BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, xxt,
    380380        yyt, HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt,
    381381        SRCPAINT);
    382     for y := -2 to 6 do
    383       BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2) + xxt, (y + 2) * yyt,
     382    for Y := -2 to 6 do
     383      BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2) + xxt, (Y + 2) * yyt,
    384384        xxt, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt,
    385385        SRCPAINT);
    386     for y := -2 to 6 do
    387       BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt, xxt,
     386    for Y := -2 to 6 do
     387      BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt, xxt,
    388388        yyt, DitherMask.Canvas, xxt, yyt, SRCAND);
    389     for y := -2 to 6 do
    390       BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2) + xxt, (y + 2) * yyt,
     389    for Y := -2 to 6 do
     390      BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2) + xxt, (Y + 2) * yyt,
    391391        xxt, yyt, DitherMask.Canvas, 0, yyt, SRCAND);
    392392  end;
    393393
    394   for y := -1 to 6 do begin
    395     if y = -1 then begin
     394  for Y := -1 to 6 do begin
     395    if Y = -1 then begin
    396396      xSrc := ShoreDither * (xxt * 2 + 1) + 1;
    397397      ySrc := 1 + yyt;
    398398    end
    399     else if y = 6 then begin
     399    else if Y = 6 then begin
    400400      xSrc := 1 + 2 * (xxt * 2 + 1);
    401401      ySrc := 1 + yyt + 2 * (yyt * 3 + 1);
    402402    end else begin
    403       xSrc := (y + 2) * (xxt * 2 + 1) + 1;
     403      xSrc := (Y + 2) * (xxt * 2 + 1) + 1;
    404404      ySrc := 1 + yyt;
    405405    end;
    406     for x := -2 to 6 do
    407       BitBltCanvas(LandMore.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
     406    for X := -2 to 6 do
     407      BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt,
    408408        xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc);
    409     BitBltCanvas(LandMore.Canvas, xxt * 2, (y + 2) * yyt, xxt, yyt,
     409    BitBltCanvas(LandMore.Canvas, xxt * 2, (Y + 2) * yyt, xxt, yyt,
    410410      HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt, SRCPAINT);
    411     for x := 0 to 7 do
    412       BitBltCanvas(LandMore.Canvas, (x + 2) * (xxt * 2) - xxt, (y + 2) * yyt,
     411    for X := 0 to 7 do
     412      BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2) - xxt, (Y + 2) * yyt,
    413413        xxt * 2, yyt, HGrTerrain.Data.Canvas, xSrc, ySrc + yyt,
    414414        SRCPAINT);
    415     for x := -2 to 6 do
    416       BitBltCanvas(LandMore.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
     415    for X := -2 to 6 do
     416      BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt,
    417417        xxt * 2, yyt, DitherMask.Canvas, 0, 0, SRCAND);
    418418  end;
    419419
    420   for x := 0 to 3 do begin
    421     for y := 0 to 3 do begin
    422       if (x = 1) and (y = 1) then xSrc := 1
     420  for X := 0 to 3 do begin
     421    for Y := 0 to 3 do begin
     422      if (X = 1) and (Y = 1) then xSrc := 1
    423423      else
    424         xSrc := (x mod 2) * (xxt * 2 + 1) + 1;
     424        xSrc := (X mod 2) * (xxt * 2 + 1) + 1;
    425425      ySrc := 1 + yyt;
    426       if (x >= 1) = (y >= 2) then
    427         BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     426      if (X >= 1) = (Y >= 2) then
     427        BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt,
    428428          HGrTerrain.Data.Canvas, xSrc, ySrc);
    429       if (x >= 1) and ((y < 2) or (x >= 2)) then
     429      if (X >= 1) and ((Y < 2) or (X >= 2)) then
    430430      begin
    431         BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
     431        BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt,
    432432          HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt,
    433433          SRCPAINT);
    434         BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
     434        BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt,
    435435          HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);
    436436      end;
    437       BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
     437      BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt,
    438438        DitherMask.Canvas, xxt, yyt, SRCAND);
    439       BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
     439      BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt,
    440440        DitherMask.Canvas, 0, yyt, SRCAND);
    441441    end;
    442442  end;
    443443
    444   for y := 0 to 3 do begin
    445     for x := 0 to 3 do begin
    446       if (x = 1) and (y = 1) then xSrc := 1
     444  for Y := 0 to 3 do begin
     445    for X := 0 to 3 do begin
     446      if (X = 1) and (Y = 1) then xSrc := 1
    447447      else
    448         xSrc := (y mod 2) * (xxt * 2 + 1) + 1;
     448        xSrc := (Y mod 2) * (xxt * 2 + 1) + 1;
    449449      ySrc := 1 + yyt;
    450       if (x < 1) or (y >= 2) then
    451         BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     450      if (X < 1) or (Y >= 2) then
     451        BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt,
    452452          HGrTerrain.Data.Canvas, xSrc, ySrc);
    453       if (x = 1) and (y < 2) or (x >= 2) and (y >= 1) then
     453      if (X = 1) and (Y < 2) or (X >= 2) and (Y >= 1) then
    454454      begin
    455         BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt, yyt,
     455        BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt, yyt,
    456456          HGrTerrain.Data.Canvas, xSrc + xxt, ySrc + yyt,
    457457          SRCPAINT);
    458         BitBltCanvas(OceanMore.Canvas, x * (xxt * 2) + xxt, y * yyt, xxt, yyt,
     458        BitBltCanvas(OceanMore.Canvas, X * (xxt * 2) + xxt, Y * yyt, xxt, yyt,
    459459          HGrTerrain.Data.Canvas, xSrc, ySrc + yyt, SRCPAINT);
    460460      end;
    461       BitBltCanvas(OceanMore.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     461      BitBltCanvas(OceanMore.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt,
    462462        DitherMask.Canvas, 0, 0, SRCAND);
    463463    end;
     
    469469    HGrTerrain.Mask.Canvas, 1, 1 + yyt, SRCPAINT);
    470470
    471   for x := -1 to 6 do
    472     for y := -2 to 6 do
    473       BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), (y + 2) * yyt,
     471  for X := -1 to 6 do
     472    for Y := -2 to 6 do
     473      BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), (Y + 2) * yyt,
    474474        xxt * 2, yyt, DitherMask.Canvas, 0, 0, SRCAND);
    475475
    476   for y := -1 to 6 do
    477     for x := -2 to 7 do
    478       BitBltCanvas(LandMore.Canvas, (x + 2) * (xxt * 2) - xxt, (y + 2) * yyt,
     476  for Y := -1 to 6 do
     477    for X := -2 to 7 do
     478      BitBltCanvas(LandMore.Canvas, (X + 2) * (xxt * 2) - xxt, (Y + 2) * yyt,
    479479        xxt * 2, yyt, DitherMask.Canvas, 0, yyt, SRCAND);
    480480
     
    482482    LandMore.Canvas, 0, 0, SRCPAINT);
    483483
    484   for x := 0 to 3 do
    485     for y := 0 to 3 do
    486       BitBltCanvas(OceanPatch.Canvas, x * (xxt * 2), y * yyt, xxt * 2, yyt,
     484  for X := 0 to 3 do
     485    for Y := 0 to 3 do
     486      BitBltCanvas(OceanPatch.Canvas, X * (xxt * 2), Y * yyt, xxt * 2, yyt,
    487487        DitherMask.Canvas, 0, 0, SRCAND);
    488488
    489   for y := 0 to 3 do
    490     for x := 0 to 4 do
    491       BitBltCanvas(OceanMore.Canvas, x * (xxt * 2) - xxt, y * yyt, xxt * 2,
     489  for Y := 0 to 3 do
     490    for X := 0 to 4 do
     491      BitBltCanvas(OceanMore.Canvas, X * (xxt * 2) - xxt, Y * yyt, xxt * 2,
    492492        yyt, DitherMask.Canvas, 0, yyt, SRCAND);
    493493
     
    502502    HGrTerrain.Mask.Canvas, 1, 1 + yyt);
    503503
    504   for x := 0 to 6 do
    505     BitBltCanvas(LandPatch.Canvas, (x + 2) * (xxt * 2), yyt, xxt * 2, yyt,
     504  for X := 0 to 6 do
     505    BitBltCanvas(LandPatch.Canvas, (X + 2) * (xxt * 2), yyt, xxt * 2, yyt,
    506506      DitherMask.Canvas, 0, 0, SRCAND);
    507507  BitBltCanvas(DitherMask.Canvas, 0, 0, xxt * 2, yyt, DitherMask.Canvas,
    508508    0, 0, DSTINVERT);
    509509
    510   for y := 0 to 6 do
    511     BitBltCanvas(LandPatch.Canvas, xxt * 2, (y + 2) * yyt, xxt * 2, yyt,
     510  for Y := 0 to 6 do
     511    BitBltCanvas(LandPatch.Canvas, xxt * 2, (Y + 2) * yyt, xxt * 2, yyt,
    512512      DitherMask.Canvas, 0, 0, SRCAND);
    513513
     
    555555end;
    556556
    557 procedure TIsoMap.SetPaintBounds(Left, Top, Right, Bottom: integer);
     557procedure TIsoMap.SetPaintBounds(Left, Top, Right, Bottom: Integer);
    558558begin
    559559  FLeft := Left;
     
    563563end;
    564564
    565 procedure TIsoMap.FillRect(x, y, Width, Height, Color: integer);
    566 begin
    567   if x < FLeft then
    568   begin
    569     Width := Width - (FLeft - x);
    570     x := FLeft;
    571   end;
    572   if y < FTop then
    573   begin
    574     Height := Height - (FTop - y);
    575     y := FTop;
    576   end;
    577   if x + Width >= FRight then
    578     Width := FRight - x;
    579   if y + Height >= FBottom then
    580     Height := FBottom - y;
     565procedure TIsoMap.FillRect(X, Y, Width, Height, Color: Integer);
     566begin
     567  if X < FLeft then
     568  begin
     569    Width := Width - (FLeft - X);
     570    X := FLeft;
     571  end;
     572  if Y < FTop then
     573  begin
     574    Height := Height - (FTop - Y);
     575    Y := FTop;
     576  end;
     577  if X + Width >= FRight then
     578    Width := FRight - X;
     579  if Y + Height >= FBottom then
     580    Height := FBottom - Y;
    581581  if (Width <= 0) or (Height <= 0) then
    582     exit;
     582    Exit;
    583583
    584584  FOutput.Canvas.Brush.Color := Color;
    585   FOutput.Canvas.FillRect(Rect(x, y, x + Width, y + Height));
     585  FOutput.Canvas.FillRect(Rect(X, Y, X + Width, Y + Height));
    586586  FOutput.Canvas.Brush.Style := bsClear;
    587587end;
    588588
    589 procedure TIsoMap.Textout(x, y, Color: integer; const s: string);
     589procedure TIsoMap.Textout(X, Y, Color: Integer; const S: string);
    590590begin
    591591  FOutput.Canvas.Font.Color := Color;
    592   FOutput.Canvas.TextRect(Rect(FLeft, FTop, FRight, FBottom), x, y, s)
    593 end;
    594 
    595 procedure TIsoMap.BitBltBitmap(Src: TBitmap; x, y, Width, Height, xSrc, ySrc,
    596   Rop: integer);
    597 begin
    598   if x < FLeft then
    599   begin
    600     Width := Width - (FLeft - x);
    601     xSrc := xSrc + (FLeft - x);
    602     x := FLeft;
    603   end;
    604   if y < FTop then
    605   begin
    606     Height := Height - (FTop - y);
    607     ySrc := ySrc + (FTop - y);
    608     y := FTop;
    609   end;
    610   if x + Width >= FRight then
    611     Width := FRight - x;
    612   if y + Height >= FBottom then
    613     Height := FBottom - y;
     592  FOutput.Canvas.TextRect(Rect(FLeft, FTop, FRight, FBottom), X, Y, S)
     593end;
     594
     595procedure TIsoMap.BitBltBitmap(Src: TBitmap; X, Y, Width, Height, xSrc, ySrc,
     596  Rop: Integer);
     597begin
     598  if X < FLeft then
     599  begin
     600    Width := Width - (FLeft - X);
     601    xSrc := xSrc + (FLeft - X);
     602    X := FLeft;
     603  end;
     604  if Y < FTop then
     605  begin
     606    Height := Height - (FTop - Y);
     607    ySrc := ySrc + (FTop - Y);
     608    Y := FTop;
     609  end;
     610  if X + Width >= FRight then
     611    Width := FRight - X;
     612  if Y + Height >= FBottom then
     613    Height := FBottom - Y;
    614614  if (Width <= 0) or (Height <= 0) then
    615     exit;
    616 
    617   BitBltCanvas(FOutput.Canvas, x, y, Width, Height, Src.Canvas, xSrc, ySrc, Rop);
    618 end;
    619 
    620 procedure TIsoMap.Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);
     615    Exit;
     616
     617  BitBltCanvas(FOutput.Canvas, X, Y, Width, Height, Src.Canvas, xSrc, ySrc, Rop);
     618end;
     619
     620procedure TIsoMap.Sprite(HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    621621begin
    622622  BitBltBitmap(HGr.Mask, xDst, yDst, Width, Height, xGr, yGr, SRCAND);
     
    624624end;
    625625
    626 procedure TIsoMap.TSprite(xDst, yDst, grix: integer;
    627   PureBlack: boolean = false);
     626procedure TIsoMap.TSprite(xDst, yDst, grix: Integer;
     627  PureBlack: Boolean = False);
    628628var
    629629  Width: Integer;
    630630  Height: Integer;
    631631  xSrc: Integer;
    632   ySrc: integer;
     632  ySrc: Integer;
    633633begin
    634634  Width := TSpriteSize[grix].Right - TSpriteSize[grix].Left;
     
    653653    Height := FBottom - yDst;
    654654  if (Width <= 0) or (Height <= 0) then
    655     exit;
     655    Exit;
    656656
    657657  BitBltCanvas(FOutput.Canvas, xDst, yDst, Width, Height, MaskCanvas, xSrc, ySrc, SRCAND);
     
    660660end;
    661661
    662 procedure TIsoMap.PaintUnit(x, y: integer; const UnitInfo: TUnitInfo;
    663   Status: integer);
    664 var
    665   xsh, ysh, xGr, yGr, j, mixShow: integer;
     662procedure TIsoMap.PaintUnit(X, Y: Integer; const UnitInfo: TUnitInfo;
     663  Status: Integer);
     664var
     665  xsh, ysh, xGr, yGr, J, mixShow: Integer;
    666666begin
    667667  with UnitInfo do
    668     if (Owner = me) or (emix <> $FFFF) then
     668    if (Owner = Me) or (emix <> $FFFF) then
    669669    begin
    670670      if Job = jCity then
     
    675675        (@OnInitEnemyModel <> nil) then
    676676        if not OnInitEnemyModel(emix) then
    677           exit;
     677          Exit;
    678678      xsh := Tribe[Owner].ModelPicture[mixShow].xShield;
    679679      ysh := Tribe[Owner].ModelPicture[mixShow].yShield;
    680680{$IFNDEF SCR} if Status and usStay <> 0 then
    681         j := 19
     681        J := 19
    682682      else if Status and usRecover <> 0 then
    683         j := 16
     683        J := 16
    684684      else if Status and (usGoto or usEnhance) = usGoto or usEnhance then
    685         j := 18
     685        J := 18
    686686      else if Status and usEnhance <> 0 then
    687         j := 17
     687        J := 17
    688688      else if Status and usGoto <> 0 then
    689         j := 20
     689        J := 20
    690690      else {$ENDIF} if Job = jCity then
    691           j := jNone
     691          J := jNone
    692692        else
    693           j := Job;
     693          J := Job;
    694694      if Flags and unMulti <> 0 then
    695         Sprite(Tribe[Owner].symHGr, x + xsh - 1 + 4, y + ysh - 2, 14, 12,
     695        Sprite(Tribe[Owner].symHGr, X + xsh - 1 + 4, Y + ysh - 2, 14, 12,
    696696          33 + Tribe[Owner].sympix mod 10 * 65,
    697697          1 + Tribe[Owner].sympix div 10 * 49);
    698       Sprite(Tribe[Owner].symHGr, x + xsh - 1, y + ysh - 2, 14, 12,
     698      Sprite(Tribe[Owner].symHGr, X + xsh - 1, Y + ysh - 2, 14, 12,
    699699        18 + Tribe[Owner].sympix mod 10 * 65,
    700700        1 + Tribe[Owner].sympix div 10 * 49);
    701       FillRect(x + xsh, y + ysh + 5, 1 + Health * 11 div 100, 3,
     701      FillRect(X + xsh, Y + ysh + 5, 1 + Health * 11 div 100, 3,
    702702        ColorOfHealth(Health));
    703       if j > 0 then
     703      if J > 0 then
    704704      begin
    705         xGr := 121 + j mod 7 * 9;
    706         yGr := 1 + j div 7 * 9;
    707         BitBltBitmap(HGrSystem.Mask, x + xsh + 3, y + ysh + 9, 8, 8, xGr,
     705        xGr := 121 + J mod 7 * 9;
     706        yGr := 1 + J div 7 * 9;
     707        BitBltBitmap(HGrSystem.Mask, X + xsh + 3, Y + ysh + 9, 8, 8, xGr,
    708708          yGr, SRCAND);
    709         Sprite(HGrSystem, x + xsh + 2, y + ysh + 8, 8, 8, xGr, yGr);
     709        Sprite(HGrSystem, X + xsh + 2, Y + ysh + 8, 8, 8, xGr, yGr);
    710710      end;
    711711      with Tribe[Owner].ModelPicture[mixShow] do
    712         Sprite(HGr, x, y, 64, 48, pix mod 10 * 65 + 1, pix div 10 * 49 + 1);
     712        Sprite(HGr, X, Y, 64, 48, pix mod 10 * 65 + 1, pix div 10 * 49 + 1);
    713713      if Flags and unFortified <> 0 then
    714714      begin
    715715        { DataCanvas:=HGrTerrain.Data.Canvas;
    716716          MaskCanvas:=HGrTerrain.Mask.Canvas;
    717           TSprite(x,y+16,12*9+7); }
    718         Sprite(HGrStdUnits, x, y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1);
     717          TSprite(X,Y+16,12*9+7); }
     718        Sprite(HGrStdUnits, X, Y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1);
    719719      end;
    720720    end;
    721721end;
    722722
    723 procedure TIsoMap.PaintCity(x, y: integer; const CityInfo: TCityInfo;
    724   accessory: boolean);
     723procedure TIsoMap.PaintCity(X, Y: Integer; const CityInfo: TCityInfo;
     724  accessory: Boolean);
    725725var
    726726  age: Integer;
     
    733733  LabelLength: Integer;
    734734  cpic: TCityPicture;
    735   s: string;
     735  S: string;
    736736begin
    737737  age := GetAge(CityInfo.Owner);
     
    752752      (cHGr.Data.Canvas.Pixels[(xGr + 4) * 65, cpix * 49 + 48] = $00FFFF)
    753753    then
    754       Sprite(cHGr, x - xxc, y - 2 * yyc, xxc * 2, yyc * 3,
     754      Sprite(cHGr, X - xxc, Y - 2 * yyc, xxc * 2, yyc * 3,
    755755        xGr * (xxc * 2 + 1) + 1, 1 + cpix * (yyc * 3 + 1));
    756756    if ciWalled and CityInfo.Flags <> 0 then
    757       Sprite(cHGr, x - xxc, y - 2 * yyc, xxc * 2, yyc * 3,
     757      Sprite(cHGr, X - xxc, Y - 2 * yyc, xxc * 2, yyc * 3,
    758758        (xGr + 4) * (xxc * 2 + 1) + 1, 1 + cpix * (yyc * 3 + 1));
    759759  end
     
    761761  begin
    762762    if ciWalled and CityInfo.Flags <> 0 then
    763       Sprite(HGrCities, x - xxt, y - 2 * yyt, 2 * xxt, 3 * yyt,
     763      Sprite(HGrCities, X - xxt, Y - 2 * yyt, 2 * xxt, 3 * yyt,
    764764        (xGr + 4) * (2 * xxt + 1) + 1, 1 + (age - 2) * (3 * yyt + 1))
    765765    else
    766       Sprite(HGrCities, x - xxt, y - 2 * yyt, 2 * xxt, 3 * yyt,
     766      Sprite(HGrCities, X - xxt, Y - 2 * yyt, 2 * xxt, 3 * yyt,
    767767        xGr * (2 * xxt + 1) + 1, 1 + (age - 2) * (3 * yyt + 1));
    768768  end;
    769769
    770770  if not accessory then
    771     exit;
     771    Exit;
    772772
    773773  { if ciCapital and CityInfo.Flags<>0 then
    774     Sprite(Tribe[CityInfo.Owner].symHGr,x+cpic.xf,y-13+cpic.yf,13,14,
     774    Sprite(Tribe[CityInfo.Owner].symHGr,X+cpic.xf,Y-13+cpic.yf,13,14,
    775775    1+Tribe[CityInfo.Owner].sympix mod 10 *65,
    776776    1+Tribe[CityInfo.Owner].sympix div 10 *49); {capital -- paint flag }
     
    781781    begin
    782782      cpic := Tribe[CityInfo.Owner].CityPicture[xGr];
    783       xShield := x - xxc + cpic.xShield;
    784       yShield := y - 2 * yyc + cpic.yShield;
     783      xShield := X - xxc + cpic.xShield;
     784      yShield := Y - 2 * yyc + cpic.yShield;
    785785    end
    786786    else
    787787    begin
    788788      cpic := CitiesPictures.Pictures[age, xGr];
    789       xShield := x - xxt + cpic.xShield;
    790       yShield := y - 2 * yyt + cpic.yShield;
     789      xShield := X - xxt + cpic.xShield;
     790      yShield := Y - 2 * yyt + cpic.yShield;
    791791    end;
    792     s := IntToStr(CityInfo.size);
    793     LabelLength := FOutput.Canvas.TextWidth(s);
     792    S := IntToStr(CityInfo.size);
     793    LabelLength := FOutput.Canvas.TextWidth(S);
    794794    FillRect(xShield, yShield, LabelLength + 4, 16, $000000);
    795795    if MyMap[CityInfo.Loc] and (fUnit or fObserved) = fObserved then
     
    802802      LabelTextColor := $000000;
    803803    end;
    804     Textout(xShield + 2, yShield - 1, LabelTextColor, s);
    805   end;
    806 end;
    807 
    808 function PoleTile(Loc: integer): integer;
     804    Textout(xShield + 2, yShield - 1, LabelTextColor, S);
     805  end;
     806end;
     807
     808function PoleTile(Loc: Integer): Integer;
    809809begin { virtual pole tile }
    810   result := fUNKNOWN;
     810  Result := fUNKNOWN;
    811811  if Loc < -2 * G.lx then
    812812  else if Loc < -G.lx then
     
    815815      (MyMap[dLoc(Loc, -2, 2)] and fTerrain <> fUNKNOWN) and
    816816      (MyMap[dLoc(Loc, 2, 2)] and fTerrain <> fUNKNOWN) then
    817       result := fArctic;
     817      Result := fArctic;
    818818    if (MyMap[dLoc(Loc, 0, 2)] and fObserved <> 0) and
    819819      (MyMap[dLoc(Loc, -2, 2)] and fObserved <> 0) and
    820820      (MyMap[dLoc(Loc, 2, 2)] and fObserved <> 0) then
    821       result := result or fObserved;
     821      Result := Result or fObserved;
    822822  end
    823823  else if Loc < 0 then
     
    825825    if (MyMap[dLoc(Loc, -1, 1)] and fTerrain <> fUNKNOWN) and
    826826      (MyMap[dLoc(Loc, 1, 1)] and fTerrain <> fUNKNOWN) then
    827       result := fArctic;
     827      Result := fArctic;
    828828    if (MyMap[dLoc(Loc, -1, 1)] and fObserved <> 0) and
    829829      (MyMap[dLoc(Loc, 1, 1)] and fObserved <> 0) then
    830       result := result or fObserved;
     830      Result := Result or fObserved;
    831831  end
    832832  else if Loc < G.lx * (G.ly + 1) then
     
    834834    if (MyMap[dLoc(Loc, -1, -1)] and fTerrain <> fUNKNOWN) and
    835835      (MyMap[dLoc(Loc, 1, -1)] and fTerrain <> fUNKNOWN) then
    836       result := fArctic;
     836      Result := fArctic;
    837837    if (MyMap[dLoc(Loc, -1, -1)] and fObserved <> 0) and
    838838      (MyMap[dLoc(Loc, 1, -1)] and fObserved <> 0) then
    839       result := result or fObserved;
     839      Result := Result or fObserved;
    840840  end
    841841  else if Loc < G.lx * (G.ly + 2) then
     
    844844      (MyMap[dLoc(Loc, -2, -2)] and fTerrain <> fUNKNOWN) and
    845845      (MyMap[dLoc(Loc, 2, -2)] and fTerrain <> fUNKNOWN) then
    846       result := fArctic;
     846      Result := fArctic;
    847847    if (MyMap[dLoc(Loc, 0, -2)] and fObserved <> 0) and
    848848      (MyMap[dLoc(Loc, -2, -2)] and fObserved <> 0) and
    849849      (MyMap[dLoc(Loc, 2, -2)] and fObserved <> 0) then
    850       result := result or fObserved;
    851   end;
    852 end;
    853 
    854 function TIsoMap.Connection4(Loc, Mask, Value: integer): integer;
    855 begin
    856   result := 0;
     850      Result := Result or fObserved;
     851  end;
     852end;
     853
     854function TIsoMap.Connection4(Loc, Mask, Value: Integer): Integer;
     855begin
     856  Result := 0;
    857857  if dLoc(Loc, 1, -1) >= 0 then
    858858  begin
    859859    if MyMap[dLoc(Loc, 1, -1)] and Mask = Cardinal(Value) then
    860       inc(result, 1);
     860      Inc(Result, 1);
    861861    if MyMap[dLoc(Loc, -1, -1)] and Mask = Cardinal(Value) then
    862       inc(result, 8);
     862      Inc(Result, 8);
    863863  end;
    864864  if dLoc(Loc, 1, 1) < G.lx * G.ly then
    865865  begin
    866866    if MyMap[dLoc(Loc, 1, 1)] and Mask = Cardinal(Value) then
    867       inc(result, 2);
     867      Inc(Result, 2);
    868868    if MyMap[dLoc(Loc, -1, 1)] and Mask = Cardinal(Value) then
    869       inc(result, 4);
    870   end;
    871 end;
    872 
    873 function TIsoMap.Connection8(Loc, Mask: integer): integer;
     869      Inc(Result, 4);
     870  end;
     871end;
     872
     873function TIsoMap.Connection8(Loc, Mask: Integer): Integer;
    874874var
    875875  Dir: Integer;
    876876  ConnLoc: Integer;
    877877begin
    878   result := 0;
     878  Result := 0;
    879879  for Dir := 0 to 7 do
    880880  begin
     
    882882    if (ConnLoc >= 0) and (ConnLoc < G.lx * G.ly) and
    883883      (MyMap[ConnLoc] and Mask <> 0) then
    884       inc(result, 1 shl Dir);
    885   end;
    886 end;
    887 
    888 function TIsoMap.OceanConnection(Loc: integer): integer;
     884      Inc(Result, 1 shl Dir);
     885  end;
     886end;
     887
     888function TIsoMap.OceanConnection(Loc: Integer): Integer;
    889889var
    890890  Dir: Integer;
    891891  ConnLoc: Integer;
    892892begin
    893   result := 0;
     893  Result := 0;
    894894  for Dir := 0 to 7 do
    895895  begin
     
    897897    if (ConnLoc < 0) or (ConnLoc >= G.lx * G.ly) or
    898898      ((MyMap[ConnLoc] - 2) and fTerrain < 13) then
    899       inc(result, 1 shl Dir);
    900   end;
    901 end;
    902 
    903 procedure TIsoMap.PaintShore(x, y, Loc: integer);
     899      Inc(Result, 1 shl Dir);
     900  end;
     901end;
     902
     903procedure TIsoMap.PaintShore(X, Y, Loc: Integer);
    904904var
    905905  Conn: Integer;
    906906  Tile: Integer;
    907907begin
    908   if (y <= FTop - yyt * 2) or (y > FBottom) or (x <= FLeft - xxt * 2) or
    909     (x > FRight) then
    910     exit;
     908  if (Y <= FTop - yyt * 2) or (Y > FBottom) or (X <= FLeft - xxt * 2) or
     909    (X > FRight) then
     910    Exit;
    911911  if (Loc < 0) or (Loc >= G.lx * G.ly) then
    912     exit;
     912    Exit;
    913913  Tile := MyMap[Loc];
    914914  if Tile and fTerrain >= fGrass then
    915     exit;
     915    Exit;
    916916  Conn := OceanConnection(Loc);
    917917  if Conn = 0 then
    918     exit;
    919 
    920   BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y, xxt, yyt,
     918    Exit;
     919
     920  BitBltBitmap(HGrTerrain.Data, X + xxt div 2, Y, xxt, yyt,
    921921    1 + (Conn shr 6 + Conn and 1 shl 2) * (xxt * 2 + 1),
    922922    1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    923   BitBltBitmap(HGrTerrain.Data, x + xxt, y + yyt div 2, xxt, yyt,
     923  BitBltBitmap(HGrTerrain.Data, X + xxt, Y + yyt div 2, xxt, yyt,
    924924    1 + (Conn and 7) * (xxt * 2 + 1) + xxt,
    925925    1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    926   BitBltBitmap(HGrTerrain.Data, x + xxt div 2, y + yyt, xxt, yyt,
     926  BitBltBitmap(HGrTerrain.Data, X + xxt div 2, Y + yyt, xxt, yyt,
    927927    1 + (Conn shr 2 and 7) * (xxt * 2 + 1) + xxt,
    928928    1 + yyt + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    929   BitBltBitmap(HGrTerrain.Data, x, y + yyt div 2, xxt, yyt,
     929  BitBltBitmap(HGrTerrain.Data, X, Y + yyt div 2, xxt, yyt,
    930930    1 + (Conn shr 4 and 7) * (xxt * 2 + 1),
    931931    1 + yyt * 2 + (16 + Tile and fTerrain) * (yyt * 3 + 1), SRCPAINT);
    932932  Conn := Connection4(Loc, fTerrain, fUNKNOWN); { dither to black }
    933933  if Conn and 1 <> 0 then
    934     BitBltBitmap(HGrTerrain.Mask, x + xxt, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +
     934    BitBltBitmap(HGrTerrain.Mask, X + xxt, Y, xxt, yyt, 1 + 7 * (xxt * 2 + 1) +
    935935      xxt, 1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    936936  if Conn and 2 <> 0 then
    937     BitBltBitmap(HGrTerrain.Mask, x + xxt, y + yyt, xxt, yyt,
     937    BitBltBitmap(HGrTerrain.Mask, X + xxt, Y + yyt, xxt, yyt,
    938938      1 + 7 * (xxt * 2 + 1) + xxt, 1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND);
    939939  if Conn and 4 <> 0 then
    940     BitBltBitmap(HGrTerrain.Mask, x, y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
     940    BitBltBitmap(HGrTerrain.Mask, X, Y + yyt, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
    941941      1 + yyt * 2 + 15 * (yyt * 3 + 1), SRCAND);
    942942  if Conn and 8 <> 0 then
    943     BitBltBitmap(HGrTerrain.Mask, x, y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
     943    BitBltBitmap(HGrTerrain.Mask, X, Y, xxt, yyt, 1 + 7 * (xxt * 2 + 1),
    944944      1 + yyt + 15 * (yyt * 3 + 1), SRCAND);
    945945end;
    946946
    947 procedure TIsoMap.PaintTileExtraTerrain(x, y, Loc: integer);
    948 var
    949   Dir, Conn, RRConn, yGr, Tile, yLoc: integer;
    950 begin
    951   if (Loc < 0) or (Loc >= G.lx * G.ly) or (y <= -yyt * 2) or
    952     (y > FOutput.Height) or (x <= -xxt * 2) or (x > FOutput.Width) then
    953     exit;
     947procedure TIsoMap.PaintTileExtraTerrain(X, Y, Loc: Integer);
     948var
     949  Dir, Conn, RRConn, yGr, Tile, yLoc: Integer;
     950begin
     951  if (Loc < 0) or (Loc >= G.lx * G.ly) or (Y <= -yyt * 2) or
     952    (Y > FOutput.Height) or (X <= -xxt * 2) or (X > FOutput.Width) then
     953    Exit;
    954954  Tile := MyMap[Loc];
    955955  if Tile and fTerrain = fForest then
     
    966966    then
    967967      Conn := Conn and not 9; // no connection to north
    968     TSprite(x, y, yGr + Conn mod 8 + (Conn div 8) * TerrainIconCols);
     968    TSprite(X, Y, yGr + Conn mod 8 + (Conn div 8) * TerrainIconCols);
    969969  end
    970970  else if Tile and fTerrain in [fHills, fMountains, fForest] then
     
    972972    yGr := 3 + 2 * (Tile and fTerrain - fForest);
    973973    Conn := Connection4(Loc, fTerrain, Tile and fTerrain);
    974     TSprite(x, y, Conn mod 8 + (yGr + Conn div 8) * TerrainIconCols);
     974    TSprite(X, Y, Conn mod 8 + (yGr + Conn div 8) * TerrainIconCols);
    975975  end
    976976  else if Tile and fDeadLands <> 0 then
    977     TSprite(x, y, spRow2);
     977    TSprite(X, Y, spRow2);
    978978
    979979  if ShowObjects then
    980980  begin
    981981    if Tile and fTerImp = tiFarm then
    982       TSprite(x, y, spFarmLand)
     982      TSprite(X, Y, spFarmLand)
    983983    else if Tile and fTerImp = tiIrrigation then
    984       TSprite(x, y, spIrrigation);
     984      TSprite(X, Y, spIrrigation);
    985985  end;
    986986  if Tile and fRiver <> 0 then
     
    989989      Connection4(Loc, fTerrain, fShore) or Connection4(Loc, fTerrain,
    990990      fUNKNOWN);
    991     TSprite(x, y, spRiver + Conn mod 8 + (Conn div 8) * TerrainIconCols);
     991    TSprite(X, Y, spRiver + Conn mod 8 + (Conn div 8) * TerrainIconCols);
    992992  end;
    993993
     
    997997    for Dir := 0 to 3 do
    998998      if Conn and (1 shl Dir) <> 0 then { river mouths }
    999         TSprite(x, y, spRiverMouths + Dir);
     999        TSprite(X, Y, spRiverMouths + Dir);
    10001000    if ShowObjects then
    10011001    begin
     
    10031003      for Dir := 0 to 7 do
    10041004        if Conn and (1 shl Dir) <> 0 then { canal mouths }
    1005           TSprite(x, y, spCanalMouths + 1 + Dir);
     1005          TSprite(X, Y, spCanalMouths + 1 + Dir);
    10061006    end;
    10071007  end;
     
    10151015      if Conn = 0 then begin
    10161016        if Tile and fCanal <> 0 then
    1017           TSprite(x, y, spCanal);
     1017          TSprite(X, Y, spCanal);
    10181018      end
    10191019      else
    10201020        for Dir := 0 to 7 do
    10211021          if (1 shl Dir) and Conn <> 0 then
    1022             TSprite(x, y, spCanal + 1 + Dir);
     1022            TSprite(X, Y, spCanal + 1 + Dir);
    10231023    end;
    10241024
     
    10321032      Conn := Connection8(Loc, fRoad or fRR or fCity) and not RRConn;
    10331033      if (Conn = 0) and (Tile and (fRR or fCity) = 0) then
    1034         TSprite(x, y, spRoad)
     1034        TSprite(X, Y, spRoad)
    10351035      else if Conn > 0 then
    10361036        for Dir := 0 to 7 do
    10371037          if (1 shl Dir) and Conn <> 0 then
    1038             TSprite(x, y, spRoad + 1 + Dir);
     1038            TSprite(X, Y, spRoad + 1 + Dir);
    10391039    end;
    10401040
    10411041    // Paint railroad connections
    10421042    if (Tile and fRR <> 0) and (RRConn = 0) then
    1043       TSprite(x, y, spRailRoad)
     1043      TSprite(X, Y, spRailRoad)
    10441044    else if RRConn > 0 then begin
    10451045      for Dir := 0 to 7 do
    10461046        if (1 shl Dir) and RRConn <> 0 then
    1047           TSprite(x, y, spRailRoad + 1 + Dir);
     1047          TSprite(X, Y, spRailRoad + 1 + Dir);
    10481048    end;
    10491049  end;
     
    10511051
    10521052// (x,y) is top left pixel of (2*xxt,3*yyt) rectangle
    1053 procedure TIsoMap.PaintTileObjects(x, y, Loc, CityLoc, CityOwner: integer;
    1054   UseBlink: boolean);
    1055 var
    1056   p1, p2, uix, cix, dy, Loc1, Tile, Multi, Destination: integer;
     1053procedure TIsoMap.PaintTileObjects(X, Y, Loc, CityLoc, CityOwner: Integer;
     1054  UseBlink: Boolean);
     1055var
     1056  p1, p2, uix, cix, dy, Loc1, Tile, Multi, Destination: Integer;
    10571057  CityInfo: TCityInfo;
    10581058  UnitInfo: TUnitInfo;
    1059   fog: boolean;
     1059  fog: Boolean;
    10601060  SpecialRow: Integer;
    10611061  SpecialCol: Integer;
     
    10631063  procedure NameCity;
    10641064  var
    1065     cix, xs, w: integer;
     1065    cix, xs, W: Integer;
    10661066    BehindCityInfo: TCityInfo;
    1067     s: string;
    1068     IsCapital: boolean;
     1067    S: string;
     1068    IsCapital: Boolean;
    10691069  begin
    10701070    BehindCityInfo.Loc := Loc - 2 * G.lx;
     
    10761076      IsCapital := BehindCityInfo.Flags and ciCapital <> 0;
    10771077      { if Showuix and (cix>=0) then s:=IntToStr(cix)
    1078         else } s := CityName(BehindCityInfo.ID);
    1079       w := FOutput.Canvas.TextWidth(s);
    1080       xs := x + xxt - (w + 1) div 2;
     1078        else } S := CityName(BehindCityInfo.ID);
     1079      W := FOutput.Canvas.TextWidth(S);
     1080      xs := X + xxt - (W + 1) div 2;
    10811081      if IsCapital then
    10821082        FOutput.Canvas.Font.Style := FOutput.Canvas.Font.Style + [fsUnderline];
    1083       Textout(xs + 1, y - 9, $000000, s);
    1084       Textout(xs, y - 10, $FFFFFF, s);
     1083      Textout(xs + 1, Y - 9, $000000, S);
     1084      Textout(xs, Y - 10, $FFFFFF, S);
    10851085      if IsCapital then
    10861086        FOutput.Canvas.Font.Style := FOutput.Canvas.Font.Style - [fsUnderline];
     
    10921092    if ShowObjects and not (moEditMode in MapOptions) and
    10931093      (Tile and fCity <> 0) and (CityInfo.Flags and ciSpacePort <> 0) then
    1094       TSprite(x + xxt, y - 6, spSpacePort);
     1094      TSprite(X + xxt, Y - 6, spSpacePort);
    10951095  end;
    10961096
    10971097  procedure PaintBorder;
    10981098  var
    1099     dx, dy: integer;
     1099    dx, dy: Integer;
    11001100  begin
    11011101    if ShowBorder and (Loc >= 0) and (Loc < G.lx * G.ly) and
    11021102      (Tile and fTerrain <> fUNKNOWN) then begin
    11031103      p1 := MyRO.Territory[Loc];
    1104       if (p1 >= 0) and (ShowMyBorder or (p1 <> me)) then begin
     1104      if (p1 >= 0) and (ShowMyBorder or (p1 <> Me)) then begin
    11051105        if BordersOK^ and (1 shl p1) = 0 then begin
    11061106          UnshareBitmap(Borders);
     
    11231123              if p2 <> p1 then
    11241124              begin
    1125                 BitBltBitmap(HGrTerrain.Mask, x + dx * xxt, y + dy * yyt, xxt,
     1125                BitBltBitmap(HGrTerrain.Mask, X + dx * xxt, Y + dy * yyt, xxt,
    11261126                  yyt, 1 + 8 * (xxt * 2 + 1) + dx * xxt,
    11271127                  1 + yyt + 16 * (yyt * 3 + 1) + dy * yyt, SRCAND);
    1128                 BitBltBitmap(Borders, x + dx * xxt, y + dy * yyt, xxt, yyt, dx * xxt,
     1128                BitBltBitmap(Borders, X + dx * xxt, Y + dy * yyt, xxt, yyt, dx * xxt,
    11291129                  p1 * (yyt * 2) + dy * yyt, SRCPAINT);
    11301130              end;
     
    11431143    (Tile and fCity <> 0) then
    11441144    GetCityInfo(Loc, cix, CityInfo);
    1145   if (y <= FTop - yyt * 2) or (y > FBottom) or (x <= FLeft - xxt * 2) or
    1146     (x > FRight) then
     1145  if (Y <= FTop - yyt * 2) or (Y > FBottom) or (X <= FLeft - xxt * 2) or
     1146    (X > FRight) then
    11471147  begin
    11481148    NameCity;
    11491149    ShowSpacePort;
    1150     exit;
     1150    Exit;
    11511151  end;
    11521152  if Tile and fTerrain = fUNKNOWN then
     
    11541154    NameCity;
    11551155    ShowSpacePort;
    1156     exit;
     1156    Exit;
    11571157  end; { square not discovered }
    11581158
     
    11611161
    11621162  if (Loc >= 0) and (Loc < G.lx * G.ly) and (Loc = FAdviceLoc) then
    1163     TSprite(x, y, spPlain);
     1163    TSprite(X, Y, spPlain);
    11641164
    11651165  if (Loc >= 0) and (Loc < G.lx * G.ly) and (Tile and fSpecial <> 0)
     
    11701170    SpecialRow := Tile and fSpecial shr 5;
    11711171    if SpecialCol < fForest then
    1172       TSprite(x, y, SpecialCol + SpecialRow * TerrainIconCols)
     1172      TSprite(X, Y, SpecialCol + SpecialRow * TerrainIconCols)
    11731173    else if (SpecialCol = fForest) and IsJungle(dy) then
    1174       TSprite(x, y, spJungle - 1 + SpecialRow * TerrainIconCols)
     1174      TSprite(X, Y, spJungle - 1 + SpecialRow * TerrainIconCols)
    11751175    else
    1176       TSprite(x, y, spForest - 1 + ((SpecialCol - fForest) * 2 + SpecialRow) * TerrainIconCols);
     1176      TSprite(X, Y, spForest - 1 + ((SpecialCol - fForest) * 2 + SpecialRow) * TerrainIconCols);
    11771177  end;
    11781178
     
    11801180  begin
    11811181    if Tile and fTerImp = tiMine then
    1182       TSprite(x, y, spMine);
     1182      TSprite(X, Y, spMine);
    11831183    if Tile and fTerImp = tiBase then
    1184       TSprite(x, y, spBase);
     1184      TSprite(X, Y, spBase);
    11851185    if Tile and fPoll <> 0 then
    1186       TSprite(x, y, spPollution);
     1186      TSprite(X, Y, spPollution);
    11871187    if Tile and fTerImp = tiFort then
    11881188    begin
    1189       TSprite(x, y, spFortBack);
     1189      TSprite(X, Y, spFortBack);
    11901190      if Tile and fObserved = 0 then
    1191         TSprite(x, y, spFortFront);
     1191        TSprite(X, Y, spFortFront);
    11921192    end;
    11931193  end;
    11941194  if (Tile and fDeadLands) <> 0 then
    1195     TSprite(x, y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols);
     1195    TSprite(X, Y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols);
    11961196
    11971197  if moEditMode in MapOptions then
     
    12051205  if fog and ShowObjects then
    12061206    if Loc < -G.lx then
    1207       Sprite(HGrTerrain, x, y + yyt, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),
     1207      Sprite(HGrTerrain, X, Y + yyt, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),
    12081208        1 + yyt * 2 + 15 * (yyt * 3 + 1))
    12091209    else if Loc >= G.lx * (G.ly + 1) then
    1210       Sprite(HGrTerrain, x, y, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),
     1210      Sprite(HGrTerrain, X, Y, xxt * 2, yyt, 1 + 6 * (xxt * 2 + 1),
    12111211        1 + yyt + 15 * (yyt * 3 + 1))
    12121212    else
    1213       TSprite(x, y, spGrid, xxt <> 33);
     1213      TSprite(X, Y, spGrid, xxt <> 33);
    12141214
    12151215  if FoW and (Tile and fObserved = 0) then
     
    12241224    if (Destination = Loc) and (Destination <> MyUn[UnFocus].Loc) then
    12251225      if not UseBlink or BlinkOn then
    1226         TSprite(x, y, spBlink1)
     1226        TSprite(X, Y, spBlink1)
    12271227      else
    1228         TSprite(x, y, spBlink2)
     1228        TSprite(X, Y, spBlink2)
    12291229  end;
    12301230{$ENDIF}
     
    12321232  begin
    12331233    if Tile and fPrefStartPos <> 0 then
    1234       TSprite(x, y, spPrefStartPos)
     1234      TSprite(X, Y, spPrefStartPos)
    12351235    else if Tile and fStartPos <> 0 then
    1236       TSprite(x, y, spStartPos);
     1236      TSprite(X, Y, spStartPos);
    12371237  end
    12381238  else if ShowObjects then
    12391239  begin
    12401240    { if (CityLoc<0) and (UnFocus>=0) and (Loc=MyUn[UnFocus].Loc) then
    1241       if BlinkOn then TSprite(x,y,8+9*0)
    1242       else TSprite(x,y,8+9*1); }
     1241      if BlinkOn then TSprite(X,Y,8+9*0)
     1242      else TSprite(X,Y,8+9*1); }
    12431243
    12441244    NameCity;
    12451245    ShowSpacePort;
    12461246    if Tile and fCity <> 0 then
    1247       PaintCity(x + xxt, y + yyt, CityInfo, CityOwner < 0);
     1247      PaintCity(X + xxt, Y + yyt, CityInfo, CityOwner < 0);
    12481248
    12491249    if (Tile and fUnit <> 0) and (Loc <> AttLoc) and
     
    12591259        UnitInfo.Health := DefHealth;
    12601260      if (UnitInfo.Owner <> CityOwner) and
    1261         not((CityOwner = me) and (MyRO.Treaty[UnitInfo.Owner] = trAlliance))
     1261        not((CityOwner = Me) and (MyRO.Treaty[UnitInfo.Owner] = trAlliance))
    12621262      then
    12631263{$IFNDEF SCR} if (UnFocus >= 0) and (Loc = MyUn[UnFocus].Loc) then { active unit }
    12641264        begin
    12651265          Multi := UnitInfo.Flags and unMulti;
    1266           MakeUnitInfo(me, MyUn[UnFocus], UnitInfo);
     1266          MakeUnitInfo(Me, MyUn[UnFocus], UnitInfo);
    12671267          UnitInfo.Flags := UnitInfo.Flags or Multi;
    1268           PaintUnit(x + (xxt - xxu), y + (yyt - yyu_anchor), UnitInfo,
     1268          PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo,
    12691269            MyUn[UnFocus].Status);
    12701270        end
    1271         else if UnitInfo.Owner = me then
     1271        else if UnitInfo.Owner = Me then
    12721272        begin
    12731273          if ClientMode = cMovieTurn then
    1274             PaintUnit(x + (xxt - xxu), y + (yyt - yyu_anchor), UnitInfo, 0)
     1274            PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 0)
    12751275            // status is not set with precise timing during loading
    12761276          else
    1277             PaintUnit(x + (xxt - xxu), y + (yyt - yyu_anchor), UnitInfo,
     1277            PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo,
    12781278              MyUn[uix].Status);
    12791279          // if Showuix then Textout(x+16,y+5,$80FF00,IntToStr(uix));
    12801280        end
    1281         else {$ENDIF} PaintUnit(x + (xxt - xxu), y + (yyt - yyu_anchor), UnitInfo, 0);
     1281        else {$ENDIF} PaintUnit(X + (xxt - xxu), Y + (yyt - yyu_anchor), UnitInfo, 0);
    12821282    end
    12831283    else if Tile and fHiddenUnit <> 0 then
    1284       Sprite(HGrStdUnits, x + (xxt - xxu), y + (yyt - yyu_anchor), xxu * 2,
     1284      Sprite(HGrStdUnits, X + (xxt - xxu), Y + (yyt - yyu_anchor), xxu * 2,
    12851285        yyu * 2, 1 + 5 * (xxu * 2 + 1), 1)
    12861286    else if Tile and fStealthUnit <> 0 then
    1287       Sprite(HGrStdUnits, x + (xxt - xxu), y + (yyt - yyu_anchor), xxu * 2,
     1287      Sprite(HGrStdUnits, X + (xxt - xxu), Y + (yyt - yyu_anchor), xxu * 2,
    12881288        yyu * 2, 1 + 5 * (xxu * 2 + 1), 1 + 1 * (yyu * 2 + 1))
    12891289  end;
     
    12911291  if ShowObjects and (Tile and fTerImp = tiFort) and (Tile and fObserved <> 0)
    12921292  then
    1293     TSprite(x, y, spFortFront);
     1293    TSprite(X, Y, spFortFront);
    12941294
    12951295  if (Loc >= 0) and (Loc < G.lx * G.ly) then
    12961296    if ShowLoc then
    1297       Textout(x + xxt - 16, y + yyt - 9, $FFFF00, IntToStr(Loc))
     1297      Textout(X + xxt - 16, Y + yyt - 9, $FFFF00, IntToStr(Loc))
    12981298    else if ShowDebug and (DebugMap <> nil) and (Loc >= 0) and
    12991299      (Loc < G.lx * G.ly) and (DebugMap[Loc] <> 0) then
    1300       Textout(x + xxt - 16, y + yyt - 9, $00E0FF,
    1301         IntToStr(integer(DebugMap[Loc])))
    1302 end;
    1303 
    1304 procedure TIsoMap.PaintGrid(x, y, nx, ny: integer);
    1305 
    1306   procedure ClippedLine(dx0, dy0: integer; mirror: boolean);
     1300      Textout(X + xxt - 16, Y + yyt - 9, $00E0FF,
     1301        IntToStr(Integer(DebugMap[Loc])))
     1302end;
     1303
     1304procedure TIsoMap.PaintGrid(X, Y, nx, ny: Integer);
     1305
     1306  procedure ClippedLine(dx0, dy0: Integer; mirror: Boolean);
    13071307  var
    1308     x0, x1, dxmin, dymin, dxmax, dymax, n: integer;
     1308    x0, x1, dxmin, dymin, dxmax, dymax, N: Integer;
    13091309  begin
    13101310    with FOutput.Canvas do
    13111311    begin
    1312       dxmin := (FLeft - x) div xxt;
    1313       dymin := (RealTop - y) div yyt;
    1314       dxmax := (FRight - x - 1) div xxt + 1;
    1315       dymax := (RealBottom - y - 1) div yyt + 1;
    1316       n := dymax - dy0;
     1312      dxmin := (FLeft - X) div xxt;
     1313      dymin := (RealTop - Y) div yyt;
     1314      dxmax := (FRight - X - 1) div xxt + 1;
     1315      dymax := (RealBottom - Y - 1) div yyt + 1;
     1316      N := dymax - dy0;
    13171317      if mirror then
    13181318      begin
    1319         if dx0 - dxmin < n then
    1320           n := dx0 - dxmin;
     1319        if dx0 - dxmin < N then
     1320          N := dx0 - dxmin;
    13211321        if dx0 > dxmax then
    13221322        begin
    1323           n := n - (dx0 - dxmax);
     1323          N := N - (dx0 - dxmax);
    13241324          dy0 := dy0 + (dx0 - dxmax);
    13251325          dx0 := dxmax
     
    13271327        if dy0 < dymin then
    13281328        begin
    1329           n := n - (dymin - dy0);
     1329          N := N - (dymin - dy0);
    13301330          dx0 := dx0 - (dymin - dy0);
    13311331          dy0 := dymin
     
    13341334      else
    13351335      begin
    1336         if dxmax - dx0 < n then
    1337           n := dxmax - dx0;
     1336        if dxmax - dx0 < N then
     1337          N := dxmax - dx0;
    13381338        if dx0 < dxmin then
    13391339        begin
    1340           n := n - (dxmin - dx0);
     1340          N := N - (dxmin - dx0);
    13411341          dy0 := dy0 + (dxmin - dx0);
    13421342          dx0 := dxmin
     
    13441344        if dy0 < dymin then
    13451345        begin
    1346           n := n - (dymin - dy0);
     1346          N := N - (dymin - dy0);
    13471347          dx0 := dx0 + (dymin - dy0);
    13481348          dy0 := dymin
    13491349        end;
    13501350      end;
    1351       if n <= 0 then
    1352         exit;
     1351      if N <= 0 then
     1352        Exit;
    13531353      if mirror then
    13541354      begin
    1355         x0 := x + dx0 * xxt - 1;
    1356         x1 := x + (dx0 - n) * xxt - 1;
     1355        x0 := X + dx0 * xxt - 1;
     1356        x1 := X + (dx0 - N) * xxt - 1;
    13571357      end
    13581358      else
    13591359      begin
    1360         x0 := x + dx0 * xxt;
    1361         x1 := x + (dx0 + n) * xxt;
     1360        x0 := X + dx0 * xxt;
     1361        x1 := X + (dx0 + N) * xxt;
    13621362      end;
    1363       moveto(x0, y + dy0 * yyt);
    1364       lineto(x1, y + (dy0 + n) * yyt);
     1363      moveto(x0, Y + dy0 * yyt);
     1364      lineto(x1, Y + (dy0 + N) * yyt);
    13651365    end;
    13661366  end;
    13671367
    13681368var
    1369   i: integer;
     1369  I: Integer;
    13701370begin
    13711371  FOutput.Canvas.pen.Color := $000000; // $FF shl (8*random(3));
    1372   for i := 0 to nx div 2 do
    1373     ClippedLine(i * 2, 0, false);
    1374   for i := 1 to (nx + 1) div 2 do
    1375     ClippedLine(i * 2, 0, true);
    1376   for i := 0 to ny div 2 do
    1377   begin
    1378     ClippedLine(0, 2 * i + 2, false);
    1379     ClippedLine(nx + 1, 2 * i + 1 + nx and 1, true);
    1380   end;
    1381 end;
    1382 
    1383 function TIsoMap.IsShoreTile(Loc: integer): boolean;
     1372  for I := 0 to nx div 2 do
     1373    ClippedLine(I * 2, 0, False);
     1374  for I := 1 to (nx + 1) div 2 do
     1375    ClippedLine(I * 2, 0, True);
     1376  for I := 0 to ny div 2 do
     1377  begin
     1378    ClippedLine(0, 2 * I + 2, False);
     1379    ClippedLine(nx + 1, 2 * I + 1 + nx and 1, True);
     1380  end;
     1381end;
     1382
     1383function TIsoMap.IsShoreTile(Loc: Integer): Boolean;
    13841384var
    13851385  Dir: Integer;
    1386   ConnLoc: integer;
    1387 begin
    1388   result := false;
     1386  ConnLoc: Integer;
     1387begin
     1388  Result := False;
    13891389  for Dir := 0 to 7 do
    13901390  begin
     
    13921392    if (ConnLoc < 0) or (ConnLoc >= G.lx * G.ly) or
    13931393      ((MyMap[ConnLoc] - 2) and fTerrain < 13) then
    1394       result := true;
     1394      Result := True;
    13951395  end;
    13961396end;
     
    14011401begin
    14021402  for I := 0 to Length - 1 do begin
    1403     Line^.Pixel^.B := (Line^.Pixel^.B shr 1) and $7f;
    1404     Line^.Pixel^.G := (Line^.Pixel^.G shr 1) and $7f;
    1405     Line^.Pixel^.R := (Line^.Pixel^.R shr 1) and $7f;
     1403    Line^.Pixel^.B := (Line^.Pixel^.B shr 1) and $7F;
     1404    Line^.Pixel^.G := (Line^.Pixel^.G shr 1) and $7F;
     1405    Line^.Pixel^.R := (Line^.Pixel^.R shr 1) and $7F;
    14061406    Line^.NextPixel;
    14071407  end;
     
    14151415end;
    14161416
    1417 procedure TIsoMap.ShadeOutside(x0, y0, Width, Height, xm, ym: integer);
     1417procedure TIsoMap.ShadeOutside(x0, y0, Width, Height, xm, ym: Integer);
    14181418const
    14191419  rShade = 3.75;
    14201420var
    1421   y, wBright: integer;
    1422   y_n, w_n: single;
     1421  Y, wBright: Integer;
     1422  y_n, w_n: Single;
    14231423  Line: TPixelPointer;
    14241424begin
    14251425  FOutput.BeginUpdate;
    14261426  Line := PixelPointer(FOutput, ScaleToNative(x0), ScaleToNative(y0));
    1427   for y := 0 to ScaleToNative(Height) - 1 do begin
    1428     y_n := (ScaleFromNative(y) + y0 - ym) / yyt;
     1427  for Y := 0 to ScaleToNative(Height) - 1 do begin
     1428    y_n := (ScaleFromNative(Y) + y0 - ym) / yyt;
    14291429    if abs(y_n) < rShade then begin
    14301430      // Darken left and right parts of elipsis
     
    14451445end;
    14461446
    1447 procedure TIsoMap.CityGrid(xm, ym: integer; CityAllowClick: Boolean);
    1448 var
    1449   i: integer;
     1447procedure TIsoMap.CityGrid(xm, ym: Integer; CityAllowClick: Boolean);
     1448var
     1449  I: Integer;
    14501450begin
    14511451  with FOutput.Canvas do
     
    14561456      pen.Color := $000000;
    14571457    pen.Width := 1;
    1458     for i := 0 to 3 do
     1458    for I := 0 to 3 do
    14591459    begin
    1460       moveto(xm - xxt * (4 - i), ym + yyt * (1 + i));
    1461       lineto(xm + xxt * (1 + i), ym - yyt * (4 - i));
    1462       moveto(xm - xxt * (4 - i), ym - yyt * (1 + i));
    1463       lineto(xm + xxt * (1 + i), ym + yyt * (4 - i));
     1460      moveto(xm - xxt * (4 - I), ym + yyt * (1 + I));
     1461      lineto(xm + xxt * (1 + I), ym - yyt * (4 - I));
     1462      moveto(xm - xxt * (4 - I), ym - yyt * (1 + I));
     1463      lineto(xm + xxt * (1 + I), ym + yyt * (4 - I));
    14641464    end;
    14651465    moveto(xm - xxt * 4, ym + yyt * 1);
     
    14751475end;
    14761476
    1477 procedure TIsoMap.Paint(x, y, Loc, nx, ny, CityLoc, CityOwner: integer;
    1478   UseBlink: boolean; CityAllowClick: boolean);
    1479 var
    1480   dx, dy, xm, ym, ALoc, BLoc, ATer, BTer, Aix, bix: integer;
    1481 begin
    1482   FoW := true;
     1477procedure TIsoMap.Paint(X, Y, Loc, nx, ny, CityLoc, CityOwner: Integer;
     1478  UseBlink: Boolean; CityAllowClick: Boolean);
     1479var
     1480  dx, dy, xm, ym, ALoc, BLoc, ATer, BTer, Aix, bix: Integer;
     1481begin
     1482  FoW := True;
    14831483  ShowLoc := moLocCodes in MapOptions;
    14841484  ShowDebug := pDebugMap >= 0;
     
    14861486  ShowCityNames := ShowObjects and (CityOwner < 0) and
    14871487    (moCityNames in MapOptions);
    1488   ShowBorder := true;
     1488  ShowBorder := True;
    14891489  ShowMyBorder := CityOwner < 0;
    14901490  ShowGrWall := (CityOwner < 0) and (moGreatWall in MapOptions);
    14911491  if ShowDebug then
    1492     Server(sGetDebugMap, me, pDebugMap, DebugMap)
     1492    Server(sGetDebugMap, Me, pDebugMap, DebugMap)
    14931493  else
    14941494    DebugMap := nil;
    14951495  with FOutput.Canvas do
    14961496  begin
    1497     RealTop := y - ((Loc + 12345 * G.lx) div G.lx - 12345) * yyt;
    1498     RealBottom := y + (G.ly - ((Loc + 12345 * G.lx) div G.lx - 12345) +
     1497    RealTop := Y - ((Loc + 12345 * G.lx) div G.lx - 12345) * yyt;
     1498    RealBottom := Y + (G.ly - ((Loc + 12345 * G.lx) div G.lx - 12345) +
    14991499      3) * yyt;
    15001500    Brush.Color := EmptySpaceColor;
     
    15731573                  bix := 0;
    15741574                end;
    1575               BitBltBitmap(OceanPatch, x + dx * xxt, y + dy * yyt, xxt, yyt,
     1575              BitBltBitmap(OceanPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt,
    15761576                Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY)
    15771577            end
     
    16211621                bix := Aix;
    16221622            if Aix = -1 then
    1623               BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y + dy * yyt, xxt,
     1623              BitBltBitmap(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt,
    16241624                yyt, 1 + 6 * (xxt * 2 + 1) + (dx + dy + 1) and 1 * xxt, 1 + yyt,
    16251625                SRCCOPY) // arctic <-> ocean
    16261626            else if bix = -1 then
    1627               BitBltBitmap(HGrTerrain.Data, x + dx * xxt, y + dy * yyt, xxt,
     1627              BitBltBitmap(HGrTerrain.Data, X + dx * xxt, Y + dy * yyt, xxt,
    16281628                yyt, 1 + 6 * (xxt * 2 + 1) + xxt - (dx + dy + 1) and 1 * xxt,
    16291629                1 + yyt * 2, SRCCOPY) // arctic <-> ocean
    16301630            else
    1631               BitBltBitmap(LandPatch, x + dx * xxt, y + dy * yyt, xxt, yyt,
     1631              BitBltBitmap(LandPatch, X + dx * xxt, Y + dy * yyt, xxt, yyt,
    16321632                Aix * (xxt * 2) + (dx + dy + 1) and 1 * xxt, bix * yyt, SRCCOPY)
    16331633          end;
     
    16391639    for dx := -1 to nx do
    16401640      if (dx + dy) and 1 = 0 then
    1641         PaintShore(x + xxt * dx, y + yyt + yyt * dy, dLoc(Loc, dx, dy));
     1641        PaintShore(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy));
    16421642  for dy := -2 to ny + 1 do
    16431643    for dx := -1 to nx do
    16441644      if (dx + dy) and 1 = 0 then
    1645         PaintTileExtraTerrain(x + xxt * dx, y + yyt + yyt * dy,
     1645        PaintTileExtraTerrain(X + xxt * dx, Y + yyt + yyt * dy,
    16461646          dLoc(Loc, dx, dy));
    16471647  if CityOwner >= 0 then
     
    16531653          ALoc := dLoc(Loc, dx, dy);
    16541654          if Distance(ALoc, CityLoc) > 5 then
    1655             PaintTileObjects(x + xxt * dx, y + yyt + yyt * dy, ALoc, CityLoc,
     1655            PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc,
    16561656              CityOwner, UseBlink);
    16571657        end;
     
    16601660      * G.lx) mod (2 * G.lx) - G.lx;
    16611661    dy := CityLoc div G.lx - (Loc + 666 * G.lx) div G.lx + 666;
    1662     xm := x + (dx + 1) * xxt;
    1663     ym := y + (dy + 1) * yyt + yyt;
     1662    xm := X + (dx + 1) * xxt;
     1663    ym := Y + (dy + 1) * yyt + yyt;
    16641664    ShadeOutside(FLeft, FTop, FRight - FLeft, FBottom - FTop, xm, ym);
    16651665    CityGrid(xm, ym, CityAllowClick);
     
    16701670          ALoc := dLoc(Loc, dx, dy);
    16711671          if Distance(ALoc, CityLoc) <= 5 then
    1672             PaintTileObjects(x + xxt * dx, y + yyt + yyt * dy, ALoc, CityLoc,
     1672            PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, ALoc, CityLoc,
    16731673              CityOwner, UseBlink);
    16741674        end;
     
    16781678    if ShowLoc or (moEditMode in MapOptions) or
    16791679      (moGrid in MapOptions) then
    1680       PaintGrid(x, y, nx, ny);
     1680      PaintGrid(X, Y, nx, ny);
    16811681    for dy := -2 to ny + 1 do
    16821682      for dx := -2 to nx + 1 do
    16831683        if (dx + dy) and 1 = 0 then
    1684           PaintTileObjects(x + xxt * dx, y + yyt + yyt * dy, dLoc(Loc, dx, dy),
     1684          PaintTileObjects(X + xxt * dx, Y + yyt + yyt * dy, dLoc(Loc, dx, dy),
    16851685            CityLoc, CityOwner, UseBlink);
    16861686  end;
Note: See TracChangeset for help on using the changeset viewer.