Changeset 465 for branches/highdpi/Start.pas
- Timestamp:
- Nov 30, 2023, 10:16:14 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Start.pas
r405 r465 7 7 UDpiControls, GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Types, 8 8 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; 10 11 11 12 type 12 13 13 { TPlayerSlot } 14 14 … … 21 21 end; 22 22 23 TPlayerSlots = class(T FPGObjectList<TPlayerSlot>)23 TPlayerSlots = class(TObjectList<TPlayerSlot>) 24 24 end; 25 25 … … 69 69 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 70 70 procedure FormMouseDown(Sender: TObject; Button: TMouseButton; 71 Shift: TShiftState; x, y: integer);71 Shift: TShiftState; X, Y: Integer); 72 72 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); 75 75 procedure Up1BtnClick(Sender: TObject); 76 76 procedure Down1BtnClick(Sender: TObject); … … 122 122 MiniMap: TMiniMap; 123 123 LastGame: string; 124 procedure DrawAction( y, IconIndex: integer; HeaderItem, TextItem: string);124 procedure DrawAction(Y, IconIndex: Integer; HeaderItem, TextItem: string); 125 125 procedure InitPopup(PlayerIndex: Integer); 126 126 procedure OfferBrain(Brain: TBrain; FixedLines: Integer); … … 129 129 procedure ChangeTab(NewTab: TStartTab); 130 130 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; 133 133 procedure LoadConfig; 134 134 procedure SaveConfig; 135 procedure LoadLanguages; 135 136 procedure LoadAiBrainsPictures; 136 137 procedure UpdateInterface; … … 138 139 public 139 140 EmptyPicture: TDpiBitmap; 141 Translator: TTranslator; 140 142 procedure UpdateFormerGames; 141 143 procedure UpdateMaps; … … 149 151 150 152 uses 151 Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UKeyBindings; 153 Global, Directories, Direct, ScreenTools, Inp, Back, Settings, KeyBindings, 154 Languages; 152 155 153 156 {$R *.lfm} … … 157 160 // attention: lx*ly+1 must be prime! 158 161 { 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); 161 164 DefaultWorldTiles=4200; } 162 165 MaxWorldSize = 6; … … 189 192 dxBrain = 104; 190 193 dyBrain = 80; 191 xBrain: array [0 .. nPlOffered - 1] of integer = (x0Brain, x0Brain,194 xBrain: array [0 .. nPlOffered - 1] of Integer = (x0Brain, x0Brain, 192 195 x0Brain + dxBrain, x0Brain + dxBrain, x0Brain + dxBrain, x0Brain, 193 196 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, 195 198 y0Brain - dyBrain, y0Brain, y0Brain + dyBrain, y0Brain + dyBrain, 196 199 y0Brain + dyBrain, y0Brain, y0Brain - dyBrain); … … 199 202 TabHeight = 40; 200 203 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, 202 205 1 + 2 + 8 + 128, 1 + 2 + 8 + 32 + 128, 1 + 2 + 8 + 16 + 64 + 128, 203 206 1 + 2 + 4 + 16 + 32 + 64 + 256, 511 - 32, 511, 511 - 32, 511, 511 - 32, 511, 204 207 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, 206 209 256 + 128, 256 + 128 + 64, 256 + 128 + 64); 207 210 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); 210 213 211 214 { TStartDlg } … … 213 216 procedure TStartDlg.FormCreate(Sender: TObject); 214 217 var 215 x, i: Integer;218 X, I: Integer; 216 219 PlayerSlot: TPlayerSlot; 217 220 AIBrains: TBrains; … … 226 229 LoadConfig; 227 230 LoadAssets; 231 LoadLanguages; 228 232 229 233 ActionsOffered := [maConfig, maManual, maCredits, maWeb]; … … 232 236 233 237 BrainDefault := nil; 234 for i:= Brains.IndexOf(BrainRandom) to Brains.Count - 1 do235 if AnsiCompareFileName(DefaultAI, Brains[ i].FileName) = 0 then236 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]; 237 241 if (BrainDefault = BrainRandom) and (Brains.GetKindCount(btAI) < 2) then 238 242 BrainDefault := nil; … … 256 260 ReplayBtn.Hint := Phrases.Lookup('BTN_REPLAY'); 257 261 PlayerSlots.Count := nPlOffered; 258 for i:= 0 to PlayerSlots.Count - 1 do259 with PlayerSlots[ i] do begin262 for I := 0 to PlayerSlots.Count - 1 do 263 with PlayerSlots[I] do begin 260 264 DiffUpBtn := TButtonC.Create(self); 261 265 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; 264 268 DiffUpBtn.ButtonIndex := 1; 265 269 DiffUpBtn.Parent := self; … … 267 271 DiffDownBtn := TButtonC.Create(self); 268 272 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; 271 275 DiffDownBtn.ButtonIndex := 0; 272 276 DiffDownBtn.Parent := self; 273 277 DiffDownBtn.OnClick := DiffBtnClick; 274 278 end; 275 for i:= 6 to 8 do276 with PlayerSlots[ i] do begin279 for I := 6 to 8 do 280 with PlayerSlots[I] do begin 277 281 MultiBtn := TButtonC.Create(self); 278 282 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]; 281 285 MultiBtn.Parent := self; 282 286 MultiBtn.OnClick := MultiBtnClick; … … 284 288 end; 285 289 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; 288 292 if AutoDiff < 0 then 289 293 CustomizeBtn.ButtonIndex := 3 … … 291 295 CustomizeBtn.ButtonIndex := 2; 292 296 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 297 302 LoadAiBrainsPictures; 298 303 … … 325 330 begin 326 331 SaveConfig; 332 FreeAndNil(Translator); 327 333 FreeAndNil(FormerGames); 328 334 FreeAndNil(Maps); … … 333 339 end; 334 340 335 procedure TStartDlg.SmartInvalidate(x0, y0, x1, y1: integer;336 invalidateTab0: boolean);337 var 338 i: integer;341 procedure TStartDlg.SmartInvalidate(x0, y0, x1, y1: Integer; 342 invalidateTab0: Boolean); 343 var 344 I: Integer; 339 345 r0, r1: HRgn; 340 346 begin 341 347 r0 := DpiCreateRectRgn(x0, y0, x1, y1); 342 for i:= 0 to ControlCount - 1 do343 if not (Controls[ i] is TArea) and Controls[i].Visible then348 for I := 0 to ControlCount - 1 do 349 if not (Controls[I] is TArea) and Controls[I].Visible then 344 350 begin 345 with Controls[ i].BoundsRect do351 with Controls[I].BoundsRect do 346 352 r1 := DpiCreateRectRgn(left, top, Right, Bottom); 347 353 CombineRgn(r0, r0, r1, RGN_DIFF); … … 353 359 DeleteObject(r1); 354 360 end; 355 InvalidateRgn(Handle, r0, false);361 InvalidateRgn(Handle, r0, False); 356 362 DeleteObject(r0); 357 363 end; … … 429 435 end; 430 436 431 KeyBindings. LoadFromRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings');437 KeyBindings.KeyBindings.LoadFromRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings'); 432 438 end; 433 439 … … 453 459 end; 454 460 455 KeyBindings.SaveToRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings'); 461 KeyBindings.KeyBindings.SaveToRegistry(HKEY_CURRENT_USER, AppRegistryKey + '\KeyBindings'); 462 end; 463 464 procedure TStartDlg.LoadLanguages; 465 var 466 I: Integer; 467 begin 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; 456 477 end; 457 478 458 479 procedure TStartDlg.LoadAiBrainsPictures; 459 480 var 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; 482 begin 483 AiBrains := TBrains.Create(False); 484 try 485 Brains.GetByKind(btAI, AiBrains); 486 AiBrains.LoadPictures; 487 finally 488 FreeAndNil(AiBrains); 489 end; 483 490 end; 484 491 … … 498 505 DeleteObject(r1); 499 506 r1 := DpiCreateRectRgn(QuitBtn.Left, QuitBtn.Top, QuitBtn.Left + QuitBtn.Width, 500 QuitBtn. top + QuitBtn.Height);507 QuitBtn.Top + QuitBtn.Height); 501 508 CombineRgn(r0, r0, r1, RGN_OR); 502 509 DeleteObject(r1); … … 505 512 end else begin 506 513 BoundsRect := Bounds((DpiScreen.Width - Width) div 2, 507 (DpiScreen.Height - Height) div 2, Width, Height) 514 (DpiScreen.Height - Height) div 2, Width, Height); 508 515 end; 509 516 end; … … 521 528 end; 522 529 523 procedure TStartDlg.DrawAction( y, IconIndex: integer; HeaderItem, TextItem: string);530 procedure TStartDlg.DrawAction(Y, IconIndex: Integer; HeaderItem, TextItem: string); 524 531 begin 525 532 Canvas.Font.Assign(UniFont[ftCaption]); 526 533 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)); 528 535 Canvas.Font.Assign(UniFont[ftNormal]); 529 536 BiColorTextOut(Canvas, Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText], 530 $000000, xAction, y+ 21, Phrases2.Lookup(TextItem));537 $000000, xAction, Y + 21, Phrases2.Lookup(TextItem)); 531 538 532 539 UnshareBitmap(LogoBuffer); 533 DpiBit Canvas(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); 535 542 GlowFrame(LogoBuffer, 8, 8, 34, 34, $202020); 536 DpiBit Canvas(Canvas, xActionIcon - 2, y- 2, 50, 50,543 DpiBitBltCanvas(Canvas, xActionIcon - 2, Y - 2, 50, 50, 537 544 LogoBuffer.Canvas, 0, 0); 538 DpiBit Canvas(Canvas, xActionIcon, y, 40, 40, BigImp.Canvas,545 DpiBitBltCanvas(Canvas, xActionIcon, Y, 40, 40, BigImp.Canvas, 539 546 (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, 541 548 $000000, $000000); 542 549 end; … … 546 553 TabNames: array[TStartTab] of Integer = (0, 11, 3, 4); 547 554 var 548 i, w, h, xMini, yMini, y: integer;549 s: string;555 I, W, H, xMini, yMini, Y: Integer; 556 S: string; 550 557 Tab2: TStartTab; 551 558 MainAction: TMainAction; … … 579 586 580 587 // 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, 582 589 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, 584 591 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; 586 593 for Tab2 := tbMap to tbPrevious do 587 594 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), 589 596 TabOffset + (Integer(Tab2) + 1) * TabSize - 1, TabHeight, MainTexture.ColorBevelLight, 590 597 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), 592 599 TabOffset + (Integer(Tab2) + 1) * TabSize, TabHeight, MainTexture.ColorBevelLight, 593 600 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)] := 595 602 MainTexture.ColorBevelShade; 596 603 end; … … 598 605 for Tab2 := tbMap to tbPrevious do 599 606 begin 600 s:= Phrases.Lookup('STARTCONTROLS', TabNames[Tab2]);607 S := Phrases.Lookup('STARTCONTROLS', TabNames[Tab2]); 601 608 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); 604 611 end; 605 612 Frame(Canvas, TabOffset + 4 * TabSize + 1, -1, ClientWidth, TabHeight, … … 630 637 // Paint menu logo 631 638 UnshareBitmap(LogoBuffer); 632 DpiBit Canvas(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)); 634 641 635 642 ImageOp_BCC(LogoBuffer, Templates.Data, 0, 0, MenuLogo.Left, MenuLogo.Top, … … 637 644 ImageOp_BCC(LogoBuffer, Templates.Data, 10, 27, MenuLogo.Left + 10, 638 645 MenuLogo.Top + 27, MenuLogo.Width - 10, 9, $BFBF20, $4040DF); // logo part 2 639 DpiBit Canvas(Canvas, 6, 3 + 2 * integer(Tab <> tbMain), MenuLogo.Width, MenuLogo.Height,646 DpiBitBltCanvas(Canvas, 6, 3 + 2 * Integer(Tab <> tbMain), MenuLogo.Width, MenuLogo.Height, 640 647 LogoBuffer.Canvas, 0, 0); 641 648 642 649 if Page = pgMain then begin 643 650 if SelectedAction <> maNone then // mark selected action 644 for i:= 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do651 for I := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do 645 652 begin 646 w := ClientWidth - 2 * ActionSideBorder - i* wBuffer;647 if w> wBuffer then648 w:= wBuffer;649 h:= ActionPitch;650 if yAction + Integer(SelectedAction) * ActionPitch - 8 + h> ClientHeight - ActionBottomBorder653 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 651 658 then 652 h:= ClientHeight - ActionBottomBorder -659 H := ClientHeight - ActionBottomBorder - 653 660 (yAction + Integer(SelectedAction) * ActionPitch - 8); 654 661 655 662 UnshareBitmap(LogoBuffer); 656 DpiBit Canvas(LogoBuffer.Canvas, 0, 0, w, h, Canvas,657 ActionSideBorder + i* wBuffer, yAction + Integer(SelectedAction) * ActionPitch663 DpiBitBltCanvas(LogoBuffer.Canvas, 0, 0, W, H, Canvas, 664 ActionSideBorder + I * wBuffer, yAction + Integer(SelectedAction) * ActionPitch 658 665 - 8); 659 MakeBlue(LogoBuffer, 0, 0, w, h);660 DpiBit Canvas(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, 662 669 LogoBuffer.Canvas, 0, 0); 663 670 end; 664 y:= yAction;671 Y := yAction; 665 672 for MainAction := Low(TMainActionSet) to High(TMainActionSet) do 666 673 begin 667 674 if MainAction in ActionsOffered then 668 675 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'); 673 680 maWeb: 674 681 begin 675 682 Canvas.Font.Assign(UniFont[ftCaption]); 676 683 // Canvas.Font.Style:=Canvas.Font.Style+[fsUnderline]; 677 RisedTextOut(Canvas, xActionIcon + 99, y,684 RisedTextOut(Canvas, xActionIcon + 99, Y, 678 685 Format(Phrases2.Lookup('ACTIONHEADER_WEB'), [CevoHomepageShort])); 679 686 Canvas.Font.Assign(UniFont[ftNormal]); 680 687 681 688 UnshareBitmap(LogoBuffer); 682 DpiBit Canvas(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); 684 691 ImageOp_BCC(LogoBuffer, Templates.Data, Point(0, 0), LinkArrows.BoundsRect, 0, 685 692 Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText]); 686 DpiBit Canvas(Canvas, xActionIcon, y+ 2, LinkArrows.Width, LinkArrows.Height,693 DpiBitBltCanvas(Canvas, xActionIcon, Y + 2, LinkArrows.Width, LinkArrows.Height, 687 694 LogoBuffer.Canvas, 0, 0); 688 695 end; 689 696 end; 690 Inc( y, ActionPitch);697 Inc(Y, ActionPitch); 691 698 end; 692 699 end … … 696 703 TurnToString(MaxTurn), 344, y0Mini + 61, 170); 697 704 698 s:= Phrases.Lookup('STARTCONTROLS', 7);699 w := Canvas.TextWidth(s);700 LoweredTextOut(Canvas, -2, MainTexture, x0Brain + 32 - wdiv 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); 702 709 703 710 InitOrnament; 704 711 if AutoDiff < 0 then 705 712 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, 710 716 HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND); 711 DpiBit Canvas(Canvas, 9 + i* 27, yLogo - 2, Ornament.Width, Ornament.Height,717 DpiBitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height, 712 718 HGrSystem2.Data.Canvas, Ornament.Left, Ornament.Top, SRCPAINT); 713 719 end; … … 715 721 MainTexture.ColorBevelShade); 716 722 717 for i:= 0 to nPlOffered - 1 do718 if 1 shl iand SlotAvailable <> 0 then723 for I := 0 to nPlOffered - 1 do 724 if 1 shl I and SlotAvailable <> 0 then 719 725 begin 720 if Assigned(PlayersBrain[ i]) then721 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) 723 729 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]) then730 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 727 733 begin 728 DpiBit Canvas(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) * 730 736 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, 735 741 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 736 742 with Canvas do 737 743 begin 738 744 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)); 741 747 Brush.Style := bsClear; 742 748 end; … … 746 752 PlayerSlots[I].MultiBtn.left + 12, PlayerSlots[I].MultiBtn.top + 12, 747 753 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 748 DpiBit Canvas(Canvas, xBrain[i] - 31, yBrain[i], 13, 12,754 DpiBitBltCanvas(Canvas, xBrain[I] - 31, yBrain[I], 13, 12, 749 755 HGrSystem.Data.Canvas, 88, 47); 750 756 end; 751 757 end; 752 if Assigned(PlayersBrain[ i]) then758 if Assigned(PlayersBrain[I]) then 753 759 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; 757 763 end; 758 764 end; … … 765 771 yMain + 140 { y0Mini-77 } , Phrases.Lookup('STARTCONTROLS', 15)); 766 772 if Page = pgStartRandom then 767 s:= IntToStr(AutoEnemies)773 S := IntToStr(AutoEnemies) 768 774 else if nMapStartPositions = 0 then 769 s:= '0'775 S := '0' 770 776 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); 773 779 774 780 DLine(Canvas, 24, xDefault - 6, yMain + 164 + 19, … … 778 784 if AutoDiff = 1 then 779 785 FrameImage(Canvas, Brains.GetBeginner.Picture, xDefault, yDefault, 64, 780 64, 0, 0, false)786 64, 0, 0, False) 781 787 else 782 788 FrameImage(Canvas, BrainDefault.Picture, xDefault, yDefault, 64, 64, 783 0, 0, true);789 0, 0, True); 784 790 DLine(Canvas, 56, 272, y0Mini + 61 + 19, MainTexture.ColorBevelLight, 785 791 MainTexture.ColorBevelShade); … … 787 793 RisedTextOut(Canvas, 56, y0Mini + 61, 788 794 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, 796 801 HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND); 797 DpiBit Canvas(Canvas, 9 + i* 27, yLogo - 2, Ornament.Width, Ornament.Height,802 DpiBitBltCanvas(Canvas, 9 + I * 27, yLogo - 2, Ornament.Width, Ornament.Height, 798 803 HGrSystem2.Data.Canvas, Ornament.Left, Ornament.Top, SRCPAINT); 799 804 end; … … 818 823 MainTexture.ColorBevelShade); 819 824 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); 822 827 end 823 828 else if Page = pgEditRandom then … … 833 838 begin 834 839 // DLine(Canvas,344,514,y0Mini+61+19,MainTexture.ColorBevelLight,MainTexture.ColorBevelShade); 835 s:= Format(Phrases2.Lookup('MAPPROP'),840 S := Format(Phrases2.Lookup('MAPPROP'), 836 841 [(nMapLandTiles * 100 + 556) div 1112, 837 842 // 1112 is typical for world with 100% size and default land mass 838 843 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); 841 846 end; 842 847 … … 881 886 MainTexture.ColorBevelLight); 882 887 883 s:= '';888 S := ''; 884 889 if MiniMap.Mode = mmPicture then 885 890 begin 886 DpiBit Canvas(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, 887 892 MiniMap.Bitmap.Canvas, 0, 0); 888 893 if Page = pgStartRandom then 889 s := Phrases.Lookup('RANMAP')894 S := Phrases.Lookup('RANMAP'); 890 895 end 891 896 else if MiniMap.Mode = mmMultiPlayer then 892 s:= Phrases.Lookup('MPMAP')897 S := Phrases.Lookup('MPMAP') 893 898 else if Page = pgStartMap then 894 s:= Copy(MapFileName, 1, Length(MapFileName) - Length(CevoMapExt))899 S := Copy(MapFileName, 1, Length(MapFileName) - Length(CevoMapExt)) 895 900 else if Page = pgEditMap then 896 s:= List.Items[List.ItemIndex]901 S := List.Items[List.ItemIndex] 897 902 else if Page = pgNoLoad then 898 s:= Phrases.Lookup('NOGAMES');899 if s<> '' then900 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); 902 907 end; 903 908 end; … … 905 910 procedure TStartDlg.FormShow(Sender: TObject); 906 911 begin 912 {$IFDEF UNIX} 913 ShowInTaskBar := stAlways; 914 {$ENDIF} 907 915 MainTexture.Age := -1; 908 916 List.Font.Color := MainTexture.ColorMark; … … 949 957 begin // load 950 958 FileName := List.Items[List.ItemIndex]; 951 if LoadGame(GetSavedDir + DirectorySeparator, FileName + CevoExt, LoadTurn, false)959 if LoadGame(GetSavedDir + DirectorySeparator, FileName + CevoExt, LoadTurn, False) 952 960 then 953 961 UnlistBackupFile(FileName) … … 969 977 with Reg do 970 978 try 971 OpenKey(AppRegistryKey, true);979 OpenKey(AppRegistryKey, True); 972 980 if ValueExists('GameCount') then GameCount := ReadInteger('GameCount') 973 981 else GameCount := 0; … … 1158 1166 if Assigned(PlayersBrain[I]) and (PlayersBrain[I].Kind = btTerm) then begin 1159 1167 PlayersBrain[I] := nil; 1160 PlayerSlots[I].DiffUpBtn.Visible := false;1168 PlayerSlots[I].DiffUpBtn.Visible := False; 1161 1169 PlayerSlots[I].DiffUpBtn.Tag := 0; 1162 PlayerSlots[I].DiffDownBtn.Visible := false;1170 PlayerSlots[I].DiffDownBtn.Visible := False; 1163 1171 PlayerSlots[I].DiffDownBtn.Tag := 0; 1164 1172 if PlayerSlots[I].OfferMultiple then begin 1165 PlayerSlots[I].MultiBtn.Visible := false;1173 PlayerSlots[I].MultiBtn.Visible := False; 1166 1174 PlayerSlots[I].MultiBtn.Tag := 0; 1167 1175 end; … … 1189 1197 J := FixedLines; 1190 1198 while (J < PopupMenu1.Items.Count) and 1191 (StrIComp( pchar(MenuItem.Caption), pchar(PopupMenu1.Items[J].Caption)) > 0) do1199 (StrIComp(PChar(MenuItem.Caption), PChar(PopupMenu1.Items[J].Caption)) > 0) do 1192 1200 Inc(J); 1193 1201 MenuItem.RadioItem := True; … … 1200 1208 var 1201 1209 I: Integer; 1202 FixedLines: integer;1210 FixedLines: Integer; 1203 1211 MenuItem: TDpiMenuItem; 1204 1212 AIBrains: TBrains; … … 1234 1242 end; 1235 1243 for I := Brains.IndexOf(BrainTerm) downto 0 do // offer game interfaces 1236 if (PlayerPopupIndex = 0) or (Brains[ i].Kind = btTerm) and1244 if (PlayerPopupIndex = 0) or (Brains[I].Kind = btTerm) and 1237 1245 (PlayersBrain[0].Kind <> btNoTerm) then begin 1238 1246 OfferBrain(Brains[I], FixedLines); … … 1258 1266 if (AIBrains[I].Flags and fMultiple <> 0) or (AIBrains[I].Flags and fUsed = 0) 1259 1267 or (Brains[I] = PlayersBrain[PlayerPopupIndex]) then 1260 OfferBrain(AIBrains[ i], FixedLines);1268 OfferBrain(AIBrains[I], FixedLines); 1261 1269 FreeAndNil(AIBrains); 1262 1270 end; … … 1273 1281 repeat 1274 1282 I := FormerGames.Count; 1275 while (I > 0) and (F.Time < integer(FormerGames.Objects[I - 1])) do1283 while (I > 0) and (F.Time < Integer(FormerGames.Objects[I - 1])) do 1276 1284 Dec(I); 1277 1285 FormerGames.InsertObject(I, Copy(F.Name, 1, Length(F.Name) - 5), … … 1287 1295 procedure TStartDlg.UpdateMaps; 1288 1296 var 1289 f: TSearchRec;1297 F: TSearchRec; 1290 1298 begin 1291 1299 Maps.Clear; 1292 if FindFirst(GetMapsDir + DirectorySeparator + '*' + CevoMapExt, $21, f) = 0 then1300 if FindFirst(GetMapsDir + DirectorySeparator + '*' + CevoMapExt, $21, F) = 0 then 1293 1301 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; 1296 1304 FindClose(F); 1297 1305 Maps.Sort; … … 1304 1312 procedure TStartDlg.ChangePage(NewPage: TStartPage); 1305 1313 var 1306 i, j, p1: integer;1307 s: string;1314 I, J, p1: Integer; 1315 S: string; 1308 1316 Reg: TRegistry; 1309 InvalidateTab0: boolean;1317 InvalidateTab0: Boolean; 1310 1318 begin 1311 1319 InvalidateTab0 := (Page = pgMain) or (NewPage = pgMain); … … 1316 1324 StartBtn.Caption := Phrases.Lookup('STARTCONTROLS', 1); 1317 1325 if Page = pgStartRandom then 1318 i:= nPlOffered1326 I := nPlOffered 1319 1327 else 1320 1328 begin 1321 i:= nMapStartPositions;1322 if i= 0 then1329 I := nMapStartPositions; 1330 if I = 0 then 1323 1331 begin 1324 1332 PlayersBrain[0] := BrainSuperVirtual; … … 1326 1334 end; 1327 1335 if PlayersBrain[0].Kind in [btNoTerm, btSuperVirtual] then 1328 inc(i);1329 if i> nPl then1330 i:= nPl;1331 if i<= nPlOffered then1336 Inc(I); 1337 if I > nPl then 1338 I := nPl; 1339 if I <= nPlOffered then 1332 1340 MultiControl := 0 1333 1341 else 1334 MultiControl := InitMulti[ i];1342 MultiControl := InitMulti[I]; 1335 1343 end; 1336 if InitAlive[ i] <> SlotAvailable then1344 if InitAlive[I] <> SlotAvailable then 1337 1345 if Page = pgStartRandom then 1338 1346 begin // restore AI assignment of last start … … 1343 1351 for p1 := 0 to nPlOffered - 1 do begin 1344 1352 PlayersBrain[p1] := nil; 1345 s:= ReadString('Control' + IntToStr(p1));1353 S := ReadString('Control' + IntToStr(p1)); 1346 1354 Difficulty[p1] := ReadInteger('Diff' + IntToStr(p1)); 1347 if s<> '' then1348 for j:= 0 to Brains.Count - 1 do1349 if AnsiCompareFileName( s, Brains[j].FileName) = 0 then1350 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]; 1351 1359 end; 1352 1360 finally … … 1356 1364 else 1357 1365 for p1 := 1 to nPl - 1 do 1358 if 1 shl p1 and InitAlive[ i] <> 0 then1366 if 1 shl p1 and InitAlive[I] <> 0 then 1359 1367 begin 1360 1368 PlayersBrain[p1] := BrainDefault; … … 1363 1371 else 1364 1372 PlayersBrain[p1] := nil; 1365 SlotAvailable := InitAlive[ i];1366 for i:= 0 to nPlOffered - 1 do1367 if (AutoDiff < 0) and Assigned(PlayersBrain[ i]) and1368 (PlayersBrain[ i].Kind in [btTerm, btRandom, btAI]) then1373 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 1369 1377 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; 1372 1380 end 1373 1381 else 1374 1382 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; 1377 1385 end; 1378 for i:= 6 to 8 do1379 if (AutoDiff < 0) and Assigned(PlayersBrain[ i]) and1380 (PlayersBrain[ i].Kind in [btTerm, btRandom, btAI]) then1386 for I := 6 to 8 do 1387 if (AutoDiff < 0) and Assigned(PlayersBrain[I]) and 1388 (PlayersBrain[I].Kind in [btTerm, btRandom, btAI]) then 1381 1389 begin 1382 PlayerSlots[ i].MultiBtn.Tag := 768;1383 PlayerSlots[ i].MultiBtn.ButtonIndex := 2 + (MultiControl shr i) and 1;1384 PlayerSlots[ i].MultiBtn.Enabled := Page = pgStartRandom1390 PlayerSlots[I].MultiBtn.Tag := 768; 1391 PlayerSlots[I].MultiBtn.ButtonIndex := 2 + (MultiControl shr I) and 1; 1392 PlayerSlots[I].MultiBtn.Enabled := Page = pgStartRandom 1385 1393 end 1386 1394 else 1387 PlayerSlots[ i].MultiBtn.Tag := 0;1395 PlayerSlots[I].MultiBtn.Tag := 0; 1388 1396 if (AutoDiff > 0) and (Page <> pgStartMap) then 1389 1397 begin … … 1424 1432 1425 1433 PaintInfo; 1426 for i:= 0 to ControlCount - 1 do1427 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; 1428 1436 if Page = pgLoad then 1429 1437 ReplayBtn.Visible := MiniMap.Mode <> mmMultiPlayer; … … 1469 1477 1470 1478 procedure TStartDlg.FormMouseDown(Sender: TObject; Button: TMouseButton; 1471 Shift: TShiftState; x, y: integer);1479 Shift: TShiftState; X, Y: Integer); 1472 1480 var 1473 1481 I: Integer; 1474 1482 begin 1475 if ( y < TabHeight + 1) and (x- TabOffset < TabSize * 4) and1476 (( x- TabOffset) div TabSize <> Integer(Tab)) then1483 if (Y < TabHeight + 1) and (X - TabOffset < TabSize * 4) and 1484 ((X - TabOffset) div TabSize <> Integer(Tab)) then 1477 1485 begin 1478 1486 // Play('BUTTON_DOWN'); 1479 1487 ListIndex[Tab] := List.ItemIndex; 1480 ChangeTab(TStartTab(( x- TabOffset) div TabSize));1488 ChangeTab(TStartTab((X - TabOffset) div TabSize)); 1481 1489 end 1482 1490 else if Page = pgMain then begin … … 1493 1501 begin 1494 1502 for I := 0 to nPlOffered - 1 do 1495 if (1 shl I and SlotAvailable <> 0) and ( x>= xBrain[I]) and1496 ( y >= yBrain[I]) and (x < xBrain[I] + 64) and (y< yBrain[I] + 64) then1503 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 1497 1505 begin 1498 1506 InitPopup(I); … … 1504 1512 end 1505 1513 else if (AutoDiff > 1) and ((Page = pgStartRandom) or (Page = pgStartMap)) and 1506 ( x >= xDefault) and (y >= yDefault) and (x< xDefault + 64) and1507 ( y< yDefault + 64) then1514 (X >= xDefault) and (Y >= yDefault) and (X < xDefault + 64) and 1515 (Y < yDefault + 64) then 1508 1516 if Brains.GetKindCount(btAI) < 2 then 1509 1517 SimpleMessage(Phrases.Lookup('NOALTAI')) … … 1513 1521 PopupMenu1.Popup(left + xDefault + 4, top + yDefault + 4); 1514 1522 end 1515 else if (Page = pgLoad) and (LastTurn > 0) and ( y>= yTurnSlider) and1516 ( y < yTurnSlider + 7) and (x>= xTurnSlider) and1517 ( x<= xTurnSlider + wTurnSlider) then1518 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; 1520 1528 SmartInvalidate(xTurnSlider - 2, y0Mini + 61, xTurnSlider + wTurnSlider + 2, 1521 1529 yTurnSlider + 9); … … 1530 1538 if MaxTurn < 1400 then 1531 1539 begin 1532 inc(MaxTurn, 200);1540 Inc(MaxTurn, 200); 1533 1541 SmartInvalidate(344, y0Mini + 61, 514, y0Mini + 82); 1534 1542 end; … … 1536 1544 if LoadTurn < LastTurn then 1537 1545 begin 1538 inc(LoadTurn);1546 Inc(LoadTurn); 1539 1547 SmartInvalidate(xTurnSlider - 2, y0Mini + 61, xTurnSlider + wTurnSlider 1540 1548 + 2, yTurnSlider + 9); … … 1543 1551 if StartLandMass < 96 then 1544 1552 begin 1545 inc(StartLandMass, 5);1553 Inc(StartLandMass, 5); 1546 1554 PaintInfo; 1547 1555 SmartInvalidate(344, y0Mini + 61, 514, y0Mini + 61 + 21); … … 1556 1564 if MaxTurn > 400 then 1557 1565 begin 1558 dec(MaxTurn, 200);1566 Dec(MaxTurn, 200); 1559 1567 SmartInvalidate(344, y0Mini + 61, 514, y0Mini + 82); 1560 1568 end; … … 1562 1570 if LoadTurn > 0 then 1563 1571 begin 1564 dec(LoadTurn);1572 Dec(LoadTurn); 1565 1573 SmartInvalidate(xTurnSlider - 2, y0Mini + 61, xTurnSlider + wTurnSlider 1566 1574 + 2, yTurnSlider + 9); … … 1569 1577 if StartLandMass > 10 then 1570 1578 begin 1571 dec(StartLandMass, 5);1579 Dec(StartLandMass, 5); 1572 1580 PaintInfo; 1573 1581 SmartInvalidate(344, y0Mini + 61, 514, y0Mini + 61 + 21); … … 1624 1632 procedure TStartDlg.RenameBtnClick(Sender: TObject); 1625 1633 var 1626 i: integer;1634 I: Integer; 1627 1635 NewName: string; 1628 f: file;1629 ok: boolean;1636 F: file; 1637 ok: Boolean; 1630 1638 MapPictureFileName: string; 1631 1639 begin … … 1645 1653 (NewName <> List.Items[List.ItemIndex]) then 1646 1654 begin 1647 for i:= 1 to Length(NewName) do1648 if NewName[ i] in ['\', '/', ':', '*', '?', '"', '<', '>', '|'] then1655 for I := 1 to Length(NewName) do 1656 if NewName[I] in ['\', '/', ':', '*', '?', '"', '<', '>', '|'] then 1649 1657 begin 1650 SimpleMessage(Format(Phrases.Lookup('NOFILENAME'), [NewName[ i]]));1658 SimpleMessage(Format(Phrases.Lookup('NOFILENAME'), [NewName[I]])); 1651 1659 Exit; 1652 1660 end; 1653 1661 if Page = pgLoad then 1654 AssignFile( f, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)1662 AssignFile(F, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt) 1655 1663 else 1656 AssignFile( f, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] +1664 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] + 1657 1665 CevoMapExt); 1658 ok := true;1666 ok := True; 1659 1667 try 1660 1668 if Page = pgLoad then 1661 Rename( f, GetSavedDir + DirectorySeparator + NewName + CevoExt)1669 Rename(F, GetSavedDir + DirectorySeparator + NewName + CevoExt) 1662 1670 else 1663 Rename( f, GetMapsDir + DirectorySeparator + NewName + CevoMapExt);1671 Rename(F, GetMapsDir + DirectorySeparator + NewName + CevoMapExt); 1664 1672 except 1665 1673 // Play('INVALID'); … … 1672 1680 if FileExists(MapPictureFileName) then 1673 1681 try 1674 AssignFile( f, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex]1682 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] 1675 1683 + CevoMapPictureExt); 1676 Rename( f, GetMapsDir + DirectorySeparator + NewName + CevoMapPictureExt);1684 Rename(F, GetMapsDir + DirectorySeparator + NewName + CevoMapPictureExt); 1677 1685 except 1678 1686 end; … … 1694 1702 procedure TStartDlg.DeleteBtnClick(Sender: TObject); 1695 1703 var 1696 iDel: integer;1697 f: file;1704 iDel: Integer; 1705 F: file; 1698 1706 begin 1699 1707 if List.ItemIndex >= 0 then … … 1708 1716 begin 1709 1717 if Page = pgLoad then 1710 AssignFile( f, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt)1718 AssignFile(F, GetSavedDir + DirectorySeparator + List.Items[List.ItemIndex] + CevoExt) 1711 1719 else 1712 AssignFile( f, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] +1720 AssignFile(F, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex] + 1713 1721 CevoMapExt); 1714 Erase( f);1722 Erase(F); 1715 1723 iDel := List.ItemIndex; 1716 1724 if Page = pgLoad then … … 1733 1741 List.Invalidate; 1734 1742 if Page = pgLoad then 1735 TurnValid := false;1743 TurnValid := False; 1736 1744 PaintInfo; 1737 1745 if Page = pgLoad then … … 1832 1840 1833 1841 procedure TStartDlg.FormMouseUp(Sender: TObject; Button: TMouseButton; 1834 Shift: TShiftState; x, y: integer);1842 Shift: TShiftState; X, Y: Integer); 1835 1843 begin 1836 1844 Tracking := False; … … 1838 1846 1839 1847 procedure TStartDlg.FormMouseMove(Sender: TObject; Shift: TShiftState; 1840 x, y: integer);1848 X, Y: Integer); 1841 1849 var 1842 1850 OldLoadTurn: Integer; … … 1845 1853 if Tracking then 1846 1854 begin 1847 x := x- xTurnSlider;1848 if x< 0 then1849 x:= 01850 else if x> wTurnSlider then1851 x:= wTurnSlider;1855 X := X - xTurnSlider; 1856 if X < 0 then 1857 X := 0 1858 else if X > wTurnSlider then 1859 X := wTurnSlider; 1852 1860 OldLoadTurn := LoadTurn; 1853 LoadTurn := LastTurn * xdiv wTurnSlider;1861 LoadTurn := LastTurn * X div wTurnSlider; 1854 1862 if LoadTurn < OldLoadTurn then 1855 1863 begin … … 1869 1877 else if Page = pgMain then 1870 1878 begin 1871 if ( x >= ActionSideBorder) and (x< ClientWidth - ActionSideBorder) and1872 ( y >= yAction - 8) and (y< ClientHeight - ActionBottomBorder) then1879 if (X >= ActionSideBorder) and (X < ClientWidth - ActionSideBorder) and 1880 (Y >= yAction - 8) and (Y < ClientHeight - ActionBottomBorder) then 1873 1881 begin 1874 NewSelectedAction := TMainAction(( y- (yAction - 8)) div ActionPitch);1882 NewSelectedAction := TMainAction((Y - (yAction - 8)) div ActionPitch); 1875 1883 if not (NewSelectedAction in ActionsOffered) then 1876 1884 NewSelectedAction := maNone; … … 1918 1926 end; 1919 1927 1920 1921 1928 end.
Note:
See TracChangeset
for help on using the changeset viewer.