diff --git a/src/NotesLoaderSMA.cpp b/src/NotesLoaderSMA.cpp index 352def3295..4a20ff4b14 100644 --- a/src/NotesLoaderSMA.cpp +++ b/src/NotesLoaderSMA.cpp @@ -223,6 +223,53 @@ void SMALoader::ProcessDelays( TimingData &out, const int iRowsPerBeat, const RS } } +void SMALoader::ProcessTickcounts( TimingData &out, const int iRowsPerBeat, const RString sParam ) +{ + vector arrayTickcountExpressions; + split( sParam, ",", arrayTickcountExpressions ); + + for( unsigned f=0; f arrayTickcountValues; + split( arrayTickcountExpressions[f], "=", arrayTickcountValues ); + if( arrayTickcountValues.size() != 2 ) + { + // XXX: Hard to tell which file caused this. + LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #TICKCOUNTS value \"%s\" (must have exactly one '='), ignored.", + arrayTickcountExpressions[f].c_str() ); + continue; + } + + const float fTickcountBeat = RowToBeat( arrayTickcountValues[0], iRowsPerBeat ); + int iTicks = clamp(atoi( arrayTickcountValues[1] ), 0, ROWS_PER_BEAT); + + TickcountSegment new_seg( BeatToNoteRow(fTickcountBeat), iTicks ); + out.AddTickcountSegment( new_seg ); + } +} + +void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString sParam ) +{ + vector arrayMultiplierExpressions; + split( sParam, ",", arrayMultiplierExpressions ); + + for( unsigned f=0; f arrayMultiplierValues; + split( arrayMultiplierExpressions[f], "=", arrayMultiplierValues ); + if( arrayMultiplierValues.size() != 2 ) + { + LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #MULTIPLIER value \"%s\" (must have exactly one '='), ignored.", + arrayMultiplierExpressions[f].c_str() ); + continue; + } + const float fComboBeat = RowToBeat( arrayMultiplierValues[0], iRowsPerBeat ); + const int iCombos = StringToInt( arrayMultiplierValues[1] ); + ComboSegment new_seg( BeatToNoteRow( fComboBeat ), iCombos ); + out.AddComboSegment( new_seg ); + } +} + void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam ) { vector vs1; @@ -569,6 +616,23 @@ bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out ) ProcessDelays( timing, iRowsPerBeat, sParams[1] ); } + else if( sValueName=="TICKCOUNT" ) + { + TimingData &timing = (state == SMA_GETTING_STEP_INFO + ? pNewNotes->m_Timing : out.m_SongTiming); + ProcessTickcounts( timing, iRowsPerBeat, sParams[1] ); + } + + else if( sValueName=="SPEED" ) + { + ; // This is something we should consider implementing. + } + + else if( sValueName=="MULTIPLIER" ) + { + ProcessMultipliers( pNewNotes->m_Timing, iRowsPerBeat, sParams[1] ); + } + else if( sValueName=="KEYSOUNDS" ) { split( sParams[1], ",", out.m_vsKeysoundFile ); @@ -603,7 +667,7 @@ bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out ) * We used to check for timing data in this section. That has * since been moved to a dedicated function. */ - else if( sValueName=="TIMESIGNATURES" || sValueName=="LEADTRACK" || sValueName=="TICKCOUNTS" ) + else if( sValueName=="TIMESIGNATURES" || sValueName=="LEADTRACK" ) ; else LOG->UserLog( "Song file", sPath, "has an unexpected value named \"%s\".", sValueName.c_str() ); diff --git a/src/NotesLoaderSMA.h b/src/NotesLoaderSMA.h index 089eabe5ca..1c40b462f2 100644 --- a/src/NotesLoaderSMA.h +++ b/src/NotesLoaderSMA.h @@ -45,6 +45,8 @@ namespace SMALoader bool ProcessBPMs( TimingData &out, const int iRowsPerBeat, const RString sParam ); void ProcessStops( TimingData &out, const int iRowsPerBeat, const RString sParam ); void ProcessDelays( TimingData &out, const int iRowsPerBeat, const RString sParam ); + void ProcessTickcounts( TimingData &out, const int iRowsPerBeat, const RString sParam ); + void ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString sParam ); float RowToBeat( RString sLine, const int iRowsPerBeat ); }; diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index abb5a72adf..74015106f5 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -120,7 +120,7 @@ void SSCLoader::ProcessCombos( TimingData &out, const RString sParam ) continue; } const float fComboBeat = StringToFloat( arrayComboValues[0] ); - const int iCombos = atoi( arrayComboValues[1] ); + const int iCombos = StringToInt( arrayComboValues[1] ); ComboSegment new_seg( BeatToNoteRow( fComboBeat ), iCombos ); out.AddComboSegment( new_seg ); }