From e0c4de18cabd3f1f27376afe389cdd4470ee198d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 25 Jun 2007 12:24:53 +0000 Subject: Fixed wrong sentence timings (T in Editor) when last note of a sentence and first note of the next sentence overlap. Fixed 2 Bugs in Midi Converter: Notes were added more than once to txt when the save Button is pressed multiple times Notes are added more than once when open is pressed multiple time Added sentence start calculating to Midi Converter git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@267 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenEditConvert.pas | 30 ++++++++++++++++++++++++++++++ Game/Code/Screens/UScreenEditSub.pas | 8 ++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 92e8544c..f1e3ba32 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -54,8 +54,10 @@ type BPM: real; Ticks: real; Nuta: array of TNuta; + procedure AddLyric(Start: integer; Tekst: string); procedure Extract; + procedure MidiFile1MidiEvent(event: PMidiEvent); function SelectedNumber: integer; constructor Create; override; @@ -192,6 +194,7 @@ var Nu: integer; NutaTemp: TNuta; Move: integer; + Max, Min: integer; begin // song info Song.Title := ''; @@ -201,6 +204,8 @@ begin SetLength(Song.BPM, 1); Song.BPM[0].BPM := BPM*4; + SetLength(Nuta, 0); + // extract notes for T := 0 to High(ATrack) do begin // if ATrack[T].Hear then begin @@ -265,6 +270,27 @@ begin SetLength(Czesc.Czesc[C].Nuta, 0); Czesc.Czesc[C].IlNut := 0; Czesc.Czesc[C].HighNut := -1; + + //Calculate Start of the Last Sentence + if (C > 0) and (Nu > 0) then + begin + Max := Nuta[Nu].Start; + Min := Nuta[Nu-1].Start + Nuta[Nu-1].Len; + + case (Max - Min) of + 0: Czesc.Czesc[C].Start := Max; + 1: Czesc.Czesc[C].Start := Max; + 2: Czesc.Czesc[C].Start := Max - 1; + 3: Czesc.Czesc[C].Start := Max - 2; + else + if ((Max - Min) > 4) then + Czesc.Czesc[C].Start := Min + 2 + else + Czesc.Czesc[C].Start := Max; + + end; // case + + end; end; // tworzy miejsce na nowa nute @@ -388,7 +414,11 @@ begin SetLength(Channel, 16); for T := 0 to 15 do + begin Channel[T].Name := IntToStr(T+1); + SetLength(Channel[T].Note, 0); + Channel[T].Status := 0; + end; for T := 0 to MidiFile.NumberOfTracks-1 do begin MidiTrack := MidiFile.GetTrack(T); diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index a0adef2c..8a5eaab8 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -730,8 +730,12 @@ begin 0: S := Max; 1: S := Max; 2: S := Max - 1; - 3..3: S := Max - 2; - 4..10000: S := Min + 2; // poczatek + 2 + 3: S := Max - 2; + else + if ((Max - Min) > 4) then + S := Min + 2 + else + S := Max; end; // case Czesci[0].Czesc[C].Start := S; -- cgit v1.2.3