Flatten song parsing code a bit. (Gah--that makes patches look really big, when most of the lines are really just changing indentation.)
More minor const fixes in Notes. Handle #DIFFICULTY in KSF. Fix spurious warnings about KSF keys. Clean up KSF parsing slightly.
This commit is contained in:
+13
-13
@@ -742,6 +742,7 @@ bool Notes::LoadFromKSFFile( const CString &sPath )
|
||||
throw RageException( "Error opening file '%s'.", sPath );
|
||||
|
||||
int iTickCount = -1; // this is the value we read for TICKCOUNT
|
||||
CString iStep; // this is the value we read for STEP
|
||||
|
||||
for( int i=0; i<msd.m_iNumValues; i++ )
|
||||
{
|
||||
@@ -754,18 +755,22 @@ bool Notes::LoadFromKSFFile( const CString &sPath )
|
||||
iTickCount = atoi(sParams[1]);
|
||||
|
||||
else if( 0==stricmp(sValueName,"STEP") )
|
||||
{
|
||||
iStep = sParams[1];
|
||||
else if( 0==stricmp(sValueName,"DIFFICULTY") )
|
||||
m_iMeter = atoi(sParams[1]);
|
||||
}
|
||||
|
||||
if( iTickCount == -1 )
|
||||
{
|
||||
LOG->Warn( "In KSF file '%s', STEP was read before TICKCOUNT", sPath );
|
||||
iTickCount = 2;
|
||||
LOG->Warn( "TICKCOUNT not found; defaulting to %i", sPath, iTickCount );
|
||||
}
|
||||
|
||||
NoteData notedata; // read it into here
|
||||
|
||||
CStringArray asRows;
|
||||
sParams[1].TrimLeft();
|
||||
split( sParams[1], "\n", asRows, true );
|
||||
iStep.TrimLeft();
|
||||
split( iStep, "\n", asRows, true );
|
||||
|
||||
int iHoldStartRow[13];
|
||||
for( int t=0; t<13; t++ )
|
||||
@@ -811,22 +816,22 @@ bool Notes::LoadFromKSFFile( const CString &sPath )
|
||||
if( sFName.Find("crazy")!=-1 )
|
||||
{
|
||||
m_DifficultyClass = CLASS_HARD;
|
||||
m_iMeter = 8;
|
||||
if(!m_iMeter) m_iMeter = 8;
|
||||
}
|
||||
else if( sFName.Find("hard")!=-1 )
|
||||
{
|
||||
m_DifficultyClass = CLASS_MEDIUM;
|
||||
m_iMeter = 5;
|
||||
if(!m_iMeter) m_iMeter = 5;
|
||||
}
|
||||
else if( sFName.Find("easy")!=-1 )
|
||||
{
|
||||
m_DifficultyClass = CLASS_EASY;
|
||||
m_iMeter = 2;
|
||||
if(!m_iMeter) m_iMeter = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DifficultyClass = CLASS_MEDIUM;
|
||||
m_iMeter = 5;
|
||||
if(!m_iMeter) m_iMeter = 5;
|
||||
}
|
||||
|
||||
if( sFName.Find("double") != -1 )
|
||||
@@ -841,11 +846,6 @@ bool Notes::LoadFromKSFFile( const CString &sPath )
|
||||
}
|
||||
|
||||
m_sSMNoteData = notedata.GetSMNoteDataString();
|
||||
}
|
||||
|
||||
else
|
||||
LOG->Trace( "Unexpected value named '%s'", sValueName );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ void SortStopSegmentsArray( CArray<StopSegment,StopSegment&> &arrayStopSegments
|
||||
int CompareAnimationSegments(const void *arg1, const void *arg2)
|
||||
{
|
||||
// arg1 and arg2 are of type Step**
|
||||
AnimationSegment* seg1 = (AnimationSegment*)arg1;
|
||||
AnimationSegment* seg2 = (AnimationSegment*)arg2;
|
||||
const AnimationSegment* seg1 = (const AnimationSegment*)arg1;
|
||||
const AnimationSegment* seg2 = (const AnimationSegment*)arg2;
|
||||
|
||||
float score1 = seg1->m_fStartBeat;
|
||||
float score2 = seg2->m_fStartBeat;
|
||||
@@ -469,8 +469,9 @@ bool Song::LoadFromBMSDir( CString sDir )
|
||||
// valuename, sNoteData, iMeasureNo, iBMSTrackNo, iNumNotesInThisMeasure );
|
||||
for( int j=0; j<iNumNotesInThisMeasure; j++ )
|
||||
{
|
||||
if( arrayNotes[j] != 0 )
|
||||
{
|
||||
if( arrayNotes[j] == 0 )
|
||||
continue;
|
||||
|
||||
float fPercentThroughMeasure = (float)j/(float)iNumNotesInThisMeasure;
|
||||
|
||||
// index is in quarter beats starting at beat 0
|
||||
@@ -653,7 +654,6 @@ bool Song::LoadFromBMSDir( CString sDir )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( i=0; i<m_BPMSegments.GetSize(); i++ )
|
||||
LOG->Trace( "There is a BPM change at beat %f, BPM %f, index %d",
|
||||
@@ -1013,7 +1013,10 @@ bool Song::LoadFromKSFDir( CString sDir )
|
||||
|
||||
else if( 0==stricmp(sValueName,"STARTTIME") )
|
||||
m_fBeat0OffsetInSeconds = -(float)atof(sParams[1])/100;
|
||||
|
||||
else if( 0==stricmp(sValueName,"TICKCOUNT") ||
|
||||
0==stricmp(sValueName,"STEP") ||
|
||||
0==stricmp(sValueName,"DIFFICULTY"))
|
||||
; /* Handled in Notes::LoadFromKSFFile; don't warn. */
|
||||
else
|
||||
LOG->Trace( "Unexpected value named '%s'", sValueName );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user