From dbe444f87b85da27a37f38e80bfd540178b8dde0 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Wed, 1 Sep 2010 14:09:58 +0000 Subject: - fix: position of player 3 and 4 in 4-player-mode on one screen in singscreen - fix: scorescreen for 4-player-mode on one screen - add: tag #CALCMEDLEY:Off => disable calculation of medley for that song - add: sorting RANDOM for party-modes - add: ShuffleMode FULL (play whole file) in fullscreen if video available - add: it possible to select the 2 songs left and right of the random selected song in party mode - add: num song in in party options (in the selected folder/playlist) - fix: dont change line in editor while playing only one line - removed option solmization from lyric option screen - add: play last sung song in party score screen - added some plugins (thx to MasterPhW) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2629 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 20 ++++++------- Game/Code/Classes/UFiles.pas | 50 ++++++++++++++++++++++++++++++-- Game/Code/Classes/UIni.pas | 14 +++++++-- Game/Code/Classes/UParty.pas | 9 ++++-- Game/Code/Classes/UPlaylist.pas | 38 +++++++++++++++++++++++-- Game/Code/Classes/USongs.pas | 63 ++++++++++++++++++++++++++++++++++++++++- Game/Code/Classes/UThemes.pas | 49 ++++++++++++++++---------------- 7 files changed, 198 insertions(+), 45 deletions(-) (limited to 'Game/Code/Classes') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index ad4ecae7..38e94482 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -1021,8 +1021,8 @@ begin SingDrawCzesc(400+NR.Left + 20, Skin_P1_NotesB, 400+NR.Right - 20, 0, 15, Alpha[0]); SingDrawCzesc(400+NR.Left + 20, Skin_P2_NotesB, 400+NR.Right - 20, 0, 15, Alpha[0]); - SingDrawPlayerCzesc(400+Nr.Left + 20, Skin_P1_NotesB, 400+Nr.Width - 40, 0, 2, 15, Alpha[0]); - SingDrawPlayerCzesc(400+Nr.Left + 20, Skin_P2_NotesB, 400+Nr.Width - 40, 0, 3, 15, Alpha[0]); + SingDrawPlayerCzesc(400+Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 2, 15, Alpha[0]); + SingDrawPlayerCzesc(400+Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 0, 3, 15, Alpha[0]); end; end; @@ -1071,9 +1071,9 @@ begin SingDrawCzesc(400+NR.Left + 20, 245+95, 400+NR.Right - 20, 0, 12, Alpha[0]); SingDrawCzesc(400+NR.Left + 20, 370+95, 400+NR.Right - 20, 0, 12, Alpha[0]); - SingDrawPlayerCzesc(400+Nr.Left + 20, 120+95, 400+Nr.Width - 40, 0, 3, 12, Alpha[0]); - SingDrawPlayerCzesc(400+Nr.Left + 20, 245+95, 400+Nr.Width - 40, 0, 4, 12, Alpha[0]); - SingDrawPlayerCzesc(400+Nr.Left + 20, 370+95, 400+Nr.Width - 40, 0, 5, 12, Alpha[0]); + SingDrawPlayerCzesc(400+Nr.Left + 20, 120+95, Nr.Width - 40, 0, 3, 12, Alpha[0]); + SingDrawPlayerCzesc(400+Nr.Left + 20, 245+95, Nr.Width - 40, 0, 4, 12, Alpha[0]); + SingDrawPlayerCzesc(400+Nr.Left + 20, 370+95, Nr.Width - 40, 0, 5, 12, Alpha[0]); end; end; end; @@ -1148,8 +1148,8 @@ begin SingDrawCzesc(400+NR.Left + 20, Skin_P1_NotesB, 400+NR.Right - 20, 0, 15, Alpha[0]); SingDrawCzesc(400+NR.Left + 20, Skin_P2_NotesB, 400+NR.Right - 20, 1, 15, Alpha[1]); - SingDrawPlayerCzesc(400+Nr.Left + 20, Skin_P1_NotesB, 400+Nr.Width - 40, 0, 2, 15, Alpha[0]); - SingDrawPlayerCzesc(400+Nr.Left + 20, Skin_P2_NotesB, 400+Nr.Width - 40, 1, 3, 15, Alpha[1]); + SingDrawPlayerCzesc(400+Nr.Left + 20, Skin_P1_NotesB, Nr.Width - 40, 0, 2, 15, Alpha[0]); + SingDrawPlayerCzesc(400+Nr.Left + 20, Skin_P2_NotesB, Nr.Width - 40, 1, 3, 15, Alpha[1]); end; end; @@ -1193,9 +1193,9 @@ begin SingDrawCzesc(400+NR.Left + 20, 245+95, 400+NR.Right - 20, 1, 12, Alpha[1]); SingDrawCzesc(400+NR.Left + 20, 370+95, 400+NR.Right - 20, 0, 12, Alpha[0]); - SingDrawPlayerCzesc(400+Nr.Left + 20, 120+95, 400+Nr.Width - 40, 0, 3, 12, Alpha[0]); - SingDrawPlayerCzesc(400+Nr.Left + 20, 245+95, 400+Nr.Width - 40, 1, 4, 12, Alpha[1]); - SingDrawPlayerCzesc(400+Nr.Left + 20, 370+95, 400+Nr.Width - 40, 0, 5, 12, Alpha[0]); + SingDrawPlayerCzesc(400+Nr.Left + 20, 120+95, Nr.Width - 40, 0, 3, 12, Alpha[0]); + SingDrawPlayerCzesc(400+Nr.Left + 20, 245+95, Nr.Width - 40, 1, 4, 12, Alpha[1]); + SingDrawPlayerCzesc(400+Nr.Left + 20, 370+95, Nr.Width - 40, 0, 5, 12, Alpha[0]); end; end; end; diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 16ff7c63..2b051353 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -133,6 +133,7 @@ begin SetLength(Song.Edition, 1); Song.Edition[0] := 'Unknown'; Song.Language := 'Unknown'; //Language Patch + Song.Year := ''; //Required Information Song.Mp3 := ''; @@ -152,8 +153,12 @@ begin Song.Resolution := 4; Song.Creator := ''; Song.Medley.Source:=msNone; + Song.CalcMedley := true; Song.PreviewStart := 0; SetLength(Song.CustomTags, 0); + SetLength(Song.DuetNames, 2); + Song.DuetNames[0] := 'P1'; + Song.DuetNames[1] := 'P2'; end; //-------------------- @@ -350,6 +355,12 @@ begin Song.Language := Value; end + //Year Sorting + else if (Identifier = 'YEAR') then + begin + Song.Year := Value; + end + // Song Start else if (Identifier = 'START') then begin @@ -406,6 +417,25 @@ begin MedleyFlags := MedleyFlags or 4; end + // Medley + else if (Identifier = 'CALCMEDLEY') then + begin + if (Uppercase(Value) = 'OFF') then + Song.CalcMedley := false; + end + + // Duet Singer Name P1 + else if (Identifier = 'DUETSINGERP1') then + begin + Song.DuetNames[0] := Value; + end + + // Duet Singer Name P2 + else if (Identifier = 'DUETSINGERP2') then + begin + Song.DuetNames[1] := Value; + end + // unsupported tag else begin @@ -1128,13 +1158,17 @@ begin if Song.Creator <> '' then WriteLn(SongFile, '#CREATOR:' + Song.Creator); + if Song.Language <> 'Unknown' then WriteLn(SongFile, '#LANGUAGE:' + Song.Language); + for C := 0 to Length(Song.Edition)-1 do if Song.Edition[C] <> 'Unknown' then WriteLn(SongFile, '#EDITION:' + Song.Edition[C]); for C := 0 to Length(Song.Genre) - 1 do if Song.Genre[C] <> 'Unknown' then WriteLn(SongFile, '#GENRE:' + Song.Genre[C]); - - if Song.Language <> 'Unknown' then WriteLn(SongFile, '#LANGUAGE:' + Song.Language); + + if Song.Year <> '' then WriteLn(SongFile, '#YEAR:' + Song.Year); + + WriteLn(SongFile, '#MP3:' + Song.Mp3); @@ -1154,6 +1188,15 @@ begin WriteLn(SongFile, '#MedleyEndBeat:' + IntToStr(Song.Medley.EndBeat)); end; + if (not Song.CalcMedley) then + WriteLn(SongFile, '#CalcMedley:Off'); + + {if (Song.isDuet) then + begin + WriteLn(SongFile, '#DuetSingerP1:' + Song.DuetNames[0]); + WriteLn(SongFile, '#DuetSingerP2:' + Song.DuetNames[1]); + end;} + if Relative then WriteLn(SongFile, '#RELATIVE:yes'); WriteLn(SongFile, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4)); @@ -1222,6 +1265,9 @@ begin if AktSong.Medley.Source = msTag then Exit; + if not AktSong.CalcMedley then + Exit; + //relative is not supported for medley by now! if AktSong.Relative then begin diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 0f1b26ce..97030d1d 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -19,7 +19,9 @@ type Difficulty: integer; Language: integer; Tabs: integer; + tabs_temp: integer; Sorting: integer; + sorting_temp: integer; ShuffleTime: integer; Debug: integer; LoadFaultySongs:integer; @@ -108,7 +110,7 @@ const IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard'); ITabs: array[0..1] of string = ('Off', 'On'); - ISorting: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); + ISorting: array[0..8] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2', 'Random'); sEdition = 0; sGenre = 1; sLanguage = 2; @@ -117,8 +119,9 @@ const sArtist = 5; sTitle2 = 6; sArtist2 = 7; + sRandom = 8; - IShuffleTime: array[0..9] of string = ('Off', + IShuffleTime: array[0..10] of string = ('Off', '15 Sec', '30 Sec', '45 Sec', @@ -127,7 +130,8 @@ const '90 Sec', '105 Sec', '120 Sec', - 'MAX'); + 'MAX', + 'FULL'); IDebug: array[0..1] of string = ('Off', 'On'); ILoadFaultySongs: array[0..1] of string = ('Off', 'On'); @@ -248,11 +252,13 @@ begin Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]); for Pet := 0 to High(ITabs) do if Tekst = ITabs[Pet] then Ini.Tabs := Pet; + tabs_temp := Tabs; // Sorting Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]); for Pet := 0 to High(ISorting) do if Tekst = ISorting[Pet] then Ini.Sorting := Pet; + sorting_temp := Sorting; // ShuffleTime Tekst := IniFile.ReadString('Game', 'ShuffleTime', 'Off'); @@ -653,10 +659,12 @@ begin // Tabs Tekst := ITabs[Ini.Tabs]; IniFile.WriteString('Game', 'Tabs', Tekst); + tabs_temp := Tabs; // Sorting Tekst := ISorting[Ini.Sorting]; IniFile.WriteString('Game', 'Sorting', Tekst); + sorting_temp := Sorting; //ShuffleTime Tekst := IShuffleTime[Ini.ShuffleTime]; diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index 22a4847c..a416bb4c 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -37,10 +37,11 @@ type function IsWinner(Player, Winner: Byte): boolean; procedure GenScores; public - Plugins: array of TPartyPlugin; - Teams: TTeamInfo; - Rounds: array of TRoundInfo; + Plugins: array of TPartyPlugin; + Teams: TTeamInfo; + Rounds: array of TRoundInfo; CurRound: Byte; + Rand3: boolean; constructor Create; @@ -131,6 +132,8 @@ begin //Set cur Round to Round 1 CurRound := 255; + Rand3 := true; + //Set Rounds NumMedleys := 0; If (Length(Plugins) >= 1) then diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 66bd8189..36bbf051 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -47,7 +47,9 @@ type Procedure DelItem(const iItem: Cardinal; const iPlaylist: Integer = -1); Procedure GetNames(var PLNames: array of String); + Procedure GetNamesAndNumSongs(var PLNames: array of String); Function GetIndexbySongID(const SongID: Cardinal; const iPlaylist: Integer = -1): Integer; + Function GetNumSongs(Index: Cardinal): integer; end; {Modes: @@ -414,13 +416,13 @@ end; //---------- //GetNames - Writes Playlist Names in a Array //---------- -Procedure TPlayListManager.GetNames(var PLNames: array of String); +Procedure TPlayListManager.GetNames(var PLNames: array of String); var I: Integer; Len: Integer; begin Len := High(Playlists); - + if (Length(PLNames) <> Len + 1) then exit; @@ -428,6 +430,23 @@ begin PLNames[I] := Playlists[I].Name; end; +//---------- +//GetNamesAndNumSongs - Writes Playlist Names + Num Songs in an Array +//---------- +Procedure TPlayListManager.GetNamesAndNumSongs(var PLNames: array of String); +var + I: Integer; + Len: Integer; +begin + Len := High(Playlists); + + if (Length(PLNames) <> Len + 1) then + exit; + + For I := 0 to Len do + PLNames[I] := Playlists[I].Name + ' ( ' + IntToStr(GetNumSongs(I)) + ' Songs)'; +end; + //---------- //GetIndexbySongID - Returns Index in the specified Playlist of the given Song //---------- @@ -455,4 +474,19 @@ begin end; end; +function TPlayListManager.GetNumSongs(Index: Cardinal): integer; +var + I: integer; + +begin + Result := 0; + + //Count Songs in Playlist + For I := 0 to high(PlayLists[Index].Items) do + begin + if (ScreenSong.Mode=smNormal) or not CatSongs.Song[PlayLists[Index].Items[I].SongID].isDuet then + Inc(Result); + end; +end; + end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 5a579474..e669edf6 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -44,7 +44,9 @@ type FileName: string; isDuet: boolean; + DuetNames: array of string; Medley: TMedley; + CalcMedley: boolean; PreviewStart: real; //in seconds CustomTags: array of TCustomHeaderTag; // from 1.1 @@ -53,6 +55,7 @@ type Genre: array of string; Edition: array of string; Language: string; // 0.5.0: new + Year: string; Title: string; Artist: string; @@ -118,6 +121,7 @@ type function SetFilter(FilterStr: String; const fType: Byte): Cardinal; function NumCatSongs(Cat: integer): integer; + function NumSongs(): integer; function NumVisibleCats(): integer; end; @@ -319,6 +323,21 @@ begin SongSort[S] := TempSong; end; end; + sRandom: + begin + for S2 := 0 to Length(SongSort)-1 do + begin + for S := 1 to Length(SongSort)-1 do + begin + if (Random(2) = 0) then + begin + TempSong := SongSort[S-1]; + SongSort[S-1] := SongSort[S]; + SongSort[S] := TempSong; + end; + end; + end; + end; end; // case end; @@ -441,6 +460,7 @@ begin sArtist: Songs.Sort(sArtist); sTitle2: Songs.Sort(sTitle2); // by title2 ??? sArtist2: Songs.Sort(sArtist2); // by artist2 ??? + sRandom: Songs.Sort(sRandom); end; // case @@ -670,7 +690,32 @@ begin CatSongs.Song[CatLen].Visible := true; end; - end; + end else if (Ini.Sorting = sRandom) and + (Length(Songs.SongSort[S].Artist)>=1) and + (Letter <> 'R') then + begin + // add a letter Category Button + Inc(Order); + Letter := 'R'; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[RANDOM]'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + if (CatLen - CatNumber - 1>=0) then + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end end; CatLen := Length(CatSongs.Song); @@ -757,6 +802,22 @@ begin end; end; +function TCatSongs.NumSongs(): integer; +var + I: integer; +begin + Result := 0; + for I := 0 to Length(CatSongs.Song)-1 do + begin + if (Not CatSongs.Song[I].Main) then + begin + if ((ScreenSong.Mode<>smNormal) and (not CatSongs.Song[I].isDuet)) or + (ScreenSong.Mode=smNormal) then + inc(Result); + end; + end; +end; + function TCatSongs.NumVisibleCats(): integer; var I: integer; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 38d11db4..52893dc6 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -443,29 +443,29 @@ type StaticMedleyNav: TThemeStatic; TextMedleyNav: TThemeText; - PlayerStatic: array[1..6] of AThemeStatic; - PlayerTexts: array[1..6] of AThemeText; - - TextName: array[1..6] of TThemeText; - TextScore: array[1..6] of TThemeText; - - TextNotes: array[1..6] of TThemeText; - TextNotesScore: array[1..6] of TThemeText; - TextLineBonus: array[1..6] of TThemeText; - TextLineBonusScore: array[1..6] of TThemeText; - TextGoldenNotes: array[1..6] of TThemeText; - TextGoldenNotesScore: array[1..6] of TThemeText; - TextTotal: array[1..6] of TThemeText; - TextTotalScore: array[1..6] of TThemeText; - - StaticBoxLightest: array[1..6] of TThemeStatic; - StaticBoxLight: array[1..6] of TThemeStatic; - StaticBoxDark: array[1..6] of TThemeStatic; - - StaticBackLevel: array[1..6] of TThemeStatic; - StaticBackLevelRound: array[1..6] of TThemeStatic; - StaticLevel: array[1..6] of TThemeStatic; - StaticLevelRound: array[1..6] of TThemeStatic; + PlayerStatic: array[1..10] of AThemeStatic; + PlayerTexts: array[1..10] of AThemeText; + + TextName: array[1..10] of TThemeText; + TextScore: array[1..10] of TThemeText; + + TextNotes: array[1..10] of TThemeText; + TextNotesScore: array[1..10] of TThemeText; + TextLineBonus: array[1..10] of TThemeText; + TextLineBonusScore: array[1..10] of TThemeText; + TextGoldenNotes: array[1..10] of TThemeText; + TextGoldenNotesScore: array[1..10] of TThemeText; + TextTotal: array[1..10] of TThemeText; + TextTotalScore: array[1..10] of TThemeText; + + StaticBoxLightest: array[1..10] of TThemeStatic; + StaticBoxLight: array[1..10] of TThemeStatic; + StaticBoxDark: array[1..10] of TThemeStatic; + + StaticBackLevel: array[1..10] of TThemeStatic; + StaticBackLevelRound: array[1..10] of TThemeStatic; + StaticLevel: array[1..10] of TThemeStatic; + StaticLevelRound: array[1..10] of TThemeStatic; // Description: array[0..5] of string;} end; @@ -1396,7 +1396,8 @@ begin ThemeLoadStatic(Score.StaticMedleyNav, 'ScoreMedleyNavStatic'); ThemeLoadText(Score.TextMedleyNav, 'ScoreMedleyNavText'); - for I := 1 to 6 do begin + for I := 1 to 10 do + begin ThemeLoadStatics(Score.PlayerStatic[I], 'ScorePlayer' + IntToStr(I) + 'Static'); ThemeLoadTexts(Score.PlayerTexts[I], 'ScorePlayer' + IntToStr(I) + 'Text'); -- cgit v1.2.3