[notesloader] More virtuals.

This commit is contained in:
Jason Felds
2011-06-09 21:27:47 -04:00
parent 68fd21fdc8
commit 1e296ed0bf
11 changed files with 26 additions and 19 deletions
+2 -2
View File
@@ -145,7 +145,7 @@ static void StartMusic( MusicToPlay &ToPlay )
SSCLoader loaderSSC; SSCLoader loaderSSC;
SMLoader loaderSM; SMLoader loaderSM;
if(GetExtension(ToPlay.m_sTimingFile) == ".ssc" && if(GetExtension(ToPlay.m_sTimingFile) == ".ssc" &&
loaderSSC.LoadFromSSCFile(ToPlay.m_sTimingFile, song) ) loaderSSC.LoadFromSimfile(ToPlay.m_sTimingFile, song) )
{ {
ToPlay.HasTiming = true; ToPlay.HasTiming = true;
ToPlay.m_TimingData = song.m_SongTiming; ToPlay.m_TimingData = song.m_SongTiming;
@@ -155,7 +155,7 @@ static void StartMusic( MusicToPlay &ToPlay )
pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData ); pStepsCabinetLights->GetNoteData( ToPlay.m_LightsData );
} }
else if(GetExtension(ToPlay.m_sTimingFile) == ".sm" && else if(GetExtension(ToPlay.m_sTimingFile) == ".sm" &&
loaderSM.LoadFromSMFile(ToPlay.m_sTimingFile, song) ) loaderSM.LoadFromSimfile(ToPlay.m_sTimingFile, song) )
{ {
ToPlay.HasTiming = true; ToPlay.HasTiming = true;
ToPlay.m_TimingData = song.m_SongTiming; ToPlay.m_TimingData = song.m_SongTiming;
+2 -2
View File
@@ -30,7 +30,7 @@ bool SMLoader::LoadFromDir( const RString &sPath, Song &out )
ASSERT( aFileNames.size() == 1 ); ASSERT( aFileNames.size() == 1 );
//ASSERT( aFileNames.size() >= 1 ); //ASSERT( aFileNames.size() >= 1 );
return LoadFromSMFile( sPath + aFileNames[0], out ); return LoadFromSimfile( sPath + aFileNames[0], out );
} }
float SMLoader::RowToBeat( RString line, const int rowsPerBeat ) float SMLoader::RowToBeat( RString line, const int rowsPerBeat )
@@ -598,7 +598,7 @@ bool SMLoader::LoadFromBGChangesString( BackgroundChange &change, const RString
return aBGChangeValues.size() >= 2; return aBGChangeValues.size() >= 2;
} }
bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out, bool bFromCache ) bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache )
{ {
LOG->Trace( "Song::LoadFromSMFile(%s)", sPath.c_str() ); LOG->Trace( "Song::LoadFromSMFile(%s)", sPath.c_str() );
+8 -1
View File
@@ -28,7 +28,14 @@ struct SMLoader
*/ */
virtual void TidyUpData( Song &song, bool bFromCache ); virtual void TidyUpData( Song &song, bool bFromCache );
bool LoadFromSMFile( const RString &sPath, Song &out, bool bFromCache = false ); /**
* @brief Attempt to load the specified sm file.
* @param sPath a const reference to the path on the hard drive to check.
* @param out a reference to the Song that will retrieve the song information.
* @param bFromCache a check to see if we are getting certain information from the cache file.
* @return its success or failure.
*/
virtual bool LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache = false );
/** /**
* @brief Retrieve the list of .sm files. * @brief Retrieve the list of .sm files.
* @param sPath a const reference to the path on the hard drive to check. * @param sPath a const reference to the path on the hard drive to check.
+2 -2
View File
@@ -30,7 +30,7 @@ bool SMALoader::LoadFromDir( const RString &sPath, Song &out )
return false; return false;
} }
ASSERT( aFileNames.size() == 1 ); ASSERT( aFileNames.size() == 1 );
return LoadFromSMAFile( sPath + aFileNames[0], out ); return LoadFromSimfile( sPath + aFileNames[0], out );
} }
void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString sParam ) void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString sParam )
@@ -142,7 +142,7 @@ void SMALoader::ProcessSpeeds( TimingData &out, const RString line, const int ro
} }
} }
bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out ) bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache )
{ {
LOG->Trace( "Song::LoadFromSMAFile(%s)", sPath.c_str() ); LOG->Trace( "Song::LoadFromSMAFile(%s)", sPath.c_str() );
+1 -1
View File
@@ -25,7 +25,7 @@ struct SMALoader : public SMLoader
{ {
bool LoadFromDir( const RString &sPath, Song &out ); bool LoadFromDir( const RString &sPath, Song &out );
bool LoadFromSMAFile( const RString &sPath, Song &out ); virtual bool LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache = false );
/** /**
* @brief Retrieve the list of .sma files. * @brief Retrieve the list of .sma files.
* @param sPath a const reference to the path on the hard drive to check. * @param sPath a const reference to the path on the hard drive to check.
+2 -2
View File
@@ -31,7 +31,7 @@ bool SSCLoader::LoadFromDir( const RString &sPath, Song &out )
} }
ASSERT( aFileNames.size() == 1 ); ASSERT( aFileNames.size() == 1 );
return LoadFromSSCFile( sPath + aFileNames[0], out ); return LoadFromSimfile( sPath + aFileNames[0], out );
} }
void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float fVersion ) void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float fVersion )
@@ -149,7 +149,7 @@ void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
} }
bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCache ) bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache )
{ {
LOG->Trace( "Song::LoadFromSSCFile(%s)", sPath.c_str() ); LOG->Trace( "Song::LoadFromSSCFile(%s)", sPath.c_str() );
+1 -1
View File
@@ -46,7 +46,7 @@ struct SSCLoader : public SMLoader
* @param bFromCache a check to see if we are getting certain information from the cache file. * @param bFromCache a check to see if we are getting certain information from the cache file.
* @return its success or failure. * @return its success or failure.
*/ */
bool LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCache = false ); virtual bool LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache = false );
/** /**
* @brief Retrieve the list of .ssc files. * @brief Retrieve the list of .ssc files.
* @param sPath a const reference to the path on the hard drive to check. * @param sPath a const reference to the path on the hard drive to check.
+2 -2
View File
@@ -24,9 +24,9 @@ void ScreenGameplaySyncMachine::Init()
SSCLoader loaderSSC; SSCLoader loaderSSC;
SMLoader loaderSM; SMLoader loaderSM;
if(sFile.Right(4) == ".ssc") if(sFile.Right(4) == ".ssc")
loaderSSC.LoadFromSSCFile( sFile, m_Song ); loaderSSC.LoadFromSimfile( sFile, m_Song );
else else
loaderSM.LoadFromSMFile( sFile, m_Song ); loaderSM.LoadFromSimfile( sFile, m_Song );
m_Song.SetSongDir( Dirname(sFile) ); m_Song.SetSongDir( Dirname(sFile) );
m_Song.TidyUpData(); m_Song.TidyUpData();
+2 -2
View File
@@ -138,9 +138,9 @@ void ScreenHowToPlay::Init()
SSCLoader loaderSSC; SSCLoader loaderSSC;
SMLoader loaderSM; SMLoader loaderSM;
if( sStepsPath.Right(4) == ".ssc" ) if( sStepsPath.Right(4) == ".ssc" )
loaderSSC.LoadFromSSCFile( sStepsPath, m_Song, false ); loaderSSC.LoadFromSimfile( sStepsPath, m_Song, false );
else else
loaderSM.LoadFromSMFile( sStepsPath, m_Song, false ); loaderSM.LoadFromSimfile( sStepsPath, m_Song, false );
m_Song.AddAutoGenNotes(); m_Song.AddAutoGenNotes();
const Style* pStyle = GAMESTATE->GetCurrentStyle(); const Style* pStyle = GAMESTATE->GetCurrentStyle();
+2 -2
View File
@@ -236,12 +236,12 @@ bool Song::LoadFromSongDir( RString sDir )
{ {
// LOG->Trace( "Loading '%s' from cache file '%s'.", m_sSongDir.c_str(), GetCacheFilePath().c_str() ); // LOG->Trace( "Loading '%s' from cache file '%s'.", m_sSongDir.c_str(), GetCacheFilePath().c_str() );
SSCLoader loaderSSC; SSCLoader loaderSSC;
bool bLoadedFromSSC = loaderSSC.LoadFromSSCFile( sCacheFilePath, *this, true ); bool bLoadedFromSSC = loaderSSC.LoadFromSimfile( sCacheFilePath, *this, true );
if( !bLoadedFromSSC ) if( !bLoadedFromSSC )
{ {
// load from .sm // load from .sm
SMLoader loaderSM; SMLoader loaderSM;
loaderSM.LoadFromSMFile( sCacheFilePath, *this, true ); loaderSM.LoadFromSimfile( sCacheFilePath, *this, true );
loaderSM.TidyUpData( *this, true ); loaderSM.TidyUpData( *this, true );
} }
} }
+2 -2
View File
@@ -243,12 +243,12 @@ void Steps::Decompress() const
// We have data on disk and not in memory. Load it. // We have data on disk and not in memory. Load it.
Song s; Song s;
SSCLoader loaderSSC; SSCLoader loaderSSC;
bool bLoadedFromSSC = loaderSSC.LoadFromSSCFile(m_sFilename, s, true); bool bLoadedFromSSC = loaderSSC.LoadFromSimfile(m_sFilename, s, true);
if( !bLoadedFromSSC ) if( !bLoadedFromSSC )
{ {
// try reading from .sm instead // try reading from .sm instead
SMLoader loaderSM; SMLoader loaderSM;
if( !loaderSM.LoadFromSMFile(m_sFilename, s, true) ) if( !loaderSM.LoadFromSimfile(m_sFilename, s, true) )
{ {
LOG->Warn( "Couldn't load \"%s\"", m_sFilename.c_str() ); LOG->Warn( "Couldn't load \"%s\"", m_sFilename.c_str() );
return; return;