From efe03774a1736d28512746f1a56b5c1f4e3da0c2 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Thu, 10 Apr 2008 17:51:42 +0000 Subject: finally removed IlNut from Editor (*hope* it will work) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1019 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMusic.pas | 1 - Game/Code/Screens/UScreenEditConvert.pas | 4 -- Game/Code/Screens/UScreenEditSub.pas | 97 ++++++++++++++------------------ Game/Code/Screens/UScreenSingModi.pas | 1 - 4 files changed, 42 insertions(+), 61 deletions(-) diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index 8efb8be7..93dd15de 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -22,7 +22,6 @@ type End_: integer; BaseNote: integer; HighNote: integer; - IlNut: integer; // (TODO: Il = tone, Nut(a) = Note) TotalNotes: integer; LastLine: boolean; Note: array of record diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index 1749d4e2..7a3ef3e8 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -302,7 +302,6 @@ begin C := 0; N := 0; - Lines.Line[C].IlNut := 0; Lines.Line[C].HighNote := -1; for Nu := 0 to High(Note) do begin @@ -313,7 +312,6 @@ begin C := C + 1; N := 0; SetLength(Lines.Line[C].Note, 0); - Lines.Line[C].IlNut := 0; Lines.Line[C].HighNote := -1; //Calculate Start of the Last Sentence @@ -340,8 +338,6 @@ begin // tworzy miejsce na nowa nute SetLength(Lines.Line[C].Note, Length(Lines.Line[C].Note)+1); - Lines.Line[C].IlNut := Lines.Line[C].IlNut + 1; - Lines.Line[C].HighNote := Lines.Line[C].HighNote + 1; // dopisuje Lines.Line[C].Note[N].Start := Note[Nu].Start; diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index a3d300f3..c3071640 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -172,7 +172,7 @@ begin begin // Paste text if SDL_ModState = KMOD_LCTRL then begin - if Lines[0].Line[Lines[0].Current].IlNut >= Lines[0].Line[CopySrc].IlNut then + if Lines[0].Line[Lines[0].Current].HighNote >= Lines[0].Line[CopySrc].HighNote then PasteText else Log.LogStatus('PasteText: invalid range', 'TScreenEditSub.ParseInput'); @@ -428,7 +428,7 @@ begin if SDL_ModState = 0 then begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(CurrentNote); - if CurrentNote = Lines[0].Line[Lines[0].Current].IlNut then CurrentNote := 0; + if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; @@ -619,7 +619,7 @@ begin if SDL_ModState = 0 then begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(CurrentNote); - if CurrentNote = Lines[0].Line[Lines[0].Current].IlNut then CurrentNote := 0; + if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; @@ -779,7 +779,6 @@ var N: integer; NStart: integer; NHigh: integer; - NNewL: integer; begin // increase sentence length by 1 CLen := Length(Lines[0].Line); @@ -800,42 +799,35 @@ begin Lines[0].Line[CNew].LyricWidth := 0; Lines[0].Line[CNew].End_ := 0; Lines[0].Line[CNew].BaseNote := 0; // 0.5.0: we modify it later in this procedure - Lines[0].Line[CNew].IlNut := 0; Lines[0].Line[CNew].HighNote := -1; SetLength(Lines[0].Line[CNew].Note, 0); // move right notes to new sentences NHigh := Lines[0].Line[CStart].HighNote; for N := NStart to NHigh do begin - NNewL := Lines[0].Line[CNew].IlNut; - SetLength(Lines[0].Line[CNew].Note, NNewL + 1); - Lines[0].Line[CNew].Note[NNewL] := Lines[0].Line[CStart].Note[N]; - // increase sentence counters - Inc(Lines[0].Line[CNew].IlNut); - Inc(Lines[0].Line[CNew].HighNote); - Lines[0].Line[CNew].End_ := Lines[0].Line[CNew].Note[NNewL].Start + - Lines[0].Line[CNew].Note[NNewL].Length; + with Lines[0].Line[CNew] do + begin + Inc(HighNote); + SetLength(Note, HighNote + 1); + Note[HighNote] := Note[N]; + End_ := Note[HighNote].Start + Note[HighNote].Length; + + if Note[HighNote].Tone < BaseNote then + BaseNote := Note[HighNote].Tone; + end; end; // clear old notes and set sentence counters Lines[0].Line[CStart].HighNote := NStart - 1; - Lines[0].Line[CStart].IlNut := Lines[0].Line[CStart].HighNote + 1; Lines[0].Line[CStart].End_ := Lines[0].Line[CStart].Note[NStart-1].Start + Lines[0].Line[CStart].Note[NStart-1].Length; - SetLength(Lines[0].Line[CStart].Note, Lines[0].Line[CStart].IlNut); - - // 0.5.0: modify BaseNote - Lines[0].Line[CNew].BaseNote := 120; - for N := 0 to Lines[0].Line[CNew].IlNut do - if Lines[0].Line[CNew].Note[N].Tone < Lines[0].Line[CNew].BaseNote then - Lines[0].Line[CNew].BaseNote := Lines[0].Line[CNew].Note[N].Tone; + SetLength(Lines[0].Line[CStart].Note, Lines[0].Line[CStart].HighNote + 1); Lines[0].Current := Lines[0].Current + 1; CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.AddCzesc(Lines[0].Current); - end; procedure TScreenEditSub.JoinSentence; @@ -848,10 +840,9 @@ begin C := Lines[0].Current; // set new sentence - NStart := Lines[0].Line[C].IlNut; - Lines[0].Line[C].IlNut := Lines[0].Line[C].IlNut + Lines[0].Line[C+1].IlNut; - Lines[0].Line[C].HighNote := Lines[0].Line[C].HighNote + Lines[0].Line[C+1].IlNut; - SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].IlNut); + NStart := Lines[0].Line[C].HighNote + 1; + Lines[0].Line[C].HighNote := Lines[0].Line[C].HighNote + Lines[0].Line[C+1].HighNote + 1; + SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); // move right notes to new sentences for N := 0 to Lines[0].Line[C+1].HighNote do begin @@ -878,26 +869,26 @@ procedure TScreenEditSub.DivideNote; var C: integer; N: integer; - NLen: integer; begin C := Lines[0].Current; - NLen := Lines[0].Line[C].IlNut + 1; - SetLength(Lines[0].Line[C].Note, NLen); - Inc(Lines[0].Line[C].HighNote); - Inc(Lines[0].Line[C].IlNut); + with Lines[0].Line[C] do + begin + Inc(HighNote); + SetLength(Note, HighNote + 1); + + // we copy all notes including selected one + for N := HighNote downto CurrentNote+1 do begin + Note[N] := Note[N-1]; + end; - // we copy all notes including selected one - for N := Lines[0].Line[C].HighNote downto CurrentNote+1 do begin - Lines[0].Line[C].Note[N] := Lines[0].Line[C].Note[N-1]; + // me slightly modify new note + Note[CurrentNote].Length := 1; + Inc(Note[CurrentNote+1].Start); + Dec(Note[CurrentNote+1].Length); + Note[CurrentNote+1].Text := '- '; + Note[CurrentNote+1].Color := 0; end; - - // me slightly modify new note - Lines[0].Line[C].Note[CurrentNote].Length := 1; - Inc(Lines[0].Line[C].Note[CurrentNote+1].Start); - Dec(Lines[0].Line[C].Note[CurrentNote+1].Length); - Lines[0].Line[C].Note[CurrentNote+1].Text := '- '; - Lines[0].Line[C].Note[CurrentNote+1].Color := 0; end; procedure TScreenEditSub.DeleteNote; @@ -916,19 +907,17 @@ begin for N := CurrentNote+1 to Lines[0].Line[C].HighNote do begin Lines[0].Line[C].Note[N-1] := Lines[0].Line[C].Note[N]; end; - - NLen := Lines[0].Line[C].IlNut - 1; - - if (NLen > 0) then + + Dec(Lines[0].Line[C].HighNote); + if (Lines[0].Line[C].HighNote >= 0) then begin - SetLength(Lines[0].Line[C].Note, NLen); - Dec(Lines[0].Line[C].HighNote); - Dec(Lines[0].Line[C].IlNut); - + SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); // me slightly modify new note - if CurrentNote > Lines[0].Line[C].HighNote then Dec(CurrentNote); - Lines[0].Line[C].Note[CurrentNote].Color := 1; + if CurrentNote > Lines[0].Line[C].HighNote then + Dec(CurrentNote); + + Lines[0].Line[C].Note[CurrentNote].Color := 1; end //Last Note of current Sentence Deleted - > Delete Sentence else @@ -1047,8 +1036,7 @@ begin Time2 := Lines[0].Line[Dst].Note[0].Start; TD := Time2-Time1; - SetLength(Lines[0].Line[Dst].Note, Lines[0].Line[Src].IlNut); - Lines[0].Line[Dst].IlNut := Lines[0].Line[Src].IlNut; + SetLength(Lines[0].Line[Dst].Note, Lines[0].Line[Src].HighNote + 1); Lines[0].Line[Dst].HighNote := Lines[0].Line[Src].HighNote; for N := 0 to Lines[0].Line[Src].HighNote do begin Lines[0].Line[Dst].Note[N].Text := Lines[0].Line[Src].Note[N].Text; @@ -1080,7 +1068,6 @@ begin Lines[0].Line[Dst + C].Start := Lines[0].Line[Dst + C - 1].Note[0].Start + (Lines[0].Line[Src + C].Note[0].Start - Lines[0].Line[Src + C - 1].Note[0].Start); SetLength(Lines[0].Line[Dst + C].Note, 1); - Lines[0].Line[Dst + C].IlNut := 1; Lines[0].Line[Dst + C].HighNote := 0; Lines[0].Line[Dst + C].Note[0].Start := Lines[0].Line[Dst + C].Start; Lines[0].Line[Dst + C].Note[0].Length := 1; @@ -1288,7 +1275,7 @@ begin Text[TextSentence].Text := IntToStr(Lines[0].Current + 1) + ' / ' + IntToStr(Lines[0].Number); - Text[TextNote].Text := IntToStr(CurrentNote + 1) + ' / ' + IntToStr(Lines[0].Line[Lines[0].Current].IlNut); + Text[TextNote].Text := IntToStr(CurrentNote + 1) + ' / ' + IntToStr(Lines[0].Line[Lines[0].Current].HighNote + 1); // Song info Text[TextBPM].Text := FloatToStr(CurrentSong.BPM[0].BPM / 4); diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index 87e01e00..e1441684 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -148,7 +148,6 @@ begin Result.Sentence[I].End_ := Lines.Line[I].End_; Result.Sentence[I].BaseNote := Lines.Line[I].BaseNote; Result.Sentence[I].HighNote := Lines.Line[I].HighNote; - Result.Sentence[I].IlNut := Lines.Line[I].IlNut; Result.Sentence[I].TotalNotes := Lines.Line[I].TotalNotes; SetLength(Result.Sentence[I].Note, Length(Lines.Line[I].Note)); -- cgit v1.2.3