aboutsummaryrefslogtreecommitdiffstats
path: root/Lua/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Lua/src/base/UParty.pas50
-rw-r--r--Lua/src/screens/UScreenPartyScore.pas7
-rw-r--r--Lua/src/screens/UScreenPartyWin.pas57
3 files changed, 65 insertions, 49 deletions
diff --git a/Lua/src/base/UParty.pas b/Lua/src/base/UParty.pas
index fc741768..3d916f64 100644
--- a/Lua/src/base/UParty.pas
+++ b/Lua/src/base/UParty.pas
@@ -163,6 +163,9 @@ type
been played }
function NextRound: integer;
+ { indicates that current round has already been played }
+ procedure RoundPlayed;
+
{ true if in a Party Game (not in standard mode) }
property PartyGame: Boolean read BPartyGame;
@@ -624,6 +627,13 @@ begin
end;
end;
+{ indicates that current round has already been played }
+procedure TPartyGame.RoundPlayed;
+begin
+ if (bPartyStarted) and (CurRound >= 0) and (CurRound <= High(Rounds)) then
+ Rounds[CurRound].AlreadyPlayed := True;
+end;
+
{ returns true if last round was already played }
function TPartyGame.GameFinished: Boolean;
begin
@@ -788,35 +798,45 @@ begin
end;
end;
-{ returns a string like "Team 1 (and Team 2) win" }
+{ returns a string like "Team 1 (and Team 2) win"
+ if Round is in range from 0 to high(Rounds) then
+ result is name of winners of specified round.
+ if Round is -1 the result is name of winners of
+ the whole party game}
function TPartyGame.GetWinnerString(Round: Integer): String;
var
Winners: array of String;
I: integer;
+ Ranking: AParty_TeamRanking;
begin
Result := '';
-
+ Ranking := nil;
+
if (Round >= 0) and (Round <= High(Rounds)) then
begin
if (not Rounds[Round].AlreadyPlayed) then
- begin
- Result := Language.Translate('PARTY_NOTPLAYEDYET');
- end
+ Result := Language.Translate('PARTY_NOTPLAYEDYET')
else
+ Ranking := Rounds[Round].Ranking;
+ end
+ else if (Round = -1) then
+ Ranking := GetTeamRanking;
+
+
+ if (Ranking <> nil) then
+ begin
+ SetLength(Winners, 0);
+ for I := 0 to High(Ranking) do
begin
- SetLength(Winners, 0);
- for I := 0 to High(Rounds[Round].Ranking) do
+ if (Ranking[I].Rank = PR_First) and (Ranking[I].Team >= 0) and (Ranking[I].Team <= High(Teams)) then
begin
- if Rounds[Round].Ranking[I].Rank = PR_First then
- begin
- SetLength(Winners, Length(Winners) + 1);
- Winners[high(Winners)] := Teams[I].Name;
- end;
+ SetLength(Winners, Length(Winners) + 1);
+ Winners[high(Winners)] := Teams[Ranking[I].Team].Name;
end;
-
- if (Length(Winners) > 0) then
- Result := Language.Implode(Winners);
end;
+
+ if (Length(Winners) > 0) then
+ Result := Language.Implode(Winners);
end;
if (Length(Result) = 0) then
diff --git a/Lua/src/screens/UScreenPartyScore.pas b/Lua/src/screens/UScreenPartyScore.pas
index b249a55a..7fc79ee7 100644
--- a/Lua/src/screens/UScreenPartyScore.pas
+++ b/Lua/src/screens/UScreenPartyScore.pas
@@ -185,6 +185,10 @@ var
begin
inherited;
+ // indicate that round is finished
+ Party.RoundPlayed;
+
+ // get rankings for current round
Ranking := Party.Rounds[Party.CurrentRound].Ranking;
@@ -198,9 +202,6 @@ begin
if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99;
if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; }
- //End Last Round // to-do : Party
- //PartySession.EndRound;
-
//Set Winnertext
Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [Party.GetWinnerString(Party.CurrentRound)]);
diff --git a/Lua/src/screens/UScreenPartyWin.pas b/Lua/src/screens/UScreenPartyWin.pas
index 6b4a55c0..280a9b28 100644
--- a/Lua/src/screens/UScreenPartyWin.pas
+++ b/Lua/src/screens/UScreenPartyWin.pas
@@ -83,13 +83,8 @@ begin
// check special keys
case PressedKey of
SDLK_ESCAPE,
- SDLK_BACKSPACE :
- begin
- AudioPlayback.PlaySound(SoundLib.Start);
- FadeTo(@ScreenMain);
- end;
-
- SDLK_RETURN:
+ SDLK_BACKSPACE,
+ SDLK_RETURN :
begin
AudioPlayback.PlaySound(SoundLib.Start);
FadeTo(@ScreenMain);
@@ -127,11 +122,11 @@ begin
end;
procedure TScreenPartyWin.onShow;
-//var
-// I: Integer; // Auto Removed, Unused Variable
-// Placing: Integer; // Auto Removed, Unused Variable
+var
+ I, J: Integer;
+ Ranking: AParty_TeamRanking;
- Function GetTeamColor(Team: Byte): Cardinal;
+ Function GetTeamColor(Team: Integer): Cardinal;
var
NameString: String;
begin
@@ -143,16 +138,16 @@ procedure TScreenPartyWin.onShow;
begin
inherited;
- // to-do : Party
- //Get Team Placing
- //Placing := PartySession.GetTeamOrder;
+ // get team ranking
+ // Ranking is sorted by score
+ Ranking := Party.GetTeamRanking;
//Set Winnertext
- //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]);
- {if (PartySession.Teams.NumTeams >= 1) then
+ Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [Party.GetWinnerString(-1)]);
+ if (Length(Party.Teams) >= 1) then
begin
- Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score);
- Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name);
+ Text[TextScoreTeam1].Text := IntToStr(Party.Teams[Ranking[0].Team].Score);
+ Text[TextNameTeam1].Text := Party.Teams[Ranking[0].Team].Name;
Text[TextScoreTeam1].Visible := True;
Text[TextNameTeam1].Visible := True;
@@ -163,7 +158,7 @@ begin
//Set Static Color to Team Color
If (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then
begin
- I := GetTeamColor(Placing[0]);
+ I := GetTeamColor(Ranking[0].Team);
if (I <> -1) then
begin
Static[StaticTeam1BG].Texture.ColR := Color[I].RGB.R;
@@ -174,7 +169,7 @@ begin
If (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then
begin
- I := GetTeamColor(Placing[0]);
+ I := GetTeamColor(Ranking[0].Team);
if (I <> -1) then
begin
Static[StaticTeam1].Texture.ColR := Color[I].RGB.R;
@@ -192,10 +187,10 @@ begin
Static[StaticTeam1Deco].Visible := False;
end;
- if (PartySession.Teams.NumTeams >= 2) then
+ if (Length(Party.Teams) >= 2) then
begin
- Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[1]].Score);
- Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[Placing[1]].Name);
+ Text[TextScoreTeam2].Text := IntToStr(Party.Teams[Ranking[1].Team].Score);
+ Text[TextNameTeam2].Text := Party.Teams[Ranking[1].Team].Name;
Text[TextScoreTeam2].Visible := True;
Text[TextNameTeam2].Visible := True;
@@ -206,7 +201,7 @@ begin
//Set Static Color to Team Color
If (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then
begin
- I := GetTeamColor(Placing[1]);
+ I := GetTeamColor(Ranking[1].Team);
if (I <> -1) then
begin
Static[StaticTeam2BG].Texture.ColR := Color[I].RGB.R;
@@ -217,7 +212,7 @@ begin
If (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then
begin
- I := GetTeamColor(Placing[1]);
+ I := GetTeamColor(Ranking[1].Team);
if (I <> -1) then
begin
Static[StaticTeam2].Texture.ColR := Color[I].RGB.R;
@@ -235,10 +230,10 @@ begin
Static[StaticTeam2Deco].Visible := False;
end;
- if (PartySession.Teams.NumTeams >= 3) then
+ if (Length(Party.Teams) >= 3) then
begin
- Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[2]].Score);
- Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[Placing[2]].Name);
+ Text[TextScoreTeam3].Text := IntToStr(Party.Teams[Ranking[2].Team].Score);
+ Text[TextNameTeam3].Text := Party.Teams[Ranking[2].Team].Name;
Text[TextScoreTeam3].Visible := True;
Text[TextNameTeam3].Visible := True;
@@ -249,7 +244,7 @@ begin
//Set Static Color to Team Color
If (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then
begin
- I := GetTeamColor(Placing[2]);
+ I := GetTeamColor(Ranking[2].Team);
if (I <> -1) then
begin
Static[StaticTeam3BG].Texture.ColR := Color[I].RGB.R;
@@ -260,7 +255,7 @@ begin
If (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then
begin
- I := GetTeamColor(Placing[2]);
+ I := GetTeamColor(Ranking[2].Team);
if (I <> -1) then
begin
Static[StaticTeam3].Texture.ColR := Color[I].RGB.R;
@@ -276,7 +271,7 @@ begin
Static[StaticTeam3].Visible := False;
Static[StaticTeam3BG].Visible := False;
Static[StaticTeam3Deco].Visible := False;
- end; }
+ end;
end;
procedure TScreenPartyWin.SetAnimationProgress(Progress: real);