Added support for Two BUNKI's and BPM changes in the KSF file format (e.g. Beat Of The War on PIU has 2 bpm changes).

This commit is contained in:
Andrew Livy
2003-08-21 19:39:41 +00:00
parent 6c5a829e54
commit 987d10baec
+14 -1
View File
@@ -265,7 +265,7 @@ bool KSFLoader::LoadGlobalData( const CString &sPath, Song &out )
if( !bResult )
RageException::Throw( "Error opening file '%s'.", sPath.c_str() );
float BPMPos2 = -1, BPM2 = -1;
float BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1;;
for( unsigned i=0; i < msd.GetNumValues(); i++ )
{
@@ -279,8 +279,12 @@ bool KSFLoader::LoadGlobalData( const CString &sPath, Song &out )
out.AddBPMSegment( BPMSegment(0, (float)atof(sParams[1])) );
else if( 0==stricmp(sValueName,"BPM2") )
BPM2 = float(atof(sParams[1]));
else if( 0==stricmp(sValueName,"BPM3") )
BPM3 = float(atof(sParams[1]));
else if( 0==stricmp(sValueName,"BUNKI") )
BPMPos2 = float(atof(sParams[1])) / 100.0f;
else if( 0==stricmp(sValueName,"BUNKI2") )
BPMPos3 = float(atof(sParams[1])) / 100.0f;
else if( 0==stricmp(sValueName,"STARTTIME") )
out.m_fBeat0OffsetInSeconds = -(float)atof(sParams[1])/100;
else if( 0==stricmp(sValueName,"TICKCOUNT") ||
@@ -302,6 +306,15 @@ bool KSFLoader::LoadGlobalData( const CString &sPath, Song &out )
out.AddBPMSegment( BPMSegment(beat, BPM2) );
}
if( BPM3 > 0 && BPMPos3 > 0 )
{
const float BeatsPerSecond = out.GetBPMAtBeat(0) / 60.0f;
const float beat = BPMPos3 * BeatsPerSecond;
LOG->Trace("BPM %f, BPS %f, BPMPos3 %f, beat %f",
out.GetBPMAtBeat(0), BeatsPerSecond, BPMPos3, beat);
out.AddBPMSegment( BPMSegment(beat, BPM3) );
}
/* Try to fill in missing bits of information from the pathname. */
{
CStringArray asBits;