Changeset 349 for branches/highdpi/Start.pas
- Timestamp:
- Apr 6, 2021, 8:11:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Start.pas
r308 r349 5 5 6 6 uses 7 UDpiControls, GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, 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;9 Menus, Registry, DrawDlg, fgl, Protocol, UMiniMap; 10 10 11 11 type … … 34 34 TMainAction = (maConfig, maManual, maCredits, maAIDev, maWeb, maNone); 35 35 TMainActionSet = set of TMainAction; 36 37 TMapArray = array[0 .. lxmax * lymax - 1] of Byte;38 39 TMiniMode = (mmNone, mmPicture, mmMultiPlayer);40 41 { TMiniMap }42 43 TMiniMap = class44 const45 MaxWidthMapLogo = 96;46 MaxHeightMapLogo = 96;47 var48 Bitmap: TDpiBitmap; { game world sample preview }49 Size: TPoint;50 Colors: array [0 .. 11, 0 .. 1] of TColor;51 Mode: TMiniMode;52 procedure LoadFromLogFile(FileName: string; var LastTurn: Integer);53 procedure LoadFromMapFile(FileName: string; var nMapLandTiles, nMapStartPositions: Integer);54 procedure PaintRandom(Brightness, StartLandMass, WorldSize: Integer);55 procedure PaintFile(SaveMap: TMapArray);56 constructor Create;57 destructor Destroy; override;58 end;59 36 60 37 { TStartDlg } … … 166 143 167 144 uses 168 Global, Directories, Direct, ScreenTools, Inp, Back, Settings, U PixelPointer;145 Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UKeyBindings; 169 146 170 147 {$R *.lfm} … … 226 203 EnemyAutoDiff: array [1 .. 5] of integer = (4, 3, 2, 1, 1); 227 204 228 { TMiniMap }229 230 constructor TMiniMap.Create;231 var232 X, Y: Integer;233 begin234 Bitmap := TDpiBitmap.Create;235 236 for X := 0 to 11 do237 for Y := 0 to 1 do238 Colors[x, y] := GrExt[HGrSystem].Data.Canvas.Pixels[66 + x, 67 + y];239 end;240 241 destructor TMiniMap.Destroy;242 begin243 FreeAndNil(Bitmap);244 inherited;245 end;246 247 procedure TMiniMap.LoadFromLogFile(FileName: string; var LastTurn: Integer);248 var249 SaveMap: TMapArray;250 y: Integer;251 Dummy: Integer;252 FileLandMass: integer;253 LogFile: file;254 s: string[255];255 MapRow: array [0 .. lxmax - 1] of Cardinal;256 begin257 AssignFile(LogFile, FileName);258 try259 Reset(LogFile, 4);260 BlockRead(LogFile, s[1], 2); { file id }261 BlockRead(LogFile, Dummy, 1); { format id }262 if Dummy >= $000E01 then263 BlockRead(LogFile, Dummy, 1); { item stored since 0.14.1 }264 BlockRead(LogFile, Size.X, 1);265 BlockRead(LogFile, Size.Y, 1);266 BlockRead(LogFile, FileLandMass, 1);267 if FileLandMass = 0 then268 for y := 0 to Size.Y - 1 do269 BlockRead(LogFile, MapRow, Size.X);270 BlockRead(LogFile, Dummy, 1);271 BlockRead(LogFile, Dummy, 1);272 BlockRead(LogFile, LastTurn, 1);273 BlockRead(LogFile, SaveMap, 1);274 if SaveMap[0] = $80 then275 Mode := mmMultiPlayer276 else277 Mode := mmPicture;278 if Mode = mmPicture then279 BlockRead(LogFile, SaveMap[4], (Size.X * Size.Y - 1) div 4);280 CloseFile(LogFile);281 except282 CloseFile(LogFile);283 LastTurn := 0;284 Size := WorldSizes[DefaultWorldSize];285 Mode := mmNone;286 end;287 PaintFile(SaveMap);288 end;289 290 procedure TMiniMap.LoadFromMapFile(FileName: string; var nMapLandTiles, nMapStartPositions: Integer);291 var292 x, y, lxFile, lyFile: integer;293 MapFile: file;294 s: string[255];295 MapRow: array [0 .. lxmax - 1] of Cardinal;296 ImageFileName: string;297 begin298 ImageFileName := Copy(FileName, 1, Length(FileName) - Length(CevoMapExt)) + '.png';299 Mode := mmPicture;300 if LoadGraphicFile(Bitmap, ImageFileName, [gfNoError]) then301 begin302 if Bitmap.width div 2 > MaxWidthMapLogo then303 Bitmap.width := MaxWidthMapLogo * 2;304 if Bitmap.height > MaxHeightMapLogo then305 Bitmap.height := MaxHeightMapLogo;306 Size.X := Bitmap.width div 2;307 Size.Y := Bitmap.height;308 end309 else310 begin311 Mode := mmNone;312 Size.X := MaxWidthMapLogo;313 Size.Y := MaxHeightMapLogo;314 end;315 316 AssignFile(MapFile, FileName);317 try318 Reset(MapFile, 4);319 BlockRead(MapFile, s[1], 2); { file id }320 BlockRead(MapFile, x, 1); { format id }321 BlockRead(MapFile, x, 1); // MaxTurn322 BlockRead(MapFile, lxFile, 1);323 BlockRead(MapFile, lyFile, 1);324 nMapLandTiles := 0;325 nMapStartPositions := 0;326 for y := 0 to lyFile - 1 do begin327 BlockRead(MapFile, MapRow, lxFile);328 for x := 0 to lxFile - 1 do329 begin330 if (MapRow[x] and fTerrain) in [fGrass, fPrairie, fTundra, fSwamp,331 fForest, fHills] then332 inc(nMapLandTiles);333 if MapRow[x] and (fPrefStartPos or fStartPos) <> 0 then334 inc(nMapStartPositions);335 end336 end;337 if nMapStartPositions > nPl then338 nMapStartPositions := nPl;339 CloseFile(MapFile);340 except341 CloseFile(MapFile);342 end;343 end;344 345 procedure TMiniMap.PaintRandom(Brightness, StartLandMass, WorldSize: Integer);346 var347 i, x, y, xm, cm: Integer;348 MiniPixel: TPixelPointer;349 Map: ^TTileList;350 begin351 Map := PreviewMap(StartLandMass);352 Size := WorldSizes[WorldSize];353 354 Bitmap.PixelFormat := pf24bit;355 Bitmap.SetSize(Size.X * 2, Size.Y);356 Bitmap.BeginUpdate;357 MiniPixel := PixelPointer(Bitmap);358 for y := 0 to ScaleToNative(Size.Y) - 1 do begin359 for x := 0 to ScaleToNative(Size.X) - 1 do begin360 for i := 0 to 1 do begin361 xm := (x * 2 + i + y and 1) mod (ScaleToNative(Size.X) * 2);362 MiniPixel.SetX(xm);363 cm := Colors364 [Map[ScaleFromNative(x) * lxmax div Size.X + lxmax *365 ((ScaleFromNative(y) * (lymax - 1) + Size.Y div 2) div (Size.Y - 1))] and366 fTerrain, i];367 MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3;368 MiniPixel.Pixel^.G := ((cm shr 8) and $FF) * Brightness div 3;369 MiniPixel.Pixel^.R := ((cm shr 0) and $FF) * Brightness div 3;370 end;371 end;372 MiniPixel.NextLine;373 end;374 Bitmap.EndUpdate;375 end;376 377 procedure TMiniMap.PaintFile(SaveMap: TMapArray);378 var379 i, x, y, xm, cm, Tile, OwnColor, EnemyColor: integer;380 MiniPixel: TPixelPointer;381 PrevMiniPixel: TPixelPointer;382 TerrainTile: Cardinal;383 begin384 OwnColor := GrExt[HGrSystem].Data.Canvas.Pixels[95, 67];385 EnemyColor := GrExt[HGrSystem].Data.Canvas.Pixels[96, 67];386 Bitmap.PixelFormat := pf24bit;387 Bitmap.SetSize(Size.X * 2, Size.Y);388 if Mode = mmPicture then begin389 Bitmap.BeginUpdate;390 MiniPixel := PixelPointer(Bitmap);391 PrevMiniPixel := PixelPointer(Bitmap, 0, -1);392 for y := 0 to ScaleToNative(Size.Y) - 1 do begin393 for x := 0 to ScaleToNative(Size.X) - 1 do begin394 for i := 0 to 1 do begin395 xm := (x * 2 + i + y and 1) mod (ScaleToNative(Size.X) * 2);396 MiniPixel.SetX(xm);397 Tile := SaveMap[ScaleFromNative(x) + Size.X * ScaleFromNative(y)];398 if Tile and fTerrain = fUNKNOWN then399 cm := $000000400 else if Tile and smCity <> 0 then401 begin402 if Tile and smOwned <> 0 then403 cm := OwnColor404 else405 cm := EnemyColor;406 if y > 0 then begin407 // 2x2 city dot covers two lines408 PrevMiniPixel.SetX(xm);409 PrevMiniPixel.Pixel^.B := cm shr 16;410 PrevMiniPixel.Pixel^.G:= cm shr 8 and $FF;411 PrevMiniPixel.Pixel^.R := cm and $FF;412 end;413 end414 else if (i = 0) and (Tile and smUnit <> 0) then415 if Tile and smOwned <> 0 then416 cm := OwnColor417 else cm := EnemyColor418 else begin419 TerrainTile := Tile and fTerrain;420 if TerrainTile > 11 then TerrainTile := 0;421 cm := Colors[TerrainTile, i];422 end;423 MiniPixel.Pixel^.B := (cm shr 16) and $ff;424 MiniPixel.Pixel^.G := (cm shr 8) and $ff;425 MiniPixel.Pixel^.R := (cm shr 0) and $ff;426 end;427 end;428 MiniPixel.NextLine;429 PrevMiniPixel.NextLine;430 end;431 Bitmap.EndUpdate;432 end;433 end;434 435 205 { TStartDlg } 436 206 … … 483 253 with PlayerSlots[i] do begin 484 254 DiffUpBtn := TButtonC.Create(self); 485 DiffUpBtn.Graphic := GrExt[HGrSystem].Data;255 DiffUpBtn.Graphic := HGrSystem.Data; 486 256 DiffUpBtn.left := xBrain[i] - 18; 487 257 DiffUpBtn.top := yBrain[i] + 39; … … 490 260 DiffUpBtn.OnClick := DiffBtnClick; 491 261 DiffDownBtn := TButtonC.Create(self); 492 DiffDownBtn.Graphic := GrExt[HGrSystem].Data;262 DiffDownBtn.Graphic := HGrSystem.Data; 493 263 DiffDownBtn.left := xBrain[i] - 18; 494 264 DiffDownBtn.top := yBrain[i] + 51; … … 500 270 with PlayerSlots[i] do begin 501 271 MultiBtn := TButtonC.Create(self); 502 MultiBtn.Graphic := GrExt[HGrSystem].Data;272 MultiBtn.Graphic := HGrSystem.Data; 503 273 MultiBtn.left := xBrain[i] - 18; 504 274 MultiBtn.top := yBrain[i]; … … 515 285 CustomizeBtn.ButtonIndex := 2; 516 286 517 BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 1, 111);518 BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 66, 111);519 BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 131, 111);520 BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, GrExt[HGrSystem2].Data, 131, 46);287 BitBltBitmap(BrainNoTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, 1, 111); 288 BitBltBitmap(BrainSuperVirtual.Picture, 0, 0, 64, 64, HGrSystem2.Data, 66, 111); 289 BitBltBitmap(BrainTerm.Picture, 0, 0, 64, 64, HGrSystem2.Data, 131, 111); 290 BitBltBitmap(BrainRandom.Picture, 0, 0, 64, 64, HGrSystem2.Data, 131, 46); 521 291 LoadAiBrainsPictures; 522 292 … … 675 445 AIBrains: TBrains; 676 446 I: Integer; 447 TextSize: TSize; 677 448 begin 678 449 AIBrains := TBrains.Create(False); … … 688 459 Font.Style := []; 689 460 Font.Color := $5FDBFF; 690 Textout(32 - TextWidth(FileName) div 2, 691 32 - TextHeight(FileName) div 2, FileName); 461 TextSize := TextExtent(FileName); 462 Textout(32 - TextSize.Width div 2, 463 32 - TextSize.Height div 2, FileName); 692 464 end; 693 465 end; … … 731 503 $000000, xAction, y + 21, Phrases2.Lookup(TextItem)); 732 504 733 // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it 734 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height); 505 UnshareBitmap(LogoBuffer); 735 506 DpiBitCanvas(LogoBuffer.Canvas, 0, 0, 50, 50, Canvas, 736 507 xActionIcon - 2, y - 2); … … 829 600 TabOffset + (Integer(Tab) + 1) * TabSize + 2, TabHeight, MainTexture.clBevelShade, 830 601 MainTexture.clBevelShade); // Tab shadow 831 // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it 832 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height); 833 DpiBitCanvas(LogoBuffer.Canvas, 0, 0, 36, 36, Canvas, 6, 602 603 // Paint menu logo 604 UnshareBitmap(LogoBuffer); 605 DpiBitCanvas(LogoBuffer.Canvas, 0, 0, MenuLogo.Width, MenuLogo.Height, Canvas, 6, 834 606 3 + 2 * integer(Tab <> tbMain)); 835 607 836 ImageOp_BCC(LogoBuffer, Templates , 0, 0, 145, 38, 36, 27, $BFBF20, $4040DF);837 // logo part 1838 ImageOp_BCC(LogoBuffer, Templates , 10, 27, 155, 38 + 27, 26, 9, $BFBF20,839 $4040DF); // logo part 2840 DpiBitCanvas(Canvas, 6, 3 + 2 * integer(Tab <> tbMain), 36, 36,608 ImageOp_BCC(LogoBuffer, Templates.Data, 0, 0, MenuLogo.Left, MenuLogo.Top, 609 MenuLogo.Width, MenuLogo.Height - 9, $BFBF20, $4040DF); // logo part 1 610 ImageOp_BCC(LogoBuffer, Templates.Data, 10, 27, MenuLogo.Left + 10, 611 MenuLogo.Top + 27, MenuLogo.Width - 10, 9, $BFBF20, $4040DF); // logo part 2 612 DpiBitCanvas(Canvas, 6, 3 + 2 * integer(Tab <> tbMain), MenuLogo.Width, MenuLogo.Height, 841 613 LogoBuffer.Canvas, 0, 0); 842 614 … … 853 625 h := ClientHeight - ActionBottomBorder - 854 626 (yAction + Integer(SelectedAction) * ActionPitch - 8); 855 // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it 856 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);627 628 UnshareBitmap(LogoBuffer); 857 629 DpiBitCanvas(LogoBuffer.Canvas, 0, 0, w, h, Canvas, 858 630 ActionSideBorder + i * wBuffer, yAction + Integer(SelectedAction) * ActionPitch … … 877 649 // Canvas.Font.Style:=Canvas.Font.Style+[fsUnderline]; 878 650 RisedTextOut(Canvas, xActionIcon + 99, y, 879 Phrases2.Lookup('ACTIONHEADER_WEB'));651 Format(Phrases2.Lookup('ACTIONHEADER_WEB'), [CevoHomepageShort])); 880 652 Canvas.Font.Assign(UniFont[ftNormal]); 881 // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it 882 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height);883 DpiBitCanvas(LogoBuffer.Canvas, 0, 0, 91, 25, Canvas,653 654 UnshareBitmap(LogoBuffer); 655 DpiBitCanvas(LogoBuffer.Canvas, 0, 0, LinkArrows.Width, LinkArrows.Height, Canvas, 884 656 xActionIcon, y + 2); 885 ImageOp_BCC(LogoBuffer, Templates , 0, 0, 1, 400, 91, 25, 0,657 ImageOp_BCC(LogoBuffer, Templates.Data, Point(0, 0), LinkArrows.BoundsRect, 0, 886 658 Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText]); 887 DpiBitCanvas(Canvas, xActionIcon, y + 2, 91, 25,659 DpiBitCanvas(Canvas, xActionIcon, y + 2, LinkArrows.Width, LinkArrows.Height, 888 660 LogoBuffer.Canvas, 0, 0); 889 661 end; … … 894 666 else if Page in [pgStartRandom, pgStartMap] then 895 667 begin 896 DLine(Canvas, 344, 514, y0Mini + 61 + 19, MainTexture.clBevelLight, 897 MainTexture.clBevelShade); 898 RisedTextOut(Canvas, 344, y0Mini + 61, Phrases.Lookup('STARTCONTROLS', 10)); 899 s := TurnToString(MaxTurn); 900 RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, s), y0Mini + 61, s); 668 UnderlinedTitleValue(Canvas, Phrases.Lookup('STARTCONTROLS', 10), 669 TurnToString(MaxTurn), 344, y0Mini + 61, 170); 670 901 671 s := Phrases.Lookup('STARTCONTROLS', 7); 902 672 w := Canvas.TextWidth(s); … … 910 680 if (i < 13) or (i > 17) then 911 681 begin 912 DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, wOrna, hOrna,913 GrExt[HGrSystem2].Mask.Canvas, xOrna, yOrna, SRCAND);914 DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, wOrna, hOrna,915 GrExt[HGrSystem2].Data.Canvas, xOrna, yOrna, SRCPAINT);682 DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height, 683 HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND); 684 DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height, 685 HGrSystem2.Data.Canvas, Ornament.Left, Ornament.Top, SRCPAINT); 916 686 end; 917 687 PaintLogo(Canvas, 69 + 11 * 27, yLogo, MainTexture.clBevelLight, … … 930 700 begin 931 701 DpiBitCanvas(Canvas, xBrain[i] - 18, yBrain[i] + 19, 12, 14, 932 GrExt[HGrSystem].Data.Canvas, 134 + (Difficulty[i] - 1) *702 HGrSystem.Data.Canvas, 134 + (Difficulty[i] - 1) * 933 703 13, 28); 934 704 Frame(Canvas, xBrain[i] - 19, yBrain[i] + 18, xBrain[i] - 18 + 12, … … 950 720 MainTexture.clBevelShade, MainTexture.clBevelLight); 951 721 DpiBitCanvas(Canvas, xBrain[i] - 31, yBrain[i], 13, 12, 952 GrExt[HGrSystem].Data.Canvas, 88, 47);722 HGrSystem.Data.Canvas, 88, 47); 953 723 end; 954 724 end; … … 974 744 s := IntToStr(nMapStartPositions - 1); 975 745 RisedTextOut(Canvas, 198 - BiColorTextWidth(Canvas, s), yMain + 140, s); 746 976 747 DLine(Canvas, 24, xDefault - 6, yMain + 164 + 19, 977 748 MainTexture.clBevelLight, MainTexture.clBevelShade); … … 986 757 DLine(Canvas, 56, 272, y0Mini + 61 + 19, MainTexture.clBevelLight, 987 758 MainTexture.clBevelShade); 759 988 760 RisedTextOut(Canvas, 56, y0Mini + 61, 989 761 Phrases.Lookup('STARTCONTROLS', 14)); … … 994 766 if (i < 2) or (i > 6) then 995 767 begin 996 DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, wOrna, hOrna,997 GrExt[HGrSystem2].Mask.Canvas, xOrna, yOrna, SRCAND);998 DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, wOrna, hOrna,999 GrExt[HGrSystem2].Data.Canvas, xOrna, yOrna, SRCPAINT);768 DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height, 769 HGrSystem2.Mask.Canvas, Ornament.Left, Ornament.Top, SRCAND); 770 DpiBitCanvas(Canvas, 9 + i * 27, yLogo - 2, Ornament.Width, Ornament.Height, 771 HGrSystem2.Data.Canvas, Ornament.Left, Ornament.Top, SRCPAINT); 1000 772 end; 1001 773 PaintLogo(Canvas, 69, yLogo, MainTexture.clBevelLight, … … 1024 796 else if Page = pgEditRandom then 1025 797 begin 1026 DLine(Canvas, 344, 514, y0Mini - 77 + 19, MainTexture.clBevelLight, 1027 MainTexture.clBevelShade); 1028 RisedTextOut(Canvas, 344, y0Mini - 77, Phrases.Lookup('STARTCONTROLS', 5)); 1029 s := IntToStr((WorldSizes[WorldSize].X * WorldSizes[WorldSize].Y * 20 + 1030 DefaultWorldTiles div 2) div DefaultWorldTiles * 5) + '%'; 1031 RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, s), y0Mini - 77, s); 1032 DLine(Canvas, 344, 514, y0Mini + 61 + 19, MainTexture.clBevelLight, 1033 MainTexture.clBevelShade); 1034 RisedTextOut(Canvas, 344, y0Mini + 61, Phrases.Lookup('STARTCONTROLS', 6)); 1035 s := IntToStr(StartLandMass) + '%'; 1036 RisedTextOut(Canvas, 514 - BiColorTextWidth(Canvas, s), y0Mini + 61, s); 798 UnderlinedTitleValue(Canvas, Phrases.Lookup('STARTCONTROLS', 5), 799 IntToStr((WorldSizes[WorldSize].X * WorldSizes[WorldSize].Y * 20 + 800 DefaultWorldTiles div 2) div DefaultWorldTiles * 5) + '%', 801 344, y0Mini - 77, 170); 802 UnderlinedTitleValue(Canvas, Phrases.Lookup('STARTCONTROLS', 6), 803 IntToStr(StartLandMass) + '%', 344, y0Mini + 61, 170); 1037 804 end 1038 805 else if Page = pgEditMap then … … 1098 865 s := Phrases.Lookup('MPMAP') 1099 866 else if Page = pgStartMap then 1100 s := Copy(MapFileName, 1, Length(MapFileName) - 9)867 s := Copy(MapFileName, 1, Length(MapFileName) - Length(CevoMapExt)) 1101 868 else if Page = pgEditMap then 1102 869 s := List.Items[List.ItemIndex] … … 1241 1008 end; 1242 1009 pgEditMap: 1243 EditMap( MapFileName, lxmax, lymax, StartLandMass);1010 EditMap(GetMapsDir + DirectorySeparator + MapFileName, lxmax, lymax, StartLandMass); 1244 1011 pgEditRandom: // new map 1245 1012 begin … … 1256 1023 end; 1257 1024 MapFileName := Format(Phrases.Lookup('MAP'), [MapCount]) + CevoMapExt; 1258 EditMap(MapFileName, WorldSizes[WorldSize].X, WorldSizes[WorldSize].Y, StartLandMass); 1025 EditMap(GetMapsDir + DirectorySeparator + MapFileName, 1026 WorldSizes[WorldSize].X, WorldSizes[WorldSize].Y, StartLandMass); 1259 1027 end; 1260 1028 end; … … 1266 1034 pgStartRandom: begin 1267 1035 MiniMap.Mode := mmPicture; 1268 MiniMap.PaintRandom(3, StartLandMass, WorldSize );1036 MiniMap.PaintRandom(3, StartLandMass, WorldSizes[WorldSize]); 1269 1037 end; 1270 1038 pgNoLoad: begin … … 1274 1042 pgLoad: begin 1275 1043 MiniMap.LoadFromLogFile(GetSavedDir + DirectorySeparator + 1276 List.Items[List.ItemIndex] + CevoExt, LastTurn );1044 List.Items[List.ItemIndex] + CevoExt, LastTurn, WorldSizes[DefaultWorldSize]); 1277 1045 // BookDate:=DateToStr(FileDateToDateTime(FileAge(FileName))); 1278 1046 if not TurnValid then begin … … 1286 1054 MapFileName := ''; 1287 1055 MiniMap.Mode := mmPicture; 1288 MiniMap.PaintRandom(4, StartLandMass, WorldSize );1056 MiniMap.PaintRandom(4, StartLandMass, WorldSizes[WorldSize]); 1289 1057 end; 1290 1058 pgStartMap, pgEditMap: … … 1292 1060 if Page = pgEditMap then 1293 1061 MapFileName := List.Items[List.ItemIndex] + CevoMapExt; 1294 MiniMap.LoadFromMapFile(GetMapsDir + DirectorySeparator + MapFileName, nMapLandTiles, nMapStartPositions); 1062 MiniMap.LoadFromMapFile(GetMapsDir + DirectorySeparator + MapFileName, 1063 nMapLandTiles, nMapStartPositions); 1295 1064 if Page = pgEditMap then 1296 1065 SmartInvalidate(x0Mini - 112, y0Mini + 61, x0Mini + 112, y0Mini + 91); … … 1467 1236 if FindFirst(GetMapsDir + DirectorySeparator + '*' + CevoMapExt, $21, f) = 0 then 1468 1237 repeat 1469 Maps.Add(Copy(f.Name, 1, Length(f.Name) - 9));1238 Maps.Add(Copy(f.Name, 1, Length(f.Name) - Length(CevoMapExt))); 1470 1239 until FindNext(f) <> 0; 1471 1240 FindClose(F); 1472 1241 Maps.Sort; 1473 1242 Maps.Insert(0, Phrases.Lookup('RANMAP')); 1474 ListIndex[tbMain] := Maps.IndexOf(Copy(MapFileName, 1, Length(MapFileName) - 9));1243 ListIndex[tbMain] := Maps.IndexOf(Copy(MapFileName, 1, Length(MapFileName) - Length(CevoMapExt))); 1475 1244 if ListIndex[tbMain] < 0 then 1476 1245 ListIndex[tbMain] := 0; … … 1973 1742 procedure TStartDlg.FormKeyDown(Sender: TObject; var Key: Word; 1974 1743 Shift: TShiftState); 1975 begin 1976 if KeyToShortCut(Key, Shift) = VK_F1 then 1744 var 1745 ShortCut: TShortCut; 1746 begin 1747 ShortCut := KeyToShortCut(Key, Shift); 1748 if BFullScreen.Test(ShortCut) then begin 1749 FullScreen := not FullScreen; 1750 UpdateInterface; 1751 Background.UpdateInterface; 1752 SetFocus; 1753 end else 1754 if BHelp.Test(ShortCut) then 1977 1755 DirectHelp(cStartHelp); 1978 1756 end;
Note:
See TracChangeset
for help on using the changeset viewer.