Changeset 87


Ignore:
Timestamp:
May 17, 2024, 8:50:43 PM (7 months ago)
Author:
chronos
Message:
  • Fixed: Show stats for more than 4 player in two parts second bellow first part.
  • Fixed: Translate player names.
  • Fixed: Player view size calculation for 5 players.
  • Modified: Use same default keys as in the original game.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Engine.pas

    r86 r87  
    205205    gsInstructions, gsSettings, gsPlayerKeys, gsPlayerKeysRedefine);
    206206
     207  TPlayerColor = (pcGreen);
     208
    207209  { TEngine }
    208210
     
    231233    procedure ClearBackground;
    232234    procedure DrawMenu;
     235    procedure DrawStatsPartial(PlayerIndex, YDiff: Integer);
    233236    procedure DrawStats;
    234237    procedure DrawGamePrepare(Thread: TVirtualThread);
     
    273276    procedure SaveToRegistry(Context: TRegistryContext);
    274277    procedure InitPlayerPool;
     278    procedure Translate;
    275279    property Bitmap: TBitmap read FBitmap write SetBitmap;
    276280    property Active: Boolean read FActive write SetActive;
     
    308312    'Players can refuel at either base but can repair their shields only at their own bases.';
    309313  SInstructionsDetails4 = 'Controls: \n ' +
    310     'Blue: W - up, A - left, S - down, D - right, E - shoot \n ' +
    311     'Green: arrows key, CTRL - shoot';
     314    'Blue: W - up, A - left, X - down, D - right, Control - shoot \n ' +
     315    'Green: arrows key, Enter - shoot';
    312316  SInformation = 'Information';
    313317  SInformationDetails = 'Tunneler is written from scratch in Lazarus/FPC. ' +
     
    17071711    Name := SGreen;
    17081712    Keys.Left := vkA;
    1709     Keys.Down := vkS;
     1713    Keys.Down := vkX;
    17101714    Keys.Right := vkD;
    17111715    Keys.Up := vkW;
    1712     Keys.Shoot := vkE;
     1716    Keys.Shoot := vkControl;
    17131717    Color1 := $00ff00;
    17141718    Color2 := $00a000;
     
    17211725    Keys.Right := vkRight;
    17221726    Keys.Up := vkUp;
    1723     Keys.Shoot := vkControl;
     1727    Keys.Shoot := vkReturn;
    17241728    Color1 := $ff2c2c;
    17251729    Color2 := $b60000;
     
    17931797    if I < 2 then Enabled := True;
    17941798  end;
     1799end;
     1800
     1801procedure TEngine.Translate;
     1802begin
     1803  PlayerPool[0].Name := SGreen;
     1804  PlayerPool[1].Name := SBlue;
     1805  PlayerPool[2].Name := SRed;
     1806  PlayerPool[3].Name := SPink;
     1807  PlayerPool[4].Name := SCyan;
     1808  PlayerPool[5].Name := SYellow;
     1809  PlayerPool[6].Name := SOrange;
     1810  PlayerPool[7].Name := SGray;
    17951811end;
    17961812
     
    18931909end;
    18941910
    1895 procedure TEngine.DrawStats;
     1911procedure TEngine.DrawStatsPartial(PlayerIndex, YDiff: Integer);
    18961912var
    18971913  X: Integer;
    18981914  Y: Integer;
     1915  I: Integer;
    18991916  Text: string;
    1900   Winner: TPlayer;
    1901   I: Integer;
    19021917  ShotsPercent: Integer;
    19031918const
     
    19051920begin
    19061921  with Bitmap.Canvas do begin
    1907     X := Bitmap.Width div 4 * 3;
    1908 
    1909     Brush.Style := bsClear;
    1910     Pen.Style := psSolid;
    1911 
    1912     Pen.Color := clWhite;
    1913     MoveTo(Bitmap.Width div 2, 0);
    1914     LineTo(Bitmap.Width div 2, Bitmap.Height);
    1915 
    1916     Font.Color := clCyan;
    1917     Font.Size := 20;
    1918     Text := SStatistics;
    1919     TextOut(X - TextWidth(Text) div 2, Bitmap.Height div 10, Text);
    1920 
    19211922    Font.Color := clOrange;
    19221923    Font.Size := 20;
    19231924
    1924     Y := Bitmap.Height div 10 + 3 * LineHeight;
     1925    Y := Bitmap.Height div 10 + 3 * LineHeight + YDiff;
    19251926    X := Bitmap.Width div 2 + 50;
    19261927    Inc(Y, LineHeight);
     
    19421943    Inc(Y, LineHeight);
    19431944
    1944     for I := 0 to Players.Count - 1 do
     1945    for I := PlayerIndex to Min(Players.Count - 1, PlayerIndex + 3) do
     1946    if I < Players.Count then
    19451947    with Players[I] do begin
    1946       Y := Bitmap.Height div 10 + 3 * LineHeight;
    1947       X := Bitmap.Width div 2 + 50 + 500 + 200 * I;
     1948      Y := Bitmap.Height div 10 + 3 * LineHeight + YDiff;
     1949      X := Bitmap.Width div 2 + 50 + 500 + 200 * (I - PlayerIndex);
    19481950      Font.Color := Color1;
    19491951      Text := Name;
     
    19721974
    19731975    Inc(Y, 3 * LineHeight);
     1976  end;
     1977end;
     1978
     1979procedure TEngine.DrawStats;
     1980var
     1981  X: Integer;
     1982  Y: Integer;
     1983  Text: string;
     1984  Winner: TPlayer;
     1985begin
     1986  with Bitmap.Canvas do begin
     1987    X := Bitmap.Width div 4 * 3;
     1988
     1989    Brush.Style := bsClear;
     1990    Pen.Style := psSolid;
     1991
     1992    Pen.Color := clWhite;
     1993    MoveTo(Bitmap.Width div 2, 0);
     1994    LineTo(Bitmap.Width div 2, Bitmap.Height);
     1995
     1996    Font.Color := clCyan;
     1997    Font.Size := 20;
     1998    Text := SStatistics;
     1999    TextOut(X - TextWidth(Text) div 2, Bitmap.Height div 10, Text);
     2000
     2001    DrawStatsPartial(0, 0);
     2002    if Players.Count > 4 then
     2003      DrawStatsPartial(4, 400);
    19742004
    19752005    X := Bitmap.Width div 2 + 50;
     
    20192049      if Players.Count > 2 then VertFrameCount := 2
    20202050        else VertFrameCount := 1;
    2021       HorizFrameCount := Round(Players.Count / VertFrameCount);
     2051      HorizFrameCount := Ceil(Players.Count / VertFrameCount);
    20222052    end else begin
    20232053      VertFrameCount := 1;
  • trunk/Forms/FormMain.pas

    r85 r87  
    187187  Engine.HomePage := Core.Core.ApplicationInfo.HomePage;
    188188  LoadConfig;
     189  Engine.Translate;
    189190  Engine.Bitmap := Image1.Picture.Bitmap;
    190191  Engine.NewGame;
  • trunk/Languages/Tunneler.cs.po

    r85 r87  
    9191#: engine.sinstructionsdetails4
    9292msgctxt "engine.sinstructionsdetails4"
    93 msgid "Controls: \\n Blue: W - up, A - left, S - down, D - right, E - shoot \\n Green: arrows key, CTRL - shoot"
    94 msgstr "Ovládání: \\n Modrá: W - nahoru, A - vlevo, S - dolů, D - vpravo, E - střelba \\n ZelenÃœ: kurzorové Å¡ipky, CTRL + střelba"
     93msgid "Controls: \\n Blue: W - up, A - left, X - down, D - right, Control - shoot \\n Green: arrows key, Enter - shoot"
     94msgstr "Ovládání: \\n Modrá: W - nahoru, A - vlevo, X - dolů, D - vpravo, Control - střelba \\n ZelenÃœ: kurzorové Å¡ipky, Return + střelba"
    9595
    9696#: engine.sleft
  • trunk/Languages/Tunneler.pot

    r85 r87  
    8181#: engine.sinstructionsdetails4
    8282msgctxt "engine.sinstructionsdetails4"
    83 msgid "Controls: \\n Blue: W - up, A - left, S - down, D - right, E - shoot \\n Green: arrows key, CTRL - shoot"
     83msgid "Controls: \\n Blue: W - up, A - left, X - down, D - right, Control - shoot \\n Green: arrows key, Enter - shoot"
    8484msgstr ""
    8585
  • trunk/UITypes2.pas

    r85 r87  
    1717  vkS: Integer = $53;
    1818  vkW: Integer = $57;
     19  vkX: Integer = $58;
    1920  vkLeft: Integer = $25;
    2021  vkRight: Integer = $27;
     
    2425  vkQuote: Integer = $DE;
    2526  vkSlash: Integer = $BF;
     27  vkReturn: Integer = $D;
    2628  vkNumpad1: Integer = $61;
    2729  vkNumpad2: Integer = $62;
Note: See TracChangeset for help on using the changeset viewer.