Ignore:
Timestamp:
Apr 6, 2021, 8:11:02 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Merged trunk branch version r348 into highdpi branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Start.pas

    r308 r349  
    55
    66uses
    7   UDpiControls, GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area,
     7  UDpiControls, GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Types,
    88  LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
    9   Menus, Registry, DrawDlg, fgl, Protocol;
     9  Menus, Registry,  DrawDlg, fgl, Protocol, UMiniMap;
    1010
    1111type
     
    3434  TMainAction = (maConfig, maManual, maCredits, maAIDev, maWeb, maNone);
    3535  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 = class
    44   const
    45     MaxWidthMapLogo = 96;
    46     MaxHeightMapLogo = 96;
    47   var
    48     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;
    5936
    6037  { TStartDlg }
     
    166143
    167144uses
    168   Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UPixelPointer;
     145  Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UKeyBindings;
    169146
    170147{$R *.lfm}
     
    226203  EnemyAutoDiff: array [1 .. 5] of integer = (4, 3, 2, 1, 1);
    227204
    228 { TMiniMap }
    229 
    230 constructor TMiniMap.Create;
    231 var
    232   X, Y: Integer;
    233 begin
    234   Bitmap := TDpiBitmap.Create;
    235 
    236   for X := 0 to 11 do
    237     for Y := 0 to 1 do
    238       Colors[x, y] := GrExt[HGrSystem].Data.Canvas.Pixels[66 + x, 67 + y];
    239 end;
    240 
    241 destructor TMiniMap.Destroy;
    242 begin
    243   FreeAndNil(Bitmap);
    244   inherited;
    245 end;
    246 
    247 procedure TMiniMap.LoadFromLogFile(FileName: string; var LastTurn: Integer);
    248 var
    249   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 begin
    257   AssignFile(LogFile, FileName);
    258   try
    259     Reset(LogFile, 4);
    260     BlockRead(LogFile, s[1], 2); { file id }
    261     BlockRead(LogFile, Dummy, 1); { format id }
    262     if Dummy >= $000E01 then
    263       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 then
    268       for y := 0 to Size.Y - 1 do
    269         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 then
    275       Mode := mmMultiPlayer
    276     else
    277       Mode := mmPicture;
    278     if Mode = mmPicture then
    279       BlockRead(LogFile, SaveMap[4], (Size.X * Size.Y - 1) div 4);
    280     CloseFile(LogFile);
    281   except
    282     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 var
    292   x, y, lxFile, lyFile: integer;
    293   MapFile: file;
    294   s: string[255];
    295   MapRow: array [0 .. lxmax - 1] of Cardinal;
    296   ImageFileName: string;
    297 begin
    298   ImageFileName := Copy(FileName, 1, Length(FileName) - Length(CevoMapExt)) + '.png';
    299   Mode := mmPicture;
    300   if LoadGraphicFile(Bitmap, ImageFileName, [gfNoError]) then
    301   begin
    302     if Bitmap.width div 2 > MaxWidthMapLogo then
    303       Bitmap.width := MaxWidthMapLogo * 2;
    304     if Bitmap.height > MaxHeightMapLogo then
    305       Bitmap.height := MaxHeightMapLogo;
    306     Size.X := Bitmap.width div 2;
    307     Size.Y := Bitmap.height;
    308   end
    309   else
    310   begin
    311     Mode := mmNone;
    312     Size.X := MaxWidthMapLogo;
    313     Size.Y := MaxHeightMapLogo;
    314   end;
    315 
    316   AssignFile(MapFile, FileName);
    317   try
    318     Reset(MapFile, 4);
    319     BlockRead(MapFile, s[1], 2); { file id }
    320     BlockRead(MapFile, x, 1); { format id }
    321     BlockRead(MapFile, x, 1); // MaxTurn
    322     BlockRead(MapFile, lxFile, 1);
    323     BlockRead(MapFile, lyFile, 1);
    324     nMapLandTiles := 0;
    325     nMapStartPositions := 0;
    326     for y := 0 to lyFile - 1 do begin
    327       BlockRead(MapFile, MapRow, lxFile);
    328       for x := 0 to lxFile - 1 do
    329       begin
    330         if (MapRow[x] and fTerrain) in [fGrass, fPrairie, fTundra, fSwamp,
    331           fForest, fHills] then
    332           inc(nMapLandTiles);
    333         if MapRow[x] and (fPrefStartPos or fStartPos) <> 0 then
    334           inc(nMapStartPositions);
    335       end
    336     end;
    337     if nMapStartPositions > nPl then
    338       nMapStartPositions := nPl;
    339     CloseFile(MapFile);
    340   except
    341     CloseFile(MapFile);
    342   end;
    343 end;
    344 
    345 procedure TMiniMap.PaintRandom(Brightness, StartLandMass, WorldSize: Integer);
    346 var
    347   i, x, y, xm, cm: Integer;
    348   MiniPixel: TPixelPointer;
    349   Map: ^TTileList;
    350 begin
    351   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 begin
    359     for x := 0 to ScaleToNative(Size.X) - 1 do begin
    360       for i := 0 to 1 do begin
    361         xm := (x * 2 + i + y and 1) mod (ScaleToNative(Size.X) * 2);
    362         MiniPixel.SetX(xm);
    363         cm := Colors
    364           [Map[ScaleFromNative(x) * lxmax div Size.X + lxmax *
    365           ((ScaleFromNative(y) * (lymax - 1) + Size.Y div 2) div (Size.Y - 1))] and
    366           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 var
    379   i, x, y, xm, cm, Tile, OwnColor, EnemyColor: integer;
    380   MiniPixel: TPixelPointer;
    381   PrevMiniPixel: TPixelPointer;
    382   TerrainTile: Cardinal;
    383 begin
    384   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 begin
    389     Bitmap.BeginUpdate;
    390     MiniPixel := PixelPointer(Bitmap);
    391     PrevMiniPixel := PixelPointer(Bitmap, 0, -1);
    392     for y := 0 to ScaleToNative(Size.Y) - 1 do begin
    393       for x := 0 to ScaleToNative(Size.X) - 1 do begin
    394         for i := 0 to 1 do begin
    395           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 then
    399             cm := $000000
    400           else if Tile and smCity <> 0 then
    401           begin
    402             if Tile and smOwned <> 0 then
    403               cm := OwnColor
    404             else
    405               cm := EnemyColor;
    406             if y > 0 then begin
    407               // 2x2 city dot covers two lines
    408               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           end
    414           else if (i = 0) and (Tile and smUnit <> 0) then
    415             if Tile and smOwned <> 0 then
    416               cm := OwnColor
    417             else cm := EnemyColor
    418           else begin
    419             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 
    435205{ TStartDlg }
    436206
     
    483253  with PlayerSlots[i] do begin
    484254    DiffUpBtn := TButtonC.Create(self);
    485     DiffUpBtn.Graphic := GrExt[HGrSystem].Data;
     255    DiffUpBtn.Graphic := HGrSystem.Data;
    486256    DiffUpBtn.left := xBrain[i] - 18;
    487257    DiffUpBtn.top := yBrain[i] + 39;
     
    490260    DiffUpBtn.OnClick := DiffBtnClick;
    491261    DiffDownBtn := TButtonC.Create(self);
    492     DiffDownBtn.Graphic := GrExt[HGrSystem].Data;
     262    DiffDownBtn.Graphic := HGrSystem.Data;
    493263    DiffDownBtn.left := xBrain[i] - 18;
    494264    DiffDownBtn.top := yBrain[i] + 51;
     
    500270  with PlayerSlots[i] do begin
    501271    MultiBtn := TButtonC.Create(self);
    502     MultiBtn.Graphic := GrExt[HGrSystem].Data;
     272    MultiBtn.Graphic := HGrSystem.Data;
    503273    MultiBtn.left := xBrain[i] - 18;
    504274    MultiBtn.top := yBrain[i];
     
    515285    CustomizeBtn.ButtonIndex := 2;
    516286
    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);
    521291  LoadAiBrainsPictures;
    522292
     
    675445  AIBrains: TBrains;
    676446  I: Integer;
     447  TextSize: TSize;
    677448begin
    678449  AIBrains := TBrains.Create(False);
     
    688459        Font.Style := [];
    689460        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);
    692464      end;
    693465    end;
     
    731503    $000000, xAction, y + 21, Phrases2.Lookup(TextItem));
    732504
    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);
    735506  DpiBitCanvas(LogoBuffer.Canvas, 0, 0, 50, 50, Canvas,
    736507    xActionIcon - 2, y - 2);
     
    829600      TabOffset + (Integer(Tab) + 1) * TabSize + 2, TabHeight, MainTexture.clBevelShade,
    830601      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,
    834606    3 + 2 * integer(Tab <> tbMain));
    835607
    836   ImageOp_BCC(LogoBuffer, Templates, 0, 0, 145, 38, 36, 27, $BFBF20, $4040DF);
    837   // logo part 1
    838   ImageOp_BCC(LogoBuffer, Templates, 10, 27, 155, 38 + 27, 26, 9, $BFBF20,
    839     $4040DF); // logo part 2
    840   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,
    841613    LogoBuffer.Canvas, 0, 0);
    842614
     
    853625          h := ClientHeight - ActionBottomBorder -
    854626            (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);
    857629        DpiBitCanvas(LogoBuffer.Canvas, 0, 0, w, h, Canvas,
    858630          ActionSideBorder + i * wBuffer, yAction + Integer(SelectedAction) * ActionPitch
     
    877649              // Canvas.Font.Style:=Canvas.Font.Style+[fsUnderline];
    878650              RisedTextOut(Canvas, xActionIcon + 99, y,
    879                 Phrases2.Lookup('ACTIONHEADER_WEB'));
     651                Format(Phrases2.Lookup('ACTIONHEADER_WEB'), [CevoHomepageShort]));
    880652              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,
    884656                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,
    886658                Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText]);
    887               DpiBitCanvas(Canvas, xActionIcon, y + 2, 91, 25,
     659              DpiBitCanvas(Canvas, xActionIcon, y + 2, LinkArrows.Width, LinkArrows.Height,
    888660                LogoBuffer.Canvas, 0, 0);
    889661            end;
     
    894666  else if Page in [pgStartRandom, pgStartMap] then
    895667  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
    901671    s := Phrases.Lookup('STARTCONTROLS', 7);
    902672    w := Canvas.TextWidth(s);
     
    910680        if (i < 13) or (i > 17) then
    911681        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);
    916686        end;
    917687      PaintLogo(Canvas, 69 + 11 * 27, yLogo, MainTexture.clBevelLight,
     
    930700          begin
    931701            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) *
    933703              13, 28);
    934704            Frame(Canvas, xBrain[i] - 19, yBrain[i] + 18, xBrain[i] - 18 + 12,
     
    950720                MainTexture.clBevelShade, MainTexture.clBevelLight);
    951721              DpiBitCanvas(Canvas, xBrain[i] - 31, yBrain[i], 13, 12,
    952                 GrExt[HGrSystem].Data.Canvas, 88, 47);
     722                HGrSystem.Data.Canvas, 88, 47);
    953723            end;
    954724          end;
     
    974744        s := IntToStr(nMapStartPositions - 1);
    975745      RisedTextOut(Canvas, 198 - BiColorTextWidth(Canvas, s), yMain + 140, s);
     746
    976747      DLine(Canvas, 24, xDefault - 6, yMain + 164 + 19,
    977748        MainTexture.clBevelLight, MainTexture.clBevelShade);
     
    986757      DLine(Canvas, 56, 272, y0Mini + 61 + 19, MainTexture.clBevelLight,
    987758        MainTexture.clBevelShade);
     759
    988760      RisedTextOut(Canvas, 56, y0Mini + 61,
    989761        Phrases.Lookup('STARTCONTROLS', 14));
     
    994766        if (i < 2) or (i > 6) then
    995767        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);
    1000772        end;
    1001773      PaintLogo(Canvas, 69, yLogo, MainTexture.clBevelLight,
     
    1024796  else if Page = pgEditRandom then
    1025797  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);
    1037804  end
    1038805  else if Page = pgEditMap then
     
    1098865      s := Phrases.Lookup('MPMAP')
    1099866    else if Page = pgStartMap then
    1100       s := Copy(MapFileName, 1, Length(MapFileName) - 9)
     867      s := Copy(MapFileName, 1, Length(MapFileName) - Length(CevoMapExt))
    1101868    else if Page = pgEditMap then
    1102869      s := List.Items[List.ItemIndex]
     
    12411008      end;
    12421009    pgEditMap:
    1243       EditMap(MapFileName, lxmax, lymax, StartLandMass);
     1010      EditMap(GetMapsDir + DirectorySeparator + MapFileName, lxmax, lymax, StartLandMass);
    12441011    pgEditRandom: // new map
    12451012      begin
     
    12561023        end;
    12571024        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);
    12591027      end;
    12601028  end;
     
    12661034    pgStartRandom: begin
    12671035      MiniMap.Mode := mmPicture;
    1268       MiniMap.PaintRandom(3, StartLandMass, WorldSize);
     1036      MiniMap.PaintRandom(3, StartLandMass, WorldSizes[WorldSize]);
    12691037    end;
    12701038    pgNoLoad: begin
     
    12741042    pgLoad: begin
    12751043        MiniMap.LoadFromLogFile(GetSavedDir + DirectorySeparator +
    1276           List.Items[List.ItemIndex] + CevoExt, LastTurn);
     1044          List.Items[List.ItemIndex] + CevoExt, LastTurn, WorldSizes[DefaultWorldSize]);
    12771045        // BookDate:=DateToStr(FileDateToDateTime(FileAge(FileName)));
    12781046        if not TurnValid then  begin
     
    12861054      MapFileName := '';
    12871055      MiniMap.Mode := mmPicture;
    1288       MiniMap.PaintRandom(4, StartLandMass, WorldSize);
     1056      MiniMap.PaintRandom(4, StartLandMass, WorldSizes[WorldSize]);
    12891057    end;
    12901058    pgStartMap, pgEditMap:
     
    12921060        if Page = pgEditMap then
    12931061          MapFileName := List.Items[List.ItemIndex] + CevoMapExt;
    1294         MiniMap.LoadFromMapFile(GetMapsDir + DirectorySeparator + MapFileName, nMapLandTiles, nMapStartPositions);
     1062        MiniMap.LoadFromMapFile(GetMapsDir + DirectorySeparator + MapFileName,
     1063          nMapLandTiles, nMapStartPositions);
    12951064        if Page = pgEditMap then
    12961065          SmartInvalidate(x0Mini - 112, y0Mini + 61, x0Mini + 112, y0Mini + 91);
     
    14671236  if FindFirst(GetMapsDir + DirectorySeparator + '*' + CevoMapExt, $21, f) = 0 then
    14681237    repeat
    1469       Maps.Add(Copy(f.Name, 1, Length(f.Name) - 9));
     1238      Maps.Add(Copy(f.Name, 1, Length(f.Name) - Length(CevoMapExt)));
    14701239    until FindNext(f) <> 0;
    14711240  FindClose(F);
    14721241  Maps.Sort;
    14731242  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)));
    14751244  if ListIndex[tbMain] < 0 then
    14761245    ListIndex[tbMain] := 0;
     
    19731742procedure TStartDlg.FormKeyDown(Sender: TObject; var Key: Word;
    19741743  Shift: TShiftState);
    1975 begin
    1976   if KeyToShortCut(Key, Shift) = VK_F1 then
     1744var
     1745  ShortCut: TShortCut;
     1746begin
     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
    19771755    DirectHelp(cStartHelp);
    19781756end;
Note: See TracChangeset for help on using the changeset viewer.