ignore #FIRSTBEAT and #LASTBEAT except in cache

This commit is contained in:
Glenn Maynard
2003-01-25 08:10:51 +00:00
parent 4ea9aa7de7
commit ad4f34ca0b
3 changed files with 25 additions and 1 deletions
+16
View File
@@ -115,11 +115,27 @@ bool SMLoader::LoadFromSMFile( CString sPath, Song &out )
else if( 0==stricmp(sValueName,"MUSICLENGTH") )
out.m_fMusicLengthSeconds = (float)atof( sParams[1] );
/* We calculate these. Some SMs in circulation have bogus values for
* these, so make sure we always calculate it ourself. */
else if( 0==stricmp(sValueName,"FIRSTBEAT") )
{
if(!FromCache)
{
LOG->Trace("Ignored #FIRSTBEAT (cache only)");
continue;
}
out.m_fFirstBeat = (float)atof( sParams[1] );
}
else if( 0==stricmp(sValueName,"LASTBEAT") )
{
if(!FromCache)
{
LOG->Trace("Ignored #LASTBEAT (cache only)");
continue;
}
out.m_fLastBeat = (float)atof( sParams[1] );
}
else if( 0==stricmp(sValueName,"SAMPLESTART") )
out.m_fMusicSampleStartSeconds = TimeToSeconds( sParams[1] );
+8
View File
@@ -15,8 +15,16 @@ class SMLoader: public NotesLoader {
CString sNoteData,
Notes &out);
bool FromCache;
public:
SMLoader() { FromCache = false; }
bool LoadFromSMFile( CString sPath, Song &out );
bool LoadFromSMFile( CString sPath, Song &out, bool cache )
{
FromCache=cache;
return LoadFromSMFile( sPath, out );
}
void GetApplicableFiles( CString sPath, CStringArray &out );
bool LoadFromDir( CString sPath, Song &out );
+1 -1
View File
@@ -313,7 +313,7 @@ bool Song::LoadFromSongDir( CString sDir )
{
// LOG->Trace( "Loading '%s' from cache file '%s'.", m_sSongDir.GetString(), GetCacheFilePath().GetString() );
SMLoader ld;
ld.LoadFromSMFile( GetCacheFilePath(), *this );
ld.LoadFromSMFile( GetCacheFilePath(), *this, true );
}
else
{