From 3ba33f8e920a9e9a3114f159e2b6fda4273a6efb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 28 Mar 2007 13:08:41 +0000 Subject: Added Jumpto Ability to SongScreen (Press J) Fixed: Golden Notes are not shown in PartyMode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@39 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UGraphic.pas | 9 +++-- Game/Code/Classes/USongs.pas | 77 ++++++++++++++++++++++++++++++++++++------ Game/Code/Classes/UThemes.pas | 16 ++++++++- 3 files changed, 87 insertions(+), 15 deletions(-) (limited to 'Game/Code/Classes') diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 8238eace..d9831143 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -6,7 +6,7 @@ uses UScreenWelcome, UScreenMain, UScreenName, UScreenLevel, UScreenOptions, UScreenOptionsGame, UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, UScreenSong, UScreenSing, UScreenScore, UScreenTop5, UScreenEditSub, - UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, + UScreenEdit, UScreenEditConvert, UScreenEditHeader, UScreenOpen, UThemes, USkins, UScreenSongMenu, UScreenSongJumpto, {Party Screens} UScreenSingModi, UScreenPartyNewRound, UScreenPartyScore, UScreenPartyOptions, UScreenPartyWin, UScreenPartyPlayer; type @@ -51,6 +51,7 @@ var ScreenOpen: TScreenOpen; ScreenSongMenu: TScreenSongMenu; + ScreenSongJumpto: TScreenSongJumpto; //Party Screens ScreenSingModi: TScreenSingModi; @@ -390,9 +391,11 @@ begin ScreenOpen := TScreenOpen.Create(''); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Open', 3); Log.BenchmarkStart(3); ScreenSingModi := TScreenSingModi.Create; - Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); - //ScreenSongMenu := TScreenSongMenu.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Sing with Modi support', 3); Log.BenchmarkStart(3); + ScreenSongMenu := TScreenSongMenu.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongMenu', 3); Log.BenchmarkStart(3); + ScreenSongJumpto := TScreenSongJumpto.Create; + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen SongJumpto', 3); Log.BenchmarkStart(3); ScreenPartyNewRound := TScreenPartyNewRound.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen PartyNewRound', 3); Log.BenchmarkStart(3); ScreenPartyScore := TScreenPartyScore.Create; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index c2532a03..5b75879d 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -82,6 +82,8 @@ type function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song function VisibleSongs: integer; // returns number of visible songs (for tabs) function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: String; const fType: Byte): Cardinal; end; var @@ -91,7 +93,7 @@ var implementation -uses UPliki, UIni, UFiles; +uses UPliki, UIni, UFiles, StrUtils; procedure TSongs.LoadSongList; begin @@ -572,12 +574,12 @@ var S: integer; // song begin CatNumShow := Index; - for S := 0 to high(CatSongs.Song) do begin - if CatSongs.Song[S].OrderNum = Index then + for S := 0 to high(CatSongs.Song) do + begin + if (CatSongs.Song[S].OrderNum = Index) AND (Not CatSongs.Song[S].Main) then CatSongs.Song[S].Visible := true else - if not CatSongs.Song[S].Main then - CatSongs.Song[S].Visible := false; + CatSongs.Song[S].Visible := false; end; end; @@ -599,12 +601,6 @@ begin if Num <> CatNumShow then begin ShowCategory(Num); - //Hide Categorys when in Category Hack - for S := low(CatSongs.Song) to high(CatSongs.Song) do begin - if CatSongs.Song[S].Main then //Hide all Cats - CatSongs.Song[S].Visible := false - end; - //Hide Categorys when in Category Hack End end else begin ShowCategoryList; @@ -664,4 +660,63 @@ begin if CatSongs.Song[S].Visible = true then Inc(Result); end; +function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; +var + I, J: Integer; + cString: String; + SearchStr: Array of String; +begin + {fType: 0: All + 1: Title + 2: Artist} + if FilterStr<>'' then begin + Result := 0; + //Create Search Array + SetLength(SearchStr, 1); + I := Pos (' ', FilterStr); + While (I <> 0) do + begin + SetLength (SearchStr, Length(SearchStr) + 1); + cString := Copy(FilterStr, 1, I-1); + if (cString <> ' ') AND (cString <> '') then + SearchStr[High(SearchStr)-1] := cString; + Delete (FilterStr, 1, I); + + I := Pos (' ', FilterStr); + end; + //Copy last Word + if (FilterStr <> ' ') AND (FilterStr <> '') then + SearchStr[High(SearchStr)] := FilterStr; + + for I:=0 to High(Song) do begin + if not Song[i].Main then + begin + case fType of + 0: cString := Song[I].Artist + ' ' + Song[i].Title + ' ' + Song[i].Folder; + 1: cString := Song[I].Title; + 2: cString := Song[I].Artist; + end; + Song[i].Visible:=True; + //Look for every Searched Word + For J := 0 to High(SearchStr) do + begin + Song[i].Visible := Song[i].Visible AND AnsiContainsText(cString, SearchStr[J]) + end; + if Song[i].Visible then + Inc(Result); + end + else + Song[i].Visible:=False; + end; + CatNumShow := -2; + end + else begin + for i:=0 to High(Song) do begin + Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; + CatNumShow := -1; + end; + Result := 0; + end; +end; + end. diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index e9aa2141..e31e94d2 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -393,6 +393,12 @@ type TextMenu: TThemeText; end; + TThemeSongJumpTo = class(TThemeBasic) + ButtonSearchText: TThemeButton; + SelectSlideType: TThemeSelectSlide; + TextFound: TThemeText; + end; + //Party Screens TThemePartyNewRound = class(TThemeBasic) TextRound1: TThemeText; @@ -525,6 +531,7 @@ type OptionsRecord: TThemeOptionsRecord; //Menu SongMenu: TThemeSongMenu; + SongJumpto: TThemeSongJumpTo; //Party Screens: PartyNewRound: TThemePartyNewRound; PartyScore: TThemePartyScore; @@ -606,6 +613,7 @@ begin OptionsRecord := TThemeOptionsRecord.Create; SongMenu := TThemeSongMenu.Create; + SongJumpto := TThemeSongJumpto.Create; //Party Screens PartyNewRound := TThemePartyNewRound.Create; PartyWin := TThemePartyWin.Create; @@ -980,7 +988,7 @@ begin ThemeLoadSelectSlide(OptionsRecord.SelectSlideChannelR, 'OptionsRecordSelectSlideChannelR'); ThemeLoadButton(OptionsRecord.ButtonExit, 'OptionsRecordButtonExit'); - //Song Menu + //Song Menu ThemeLoadBasic (SongMenu, 'SongMenu'); ThemeLoadButton(SongMenu.Button1, 'SongMenuButton1'); ThemeLoadButton(SongMenu.Button2, 'SongMenuButton2'); @@ -990,6 +998,12 @@ begin ThemeLoadText(SongMenu.TextMenu, 'SongMenuTextMenu'); + //Song Jumpto + ThemeLoadBasic (SongJumpto, 'SongJumpto'); + ThemeLoadButton(SongJumpto.ButtonSearchText, 'SongJumptoButtonSearchText'); + ThemeLoadSelectSlide(SongJumpto.SelectSlideType, 'SongJumptoSelectSlideType'); + ThemeLoadText(SongJumpto.TextFound, 'SongJumptoTextFound'); + //Party Screens: //Party NewRound ThemeLoadBasic(PartyNewRound, 'PartyNewRound'); -- cgit v1.2.3