Changeset 192 for trunk/Start.pas
- Timestamp:
- May 7, 2020, 12:30:04 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Start.pas
r190 r192 154 154 procedure LoadConfig; 155 155 procedure SaveConfig; 156 procedure LoadAiBrainsPictures; 156 157 end; 157 158 … … 433 434 r0, r1: HRgn; 434 435 Location: TPoint; 436 PlayerSlot: TPlayerSlot; 435 437 AIBrains: TBrains; 436 PlayerSlot: TPlayerSlot;437 438 begin 438 439 PlayerSlots := TPlayerSlots.Create; … … 528 529 CustomizeBtn.ButtonIndex := 2; 529 530 530 Brains[0].Picture := TBitmap.Create; 531 Brains[0].Picture.SetSize(64, 64); 532 BitBltCanvas(Brains[0].Picture.Canvas, 0, 0, 64, 64, 533 GrExt[HGrSystem2].Data.Canvas, 1, 111); 534 Brains[1].Picture := TBitmap.Create; 535 Brains[1].Picture.SetSize(64, 64); 536 BitBltCanvas(Brains[1].Picture.Canvas, 0, 0, 64, 64, 537 GrExt[HGrSystem2].Data.Canvas, 66, 111); 538 Brains[2].Picture := TBitmap.Create; 539 Brains[2].Picture.SetSize(64, 64); 540 BitBltCanvas(Brains[2].Picture.Canvas, 0, 0, 64, 64, 541 GrExt[HGrSystem2].Data.Canvas, 131, 111); 542 Brains[3].Picture := TBitmap.Create; 543 Brains[3].Picture.SetSize(64, 64); 544 BitBltCanvas(Brains[3].Picture.Canvas, 0, 0, 64, 64, 545 GrExt[HGrSystem2].Data.Canvas, 131, 46); 546 547 AIBrains := TBrains.Create(False); 548 Brains.GetByKind(btAI, AIBrains); 549 for i := 0 to AIBrains.Count - 1 do 550 with AIBrains[I] do 551 begin 552 AIBrains[i].Picture := TBitmap.Create; 553 if not LoadGraphicFile(AIBrains[i].Picture, HomeDir + 'AI' + DirectorySeparator + 554 FileName + DirectorySeparator + FileName + '.png', gfNoError) then begin 555 AIBrains[i].Picture.SetSize(64, 64); 556 with AIBrains[i].Picture.Canvas do begin 557 Brush.Color := $904830; 558 FillRect(Rect(0, 0, 64, 64)); 559 Font.Assign(UniFont[ftTiny]); 560 Font.Style := []; 561 Font.Color := $5FDBFF; 562 Textout(32 - TextWidth(FileName) div 2, 563 32 - TextHeight(FileName) div 2, FileName); 564 end; 565 end; 566 end; 567 AIBrains.Free; 531 BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 1, 111); 532 BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 66, 111); 533 BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 131, 111); 534 BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 131, 46); 535 LoadAiBrainsPictures; 568 536 569 537 EmptyPicture := TBitmap.Create; … … 712 680 end; 713 681 682 procedure TStartDlg.LoadAiBrainsPictures; 683 var 684 AIBrains: TBrains; 685 I: Integer; 686 begin 687 AIBrains := TBrains.Create(False); 688 Brains.GetByKind(btAI, AIBrains); 689 for i := 0 to AIBrains.Count - 1 do 690 with AIBrains[I] do begin 691 if not LoadGraphicFile(AIBrains[i].Picture, GetAiDir + DirectorySeparator + 692 FileName + DirectorySeparator + FileName + '.png', gfNoError) then begin 693 with AIBrains[i].Picture.Canvas do begin 694 Brush.Color := $904830; 695 FillRect(Rect(0, 0, 64, 64)); 696 Font.Assign(UniFont[ftTiny]); 697 Font.Style := []; 698 Font.Color := $5FDBFF; 699 Textout(32 - TextWidth(FileName) div 2, 700 32 - TextHeight(FileName) div 2, FileName); 701 end; 702 end; 703 end; 704 AIBrains.Free; 705 end; 706 714 707 procedure TStartDlg.DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string); 715 708 begin … … 828 821 if Page = pgMain then 829 822 begin 830 if SelectedAction >=maNone then // mark selected action823 if SelectedAction <> maNone then // mark selected action 831 824 for i := 0 to (ClientWidth - 2 * ActionSideBorder) div wBuffer + 1 do 832 825 begin … … 852 845 if MainAction in ActionsOffered then 853 846 case MainAction of 854 maConfig: 855 DrawAction(y, 25, 'ACTIONHEADER_CONFIG', 'ACTION_CONFIG'); 856 maManual: 857 DrawAction(y, 19, 'ACTIONHEADER_MANUAL', 'ACTION_MANUAL'); 858 maCredits: 859 DrawAction(y, 22, 'ACTIONHEADER_CREDITS', 'ACTION_CREDITS'); 860 maAIDev: 861 DrawAction(y, 24, 'ACTIONHEADER_AIDEV', 'ACTION_AIDEV'); 847 maConfig: DrawAction(y, 25, 'ACTIONHEADER_CONFIG', 'ACTION_CONFIG'); 848 maManual: DrawAction(y, 19, 'ACTIONHEADER_MANUAL', 'ACTION_MANUAL'); 849 maCredits: DrawAction(y, 22, 'ACTIONHEADER_CREDITS', 'ACTION_CREDITS'); 850 maAIDev: DrawAction(y, 24, 'ACTIONHEADER_AIDEV', 'ACTION_AIDEV'); 862 851 maWeb: 863 852 begin … … 1095 1084 1096 1085 procedure TStartDlg.FormShow(Sender: TObject); 1097 var1098 x, y: integer;1099 PicturePixel: TPixelPointer;1100 1086 begin 1101 1087 SetMainTextureByAge(-1); 1102 1088 List.Font.Color := MainTexture.clMark; 1103 1089 1104 Fill(EmptyPicture.Canvas, 0, 0, 64, 64, (wMaintexture - 64) div 2, 1105 (hMaintexture - 64) div 2); 1106 // darken texture for empty slot 1107 EmptyPicture.BeginUpdate; 1108 PicturePixel.Init(EmptyPicture); 1109 for y := 0 to 63 do begin 1110 for x := 0 to 64 - 1 do begin 1111 PicturePixel.Pixel^.B := Max(PicturePixel.Pixel^.B - 28, 0); 1112 PicturePixel.Pixel^.G := Max(PicturePixel.Pixel^.G - 28, 0); 1113 PicturePixel.Pixel^.R := Max(PicturePixel.Pixel^.R - 28, 0); 1114 PicturePixel.NextPixel; 1115 end; 1116 PicturePixel.NextLine; 1117 end; 1118 EmptyPicture.EndUpdate; 1090 Fill(EmptyPicture.Canvas, Bounds(0, 0, 64, 64), 1091 Point((wMaintexture - 64) div 2, (hMaintexture - 64) div 2)); 1092 1093 DarkenImage(EmptyPicture, 28); 1119 1094 1120 1095 Difficulty[0] := Diff0;
Note:
See TracChangeset
for help on using the changeset viewer.