From 1c3f711aea601fc0c19481ba0edfcc3d96c8abc8 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 19 Jul 2008 13:23:22 +0000 Subject: renamed TLineState to TLyricsState git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1214 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UDraw.pas | 26 +++++++++++++------------- Game/Code/Classes/UMain.pas | 42 +++++++++++++++++++++--------------------- Game/Code/Classes/UMusic.pas | 22 +++++++++++----------- 3 files changed, 45 insertions(+), 45 deletions(-) (limited to 'Game/Code/Classes') diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index a5bd8afa..e405ec07 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -401,8 +401,8 @@ begin Rec.Right := X + (Start+Length-Lines[0].Line[Lines[0].Current].Note[0].Start) * TempR - NotesW - 0.5 + 10*ScreenX; // (nowe) - dunno - if (Start+Length-1 = LineState.CurrentBeatD) then - Rec.Right := Rec.Right - (1-Frac(LineState.MidBeatD)) * TempR; + if (Start+Length-1 = LyricsState.CurrentBeatD) then + Rec.Right := Rec.Right - (1-Frac(LyricsState.MidBeatD)) * TempR; // the left note is more right than the right note itself, sounds weird - so we fix that xD if Rec.Right <= Rec.Left then Rec.Right := Rec.Left; @@ -434,8 +434,8 @@ begin // Perfect note is stored if Perfect and (Ini.EffectSing=1) then begin - A := 1 - 2*(LineState.GetCurrentTime() - GetTimeFromBeat(Start+Length)); - if not (Start+Length-1 = LineState.CurrentBeatD) then + A := 1 - 2*(LyricsState.GetCurrentTime() - GetTimeFromBeat(Start+Length)); + if not (Start+Length-1 = LyricsState.CurrentBeatD) then begin //Star animation counter //inc(Starfr); @@ -591,7 +591,7 @@ begin FirstNoteDelta := FirstNoteBeat - CurLine.Start; // beats from current beat to the first note of the line - BarMoveDelta := FirstNoteBeat - LineState.MidBeat; + BarMoveDelta := FirstNoteBeat - LyricsState.MidBeat; if (FirstNoteDelta > 8) and // if the wait-time is large enough (BarMoveDelta > 0) then // and the first note of the line is not reached @@ -693,7 +693,7 @@ begin end; // draw Lyrics - LyricEngine.Draw(LineState.MidBeat); + LyricEngine.Draw(LyricsState.MidBeat); SingDrawLyricHelper(NR.Left, NR.WMid); // oscilloscope @@ -911,7 +911,7 @@ begin end; // Draw Lyrics - ScreenSingModi.Lyrics.Draw(LineState.MidBeat); + ScreenSingModi.Lyrics.Draw(LyricsState.MidBeat); // todo: Lyrics { // rysuje pasek, podpowiadajacy poczatek spiwania w scenie @@ -919,9 +919,9 @@ begin BarFrom := Lines[0].Line[Lines[0].Current].StartNote - Lines[0].Line[Lines[0].Current].Start; if BarFrom > 40 then BarFrom := 40; if (Lines[0].Line[Lines[0].Current].StartNote - Lines[0].Line[Lines[0].Current].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more - (Lines[0].Line[Lines[0].Current].StartNote - LineState.MidBeat > 0) and // przed tekstem - (Lines[0].Line[Lines[0].Current].StartNote - LineState.MidBeat < 40) then begin // ale nie za wczesnie - BarWspol := (LineState.MidBeat - (Lines[0].Line[Lines[0].Current].StartNote - BarFrom)) / BarFrom; + (Lines[0].Line[Lines[0].Current].StartNote - LyricsState.MidBeat > 0) and // przed tekstem + (Lines[0].Line[Lines[0].Current].StartNote - LyricsState.MidBeat < 40) then begin // ale nie za wczesnie + BarWspol := (LyricsState.MidBeat - (Lines[0].Line[Lines[0].Current].StartNote - BarFrom)) / BarFrom; Rec.Left := NR.Left + BarWspol * (ScreenSingModi.LyricMain.ClientX - NR.Left - 50) + 10*ScreenX; Rec.Right := Rec.Left + 50; Rec.Top := Skin_LyricsT + 3; @@ -1361,11 +1361,11 @@ begin glTexCoord2f(0, 0); glVertex2f(x, y); - CurLyricsTime := LineState.GetCurrentTime(); + CurLyricsTime := LyricsState.GetCurrentTime(); if (CurLyricsTime > 0) and - (LineState.TotalTime > 0) then + (LyricsState.TotalTime > 0) then begin - LyricsProgress := CurLyricsTime / LineState.TotalTime; + LyricsProgress := CurLyricsTime / LyricsState.TotalTime; glTexCoord2f((width * LyricsProgress) / 8, 0); glVertex2f(x + width * LyricsProgress, y); diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 4037d457..9688fe76 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -231,7 +231,7 @@ begin Log.LogBenchmark('Initializing Sound', 1); // Lyrics-engine with media reference timer - LineState := TLineState.Create(); + LyricsState := TLyricsState.Create(); // Theme Log.BenchmarkStart(1); @@ -648,35 +648,35 @@ var CurLine: PLine; CurNote: PLineFragment; begin - LineState.UpdateBeats(); + LyricsState.UpdateBeats(); // sentences routines for CountGr := 0 to 0 do //High(Lines) begin; CP := CountGr; // old parts - LineState.OldLine := Lines[CP].Current; + LyricsState.OldLine := Lines[CP].Current; // choose current parts for Count := 0 to Lines[CP].High do begin - if LineState.CurrentBeat >= Lines[CP].Line[Count].Start then + if LyricsState.CurrentBeat >= Lines[CP].Line[Count].Start then Lines[CP].Current := Count; end; // clean player note if there is a new line // (optimization on halfbeat time) - if Lines[CP].Current <> LineState.OldLine then + if Lines[CP].Current <> LyricsState.OldLine then NewSentence(Screen); end; // for CountGr // make some operations on clicks - if {(LineState.CurrentBeatC >= 0) and }(LineState.OldBeatC <> LineState.CurrentBeatC) then + if {(LyricsState.CurrentBeatC >= 0) and }(LyricsState.OldBeatC <> LyricsState.CurrentBeatC) then NewBeatClick(Screen); // make some operations when detecting new voice pitch - if (LineState.CurrentBeatD >= 0) and (LineState.OldBeatD <> LineState.CurrentBeatD) then + if (LyricsState.CurrentBeatD >= 0) and (LyricsState.OldBeatD <> LyricsState.CurrentBeatD) then NewBeatDetect(Screen); CurLine := @Lines[0].Line[Lines[0].Current]; @@ -686,10 +686,10 @@ begin for N := 0 to CurLine.HighNote do begin CurNote := @CurLine.Note[N]; - if (CurNote.Start <= LineState.MidBeat) and - (CurNote.Start + CurNote.Length >= LineState.MidBeat) then + if (CurNote.Start <= LyricsState.MidBeat) and + (CurNote.Start + CurNote.Length >= LyricsState.MidBeat) then begin - Done := (LineState.MidBeat - CurNote.Start) / CurNote.Length; + Done := (LyricsState.MidBeat - CurNote.Start) / CurNote.Length; end; end; end; @@ -716,14 +716,14 @@ var begin // beat click if ((Ini.BeatClick = 1) and - ((LineState.CurrentBeatC + Lines[0].Resolution + Lines[0].NotesGAP) mod Lines[0].Resolution = 0)) then + ((LyricsState.CurrentBeatC + Lines[0].Resolution + Lines[0].NotesGAP) mod Lines[0].Resolution = 0)) then begin AudioPlayback.PlaySound(SoundLib.Click); end; for Count := 0 to Lines[0].Line[Lines[0].Current].HighNote do begin - if (Lines[0].Line[Lines[0].Current].Note[Count].Start = LineState.CurrentBeatC) then + if (Lines[0].Line[Lines[0].Current].Note[Count].Start = LyricsState.CurrentBeatC) then begin // click assist if Ini.ClickAssist = 1 then @@ -785,8 +785,8 @@ begin begin CurrentLineFragment := @Line.Note[LineFragmentIndex]; // check if line is active - if ((CurrentLineFragment.Start <= LineState.CurrentBeatD) and - (CurrentLineFragment.Start + CurrentLineFragment.Length-1 >= LineState.CurrentBeatD)) and + if ((CurrentLineFragment.Start <= LyricsState.CurrentBeatD) and + (CurrentLineFragment.Start + CurrentLineFragment.Length-1 >= LyricsState.CurrentBeatD)) and (CurrentLineFragment.NoteType <> ntFreestyle) and // but ignore FreeStyle notes (CurrentLineFragment.Length > 0) then // and make sure the note lengths is at least 1 begin @@ -825,8 +825,8 @@ begin for LineFragmentIndex := 0 to Line.HighNote do begin CurrentLineFragment := @Line.Note[LineFragmentIndex]; - if (CurrentLineFragment.Start <= LineState.OldBeatD+1) and - (CurrentLineFragment.Start + CurrentLineFragment.Length > LineState.OldBeatD+1) then + if (CurrentLineFragment.Start <= LyricsState.OldBeatD+1) and + (CurrentLineFragment.Start + CurrentLineFragment.Length > LyricsState.OldBeatD+1) then begin // compare notes (from song-file and from player) @@ -889,7 +889,7 @@ begin // if last has the same tone if ((CurrentPlayer.LengthNote > 0) and (LastPlayerNote.Tone = CurrentSound.Tone) and - ((LastPlayerNote.Start + LastPlayerNote.Length) = LineState.CurrentBeatD)) then + ((LastPlayerNote.Start + LastPlayerNote.Length) = LyricsState.CurrentBeatD)) then begin NewNote := false; end; @@ -897,7 +897,7 @@ begin // if is not as new note to control for LineFragmentIndex := 0 to Line.HighNote do begin - if (Line.Note[LineFragmentIndex].Start = LineState.CurrentBeatD) then + if (Line.Note[LineFragmentIndex].Start = LyricsState.CurrentBeatD) then NewNote := true; end; @@ -913,10 +913,10 @@ begin LastPlayerNote := @CurrentPlayer.Note[CurrentPlayer.HighNote]; with LastPlayerNote^ do begin - Start := LineState.CurrentBeatD; + Start := LyricsState.CurrentBeatD; Length := 1; Tone := CurrentSound.Tone; // Tone || ToneAbs - Detect := LineState.MidBeat; + Detect := LyricsState.MidBeat; Hit := NoteHit; // half note patch end; end @@ -950,7 +950,7 @@ begin begin Line := @Lines[0].Line[SentenceDetected]; CurrentLineFragment := @Line.Note[Line.HighNote]; - if ((CurrentLineFragment.Start + CurrentLineFragment.Length - 1) = LineState.CurrentBeatD) then + if ((CurrentLineFragment.Start + CurrentLineFragment.Length - 1) = LyricsState.CurrentBeatD) then begin if assigned(Screen) then Screen.OnSentenceEnd(SentenceDetected); diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 2df5286e..f3474e30 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -65,10 +65,10 @@ type end; (** - * TLineState contains all information that concerns the - * state of the lyrics. + * TLyricsState contains all information concerning the + * state of the lyrics, e.g. the current beat or duration of the lyrics. *) - TLineState = class + TLyricsState = class private Timer: TRelativeTimer; // keeps track of the current time public @@ -513,7 +513,7 @@ type var // TODO: JB --- THESE SHOULD NOT BE GLOBAL Lines: array of TLines; - LineState: TLineState; + LyricsState: TLyricsState; SoundLib: TSoundLibrary; @@ -930,7 +930,7 @@ end; { TVoiceRemoval } -constructor TLineState.Create(); +constructor TLyricsState.Create(); begin // create a triggered timer, so we can Pause() it, set the time // and Resume() it afterwards for better synching. @@ -940,24 +940,24 @@ begin Reset(); end; -procedure TLineState.Pause(); +procedure TLyricsState.Pause(); begin Timer.Pause(); end; -procedure TLineState.Resume(); +procedure TLyricsState.Resume(); begin Timer.Resume(); end; -procedure TLineState.SetCurrentTime(Time: real); +procedure TLyricsState.SetCurrentTime(Time: real); begin // do not start the timer (if not started already), // after setting the current time Timer.SetTime(Time, false); end; -function TLineState.GetCurrentTime(): real; +function TLyricsState.GetCurrentTime(): real; begin Result := Timer.GetTime(); end; @@ -967,7 +967,7 @@ end; * The timer will be stopped afterwards so you have to call Resume() * to start the lyrics timer. *) -procedure TLineState.Reset(); +procedure TLyricsState.Reset(); begin Pause(); SetCurrentTime(0); @@ -992,7 +992,7 @@ end; * Updates the beat information (CurrentBeat/MidBeat/...) according to the * current lyric time. *) -procedure TLineState.UpdateBeats(); +procedure TLyricsState.UpdateBeats(); var CurLyricsTime: real; begin -- cgit v1.2.3