From 528d8cd40ec3763bb3018da4829803404d1cd04b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 9 Oct 2008 17:57:10 +0000 Subject: Errormessages during songload now translatable German and English translations updated Added four new language strings: ERROR_CORRUPT_SONG_FILE_NOT_FOUND ERROR_CORRUPT_SONG_NO_NOTES ERROR_CORRUPT_SONG_NO_BREAKS ERROR_CORRUPT_SONG_UNKNOWN_IN_LINE git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1443 b956fd51-792f-4845-bead-9b4dfca2ff2c --- game/languages/English.ini | 6 +++++- game/languages/German.ini | 6 +++++- src/base/USong.pas | 19 +++++++++++++++---- src/screens/UScreenSing.pas | 6 +++++- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/game/languages/English.ini b/game/languages/English.ini index 3ab987fd..e69ead4a 100644 --- a/game/languages/English.ini +++ b/game/languages/English.ini @@ -303,4 +303,8 @@ MSG_QUIT_USDX=Really leave UltraStar? MSG_END_PARTY=Really end Party Mode? ERROR_NO_SONGS=No Songs loaded ERROR_NO_PLUGINS=No Plugins loaded -ERROR_CORRUPT_SONG=Song could not be loaded. \ No newline at end of file +ERROR_CORRUPT_SONG=Song could not be loaded. +ERROR_CORRUPT_SONG_FILE_NOT_FOUND=Song could not be loaded: File not found +ERROR_CORRUPT_SONG_NO_NOTES=Song could not be loaded: Can''t find any notes +ERROR_CORRUPT_SONG_NO_BREAKS=Song could not be loaded: Can''t find any linebreaks +ERROR_CORRUPT_SONG_UNKNOWN_IN_LINE=Song could not be loaded: Error parsing line %0:d \ No newline at end of file diff --git a/game/languages/German.ini b/game/languages/German.ini index 1db702dc..f6e573d8 100644 --- a/game/languages/German.ini +++ b/game/languages/German.ini @@ -304,4 +304,8 @@ MSG_QUIT_USDX=UltraStar wirklich verlassen? MSG_END_PARTY=Party-Modus beenden? ERROR_NO_SONGS=Keine Songs vorhanden. ERROR_NO_PLUGINS=Keine Plugins vorhanden. -ERROR_CORRUPT_SONG=Song konnte nicht geladen werden. \ No newline at end of file +ERROR_CORRUPT_SONG=Song konnte nicht geladen werden. +ERROR_CORRUPT_SONG_FILE_NOT_FOUND=Song konnte nicht geladen werden: Datei wurde nicht gefunden. +ERROR_CORRUPT_SONG_NO_NOTES=Song konnte nicht geladen werden: Es wurden keine Noten gefunden. +ERROR_CORRUPT_SONG_NO_BREAKS=Song konnte nicht geladen werden: Es wurden keine Satzwechsel gefunden. +ERROR_CORRUPT_SONG_UNKNOWN_IN_LINE=Song konnte nicht geladen werden: Fehler beim parsen der Zeile %0:d \ No newline at end of file diff --git a/src/base/USong.pas b/src/base/USong.pas index 47ac0a30..6c81cecc 100644 --- a/src/base/USong.pas +++ b/src/base/USong.pas @@ -130,6 +130,9 @@ type MultBPM : integer; LastError: String; + Function GetErrorLineNo: Integer; + Property ErrorLineNo: Integer read GetErrorLineNo; + constructor Create (); overload; constructor Create ( const aFileName : WideString ); overload; @@ -203,7 +206,7 @@ begin if not FileExists(Path + PathDelim + FileName) then begin - LastError := 'File not found'; + LastError := 'ERROR_CORRUPT_SONG_FILE_NOT_FOUND'; Log.LogError('File not found: "' + Path + PathDelim + FileName + '"', 'TSong.LoadSong()'); exit; end; @@ -243,7 +246,7 @@ begin begin //Song File Corrupted - No Notes CloseFile(SongFile); Log.LogError('Could not load txt File, no Notes found: ' + FileName); - LastError := 'Can''t find any notes'; + LastError := 'ERROR_CORRUPT_SONG_NO_NOTES'; Exit; end; Read(SongFile, TempC); @@ -368,7 +371,7 @@ begin begin If (Length(Lines[I].Line) < 2) then begin - LastError := 'Can''t find any linebreaks'; + LastError := 'ERROR_CORRUPT_SONG_NO_BREAKS'; Log.LogError('Error Loading File, Can''t find any Linebreaks: "' + fFileName + '"'); exit; end; @@ -395,7 +398,7 @@ begin end; - LastError := 'Error reading line ' + inttostr(FileLineNo); + LastError := 'ERROR_CORRUPT_SONG_ERROR_IN_LINE'; Log.LogError('Error Loading File: "' + fFileName + '" in Line ' + inttostr(FileLineNo)); exit; end; @@ -885,6 +888,14 @@ begin end; +Function TSong.GetErrorLineNo: Integer; +begin + If (LastError='ERROR_CORRUPT_SONG_ERROR_IN_LINE') then + Result := FileLineNo + Else + Result := -1; +end; + procedure TSong.ParseNote(LineNumber: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); begin diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 3eb3742d..d0908ff8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -441,7 +441,7 @@ begin if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong(); if (Length(CurrentSong.LastError) > 0) then - ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG') + '\n' + CurrentSong.LastError) + ScreenPopupError.ShowPopup(Format(Language.Translate(CurrentSong.LastError), [CurrentSong.ErrorLineNo])) else ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); // FIXME: do we need this? @@ -656,6 +656,8 @@ begin glDeleteTextures(1, PGLuint(@Tex_Background.TexNum)); Tex_Background.TexNum := 0; end; + + Background.OnFinish; end; function TScreenSing.Draw: boolean; @@ -669,6 +671,8 @@ var CurLyricsTime: real; begin + Background.Draw; + // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin -- cgit v1.2.3