ignore #FIRSTBEAT and #LASTBEAT except in cache
This commit is contained in:
@@ -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] );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user