From d520f9f6ed8a3a0cb8e3063040db19758b7c6f38 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 30 Mar 2008 16:44:20 +0000 Subject: Prepared some classes for enhanced Song loading. Commited to work with s_alexander in this task. Song loading doesn't work at this point git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@983 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UCovers.pas | 64 ++++++---- Game/Code/Classes/UDataBase.pas | 166 +++++++++++++++++++++--- Game/Code/Classes/UPlaylist.pas | 18 +-- Game/Code/Classes/USong.pas | 201 ++++++++++++++++++++++++++++-- Game/Code/Classes/USongs.pas | 74 +++++------ Game/Code/Screens/UScreenEditSub.pas | 15 +-- Game/Code/Screens/UScreenPartyOptions.pas | 18 +-- Game/Code/Screens/UScreenSing.pas | 48 +++---- Game/Code/Screens/UScreenSong.pas | 190 ++++++++++++++-------------- Game/Code/Screens/UScreenTop5.pas | 14 +-- 10 files changed, 570 insertions(+), 238 deletions(-) diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index 9cc2a5e9..4068e02b 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -32,25 +32,32 @@ type end; TCovers = class - Cover: array of TCover; - W: word; - H: word; - Size: integer; - Data: array of byte; - WritetoFile: Boolean; - - constructor Create; - procedure Load; - procedure Save; - procedure AddCover(Name: string); - function CoverExists(Name: string): boolean; - function CoverNumber(Name: string): integer; - procedure PrepareData(Name: string); + private + Filename: String; + + + + WritetoFile: Boolean; + public + W: word; + H: word; + Size: integer; + Data: array of byte; + Cover: array of TCover; + + constructor Create; + procedure Load; + procedure Save; + Function AddCover(FileName: string): Integer; //Returns ID, Checks Cover for Change, Updates Cover if required + function CoverExists(FileName: string): boolean; + function CoverNumber(FileName: string): integer; //Returns ID by FilePath + procedure PrepareData(FileName: string); + Procedure LoadTextures; end; var Covers: TCovers; - + // to - do : new Song management implementation uses UMain, @@ -155,7 +162,7 @@ begin CloseFile(F);} end; -procedure TCovers.AddCover(Name: string); +Function TCovers.AddCover(FileName: string): Integer; var B: integer; F: File; @@ -163,10 +170,10 @@ var NLen: word; Bits: byte; begin - if not CoverExists(Name) then + if not CoverExists(FileName) then begin SetLength(Cover, Length(Cover)+1); - Cover[High(Cover)].Name := Name; + Cover[High(Cover)].Name := FileName; Cover[High(Cover)].W := W; Cover[High(Cover)].H := H; @@ -197,9 +204,9 @@ begin BlockWrite(F, H, 2); BlockWrite(F, Bits, 1); - NLen := Length(Name); + NLen := Length(FileName); BlockWrite(F, NLen, 2); - BlockWrite(F, Name[1], NLen); + BlockWrite(F, FileName[1], NLen); Cover[High(Cover)].Position := FilePos(F); BlockWrite(F, CacheMipmap[0], W*H*(Bits div 8)); @@ -211,7 +218,7 @@ begin Cover[High(Cover)].Position := 0; end; -function TCovers.CoverExists(Name: string): boolean; +function TCovers.CoverExists(FileName: string): boolean; var C: integer; // cover begin @@ -220,14 +227,14 @@ begin while (C <= High(Cover)) and (Result = false) do begin - if Cover[C].Name = Name then + if Cover[C].Name = FileName then Result := true; Inc(C); end; end; -function TCovers.CoverNumber(Name: string): integer; +function TCovers.CoverNumber(FileName: string): integer; var C: integer; begin @@ -236,14 +243,14 @@ begin while (C <= High(Cover)) and (Result = -1) do begin - if Cover[C].Name = Name then + if Cover[C].Name = FileName then Result := C; Inc(C); end; end; -procedure TCovers.PrepareData(Name: string); +procedure TCovers.PrepareData(FileName: string); var F: File; C: integer; @@ -253,7 +260,7 @@ begin AssignFile(F, GamePath + 'covers.cache'); Reset(F, 1); - C := CoverNumber(Name); + C := CoverNumber(FileName); SetLength(Data, Cover[C].Size); if Length(Data) < 6 then beep; Seek(F, Cover[C].Position); @@ -262,4 +269,9 @@ begin end; end; +Procedure TCovers.LoadTextures; +begin + +end; + end. diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index dcf32315..059443ac 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -35,28 +35,116 @@ type TimesSungtot: Word); end; AStatResult = Array of TStatResult; - + + TDBSongInfo = record + FileName: String; + FolderID: String; + FullPath: String; + LastChanged: Integer; //TimeStamp + + //Required Information + Title: widestring; + Artist: widestring; + + Mp3: widestring; + + Text: widestring; + Creator: widestring; + + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Base : array[0..1] of integer; + Rel : array[0..1] of integer; + Mult : integer; + MultBPM : integer; + + //Some Files + Cover: widestring; //Path to Cover + CoverID: Integer; //ID of Cover in Covers Cache + Background: widestring; + Video: widestring; + VideoGAP: real; + + + //Additional Information + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + + //Sorting + Genre: widestring; + Edition: widestring; + Language: widestring; + end; + + TSongListInfo = record //SongInfo used by Songscreen + ID: Integer; + Title: widestring; + Artist: widestring; + + Mp3: widestring; + Video: widestring; + CoverID: Integer; //Cover ID in CoversCache + end; + ASongList = Array of TSongListInfo; + + TSongListFilter = record + Field: Byte; //FieldID //See constants below + isSearch: Boolean; //Search Mask(true) or exact Match(False) + Filter: String; + end; + ASongListFilter = Array of TSongListFilter; + TDataBaseSystem = class private ScoreDB: TSqliteDatabase; sFilename: string; - + public property Filename: String read sFilename; - + Destructor Free; Procedure Init(const Filename: string); - procedure ReadScore(var Song: TSong); - procedure AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); - procedure WriteScore(var Song: TSong); + procedure ReadScore(Song: Integer); + procedure AddScore(Song: Integer; Level: integer; Name: string; Score: integer); + procedure WriteScore(Song: Integer); + + Function GetIDbyPath(const Path: String): Integer; + Function GetIDbyFileName(const Filename: String; FolderID: Integer): Integer; + Procedure GetSongData(ID: Integer; var Info: TDBSongInfo); + Procedure SetSongData(ID: Integer; var Info: TDBSongInfo); + Function GetLastChangedbyID(const Song: Integer): Integer; + Function GetLastChangedbyFileName(const Filename: String; FolderID: Integer): Integer; + + Function GetFolderIDbyPath(Path: String): Integer; + Function GetFolderIDbyName(const Name: String; ParentFolder: Integer): Integer; + + Function GetSongList(var List: ASongList; const Filter: ASongListFilter): Integer; Function GetStats(var Stats: AStatResult; const Typ, Count: Byte; const Page: Cardinal; const Reversed: Boolean): Boolean; Function GetTotalEntrys(const Typ: Byte): Cardinal; end; +const + //Filter FieldIDs + SLF_Edition = 0; + SLF_Genre = 1; + SLF_Language = 2; + SLF_Folder = 3; + SLF_Title = 4; + SLF_Artist = 5; + SLF_Year = 6; + SLF_Creator = 7; + SLF_Video = 8; //Songs w/ Video are returned + SLF_NoVideo = 9; //Songs w/o Video are returned + Max_FilterFieldID = SLF_NoVideo; + var DataBase: TDataBaseSystem; @@ -123,12 +211,12 @@ end; //-------------------- //ReadScore - Read Scores into SongArray //-------------------- -procedure TDataBaseSystem.ReadScore(var Song: TSong); +procedure TDataBaseSystem.ReadScore(Song: Integer); var TableData: TSqliteTable; Difficulty: Integer; begin - if not assigned( ScoreDB ) then + {if not assigned( ScoreDB ) then exit; @@ -169,18 +257,18 @@ begin finally //ScoreDb.Free; - end; + end; } end; //-------------------- //AddScore - Add one new Score to DB //-------------------- -procedure TDataBaseSystem.AddScore(var Song: TSong; Level: integer; Name: string; Score: integer); +procedure TDataBaseSystem.AddScore(Song: Integer; Level: integer; Name: string; Score: integer); var ID: Integer; TableData: TSqliteTable; begin - if not assigned( ScoreDB ) then + {if not assigned( ScoreDB ) then exit; //ScoreDB := TSqliteDatabase.Create(sFilename); @@ -210,15 +298,15 @@ begin end; finally //ScoreDB.Free; - end; + end; } end; //-------------------- //WriteScore - Not needed with new System; But used for Increment Played Count //-------------------- -procedure TDataBaseSystem.WriteScore(var Song: TSong); +procedure TDataBaseSystem.WriteScore(Song: Integer); begin - if not assigned( ScoreDB ) then + {if not assigned( ScoreDB ) then exit; try @@ -226,7 +314,7 @@ begin ScoreDB.ExecSQL ('UPDATE `'+cUS_Songs+'` SET `TimesPlayed` = `TimesPlayed` + "1" WHERE `Title` = "' + Song.Title + '" AND `Artist` = "' + Song.Artist + '";'); except - end; + end; } end; //-------------------- @@ -369,4 +457,52 @@ begin end; +Function TDataBaseSystem.GetIDbyPath(const Path: String): Integer; +begin + +end; + +Function TDataBaseSystem.GetIDbyFileName(const Filename: String; FolderID: Integer): Integer; +begin + +end; + +Procedure TDataBaseSystem.GetSongData(ID: Integer; var Info: TDBSongInfo); +begin + +end; + +Procedure TDataBaseSystem.SetSongData(ID: Integer; var Info: TDBSongInfo); +begin + +end; + +Function TDataBaseSystem.GetLastChangedbyID(const Song: Integer): Integer; +begin + +end; + +Function TDataBaseSystem.GetLastChangedbyFileName(const Filename: String; FolderID: Integer): Integer; +begin + +end; + + +Function TDataBaseSystem.GetFolderIDbyPath(Path: String): Integer; +begin + +end; + +Function TDataBaseSystem.GetFolderIDbyName(const Name: String; ParentFolder: Integer): Integer; +begin + +end; + + +Function TDataBaseSystem.GetSongList(var List: ASongList; const Filter: ASongListFilter): Integer; +begin + +end; + + end. diff --git a/Game/Code/Classes/UPlaylist.pas b/Game/Code/Classes/UPlaylist.pas index 4f181d73..c05460cf 100644 --- a/Game/Code/Classes/UPlaylist.pas +++ b/Game/Code/Classes/UPlaylist.pas @@ -267,13 +267,13 @@ begin exit; //Hide all Songs - For I := 0 to high(CatSongs.Song) do - CatSongs.Song[I].Visible := False; + {For I := 0 to high(CatSongs.Song) do + CatSongs.Song[I].Visible := False;} //Show Songs in PL For I := 0 to high(PlayLists[Index].Items) do begin - CatSongs.Song[PlayLists[Index].Items[I].SongID].Visible := True; + //CatSongs.Song[PlayLists[Index].Items[I].SongID].Visible := True; end; //Set CatSongsMode + Playlist Mode @@ -335,8 +335,8 @@ Procedure TPlayListManager.DelPlaylist(const Index: Cardinal); var I: Integer; Filename: String; -begin - If Int(Index) > High(Playlists) then +begin // to - do : new Song management + {If Int(Index) > High(Playlists) then Exit; Filename := PlaylistPath + Playlists[Index].Filename; @@ -368,7 +368,7 @@ begin ScreenSong.Interaction := 0; ScreenSong.FixSelected; ScreenSong.ChangeMusic; - end; + end; } end; //---------- @@ -385,8 +385,8 @@ begin P := iPlaylist else exit; - - if (Int(SongID) <= High(CatSongs.Song)) AND (NOT CatSongs.Song[SongID].Main) then + // to - do : new Song management + {if (Int(SongID) <= High(CatSongs.Song)) AND (NOT CatSongs.Song[SongID].Main) then begin Len := Length(Playlists[P].Items); SetLength(Playlists[P].Items, Len + 1); @@ -401,7 +401,7 @@ begin //Correct Display when Editing current Playlist if (CatSongs.CatNumShow = -3) and (P = CurPlaylist) then SetPlaylist(P); - end; + end; } end; //---------- diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index 2693ed48..27c79a71 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -48,7 +48,7 @@ type Length: string; end; - TSong = class + {TSong = class FileLineNo : integer; //Line which is readed at Last, for error reporting procedure ParseNote(LineNumber: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); @@ -111,6 +111,76 @@ type function Analyse(): boolean; function AnalyseXML(): boolean; procedure clear(); + end; } + + AScore = Array[0..4] of TScore; + {******************* + New TSong Class. + Containing some Methods for DB communication + but none for Song laoding, saving, these should be + implemented by child classes + *******************} + TSong = class + protected + SongID: Integer; //ID of this Song in the Song Database + FolderID: Integer; //ID of the Folder containing this Song + FileName: String; //Filename of this Song w/o Path + FullPath: String; //Path + Filename + + Procedure ResetAttributes; virtual; //Reset all Attributes of this object + Procedure ReadHeader; virtual; //Reads Fileheader (Implemented by Child only) + Procedure ReadFile; virtual; //Reads complete File (Header + Notes) (Implemented by Child only) + Procedure WriteFile; virtual; //Writes complete File (Header + Notes) (Implemented by Child only) + Procedure ReadFromDB; virtual; //Reads all available Information from DB + Function CheckDB: Integer; virtual; //Checks DB for Song. Result > 0 SongExists (ID Returned) + Function UpdateDB: Integer; virtual;//Writes all Header Information set in this Song Object to DB. Returns ID (Required when Updated first Time) + public + //Required Information + Title: widestring; + Artist: widestring; + + Mp3: widestring; //Full Path to MP3 + + Text: widestring; + Creator: widestring; + + Resolution: integer; + BPM: array of TBPM; + GAP: real; // in miliseconds + + Base : array[0..1] of integer; + Rel : array[0..1] of integer; + Mult : integer; + MultBPM : integer; + + //Some Files + Cover: widestring; //Full Path to Cover + CoverID: Integer; //ID of Cover in Covers Cache + Background: widestring; //Full Path to BG + Video: widestring; //Full Path to Video + VideoGAP: real; + + + //Additional Information + NotesGAP: integer; + Start: real; // in seconds + Finish: integer; // in miliseconds + Relative: boolean; + + //Sorting + Genre: widestring; + Edition: widestring; + Language: widestring; + + + constructor Create(const Path: String = ''; const FolderID: Integer = 0); + Procedure LoadbyFile(const Path: String); + Procedure LoadbyID(const ID: Integer); + Procedure SavetoFile(const Filename: String = ''); + + Function Score(const Difficulty: Byte): AScore; + + Procedure Clear; end; implementation @@ -121,7 +191,120 @@ uses UMusic, //needed for Lines UMain; //needed for Player -constructor TSong.create( const aFileName : WideString ); +constructor TSong.Create(const Path: String = ''; const FolderID: Integer = 0); +begin + If (Length(Path) > 0) AND (FolderID > 0) then + begin //Read Song Infos from File or DB + FullPath := Path; + FileName := ExtractFileName(Path); + Self.FolderID := FolderID; + SongID := CheckDB; + + If (SongID = 0) then //Check if File has changed + begin + ResetAttributes; + ReadHeader; + SongID := UpdateDB; + //Get CoverID from Covers by Covers.AddCover(Coverscache checks if the Cover requires update + end; + end + else + begin + ResetAttributes; + end; +end; + +Procedure TSong.LoadbyFile(const Path: String); +begin + //Call all Functions to Load From File + //Set Song and Folder ID and Update DB if required + //Get CoverID from Covers by Covers.AddCover(Coverscache checks if the Cover requires update +end; + +Procedure TSong.LoadbyID(const ID: Integer); +begin + //Call all Functions to Load Song by ID + //Read all Information from file + //Get CoverID from Covers by Covers.AddCover(Coverscache checks if the Cover requires update +end; + +Procedure TSong.SavetoFile(const Filename: String = ''); +begin + //Save HeaderInformation and Notes to File. If File = '' use File that was read from +end; + +Function TSong.Score(const Difficulty: Byte): AScore; +begin + //Return Score of Difficulty(0..2) Easy to Difficult +end; + +Procedure TSong.Clear; +begin + ResetAttributes; +end; + +//-------- +// Reset all Attributes of this object +//-------- +Procedure TSong.ResetAttributes; +begin + //to do +end; + +//-------- +// Reads Fileheader (Implemented by Child only) +//-------- +Procedure TSong.ReadHeader; +begin + //Implented in Childs only! +end; + +//-------- +// Reads complete File (Header + Notes) (Implemented by Child only) +//-------- +Procedure TSong.ReadFile; +begin + //Implented in Childs only! +end; + + +//-------- +// Writes complete File (Header + Notes) (Implemented by Child only) +//-------- +Procedure TSong.WriteFile; +begin + //Implented in Childs only! +end; + + +//-------- +// Reads all available Information from DB +//-------- +Procedure TSong.ReadFromDB; +begin + // to- do +end; + + +//-------- +// Checks DB for Song. Result > 0 SongExists (ID Returned) +//-------- +Function TSong.CheckDB: Integer; +begin + // to- do +end; + + +//-------- +// Writes all Header Information set in this Song Object to DB. Returns ID (Required when Updated first Time) +//-------- +Function TSong.UpdateDB: Integer; +begin + // to- do +end; + + +{constructor TSong.create( const aFileName : WideString ); begin Mult := 1; @@ -323,7 +506,7 @@ begin end; Read(SongFile, TempC); Inc(FileLineNo); - end; // while} + end; // while} { for Count := 0 to High(Lines) do begin Lines[Count].Line[High(Lines[Count].Line)].LastLine := True; @@ -667,10 +850,10 @@ begin //Required Attributes //----------- - {$IFDEF UTF8_FILENAMES} + {$IFDEF UTF8_FILENAMES} { if ((Identifier = 'MP3') or (Identifier = 'BACKGROUND') or (Identifier = 'COVER') or (Identifier = 'VIDEO')) then Value := Utf8Encode(Value); - {$ENDIF} + {$ENDIF} { //Title if (Identifier = 'TITLE') then @@ -947,11 +1130,11 @@ begin //Required Information Mp3 := ''; - {$IFDEF FPC} + {$IFDEF FPC} { setlength( BPM, 0 ); - {$ELSE} + {$ELSE} { BPM := nil; - {$ENDIF} + {$ENDIF} { GAP := 0; Start := 0; @@ -1007,6 +1190,6 @@ begin //Read Header Result := self.ReadXMLHeader( FileName ); -end; +end; } end. diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index df748e74..87497b17 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -259,8 +259,8 @@ var Files : TDirectoryEntryArray; lSong : TSong; begin - - Files := Platform.DirectoryFindFiles( Dir, '.txt', true); + // to - do : new Song management + {Files := Platform.DirectoryFindFiles( Dir, '.txt', true); for i := 0 to Length(Files)-1 do begin @@ -282,7 +282,7 @@ begin end; end; SetLength( Files, 0); - + } end; procedure TSongs.BrowseXMLFiles(Dir: widestring); @@ -292,7 +292,7 @@ var lSong : TSong; begin - Files := Platform.DirectoryFindFiles( Dir, '.xml', true); + {Files := Platform.DirectoryFindFiles( Dir, '.xml', true); for i := 0 to Length(Files)-1 do begin @@ -313,7 +313,7 @@ begin end; end; - SetLength( Files, 0); + SetLength( Files, 0); } end; @@ -323,7 +323,7 @@ var S2: integer; TempSong: TSong; begin - case Order of + {case Order of sEdition: // by edition begin for S2 := 0 to SongList.Count -1 do @@ -422,7 +422,7 @@ begin end; end; - end; // case + end; // case } end; function TSongs.FindSongFile(Dir, Mask: widestring): widestring; @@ -449,7 +449,7 @@ begin CatNumShow := -1; // Songs.Sort(0); // by title -case Ini.Sorting of +{case Ini.Sorting of sEdition: begin Songs.Sort(sArtist); Songs.Sort(sEdition); @@ -514,7 +514,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); @@ -541,7 +541,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); //CatNumber Patch @@ -567,7 +567,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); //CatNumber Patch @@ -597,7 +597,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -625,7 +625,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -651,7 +651,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); //CatNumber Patch @@ -680,7 +680,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -710,7 +710,7 @@ case Ini.Sorting of {// cover-patch if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} + else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}{ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -719,7 +719,7 @@ case Ini.Sorting of Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy CatNumber := 0; end; - + CatSongs.Song[CatLen].Visible := true; end; end; @@ -744,45 +744,45 @@ case Ini.Sorting of if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy //CatCount Patch -CatCount := Order; +CatCount := Order; } end; procedure TCatSongs.ShowCategory(Index: integer); var S: integer; // song -begin - CatNumShow := Index; +begin // to - do : new Song management + { CatNumShow := Index; 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 CatSongs.Song[S].Visible := false; - end; + end; } end; procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category var S: integer; // song -begin - for S := 0 to high(CatSongs.Song) do begin +begin // to - do : new Song management + {for S := 0 to high(CatSongs.Song) do begin if not CatSongs.Song[S].Main then CatSongs.Song[S].Visible := false // hides all at now - end; + end; } end; procedure TCatSongs.ClickCategoryButton(Index: integer); var Num, S: integer; begin - Num := CatSongs.Song[Index].OrderNum; + { Num := CatSongs.Song[Index].OrderNum; if Num <> CatNumShow then begin ShowCategory(Num); end else begin ShowCategoryList; - end; + end; } end; //Hide Categorys when in Category Hack @@ -790,7 +790,7 @@ procedure TCatSongs.ShowCategoryList; var Num, S: integer; begin - //Hide All Songs Show All Cats + {//Hide All Songs Show All Cats for S := 0 to high(CatSongs.Song) do begin if CatSongs.Song[S].Main then CatSongs.Song[S].Visible := true @@ -798,7 +798,7 @@ begin CatSongs.Song[S].Visible := false end; CatSongs.Selected := CatNumShow; //Show last shown Category - CatNumShow := -1; + CatNumShow := -1; } end; //Hide Categorys when in Category Hack End @@ -808,7 +808,7 @@ var I: Integer; begin Result := -1; - I := SearchFrom + 1; + I := SearchFrom + 1; { while not CatSongs.Song[I].Visible do begin Inc (I); @@ -816,7 +816,7 @@ var I := low(CatSongs.Song); if (I = SearchFrom) then //Make One Round and no song found->quit break; - end; + end; } end; //Wrong song selected when tabs on bug End @@ -825,8 +825,8 @@ var S: integer; // song begin Result := 0; - for S := 0 to high(CatSongs.Song) do - if CatSongs.Song[S].Visible = true then Inc(Result); + {for S := 0 to high(CatSongs.Song) do + if CatSongs.Song[S].Visible = true then Inc(Result); } end; function TCatSongs.VisibleIndex(Index: integer): integer; @@ -834,8 +834,8 @@ var S: integer; // song begin Result := 0; - for S := 0 to Index-1 do - if CatSongs.Song[S].Visible = true then Inc(Result); + {for S := 0 to Index-1 do + if CatSongs.Song[S].Visible = true then Inc(Result); } end; function TCatSongs.SetFilter(FilterStr: String; const fType: Byte): Cardinal; @@ -847,7 +847,7 @@ begin {fType: 0: All 1: Title 2: Artist} - FilterStr := Trim(FilterStr); + {FilterStr := Trim(FilterStr); if FilterStr<>'' then begin Result := 0; //Create Search Array @@ -893,9 +893,9 @@ begin for i:=0 to High(Song) do begin Song[i].Visible:=(Ini.Tabs=1)=Song[i].Main; CatNumShow := -1; - end; + end; } Result := 0; - end; + {end; } end; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index bf479c41..51fd6ebc 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -128,10 +128,11 @@ begin 'S': begin // Save Song - if SDL_ModState = KMOD_LSHIFT then + // to - do : new Song management + {if SDL_ModState = KMOD_LSHIFT then SaveSong(CurrentSong, Lines[0], CurrentSong.Path + CurrentSong.FileName, true) else - SaveSong(CurrentSong, Lines[0], CurrentSong.Path + CurrentSong.FileName, false); + SaveSong(CurrentSong, Lines[0], CurrentSong.Path + CurrentSong.FileName, false);} {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then // Save Song @@ -1169,14 +1170,14 @@ begin ResetSingTemp; - try + {try // to - do : new Song management //Check if File is XML if copy(CurrentSong.FileName,length(CurrentSong.FileName)-3,4) = '.xml' then Error := not CurrentSong.LoadXMLSong() else Error := not CurrentSong.LoadSong(); - except + except } Error := True; - end; + //end; if Error then begin @@ -1199,8 +1200,8 @@ begin Lines[0].Current := 0; CurrentNote := 0; Lines[0].Line[0].Note[0].Color := 1; - - AudioPlayback.Open(CurrentSong.Path + CurrentSong.Mp3); + // to - do : new Song management + AudioPlayback.Open({CurrentSong.Path + }CurrentSong.Mp3); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(40); diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index bd05e653..52e1671f 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -98,12 +98,12 @@ begin PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} - + // to - do : new Song management //Save Playlist PlaylistMan.Mode := TSingMode( Playlist ); PlaylistMan.CurPlayList := High(Cardinal); //If Category Selected Search Category ID - if Playlist = 1 then + {if Playlist = 1 then begin J := -1; For I := 0 to high(CatSongs.Song) do @@ -123,7 +123,7 @@ begin Exit; end else - PlaylistMan.CurPlayList := Playlist2; + PlaylistMan.CurPlayList := Playlist2;} //Start Party // to-do : Party @@ -216,7 +216,7 @@ end; procedure TScreenPartyOptions.SetPlaylist2; var I: Integer; -begin +begin // to - do : new Song management Case Playlist of 0: begin @@ -226,14 +226,14 @@ begin 1: begin SetLength(IPlaylist2, 0); - For I := 0 to high(CatSongs.Song) do + {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; } If (Length(IPlaylist2) = 0) then begin @@ -243,16 +243,16 @@ begin end; 2: begin - if (Length(PlaylistMan.Playlists) > 0) then + {if (Length(PlaylistMan.Playlists) > 0) then begin SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); PlaylistMan.GetNames(IPlaylist2); end else - begin + begin} SetLength(IPlaylist2, 1); IPlaylist2[0] := 'No Playlists found'; - end; + //end; end; end; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 859aeb52..5b185200 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -222,9 +222,9 @@ begin // pause Music AudioPlayback.Pause; - // pause Video - if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then - fCurrentVideoPlaybackEngine.Pause; + // pause Video // to - do : new Song management + {if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then + fCurrentVideoPlaybackEngine.Pause;} end else //disable Pause @@ -239,9 +239,9 @@ begin // Play Music AudioPlayback.Play; - // Video - if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then - fCurrentVideoPlaybackEngine.Pause; + // Video // to - do : new Song management + {if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then + fCurrentVideoPlaybackEngine.Pause; } Paused := false; end; @@ -461,14 +461,14 @@ begin CurrentSong := CatSongs.Song[CatSongs.Selected]; // FIXME: bad style, put the try-except into LoadSong() and not here - try + {try // to - do : new Song management //Check if File is XML if copy(CurrentSong.FileName,length(CurrentSong.FileName)-3,4) = '.xml' then success := CurrentSong.LoadXMLSong() else success := CurrentSong.LoadSong(); - except + except } success := false; - end; + //end; if (not success) then begin @@ -479,7 +479,7 @@ begin ScreenSong.SelectRandomSong(); ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); // FIXME: do we need this? - CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; + //CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; Exit; end; @@ -492,8 +492,8 @@ begin fCurrentVideoPlaybackEngine.Close; fCurrentVideoPlaybackEngine := VideoPlayback; - // set movie - CurrentSong.VideoLoaded := false; + // set movie // to - do : new Song management + {CurrentSong.VideoLoaded := false; fShowVisualization := false; if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin @@ -504,14 +504,14 @@ begin fCurrentVideoPlaybackEngine.position := CurrentSong.VideoGAP + CurrentSong.Start; CurrentSong.VideoLoaded := true; - end; + end; } // set background - if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = false) then + if (CurrentSong.Background <> '') { and (CurrentSong.VideoLoaded = false)} then try - Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); + Tex_Background := Texture.LoadTexture({CurrentSong.Path + }CurrentSong.Background); except - log.LogError('Background could not be loaded: ' + CurrentSong.Path + CurrentSong.Background); + log.LogError('Background could not be loaded: ' + {CurrentSong.Path + }CurrentSong.Background); Tex_Background.TexNum := -1; end else @@ -914,8 +914,8 @@ end; procedure TScreenSing.onShowFinish; begin // play movie (II) - - if CurrentSong.VideoLoaded then + // to - do : new Song management + {if CurrentSong.VideoLoaded then begin try fCurrentVideoPlaybackEngine.GetFrame(LineState.CurrentTime); @@ -939,7 +939,7 @@ begin end; end; end; - end; + end; } // play music (II) @@ -1184,8 +1184,8 @@ begin SingDrawBackground; // update and draw movie - if ShowFinish and - ( CurrentSong.VideoLoaded or fShowVisualization ) then + if ShowFinish and // to - do : new Song management + ( {CurrentSong.VideoLoaded or }fShowVisualization ) then // if ShowFinish then begin // try @@ -1303,13 +1303,13 @@ begin Log.BenchmarkEnd(0); Log.LogBenchmark('Creating files', 0); end; - - if CurrentSong.VideoLoaded then + // to - do : new Song management + {if CurrentSong.VideoLoaded then begin // CloseSmpeg; fCurrentVideoPlaybackEngine.Close; CurrentSong.VideoLoaded := false; // to prevent drawing closed video - end; + end; } SetFontItalic (False); end; diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index aab4dd2a..aed13212 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -148,7 +148,7 @@ uses UGraphic, procedure TScreenSong.FixSelected; var I, I2: Integer; begin - if CatSongs.VisibleSongs > 0 then + {if CatSongs.VisibleSongs > 0 then begin I2:= 0; for I := low(CatSongs.Song) to High(Catsongs.Song) do @@ -162,13 +162,13 @@ var I, I2: Integer; SongCurrent := I2; SongTarget := I2; - end; + end; } end; procedure TScreenSong.FixSelected2; var I, I2: Integer; - begin - if CatSongs.VisibleSongs > 0 then + begin // to - do : new Song management + { if CatSongs.VisibleSongs > 0 then begin I2:= 0; for I := low(CatSongs.Song) to High(Catsongs.Song) do @@ -181,7 +181,7 @@ var I, I2: Integer; end; SongTarget := I2; - end; + end;} end; //Show Wrong Song when Tabs on Fix End @@ -266,7 +266,7 @@ begin begin For I := 1 to high(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + {if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) AND (WideUpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1] = Letter) then begin @@ -279,15 +279,15 @@ begin //UpdateLCD; //TODO: maybe LCD Support as Plugin? //Break and Exit Exit; - end; + end; } end; end //Jump to Artist else if (SDL_ModState = KMOD_LALT) then begin For I := 1 to high(CatSongs.Song) do - begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND + begin // to - do : new Song management + {if (CatSongs.Song[(I + Interaction) mod I2].Visible) AND (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) AND (WideUpperCase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1] = Letter) then begin @@ -301,7 +301,7 @@ begin //Break and Exit Exit; - end; + end; } end; end; end; @@ -320,8 +320,8 @@ begin 'M': //Show SongMenu begin if (Songs.SongList.Count > 0) then begin - if (Mode = smNormal) then begin - if not CatSongs.Song[Interaction].Main then begin // clicked on Song + if (Mode = smNormal) then begin // to - do : new Song management + {if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then ScreenSongMenu.MenuShow(SM_Playlist) else @@ -330,7 +330,7 @@ begin else begin ScreenSongMenu.MenuShow(SM_Playlist_Load); - end; + end;} end //Party Mode -> Show Party Menu else ScreenSongMenu.MenuShow(SM_Party_Main); end; @@ -366,16 +366,16 @@ begin if (SDL_ModState = KMOD_LSHIFT) AND (Ini.Tabs_at_startup = 1) then //Random Category begin - I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do - if CatSongs.Song[I].Main then Inc(I2); + I2 := 0; //Count Cats // to - do : new Song management + {for I:= low(CatSongs.Song) to high (CatSongs.Song) do + if CatSongs.Song[I].Main then Inc(I2);} I2 := Random (I2)+1; //Zufall //Find Cat: for I:= low(CatSongs.Song) to high (CatSongs.Song) do begin - if CatSongs.Song[I].Main then + {if CatSongs.Song[I].Main then Dec(I2); if (I2<=0) then begin @@ -389,23 +389,23 @@ begin SelectNext; FixSelected; break; - end; - end; + end; } + end; // to - do : new Song management end else if (SDL_ModState = KMOD_LCTRL) AND (Ini.Tabs_at_startup = 1) then //random in All Categorys begin - repeat + {repeat I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; + until CatSongs.Song[I2].Main = false; } //Search Cat - for I := I2 downto low(CatSongs.Song) do + {for I := I2 downto low(CatSongs.Song) do begin if CatSongs.Song[I].Main then break; - end; + end; } //In I is now the categorie in I2 the song //Choose Cat @@ -450,12 +450,12 @@ begin begin //Find Category I := Interaction; - while not catsongs.Song[I].Main do + {while not catsongs.Song[I].Main do begin Dec (I); if (I < low(catsongs.Song)) then break; - end; + end; } if (I<= 1) then Interaction := high(catsongs.Song) else @@ -518,8 +518,8 @@ begin begin {$IFDEF UseSerialPort} // PortWriteB($378, 0); - {$ENDIF} - if CatSongs.Song[Interaction].Main then + {$ENDIF} // to - do : new Song management + {if CatSongs.Song[Interaction].Main then begin // clicked on Category Button //Show Cat in Top Left Mod @@ -535,7 +535,7 @@ begin // SetScroll4; //Show Wrong Song when Tabs on Fix - SelectNext; +{ SelectNext; FixSelected; //Play Music: @@ -565,7 +565,7 @@ begin else ScreenSong.StartSong; end; - end; + end; } end; end; @@ -582,12 +582,12 @@ begin I := Interaction; if I <= 0 then I := 1; - while not catsongs.Song[I].Main do + {while not catsongs.Song[I].Main do begin Inc (I); if (I > high(catsongs.Song)) then I := low(catsongs.Song); - end; + end; } Interaction := I; @@ -623,14 +623,14 @@ begin I2 := 0; if I <= 0 then I := 1; - while not catsongs.Song[I].Main or (I2 = 0) do + {while not catsongs.Song[I].Main or (I2 = 0) do begin if catsongs.Song[I].Main then Inc(I2); Dec (I); if (I < low(catsongs.Song)) then I := high(catsongs.Song); - end; + end; } Interaction := I; @@ -808,30 +808,30 @@ begin // new Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + if not FileExists({CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover) then CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - + // to - do : new Song management if CatSongs.Song[Pet].Cover = '' then AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) else begin // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + if not Covers.CoverExists({CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover) then begin Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.GetTexture({CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap Texture.CreateCacheMipmap := false; // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + Covers.AddCover({CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover); // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + Texture.UnloadTexture({CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover, false); // we should also add mipmap texture by calling createtexture and use mipmap cache as data source end; // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + AddButton(300 + Pet*250, 140, 200, 200,{ CatSongs.Song[Pet].Path + }CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); end; Texture.Limit := 1024*1024; I := -1; @@ -898,7 +898,7 @@ begin //Set Texts: Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; Text[TextTitle].Text := CatSongs.Song[Interaction].Title; - if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then + {if (Ini.Tabs_at_startup = 1) And (CatSongs.CatNumShow = -1) then begin Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; @@ -910,15 +910,15 @@ begin else if (Ini.Tabs_at_startup = 1) then Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) else - Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song));} end else begin Text[TextNumber].Text := '0/0'; Text[TextArtist].Text := ''; Text[TextTitle].Text := ''; - for B := 0 to High(Button) do - Button[B].Visible := False; + {for B := 0 to High(Button) do + Button[B].Visible := False; } end; end; @@ -946,12 +946,12 @@ begin Placed := 0; VisCount := 0; - for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); + {for B := 0 to High(Button) do + if CatSongs.Song[B].Visible then Inc(VisCount);} VisInt := 0; - for B := 0 to Interaction-1 do - if CatSongs.Song[B].Visible then Inc(VisInt); + {for B := 0 to Interaction-1 do + if CatSongs.Song[B].Visible then Inc(VisInt); } if VisCount <= 6 then begin @@ -976,11 +976,11 @@ begin end; - + // to - do : new Song management // hide all buttons for B := 0 to High(Button) do begin Button[B].Visible := false; - Button[B].Selectable := CatSongs.Song[B].Visible; + //Button[B].Selectable := CatSongs.Song[B].Visible; end; { for B := Src to Dst do begin @@ -991,7 +991,7 @@ begin end;} - if Typ = 0 then begin + {if Typ = 0 then begin for B := 0 to High(Button) do begin if CatSongs.Song[B].Visible then begin Button[B].Visible := true; @@ -999,9 +999,9 @@ begin Inc(Placed); end; end; - end; + end; } - if Typ = 1 then begin + {if Typ = 1 then begin B := 0; while (Count > 0) do begin if CatSongs.Song[B].Visible then begin @@ -1012,9 +1012,9 @@ begin end; Inc(B); end; - end; + end; } - if Typ = 2 then begin + {if Typ = 2 then begin B := High(Button); while (Count > 0) do begin if CatSongs.Song[B].Visible then begin @@ -1056,7 +1056,7 @@ begin end; if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture + Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture } end; procedure TScreenSong.SetScroll2; @@ -1065,7 +1065,7 @@ var // Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu // Auto Removed, Unused Variable // Wsp2: real; // Auto Removed, Unused Variable begin - // liniowe + {// liniowe for B := 0 to High(Button) do Button[B].X := 300 + (B - Interaction) * 260; @@ -1092,7 +1092,7 @@ var // Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu // Auto Removed, Unused Variable // Wsp2: real; // Auto Removed, Unused Variable begin - SongTarget := Interaction; + {SongTarget := Interaction; // liniowe for B := 0 to High(Button) do @@ -1128,7 +1128,7 @@ var Z, Z2: real; VS: integer; begin - VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important + {VS := CatSongs.VisibleSongs; // 0.5.0 (I): cached, very important // kolowe for B := 0 to High(Button) do begin @@ -1136,7 +1136,7 @@ begin if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - +{ Z := (1 + cos(Wsp)) / 2; Z2 := (1 + 2*Z) / 3; @@ -1146,11 +1146,11 @@ begin Button[B].W := Theme.Song.Cover.H * Z2; -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; +// Button[B].Y := {50 +}{ 140 + 50 - 50 * Z2; +{ Button[B].Y := Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; Button[B].H := Button[B].W; end; - end; + end;} end; (* @@ -1246,7 +1246,7 @@ var X: Real; helper: real; begin - VS := CatSongs.VisibleSongs; // cache Visible Songs + {VS := CatSongs.VisibleSongs; // cache Visible Songs {Vars Theme.Song.CoverW: Radius des Kreises Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers @@ -1254,7 +1254,7 @@ begin Theme.Song.CoverH: Höhe der Cover (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Distance to middle Cover in % - } + }{ //Change Pos of all Buttons for B := low(Button) to high(Button) do @@ -1268,7 +1268,7 @@ begin else if (Pos > VS/2) then Pos := Pos - VS; - if (Abs(Pos) < 2.5) then {fixed Positions} + if (Abs(Pos) < 2.5) then {fixed Positions} { begin Angle := Pi * (Pos / 5); // Button[B].Visible := False; @@ -1293,7 +1293,7 @@ begin end else - begin {Behind the Front Covers} + begin {Behind the Front Covers} { // limit-bg-covers hack if (abs(abs(Pos)-VS/2)>10) then Button[B].Visible:=False; @@ -1334,7 +1334,7 @@ begin // Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Button[B].H) * 0.7); end; - end; + end; } end; procedure TScreenSong.SetScroll6; // rotate (slotmachine style) @@ -1348,7 +1348,7 @@ var Wsp: real; Z, Z2: real; begin - VS := CatSongs.VisibleSongs; // cache Visible Songs + {VS := CatSongs.VisibleSongs; // cache Visible Songs if VS <=5 then begin // kolowe for B := 0 to High(Button) do @@ -1357,7 +1357,7 @@ begin if Button[B].Visible then begin // 0.5.0 optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed Wsp := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - + { Z := (1 + cos(Wsp)) / 2; Z2 := (1 + 2*Z) / 3; @@ -1367,9 +1367,9 @@ begin Button[B].W := Theme.Song.Cover.H * Z2; -// Button[B].Y := {50 +} 140 + 50 - 50 * Z2; +// Button[B].Y := {50 +}{ 140 + 50 - 50 * Z2; Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; + Button[B].H := Button[B].W; { end; end; end @@ -1387,7 +1387,7 @@ begin else if (Pos > VS/2) then Pos := Pos - VS; - if (Abs(Pos) < 2.5) then {fixed Positions} + if (Abs(Pos) < 2.5) then {fixed Positions} { begin Angle := Pi * (Pos / 5); // Button[B].Visible := False; @@ -1410,7 +1410,7 @@ begin Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; end else - begin {Behind the Front Covers} + begin {Behind the Front Covers} { // limit-bg-covers hack if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; @@ -1439,7 +1439,7 @@ begin end; end; end; - end; + end; } end; @@ -1465,8 +1465,8 @@ begin if Length(CatSongs.Song) > 0 then begin //Load Music only when Song Preview is activated if ( Ini.PreviewVolume <> 0 ) then - begin - if(AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3)) then + begin // to - do : new Song management + if(AudioPlayback.Open({CatSongs.Song[Interaction].Path + }CatSongs.Song[Interaction].Mp3)) then begin AudioPlayback.SetLoop(false); AudioPlayback.Position := AudioPlayback.Length / 4; @@ -1520,8 +1520,8 @@ begin AudioPlayback.SetMusicVolume(100); //If Preview is deactivated: Load MUsicfile now - If (Ini.PreviewVolume = 0) then - AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + If (Ini.PreviewVolume = 0) then // to - do : new Song management + AudioPlayback.Open({Song[Interaction].Path + } CatSongs.Song[Interaction].Mp3); //When hide then Stop Music (For Party Mode Popup on Exit) if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) and (AudioPlayback <> nil) then @@ -1577,9 +1577,9 @@ begin Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, 'Plain', false); Button[Interaction].Texture2.Alpha := 1; end; - + // to - do : new Song management //Song Fade - if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) AND (Not CatSongs.Song[Interaction].Main) AND (Ini.PreviewFading <> 0) then + if (CatSongs.VisibleSongs > 0) AND (Ini.PreviewVolume <> 0) {AND (Not CatSongs.Song[Interaction].Main)} AND (Ini.PreviewFading <> 0) then begin //Start Song Fade after a little Time, to prevent Song to be Played on Scrolling if (CoverTime < 0.2) and (CoverTime + TimeSkip >= 0.2) then @@ -1648,9 +1648,9 @@ begin Skip := 1; // this 1 could be changed by CatSongs.FindNextVisible - while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); + {while (not CatSongs.Song[(Interaction + Skip) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget + 1;//Skip; + }SongTarget := SongTarget + 1;//Skip; Interaction := (Interaction + Skip) mod Length(Interactions); @@ -1679,8 +1679,8 @@ begin Skip := 1; - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); - SongTarget := SongTarget - 1;//Skip; + {while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + }SongTarget := SongTarget - 1;//Skip; Interaction := (Interaction - Skip + Length(Interactions)) mod Length(Interactions); @@ -1711,7 +1711,7 @@ begin //When Music Preview is avtivated -> then Change Music if (Ini.PreviewVolume <> 0) then begin - if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then + {if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then begin AudioPlayback.Close; if AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin @@ -1724,7 +1724,7 @@ begin end; end else - AudioPlayback.Stop; + AudioPlayback.Stop; } end; end; @@ -1864,17 +1864,17 @@ begin begin //When Tabs are activated then use Tab Method if (Ini.Tabs_at_startup = 1) then - begin - repeat + begin // to - do : new Song management + {repeat I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; + until CatSongs.Song[I2].Main = false;} //Search Cat - for I := I2 downto low(CatSongs.Song) do + {for I := I2 downto low(CatSongs.Song) do begin if CatSongs.Song[I].Main then break; - end; + end; } //In I ist jetzt die Kategorie in I2 der Song //I is the CatNum, I2 is the No of the Song within this Cat @@ -2052,14 +2052,14 @@ begin end; procedure TScreenSong.OpenEditor; -begin - if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then +begin // to - do : new Song management + {if (Songs.SongList.Count > 0) and (not CatSongs.Song[Interaction].Main) AND (Mode = smNormal) then begin AudioPlayback.Stop; AudioPlayback.PlaySound(SoundLib.Start); CurrentSong := CatSongs.Song[Interaction]; FadeTo(@ScreenEditSub); - end; + end; } end; //Team No of Team (0-5) diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index 6893391c..4b3356dc 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -101,26 +101,26 @@ begin //ReadScore(CurrentSong); PMax := Ini.Players; - if Ini.Players = 4 then Ini.Players := 5; - for I := 0 to PMax do + if Ini.Players = 4 then Ini.Players := 5; // to - do : new Song management + {for I := 0 to PMax do DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalI)); DataBase.WriteScore(CurrentSong); - DataBase.ReadScore(CurrentSong); + DataBase.ReadScore(CurrentSong); } Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; - for I := 1 to Length(CurrentSong.Score[Ini.Difficulty]) do begin + for I := 1 to Length(CurrentSong.Score(Ini.Difficulty)) do begin Static[StaticNumber[I]].Visible := true; Text[TextNumber[I]].Visible := true; Text[TextName[I]].Visible := true; Text[TextScore[I]].Visible := true; - Text[TextName[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Name; - Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); + Text[TextName[I]].Text := CurrentSong.Score(Ini.Difficulty)[I-1].Name; + Text[TextScore[I]].Text := IntToStr(CurrentSong.Score(Ini.Difficulty) [I-1].Score); end; - for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do begin + for I := Length(CurrentSong.Score(Ini.Difficulty))+1 to 5 do begin Static[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; Text[TextName[I]].Visible := false; -- cgit v1.2.3