Ignore:
Timestamp:
Nov 30, 2023, 10:16:14 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Updated high dpi branch from trunk.
  • Modified: Use generics.collections instead of fgl.
  • Modified: Compile with Delphi syntax.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Start.pas

    r405 r465  
    77  UDpiControls, GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Types,
    88  LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
    9   Menus, Registry,  DrawDlg, fgl, Protocol, UMiniMap, UBrain;
     9  Menus, Registry, DrawDlg, Generics.Collections, Protocol, MiniMap, Brain,
     10  Translator;
    1011
    1112type
    12 
    1313  { TPlayerSlot }
    1414
     
    2121  end;
    2222
    23   TPlayerSlots = class(TFPGObjectList<TPlayerSlot>)
     23  TPlayerSlots = class(TObjectList<TPlayerSlot>)
    2424  end;
    2525
     
    6969    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    7070    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
    71       Shift: TShiftState; x, y: integer);
     71      Shift: TShiftState; X, Y: Integer);
    7272    procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
    73       Shift: TShiftState; x, y: integer);
    74     procedure FormMouseMove(Sender: TObject; Shift: TShiftState; x, y: integer);
     73      Shift: TShiftState; X, Y: Integer);
     74    procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    7575    procedure Up1BtnClick(Sender: TObject);
    7676    procedure Down1BtnClick(Sender: TObject);
     
    122122    MiniMap: TMiniMap;
    123123    LastGame: string;
    124     procedure DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string);
     124    procedure DrawAction(Y, IconIndex: Integer; HeaderItem, TextItem: string);
    125125    procedure InitPopup(PlayerIndex: Integer);
    126126    procedure OfferBrain(Brain: TBrain; FixedLines: Integer);
     
    129129    procedure ChangeTab(NewTab: TStartTab);
    130130    procedure UnlistBackupFile(FileName: string);
    131     procedure SmartInvalidate(x0, y0, x1, y1: integer;
    132       invalidateTab0: boolean = false); overload;
     131    procedure SmartInvalidate(x0, y0, x1, y1: Integer;
     132      invalidateTab0: Boolean = False); overload;
    133133    procedure LoadConfig;
    134134    procedure SaveConfig;
     135    procedure LoadLanguages;
    135136    procedure LoadAiBrainsPictures;
    136137    procedure UpdateInterface;
     
    138139  public
    139140    EmptyPicture: TDpiBitmap;
     141    Translator: TTranslator;
    140142    procedure UpdateFormerGames;
    141143    procedure UpdateMaps;
     
    149151
    150152uses
    151   Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UKeyBindings;
     153  Global, Directories, Direct, ScreenTools, Inp, Back, Settings, KeyBindings,
     154  Languages;
    152155
    153156{$R *.lfm}
     
    157160  // attention: lx*ly+1 must be prime!
    158161  { MaxWorldSize=8;
    159     lxpre: array[0..nWorldSize-1] of integer =(30,40,50,60,70,90,110,130);
    160     lypre: array[0..nWorldSize-1] of integer =(46,52,60,70,84,94,110,130);
     162    lxpre: array[0..nWorldSize-1] of Integer =(30,40,50,60,70,90,110,130);
     163    lypre: array[0..nWorldSize-1] of Integer =(46,52,60,70,84,94,110,130);
    161164    DefaultWorldTiles=4200; }
    162165  MaxWorldSize = 6;
     
    189192  dxBrain = 104;
    190193  dyBrain = 80;
    191   xBrain: array [0 .. nPlOffered - 1] of integer = (x0Brain, x0Brain,
     194  xBrain: array [0 .. nPlOffered - 1] of Integer = (x0Brain, x0Brain,
    192195    x0Brain + dxBrain, x0Brain + dxBrain, x0Brain + dxBrain, x0Brain,
    193196    x0Brain - dxBrain, x0Brain - dxBrain, x0Brain - dxBrain);
    194   yBrain: array [0 .. nPlOffered - 1] of integer = (y0Brain, y0Brain - dyBrain,
     197  yBrain: array [0 .. nPlOffered - 1] of Integer = (y0Brain, y0Brain - dyBrain,
    195198    y0Brain - dyBrain, y0Brain, y0Brain + dyBrain, y0Brain + dyBrain,
    196199    y0Brain + dyBrain, y0Brain, y0Brain - dyBrain);
     
    199202  TabHeight = 40;
    200203
    201   InitAlive: array [1 .. nPl] of integer = (1, 1 + 2, 1 + 2 + 32,
     204  InitAlive: array [1 .. nPl] of Integer = (1, 1 + 2, 1 + 2 + 32,
    202205    1 + 2 + 8 + 128, 1 + 2 + 8 + 32 + 128, 1 + 2 + 8 + 16 + 64 + 128,
    203206    1 + 2 + 4 + 16 + 32 + 64 + 256, 511 - 32, 511, 511 - 32, 511, 511 - 32, 511,
    204207    511 - 32, 511);
    205   InitMulti: array [nPlOffered + 1 .. nPl] of integer = (256, 256, 256 + 128,
     208  InitMulti: array [nPlOffered + 1 .. nPl] of Integer = (256, 256, 256 + 128,
    206209    256 + 128, 256 + 128 + 64, 256 + 128 + 64);
    207210
    208   PlayerAutoDiff: array [1 .. 5] of integer = (1, 1, 2, 2, 3);
    209   EnemyAutoDiff: array [1 .. 5] of integer = (4, 3, 2, 1, 1);
     211  PlayerAutoDiff: array [1 .. 5] of Integer = (1, 1, 2, 2, 3);
     212  EnemyAutoDiff: array [1 .. 5] of Integer = (4, 3, 2, 1, 1);
    210213
    211214{ TStartDlg }
     
    213216procedure TStartDlg.FormCreate(Sender: TObject);
    214217var
    215   x, i: Integer;
     218  X, I: Integer;
    216219  PlayerSlot: TPlayerSlot;
    217220  AIBrains: TBrains;
     
    226229  LoadConfig;
    227230  LoadAssets;
     231  LoadLanguages;
    228232
    229233  ActionsOffered := [maConfig, maManual, maCredits, maWeb];
     
    232236
    233237  BrainDefault := nil;
    234   for i := Brains.IndexOf(BrainRandom) to Brains.Count - 1 do
    235     if AnsiCompareFileName(DefaultAI, Brains[i].FileName) = 0 then
    236       BrainDefault := Brains[i];
     238  for I := Brains.IndexOf(BrainRandom) to Brains.Count - 1 do
     239    if AnsiCompareFileName(DefaultAI, Brains[I].FileName) = 0 then
     240      BrainDefault := Brains[I];
    237241  if (BrainDefault = BrainRandom) and (Brains.GetKindCount(btAI) < 2) then
    238242    BrainDefault := nil;
     
    256260  ReplayBtn.Hint := Phrases.Lookup('BTN_REPLAY');
    257261  PlayerSlots.Count := nPlOffered;
    258   for i := 0 to PlayerSlots.Count - 1 do
    259   with PlayerSlots[i] do begin
     262  for I := 0 to PlayerSlots.Count - 1 do
     263  with PlayerSlots[I] do begin
    260264    DiffUpBtn := TButtonC.Create(self);
    261265    DiffUpBtn.Graphic := HGrSystem.Data;
    262     DiffUpBtn.left := xBrain[i] - 18;
    263     DiffUpBtn.top := yBrain[i] + 39;
     266    DiffUpBtn.left := xBrain[I] - 18;
     267    DiffUpBtn.top := yBrain[I] + 39;
    264268    DiffUpBtn.ButtonIndex := 1;
    265269    DiffUpBtn.Parent := self;
     
    267271    DiffDownBtn := TButtonC.Create(self);
    268272    DiffDownBtn.Graphic := HGrSystem.Data;
    269     DiffDownBtn.left := xBrain[i] - 18;
    270     DiffDownBtn.top := yBrain[i] + 51;
     273    DiffDownBtn.left := xBrain[I] - 18;
     274    DiffDownBtn.top := yBrain[I] + 51;
    271275    DiffDownBtn.ButtonIndex := 0;
    272276    DiffDownBtn.Parent := self;
    273277    DiffDownBtn.OnClick := DiffBtnClick;
    274278  end;
    275   for i := 6 to 8 do
    276   with PlayerSlots[i] do begin
     279  for I := 6 to 8 do
     280  with PlayerSlots[I] do begin
    277281    MultiBtn := TButtonC.Create(self);
    278282    MultiBtn.Graphic := HGrSystem.Data;
    279     MultiBtn.left := xBrain[i] - 18;
    280     MultiBtn.top := yBrain[i];
     283    MultiBtn.left := xBrain[I] - 18;
     284    MultiBtn.top := yBrain[I];
    281285    MultiBtn.Parent := self;
    282286    MultiBtn.OnClick := MultiBtnClick;
     
    284288  end;
    285289
    286   x := BiColorTextWidth(Canvas, Phrases.Lookup('STARTCONTROLS', 7)) div 2;
    287   CustomizeBtn.left := x0Brain + 32 - 16 - x;
     290  X := BiColorTextWidth(Canvas, Phrases.Lookup('STARTCONTROLS', 7)) div 2;
     291  CustomizeBtn.left := x0Brain + 32 - 16 - X;
    288292  if AutoDiff < 0 then
    289293    CustomizeBtn.ButtonIndex := 3
     
    291295    CustomizeBtn.ButtonIndex := 2;
    292296
    293   BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, 1, 111);
    294   BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, HGrSystem2.Data, 66, 111);
    295   BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, 131, 111);
    296   BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, HGrSystem2.Data, 131, 46);
     297  BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, GBrainNoTerm.Left, GBrainNoTerm.Top);
     298  BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, HGrSystem2.Data, GBrainSuperVirtual.Left, GBrainSuperVirtual.Top);
     299  BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, GBrainTerm.Left, GBrainTerm.Top);
     300  BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, HGrSystem2.Data, GBrainRandom.Left, GBrainRandom.Top);
     301
    297302  LoadAiBrainsPictures;
    298303
     
    325330begin
    326331  SaveConfig;
     332  FreeAndNil(Translator);
    327333  FreeAndNil(FormerGames);
    328334  FreeAndNil(Maps);
     
    333339end;
    334340
    335 procedure TStartDlg.SmartInvalidate(x0, y0, x1, y1: integer;
    336   invalidateTab0: boolean);
    337 var
    338   i: integer;
     341procedure TStartDlg.SmartInvalidate(x0, y0, x1, y1: Integer;
     342  invalidateTab0: Boolean);
     343var
     344  I: Integer;
    339345  r0, r1: HRgn;
    340346begin
    341347  r0 := DpiCreateRectRgn(x0, y0, x1, y1);
    342   for i := 0 to ControlCount - 1 do
    343     if not (Controls[i] is TArea) and Controls[i].Visible then
     348  for I := 0 to ControlCount - 1 do
     349    if not (Controls[I] is TArea) and Controls[I].Visible then
    344350    begin
    345       with Controls[i].BoundsRect do
     351      with Controls[I].BoundsRect do
    346352        r1 := DpiCreateRectRgn(left, top, Right, Bottom);
    347353      CombineRgn(r0, r0, r1, RGN_DIFF);
     
    353359    DeleteObject(r1);
    354360  end;
    355   InvalidateRgn(Handle, r0, false);
     361  InvalidateRgn(Handle, r0, False);
    356362  DeleteObject(r0);
    357363end;
     
    429435  end;
    430436
    431   KeyBindings.LoadFromRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');
     437  KeyBindings.KeyBindings.LoadFromRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');
    432438end;
    433439
     
    453459  end;
    454460
    455   KeyBindings.SaveToRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');
     461  KeyBindings.KeyBindings.SaveToRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');
     462end;
     463
     464procedure TStartDlg.LoadLanguages;
     465var
     466  I: Integer;
     467begin
     468  Translator := TTranslator.Create(nil);
     469  with Translator, Languages do begin
     470    SearchByCode('').Available := True;
     471
     472    for I := 1 to Languages.Count - 1 do
     473    with Languages[I] do begin
     474      Available := DirectoryExists(HomeDir + 'Localization' + DirectorySeparator + Code) or (Code = 'en');
     475    end;
     476  end;
    456477end;
    457478
    458479procedure TStartDlg.LoadAiBrainsPictures;
    459480var
    460   AIBrains: TBrains;
    461   I: Integer;
    462   TextSize: TSize;
    463 begin
    464   AIBrains := TBrains.Create(False);
    465   Brains.GetByKind(btAI, AIBrains);
    466   for i := 0 to AIBrains.Count - 1 do
    467   with AIBrains[I] do begin
    468     if not LoadGraphicFile(AIBrains[i].Picture, GetAiDir + DirectorySeparator +
    469       FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin
    470       with AIBrains[i].Picture.Canvas do begin
    471         Brush.Color := $904830;
    472         FillRect(Rect(0, 0, 64, 64));
    473         Font.Assign(UniFont[ftTiny]);
    474         Font.Style := [];
    475         Font.Color := $5FDBFF;
    476         TextSize := TextExtent(FileName);
    477         Textout(32 - TextSize.Width div 2,
    478           32 - TextSize.Height div 2, FileName);
    479       end;
    480     end;
    481   end;
    482   FreeAndNil(AIBrains);
     481  AiBrains: TBrains;
     482begin
     483  AiBrains := TBrains.Create(False);
     484  try
     485    Brains.GetByKind(btAI, AiBrains);
     486    AiBrains.LoadPictures;
     487  finally
     488    FreeAndNil(AiBrains);
     489  end;
    483490end;
    484491
     
    498505    DeleteObject(r1);
    499506    r1 := DpiCreateRectRgn(QuitBtn.Left, QuitBtn.Top, QuitBtn.Left + QuitBtn.Width,
    500       QuitBtn.top + QuitBtn.Height);
     507      QuitBtn.Top + QuitBtn.Height);
    501508    CombineRgn(r0, r0, r1, RGN_OR);
    502509    DeleteObject(r1);
     
    505512  end else begin
    506513    BoundsRect := Bounds((DpiScreen.Width - Width) div 2,
    507       (DpiScreen.Height - Height) div 2, Width, Height)
     514      (DpiScreen.Height - Height) div 2, Width, Height);
    508515  end;
    509516end;
     
    521528end;
    522529
    523 procedure TStartDlg.DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string);
     530procedure TStartDlg.DrawAction(Y, IconIndex: Integer; HeaderItem, TextItem: string);
    524531begin
    525532  Canvas.Font.Assign(UniFont[ftCaption]);
    526533  Canvas.Font.Style := Canvas.Font.Style + [fsUnderline];
    527   RisedTextOut(Canvas, xAction, y - 3, Phrases2.Lookup(HeaderItem));
     534  RisedTextOut(Canvas, xAction, Y - 3, Phrases2.Lookup(HeaderItem));
    528535  Canvas.Font.Assign(UniFont[ftNormal]);
    529536  BiColorTextOut(Canvas, Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText],
    530     $000000, xAction, y + 21, Phrases2.Lookup(TextItem));
     537    $000000, xAction, Y + 21, Phrases2.Lookup(TextItem));
    531538
    532539  UnshareBitmap(LogoBuffer);
    533   DpiBitCanvas(LogoBuffer.Canvas, 0, 0, 50, 50, Canvas,
    534     xActionIcon - 2, y - 2);
     540  DpiBitBltCanvas(LogoBuffer.Canvas, 0, 0, 50, 50, Canvas,
     541    xActionIcon - 2, Y - 2);
    535542  GlowFrame(LogoBuffer, 8, 8, 34, 34, $202020);
    536   DpiBitCanvas(Canvas, xActionIcon - 2, y - 2, 50, 50,
     543  DpiBitBltCanvas(Canvas, xActionIcon - 2, Y - 2, 50, 50,
    537544    LogoBuffer.Canvas, 0, 0);
    538   DpiBitCanvas(Canvas, xActionIcon, y, 40, 40, BigImp.Canvas,
     545  DpiBitBltCanvas(Canvas, xActionIcon, Y, 40, 40, BigImp.Canvas,
    539546    (IconIndex mod 7) * xSizeBig + 8, (IconIndex div 7) * ySizeBig);
    540   RFrame(Canvas, xActionIcon - 1, y - 1, xActionIcon + 40, y + 40,
     547  RFrame(Canvas, xActionIcon - 1, Y - 1, xActionIcon + 40, Y + 40,
    541548    $000000, $000000);
    542549end;
     
    546553  TabNames: array[TStartTab] of Integer = (0, 11, 3, 4);
    547554var
    548   i, w, h, xMini, yMini, y: integer;
    549   s: string;
     555  I, W, H, xMini, yMini, Y: Integer;
     556  S: string;
    550557  Tab2: TStartTab;
    551558  MainAction: TMainAction;
     
    579586
    580587  // draw tabs
    581   Frame(Canvas, 2, 2 + 2 * integer(Tab <> tbMain), TabOffset + (0 + 1) * TabSize - 1,
     588  Frame(Canvas, 2, 2 + 2 * Integer(Tab <> tbMain), TabOffset + (0 + 1) * TabSize - 1,
    582589    TabHeight, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade);
    583   Frame(Canvas, 1, 1 + 2 * integer(Tab <> tbMain), TabOffset + (0 + 1) * TabSize,
     590  Frame(Canvas, 1, 1 + 2 * Integer(Tab <> tbMain), TabOffset + (0 + 1) * TabSize,
    584591    TabHeight, MainTexture.ColorBevelLight, MainTexture.ColorBevelShade);
    585   Canvas.Pixels[1, 1 + 2 * integer(Tab <> tbMain)] := MainTexture.ColorBevelShade;
     592  Canvas.Pixels[1, 1 + 2 * Integer(Tab <> tbMain)] := MainTexture.ColorBevelShade;
    586593  for Tab2 := tbMap to tbPrevious do
    587594  begin
    588     Frame(Canvas, TabOffset + Integer(Tab2) * TabSize + 2, 2 + 2 * integer(Tab <> Tab2),
     595    Frame(Canvas, TabOffset + Integer(Tab2) * TabSize + 2, 2 + 2 * Integer(Tab <> Tab2),
    589596      TabOffset + (Integer(Tab2) + 1) * TabSize - 1, TabHeight, MainTexture.ColorBevelLight,
    590597      MainTexture.ColorBevelShade);
    591     Frame(Canvas, TabOffset + Integer(Tab2) * TabSize + 1, 1 + 2 * integer(Tab <> Tab2),
     598    Frame(Canvas, TabOffset + Integer(Tab2) * TabSize + 1, 1 + 2 * Integer(Tab <> Tab2),
    592599      TabOffset + (Integer(Tab2) + 1) * TabSize, TabHeight, MainTexture.ColorBevelLight,
    593600      MainTexture.ColorBevelShade);
    594     Canvas.Pixels[TabOffset + Integer(Tab2) * TabSize + 1, 1 + 2 * integer(Tab <> Tab2)] :=
     601    Canvas.Pixels[TabOffset + Integer(Tab2) * TabSize + 1, 1 + 2 * Integer(Tab <> Tab2)] :=
    595602      MainTexture.ColorBevelShade;
    596603  end;
     
    598605  for Tab2 := tbMap to tbPrevious do
    599606  begin
    600     s := Phrases.Lookup('STARTCONTROLS', TabNames[Tab2]);
     607    S := Phrases.Lookup('STARTCONTROLS', TabNames[Tab2]);
    601608    RisedTextOut(Canvas, TabOffset + Integer(Tab2) * TabSize + 1 +
    602       (TabSize - BiColorTextWidth(Canvas, s)) div 2,
    603       10 + 2 * integer(Tab <> Tab2), s);
     609      (TabSize - BiColorTextWidth(Canvas, S)) div 2,
     610      10 + 2 * Integer(Tab <> Tab2), S);
    604611  end;
    605612  Frame(Canvas, TabOffset + 4 * TabSize + 1, -1, ClientWidth, TabHeight,
     
    630637  // Paint menu logo
    631638  UnshareBitmap(LogoBuffer);
    632   DpiBitCanvas(LogoBuffer.Canvas, 0, 0, MenuLogo.Width, MenuLogo.Height, Canvas, 6,
    633     3 + 2 * integer(Tab <> tbMain));
     639  DpiBitBltCanvas(LogoBuffer.Canvas, 0, 0, MenuLogo.Width, MenuLogo.Height, Canvas, 6,
     640    3 + 2 * Integer(Tab <> tbMain));
    634641
    635642  ImageOp_BCC(LogoBuffer, Templates.Data, 0, 0, MenuLogo.Left, MenuLogo.Top,
     
    637644  ImageOp_BCC(LogoBuffer, Templates.Data, 10, 27, MenuLogo.Left + 10,
    638645    MenuLogo.Top + 27, MenuLogo.Width - 10, 9, $BFBF20, $4040DF); // logo part 2
    639   DpiBitCanvas(Canvas, 6, 3 + 2 * integer(Tab <> tbMain), MenuLogo.Width, MenuLogo.Height,
     646  DpiBitBltCanvas(Canvas, 6, 3 + 2 * Integer(Tab <> tbMain), MenuLogo.Width, MenuLogo.Height,
    640647    LogoBuffer.Canvas, 0, 0);
    641648
    642649  if Page = pgMain then begin
    643650    if SelectedAction <> maNone then // mark selected action
    644       for i := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do
     651      for I := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do
    645652      begin
    646         w := ClientWidth - 2 * ActionSideBorder - i * wBuffer;
    647         if w > wBuffer then
    648           w := wBuffer;
    649         h := ActionPitch;
    650         if yAction + Integer(SelectedAction) * ActionPitch - 8 + h > ClientHeight - ActionBottomBorder
     653        W := ClientWidth - 2 * ActionSideBorder - I * wBuffer;
     654        if W > wBuffer then
     655          W := wBuffer;
     656        H := ActionPitch;
     657        if yAction + Integer(SelectedAction) * ActionPitch - 8 + H > ClientHeight - ActionBottomBorder
    651658        then
    652           h := ClientHeight - ActionBottomBorder -
     659          H := ClientHeight - ActionBottomBorder -
    653660            (yAction + Integer(SelectedAction) * ActionPitch - 8);
    654661
    655662        UnshareBitmap(LogoBuffer);
    656         DpiBitCanvas(LogoBuffer.Canvas, 0, 0, w, h, Canvas,
    657           ActionSideBorder + i * wBuffer, yAction + Integer(SelectedAction) * ActionPitch
     663        DpiBitBltCanvas(LogoBuffer.Canvas, 0, 0, W, H, Canvas,
     664          ActionSideBorder + I * wBuffer, yAction + Integer(SelectedAction) * ActionPitch
    658665          - 8);
    659         MakeBlue(LogoBuffer, 0, 0, w, h);
    660         DpiBitCanvas(Canvas, ActionSideBorder + i * wBuffer,
    661           yAction + Integer(SelectedAction) * ActionPitch - 8, w, h,
     666        MakeBlue(LogoBuffer, 0, 0, W, H);
     667        DpiBitBltCanvas(Canvas, ActionSideBorder + I * wBuffer,
     668          yAction + Integer(SelectedAction) * ActionPitch - 8, W, H,
    662669          LogoBuffer.Canvas, 0, 0);
    663670      end;
    664     y := yAction;
     671    Y := yAction;
    665672    for MainAction := Low(TMainActionSet) to High(TMainActionSet) do
    666673    begin
    667674      if MainAction in ActionsOffered then
    668675        case MainAction of
    669           maConfig: DrawAction(y, 25, 'ACTIONHEADER_CONFIG', 'ACTION_CONFIG');
    670           maManual: DrawAction(y, 19, 'ACTIONHEADER_MANUAL', 'ACTION_MANUAL');
    671           maCredits: DrawAction(y, 22, 'ACTIONHEADER_CREDITS', 'ACTION_CREDITS');
    672           maAIDev: DrawAction(y, 24, 'ACTIONHEADER_AIDEV', 'ACTION_AIDEV');
     676          maConfig: DrawAction(Y, 25, 'ACTIONHEADER_CONFIG', 'ACTION_CONFIG');
     677          maManual: DrawAction(Y, 19, 'ACTIONHEADER_MANUAL', 'ACTION_MANUAL');
     678          maCredits: DrawAction(Y, 22, 'ACTIONHEADER_CREDITS', 'ACTION_CREDITS');
     679          maAIDev: DrawAction(Y, 24, 'ACTIONHEADER_AIDEV', 'ACTION_AIDEV');
    673680          maWeb:
    674681            begin
    675682              Canvas.Font.Assign(UniFont[ftCaption]);
    676683              // Canvas.Font.Style:=Canvas.Font.Style+[fsUnderline];
    677               RisedTextOut(Canvas, xActionIcon + 99, y,
     684              RisedTextOut(Canvas, xActionIcon + 99, Y,
    678685                Format(Phrases2.Lookup('ACTIONHEADER_WEB'), [CevoHomepageShort]));
    679686              Canvas.Font.Assign(UniFont[ftNormal]);
    680687
    681688              UnshareBitmap(LogoBuffer);
    682               DpiBitCanvas(LogoBuffer.Canvas, 0, 0, LinkArrows.Width, LinkArrows.Height, Canvas,
    683                 xActionIcon, y + 2);
     689              DpiBitBltCanvas(LogoBuffer.Canvas, 0, 0, LinkArrows.Width, LinkArrows.Height, Canvas,
     690                xActionIcon, Y + 2);
    684691              ImageOp_BCC(LogoBuffer, Templates.Data, Point(0, 0), LinkArrows.BoundsRect, 0,
    685692                Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText]);
    686               DpiBitCanvas(Canvas, xActionIcon, y + 2, LinkArrows.Width, LinkArrows.Height,
     693              DpiBitBltCanvas(Canvas, xActionIcon, Y + 2, LinkArrows.Width, LinkArrows.Height,
    687694                LogoBuffer.Canvas, 0, 0);
    688695            end;
    689696        end;
    690       Inc(y, ActionPitch);
     697      Inc(Y, ActionPitch);
    691698    end;
    692699  end
     
    696703      TurnToString(MaxTurn), 344, y0Mini + 61, 170);
    697704
    698     s := Phrases.Lookup('STARTCONTROLS', 7);
    699     w := Canvas.TextWidth(s);
    700     LoweredTextOut(Canvas, -2, MainTexture, x0Brain + 32 - w div 2,
    701       y0Brain + dyBrain + 69, s);
     705    S := Phrases.Lookup('STARTCONTROLS', 7);
     706    W := Canvas.TextWidth(S);
     707    LoweredTextOut(Canvas, -2, MainTexture, x0Brain + 32 - W div 2,
     708      y0Brain + dyBrain + 69, S);
    702709
    703710    InitOrnament;
    704711    if AutoDiff < 0 then
    705712    begin
    706       for i := 12 to 19 do
    707         if (i < 13) or (i > 17) then
    708         begin
    709           DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height,
     713      for I := 12 to 19 do
     714        if (I < 13) or (I > 17) then begin
     715          DpiBitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    710716            HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND);
    711           DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height,
     717          DpiBitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    712718            HGrSystem2.Data.Canvas, Ornament.Left, Ornament.Top, SRCPAINT);
    713719        end;
     
    715721        MainTexture.ColorBevelShade);
    716722
    717       for i := 0 to nPlOffered - 1 do
    718         if 1 shl i and SlotAvailable <> 0 then
     723      for I := 0 to nPlOffered - 1 do
     724        if 1 shl I and SlotAvailable <> 0 then
    719725        begin
    720           if Assigned(PlayersBrain[i]) then
    721             FrameImage(Canvas, PlayersBrain[i].Picture, xBrain[i], yBrain[i],
    722               64, 64, 0, 0, true)
     726          if Assigned(PlayersBrain[I]) then
     727            FrameImage(Canvas, PlayersBrain[I].Picture, xBrain[I], yBrain[I],
     728              64, 64, 0, 0, True)
    723729          else
    724             FrameImage(Canvas, EmptyPicture, xBrain[i], yBrain[i], 64, 64,
    725               0, 0, true);
    726           if Assigned(PlayersBrain[I]) and (PlayersBrain[i].Kind in [btTerm, btRandom, btAI]) then
     730            FrameImage(Canvas, EmptyPicture, xBrain[I], yBrain[I], 64, 64,
     731              0, 0, True);
     732          if Assigned(PlayersBrain[I]) and (PlayersBrain[I].Kind in [btTerm, btRandom, btAI]) then
    727733          begin
    728             DpiBitCanvas(Canvas, xBrain[i] - 18, yBrain[i] + 19, 12, 14,
    729               HGrSystem.Data.Canvas, 134 + (Difficulty[i] - 1) *
     734            DpiBitBltCanvas(Canvas, xBrain[I] - 18, yBrain[I] + 19, 12, 14,
     735              HGrSystem.Data.Canvas, 134 + (Difficulty[I] - 1) *
    730736              13, 28);
    731             Frame(Canvas, xBrain[i] - 19, yBrain[i] + 18, xBrain[i] - 18 + 12,
    732               yBrain[i] + (19 + 14), $000000, $000000);
    733             RFrame(Canvas, PlayerSlots[i].DiffUpBtn.left - 1, PlayerSlots[i].DiffUpBtn.top - 1,
    734               PlayerSlots[i].DiffUpBtn.left + 12, PlayerSlots[i].DiffUpBtn.top + 24,
     737            Frame(Canvas, xBrain[I] - 19, yBrain[I] + 18, xBrain[I] - 18 + 12,
     738              yBrain[I] + (19 + 14), $000000, $000000);
     739            RFrame(Canvas, PlayerSlots[I].DiffUpBtn.left - 1, PlayerSlots[I].DiffUpBtn.top - 1,
     740              PlayerSlots[I].DiffUpBtn.left + 12, PlayerSlots[I].DiffUpBtn.top + 24,
    735741              MainTexture.ColorBevelShade, MainTexture.ColorBevelLight);
    736742            with Canvas do
    737743            begin
    738744              Brush.Color := $000000;
    739               FillRect(Rect(xBrain[i] - 5, yBrain[i] + 25, xBrain[i] - 2,
    740                 yBrain[i] + 27));
     745              FillRect(Rect(xBrain[I] - 5, yBrain[I] + 25, xBrain[I] - 2,
     746                yBrain[I] + 27));
    741747              Brush.Style := bsClear;
    742748            end;
     
    746752                PlayerSlots[I].MultiBtn.left + 12, PlayerSlots[I].MultiBtn.top + 12,
    747753                MainTexture.ColorBevelShade, MainTexture.ColorBevelLight);
    748               DpiBitCanvas(Canvas, xBrain[i] - 31, yBrain[i], 13, 12,
     754              DpiBitBltCanvas(Canvas, xBrain[I] - 31, yBrain[I], 13, 12,
    749755                HGrSystem.Data.Canvas, 88, 47);
    750756            end;
    751757          end;
    752           if Assigned(PlayersBrain[i]) then
     758          if Assigned(PlayersBrain[I]) then
    753759          begin
    754             PlayerSlots[i].DiffUpBtn.Hint := Format(Phrases.Lookup('STARTCONTROLS', 9),
    755               [PlayersBrain[i].Name]);
    756             PlayerSlots[i].DiffDownBtn.Hint := PlayerSlots[i].DiffUpBtn.Hint;
     760            PlayerSlots[I].DiffUpBtn.Hint := Format(Phrases.Lookup('STARTCONTROLS', 9),
     761              [PlayersBrain[I].Name]);
     762            PlayerSlots[I].DiffDownBtn.Hint := PlayerSlots[I].DiffUpBtn.Hint;
    757763          end;
    758764        end;
     
    765771        yMain + 140 { y0Mini-77 } , Phrases.Lookup('STARTCONTROLS', 15));
    766772      if Page = pgStartRandom then
    767         s := IntToStr(AutoEnemies)
     773        S := IntToStr(AutoEnemies)
    768774      else if nMapStartPositions = 0 then
    769         s := '0'
     775        S := '0'
    770776      else
    771         s := IntToStr(nMapStartPositions - 1);
    772       RisedTextOut(Canvas, 198 - BiColorTextWidth(Canvas, s), yMain + 140, s);
     777        S := IntToStr(nMapStartPositions - 1);
     778      RisedTextOut(Canvas, 198 - BiColorTextWidth(Canvas, S), yMain + 140, S);
    773779
    774780      DLine(Canvas, 24, xDefault - 6, yMain + 164 + 19,
     
    778784      if AutoDiff = 1 then
    779785        FrameImage(Canvas, Brains.GetBeginner.Picture, xDefault, yDefault, 64,
    780           64, 0, 0, false)
     786          64, 0, 0, False)
    781787      else
    782788        FrameImage(Canvas, BrainDefault.Picture, xDefault, yDefault, 64, 64,
    783           0, 0, true);
     789          0, 0, True);
    784790      DLine(Canvas, 56, 272, y0Mini + 61 + 19, MainTexture.ColorBevelLight,
    785791        MainTexture.ColorBevelShade);
     
    787793      RisedTextOut(Canvas, 56, y0Mini + 61,
    788794        Phrases.Lookup('STARTCONTROLS', 14));
    789       s := Phrases.Lookup('AUTODIFF', AutoDiff - 1);
    790       RisedTextOut(Canvas, 272 - BiColorTextWidth(Canvas, s), y0Mini + 61, s);
    791 
    792       for i := 0 to 19 do
    793         if (i < 2) or (i > 6) then
    794         begin
    795           DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height,
     795      S := Phrases.Lookup('AUTODIFF', AutoDiff - 1);
     796      RisedTextOut(Canvas, 272 - BiColorTextWidth(Canvas, S), y0Mini + 61, S);
     797
     798      for I := 0 to 19 do
     799        if (I < 2) or (I > 6) then begin
     800          DpiBitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    796801            HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND);
    797           DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height,
     802          DpiBitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height,
    798803            HGrSystem2.Data.Canvas, Ornament.Left, Ornament.Top, SRCPAINT);
    799804        end;
     
    818823        MainTexture.ColorBevelShade);
    819824    RisedTextOut(Canvas, 344, y0Mini + 61, Phrases.Lookup('STARTCONTROLS', 8));
    820     s := TurnToString(LoadTurn);
    821     RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, s), y0Mini + 61, s);
     825    S := TurnToString(LoadTurn);
     826    RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, S), y0Mini + 61, S);
    822827  end
    823828  else if Page = pgEditRandom then
     
    833838  begin
    834839    // DLine(Canvas,344,514,y0Mini+61+19,MainTexture.ColorBevelLight,MainTexture.ColorBevelShade);
    835     s := Format(Phrases2.Lookup('MAPPROP'),
     840    S := Format(Phrases2.Lookup('MAPPROP'),
    836841      [(nMapLandTiles * 100 + 556) div 1112,
    837842      // 1112 is typical for world with 100% size and default land mass
    838843      nMapStartPositions]);
    839     RisedTextOut(Canvas, x0Mini - BiColorTextWidth(Canvas, s) div 2,
    840       y0Mini + 61, s);
     844    RisedTextOut(Canvas, x0Mini - BiColorTextWidth(Canvas, S) div 2,
     845      y0Mini + 61, S);
    841846  end;
    842847
     
    881886      MainTexture.ColorBevelLight);
    882887
    883     s := '';
     888    S := '';
    884889    if MiniMap.Mode = mmPicture then
    885890    begin
    886       DpiBitCanvas(Canvas, xMini + 2, yMini + 2, MiniMap.Size.X * 2, MiniMap.Size.Y,
     891      DpiBitBltCanvas(Canvas, xMini + 2, yMini + 2, MiniMap.Size.X * 2, MiniMap.Size.Y,
    887892        MiniMap.Bitmap.Canvas, 0, 0);
    888893      if Page = pgStartRandom then
    889         s := Phrases.Lookup('RANMAP')
     894        S := Phrases.Lookup('RANMAP');
    890895    end
    891896    else if MiniMap.Mode = mmMultiPlayer then
    892       s := Phrases.Lookup('MPMAP')
     897      S := Phrases.Lookup('MPMAP')
    893898    else if Page = pgStartMap then
    894       s := Copy(MapFileName, 1, Length(MapFileName) - Length(CevoMapExt))
     899      S := Copy(MapFileName, 1, Length(MapFileName) - Length(CevoMapExt))
    895900    else if Page = pgEditMap then
    896       s := List.Items[List.ItemIndex]
     901      S := List.Items[List.ItemIndex]
    897902    else if Page = pgNoLoad then
    898       s := Phrases.Lookup('NOGAMES');
    899     if s <> '' then
    900       RisedTextOut(Canvas, x0Mini + 2 - BiColorTextWidth(Canvas, s) div 2,
    901         y0Mini - 8, s);
     903      S := Phrases.Lookup('NOGAMES');
     904    if S <> '' then
     905      RisedTextOut(Canvas, x0Mini + 2 - BiColorTextWidth(Canvas, S) div 2,
     906        y0Mini - 8, S);
    902907  end;
    903908end;
     
    905910procedure TStartDlg.FormShow(Sender: TObject);
    906911begin
     912  {$IFDEF UNIX}
     913  ShowInTaskBar := stAlways;
     914  {$ENDIF}
    907915  MainTexture.Age := -1;
    908916  List.Font.Color := MainTexture.ColorMark;
     
    949957      begin // load
    950958        FileName := List.Items[List.ItemIndex];
    951         if LoadGame(GetSavedDir + DirectorySeparator, FileName + CevoExt, LoadTurn, false)
     959        if LoadGame(GetSavedDir + DirectorySeparator, FileName + CevoExt, LoadTurn, False)
    952960        then
    953961          UnlistBackupFile(FileName)
     
    969977        with Reg do
    970978        try
    971           OpenKey(AppRegistryKey, true);
     979          OpenKey(AppRegistryKey, True);
    972980          if ValueExists('GameCount') then GameCount := ReadInteger('GameCount')
    973981            else GameCount := 0;
     
    11581166          if Assigned(PlayersBrain[I]) and (PlayersBrain[I].Kind = btTerm) then begin
    11591167            PlayersBrain[I] := nil;
    1160             PlayerSlots[I].DiffUpBtn.Visible := false;
     1168            PlayerSlots[I].DiffUpBtn.Visible := False;
    11611169            PlayerSlots[I].DiffUpBtn.Tag := 0;
    1162             PlayerSlots[I].DiffDownBtn.Visible := false;
     1170            PlayerSlots[I].DiffDownBtn.Visible := False;
    11631171            PlayerSlots[I].DiffDownBtn.Tag := 0;
    11641172            if PlayerSlots[I].OfferMultiple then begin
    1165               PlayerSlots[I].MultiBtn.Visible := false;
     1173              PlayerSlots[I].MultiBtn.Visible := False;
    11661174              PlayerSlots[I].MultiBtn.Tag := 0;
    11671175            end;
     
    11891197  J := FixedLines;
    11901198  while (J < PopupMenu1.Items.Count) and
    1191     (StrIComp(pchar(MenuItem.Caption), pchar(PopupMenu1.Items[J].Caption)) > 0) do
     1199    (StrIComp(PChar(MenuItem.Caption), PChar(PopupMenu1.Items[J].Caption)) > 0) do
    11921200    Inc(J);
    11931201  MenuItem.RadioItem := True;
     
    12001208var
    12011209  I: Integer;
    1202   FixedLines: integer;
     1210  FixedLines: Integer;
    12031211  MenuItem: TDpiMenuItem;
    12041212  AIBrains: TBrains;
     
    12341242    end;
    12351243    for I := Brains.IndexOf(BrainTerm) downto 0 do // offer game interfaces
    1236       if (PlayerPopupIndex = 0) or (Brains[i].Kind = btTerm) and
     1244      if (PlayerPopupIndex = 0) or (Brains[I].Kind = btTerm) and
    12371245        (PlayersBrain[0].Kind <> btNoTerm) then begin
    12381246        OfferBrain(Brains[I], FixedLines);
     
    12581266        if (AIBrains[I].Flags and fMultiple <> 0) or (AIBrains[I].Flags and fUsed = 0)
    12591267          or (Brains[I] = PlayersBrain[PlayerPopupIndex]) then
    1260           OfferBrain(AIBrains[i], FixedLines);
     1268          OfferBrain(AIBrains[I], FixedLines);
    12611269      FreeAndNil(AIBrains);
    12621270    end;
     
    12731281    repeat
    12741282      I := FormerGames.Count;
    1275       while (I > 0) and (F.Time < integer(FormerGames.Objects[I - 1])) do
     1283      while (I > 0) and (F.Time < Integer(FormerGames.Objects[I - 1])) do
    12761284        Dec(I);
    12771285      FormerGames.InsertObject(I, Copy(F.Name, 1, Length(F.Name) - 5),
     
    12871295procedure TStartDlg.UpdateMaps;
    12881296var
    1289   f: TSearchRec;
     1297  F: TSearchRec;
    12901298begin
    12911299  Maps.Clear;
    1292   if FindFirst(GetMapsDir + DirectorySeparator + '*' + CevoMapExt, $21, f) = 0 then
     1300  if FindFirst(GetMapsDir + DirectorySeparator + '*' + CevoMapExt, $21, F) = 0 then
    12931301    repeat
    1294       Maps.Add(Copy(f.Name, 1, Length(f.Name) - Length(CevoMapExt)));
    1295     until FindNext(f) <> 0;
     1302      Maps.Add(Copy(F.Name, 1, Length(F.Name) - Length(CevoMapExt)));
     1303    until FindNext(F) <> 0;
    12961304  FindClose(F);
    12971305  Maps.Sort;
     
    13041312procedure TStartDlg.ChangePage(NewPage: TStartPage);
    13051313var
    1306   i, j, p1: integer;
    1307   s: string;
     1314  I, J, p1: Integer;
     1315  S: string;
    13081316  Reg: TRegistry;
    1309   InvalidateTab0: boolean;
     1317  InvalidateTab0: Boolean;
    13101318begin
    13111319  InvalidateTab0 := (Page = pgMain) or (NewPage = pgMain);
     
    13161324        StartBtn.Caption := Phrases.Lookup('STARTCONTROLS', 1);
    13171325        if Page = pgStartRandom then
    1318           i := nPlOffered
     1326          I := nPlOffered
    13191327        else
    13201328        begin
    1321           i := nMapStartPositions;
    1322           if i = 0 then
     1329          I := nMapStartPositions;
     1330          if I = 0 then
    13231331          begin
    13241332            PlayersBrain[0] := BrainSuperVirtual;
     
    13261334          end;
    13271335          if PlayersBrain[0].Kind in [btNoTerm, btSuperVirtual] then
    1328             inc(i);
    1329           if i > nPl then
    1330             i := nPl;
    1331           if i <= nPlOffered then
     1336            Inc(I);
     1337          if I > nPl then
     1338            I := nPl;
     1339          if I <= nPlOffered then
    13321340            MultiControl := 0
    13331341          else
    1334             MultiControl := InitMulti[i];
     1342            MultiControl := InitMulti[I];
    13351343        end;
    1336         if InitAlive[i] <> SlotAvailable then
     1344        if InitAlive[I] <> SlotAvailable then
    13371345          if Page = pgStartRandom then
    13381346          begin // restore AI assignment of last start
     
    13431351              for p1 := 0 to nPlOffered - 1 do begin
    13441352                PlayersBrain[p1] := nil;
    1345                 s := ReadString('Control' + IntToStr(p1));
     1353                S := ReadString('Control' + IntToStr(p1));
    13461354                Difficulty[p1] := ReadInteger('Diff' + IntToStr(p1));
    1347                 if s <> '' then
    1348                   for j := 0 to Brains.Count - 1 do
    1349                     if AnsiCompareFileName(s, Brains[j].FileName) = 0 then
    1350                       PlayersBrain[p1] := Brains[j];
     1355                if S <> '' then
     1356                  for J := 0 to Brains.Count - 1 do
     1357                    if AnsiCompareFileName(S, Brains[J].FileName) = 0 then
     1358                      PlayersBrain[p1] := Brains[J];
    13511359              end;
    13521360            finally
     
    13561364          else
    13571365            for p1 := 1 to nPl - 1 do
    1358               if 1 shl p1 and InitAlive[i] <> 0 then
     1366              if 1 shl p1 and InitAlive[I] <> 0 then
    13591367              begin
    13601368                PlayersBrain[p1] := BrainDefault;
     
    13631371              else
    13641372                PlayersBrain[p1] := nil;
    1365         SlotAvailable := InitAlive[i];
    1366         for i := 0 to nPlOffered - 1 do
    1367           if (AutoDiff < 0) and Assigned(PlayersBrain[i]) and
    1368             (PlayersBrain[i].Kind in [btTerm, btRandom, btAI]) then
     1373        SlotAvailable := InitAlive[I];
     1374        for I := 0 to nPlOffered - 1 do
     1375          if (AutoDiff < 0) and Assigned(PlayersBrain[I]) and
     1376            (PlayersBrain[I].Kind in [btTerm, btRandom, btAI]) then
    13691377          begin
    1370             PlayerSlots[i].DiffUpBtn.Tag := 768;
    1371             PlayerSlots[i].DiffDownBtn.Tag := 768;
     1378            PlayerSlots[I].DiffUpBtn.Tag := 768;
     1379            PlayerSlots[I].DiffDownBtn.Tag := 768;
    13721380          end
    13731381          else
    13741382          begin
    1375             PlayerSlots[i].DiffUpBtn.Tag := 0;
    1376             PlayerSlots[i].DiffDownBtn.Tag := 0;
     1383            PlayerSlots[I].DiffUpBtn.Tag := 0;
     1384            PlayerSlots[I].DiffDownBtn.Tag := 0;
    13771385          end;
    1378         for i := 6 to 8 do
    1379           if (AutoDiff < 0) and Assigned(PlayersBrain[i]) and
    1380             (PlayersBrain[i].Kind in [btTerm, btRandom, btAI]) then
     1386        for I := 6 to 8 do
     1387          if (AutoDiff < 0) and Assigned(PlayersBrain[I]) and
     1388            (PlayersBrain[I].Kind in [btTerm, btRandom, btAI]) then
    13811389          begin
    1382             PlayerSlots[i].MultiBtn.Tag := 768;
    1383             PlayerSlots[i].MultiBtn.ButtonIndex := 2 + (MultiControl shr i) and 1;
    1384             PlayerSlots[i].MultiBtn.Enabled := Page = pgStartRandom
     1390            PlayerSlots[I].MultiBtn.Tag := 768;
     1391            PlayerSlots[I].MultiBtn.ButtonIndex := 2 + (MultiControl shr I) and 1;
     1392            PlayerSlots[I].MultiBtn.Enabled := Page = pgStartRandom
    13851393          end
    13861394          else
    1387             PlayerSlots[i].MultiBtn.Tag := 0;
     1395            PlayerSlots[I].MultiBtn.Tag := 0;
    13881396        if (AutoDiff > 0) and (Page <> pgStartMap) then
    13891397        begin
     
    14241432
    14251433  PaintInfo;
    1426   for i := 0 to ControlCount - 1 do
    1427     Controls[i].Visible := Controls[i].Tag and (256 shl Integer(Page)) <> 0;
     1434  for I := 0 to ControlCount - 1 do
     1435    Controls[I].Visible := Controls[I].Tag and (256 shl Integer(Page)) <> 0;
    14281436  if Page = pgLoad then
    14291437    ReplayBtn.Visible := MiniMap.Mode <> mmMultiPlayer;
     
    14691477
    14701478procedure TStartDlg.FormMouseDown(Sender: TObject; Button: TMouseButton;
    1471   Shift: TShiftState; x, y: integer);
     1479  Shift: TShiftState; X, Y: Integer);
    14721480var
    14731481  I: Integer;
    14741482begin
    1475   if (y < TabHeight + 1) and (x - TabOffset < TabSize * 4) and
    1476     ((x - TabOffset) div TabSize <> Integer(Tab)) then
     1483  if (Y < TabHeight + 1) and (X - TabOffset < TabSize * 4) and
     1484    ((X - TabOffset) div TabSize <> Integer(Tab)) then
    14771485  begin
    14781486    // Play('BUTTON_DOWN');
    14791487    ListIndex[Tab] := List.ItemIndex;
    1480     ChangeTab(TStartTab((x - TabOffset) div TabSize));
     1488    ChangeTab(TStartTab((X - TabOffset) div TabSize));
    14811489  end
    14821490  else if Page = pgMain then begin
     
    14931501  begin
    14941502    for I := 0 to nPlOffered - 1 do
    1495       if (1 shl I and SlotAvailable <> 0) and (x >= xBrain[I]) and
    1496         (y >= yBrain[I]) and (x < xBrain[I] + 64) and (y < yBrain[I] + 64) then
     1503      if (1 shl I and SlotAvailable <> 0) and (X >= xBrain[I]) and
     1504        (Y >= yBrain[I]) and (X < xBrain[I] + 64) and (Y < yBrain[I] + 64) then
    14971505      begin
    14981506        InitPopup(I);
     
    15041512  end
    15051513  else if (AutoDiff > 1) and ((Page = pgStartRandom) or (Page = pgStartMap)) and
    1506     (x >= xDefault) and (y >= yDefault) and (x < xDefault + 64) and
    1507     (y < yDefault + 64) then
     1514    (X >= xDefault) and (Y >= yDefault) and (X < xDefault + 64) and
     1515    (Y < yDefault + 64) then
    15081516    if Brains.GetKindCount(btAI) < 2 then
    15091517      SimpleMessage(Phrases.Lookup('NOALTAI'))
     
    15131521      PopupMenu1.Popup(left + xDefault + 4, top + yDefault + 4);
    15141522    end
    1515   else if (Page = pgLoad) and (LastTurn > 0) and (y >= yTurnSlider) and
    1516     (y < yTurnSlider + 7) and (x >= xTurnSlider) and
    1517     (x <= xTurnSlider + wTurnSlider) then
    1518   begin
    1519     LoadTurn := LastTurn * (x - xTurnSlider) div wTurnSlider;
     1523  else if (Page = pgLoad) and (LastTurn > 0) and (Y >= yTurnSlider) and
     1524    (Y < yTurnSlider + 7) and (X >= xTurnSlider) and
     1525    (X <= xTurnSlider + wTurnSlider) then
     1526  begin
     1527    LoadTurn := LastTurn * (X - xTurnSlider) div wTurnSlider;
    15201528    SmartInvalidate(xTurnSlider - 2, y0Mini + 61, xTurnSlider + wTurnSlider + 2,
    15211529      yTurnSlider + 9);
     
    15301538      if MaxTurn < 1400 then
    15311539      begin
    1532         inc(MaxTurn, 200);
     1540        Inc(MaxTurn, 200);
    15331541        SmartInvalidate(344, y0Mini + 61, 514, y0Mini + 82);
    15341542      end;
     
    15361544      if LoadTurn < LastTurn then
    15371545      begin
    1538         inc(LoadTurn);
     1546        Inc(LoadTurn);
    15391547        SmartInvalidate(xTurnSlider - 2, y0Mini + 61, xTurnSlider + wTurnSlider
    15401548          + 2, yTurnSlider + 9);
     
    15431551      if StartLandMass < 96 then
    15441552      begin
    1545         inc(StartLandMass, 5);
     1553        Inc(StartLandMass, 5);
    15461554        PaintInfo;
    15471555        SmartInvalidate(344, y0Mini + 61, 514, y0Mini + 61 + 21);
     
    15561564      if MaxTurn > 400 then
    15571565      begin
    1558         dec(MaxTurn, 200);
     1566        Dec(MaxTurn, 200);
    15591567        SmartInvalidate(344, y0Mini + 61, 514, y0Mini + 82);
    15601568      end;
     
    15621570      if LoadTurn > 0 then
    15631571      begin
    1564         dec(LoadTurn);
     1572        Dec(LoadTurn);
    15651573        SmartInvalidate(xTurnSlider - 2, y0Mini + 61, xTurnSlider + wTurnSlider
    15661574          + 2, yTurnSlider + 9);
     
    15691577      if StartLandMass > 10 then
    15701578      begin
    1571         dec(StartLandMass, 5);
     1579        Dec(StartLandMass, 5);
    15721580        PaintInfo;
    15731581        SmartInvalidate(344, y0Mini + 61, 514, y0Mini + 61 + 21);
     
    16241632procedure TStartDlg.RenameBtnClick(Sender: TObject);
    16251633var
    1626   i: integer;
     1634  I: Integer;
    16271635  NewName: string;
    1628   f: file;
    1629   ok: boolean;
     1636  F: file;
     1637  ok: Boolean;
    16301638  MapPictureFileName: string;
    16311639begin
     
    16451653      (NewName <> List.Items[List.ItemIndex]) then
    16461654    begin
    1647       for i := 1 to Length(NewName) do
    1648         if NewName[i] in ['\', '/', ':', '*', '?', '"', '<', '>', '|'] then
     1655      for I := 1 to Length(NewName) do
     1656        if NewName[I] in ['\', '/', ':', '*', '?', '"', '<', '>', '|'] then
    16491657        begin
    1650           SimpleMessage(Format(Phrases.Lookup('NOFILENAME'), [NewName[i]]));
     1658          SimpleMessage(Format(Phrases.Lookup('NOFILENAME'), [NewName[I]]));
    16511659          Exit;
    16521660        end;
    16531661      if Page = pgLoad then
    1654         AssignFile(f, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)
     1662        AssignFile(F, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)
    16551663      else
    1656         AssignFile(f, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] +
     1664        AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] +
    16571665          CevoMapExt);
    1658       ok := true;
     1666      ok := True;
    16591667      try
    16601668        if Page = pgLoad then
    1661           Rename(f, GetSavedDir + DirectorySeparator + NewName + CevoExt)
     1669          Rename(F, GetSavedDir + DirectorySeparator + NewName + CevoExt)
    16621670        else
    1663           Rename(f, GetMapsDir + DirectorySeparator + NewName + CevoMapExt);
     1671          Rename(F, GetMapsDir + DirectorySeparator + NewName + CevoMapExt);
    16641672      except
    16651673        // Play('INVALID');
     
    16721680        if FileExists(MapPictureFileName) then
    16731681        try
    1674           AssignFile(f, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex]
     1682          AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex]
    16751683            + CevoMapPictureExt);
    1676           Rename(f, GetMapsDir + DirectorySeparator + NewName + CevoMapPictureExt);
     1684          Rename(F, GetMapsDir + DirectorySeparator + NewName + CevoMapPictureExt);
    16771685        except
    16781686        end;
     
    16941702procedure TStartDlg.DeleteBtnClick(Sender: TObject);
    16951703var
    1696   iDel: integer;
    1697   f: file;
     1704  iDel: Integer;
     1705  F: file;
    16981706begin
    16991707  if List.ItemIndex >= 0 then
     
    17081716    begin
    17091717      if Page = pgLoad then
    1710         AssignFile(f, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)
     1718        AssignFile(F, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)
    17111719      else
    1712         AssignFile(f, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] +
     1720        AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] +
    17131721          CevoMapExt);
    1714       Erase(f);
     1722      Erase(F);
    17151723      iDel := List.ItemIndex;
    17161724      if Page = pgLoad then
     
    17331741          List.Invalidate;
    17341742          if Page = pgLoad then
    1735             TurnValid := false;
     1743            TurnValid := False;
    17361744          PaintInfo;
    17371745          if Page = pgLoad then
     
    18321840
    18331841procedure TStartDlg.FormMouseUp(Sender: TObject; Button: TMouseButton;
    1834   Shift: TShiftState; x, y: integer);
     1842  Shift: TShiftState; X, Y: Integer);
    18351843begin
    18361844  Tracking := False;
     
    18381846
    18391847procedure TStartDlg.FormMouseMove(Sender: TObject; Shift: TShiftState;
    1840   x, y: integer);
     1848  X, Y: Integer);
    18411849var
    18421850  OldLoadTurn: Integer;
     
    18451853  if Tracking then
    18461854  begin
    1847     x := x - xTurnSlider;
    1848     if x < 0 then
    1849       x := 0
    1850     else if x > wTurnSlider then
    1851       x := wTurnSlider;
     1855    X := X - xTurnSlider;
     1856    if X < 0 then
     1857      X := 0
     1858    else if X > wTurnSlider then
     1859      X := wTurnSlider;
    18521860    OldLoadTurn := LoadTurn;
    1853     LoadTurn := LastTurn * x div wTurnSlider;
     1861    LoadTurn := LastTurn * X div wTurnSlider;
    18541862    if LoadTurn < OldLoadTurn then
    18551863    begin
     
    18691877  else if Page = pgMain then
    18701878  begin
    1871     if (x >= ActionSideBorder) and (x < ClientWidth - ActionSideBorder) and
    1872       (y >= yAction - 8) and (y < ClientHeight - ActionBottomBorder) then
     1879    if (X >= ActionSideBorder) and (X < ClientWidth - ActionSideBorder) and
     1880      (Y >= yAction - 8) and (Y < ClientHeight - ActionBottomBorder) then
    18731881    begin
    1874       NewSelectedAction := TMainAction((y - (yAction - 8)) div ActionPitch);
     1882      NewSelectedAction := TMainAction((Y - (yAction - 8)) div ActionPitch);
    18751883      if not (NewSelectedAction in ActionsOffered) then
    18761884        NewSelectedAction := maNone;
     
    19181926end;
    19191927
    1920 
    19211928end.
Note: See TracChangeset for help on using the changeset viewer.