hedgewars/uTeams.pas
changeset 10124 aabd1b75d5a3
parent 10116 dd27562b6f21
child 10193 d7cd5b43588f
equal deleted inserted replaced
10123:64e72781d344 10124:aabd1b75d5a3
    51 var GameOver: boolean;
    51 var GameOver: boolean;
    52     NextClan: boolean;
    52     NextClan: boolean;
    53 
    53 
    54 function CheckForWin: boolean;
    54 function CheckForWin: boolean;
    55 var AliveClan: PClan;
    55 var AliveClan: PClan;
    56     s: shortstring;
    56     s, ts: ansistring;
    57     t, AliveCount, i, j: LongInt;
    57     t, AliveCount, i, j: LongInt;
    58 begin
    58 begin
    59 CheckForWin:= false;
    59 CheckForWin:= false;
    60 AliveCount:= 0;
    60 AliveCount:= 0;
    61 for t:= 0 to Pred(ClansCount) do
    61 for t:= 0 to Pred(ClansCount) do
    79 if not GameOver then
    79 if not GameOver then
    80     begin
    80     begin
    81     if AliveCount = 0 then
    81     if AliveCount = 0 then
    82         begin // draw
    82         begin // draw
    83         AddCaption(trmsg[sidDraw], cWhiteColor, capgrpGameState);
    83         AddCaption(trmsg[sidDraw], cWhiteColor, capgrpGameState);
    84         SendStat(siGameResult, trmsg[sidDraw]);
    84         SendStat(siGameResult, shortstring(trmsg[sidDraw]));
    85         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
    85         AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
    86         end
    86         end
    87     else // win
    87     else // win
    88         with AliveClan^ do
    88         with AliveClan^ do
    89             begin
    89             begin
       
    90             ts:= ansistring(Teams[0]^.TeamName);
    90             if TeamsNumber = 1 then
    91             if TeamsNumber = 1 then
    91                 s:= Format(shortstring(trmsg[sidWinner]), Teams[0]^.TeamName)  // team wins
    92                 s:= FormatA(trmsg[sidWinner], ts)  // team wins
    92             else
    93             else
    93                 s:= Format(shortstring(trmsg[sidWinner]), Teams[0]^.TeamName); // clan wins
    94                 s:= FormatA(trmsg[sidWinner], ts); // clan wins
    94 
    95 
    95             for j:= 0 to Pred(TeamsNumber) do
    96             for j:= 0 to Pred(TeamsNumber) do
    96                 with Teams[j]^ do
    97                 with Teams[j]^ do
    97                     for i:= 0 to cMaxHHIndex do
    98                     for i:= 0 to cMaxHHIndex do
    98                         with Hedgehogs[i] do
    99                         with Hedgehogs[i] do
   102                 AddVoice(sndFlawless, Teams[0]^.voicepack)
   103                 AddVoice(sndFlawless, Teams[0]^.voicepack)
   103             else
   104             else
   104                 AddVoice(sndVictory, Teams[0]^.voicepack);
   105                 AddVoice(sndVictory, Teams[0]^.voicepack);
   105 
   106 
   106             AddCaption(s, cWhiteColor, capgrpGameState);
   107             AddCaption(s, cWhiteColor, capgrpGameState);
   107             SendStat(siGameResult, s);
   108             SendStat(siGameResult, shortstring(s));
   108             AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
   109             AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
   109             end;
   110             end;
   110     SendStats;
   111     SendStats;
   111     end;
   112     end;
   112 GameOver:= true
   113 GameOver:= true
   235 procedure AfterSwitchHedgehog;
   236 procedure AfterSwitchHedgehog;
   236 var i, t: LongInt;
   237 var i, t: LongInt;
   237     CurWeapon: PAmmo;
   238     CurWeapon: PAmmo;
   238     w: real;
   239     w: real;
   239     vg: PVisualGear;
   240     vg: PVisualGear;
   240 
   241     s: ansistring;
   241 begin
   242 begin
   242 if PlacingHogs then
   243 if PlacingHogs then
   243     begin
   244     begin
   244     PlacingHogs:= false;
   245     PlacingHogs:= false;
   245     for t:= 0 to Pred(TeamsCount) do
   246     for t:= 0 to Pred(TeamsCount) do
   332         GetRandom(2); // needed to avoid extdriven desync
   333         GetRandom(2); // needed to avoid extdriven desync
   333         AddVoice(sndYesSir, CurrentTeam^.voicepack);
   334         AddVoice(sndYesSir, CurrentTeam^.voicepack);
   334         end;
   335         end;
   335     if cHedgehogTurnTime < 1000000 then
   336     if cHedgehogTurnTime < 1000000 then
   336         ReadyTimeLeft:= cReadyDelay;
   337         ReadyTimeLeft:= cReadyDelay;
   337     AddCaption(Format(shortstring(trmsg[sidReady]), CurrentTeam^.TeamName), cWhiteColor, capgrpGameState)
   338     s:= ansistring(CurrentTeam^.TeamName);
       
   339     AddCaption(FormatA(trmsg[sidReady], s), cWhiteColor, capgrpGameState)
   338     end
   340     end
   339 else
   341 else
   340     begin
   342     begin
   341     if TurnTimeLeft > 0 then
   343     if TurnTimeLeft > 0 then
   342         begin
   344         begin