From 4f7bf28056fefdcd000499c583a47738ce7d9b07 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 6 Apr 2007 10:32:24 +0000 Subject: Fixed a Bug in Optionsscreen after adding OptionsAdvanced Screen Added Jump to Title HotKey (Alt + A..Z) Added Playlist Support to Party Mode, Category Only Mode is still buggy. Fixed: Team3 Players are now Hidden when only 2 Teams are Selected git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@67 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlaylist.pas | 6 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 2 +- Game/Code/Screens/UScreenOptionsGame.pas | 2 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 2 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 2 +- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenOptionsSound.pas | 2 +- Game/Code/Screens/UScreenOptionsThemes.pas | 2 +- Game/Code/Screens/UScreenPartyOptions.pas | 137 +++++++++++++++++++++++++-- Game/Code/Screens/UScreenSong.pas | 89 +++++++++++------ 10 files changed, 201 insertions(+), 45 deletions(-) diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 585f9271..a6207c4f 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -50,8 +50,8 @@ type {Modes: 0: Standard Mode - 1: PlayList Mode - 2: Category Mode} + 1: Category Mode + 2: PlayList Mode} var PlayListMan: TPlaylistManager; @@ -244,7 +244,7 @@ begin //Set CatSongsMode + Playlist Mode CatSongs.CatNumShow := -3; - Mode := 1; + Mode := 2; //Show Cat in Topleft: ScreenSong.ShowCatTLCustom(Format(Theme.Playlist.CatText,[Playlists[Index].Name])); diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index bfbd54a7..7904a284 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -82,7 +82,7 @@ begin AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index cc6e850b..63bbec36 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -89,7 +89,7 @@ begin AddButton(Theme.OptionsGame.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index d39a10c8..4befb092 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -89,7 +89,7 @@ begin AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index 0ce5c970..35cb2415 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -80,7 +80,7 @@ begin AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index b4075ba8..e6989d43 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -105,7 +105,7 @@ begin AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index ad6db766..aea6cdbc 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -81,7 +81,7 @@ begin AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index eb5ed33e..151913be 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -106,7 +106,7 @@ begin AddButton(Theme.OptionsThemes.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[6]); + AddButtonText(14, 20, Theme.Options.Description[7]); end; procedure TScreenOptionsThemes.onShow; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index 148289e8..042e944f 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -27,10 +27,13 @@ type function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; + procedure SetPlaylist2; end; var ILevel: array[0..2] of String; + IPlaylist: array[0..2] of String; + IPlaylist2: array of String; const ITeams: array[0..1] of String =('2', '3'); IPlayers: array[0..3] of String =('1', '2', '3', '4'); @@ -38,10 +41,42 @@ const implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager; +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UDLLManager, UPlaylist, USongs; function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var I: Integer; + var + I, J: Integer; + + function IsVisible: Boolean; + begin + Result := True; + if (Interactions[Interaction].Typ = 0) then + begin + Result := Button[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 1) then + begin + //Result := Selects[Interactions[Interaction].Num].Visible; + end + else if (Interactions[Interaction].Typ = 3) then + begin + Result := SelectsS[Interactions[Interaction].Num].Visible; + end; + end; + + Procedure SelectNext; + begin + repeat + InteractNext; + until IsVisible; + end; + + Procedure SelectPrev; + begin + repeat + InteractPrev; + until IsVisible; + end; begin Result := true; If (PressedDown) Then @@ -71,6 +106,26 @@ begin 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 := Playlist; + //If Category Selected Search Category ID + if Playlist = 1 then + begin + J := -1; + For I := 0 to high(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Inc(J); + + if J = Playlist2 then + begin + PlaylistMan.CurPlayList := I; + Break; + end; + end; + end + else + PlaylistMan.CurPlayList := Playlist2; //Save Rounds + Random SetLength (PartySession.Rounds, Rounds + 2); For I := 0 to high (PartySession.Rounds) do @@ -86,17 +141,43 @@ begin // 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_DOWN: SelectNext; + SDLK_UP: SelectPrev; SDLK_RIGHT: begin Music.PlayOption; InteractInc; + + //Change Playlist2 if Playlist is Changed + If (Interaction = 1) then + begin + SetPlaylist2; + end //Change Team3 Players visibility + Else If (Interaction = 4) then + begin + Case NumTeams of + 0: SelectsS[7].Visible := False; + 1: SelectsS[7].Visible := True; + end; + end; end; SDLK_LEFT: begin Music.PlayOption; InteractDec; + + //Change Playlist2 if Playlist is Changed + If (Interaction = 1) then + begin + SetPlaylist2; + end //Change Team3 Players visibility + Else If (Interaction = 4) then + begin + Case NumTeams of + 0: SelectsS[7].Visible := False; + 1: SelectsS[7].Visible := True; + end; + end; end; end; end @@ -119,6 +200,15 @@ begin ILevel[1] := Language.Translate('SING_MEDIUM'); ILevel[2] := Language.Translate('SING_HARD'); + //Fill IPlaylist + IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL'); + IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY'); + IPlaylist[2] := Language.Translate('PARTY_PLAYLIST_PLAYLIST'); + + //Fill IPlaylist2 + SetLength(IPlaylist2, 1); + IPlaylist2[0] := '---'; + NumTeams := 0; NumPlayer1 := 0; NumPlayer2 := 0; @@ -130,8 +220,8 @@ begin AddBackground(Theme.PartyOptions.Background.Tex); SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, ILevel); - SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, ITeams); - SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, ITeams); + SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); + 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); @@ -145,6 +235,41 @@ begin AddText(Theme.PartyOptions.Text[I]); Interaction := 0; + + //Hide Team3 Players + SelectsS[7].Visible := False; +end; + +procedure TScreenPartyOptions.SetPlaylist2; +var I: Integer; +begin + Case Playlist of + 0: + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := '---'; + end; + 1: + begin + SetLength(IPlaylist2, 0); + For I := 0 to high(CatSongs.Song) do + begin + If (CatSongs.Song[I].Main) then + begin + SetLength(IPlaylist2, Length(IPlaylist2) + 1); + IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist; + end; + end; + end; + 2: + begin + SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(IPlaylist2); + end; + end; + + Playlist2 := 0; + UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2); end; procedure TScreenPartyOptions.onShow; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 6a1df197..2af37dd5 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -89,7 +89,7 @@ type end; implementation -uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UScreenSongMenu; +uses UGraphic, UMain, UCovers, math, OpenGL12, Windows, USkins, UDLLManager, UParty, UPlaylist, UScreenSongMenu; // ***** Public methods ****** // @@ -198,8 +198,8 @@ begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); - {//Jump To - if (SDL_ModState = KMOD_LALT) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then + //Jump To + if (SDL_ModState = KMOD_LALT) AND (Mode = 0) AND (PressedKey > SDLK_A) AND (PressedKey < SDLK_Z) then begin Letter := UpCase(Chr(ScanCode)); Log.LogError(Letter); @@ -208,7 +208,7 @@ begin begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (UpCase(CatSongs.Song[(I + Interaction) mod I2].Title[1]) = Letter) then begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + SkipTo(2 + CatSongs.VisibleIndex((I + Interaction) mod I2)); Music.PlayChange; @@ -220,7 +220,7 @@ begin end; end; Exit; - end; } + end; case PressedKey of SDLK_ESCAPE : @@ -312,7 +312,7 @@ begin SDLK_M: //Show SongMenu begin - if Length(Songs.Song) > 0 then begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then ScreenSongMenu.MenuShow(SM_Playlist) @@ -328,14 +328,14 @@ begin SDLK_P: //Show Playlist Menu begin - if Length(Songs.Song) > 0 then begin + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; SDLK_J: //Show Jumpto Menu begin - if Length(Songs.Song) > 0 then + if (Length(Songs.Song) > 0) AND (Mode = 0) then begin ScreenSongJumpto.Visible := True; end; @@ -1462,34 +1462,65 @@ Procedure TScreenSong.SelectRandomSong; var I, I2: Integer; begin - repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; + Case PlaylistMan.Mode of + 0: //All Songs Just Select Random Song + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; - //Search Cat - for I := I2 downto low(CatSongs.Song) do - begin - if CatSongs.Song[I].Main then - break; - end; - //In I ist jetzt die Kategorie in I2 der Song + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song - //Choose Cat - CatSongs.ShowCategoryList; + //Choose Cat + CatSongs.ShowCategoryList; - //Show Cat in Top Left Mod - ShowCatTL (I); + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + end; + 1: //One Category Select Category and Select Random Song + begin + CatSongs.HideCategory(-1); + CatSongs.ShowCategory(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); - CatSongs.ClickCategoryButton(I); - SelectNext; + SelectNext; + FixSelected; - //Fix: Not Existing Song selected: - if (I+1=I2) then Inc(I2); + SkipTo(2+Random(CatSongs.VisibleSongs-1)); + Music.PlayChange; + ChangeMusic; + SetScroll4; + UpdateLCD; + end; + 2: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); - //Choose Song - SkipTo(I2-I); + SkipTo(2+Random(CatSongs.VisibleSongs-1)); + Music.PlayChange; + ChangeMusic; + SetScroll4; + UpdateLCD; + FixSelected; + end; + end; - ChangeMusic; + ChangeMusic; end; procedure TScreenSong.SetJoker; -- cgit v1.2.3