Changeset 103


Ignore:
Timestamp:
May 21, 2024, 3:55:43 PM (6 months ago)
Author:
chronos
Message:
  • Fixed: Destroying other player didn't end the round.
  • Modified: End the game after three wins of the best player.
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • tags/1.1.1/Engine.pas

    r98 r103  
    260260    Lock: TCriticalSection;
    261261    CurrentRound: Integer;
    262     MaxRound: Integer;
     262    MaxScore: Integer;
    263263    AudioShot: TSound;
    264264    AudioExplode: TSound;
     
    733733    Explosion(Position, ExplosionRange);
    734734    Exploded := True;
     735    ExplosionPending := True;
     736    ExplosionTime := Now;
    735737    Engine.AudioExplode.Play;
    736738  end;
     
    18831885var
    18841886  I: Integer;
     1887  HighestScore: Integer;
    18851888begin
    18861889  if Players.GetAliveCount <= 1 then begin
     1890    HighestScore := 0;
    18871891    for I := 0 to Players.Count - 1 do
    1888     with Players[I] do
     1892    with Players[I] do begin
    18891893      if not Exploded then Inc(Score);
    1890     if CurrentRound < MaxRound then begin
     1894      HighestScore := Max(Score, HighestScore);
     1895    end;
     1896    if HighestScore < MaxScore then begin
    18911897      Inc(CurrentRound);
    18921898      NewRound;
    18931899      State := gsNewRound;
    1894     end else
     1900    end else begin
    18951901      State := gsMap;
    18961902      if Assigned(FOnGameEnd) then
    18971903        FOnGameEnd(Self);
     1904    end;
    18981905  end;
    18991906end;
     
    21442151  InitDigMasks;
    21452152  Redraw;
    2146   MaxRound := 5;
     2153  MaxScore := 3;
    21472154end;
    21482155
  • tags/1.1.1/Forms/FormMain.pas

    r101 r103  
    7777
    7878resourcestring
    79   SRound = '%0:s of %1:s';
     79  SRound = '%0:s';
    8080
    8181{ TFormMain }
     
    9595        //  IntToStr(TPlayer(Engine.Players[0]).Direction);
    9696        StatusBar1.Panels[2].Text := FloatToStr(RoundTo(Engine.DrawDuration / OneMillisecond, -2));
    97         StatusBar1.Panels[3].Text := Format(SRound, [IntToStr(Engine.CurrentRound),
    98           IntToStr(Engine.MaxRound)]);
     97        StatusBar1.Panels[3].Text := Format(SRound, [IntToStr(Engine.CurrentRound)]);
    9998      finally
    10099        Engine.Lock.Release;
  • tags/1.1.1/Languages/Tunneler.cs.po

    r87 r103  
    213213#, object-pascal-format
    214214msgctxt "formmain.sround"
    215 msgid "%0:s of %1:s"
    216 msgstr "%0:s z %1:s"
     215msgid "%0:s"
     216msgstr "%0:s"
    217217
    218218#: sound.splaynotsupported
  • tags/1.1.1/Languages/Tunneler.pot

    r87 r103  
    203203#, object-pascal-format
    204204msgctxt "formmain.sround"
    205 msgid "%0:s of %1:s"
     205msgid "%0:s"
    206206msgstr ""
    207207
  • trunk/Engine.pas

    r98 r103  
    260260    Lock: TCriticalSection;
    261261    CurrentRound: Integer;
    262     MaxRound: Integer;
     262    MaxScore: Integer;
    263263    AudioShot: TSound;
    264264    AudioExplode: TSound;
     
    733733    Explosion(Position, ExplosionRange);
    734734    Exploded := True;
     735    ExplosionPending := True;
     736    ExplosionTime := Now;
    735737    Engine.AudioExplode.Play;
    736738  end;
     
    18831885var
    18841886  I: Integer;
     1887  HighestScore: Integer;
    18851888begin
    18861889  if Players.GetAliveCount <= 1 then begin
     1890    HighestScore := 0;
    18871891    for I := 0 to Players.Count - 1 do
    1888     with Players[I] do
     1892    with Players[I] do begin
    18891893      if not Exploded then Inc(Score);
    1890     if CurrentRound < MaxRound then begin
     1894      HighestScore := Max(Score, HighestScore);
     1895    end;
     1896    if HighestScore < MaxScore then begin
    18911897      Inc(CurrentRound);
    18921898      NewRound;
    18931899      State := gsNewRound;
    1894     end else
     1900    end else begin
    18951901      State := gsMap;
    18961902      if Assigned(FOnGameEnd) then
    18971903        FOnGameEnd(Self);
     1904    end;
    18981905  end;
    18991906end;
     
    21442151  InitDigMasks;
    21452152  Redraw;
    2146   MaxRound := 5;
     2153  MaxScore := 3;
    21472154end;
    21482155
  • trunk/Forms/FormMain.pas

    r101 r103  
    7777
    7878resourcestring
    79   SRound = '%0:s of %1:s';
     79  SRound = '%0:s';
    8080
    8181{ TFormMain }
     
    9595        //  IntToStr(TPlayer(Engine.Players[0]).Direction);
    9696        StatusBar1.Panels[2].Text := FloatToStr(RoundTo(Engine.DrawDuration / OneMillisecond, -2));
    97         StatusBar1.Panels[3].Text := Format(SRound, [IntToStr(Engine.CurrentRound),
    98           IntToStr(Engine.MaxRound)]);
     97        StatusBar1.Panels[3].Text := Format(SRound, [IntToStr(Engine.CurrentRound)]);
    9998      finally
    10099        Engine.Lock.Release;
  • trunk/Languages/Tunneler.cs.po

    r87 r103  
    213213#, object-pascal-format
    214214msgctxt "formmain.sround"
    215 msgid "%0:s of %1:s"
    216 msgstr "%0:s z %1:s"
     215msgid "%0:s"
     216msgstr "%0:s"
    217217
    218218#: sound.splaynotsupported
  • trunk/Languages/Tunneler.pot

    r87 r103  
    203203#, object-pascal-format
    204204msgctxt "formmain.sround"
    205 msgid "%0:s of %1:s"
     205msgid "%0:s"
    206206msgstr ""
    207207
Note: See TracChangeset for help on using the changeset viewer.