From 0af8fe6180f31951badfd19f0bb7a2adece85ba4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 15 Dec 2009 18:24:48 +0000 Subject: - added ScreenPartyRounds (a screen to select the modes to play) - added missing language entries to German and English language file - themed ScreenPartyOptions - some minor theme changes concerning party screens - some minor code changes concerning party screens git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2039 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Lua/game/languages/English.ini | 48 ++++-- Lua/game/languages/German.ini | 47 ++++-- Lua/game/themes/Deluxe.ini | 279 ++++++++++++++++++++++++++++++- Lua/src/base/UGraphic.pas | 5 + Lua/src/base/UParty.pas | 97 ++++++++--- Lua/src/base/UThemes.pas | 17 +- Lua/src/screens/UScreenPartyNewRound.pas | 4 +- Lua/src/screens/UScreenPartyOptions.pas | 52 ++---- Lua/src/screens/UScreenPartyPlayer.pas | 24 +-- Lua/src/screens/UScreenPartyRounds.pas | 237 ++++++++++++++++++++++++++ Lua/src/ultrastardx.dpr | 1 + 11 files changed, 693 insertions(+), 118 deletions(-) create mode 100644 Lua/src/screens/UScreenPartyRounds.pas diff --git a/Lua/game/languages/English.ini b/Lua/game/languages/English.ini index 243415fb..fb0083a3 100644 --- a/Lua/game/languages/English.ini +++ b/Lua/game/languages/English.ini @@ -298,11 +298,10 @@ PARTY_PLAYLIST=Playlist Mode PARTY_PLAYLIST_ALL=All songs PARTY_PLAYLIST_CATEGORY=Folder PARTY_PLAYLIST_PLAYLIST=Playlist -PARTY_ROUNDS=Rounds -PARTY_TEAMS=Teams -PARTY_TEAMS_PLAYER1=Player Team1 -PARTY_TEAMS_PLAYER2=Player Team2 -PARTY_TEAMS_PLAYER3=Player Team3 +PARTY_TEAMS=number of teams +PARTY_TEAMS_PLAYER1=num. of singers +PARTY_TEAMS_PLAYER2=num. of singers +PARTY_TEAMS_PLAYER3=num. of singers PARTY_LEGEND_CONTINUE=continue @@ -312,7 +311,19 @@ PARTY_OPTIONS_WHEREAMI=Party Options PARTY_PLAYER_DESC=enter player- and teamnames! PARTY_PLAYER_WHEREAMI=Party Names PARTY_PLAYER_ENTER_NAME=enter names -PARTY_PLAYER_LEGEND_CONTINUE=start party-game + + +PARTY_ROUNDS_DESC = select which modes you want to play +PARTY_ROUNDS_WHEREAMI=Party Rounds +PARTY_ROUNDS_LEGEND_CONTINUE=start party-game +PARTY_ROUNDCOUNT=number of rounds +PARTY_SELECTMODE1=mode round 1 +PARTY_SELECTMODE2=mode round 2 +PARTY_SELECTMODE3=mode round 3 +PARTY_SELECTMODE4=mode round 4 +PARTY_SELECTMODE5=mode round 5 +PARTY_SELECTMODE6=mode round 6 +PARTY_SELECTMODE7=mode round 7 PARTY_ROUND_DESC=next players to the mics PARTY_ROUND_WHEREAMI=Party Next Round @@ -339,20 +350,23 @@ PARTY_DISMISSED=Dismissed! PARTY_SCORE_WINS=%s PARTY_SCORE_WINS2=wins! -PLUGIN_HDL_NAME=Hold the Line -PLUGIN_HDL_DESC=Don't get worse than the pointer at the rating bar shows you. +MODE_RANDOM_NAME=Random Mode +MODE_RANDOM_DESC=One mode will be choosen randomly + +MODE_HDL_NAME=Hold the Line +MODE_HDL_DESC=Don't get worse than the pointer at the rating bar shows you. -PLUGIN_UNTIL5000_NAME=Until 5000 -PLUGIN_UNTIL5000_DESC=Who gets 5000 points first wins the match. +MODE_5000POINTS_NAME=Until 5000 +MODE_5000POINTS_DESC=Who gets 5000 points first wins the match. -PLUGIN_DUELL_NAME=Duel -PLUGIN_DUELL_DESC=Sing a duel until 10000 points. +MODE_DUEL_NAME=Duel +MODE_DUEL_DESC=Sing a duel until 10000 points. -PLUGIN_TEAMDUELL_NAME=Team Duell -PLUGIN_TEAMDUELL_DESC=Pass The Mic! +MODE_TEAMDUEL_NAME=Team Duell +MODE_TEAMDUEL_DESC=Pass The Mic! -PLUGIN_BLIND_NAME=Blind Mode -PLUGIN_BLIND_DESC=Duel without seeing the notes. +MODE_BLIND_NAME=Blind Mode +MODE_BLIND_DESC=Duel without seeing the notes. STAT_MAIN=Statistics STAT_MAIN_DESC=General @@ -406,6 +420,8 @@ MSG_END_PARTY=Really leave Party Mode? ERROR_NO_SONGS=No Songs loaded ERROR_NO_PLUGINS=No Plugins loaded +ERROR_NO_MODES_FOR_CURRENT_SETUP=no modes available for current player/team setup +ERROR_CAN_NOT_START_PARTY= an error occurred starting the party game ERROR_CORRUPT_SONG=Song could not be loaded. ERROR_CORRUPT_SONG_FILE_NOT_FOUND=Song could not be loaded: File not found ERROR_CORRUPT_SONG_NO_NOTES=Song could not be loaded: Can''t find any notes diff --git a/Lua/game/languages/German.ini b/Lua/game/languages/German.ini index 4aae568f..ca19a377 100644 --- a/Lua/game/languages/German.ini +++ b/Lua/game/languages/German.ini @@ -298,11 +298,10 @@ PARTY_PLAYLIST=Playlist-Modus PARTY_PLAYLIST_ALL=Alle Lieder PARTY_PLAYLIST_CATEGORY=Ordner PARTY_PLAYLIST_PLAYLIST=Playlist -PARTY_ROUNDS=Runden -PARTY_TEAMS=Teams -PARTY_TEAMS_PLAYER1=Spieler Team 1 -PARTY_TEAMS_PLAYER2=Spieler Team 2 -PARTY_TEAMS_PLAYER3=Spieler Team 3 +PARTY_TEAMS=Anzahl der Teams +PARTY_TEAMS_PLAYER1=Spieleranzahl +PARTY_TEAMS_PLAYER2=Spieleranzahl +PARTY_TEAMS_PLAYER3=Spieleranzahl PARTY_LEGEND_CONTINUE=weiter @@ -312,7 +311,18 @@ PARTY_OPTIONS_WHEREAMI=Party Optionen PARTY_PLAYER_DESC=Team- und Spielernamen eingeben. PARTY_PLAYER_WHEREAMI=Party Spielernamen PARTY_PLAYER_ENTER_NAME=Namen eingeben -PARTY_PLAYER_LEGEND_CONTINUE=Partyspiel starten + +PARTY_ROUNDS_DESC = Wähle welche Modi du spielen möchtest +PARTY_ROUNDS_WHEREAMI=Party Runden +PARTY_ROUNDS_LEGEND_CONTINUE=Partyspiel starten +PARTY_ROUNDCOUNT=Anzahl der Runden +PARTY_SELECTMODE1=Modus Runde 1 +PARTY_SELECTMODE2=Modus Runde 2 +PARTY_SELECTMODE3=Modus Runde 3 +PARTY_SELECTMODE4=Modus Runde 4 +PARTY_SELECTMODE5=Modus Runde 5 +PARTY_SELECTMODE6=Modus Runde 6 +PARTY_SELECTMODE7=Modus Runde 7 PARTY_ROUND_DESC=Die nächsten Spieler an die Mikros! PARTY_ROUND_WHEREAMI=Party nächste Runde @@ -339,20 +349,23 @@ PARTY_DISMISSED=Ausgeschieden! PARTY_SCORE_WINS=%s PARTY_SCORE_WINS2=hat gewonnen! -PLUGIN_HDL_NAME=Balken halten -PLUGIN_HDL_DESC=Halte die Bewertungsanzeige im angezeigten Bereich. +MODE_RANDOM_NAME = zufälliger Modus +MODE_RANDOM_DESC = Wählt einen zufälligen Modus aus + +MODE_HDL_NAME=Balken halten +MODE_HDL_DESC=Halte die Bewertungsanzeige im angezeigten Bereich. -PLUGIN_UNTIL5000_NAME=Bis 5000 -PLUGIN_UNTIL5000_DESC=Wer zuerst 5000 Punkte hat, gewinnt. +MODE_5000POINTS_NAME=Bis 5000 +MODE_5000POINTS_DESC=Wer zuerst 5000 Punkte hat, gewinnt. -PLUGIN_DUELL_NAME=Duell -PLUGIN_DUELL_DESC=Normales Spiel. Höchste Punktzahl gewinnt. +MODE_DUELL_NAME=Duell +MODE_DUELL_DESC=Normales Spiel. Höchste Punktzahl gewinnt. -PLUGIN_TEAMDUELL_NAME=Teamsingen -PLUGIN_TEAMDUELL_DESC=Gib das Mikro weiter! +MODE_TEAMDUELL_NAME=Teamsingen +MODE_TEAMDUELL_DESC=Gib das Mikro weiter! -PLUGIN_BLIND_NAME=Blind Modus -PLUGIN_BLIND_DESC=Erreiche blind die höchste Punktzahl. +MODE_BLIND_NAME=Blind Modus +MODE_BLIND_DESC=Erreiche blind die höchste Punktzahl. STAT_MAIN=Statistiken STAT_MAIN_DESC=Allgemein @@ -406,6 +419,8 @@ MSG_END_PARTY=Party-Modus wirklich beenden? ERROR_NO_SONGS=Keine Songs vorhanden. ERROR_NO_PLUGINS=Keine Plugins vorhanden. +ERROR_NO_MODES_FOR_CURRENT_SETUP=Es sind keine Modi für die akutellen Spieler und/oder Teameinstellungen vorhanden +ERROR_CAN_NOT_START_PARTY= Ein Fehler ist beim Starten des Partyspiels aufgetreten ERROR_CORRUPT_SONG=Song konnte nicht geladen werden. ERROR_CORRUPT_SONG_FILE_NOT_FOUND=Song konnte nicht geladen werden: Datei wurde nicht gefunden. ERROR_CORRUPT_SONG_NO_NOTES=Song konnte nicht geladen werden: Es wurden keine Noten gefunden. diff --git a/Lua/game/themes/Deluxe.ini b/Lua/game/themes/Deluxe.ini index 37794d6f..2cf29024 100644 --- a/Lua/game/themes/Deluxe.ini +++ b/Lua/game/themes/Deluxe.ini @@ -6689,7 +6689,7 @@ Tex = MainBar TexSBG = SelectBG Text = PARTY_DIFFICULTY X = 70 -Y = 85 +Y = 100 W = 230 H = 40 SkipX = 10 @@ -6715,7 +6715,7 @@ Tex = MainBar TexSBG = SelectBG Text = PARTY_PLAYLIST X = 70 -Y = 140 +Y = 155 W = 230 H = 40 SkipX = 10 @@ -6736,7 +6736,7 @@ Tex = MainBar TexSBG = SelectBG Text = PARTY_PLAYLIST X = 70 -Y = 195 +Y = 210 W = 230 H = 40 SkipX = 10 @@ -6898,7 +6898,7 @@ Color = Black Font = 0 Size = 21 Align = 0 -Text = PARTY_PLAYER_LEGEND_CONTINUE +Text = SING_LEGEND_CONTINUE [PartyPlayerSelectTeams] Tex = MainBar @@ -7316,6 +7316,277 @@ Align = 1 Text = Player 12 Color = White + + +[PartyRoundsBackground] +Tex = PartyBG + +[PartyRoundsStatic1] +X = 0 +Y = 545 +W = 250 +H = 30 +Tex = Leiste1 +Color = ColorLight +Type = Colorized +Reflection = 1 +ReflectionSpacing = 2 + +[PartyRoundsStatic2] +X = 250 +Y = 545 +W = 550 +H = 30 +Tex = Leiste2 +Color = White +Type = Transparent +Reflection = 1 +ReflectionSpacing = 2 + +[PartyRoundsStatic3] +X = 40 +Y = 22 +W = 27 +H = 27 +Color = White +Tex = PartyIcon +Type = Colorized + +[PartyRoundsStatic4] +X = 260 +Y = 552 +W = 24 +H = 23 +Tex = ButtonNavi +Color = White +Type = Transparent + +[PartyRoundsStatic5] +X = 388 +Y = 552 +W = 24 +H = 23 +Tex = ButtonEnter +Color = White +Type = Transparent + +[PartyRoundsText1] +X = 70 +Y = 6 +ColR = 0.7 +ColG = 0.7 +ColB = 0.7 +Font = 0 +Size = 60 +Color = White +Text = PARTY_MODE + +[PartyRoundsText2] +X = 70 +Y = 53 +Color = White +Font = 0 +Size = 30 +Align = 0 +Text = PARTY_ROUNDS_DESC + +[PartyRoundsText3] +X = 238 +Y = 552 +Color = Black +Font = 0 +Size = 21 +Align = 2 +Text = PARTY_ROUNDS_WHEREAMI + +[PartyRoundsText4] +X = 294 +Y = 552 +Color = Black +Font = 0 +Size = 21 +Align = 0 +Text = SING_LEGEND_NAVIGATE + +[PartyRoundsText5] +X = 418 +Y = 552 +Color = Black +Font = 0 +Size = 21 +Align = 0 +Text = PARTY_ROUNDS_LEGEND_CONTINUE + +[PartyRoundsSelectRoundCount] +Tex = MainBar +TexSBG = SelectBG +Text = PARTY_ROUNDCOUNT +X = 70 +Y = 100 +W = 230 +H = 40 +SkipX = 10 +Fields = 7 + +Color = ColorDark +DColor = ColorLight +TColor = White +TDColor = White + +SBGColor = DarkBlue +SBGDColor = LightBlue +STColor = White +STDColor = GrayDark + +[PartyRoundsSelectRound1] +Tex = MainBar +TexSBG = SelectBG +Text = PARTY_SELECTMODE1 +X = 70 +Y = 155 +W = 230 +H = 40 +SkipX = 10 +Fields = 7 + +Color = ColorDark +DColor = ColorLight +TColor = White +TDColor = White + +SBGColor = DarkBlue +SBGDColor = LightBlue +STColor = White +STDColor = GrayDark + +[PartyRoundsSelectRound2] +Tex = MainBar +TexSBG = SelectBG +Text = PARTY_SELECTMODE2 +X = 70 +Y = 210 +W = 230 +H = 40 +SkipX = 10 +Fields = 7 + +Color = ColorDark +DColor = ColorLight +TColor = White +TDColor = White + +SBGColor = DarkBlue +SBGDColor = LightBlue +STColor = White +STDColor = GrayDark + +[PartyRoundsSelectRound3] +Tex = MainBar +TexSBG = SelectBG +Text = PARTY_SELECTMODE3 +X = 70 +Y = 265 +W = 230 +H = 40 +SkipX = 10 +Fields = 7 + +Color = ColorDark +DColor = ColorLight +TColor = White +TDColor = White + +SBGColor = DarkBlue +SBGDColor = LightBlue +STColor = White +STDColor = GrayDark + +[PartyRoundsSelectRound4] +Tex = MainBar +TexSBG = SelectBG +Text = PARTY_SELECTMODE4 +X = 70 +Y = 320 +W = 230 +H = 40 +SkipX = 10 +Fields = 7 + +Color = ColorDark +DColor = ColorLight +TColor = White +TDColor = White + +SBGColor = DarkBlue +SBGDColor = LightBlue +STColor = White +STDColor = GrayDark + +[PartyRoundsSelectRound5] +Tex = MainBar +TexSBG = SelectBG +Text = PARTY_SELECTMODE5 +X = 70 +Y = 375 +W = 230 +H = 40 +SkipX = 10 +Fields = 7 + +Color = ColorDark +DColor = ColorLight +TColor = White +TDColor = White + +SBGColor = DarkBlue +SBGDColor = LightBlue +STColor = White +STDColor = GrayDark + +[PartyRoundsSelectRound6] +Tex = MainBar +TexSBG = SelectBG +Text = PARTY_SELECTMODE6 +X = 70 +Y = 430 +W = 230 +H = 40 +SkipX = 10 +Fields = 7 + +Color = ColorDark +DColor = ColorLight +TColor = White +TDColor = White + +SBGColor = DarkBlue +SBGDColor = LightBlue +STColor = White +STDColor = GrayDark + +[PartyRoundsSelectRound7] +Tex = MainBar +TexSBG = SelectBG +Text = PARTY_SELECTMODE7 +X = 70 +Y = 485 +W = 230 +H = 40 +SkipX = 10 +Fields = 7 + +Color = ColorDark +DColor = ColorLight +TColor = White +TDColor = White + +SBGColor = DarkBlue +SBGDColor = LightBlue +STColor = White +STDColor = GrayDark + + + [SongMenu] [SongMenuBackground] diff --git a/Lua/src/base/UGraphic.pas b/Lua/src/base/UGraphic.pas index a1f63366..f658c800 100644 --- a/Lua/src/base/UGraphic.pas +++ b/Lua/src/base/UGraphic.pas @@ -77,6 +77,7 @@ uses UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer, + UScreenPartyRounds, {Stats Screens} UScreenStatMain, UScreenStatDetail, @@ -139,6 +140,7 @@ var ScreenPartyWin: TScreenPartyWin; ScreenPartyOptions: TScreenPartyOptions; ScreenPartyPlayer: TScreenPartyPlayer; + ScreenPartyRounds: TScreenPartyRounds; //StatsScreens ScreenStatMain: TScreenStatMain; @@ -769,6 +771,8 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyOptions', 3); Log.BenchmarkStart(3); ScreenPartyPlayer := TScreenPartyPlayer.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyPlayer', 3); Log.BenchmarkStart(3); + ScreenPartyRounds := TScreenPartyRounds.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyRounds', 3); Log.BenchmarkStart(3); ScreenStatMain := TScreenStatMain.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Stat Main', 3); Log.BenchmarkStart(3); ScreenStatDetail := TScreenStatDetail.Create; @@ -816,6 +820,7 @@ begin ScreenPartyWin.Destroy; ScreenPartyOptions.Destroy; ScreenPartyPlayer.Destroy; + ScreenPartyRounds.Destroy; ScreenStatMain.Destroy; ScreenStatDetail.Destroy; end; diff --git a/Lua/src/base/UParty.pas b/Lua/src/base/UParty.pas index e4060e95..94580241 100644 --- a/Lua/src/base/UParty.pas +++ b/Lua/src/base/UParty.pas @@ -48,7 +48,13 @@ type Team: Integer; //< id of team Rank: Integer; //< 1 to Length(Teams) e.g. 1 is for placed first end; - AParty_TeamRanking = Array of TParty_TeamRanking; //< returned by TPartyGame.GetTeamRanking + AParty_TeamRanking = array of TParty_TeamRanking; //< returned by TPartyGame.GetTeamRanking + + TParty_RoundList = record + Index: integer; + Name: UTF8String; + end; + AParty_ModeList = array of TParty_RoundList; { record used by TPartyGame to store round specific data } TParty_Round = record @@ -113,6 +119,9 @@ type function GetRandomMode: integer; function GetRandomPlayer(Team: integer): integer; + { returns true if a mode is playable with current playerconfig } + function ModePlayable(I: integer): boolean; + function CallLua(Parent: Integer; Func: String):Boolean; procedure SetRankingByScore; @@ -140,6 +149,10 @@ type if there are any party modes available } function ModesAvailable: Boolean; + { returns an array with the name of all available modes (that + are playable with current player configuration } + function GetAvailableModes: AParty_ModeList; + { clears all party specific data previously stored } procedure Clear; @@ -289,14 +302,17 @@ begin // search for the plugins less played yet for I := 0 to high(Modes) do begin - if (TimesPlayed[I] < lowestTP) then - begin - lowestTP := TimesPlayed[I]; - NumPwithLTP := 1; - end - else if (TimesPlayed[I] = lowestTP) then + if (ModePlayable(I)) then begin - Inc(NumPwithLTP); + if (TimesPlayed[I] < lowestTP) then + begin + lowestTP := TimesPlayed[I]; + NumPwithLTP := 1; + end + else if (TimesPlayed[I] = lowestTP) then + begin + Inc(NumPwithLTP); + end; end; end; @@ -306,7 +322,7 @@ begin // select the random mode from the modes with less timesplayed for I := 0 to high(Modes) do begin - if (TimesPlayed[I] = lowestTP) { and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) }then + if (TimesPlayed[I] = lowestTP) and (ModePlayable(I)) then begin //Plugin found if (R = 0) then @@ -436,14 +452,35 @@ begin end; end; +{ returns true if a mode is playable with current playerconfig } +function TPartyGame.ModePlayable(I: integer): boolean; + var + J: integer; +begin + if (Length(Teams) = 0) then + Result := true + else + begin + if (Modes[I].TeamCount and (1 shl (Length(Teams) - 1)) <> 0) then + begin + Result := true; + + for J := 0 to High(Teams) do + Result := Result and (Modes[I].PlayerCount and (1 shl (Length(Teams[J].Players) - 1)) <> 0); + end + else + Result := false; + end; +end; + { returns true if modes are available for players and teams that are currently set up. if there are no teams set up it returns if there are any party modes available } function TPartyGame.ModesAvailable: Boolean; var - I, J: Integer; - CountTeams: Integer; + I: integer; + CountTeams: integer; begin CountTeams := Length(Teams); if CountTeams = 0 then @@ -452,19 +489,37 @@ begin end else begin - Result := False; + Result := false; for I := 0 to High(Modes) do - if (Modes[I].TeamCount and (1 shl (CountTeams - 1)) <> 0) then - begin - Result := True; - - for J := 0 to High(Teams) do - Result := Result and (Modes[I].PlayerCount and (1 shl (Length(Teams[J].Players) - 1)) <> 0); + begin + Result := ModePlayable(I); - if Result then - Exit; - end; + if Result then + Exit; + end; end; +end; + +{ returns an array with the name of all available modes (that + are playable with current player configuration } +function TPartyGame.GetAvailableModes: AParty_ModeList; + var + I: integer; + Len: integer; +begin + Len := 0; + SetLength(Result, Len + 1); + Result[Len].Index := Party_Round_Random; + Result[Len].Name := Language.Translate('MODE_RANDOM_NAME'); + + for I := 0 to High(Modes) do + if (ModePlayable(I)) then + begin + Inc(Len); + SetLength(Result, Len + 1); + Result[Len].Index := I; + Result[Len].Name := Language.Translate('MODE_' + Uppercase(Modes[I].Name) + '_NAME'); + end; end; { adds a team to the team array, returning its id diff --git a/Lua/src/base/UThemes.pas b/Lua/src/base/UThemes.pas index 5cf257a8..2ecaa9f4 100644 --- a/Lua/src/base/UThemes.pas +++ b/Lua/src/base/UThemes.pas @@ -648,7 +648,6 @@ type SelectLevel: TThemeSelectSlide; SelectPlayList: TThemeSelectSlide; SelectPlayList2: TThemeSelectSlide; - SelectRounds: TThemeSelectSlide; {ButtonNext: TThemeButton; ButtonPrev: TThemeButton;} @@ -682,6 +681,11 @@ type ButtonPrev: TThemeButton;} end; + TThemePartyRounds = class(TThemeBasic) + SelectRoundCount: TThemeSelectSlide; + SelectRound: array [0..6] of TThemeSelectSlide; + end; + //Stats Screens TThemeStatMain = class(TThemeBasic) ButtonScores: TThemeButton; @@ -757,6 +761,7 @@ type PartyWin: TThemePartyWin; PartyOptions: TThemePartyOptions; PartyPlayer: TThemePartyPlayer; + PartyRounds: TThemePartyRounds; //Stats Screens: StatMain: TThemeStatMain; @@ -887,6 +892,7 @@ begin PartyScore := TThemePartyScore.Create; PartyOptions := TThemePartyOptions.Create; PartyPlayer := TThemePartyPlayer.Create; + PartyRounds := TThemePartyRounds.Create; //Stats Screens: StatMain := TThemeStatMain.Create; @@ -1436,8 +1442,6 @@ begin ThemeLoadSelectSlide(PartyOptions.SelectLevel, 'PartyOptionsSelectLevel'); ThemeLoadSelectSlide(PartyOptions.SelectPlayList, 'PartyOptionsSelectPlayList'); ThemeLoadSelectSlide(PartyOptions.SelectPlayList2, 'PartyOptionsSelectPlayList2'); - ThemeLoadSelectSlide(PartyOptions.SelectRounds, 'PartyOptionsSelectRounds'); - {ThemeLoadButton (ButtonNext, 'ButtonNext'); ThemeLoadButton (ButtonPrev, 'ButtonPrev');} @@ -1467,6 +1471,13 @@ begin ThemeLoadButton(PartyPlayer.Player11Name, 'PartyPlayerPlayer11Name'); ThemeLoadButton(PartyPlayer.Player12Name, 'PartyPlayerPlayer12Name'); + // Party Rounds + ThemeLoadBasic(PartyRounds, 'PartyRounds'); + + ThemeLoadSelectSlide(PartyRounds.SelectRoundCount, 'PartyRoundsSelectRoundCount'); + for I := 0 to High(PartyRounds.SelectRound) do + ThemeLoadSelectSlide(PartyRounds.SelectRound[I], 'PartyRoundsSelectRound' + IntToStr(I + 1)); + {ThemeLoadButton(ButtonNext, 'PartyPlayerButtonNext'); ThemeLoadButton(ButtonPrev, 'PartyPlayerButtonPrev');} diff --git a/Lua/src/screens/UScreenPartyNewRound.pas b/Lua/src/screens/UScreenPartyNewRound.pas index f5e51a0d..b52efd21 100644 --- a/Lua/src/screens/UScreenPartyNewRound.pas +++ b/Lua/src/screens/UScreenPartyNewRound.pas @@ -221,7 +221,7 @@ begin Text[TextWinner[I]].Visible := True; // update texts: - Text[TextRound[I]].Text := Language.Translate('PLUGIN_' + uppercase(Party.Modes[Party.Rounds[I].Mode].Name) + '_NAME'); + 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 @@ -298,7 +298,7 @@ begin end; //nextRound Texts - Text[TextNextRound].Text := Language.Translate('PLUGIN_' + uppercase(Party.Modes[Party.Rounds[Party.CurrentRound].Mode].Name) + '_DESC'); + 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 diff --git a/Lua/src/screens/UScreenPartyOptions.pas b/Lua/src/screens/UScreenPartyOptions.pas index e620029a..3dce9954 100644 --- a/Lua/src/screens/UScreenPartyOptions.pas +++ b/Lua/src/screens/UScreenPartyOptions.pas @@ -44,34 +44,26 @@ uses type TScreenPartyOptions = class(TMenu) - public + private SelectLevel: cardinal; SelectPlayList: cardinal; SelectPlayList2: cardinal; SelectRounds: 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 @@ -118,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); @@ -213,18 +189,24 @@ begin SetLength(IPlaylist2, 1); IPlaylist2[0] := '---'; - //Clear all Selects - Rounds := 5; + //Clear all Selects 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); Interaction := 0; end; diff --git a/Lua/src/screens/UScreenPartyPlayer.pas b/Lua/src/screens/UScreenPartyPlayer.pas index 2cdc0366..3fcaa4ba 100644 --- a/Lua/src/screens/UScreenPartyPlayer.pas +++ b/Lua/src/screens/UScreenPartyPlayer.pas @@ -151,32 +151,12 @@ begin if (Party.ModesAvailable) then begin //mode for current playersetup available - // to - do : add round select screen - // atm just add random rounds to the rounds array - SetLength(Rounds, ScreenPartyOptions.Rounds + 2); - - for I := 0 to High(Rounds) do - Rounds[I] := Party_Round_Random; - - // start party game - if (Party.StartGame(Rounds)) then - begin - FadeTo(@ScreenPartyNewRound, SoundLib.Start); - end - else - begin - //error starting party game - ScreenPopupError.ShowPopup(Language.Translate('ERROR_CAN_NOT_START_PARTY')); - - Party.Clear; - end; - + 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; @@ -443,6 +423,8 @@ begin Button[10].Text[0].Text := Ini.NameTeam[2]; // Templates for Names Mod end + Party.Clear; + UpdateInterface; end; diff --git a/Lua/src/screens/UScreenPartyRounds.pas b/Lua/src/screens/UScreenPartyRounds.pas new file mode 100644 index 00000000..146b8beb --- /dev/null +++ b/Lua/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/Lua/src/ultrastardx.dpr b/Lua/src/ultrastardx.dpr index fdfb8100..a0ee7c20 100644 --- a/Lua/src/ultrastardx.dpr +++ b/Lua/src/ultrastardx.dpr @@ -337,6 +337,7 @@ uses UScreenPartyScore in 'screens\UScreenPartyScore.pas', UScreenPartyPlayer in 'screens\UScreenPartyPlayer.pas', UScreenPartyOptions in 'screens\UScreenPartyOptions.pas', + UScreenPartyRounds in 'screens\UScreenPartyRounds.pas', UScreenPartyWin in 'screens\UScreenPartyWin.pas', -- cgit v1.2.3