aboutsummaryrefslogtreecommitdiffstats
path: root/src/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/UScreenMain.pas19
-rw-r--r--src/screens/UScreenPartyNewRound.pas272
-rw-r--r--src/screens/UScreenPartyOptions.pas90
-rw-r--r--src/screens/UScreenPartyPlayer.pas206
-rw-r--r--src/screens/UScreenPartyRounds.pas237
-rw-r--r--src/screens/UScreenPartyScore.pas107
-rw-r--r--src/screens/UScreenPartyWin.pas52
-rw-r--r--src/screens/UScreenSing.pas62
-rw-r--r--src/screens/UScreenSong.pas78
-rw-r--r--src/screens/UScreenSongMenu.pas25
10 files changed, 650 insertions, 498 deletions
diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas
index ca4ba7cc..b342281c 100644
--- a/src/screens/UScreenMain.pas
+++ b/src/screens/UScreenMain.pas
@@ -153,12 +153,7 @@ begin
begin
if (Songs.SongList.Count >= 1) then
begin
- if (Length(DLLMan.Plugins) >= 1) then
- begin
- FadeTo(@ScreenPartyOptions, SoundLib.Start);
- end
- else //show error message, No Plugins Loaded
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ FadeTo(@ScreenPartyOptions, SoundLib.Start);
end
else //show error message, No Songs Loaded
ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS'));
@@ -241,12 +236,18 @@ procedure TScreenMain.OnShow;
begin
inherited;
+ {**
+ * Clean up TPartyGame here
+ * at the moment there is no better place for this
+ *}
+ Party.Clear;
+
{ display cursor (on moved) }
Display.SetCursor;
-{**
- * Start background music
- *}
+ {**
+ * Start background music
+ *}
SoundLib.StartBgMusic;
end;
diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas
index c4295502..b52efd21 100644
--- a/src/screens/UScreenPartyNewRound.pas
+++ b/src/screens/UScreenPartyNewRound.pas
@@ -46,21 +46,9 @@ type
TScreenPartyNewRound = class(TMenu)
public
//Texts:
- TextRound1: cardinal;
- TextRound2: cardinal;
- TextRound3: cardinal;
- TextRound4: cardinal;
- TextRound5: cardinal;
- TextRound6: cardinal;
- TextRound7: cardinal;
-
- TextWinner1: cardinal;
- TextWinner2: cardinal;
- TextWinner3: cardinal;
- TextWinner4: cardinal;
- TextWinner5: cardinal;
- TextWinner6: cardinal;
- TextWinner7: cardinal;
+ TextRound: array [0..6] of cardinal;
+
+ TextWinner: array [0..6] of cardinal;
TextNextRound: cardinal;
TextNextRoundNo: cardinal;
@@ -69,13 +57,7 @@ type
TextNextPlayer3: cardinal;
//Statics
- StaticRound1: cardinal;
- StaticRound2: cardinal;
- StaticRound3: cardinal;
- StaticRound4: cardinal;
- StaticRound5: cardinal;
- StaticRound6: cardinal;
- StaticRound7: cardinal;
+ StaticRound: array [0..6] of cardinal;
//Scores
TextScoreTeam1: cardinal;
@@ -144,16 +126,7 @@ begin
SDLK_RETURN:
begin
AudioPlayback.PlaySound(SoundLib.Start);
- if DLLMan.Selected.LoadSong then
- begin
- //Select PartyMode ScreenSong
- ScreenSong.Mode := smPartyMode;
- FadeTo(@ScreenSong);
- end
- else
- begin
- FadeTo(@ScreenSingModi);
- end;
+ Party.CallBeforeSongSelect;
end;
end;
end;
@@ -163,21 +136,21 @@ constructor TScreenPartyNewRound.Create;
begin
inherited Create;
- TextRound1 := AddText (Theme.PartyNewRound.TextRound1);
- TextRound2 := AddText (Theme.PartyNewRound.TextRound2);
- TextRound3 := AddText (Theme.PartyNewRound.TextRound3);
- TextRound4 := AddText (Theme.PartyNewRound.TextRound4);
- TextRound5 := AddText (Theme.PartyNewRound.TextRound5);
- TextRound6 := AddText (Theme.PartyNewRound.TextRound6);
- TextRound7 := AddText (Theme.PartyNewRound.TextRound7);
-
- TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1);
- TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2);
- TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3);
- TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4);
- TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5);
- TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6);
- TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7);
+ TextRound[0] := AddText (Theme.PartyNewRound.TextRound1);
+ TextRound[1] := AddText (Theme.PartyNewRound.TextRound2);
+ TextRound[2] := AddText (Theme.PartyNewRound.TextRound3);
+ TextRound[3] := AddText (Theme.PartyNewRound.TextRound4);
+ TextRound[4] := AddText (Theme.PartyNewRound.TextRound5);
+ TextRound[5] := AddText (Theme.PartyNewRound.TextRound6);
+ TextRound[6] := AddText (Theme.PartyNewRound.TextRound7);
+
+ TextWinner[0] := AddText (Theme.PartyNewRound.TextWinner1);
+ TextWinner[1] := AddText (Theme.PartyNewRound.TextWinner2);
+ TextWinner[2] := AddText (Theme.PartyNewRound.TextWinner3);
+ TextWinner[3] := AddText (Theme.PartyNewRound.TextWinner4);
+ TextWinner[4] := AddText (Theme.PartyNewRound.TextWinner5);
+ TextWinner[5] := AddText (Theme.PartyNewRound.TextWinner6);
+ TextWinner[6] := AddText (Theme.PartyNewRound.TextWinner7);
TextNextRound := AddText (Theme.PartyNewRound.TextNextRound);
TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo);
@@ -185,13 +158,13 @@ begin
TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2);
TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3);
- StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1);
- StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2);
- StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3);
- StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4);
- StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5);
- StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6);
- StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7);
+ StaticRound[0] := AddStatic (Theme.PartyNewRound.StaticRound1);
+ StaticRound[1] := AddStatic (Theme.PartyNewRound.StaticRound2);
+ StaticRound[2] := AddStatic (Theme.PartyNewRound.StaticRound3);
+ StaticRound[3] := AddStatic (Theme.PartyNewRound.StaticRound4);
+ StaticRound[4] := AddStatic (Theme.PartyNewRound.StaticRound5);
+ StaticRound[5] := AddStatic (Theme.PartyNewRound.StaticRound6);
+ StaticRound[6] := AddStatic (Theme.PartyNewRound.StaticRound7);
//Scores
TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1);
@@ -219,18 +192,18 @@ end;
procedure TScreenPartyNewRound.OnShow;
var
I: integer;
- function GetTeamPlayers(const Num: byte): UTF8String;
+ function GetTeamPlayers(const Num: integer): UTF8String;
var
Players: array of UTF8String;
- J: byte;
+ J: integer;
begin
- if (Num-1 >= PartySession.Teams.NumTeams) then
+ if (Num > High(Party.Teams)) or (Num < 0) then
exit;
//Create Players array
- SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers);
- for J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do
- Players[J] := UTF8String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);
+ SetLength(Players, Length(Party.Teams[Num].Players));
+ For J := 0 to High(Party.Teams[Num].Players) do
+ Players[J] := UTF8String(Party.Teams[Num].Players[J].Name);
//Implode and Return
Result := Language.Implode(Players);
@@ -238,135 +211,34 @@ var
begin
inherited;
- PartySession.StartRound;
-
//Set Visibility of Round Infos
- I := Length(PartySession.Rounds);
- if (I >= 1) then
- begin
- Static[StaticRound1].Visible := true;
- Text[TextRound1].Visible := true;
- Text[TextWinner1].Visible := true;
-
- //Texts:
- Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name);
- Text[TextWinner1].Text := PartySession.GetWinnerString(0);
- end
- else
- begin
- Static[StaticRound1].Visible := false;
- Text[TextRound1].Visible := false;
- Text[TextWinner1].Visible := false;
- end;
-
- if (I >= 2) then
- begin
- Static[StaticRound2].Visible := true;
- Text[TextRound2].Visible := true;
- Text[TextWinner2].Visible := true;
-
- //Texts:
- Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name);
- Text[TextWinner2].Text := PartySession.GetWinnerString(1);
- end
- else
- begin
- Static[StaticRound2].Visible := false;
- Text[TextRound2].Visible := false;
- Text[TextWinner2].Visible := false;
- end;
-
- if (I >= 3) then
- begin
- Static[StaticRound3].Visible := true;
- Text[TextRound3].Visible := true;
- Text[TextWinner3].Visible := true;
-
- //Texts:
- Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name);
- Text[TextWinner3].Text := PartySession.GetWinnerString(2);
- end
- else
- begin
- Static[StaticRound3].Visible := false;
- Text[TextRound3].Visible := false;
- Text[TextWinner3].Visible := false;
- end;
-
- if (I >= 4) then
- begin
- Static[StaticRound4].Visible := true;
- Text[TextRound4].Visible := true;
- Text[TextWinner4].Visible := true;
-
- //Texts:
- Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name);
- Text[TextWinner4].Text := PartySession.GetWinnerString(3);
- end
- else
+ for I := 0 to 6 do
begin
- Static[StaticRound4].Visible := false;
- Text[TextRound4].Visible := false;
- Text[TextWinner4].Visible := false;
- end;
-
- if (I >= 5) then
- begin
- Static[StaticRound5].Visible := true;
- Text[TextRound5].Visible := true;
- Text[TextWinner5].Visible := true;
-
- //Texts:
- Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name);
- Text[TextWinner5].Text := PartySession.GetWinnerString(4);
- end
- else
- begin
- Static[StaticRound5].Visible := false;
- Text[TextRound5].Visible := false;
- Text[TextWinner5].Visible := false;
- end;
-
- if (I >= 6) then
- begin
- Static[StaticRound6].Visible := true;
- Text[TextRound6].Visible := true;
- Text[TextWinner6].Visible := true;
-
- //Texts:
- Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name);
- Text[TextWinner6].Text := PartySession.GetWinnerString(5);
- end
- else
- begin
- Static[StaticRound6].Visible := false;
- Text[TextRound6].Visible := false;
- Text[TextWinner6].Visible := false;
+ if (I <= High(Party.Rounds)) then
+ begin
+ Static[StaticRound[I]].Visible := True;
+ Text[TextRound[I]].Visible := True;
+ Text[TextWinner[I]].Visible := True;
+
+ // update texts:
+ Text[TextRound[I]].Text := Language.Translate('MODE_' + uppercase(Party.Modes[Party.Rounds[I].Mode].Name) + '_NAME');
+ Text[TextWinner[I]].Text := Party.GetWinnerString(I);
+ end
+ else
+ begin
+ Static[StaticRound[I]].Visible := False;
+ Text[TextRound[I]].Visible := False;
+ Text[TextWinner[I]].Visible := False;
+ end;
end;
- if (I >= 7) then
- begin
- Static[StaticRound7].Visible := true;
- Text[TextRound7].Visible := true;
- Text[TextWinner7].Visible := true;
-
- //Texts:
- Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name);
- Text[TextWinner7].Text := PartySession.GetWinnerString(6);
- end
- else
- begin
- Static[StaticRound7].Visible := false;
- Text[TextRound7].Visible := false;
- Text[TextWinner7].Visible := false;
- end;
//Display Scores
- if (PartySession.Teams.NumTeams >= 1) then
+ if (Length(Party.Teams) >= 1) then
begin
- Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score);
- Text[TextNameTeam1].Text := UTF8String(PartySession.Teams.TeamInfo[0].Name);
- Text[TextTeam1Players].Text := GetTeamPlayers(1);
+ Text[TextScoreTeam1].Text := InttoStr(Party.Teams[0].Score);
+ Text[TextNameTeam1].Text := UTF8String(Party.Teams[0].Name);
+ Text[TextTeam1Players].Text := GetTeamPlayers(0);
Text[TextScoreTeam1].Visible := true;
Text[TextNameTeam1].Visible := true;
@@ -383,11 +255,11 @@ begin
Static[StaticNextPlayer1].Visible := false;
end;
- if (PartySession.Teams.NumTeams >= 2) then
+ if (Length(Party.Teams) >= 2) then
begin
- Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score);
- Text[TextNameTeam2].Text := UTF8String(PartySession.Teams.TeamInfo[1].Name);
- Text[TextTeam2Players].Text := GetTeamPlayers(2);
+ Text[TextScoreTeam2].Text := InttoStr(Party.Teams[1].Score);
+ Text[TextNameTeam2].Text := UTF8String(Party.Teams[1].Name);
+ Text[TextTeam2Players].Text := GetTeamPlayers(1);
Text[TextScoreTeam2].Visible := true;
Text[TextNameTeam2].Visible := true;
@@ -404,11 +276,11 @@ begin
Static[StaticNextPlayer2].Visible := false;
end;
- if (PartySession.Teams.NumTeams >= 3) then
+ if (Length(Party.Teams) >= 3) then
begin
- Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score);
- Text[TextNameTeam3].Text := UTF8String(PartySession.Teams.TeamInfo[2].Name);
- Text[TextTeam3Players].Text := GetTeamPlayers(3);
+ Text[TextScoreTeam3].Text := InttoStr(Party.Teams[2].Score);
+ Text[TextNameTeam3].Text := UTF8String(Party.Teams[2].Name);
+ Text[TextTeam3Players].Text := GetTeamPlayers(2);
Text[TextScoreTeam3].Visible := true;
Text[TextNameTeam3].Visible := true;
@@ -423,30 +295,30 @@ begin
Text[TextTeam3Players].Visible := false;
Static[StaticTeam3].Visible := false;
Static[StaticNextPlayer3].Visible := false;
- end;
+ end;
//nextRound Texts
- Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc);
- Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1);
- if (PartySession.Teams.NumTeams >= 1) then
+ Text[TextNextRound].Text := Language.Translate('MODE_' + uppercase(Party.Modes[Party.Rounds[Party.CurrentRound].Mode].Name) + '_DESC');
+ Text[TextNextRoundNo].Text := InttoStr(Party.CurrentRound + 1);
+ if (Length(Party.Teams) >= 1) then
begin
- Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name;
+ Text[TextNextPlayer1].Text := Party.Teams[0].Players[Party.Teams[0].NextPlayer].Name;
Text[TextNextPlayer1].Visible := true;
end
else
Text[TextNextPlayer1].Visible := false;
-
- if (PartySession.Teams.NumTeams >= 2) then
+
+ if (Length(Party.Teams) >= 2) then
begin
- Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name;
+ Text[TextNextPlayer2].Text := Party.Teams[1].Players[Party.Teams[1].NextPlayer].Name;
Text[TextNextPlayer2].Visible := true;
end
else
Text[TextNextPlayer2].Visible := false;
- if (PartySession.Teams.NumTeams >= 3) then
+ if (Length(Party.Teams) >= 3) then
begin
- Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name;
+ Text[TextNextPlayer3].Text := Party.Teams[2].Players[Party.Teams[2].NextPlayer].Name;
Text[TextNextPlayer3].Visible := true;
end
else
diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas
index 2deffda6..3dce9954 100644
--- a/src/screens/UScreenPartyOptions.pas
+++ b/src/screens/UScreenPartyOptions.pas
@@ -44,38 +44,26 @@ uses
type
TScreenPartyOptions = class(TMenu)
- public
+ private
SelectLevel: cardinal;
SelectPlayList: cardinal;
SelectPlayList2: cardinal;
SelectRounds: cardinal;
- SelectTeams: cardinal;
- SelectPlayers1: cardinal;
- SelectPlayers2: cardinal;
- SelectPlayers3: cardinal;
+
+ IPlaylist: array[0..2] of UTF8String;
+ IPlaylist2: array of UTF8String;
PlayList: integer;
PlayList2: integer;
- Rounds: integer;
- NumTeams: integer;
- NumPlayer1, NumPlayer2, NumPlayer3: integer;
-
+
+ procedure SetPlaylist2;
+ public
constructor Create; override;
function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override;
procedure OnShow; override;
procedure SetAnimationProgress(Progress: real); override;
- procedure SetPlaylist2;
end;
-var
- IPlaylist: array[0..2] of UTF8String;
- IPlaylist2: array of UTF8String;
-
- const
- ITeams: array[0..1] of UTF8String = ('2', '3');
- IPlayers: array[0..3] of UTF8String = ('1', '2', '3', '4');
- IRounds: array[0..5] of UTF8String = ('2', '3', '4', '5', '6', '7');
-
implementation
uses
@@ -122,27 +110,11 @@ begin
//Don'T start when Playlist is Selected and there are no Playlists
if (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then
Exit;
- // Don't start when SinglePlayer Teams but only Multiplayer Plugins available
- OnlyMultiPlayer := true;
- for I := 0 to High(DLLMan.Plugins) do
- begin
- OnlyMultiPlayer := (OnlyMultiPlayer and DLLMan.Plugins[I].TeamModeOnly);
- end;
- if (OnlyMultiPlayer) and ((NumPlayer1 = 0) or (NumPlayer2 = 0) or ((NumPlayer3 = 0) and (NumTeams = 1))) then
- begin
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
- Exit;
- end;
+
//Save Difficulty
Ini.Difficulty := SelectsS[SelectLevel].SelectedOption;
Ini.SaveLevel;
- //Save Num Teams:
- PartySession.Teams.NumTeams := NumTeams + 2;
- PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1;
- PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1;
- PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;
-
//Save Playlist
PlaylistMan.Mode := TSingMode( Playlist );
PlaylistMan.CurPlayList := High(cardinal);
@@ -169,9 +141,6 @@ begin
else
PlaylistMan.CurPlayList := Playlist2;
- //Start Party
- PartySession.StartNewParty(Rounds + 2);
-
AudioPlayback.PlaySound(SoundLib.Start);
//Go to Player Screen
FadeTo(@ScreenPartyPlayer);
@@ -191,10 +160,6 @@ begin
if (Interaction = 1) then
begin
SetPlaylist2;
- end //Change Team3 Players visibility
- else if (Interaction = 4) then
- begin
- SelectsS[7].Visible := (NumTeams = 1);
end;
end;
SDLK_LEFT:
@@ -206,10 +171,6 @@ begin
if (Interaction = 1) then
begin
SetPlaylist2;
- end //Change Team3 Players visibility
- else if (Interaction = 4) then
- begin
- SelectsS[7].Visible := (NumTeams = 1);
end;
end;
end;
@@ -229,30 +190,25 @@ begin
IPlaylist2[0] := '---';
//Clear all Selects
- NumTeams := 0;
- NumPlayer1 := 0;
- NumPlayer2 := 0;
- NumPlayer3 := 0;
- Rounds := 5;
PlayList := 0;
PlayList2 := 0;
//Load Screen From Theme
LoadFromTheme(Theme.PartyOptions);
+ Theme.PartyOptions.SelectLevel.oneItemOnly := true;
+ Theme.PartyOptions.SelectLevel.showArrows := true;
SelectLevel := AddSelectSlide(Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel);
+
+ Theme.PartyOptions.SelectPlayList.oneItemOnly := true;
+ Theme.PartyOptions.SelectPlayList.showArrows := true;
SelectPlayList := AddSelectSlide(Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist);
+
+ Theme.PartyOptions.SelectPlayList2.oneItemOnly := true;
+ Theme.PartyOptions.SelectPlayList2.showArrows := true;
SelectPlayList2 := AddSelectSlide(Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2);
- SelectRounds := AddSelectSlide(Theme.PartyOptions.SelectRounds, Rounds, IRounds);
- SelectTeams := AddSelectSlide(Theme.PartyOptions.SelectTeams, NumTeams, ITeams);
- SelectPlayers1 := AddSelectSlide(Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers);
- SelectPlayers2 := AddSelectSlide(Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers);
- SelectPlayers3 := AddSelectSlide(Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers);
Interaction := 0;
-
- //Hide Team3 Players
- SelectsS[7].Visible := false;
end;
procedure TScreenPartyOptions.SetPlaylist2;
@@ -306,7 +262,19 @@ procedure TScreenPartyOptions.OnShow;
begin
inherited;
- Randomize;
+ Party.Clear;
+
+ // check if there are loaded modes
+ if Party.ModesAvailable then
+ begin
+ // modes are loaded
+ Randomize;
+ end
+ else
+ begin // no modes found
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS'));
+ Display.AbortScreenChange;
+ end;
end;
procedure TScreenPartyOptions.SetAnimationProgress(Progress: real);
diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas
index 887d5202..3fcaa4ba 100644
--- a/src/screens/UScreenPartyPlayer.pas
+++ b/src/screens/UScreenPartyPlayer.pas
@@ -44,6 +44,14 @@ uses
type
TScreenPartyPlayer = class(TMenu)
+ private
+ CountTeams: integer;
+ CountPlayer: array [0..2] of integer;
+
+ SelectTeams: cardinal;
+ SelectPlayers: array [0..2] of cardinal;
+ procedure UpdateInterface;
+ procedure UpdateParty;
public
Team1Name: cardinal;
Player1Name: cardinal;
@@ -69,6 +77,10 @@ type
procedure SetAnimationProgress(Progress: real); override;
end;
+const
+ ITeams: array[0..1] of UTF8String = ('2', '3');
+ IPlayers: array[0..3] of UTF8String = ('1', '2', '3', '4');
+
implementation
uses
@@ -77,24 +89,92 @@ uses
UIni,
UTexture,
UParty,
- UUnicodeUtils;
+ UUnicodeUtils,
+ UScreenPartyOptions,
+ ULanguage;
+
+procedure TScreenPartyPlayer.UpdateInterface;
+ var
+ I: integer;
+ Btn: integer;
+begin
+ SelectsS[SelectPlayers[2]].Visible := (CountTeams = 1);
+
+ Btn := 0;
+ for I := 0 to 2 do
+ begin
+ if (CountTeams + 1 >= I) then
+ begin
+ Button[Btn + 0].Visible := true;
+ Button[Btn + 1].Visible := (CountPlayer[I] + 1 >= 1);
+ Button[Btn + 2].Visible := (CountPlayer[I] + 1 >= 2);
+ Button[Btn + 3].Visible := (CountPlayer[I] + 1 >= 3);
+ Button[Btn + 4].Visible := (CountPlayer[I] + 1 >= 4);
+ end
+ else
+ begin
+ Button[Btn + 0].Visible := false;
+ Button[Btn + 1].Visible := false;
+ Button[Btn + 2].Visible := false;
+ Button[Btn + 3].Visible := false;
+ Button[Btn + 4].Visible := false;
+ end;
+ Inc(Btn, 5);
+ end;
+end;
+
+procedure TScreenPartyPlayer.UpdateParty;
+ var
+ I, J: integer;
+ Rounds: ARounds;
+begin
+ {//Save PlayerNames
+ for I := 0 to PartySession.Teams.NumTeams-1 do
+ begin
+ PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text);
+ for J := 0 to PartySession.Teams.Teaminfo[I].NumPlayers-1 do
+ begin
+ PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text);
+ PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0;
+ end;
+ end; }
+
+ // add teams to party
+
+ for I := 0 to CountTeams + 1 do
+ begin
+ Party.AddTeam(Button[I * 5].Text[0].Text);
+
+ for J := 0 to CountPlayer[I] do
+ Party.AddPlayer(I, Button[I * 5 + 1 + J].Text[0].Text);
+ end;
+
+ if (Party.ModesAvailable) then
+ begin //mode for current playersetup available
+ FadeTo(@ScreenPartyRounds, SoundLib.Start);
+ end
+ else
+ begin
+ // no mode available for current player setup
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_MODES_FOR_CURRENT_SETUP'));
+ Party.Clear;
+ end;
+end;
function TScreenPartyPlayer.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean;
var
SDL_ModState: word;
- I, J: integer;
-
procedure IntNext;
begin
repeat
InteractNext;
- until Button[Interaction].Visible;
+ until (Interactions[Interaction].Typ <> iButton) or (Button[Interactions[Interaction].Num].Visible);
end;
procedure IntPrev;
begin
repeat
InteractPrev;
- until Button[Interaction].Visible;
+ until (Interactions[Interaction].Typ <> iButton) or (Button[Interactions[Interaction].Num].Visible);
end;
begin
Result := true;
@@ -244,31 +324,31 @@ begin
FadeTo(@ScreenPartyOptions);
end;
- SDLK_RETURN:
- begin
-
- //Save PlayerNames
- for I := 0 to PartySession.Teams.NumTeams-1 do
- begin
- PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text);
- for J := 0 to PartySession.Teams.Teaminfo[I].NumPlayers-1 do
- begin
- PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text);
- PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0;
- end;
- end;
-
- AudioPlayback.PlaySound(SoundLib.Start);
- FadeTo(@ScreenPartyNewRound);
- end;
+ SDLK_RETURN: UpdateParty;
// Up and Down could be done at the same time,
// but I don't want to declare variables inside
// functions like this one, called so many times
SDLK_DOWN: IntNext;
SDLK_UP: IntPrev;
- SDLK_RIGHT: IntNext;
- SDLK_LEFT: IntPrev;
+ SDLK_RIGHT: begin
+ if (Interaction in [0,2,8,14]) then
+ begin
+ AudioPlayback.PlaySound(SoundLib.Option);
+ InteractInc;
+
+ UpdateInterface;
+ end;
+ end;
+ SDLK_LEFT: begin
+ if (Interaction in [0,2,8,14]) then
+ begin
+ AudioPlayback.PlaySound(SoundLib.Option);
+ InteractDec;
+
+ UpdateInterface;
+ end;
+ end;
end;
end;
end;
@@ -279,25 +359,47 @@ begin
LoadFromTheme(Theme.PartyPlayer);
+ Theme.PartyPlayer.SelectTeams.oneItemOnly := true;
+ Theme.PartyPlayer.SelectTeams.showArrows := true;
+ SelectTeams := AddSelectSlide(Theme.PartyPlayer.SelectTeams, CountTeams, ITeams);
+
Team1Name := AddButton(Theme.PartyPlayer.Team1Name);
+ Theme.PartyPlayer.SelectPlayers1.oneItemOnly := true;
+ Theme.PartyPlayer.SelectPlayers1.showArrows := true;
+ SelectPlayers[0] := AddSelectSlide(Theme.PartyPlayer.SelectPlayers1, CountPlayer[0], IPlayers);
+
AddButton(Theme.PartyPlayer.Player1Name);
AddButton(Theme.PartyPlayer.Player2Name);
AddButton(Theme.PartyPlayer.Player3Name);
AddButton(Theme.PartyPlayer.Player4Name);
Team2Name := AddButton(Theme.PartyPlayer.Team2Name);
+ Theme.PartyPlayer.SelectPlayers2.oneItemOnly := true;
+ Theme.PartyPlayer.SelectPlayers2.showArrows := true;
+ SelectPlayers[1] := AddSelectSlide(Theme.PartyPlayer.SelectPlayers2, CountPlayer[1], IPlayers);
+
AddButton(Theme.PartyPlayer.Player5Name);
AddButton(Theme.PartyPlayer.Player6Name);
AddButton(Theme.PartyPlayer.Player7Name);
AddButton(Theme.PartyPlayer.Player8Name);
Team3Name := AddButton(Theme.PartyPlayer.Team3Name);
+ Theme.PartyPlayer.SelectPlayers3.oneItemOnly := true;
+ Theme.PartyPlayer.SelectPlayers3.showArrows := true;
+ SelectPlayers[2] := AddSelectSlide(Theme.PartyPlayer.SelectPlayers3, CountPlayer[2], IPlayers);
+
AddButton(Theme.PartyPlayer.Player9Name);
AddButton(Theme.PartyPlayer.Player10Name);
AddButton(Theme.PartyPlayer.Player11Name);
AddButton(Theme.PartyPlayer.Player12Name);
Interaction := 0;
+
+ //Clear Selects
+ CountTeams := 0;
+ CountPlayer[0] := 0;
+ CountPlayer[1] := 0;
+ CountPlayer[2] := 0;
end;
procedure TScreenPartyPlayer.OnShow;
@@ -320,66 +422,18 @@ begin
Button[5].Text[0].Text := Ini.NameTeam[1];
Button[10].Text[0].Text := Ini.NameTeam[2];
// Templates for Names Mod end
-
- if (PartySession.Teams.NumTeams>=1) then
- begin
- Button[0].Visible := true;
- Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1);
- Button[2].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=2);
- Button[3].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=3);
- Button[4].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=4);
- end
- else
- begin
- Button[0].Visible := false;
- Button[1].Visible := false;
- Button[2].Visible := false;
- Button[3].Visible := false;
- Button[4].Visible := false;
- end;
- if (PartySession.Teams.NumTeams>=2) then
- begin
- Button[5].Visible := true;
- Button[6].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=1);
- Button[7].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=2);
- Button[8].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=3);
- Button[9].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=4);
- end
- else
- begin
- Button[5].Visible := false;
- Button[6].Visible := false;
- Button[7].Visible := false;
- Button[8].Visible := false;
- Button[9].Visible := false;
- end;
-
- if (PartySession.Teams.NumTeams>=3) then
- begin
- Button[10].Visible := true;
- Button[11].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=1);
- Button[12].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=2);
- Button[13].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=3);
- Button[14].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=4);
- end
- else
- begin
- Button[10].Visible := false;
- Button[11].Visible := false;
- Button[12].Visible := false;
- Button[13].Visible := false;
- Button[14].Visible := false;
- end;
+ Party.Clear;
+ UpdateInterface;
end;
procedure TScreenPartyPlayer.SetAnimationProgress(Progress: real);
var
I: integer;
begin
- for I := 0 to high(Button) do
- Button[I].Texture.ScaleW := Progress;
+ {for I := 0 to high(Button) do
+ Button[I].Texture.ScaleW := Progress; }
end;
end.
diff --git a/src/screens/UScreenPartyRounds.pas b/src/screens/UScreenPartyRounds.pas
new file mode 100644
index 00000000..146b8beb
--- /dev/null
+++ b/src/screens/UScreenPartyRounds.pas
@@ -0,0 +1,237 @@
+{* UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL: https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/branches/experimental/Lua/src/screens/UScreenPartyOptions.pas $
+ * $Id: UScreenPartyOptions.pas 2036 2009-12-14 20:59:44Z whiteshark0 $
+ *}
+
+unit UScreenPartyRounds;
+
+interface
+
+{$IFDEF FPC}
+ {$MODE Delphi}
+{$ENDIF}
+
+{$I switches.inc}
+
+uses
+ UMenu,
+ SDL,
+ UDisplay,
+ UMusic,
+ UFiles,
+ SysUtils,
+ UThemes;
+
+type
+ TScreenPartyRounds = class(TMenu)
+ private
+ SelectRoundCount: cardinal;
+ SelectRound: array [0..6] of cardinal;
+
+ RoundCount: integer;
+ Round: array [0..6] of integer;
+
+ IModeNames: array of UTF8String;
+ IModeIDs: array of integer;
+
+ procedure UpdateInterface;
+ procedure StartParty;
+ public
+ constructor Create; override;
+ function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override;
+ procedure OnShow; override;
+ procedure SetAnimationProgress(Progress: real); override;
+ end;
+
+const
+ IRoundCount: array[0..5] of UTF8String = ('2', '3', '4', '5', '6', '7');
+
+implementation
+
+uses
+ UGraphic,
+ UMain,
+ UIni,
+ UTexture,
+ ULanguage,
+ UParty,
+ USong,
+ UDLLManager,
+ UPlaylist,
+ USongs,
+ UUnicodeUtils;
+
+procedure TScreenPartyRounds.UpdateInterface;
+ var
+ I: integer;
+ ActualRounds: integer;
+begin
+ ActualRounds := RoundCount + 2;
+
+ for I := 0 to High(SelectRound) do
+ SelectsS[SelectRound[I]].Visible := (I < ActualRounds);
+end;
+
+procedure TScreenPartyRounds.StartParty;
+ var
+ GameRounds: ARounds;
+ I: integer;
+begin
+ SetLength(GameRounds, RoundCount + 2);
+
+ for I := 0 to High(GameRounds) do
+ GameRounds[I] := IModeIds[Round[I]];
+
+ // start party game
+ if (Party.StartGame(GameRounds)) then
+ begin
+ FadeTo(@ScreenPartyNewRound, SoundLib.Start);
+ end
+ else
+ begin
+ //error starting party game
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_CAN_NOT_START_PARTY'));
+ end;
+end;
+
+function TScreenPartyRounds.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean;
+var
+ I, J: integer;
+ OnlyMultiPlayer: boolean;
+begin
+ Result := true;
+ if (PressedDown) then
+ begin // Key Down
+ // check normal keys
+ case UCS4UpperCase(CharCode) of
+ Ord('Q'):
+ begin
+ Result := false;
+ Exit;
+ end;
+ end;
+
+ // check special keys
+ case PressedKey of
+ SDLK_ESCAPE,
+ SDLK_BACKSPACE :
+ begin
+ AudioPlayback.PlaySound(SoundLib.Back);
+ FadeTo(@ScreenPartyPlayer);
+ end;
+
+ SDLK_RETURN: StartParty;
+
+ // Up and Down could be done at the same time,
+ // but I don't want to declare variables inside
+ // functions like this one, called so many times
+ SDLK_DOWN: InteractNext;
+ SDLK_UP: InteractPrev;
+ SDLK_RIGHT:
+ begin
+ AudioPlayback.PlaySound(SoundLib.Option);
+ InteractInc;
+
+ if Interaction = 0 then
+ UpdateInterface;
+ end;
+ SDLK_LEFT:
+ begin
+ AudioPlayback.PlaySound(SoundLib.Option);
+ InteractDec;
+
+ if Interaction = 0 then
+ UpdateInterface;
+ end;
+ end;
+ end;
+end;
+
+constructor TScreenPartyRounds.Create;
+ var
+ I: integer;
+begin
+ inherited Create;
+ RoundCount := 5;
+
+ //Load Screen From Theme
+ LoadFromTheme(Theme.PartyRounds);
+
+ Theme.PartyRounds.SelectRoundCount.oneItemOnly := true;
+ Theme.PartyRounds.SelectRoundCount.showArrows := true;
+ SelectRoundCount := AddSelectSlide(Theme.PartyRounds.SelectRoundCount, RoundCount, IRoundCount);
+
+ SetLength(IModeNames, 1);
+ IModeNames[0] := '---';
+ for I := 0 to high(Theme.PartyRounds.SelectRound) do
+ begin
+ Round[I] := 0;
+ Theme.PartyRounds.SelectRound[I].oneItemOnly := true;
+ Theme.PartyRounds.SelectRound[I].showArrows := true;
+ SelectRound[I] := AddSelectSlide(Theme.PartyRounds.SelectRound[I], Round[I], IModeNames);
+ end;
+
+
+ Interaction := 0;
+end;
+
+procedure TScreenPartyRounds.OnShow;
+ var
+ ModeList: AParty_ModeList;
+ I: integer;
+begin
+ inherited;
+
+ // check if there are loaded modes
+ if Party.ModesAvailable then
+ begin
+ UpdateInterface;
+
+ ModeList := Party.GetAvailableModes;
+ SetLength(IModeNames, Length(ModeList));
+ SetLength(IModeIds, Length(ModeList));
+ for I := 0 to High(ModeList) do
+ begin
+ IModeNames[I] := ModeList[I].Name;
+ IModeIds[I] := ModeList[I].Index;
+ end;
+
+ for I := 0 to High(SelectRound) do
+ UpdateSelectSlideOptions(Theme.PartyRounds.SelectRound[I] , SelectRound[I], IModeNames, Round[I]);
+ end
+ else
+ begin
+ // no mode available for current player setup
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_MODES_FOR_CURRENT_SETUP'));
+ Party.Clear;
+ Display.AbortScreenChange;
+ end;
+end;
+
+procedure TScreenPartyRounds.SetAnimationProgress(Progress: real);
+begin
+ {for I := 0 to 6 do
+ SelectS[I].Texture.ScaleW := Progress;}
+end;
+
+end.
diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas
index 2de240b8..e2d4814b 100644
--- a/src/screens/UScreenPartyScore.pas
+++ b/src/screens/UScreenPartyScore.pas
@@ -103,26 +103,22 @@ begin
// check special keys
case PressedKey of
SDLK_ESCAPE,
- SDLK_BACKSPACE :
+ SDLK_BACKSPACE,
+ SDLK_RETURN :
begin
AudioPlayback.PlaySound(SoundLib.Start);
- if (PartySession.CurRound < High(PartySession.Rounds)) then
- FadeTo(@ScreenPartyNewRound)
+
+ Party.NextRound; //< go to next round
+
+ if (not Party.GameFinished) then
+ begin
+ FadeTo(@ScreenPartyNewRound);
+ end
else
begin
- PartySession.EndRound;
FadeTo(@ScreenPartyWin);
end;
end;
-
- SDLK_RETURN:
- begin
- AudioPlayback.PlaySound(SoundLib.Start);
- if (PartySession.CurRound < High(PartySession.Rounds)) then
- FadeTo(@ScreenPartyNewRound)
- else
- FadeTo(@ScreenPartyWin);
- end;
end;
end;
end;
@@ -204,29 +200,18 @@ end;
procedure TScreenPartyScore.OnShow;
var
I, J: integer;
- Placings: array [0..5] of byte;
+ Ranking: AParty_TeamRanking;
begin
inherited;
- //Get Maxscore
+ // indicate that round is finished
+ Party.RoundPlayed;
- MaxScore := 0;
- for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do
- begin
- if (ScreenSingModi.PlayerInfo.Playerinfo[I].Score > MaxScore) then
- MaxScore := ScreenSingModi.PlayerInfo.Playerinfo[I].Score;
- end;
+ // get rankings for current round
+ Ranking := Party.Rounds[Party.CurrentRound].Ranking;
- //Get Placings
- for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do
- begin
- Placings[I] := 0;
- for J := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do
- if (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then
- Inc(Placings[I]);
- end;
- //Set Static Length
+ {//Set Static Length
Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100;
Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100;
Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100;
@@ -234,26 +219,26 @@ begin
//fix: prevents static from drawn out of bounds.
if Static[StaticTeam1].Texture.ScaleW > 99 then Static[StaticTeam1].Texture.ScaleW := 99;
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
- PartySession.EndRound;
+ if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; }
//Set Winnertext
- Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]);
+ Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [Party.GetWinnerString(Party.CurrentRound)]);
- if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then
+ if (Length(Party.Teams) >= 1) then
begin
- Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score);
- Text[TextNameTeam1].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[0].Name);
+ Text[TextScoreTeam1].Text := InttoStr(Party.Teams[0].Score);
+ Text[TextNameTeam1].Text := Utf8String(Party.Teams[0].Name);
//Set Deco Texture
if Theme.PartyScore.DecoTextures.ChangeTextures then
begin
- Static[StaticTeam1Deco].Texture.TexNum := DecoTex[Placings[0]];
- Static[StaticTeam1Deco].Texture.ColR := DecoColor[Placings[0]].R;
- Static[StaticTeam1Deco].Texture.ColG := DecoColor[Placings[0]].G;
- Static[StaticTeam1Deco].Texture.ColB := DecoColor[Placings[0]].B;
+ if (Length(Ranking) >= 1) and (Ranking[0].Rank >= 1) and (Ranking[0].Rank <= Length(DecoTex)) then
+ begin
+ Static[StaticTeam1Deco].Texture.TexNum := DecoTex[Ranking[0].Rank-1];
+ Static[StaticTeam1Deco].Texture.ColR := DecoColor[Ranking[0].Rank-1].R;
+ Static[StaticTeam1Deco].Texture.ColG := DecoColor[Ranking[0].Rank-1].G;
+ Static[StaticTeam1Deco].Texture.ColB := DecoColor[Ranking[0].Rank-1].B;
+ end;
end;
Text[TextScoreTeam1].Visible := true;
@@ -271,18 +256,21 @@ begin
Static[StaticTeam1Deco].Visible := false;
end;
- if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then
+ if (Length(Party.Teams) >= 2) then
begin
- Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score);
- Text[TextNameTeam2].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[1].Name);
+ Text[TextScoreTeam2].Text := InttoStr(Party.Teams[1].Score);
+ Text[TextNameTeam2].Text := UTF8String(Party.Teams[1].Name);
//Set Deco Texture
if Theme.PartyScore.DecoTextures.ChangeTextures then
begin
- Static[StaticTeam2Deco].Texture.TexNum := DecoTex[Placings[1]];
- Static[StaticTeam2Deco].Texture.ColR := DecoColor[Placings[1]].R;
- Static[StaticTeam2Deco].Texture.ColG := DecoColor[Placings[1]].G;
- Static[StaticTeam2Deco].Texture.ColB := DecoColor[Placings[1]].B;
+ if (Length(Ranking) >= 2) and (Ranking[1].Rank >= 1) and (Ranking[1].Rank <= Length(DecoTex)) then
+ begin
+ Static[StaticTeam2Deco].Texture.TexNum := DecoTex[Ranking[1].Rank-1];
+ Static[StaticTeam2Deco].Texture.ColR := DecoColor[Ranking[1].Rank-1].R;
+ Static[StaticTeam2Deco].Texture.ColG := DecoColor[Ranking[1].Rank-1].G;
+ Static[StaticTeam2Deco].Texture.ColB := DecoColor[Ranking[1].Rank-1].B;
+ end;
end;
Text[TextScoreTeam2].Visible := true;
@@ -300,18 +288,21 @@ begin
Static[StaticTeam2Deco].Visible := false;
end;
- if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then
+ if (Length(Party.Teams) >= 3) then
begin
- Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score);
- Text[TextNameTeam3].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[2].Name);
+ Text[TextScoreTeam3].Text := InttoStr(Party.Teams[2].Score);
+ Text[TextNameTeam3].Text := UTF8String(Party.Teams[2].Name);
//Set Deco Texture
if Theme.PartyScore.DecoTextures.ChangeTextures then
begin
- Static[StaticTeam3Deco].Texture.TexNum := DecoTex[Placings[2]];
- Static[StaticTeam3Deco].Texture.ColR := DecoColor[Placings[2]].R;
- Static[StaticTeam3Deco].Texture.ColG := DecoColor[Placings[2]].G;
- Static[StaticTeam3Deco].Texture.ColB := DecoColor[Placings[2]].B;
+ if (Length(Ranking) >= 3) and (Ranking[2].Rank >= 1) and (Ranking[2].Rank <= Length(DecoTex)) then
+ begin
+ Static[StaticTeam3Deco].Texture.TexNum := DecoTex[Ranking[2].Rank-1];
+ Static[StaticTeam3Deco].Texture.ColR := DecoColor[Ranking[2].Rank-1].R;
+ Static[StaticTeam3Deco].Texture.ColG := DecoColor[Ranking[2].Rank-1].G;
+ Static[StaticTeam3Deco].Texture.ColB := DecoColor[Ranking[2].Rank-1].B;
+ end;
end;
Text[TextScoreTeam3].Visible := true;
@@ -332,12 +323,12 @@ end;
procedure TScreenPartyScore.SetAnimationProgress(Progress: real);
begin
- if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then
+ {if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then
Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100;
if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then
Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100;
if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then
- Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100;
+ Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100;}
end;
end.
diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas
index afa5ce83..18a6e69e 100644
--- a/src/screens/UScreenPartyWin.pas
+++ b/src/screens/UScreenPartyWin.pas
@@ -94,13 +94,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);
@@ -139,10 +134,10 @@ end;
procedure TScreenPartyWin.OnShow;
var
- I: integer;
- Placing: TeamOrderArray;
+ I, J: integer;
+ Ranking: AParty_TeamRanking;
- Function GetTeamColor(Team: byte): cardinal;
+ Function GetTeamColor(Team: integer): cardinal;
var
NameString: string;
begin
@@ -154,15 +149,16 @@ var
begin
inherited;
- //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;
@@ -173,7 +169,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;
@@ -184,7 +180,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;
@@ -202,10 +198,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;
@@ -216,7 +212,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;
@@ -227,7 +223,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;
@@ -245,10 +241,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;
@@ -259,7 +255,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;
@@ -270,7 +266,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;
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas
index 20f3b15e..18496517 100644
--- a/src/screens/UScreenSing.pas
+++ b/src/screens/UScreenSing.pas
@@ -50,7 +50,8 @@ uses
UTexture,
UThemes,
UPath,
- UTime;
+ UTime,
+ UHookableEvent;
type
TLyricsSyncSource = class(TSyncSource)
@@ -61,7 +62,9 @@ type
TScreenSing = class(TMenu)
protected
VideoLoaded: boolean;
- Paused: boolean; // pause mod
+ eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow
+ protected
+ Paused: boolean; //pause Mod
LyricsSync: TLyricsSyncSource;
NumEmptySentences: integer;
public
@@ -104,6 +107,19 @@ type
fShowVisualization: boolean;
fCurrentVideoPlaybackEngine: IVideoPlayback;
+ // some settings to be set by plugins
+ settings: record
+ Finish: Boolean; //< if true, screen will finish on next draw
+
+ LyricsVisible: Boolean; //< shows or hides lyrics
+ NotesVisible: Integer; //< if bit[playernum] is set the notes for the specified player are visible. By default all players notes are visible
+
+ PlayerEnabled: Integer; //< defines whether a player can score atm
+ end;
+ procedure ClearSettings;
+ procedure ApplySettings; //< applies changes of settings record
+ procedure EndSong;
+
constructor Create; override;
procedure OnShow; override;
procedure OnShowFinish; override;
@@ -132,6 +148,7 @@ uses
URecord,
USong,
UDisplay,
+ UParty,
UUnicodeUtils;
// method for input parsing. if false is returned, getnextwindow
@@ -312,6 +329,10 @@ begin
Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH);
LyricsSync := TLyricsSyncSource.Create();
+
+ eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded');
+
+ ClearSettings;
end;
procedure TScreenSing.OnShow;
@@ -334,8 +355,10 @@ begin
//the song was sung to the end
SungToEnd := false;
+ ClearSettings;
+ Party.CallBeforeSing;
- // reset video playback engine, to play video clip ...
+ // reset video playback engine, to play Video Clip...
fCurrentVideoPlaybackEngine := VideoPlayback;
// setup score manager
@@ -443,8 +466,8 @@ begin
if (not success) then
begin
- // error loading song -> go back to song screen and show some error message
- FadeTo(@ScreenSong);
+ // error loading song -> go back to previous screen and show some error message
+ Display.AbortScreenChange;
// select new song in party mode
if ScreenSong.Mode = smPartyMode then
ScreenSong.SelectRandomSong();
@@ -635,6 +658,8 @@ begin
if Lines[0].Line[Index].TotalNotes = 0 then
Inc(NumEmptySentences);
+ eSongLoaded.CallHookChain(False);
+
Log.LogStatus('End', 'OnShow');
end;
@@ -653,6 +678,25 @@ begin
CountSkipTimeSet;
end;
+procedure TScreenSing.ClearSettings;
+begin
+ Settings.Finish := False;
+ Settings.LyricsVisible := True;
+ Settings.NotesVisible := high(Integer);
+ Settings.PlayerEnabled := high(Integer);
+end;
+
+{ applies changes of settings record }
+procedure TScreenSing.ApplySettings;
+begin
+ //
+end;
+
+procedure TScreenSing.EndSong;
+begin
+ Settings.Finish := True;
+end;
+
procedure TScreenSing.OnHide;
begin
// background texture
@@ -790,11 +834,14 @@ begin
if ShowFinish then
begin
if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or
- (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) then
+ (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and (not Settings.Finish) then
begin
// analyze song if not paused
if (not Paused) then
+ begin
Sing(Self);
+ Party.CallOnSing;
+ end;
end
else
begin
@@ -802,7 +849,6 @@ begin
begin
Finish;
FadeOut := true;
- FadeTo(@ScreenScore);
end;
end;
end;
@@ -879,6 +925,8 @@ begin
end;
SetFontItalic(false);
+
+ Party.CallAfterSing;
end;
procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal);
diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas
index a2760ae3..5bc42a68 100644
--- a/src/screens/UScreenSong.pas
+++ b/src/screens/UScreenSong.pas
@@ -145,7 +145,7 @@ type
//procedures for Menu
procedure StartSong;
procedure OpenEditor;
- procedure DoJoker(Team: byte);
+ procedure DoJoker(Team: integer);
procedure SelectPlayers;
procedure UnloadDetailedCover;
@@ -602,7 +602,7 @@ begin
if (Ini.PartyPopup = 1) then
ScreenSongMenu.MenuShow(SM_Party_Main)
else
- ScreenSong.StartSong;
+ Party.CallAfterSongSelect;
end;
end;
end;
@@ -717,35 +717,17 @@ begin
SDLK_1:
begin //Joker
- if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then
- begin
- //Use Joker
- Dec(PartySession.Teams.Teaminfo[0].Joker);
- SelectRandomSong;
- SetJoker;
- end;
+ DoJoker(0);
end;
SDLK_2:
begin //Joker
- if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then
- begin
- //Use Joker
- Dec(PartySession.Teams.Teaminfo[1].Joker);
- SelectRandomSong;
- SetJoker;
- end;
+ DoJoker(1);
end;
SDLK_3:
begin //Joker
- if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then
- begin
- //Use Joker
- Dec(PartySession.Teams.Teaminfo[2].Joker);
- SelectRandomSong;
- SetJoker;
- end;
+ DoJoker(2);
end;
end;
end; // if (PressedDown)
@@ -1555,8 +1537,8 @@ begin
AudioPlayback.SetVolume(1.0);
// if hide then stop music (for party mode popup on exit)
- if (Display.NextScreen <> @ScreenSing) and
- (Display.NextScreen <> @ScreenSingModi) then
+ if (Display.NextScreen <> @ScreenSing) {and
+ (Display.NextScreen <> @ScreenSingModi) }then
begin
StopMusicPreview();
end;
@@ -1883,13 +1865,13 @@ begin
// If Party Mode
if Mode = smPartyMode then //Show Joker that are available
begin
- if (PartySession.Teams.NumTeams >= 1) then
+ if (Length(Party.Teams) >= 1) then
begin
- Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1);
- Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2);
- Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3);
- Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4);
- Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5);
+ Static[StaticTeam1Joker1].Visible := (Party.Teams[0].JokersLeft >= 1);
+ Static[StaticTeam1Joker2].Visible := (Party.Teams[0].JokersLeft >= 2);
+ Static[StaticTeam1Joker3].Visible := (Party.Teams[0].JokersLeft >= 3);
+ Static[StaticTeam1Joker4].Visible := (Party.Teams[0].JokersLeft >= 4);
+ Static[StaticTeam1Joker5].Visible := (Party.Teams[0].JokersLeft >= 5);
end
else
begin
@@ -1900,13 +1882,13 @@ begin
Static[StaticTeam1Joker5].Visible := false;
end;
- if (PartySession.Teams.NumTeams >= 2) then
+ if (Length(Party.Teams) >= 2) then
begin
- Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1);
- Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2);
- Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3);
- Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4);
- Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5);
+ Static[StaticTeam2Joker1].Visible := (Party.Teams[1].JokersLeft >= 1);
+ Static[StaticTeam2Joker2].Visible := (Party.Teams[1].JokersLeft >= 2);
+ Static[StaticTeam2Joker3].Visible := (Party.Teams[1].JokersLeft >= 3);
+ Static[StaticTeam2Joker4].Visible := (Party.Teams[1].JokersLeft >= 4);
+ Static[StaticTeam2Joker5].Visible := (Party.Teams[1].JokersLeft >= 5);
end
else
begin
@@ -1917,13 +1899,13 @@ begin
Static[StaticTeam2Joker5].Visible := false;
end;
- if (PartySession.Teams.NumTeams >= 3) then
+ if (Length(Party.Teams) >= 3) then
begin
- Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1);
- Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2);
- Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3);
- Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4);
- Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5);
+ Static[StaticTeam3Joker1].Visible := (Party.Teams[2].JokersLeft >= 1);
+ Static[StaticTeam3Joker2].Visible := (Party.Teams[2].JokersLeft >= 2);
+ Static[StaticTeam3Joker3].Visible := (Party.Teams[2].JokersLeft >= 3);
+ Static[StaticTeam3Joker4].Visible := (Party.Teams[2].JokersLeft >= 4);
+ Static[StaticTeam3Joker5].Visible := (Party.Teams[2].JokersLeft >= 5);
end
else
begin
@@ -1990,7 +1972,7 @@ begin
//Party Mode
if (Mode = smPartyMode) then
begin
- FadeTo(@ScreenSingModi);
+ FadeTo(@ScreenSing);
end
else
begin
@@ -2021,14 +2003,14 @@ begin
end;
//Team No of Team (0-5)
-procedure TScreenSong.DoJoker (Team: byte);
+procedure TScreenSong.DoJoker (Team: integer);
begin
if (Mode = smPartyMode) and
- (PartySession.Teams.NumTeams >= Team + 1) and
- (PartySession.Teams.Teaminfo[Team].Joker > 0) then
+ (High(Party.Teams) >= Team) and
+ (Party.Teams[Team].JokersLeft > 0) then
begin
//Use Joker
- Dec(PartySession.Teams.Teaminfo[Team].Joker);
+ Dec(Party.Teams[Team].JokersLeft);
SelectRandomSong;
SetJoker;
end;
diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas
index ec893c7a..173ac2c8 100644
--- a/src/screens/UScreenSongMenu.pas
+++ b/src/screens/UScreenSongMenu.pas
@@ -401,16 +401,19 @@ begin
begin
CurMenu := sMenu;
Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER');
-
- Button[0].Visible := (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0);
- Button[1].Visible := (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0);
- Button[2].Visible := (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0);
- Button[3].Visible := true;
- SelectsS[0].Visible := false;
-
- Button[0].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[0].Name);
- Button[1].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[1].Name);
- Button[2].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[2].Name);
+ // to-do : Party
+ Button[0].Visible := (Length(Party.Teams) >= 1) AND (Party.Teams[0].JokersLeft > 0);
+ Button[1].Visible := (Length(Party.Teams) >= 2) AND (Party.Teams[1].JokersLeft > 0);
+ Button[2].Visible := (Length(Party.Teams) >= 3) AND (Party.Teams[2].JokersLeft > 0);
+ Button[3].Visible := True;
+ SelectsS[0].Visible := False;
+
+ if (Button[0].Visible) then
+ Button[0].Text[0].Text := UTF8String(Party.Teams[0].Name);
+ if (Button[1].Visible) then
+ Button[1].Text[0].Text := UTF8String(Party.Teams[1].Name);
+ if (Button[2].Visible) then
+ Button[2].Text[0].Text := UTF8String(Party.Teams[2].Name);
Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL');
// set right interaction
@@ -614,7 +617,7 @@ begin
0: // button 1
begin
// start singing
- ScreenSong.StartSong;
+ Party.CallAfterSongSelect;
Visible := false;
end;