From 22581815288ed2462063a8ac36e3818f95adfda2 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 15 Aug 2010 16:44:17 +0000 Subject: added check popup at startup if LoadFaultySongs=Off and if there are some defective songs. the user has now the ability to load them anyway. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2611 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 10 +++++++--- Game/Code/Classes/USongs.pas | 6 ++++++ Game/Code/Screens/UScreenMain.pas | 7 +++---- Game/Code/Screens/UScreenPopup.pas | 24 ++++++++++++++++++++++-- Game/Output/Languages/Dutch.ini | 1 + Game/Output/Languages/English.ini | 3 +++ Game/Output/Languages/German.ini | 9 ++++++--- Game/Output/Languages/Italian.ini | 1 + Game/Output/Languages/Languages.xls | Bin 204800 -> 205312 bytes 9 files changed, 49 insertions(+), 12 deletions(-) (limited to 'Game') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index a8fa8076..16ff7c63 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -49,8 +49,10 @@ var // variables available for all procedures Base: array[0..1] of integer; Rel: array[0..1] of integer; - Mult: integer = 1; - MultBPM: integer = 4; + Mult: integer = 1; + MultBPM: integer = 4; + + CheckOK: boolean; implementation uses TextGL, UIni, UMain; @@ -805,6 +807,7 @@ var isNewSentence: boolean; begin Result := false; + CheckOK := true; if not FileExists(Name) then begin Log.LogError('File not found: "' + Name + '"', 'LoadSong'); @@ -1028,7 +1031,8 @@ begin exit; end; - Result := CheckSong; + CheckOK := CheckSong; + Result := CheckOK; end; //-------------------- diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index d622f2f2..5a579474 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -92,6 +92,7 @@ type Song: array of TSong; // array of songs SongSort: array of TSong; Selected: integer; // selected song index + NumFaultySongs: integer; procedure LoadSongList; // load all songs procedure BrowseDir(Dir: string); // should return number of songs in the future procedure Sort(Order: integer); @@ -135,6 +136,7 @@ begin // clear Setlength(Song, 50); + NumFaultySongs := 0; BrowsePos := 0; // browse directories @@ -179,9 +181,13 @@ begin AktSong := Song[SLen]; res := LoadSong(Song[SLen].Path + Song[SLen].FileName, SONG_LOAD_NOTES); //TODO Hash? + if not CheckOK then + inc(NumFaultySongs); + if res then begin Song[SLen]:=AktSong; + //Medley and Duet - is it possible? Perhaps later... if not AktSong.isDuet then FindRefrainStart(Song[SLen]) diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 156901e2..b92e59a2 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -261,7 +261,7 @@ begin AddButton(Theme.Main.ButtonExit); Interaction := 0; - ShowNumErrors := false; + ShowNumErrors := true; end; procedure TScreenMain.onShow; @@ -274,10 +274,9 @@ begin if not Help.SetHelpID(ID) then Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenMain)'); - if ShowNumErrors then + if (Ini.LoadFaultySongs=0) and ShowNumErrors and (Songs.NumFaultySongs>0) then begin - ShowNumErrors := false; - ScreenPopupError.ShowPopup(IntToStr(Log.NumErrors) + ' errors on loading, see Error.log for details'); + ScreenPopupCheck.ShowPopup(Format(Language.Translate('MSG_ERROR_SONGLOADING'), [Songs.NumFaultySongs])); end; end; diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index e7d6ce00..aaed32ed 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -85,7 +85,7 @@ var implementation -uses Classes, TextGL, UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; +uses Classes, TextGL, UGraphic, USongs, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -121,11 +121,31 @@ begin ScreenSingModi.Finish; end; - Display.CheckOK:=True; + //Hack to load faulty songs in main screen + if (Display.NextScreenWithCheck = NIL) then + begin + if (Display.ActualScreen = @ScreenMain) and (ScreenMain.ShowNumErrors) then + begin + Ini.LoadFaultySongs := 1; + Songs.LoadSongList(); + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens( true ); + ScreenSong.Refresh(true); + PlaylistMan.LoadPlayLists; + Ini.LoadFaultySongs := 0; + ScreenMain.ShowNumErrors := false; + FadeTo(@ScreenMain); + end else + Display.CheckOK:=True; + end else + Display.CheckOK:=True; end; 1: begin Display.CheckOK:=False; Display.NextScreenWithCheck:=NIL; + + if (Display.ActualScreen = @ScreenMain) and (ScreenMain.ShowNumErrors) then + ScreenMain.ShowNumErrors := false; end; end; Visible:=False; diff --git a/Game/Output/Languages/Dutch.ini b/Game/Output/Languages/Dutch.ini index 24177e9c..74def31d 100644 --- a/Game/Output/Languages/Dutch.ini +++ b/Game/Output/Languages/Dutch.ini @@ -11,6 +11,7 @@ IMPLODE_GLUE2 = en INFO_FILE_SAVED = Bestand Opgeslagen MSG_END_PARTY = Party modus afsluiten? MSG_ERROR_TITLE = FOUT! +MSG_ERROR_SONGLOADING = Found %0:d defective songs! Load them anyway? Details on Error.log MSG_HELP_KEYMAP = Sneltoetsen MSG_HELP_TITLE = Help-Systeem MSG_QUESTION_TITLE = Vraag diff --git a/Game/Output/Languages/English.ini b/Game/Output/Languages/English.ini index 117852c0..fede3397 100644 --- a/Game/Output/Languages/English.ini +++ b/Game/Output/Languages/English.ini @@ -11,6 +11,7 @@ IMPLODE_GLUE2 = and INFO_FILE_SAVED = File saved MSG_END_PARTY = Are you sure you want to leave party mode? MSG_ERROR_TITLE = Error: +MSG_ERROR_SONGLOADING = Found %0:d defective songs! Load them anyway? Details on Error.log MSG_HELP_KEYMAP = Key Mapping MSG_HELP_TITLE = Help MSG_QUESTION_TITLE = Question: @@ -1413,3 +1414,5 @@ PAGEDOWN = Decrease song volume #-------------------------------------------------------# # ID_034: ScreenSongMenu Medley # #-------------------------------------------------------# + + diff --git a/Game/Output/Languages/German.ini b/Game/Output/Languages/German.ini index 8268297f..e6b3d11d 100644 --- a/Game/Output/Languages/German.ini +++ b/Game/Output/Languages/German.ini @@ -11,6 +11,7 @@ IMPLODE_GLUE2 = und INFO_FILE_SAVED = Datei gespeichert MSG_END_PARTY = Party-Modus beenden? MSG_ERROR_TITLE = Fehler +MSG_ERROR_SONGLOADING = %0:d fehlerhafte Songs gefunden! Diese trotzdem laden? Details siehe Error.log MSG_HELP_KEYMAP = Tastenbelegung MSG_HELP_TITLE = Hilfe-System MSG_QUESTION_TITLE = Frage @@ -1233,8 +1234,8 @@ SEC_001 = Allgemein RETURN = Aktuelles Lied singen TAB = Hilfe öffnen/schließen PRINT = Screenshot erstellen -BACKSPACE = -ESC = +BACKSPACE = zurück +ESC = zurück Q = UltraStar Deluxe beenden #-------------------------------------------------------# SEC_010 = Songauswahl @@ -1412,4 +1413,6 @@ PAGEUP = MP3-Lautst PAGEDOWN = MP3-Lautstärke reduzieren #-------------------------------------------------------# # ID_034: ScreenSongMenu Medley # -#-------------------------------------------------------# \ No newline at end of file +#-------------------------------------------------------# + + diff --git a/Game/Output/Languages/Italian.ini b/Game/Output/Languages/Italian.ini index a4a36fdd..b304b4a0 100644 --- a/Game/Output/Languages/Italian.ini +++ b/Game/Output/Languages/Italian.ini @@ -11,6 +11,7 @@ IMPLODE_GLUE2 = e INFO_FILE_SAVED = File salvato MSG_END_PARTY = Vuoi davvero uscire dal Party? MSG_ERROR_TITLE = Errore +MSG_ERROR_SONGLOADING = Found %0:d defective songs! Load them anyway? Details on Error.log MSG_HELP_KEYMAP = Key mapping MSG_HELP_TITLE = Help-System MSG_QUESTION_TITLE = Domanda diff --git a/Game/Output/Languages/Languages.xls b/Game/Output/Languages/Languages.xls index 2b193059..7dc60d29 100644 Binary files a/Game/Output/Languages/Languages.xls and b/Game/Output/Languages/Languages.xls differ -- cgit v1.2.3