cleanup (don't think it's correct yet)

This commit is contained in:
Glenn Maynard
2004-11-01 05:08:48 +00:00
parent 806f519d16
commit 58f31d5b96
+8 -6
View File
@@ -670,14 +670,16 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
// (note-defining) line, where each non-0 hex pair is a BPM // (note-defining) line, where each non-0 hex pair is a BPM
// change at that point. // change at that point.
int totalPairs = value_data.GetLength() / 2; int totalPairs = value_data.GetLength() / 2;
for (int i = 0; i < (totalPairs*2); i+=2) for( int i = 0; i < totalPairs*2; i+=2 )
{ {
if( value_data.substr(i,2) != "00" ) CString sPair = value_data.substr(i,2);
int iBPM = 0;
if( sscanf( sPair, "%x", &iBPM ) == 1 && iBPM != 0 )
{ {
CString thisPair = value_data.substr(i,2); int iRow = iStepIndex+(1/(totalPairs*ROWS_PER_MEASURE));
int thisBPM; float fBeat = NoteRowToBeat( iRow );
sscanf( thisPair, "%x", &thisBPM ); // data is in hexadecimal BPMSegment newSeg( fBeat, (float) iBPM );
BPMSegment newSeg( NoteRowToBeat(iStepIndex+(1/(totalPairs*ROWS_PER_MEASURE))), (float) thisBPM );
out.AddBPMSegment( newSeg ); out.AddBPMSegment( newSeg );
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", newSeg.m_fStartBeat, newSeg.m_fBPM ); LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", newSeg.m_fStartBeat, newSeg.m_fBPM );
} }