diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-06-15 16:24:50 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-06-15 16:24:50 +0000 |
commit | 11ab83b9460c672ba4a6eb27a79315d9dda71ff6 (patch) | |
tree | 30f59af1d4015c2fff6e860af3cae4caebe2d11d | |
parent | 0017ec10aa9ba57797a4b3e963ccb5d2ce376da2 (diff) | |
download | usdx-11ab83b9460c672ba4a6eb27a79315d9dda71ff6.tar.gz usdx-11ab83b9460c672ba4a6eb27a79315d9dda71ff6.tar.xz usdx-11ab83b9460c672ba4a6eb27a79315d9dda71ff6.zip |
move check for OnSentenceEnd call from NewNote to NewBeatDetect
- fix rating popup for lines that end with a freestyle note
- better handling of songs with bad line breaks
this may need some additional testing!
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2528 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r-- | src/base/UNote.pas | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/base/UNote.pas b/src/base/UNote.pas index d6fdcb13..d800d30e 100644 --- a/src/base/UNote.pas +++ b/src/base/UNote.pas @@ -351,8 +351,39 @@ begin end; procedure NewBeatDetect(Screen: TScreenSing); + var + SentenceEnd: integer; + I: cardinal; begin NewNote(Screen); + + // check for sentence end + // we check all lines here because a new sentence may + // have been started even before the old one finishes + // due to corrupt lien breaks + // checking only current line works to, but may lead to + // weird ratings for the song files w/ the mentioned + // errors + // To-Do Philipp : check current and last line should + // do it for most corrupt txt and for lines in + // non-corrupt txts that start immediatly after the prev. + // line ends + if (assigned(Screen)) then + begin + for I := 0 to Lines[0].High do + begin + with Lines[0].Line[I] do + begin + if (HighNote > 0) then + begin + SentenceEnd := Note[HighNote].Start + Note[HighNote].Length; + + if (LyricsState.OldBeatD < SentenceEnd) and (LyricsState.CurrentBeatD >= SentenceEnd) then + Screen.OnSentenceEnd(I); + end; + end; + end; + end; end; procedure NewNote(Screen: TScreenSing); @@ -582,20 +613,6 @@ begin end; // for PlayerIndex //Log.LogStatus('EndBeat', 'NewBeat'); - - // on sentence end -> for LineBonus and display of SingBar (rating pop-up) - if (SentenceDetected >= Low(Lines[0].Line)) and - (SentenceDetected <= High(Lines[0].Line)) then - begin - Line := @Lines[0].Line[SentenceDetected]; - CurrentLineFragment := @Line.Note[Line.HighNote]; - if ((CurrentLineFragment.Start + CurrentLineFragment.Length - 1) = LyricsState.CurrentBeatD) then - begin - if assigned(Screen) then - Screen.OnSentenceEnd(SentenceDetected); - end; - end; - end; end. |