diff options
author | s_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-04-07 15:11:27 +0000 |
---|---|---|
committer | s_alexander <s_alexander@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-04-07 15:11:27 +0000 |
commit | de19222a6fc53d455a91a8e5c8c99c080408392b (patch) | |
tree | dca01fcb4dfb37062354d6759ce279b853bca5f7 /Game/Code/Classes | |
parent | 9a89664288cf5bbdcf4892cf721268a820e64c5b (diff) | |
download | usdx-de19222a6fc53d455a91a8e5c8c99c080408392b.tar.gz usdx-de19222a6fc53d455a91a8e5c8c99c080408392b.tar.xz usdx-de19222a6fc53d455a91a8e5c8c99c080408392b.zip |
make BPM changes during song possible
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1016 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/USong.pas | 9 | ||||
-rw-r--r-- | Game/Code/Classes/USong_Txt.pas | 98 |
2 files changed, 57 insertions, 50 deletions
diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index 9e55671e..d878132a 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -141,6 +141,7 @@ type Procedure AddLyricLine(const PlayerID: Integer; const StartBeat: Integer; const RelativeBeat: Integer = -1); Procedure AddNote(const PlayerID: Integer; const NoteType: Char; const NoteStart, NoteLength, NoteTone: Integer; const NoteText: WideString); Function SolmizatLyrics(const NoteTone: Integer; const NoteText: WideString): WideString; + Procedure AddBPM(const StartBeat: Integer; const NewBeat: Extended); public //Required Information Title: widestring; @@ -465,6 +466,14 @@ begin end; // case Ini.Solmization end; +Procedure TSong.AddBPM(const StartBeat: Integer; const NewBeat: Extended); +begin + SetLength(BPM, Length(BPM) + 1); + BPM[High(BPM)].StartBeat := StartBeat; + BPM[High(BPM)].StartBeat := BPM[High(BPM)].StartBeat + RelativPosition[0]; + + BPM[High(BPM)].BPM := NewBeat * Mult * MultBPM; +end; {constructor TSong.create( const aFileName : WideString ); begin diff --git a/Game/Code/Classes/USong_Txt.pas b/Game/Code/Classes/USong_Txt.pas index 23171517..a0259baf 100644 --- a/Game/Code/Classes/USong_Txt.pas +++ b/Game/Code/Classes/USong_Txt.pas @@ -353,62 +353,57 @@ begin // aktuelle Zeile in einzelne Werte aufteilen Values := TStringList.Create; - ParseDelimited(Values, line, ' ', 5); - try - if (line[1] = '-') then - if (not NotesRead) then - // skip newline if no notes before - continue - else - begin - // new lyric line - // param count: 1 (relative: 2) - - if (Values.Count > 2) then - // relativ offset - begin - // P1 - AddLyricLine(0, StrToInt(Values[1]), StrToInt(Values[2])); - - // P2 - if Length(Player) = 2 Then - AddLyricLine(1, StrToInt(Values[1]), StrToInt(Values[2])) - end + ParseDelimited(Values, line, ' ', 5); + + try + if (line[1] = '-') then + if (not NotesRead) then + // skip newline if no notes before + continue else begin - AddLyricLine(0, StrToInt(Values[1])); + // new lyric line + // param count: 1 (relative: 2) + + if (Values.Count > 2) then + // relativ offset + begin + // P1 + AddLyricLine(0, StrToInt(Values[1]), StrToInt(Values[2])); + + // P2 + if Length(Player) = 2 Then + AddLyricLine(1, StrToInt(Values[1]), StrToInt(Values[2])) + end + else + begin + AddLyricLine(0, StrToInt(Values[1])); - // P2 - if Length(Player) = 2 then - AddLyricLine(1, StrToInt(Values[1])) + // P2 + if Length(Player) = 2 then + AddLyricLine(1, StrToInt(Values[1])) + end; end; - end; - // new BPM set - if (line[1] = 'B') then - begin - // param count: 2 - {SetLength(BPM, Length(BPM) + 1); - Read(SongFile, BPM[High(BPM)].StartBeat); - BPM[High(BPM)].StartBeat := BPM[High(BPM)].StartBeat + Rel[0]; - - ReadLn(SongFile, Text); - BPM[High(BPM)].BPM := StrToFloat(Text); - BPM[High(BPM)].BPM := BPM[High(BPM)].BPM * Mult * MultBPM;} - end; + // new BPM set + if (line[1] = 'B') then + begin + // param count: 2 + AddBPM(StrToInt(Values[1]), StrToFloat(Values[2])); + end; - if (line[1] = ':') OR (line[1] = '*') OR (line[1] = 'F') then - begin - // param count: 4 - if (Values.Count < 5) then - Log.LogError('Error parsing line: ' + line, 'Not enough arguments.') - else + if (line[1] = ':') OR (line[1] = '*') OR (line[1] = 'F') then begin - // Check for ZeroNote - if StrToInt(Values[2]) = 0 then - Log.LogError('Found ZeroNote: "' + line + '" -> Note ignored!') + // param count: 4 + if (Values.Count < 5) then + Log.LogError('Error parsing line: ' + line, 'Not enough arguments.') else + begin + // Check for ZeroNote + if StrToInt(Values[2]) = 0 then + Log.LogError('Found ZeroNote: "' + line + '" -> Note ignored!') + else begin // P1 AddNote(0, line[1], StrToInt(Values[1]), StrToInt(Values[2]), StrToInt(Values[3]), Values[4]); @@ -417,11 +412,14 @@ begin if Length(Player) = 2 then AddNote(1, line[1], StrToInt(Values[1]), StrToInt(Values[2]), StrToInt(Values[3]), Values[4]); end; + end; end; + except + on E : Exception do + Log.LogError('Error parsing line: ' + line, E.ClassName + ': ' + E.Message); end; - except - on E : Exception do - Log.LogError('Error parsing line: ' + line, E.ClassName + ': ' + E.Message); + finally + Values.Free(); end; end; |