Cleanup.
This commit is contained in:
@@ -72,13 +72,14 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
|
|||||||
|
|
||||||
for( unsigned i=0; i<msd.GetNumValues(); i++ )
|
for( unsigned i=0; i<msd.GetNumValues(); i++ )
|
||||||
{
|
{
|
||||||
const MsdFile::value_t &sParams = msd.GetValue(i);
|
const MsdFile::value_t &sParams = msd.GetValue( i );
|
||||||
RString sValueName = sParams[0];
|
RString sValueName = sParams[0];
|
||||||
|
|
||||||
// handle the data
|
// handle the data
|
||||||
if( 0==stricmp(sValueName,"TICKCOUNT") )
|
if( 0==stricmp(sValueName,"TICKCOUNT") )
|
||||||
iTickCount = atoi(sParams[1]);
|
{
|
||||||
|
iTickCount = atoi( sParams[1] );
|
||||||
|
}
|
||||||
else if( 0==stricmp(sValueName,"STEP") )
|
else if( 0==stricmp(sValueName,"STEP") )
|
||||||
{
|
{
|
||||||
RString step = sParams[1];
|
RString step = sParams[1];
|
||||||
@@ -86,7 +87,9 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
|
|||||||
split( step, "\n", asRows, true );
|
split( step, "\n", asRows, true );
|
||||||
}
|
}
|
||||||
else if( 0==stricmp(sValueName,"DIFFICULTY") )
|
else if( 0==stricmp(sValueName,"DIFFICULTY") )
|
||||||
out.SetMeter(atoi(sParams[1]));
|
{
|
||||||
|
out.SetMeter( atoi(sParams[1]) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iTickCount == -1 )
|
if( iTickCount == -1 )
|
||||||
@@ -105,23 +108,23 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
|
|||||||
out.SetDescription(sFName);
|
out.SetDescription(sFName);
|
||||||
if( sFName.find("crazy") != string::npos )
|
if( sFName.find("crazy") != string::npos )
|
||||||
{
|
{
|
||||||
out.SetDifficulty(DIFFICULTY_HARD);
|
out.SetDifficulty( DIFFICULTY_HARD );
|
||||||
if(!out.GetMeter()) out.SetMeter(8);
|
if( !out.GetMeter() ) out.SetMeter( 8 );
|
||||||
}
|
}
|
||||||
else if( sFName.find("hard") != string::npos )
|
else if( sFName.find("hard") != string::npos )
|
||||||
{
|
{
|
||||||
out.SetDifficulty(DIFFICULTY_MEDIUM);
|
out.SetDifficulty( DIFFICULTY_MEDIUM );
|
||||||
if(!out.GetMeter()) out.SetMeter(5);
|
if( !out.GetMeter() ) out.SetMeter( 5 );
|
||||||
}
|
}
|
||||||
else if( sFName.find("easy") != string::npos || sFName.find("normal") != string::npos )
|
else if( sFName.find("easy") != string::npos || sFName.find("normal") != string::npos )
|
||||||
{
|
{
|
||||||
out.SetDifficulty(DIFFICULTY_EASY);
|
out.SetDifficulty( DIFFICULTY_EASY );
|
||||||
if(!out.GetMeter()) out.SetMeter(2);
|
if( !out.GetMeter() ) out.SetMeter( 2 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
out.SetDifficulty(DIFFICULTY_MEDIUM);
|
out.SetDifficulty( DIFFICULTY_MEDIUM );
|
||||||
if(!out.GetMeter()) out.SetMeter(5);
|
if( !out.GetMeter() ) out.SetMeter( 5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
out.m_StepsType = STEPS_TYPE_PUMP_SINGLE;
|
out.m_StepsType = STEPS_TYPE_PUMP_SINGLE;
|
||||||
@@ -162,7 +165,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
|
|||||||
if( sRowString == "2222222222222" )
|
if( sRowString == "2222222222222" )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(sRowString.size() != 13)
|
if( sRowString.size() != 13 )
|
||||||
{
|
{
|
||||||
LOG->Warn("File %s had a RowString with an improper length (\"%s\"); corrupt notes ignored",
|
LOG->Warn("File %s had a RowString with an improper length (\"%s\"); corrupt notes ignored",
|
||||||
sPath.c_str(), sRowString.c_str());
|
sPath.c_str(), sRowString.c_str());
|
||||||
@@ -198,7 +201,7 @@ bool KSFLoader::LoadFromKSFFile( const RString &sPath, Steps &out, const Song &s
|
|||||||
}
|
}
|
||||||
|
|
||||||
TapNote tap;
|
TapNote tap;
|
||||||
switch(sRowString[t])
|
switch( sRowString[t] )
|
||||||
{
|
{
|
||||||
case '0': tap = TAP_EMPTY; break;
|
case '0': tap = TAP_EMPTY; break;
|
||||||
case '1': tap = TAP_ORIGINAL_TAP; break;
|
case '1': tap = TAP_ORIGINAL_TAP; break;
|
||||||
@@ -242,7 +245,7 @@ void KSFLoader::LoadTags( const RString &str, Song &out )
|
|||||||
!stricmp(asBits[2], "hard") ||
|
!stricmp(asBits[2], "hard") ||
|
||||||
!stricmp(asBits[2], "crazy")) )
|
!stricmp(asBits[2], "crazy")) )
|
||||||
{
|
{
|
||||||
asBits.erase(asBits.begin()+2, asBits.begin()+3);
|
asBits.erase( asBits.begin()+2, asBits.begin()+3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
RString title, artist;
|
RString title, artist;
|
||||||
@@ -298,11 +301,12 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
|
|||||||
out.m_Timing.m_fBeat0OffsetInSeconds = -StringToFloat( sParams[1] )/100;
|
out.m_Timing.m_fBeat0OffsetInSeconds = -StringToFloat( sParams[1] )/100;
|
||||||
else if( 0==stricmp(sValueName,"TICKCOUNT") ||
|
else if( 0==stricmp(sValueName,"TICKCOUNT") ||
|
||||||
0==stricmp(sValueName,"STEP") ||
|
0==stricmp(sValueName,"STEP") ||
|
||||||
0==stricmp(sValueName,"DIFFICULTY"))
|
0==stricmp(sValueName,"DIFFICULTY") ||
|
||||||
; /* Handled in LoadFromKSFFile; don't warn. */
|
0==stricmp(sValueName,"STARTTIME2") ||
|
||||||
else if( 0==stricmp(sValueName,"STARTTIME2") ||
|
0==stricmp(sValueName,"STARTTIME3") )
|
||||||
0==stricmp(sValueName,"STARTTIME3"))
|
{
|
||||||
continue; /* Expected value for other Pump Simulators: don't worry about it here. */
|
continue;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
|
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
|
||||||
}
|
}
|
||||||
@@ -313,8 +317,8 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
|
|||||||
{
|
{
|
||||||
const float BeatsPerSecond = out.GetBPMAtBeat(0) / 60.0f;
|
const float BeatsPerSecond = out.GetBPMAtBeat(0) / 60.0f;
|
||||||
const float beat = BPMPos2 * BeatsPerSecond;
|
const float beat = BPMPos2 * BeatsPerSecond;
|
||||||
LOG->Trace("BPM %f, BPS %f, BPMPos2 %f, beat %f",
|
LOG->Trace( "BPM %f, BPS %f, BPMPos2 %f, beat %f",
|
||||||
out.GetBPMAtBeat(0), BeatsPerSecond, BPMPos2, beat);
|
out.GetBPMAtBeat(0), BeatsPerSecond, BPMPos2, beat );
|
||||||
out.AddBPMSegment( BPMSegment(BeatToNoteRow(beat), BPM2) );
|
out.AddBPMSegment( BPMSegment(BeatToNoteRow(beat), BPM2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,8 +326,8 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
|
|||||||
{
|
{
|
||||||
const float BeatsPerSecond = out.GetBPMAtBeat(0) / 60.0f;
|
const float BeatsPerSecond = out.GetBPMAtBeat(0) / 60.0f;
|
||||||
const float beat = BPMPos3 * BeatsPerSecond;
|
const float beat = BPMPos3 * BeatsPerSecond;
|
||||||
LOG->Trace("BPM %f, BPS %f, BPMPos3 %f, beat %f",
|
LOG->Trace( "BPM %f, BPS %f, BPMPos3 %f, beat %f",
|
||||||
out.GetBPMAtBeat(0), BeatsPerSecond, BPMPos3, beat);
|
out.GetBPMAtBeat(0), BeatsPerSecond, BPMPos3, beat );
|
||||||
out.AddBPMSegment( BPMSegment(BeatToNoteRow(beat), BPM3) );
|
out.AddBPMSegment( BPMSegment(BeatToNoteRow(beat), BPM3) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,8 +336,8 @@ bool KSFLoader::LoadGlobalData( const RString &sPath, Song &out )
|
|||||||
vector<RString> asBits;
|
vector<RString> asBits;
|
||||||
split( sPath, "/", asBits, true);
|
split( sPath, "/", asBits, true);
|
||||||
|
|
||||||
ASSERT(asBits.size() > 1);
|
ASSERT( asBits.size() > 1 );
|
||||||
LoadTags(asBits[asBits.size()-2], out);
|
LoadTags( asBits[asBits.size()-2], out );
|
||||||
}
|
}
|
||||||
|
|
||||||
// search for music with song in the file name
|
// search for music with song in the file name
|
||||||
@@ -359,14 +363,14 @@ bool KSFLoader::LoadFromDir( const RString &sDir, Song &out )
|
|||||||
if( arrayKSFFileNames.empty() )
|
if( arrayKSFFileNames.empty() )
|
||||||
RageException::Throw( "Couldn't find any KSF files in '%s'", sDir.c_str() );
|
RageException::Throw( "Couldn't find any KSF files in '%s'", sDir.c_str() );
|
||||||
|
|
||||||
if(!LoadGlobalData(out.GetSongDir() + arrayKSFFileNames[0], out))
|
if( !LoadGlobalData(out.GetSongDir() + arrayKSFFileNames[0], out) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// load the Steps from the rest of the KSF files
|
// load the Steps from the rest of the KSF files
|
||||||
for( unsigned i=0; i<arrayKSFFileNames.size(); i++ )
|
for( unsigned i=0; i<arrayKSFFileNames.size(); i++ )
|
||||||
{
|
{
|
||||||
Steps* pNewNotes = new Steps;
|
Steps* pNewNotes = new Steps;
|
||||||
if(!LoadFromKSFFile( out.GetSongDir() + arrayKSFFileNames[i], *pNewNotes, out ))
|
if( !LoadFromKSFFile(out.GetSongDir() + arrayKSFFileNames[i], *pNewNotes, out) )
|
||||||
{
|
{
|
||||||
delete pNewNotes;
|
delete pNewNotes;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user