[notesloader] Handle fakes on their own.
This commit is contained in:
@@ -493,6 +493,35 @@ void SMLoader::ProcessSpeeds( TimingData &out, const RString line, const int row
|
||||
}
|
||||
}
|
||||
|
||||
void SMLoader::ProcessFakes( TimingData &out, const RString line, const int rowsPerBeat )
|
||||
{
|
||||
vector<RString> arrayFakeExpressions;
|
||||
split( line, ",", arrayFakeExpressions );
|
||||
|
||||
for( unsigned b=0; b<arrayFakeExpressions.size(); b++ )
|
||||
{
|
||||
vector<RString> arrayFakeValues;
|
||||
split( arrayFakeExpressions[b], "=", arrayFakeValues );
|
||||
// XXX: Hard to tell which file caused this.
|
||||
if( arrayFakeValues.size() != 2 )
|
||||
{
|
||||
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #FAKES value \"%s\" (must have exactly one '='), ignored.",
|
||||
arrayFakeExpressions[b].c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = RowToBeat( arrayFakeValues[0], rowsPerBeat );
|
||||
const float fNewBeat = StringToFloat( arrayFakeValues[1] );
|
||||
|
||||
if(fNewBeat > 0)
|
||||
out.AddFakeSegment( FakeSegment(fBeat, fNewBeat) );
|
||||
else
|
||||
{
|
||||
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid Fake at beat %f, BPM %f.", fBeat, fNewBeat );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SMLoader::LoadFromBGChangesString( BackgroundChange &change, const RString &sBGChangeExpression )
|
||||
{
|
||||
vector<RString> aBGChangeValues;
|
||||
|
||||
@@ -91,6 +91,15 @@ struct SMLoader
|
||||
const RString line,
|
||||
const int rowsPerBeat = -1) {}
|
||||
|
||||
/**
|
||||
* @brief Process the Fake Segments from the string.
|
||||
* @param out the TimingData being modified.
|
||||
* @param line the string in question.
|
||||
* @param rowsPerBeat the number of rows per beat for this purpose. */
|
||||
virtual void ProcessFakes(TimingData & out,
|
||||
const RString line,
|
||||
const int rowsPerBeat = -1);
|
||||
|
||||
virtual void ProcessBGChanges( Song &out, const RString &sValueName,
|
||||
const RString &sPath, const RString &sParam );
|
||||
void ProcessAttacks( Song &out, MsdFile::value_t sParams );
|
||||
|
||||
+1
-30
@@ -142,35 +142,6 @@ void SMALoader::ProcessSpeeds( TimingData &out, const RString line, const int ro
|
||||
}
|
||||
}
|
||||
|
||||
void SMALoader::ProcessFakes( TimingData &out, const int iRowsPerBeat, const RString sParam )
|
||||
{
|
||||
vector<RString> arrayFakeExpressions;
|
||||
split( sParam, ",", arrayFakeExpressions );
|
||||
|
||||
for( unsigned b=0; b<arrayFakeExpressions.size(); b++ )
|
||||
{
|
||||
vector<RString> arrayFakeValues;
|
||||
split( arrayFakeExpressions[b], "=", arrayFakeValues );
|
||||
// XXX: Hard to tell which file caused this.
|
||||
if( arrayFakeValues.size() != 2 )
|
||||
{
|
||||
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #FAKES value \"%s\" (must have exactly one '='), ignored.",
|
||||
arrayFakeExpressions[b].c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = RowToBeat( arrayFakeValues[0], iRowsPerBeat );
|
||||
const float fNewBeat = StringToFloat( arrayFakeValues[1] );
|
||||
|
||||
if(fNewBeat > 0)
|
||||
out.AddFakeSegment( FakeSegment(fBeat, fNewBeat) );
|
||||
else
|
||||
{
|
||||
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid Fake at beat %f, BPM %f.", fBeat, fNewBeat );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out )
|
||||
{
|
||||
LOG->Trace( "Song::LoadFromSMAFile(%s)", sPath.c_str() );
|
||||
@@ -438,7 +409,7 @@ bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out )
|
||||
{
|
||||
TimingData &timing = (state == SMA_GETTING_STEP_INFO
|
||||
? pNewNotes->m_Timing : out.m_SongTiming);
|
||||
ProcessFakes( timing, iRowsPerBeat, sParams[1] );
|
||||
ProcessFakes( timing, sParams[1], iRowsPerBeat );
|
||||
}
|
||||
|
||||
else if( sValueName=="METERTYPE" )
|
||||
|
||||
@@ -31,7 +31,6 @@ struct SMALoader : public SMLoader
|
||||
void ProcessBeatsPerMeasure( TimingData &out, const RString sParam );
|
||||
void ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString sParam );
|
||||
virtual void ProcessSpeeds( TimingData &out, const RString line, const int rowsPerBeat );
|
||||
void ProcessFakes( TimingData &out, const int iRowsPerBeat, const RString sParam );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -149,35 +149,6 @@ void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
|
||||
}
|
||||
}
|
||||
|
||||
void SSCLoader::ProcessFakes( TimingData &out, const RString sParam )
|
||||
{
|
||||
vector<RString> arrayFakeExpressions;
|
||||
split( sParam, ",", arrayFakeExpressions );
|
||||
|
||||
for( unsigned b=0; b<arrayFakeExpressions.size(); b++ )
|
||||
{
|
||||
vector<RString> arrayFakeValues;
|
||||
split( arrayFakeExpressions[b], "=", arrayFakeValues );
|
||||
// XXX: Hard to tell which file caused this.
|
||||
if( arrayFakeValues.size() != 2 )
|
||||
{
|
||||
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #FAKES value \"%s\" (must have exactly one '='), ignored.",
|
||||
arrayFakeExpressions[b].c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = StringToFloat( arrayFakeValues[0] );
|
||||
const float fNewBeat = StringToFloat( arrayFakeValues[1] );
|
||||
|
||||
if(fNewBeat > 0)
|
||||
out.AddFakeSegment( FakeSegment(fBeat, fNewBeat) );
|
||||
else
|
||||
{
|
||||
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid Fake at beat %f, BPM %f.", fBeat, fNewBeat );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCache )
|
||||
{
|
||||
|
||||
@@ -76,7 +76,6 @@ struct SSCLoader : public SMLoader
|
||||
void ProcessLabels( TimingData &, const RString );
|
||||
virtual void ProcessCombos( TimingData &, const RString, const int = -1 );
|
||||
void ProcessScrolls( TimingData &, const RString );
|
||||
void ProcessFakes( TimingData &, const RString );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user