From fffb5a40133622131d7077f1d8842c2c6b7b51ad Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sat, 20 Nov 2010 10:40:00 +0000 Subject: - hide lyrics also by pressing N - support for more than one song folder - added track number in error.log for duet songs - fixed sorting by title and artist: sort by artist or title first - added more text messages in editor - copy and move lines between tracks in duet songs is possible again - adjust player number in screenname - don't show possible scores in party modes (collidates with some plugins) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2743 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 21 ++++++++++------ Game/Code/Classes/UFiles.pas | 26 +++++++++++++------- Game/Code/Classes/UIni.pas | 32 +++++++++++++++++++++++-- Game/Code/Classes/USongs.pas | 57 ++++++++++++++++++++++++++++++++------------ 4 files changed, 103 insertions(+), 33 deletions(-) (limited to 'Game/Code/Classes') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index e4735a39..8b7fd8b4 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -64,7 +64,7 @@ var TickOld: cardinal; TickOld2:cardinal; //end Singbar Mod - ShowNotes: integer; //0=show all; 1=don't show notes+rating; 2=don't show notes, rating, score+score bar + ShowNotes: integer; //0=show all; 1=don't show notes+rating; 2=don't show notes, rating, score+score bar; 3=also lyrics @@ -724,19 +724,26 @@ begin ScreenSing.LyricMain[0].SetAlpha(Alpha[0]); ScreenSing.LyricSub[0].SetAlpha(Alpha[2]); - ScreenSing.LyricMain[0].Draw; - ScreenSing.LyricSub[0].Draw; - SingDrawLyricHelper(0, NR); + if (ShowNotes<3) then + begin + ScreenSing.LyricMain[0].Draw; + ScreenSing.LyricSub[0].Draw; + + SingDrawLyricHelper(0, NR); + end; if (AktSong.isDuet) then begin ScreenSing.LyricMain[1].SetAlpha(Alpha[1]); ScreenSing.LyricSub[1].SetAlpha(Alpha[3]); - ScreenSing.LyricMain[1].Draw; - ScreenSing.LyricSub[1].Draw; - SingDrawLyricHelper(1, NR); + if (ShowNotes<3) then + begin + ScreenSing.LyricMain[1].Draw; + ScreenSing.LyricSub[1].Draw; + SingDrawLyricHelper(1, NR); + end; end; // oscilloscope diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 93e745e5..d6ec4254 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -45,7 +45,7 @@ var //Absolute Paths GamePath: string; SoundPath: string; - SongPath: string; + SongPaths: array of string; LogPath: string; ThemePath: string; ScreenshotsPath: string; @@ -82,7 +82,9 @@ begin GamePath := ExtractFilePath(ParamStr(0)); SoundPath := GamePath + 'Sounds\'; - SongPath := GamePath + 'Songs\'; + + SetLength(SongPaths, 1); + SongPaths[0] := GamePath + 'Songs\'; LogPath := GamePath; ThemePath := GamePath + 'Themes\'; ScreenshotsPath := GamePath + 'Screenshots\'; @@ -100,8 +102,8 @@ begin If not DirectoryExists(SoundPath) then Writeable := ForceDirectories(SoundPath); - If Writeable And (not DirectoryExists(SongPath)) then - Writeable := ForceDirectories(SongPath); + If Writeable And (not DirectoryExists(SongPaths[0])) then + Writeable := ForceDirectories(SongPaths[0]); If Writeable And (not DirectoryExists(ThemePath)) then Writeable := ForceDirectories(ThemePath); @@ -745,6 +747,7 @@ var foundMedleyStart: boolean; foundMedleyEnd: boolean; medley: boolean; + singer: string; begin Result := true; @@ -761,6 +764,11 @@ begin for p := 0 to Length(Czesci) - 1 do begin + if AktSong.isDuet then + singer := ' (P' + IntToStr(p+1) + ')' + else + singer := ''; + bt := low(integer); numLines := Length(Czesci[p].Czesc); @@ -793,7 +801,7 @@ begin if(bt>Czesci[p].Czesc[line].Start) then begin Log.LogError('Beat error in sentence ' + IntToStr(line+1) + ', on beat ' + IntToStr(Czesci[p].Czesc[line].Start) + - ' in song ' + AktSong.Path + AktSong.Filename); + singer + ' in song ' + AktSong.Path + AktSong.Filename); if (Ini.LoadFaultySongs=0) and (Ini.LoadFaultySongs_temp=0) then Result := false; end; @@ -804,7 +812,7 @@ begin if(bt>Czesci[p].Czesc[line].Nuta[note].Start) then begin Log.LogError('Beat error in sentence ' + IntToStr(line+1) + ', on beat ' + IntToStr(Czesci[p].Czesc[line].Nuta[note].Start) + - ' in song ' + AktSong.Path + AktSong.Filename); + singer + ' in song ' + AktSong.Path + AktSong.Filename); if (Ini.LoadFaultySongs=0) and (Ini.LoadFaultySongs_temp=0) then Result := false; end; @@ -813,7 +821,7 @@ begin if (Czesci[p].Czesc[line].Nuta[note].Dlugosc<0) then begin Log.LogError('Note length <0 in sentence ' + IntToStr(line+1) + ', on beat ' + IntToStr(Czesci[p].Czesc[line].Nuta[note].Start) + - ' in song ' + AktSong.Path + AktSong.Filename); + singer + ' in song ' + AktSong.Path + AktSong.Filename); if (Ini.LoadFaultySongs=0) and (Ini.LoadFaultySongs_temp=0) then Result := false; end; @@ -821,7 +829,7 @@ begin if (Czesci[p].Czesc[line].Nuta[note].Dlugosc=0) and not Czesci[p].Czesc[line].Nuta[note].FreeStyle then begin Log.LogError('Note length =0 in sentence ' + IntToStr(line+1) + ', on beat ' + IntToStr(Czesci[p].Czesc[line].Nuta[note].Start) + - ' in song ' + AktSong.Path + AktSong.Filename); + singer + ' in song ' + AktSong.Path + AktSong.Filename); if (Ini.LoadFaultySongs=0) and (Ini.LoadFaultySongs_temp=0) then Result := false; end; @@ -836,7 +844,7 @@ begin if (bt+Czesci[p].Czesc[line].Nuta[note].Dlugosc>nextBeat) then begin Log.LogError('Note length error in sentence ' + IntToStr(line+1) + ', on beat ' + IntToStr(Czesci[p].Czesc[line].Nuta[note].Start) + - ' in song ' + AktSong.Path + AktSong.Filename); + singer + ' in song ' + AktSong.Path + AktSong.Filename); if (Ini.LoadFaultySongs=0) and (Ini.LoadFaultySongs_temp=0) then Result := false; end; diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index d3f912d9..56306ba2 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -214,6 +214,8 @@ var Modes: PPSDL_Rect; SR: TSearchRec; //Skin List Patch found: boolean; + txt: string; + num: integer; function GetFileName (S: String):String; begin @@ -668,9 +670,29 @@ begin // SongPath if (Params.SongPath <> '') then - SongPath := IncludeTrailingPathDelimiter(Params.SongPath) + SongPaths[0] := IncludeTrailingPathDelimiter(Params.SongPath) else - SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath)); + begin + txt := IniFile.ReadString('Path', 'Songs', ' '); + if (DirectoryExists(txt)) then + begin + num := Length(SongPaths); + SetLength(SongPaths, num+1); + SongPaths[num] := IncludeTrailingPathDelimiter(txt); + end; + + I := 1; + repeat + txt := IniFile.ReadString('Directories', 'SongDir'+IntToStr(I), ' '); + if (DirectoryExists(txt)) then + begin + num := Length(SongPaths); + SetLength(SongPaths, num+1); + SongPaths[num] := IncludeTrailingPathDelimiter(txt); + Inc(I); + end; + until (not DirectoryExists(txt)); + end; Filename := IniFile.FileName; IniFile.Free; @@ -928,6 +950,12 @@ begin Tekst := ILogSession[Ini.LogSession]; IniFile.WriteString('Advanced', 'LogSession', Tekst); + // Directories (add a template if section is missing, from 1.1) + if (not IniFile.SectionExists('Path')) then + IniFile.WriteString('Path', 'Songs', ' '); + if (not IniFile.SectionExists('Directories')) then + IniFile.WriteString('Directories', 'SongDir1', ' '); + IniFile.Free; end; end; diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index 61473535..330b8a9e 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -99,7 +99,7 @@ type function FindSongFile(Dir, Mask: string): string; procedure LoadSongList; // load all songs - procedure BrowseDir(Dir: string); // should return number of songs in the future + procedure BrowseDir(Dir: string; Index: integer); // should return number of songs in the future procedure Sort(Order: integer); end; @@ -217,6 +217,8 @@ begin end; procedure TSongs.LoadSongList; +var + I: integer; begin Log.LogStatus('Initializing', 'LoadSongList'); @@ -226,13 +228,14 @@ begin BrowsePos := 0; // browse directories - BrowseDir(SongPath); + for I := 0 to Length(SongPaths) - 1 do + BrowseDir(SongPaths[I], I); //Set Correct SongArray Length SetLength(Song, BrowsePos); end; -procedure TSongs.BrowseDir(Dir: string); +procedure TSongs.BrowseDir(Dir: string; Index: integer); var SR: TSearchRec; // for parsing Songs Directory SLen: integer; @@ -240,10 +243,11 @@ var Name: string; begin - if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin + if FindFirst(Dir + '*', faDirectory, SR) = 0 then + begin repeat if (SR.Name <> '.') and (SR.Name <> '..') then - BrowseDir(Dir + SR.Name + '\'); + BrowseDir(Dir + SR.Name + '\', Index); until FindNext(SR) <> 0; end; // if FindClose(SR); @@ -256,7 +260,7 @@ begin SLen := BrowsePos; Song[SLen].Path := Dir; - Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000); + Song[SLen].Folder := Copy(Dir, Length(SongPaths[Index])+1, 10000); Song[SLen].Folder := Copy(Song[SLen].Folder, 1, Pos('\', Song[SLen].Folder)-1); Song[SLen].FileName := SR.Name; @@ -463,27 +467,50 @@ begin Log.BenchmarkStart(3); case Ini.Sorting of - sEdition: begin + sEdition: + begin Songs.Sort(sArtist); Songs.Sort(sEdition); end; - sGenre: begin + sGenre: + begin Songs.Sort(sArtist); Songs.Sort(sGenre); end; - sLanguage: begin + sLanguage: + begin Songs.Sort(sArtist); Songs.Sort(sLanguage); end; - sFolder: begin + sFolder: + begin Songs.Sort(sArtist); Songs.Sort(sFolder); end; - sTitle: Songs.Sort(sTitle); - sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 ??? - sArtist2: Songs.Sort(sArtist2); // by artist2 ??? - sRandom: Songs.Sort(sRandom); + sTitle: + begin + Songs.Sort(sArtist); + Songs.Sort(sTitle); + end; + sArtist: + begin + Songs.Sort(sTitle); + Songs.Sort(sArtist); + end; + sTitle2: + begin + Songs.Sort(sArtist); + Songs.Sort(sTitle); + end; + sArtist2: + begin + Songs.Sort(sTitle); + Songs.Sort(sArtist); + end; + sRandom: + begin + Songs.Sort(sRandom); + end; end; // case Log.BenchmarkEnd(3); -- cgit v1.2.3