diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-05-12 09:17:15 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-05-12 09:17:15 +0000 |
commit | 4036ca0937c05444b23018a19d69d1aef90495db (patch) | |
tree | 418f32b441997504a19533ac50f1e767f4803bd4 | |
parent | 8c0e834e1e8715d4b9357b42fb11e9b5a2da5c7a (diff) | |
download | usdx-4036ca0937c05444b23018a19d69d1aef90495db.tar.gz usdx-4036ca0937c05444b23018a19d69d1aef90495db.tar.xz usdx-4036ca0937c05444b23018a19d69d1aef90495db.zip |
Party Win Screen now works the way it should.
The Statics are sorted by Score
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@190 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UParty.pas | 36 | ||||
-rw-r--r-- | Game/Code/Screens/UScreenPartyWin.pas | 23 |
2 files changed, 46 insertions, 13 deletions
diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index b07ad5ad..7bf3dd1b 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -10,6 +10,13 @@ type Winner: Byte;
end;
+ TeamOrderEntry = record
+ Teamnum: Byte;
+ Score: Byte;
+ end;
+
+ TeamOrderArray = Array[0..5] of Byte;
+
TParty_Session = class
private
function GetRandomPlayer(Team: Byte): Byte;
@@ -25,7 +32,7 @@ type procedure StartNewParty(NumRounds: Byte);
procedure StartRound;
procedure EndRound;
- function GetWinner: Byte;
+ function GetTeamOrder: TeamOrderArray;
function GetWinnerString(Round: Byte): String;
end;
@@ -334,11 +341,34 @@ begin end;
//----------
-//Get Winner - Gives back the Number of the total Winner
+//GetTeamOrder - Gives back the Placing of eacb Team [First Position of Array is Teamnum of first placed Team, ...]
//----------
-function TParty_Session.GetWinner: Byte;
+function TParty_Session.GetTeamOrder: TeamOrderArray;
+var
+ I, J: Integer;
+ ATeams: array [0..5] of TeamOrderEntry;
+ TempTeam: TeamOrderEntry;
begin
+ //Fill Team Array
+ For I := 0 to Teams.NumTeams-1 do
+ begin
+ ATeams[I].Teamnum := I;
+ ATeams[I].Score := Teams.Teaminfo[I].Score;
+ end;
+ //Sort Teams
+ for J := 0 to Teams.NumTeams-1 do
+ for I := 1 to Teams.NumTeams-1 do
+ if ATeams[I].Score > ATeams[I-1].Score then
+ begin
+ TempTeam := ATeams[I-1];
+ ATeams[I-1] := ATeams[I];
+ ATeams[I] := TempTeam;
+ end;
+
+ //Copy to Result
+ For I := 0 to Teams.NumTeams-1 do
+ Result[I] := ATeams[I].TeamNum;
end;
end.
diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index a6486f67..1c4549a4 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -46,11 +46,11 @@ begin Result := false;
end;
- {SDLK_ESCAPE :
+ SDLK_ESCAPE :
begin
Music.PlayStart;
FadeTo(@ScreenMain);
- end;}
+ end;
SDLK_RETURN:
begin
@@ -92,15 +92,18 @@ end; procedure TScreenPartyWin.onShow;
var
I: Integer;
+ Placing: TeamOrderArray;
begin
-
+ //Get Team Placing
+ Placing := PartySession.GetTeamOrder;
+
//Set Winnertext
- Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(255)]);
+ Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]);
if (PartySession.Teams.NumTeams >= 1) then
begin
- Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score);
- Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name);
+ Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score);
+ Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name);
Text[TextScoreTeam1].Visible := True;
Text[TextNameTeam1].Visible := True;
@@ -119,8 +122,8 @@ begin if (PartySession.Teams.NumTeams >= 2) then
begin
- Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score);
- Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name);
+ Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[1]].Score);
+ Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[Placing[1]].Name);
Text[TextScoreTeam2].Visible := True;
Text[TextNameTeam2].Visible := True;
@@ -139,8 +142,8 @@ begin if (PartySession.Teams.NumTeams >= 3) then
begin
- Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score);
- Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name);
+ Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[2]].Score);
+ Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[Placing[2]].Name);
Text[TextScoreTeam3].Visible := True;
Text[TextNameTeam3].Visible := True;
|