From 8e1fa6955b621f1ad416610a31f8e2769a9b3b8e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 18 Dec 2003 08:21:18 +0000 Subject: [PATCH] add SMLoader::LoadTimingFromSMFile --- stepmania/src/NotesLoaderSM.cpp | 146 +++++++++++++++++--------------- stepmania/src/NotesLoaderSM.h | 3 + 2 files changed, 83 insertions(+), 66 deletions(-) diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index a0620eca20..8580ccef26 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -58,23 +58,96 @@ void SMLoader::GetApplicableFiles( CString sPath, CStringArray &out ) GetDirListing( sPath + CString("*.sm"), out ); } +void SMLoader::LoadTimingFromSMFile( MsdFile &msd, TimingData &out ) +{ + out.m_BPMSegments.clear(); + out.m_StopSegments.clear(); + + for( unsigned i=0; iTrace( "Song::LoadFromSMFile(%s)", sPath.c_str() ); - out.m_Timing.m_BPMSegments.clear(); - out.m_Timing.m_StopSegments.clear(); - MsdFile msd; bool bResult = msd.ReadFile( sPath ); if( !bResult ) RageException::Throw( "Error opening file '%s'.", sPath.c_str() ); + LoadTimingFromSMFile( msd, out.m_Timing ); + for( unsigned i=0; iWarn( "The song file '%s' has an unknown #SELECTABLE value, '%s'; ignored.", sPath.c_str(), sParams[1].c_str()); } - else if( 0==stricmp(sValueName,"STOPS") || 0==stricmp(sValueName,"FREEZES") ) - { - CStringArray arrayFreezeExpressions; - split( sParams[1], ",", arrayFreezeExpressions ); - - for( unsigned f=0; f=8)?sParams[7]:"", *pNewNotes); } + else if( 0==stricmp(sValueName,"OFFSET") || 0==stricmp(sValueName,"BPMS") || + 0==stricmp(sValueName,"STOPS") || 0==stricmp(sValueName,"FREEZES") ) + ; else LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() ); } diff --git a/stepmania/src/NotesLoaderSM.h b/stepmania/src/NotesLoaderSM.h index c1776c1138..eae104c90f 100644 --- a/stepmania/src/NotesLoaderSM.h +++ b/stepmania/src/NotesLoaderSM.h @@ -5,6 +5,8 @@ #include "Steps.h" #include "NotesLoader.h" +class MsdFile; + class SMLoader: public NotesLoader { static void LoadFromSMTokens( CString sNotesType, @@ -29,6 +31,7 @@ public: void GetApplicableFiles( CString sPath, CStringArray &out ); bool LoadFromDir( CString sPath, Song &out ); + static void LoadTimingFromSMFile( MsdFile &msd, TimingData &out ); }; #endif