don't add the song BG as a BGA if it's already there

This commit is contained in:
Glenn Maynard
2004-09-19 06:27:44 +00:00
parent 5561f6a39d
commit be433d50d2
+22 -12
View File
@@ -486,7 +486,7 @@ void SMLoader::TidyUpData( Song &song, bool cache )
if( !bg.empty() ) if( !bg.empty() )
{ {
/* BGChanges have been sorted. On the odd chance that a BGChange exists /* BGChanges have been sorted. On the odd chance that a BGChange exists
* with a very high beat, search the whole list. */ * with a very high beat, search the whole list. */
bool bHasNoSongBgTag = false; bool bHasNoSongBgTag = false;
for( unsigned i = 0; !bHasNoSongBgTag && i < bg.size(); ++i ) for( unsigned i = 0; !bHasNoSongBgTag && i < bg.size(); ++i )
@@ -498,18 +498,28 @@ void SMLoader::TidyUpData( Song &song, bool cache )
} }
} }
/* /* If there's no -nosongbg- tag, add the song BG. */
* If we're loading cache, -nosongbg- should always be in there. We must if( !bHasNoSongBgTag ) do
* not call IsAFile(song.GetBackgroundPath()) when loading cache. {
* /* If we're loading cache, -nosongbg- should always be in there. We must
* If BGChanges already exist after the last beat, don't add the background * not call IsAFile(song.GetBackgroundPath()) when loading cache. */
* in the middle. if( cache )
*/ break;
if( !cache &&
bg.back().m_fStartBeat-0.0001f < song.m_fLastBeat && /* If BGChanges already exist after the last beat, don't add the background
!bHasNoSongBgTag && * in the middle. */
IsAFile( song.GetBackgroundPath() ) ) if( !bg.empty() && bg.back().m_fStartBeat-0.0001f >= song.m_fLastBeat )
break;
/* If the last BGA is already the song BGA, don't add a duplicate. */
if( !bg.empty() && !bg.back().m_sBGName.CompareNoCase(song.m_sBackgroundFile) )
break;
if( !IsAFile( song.GetBackgroundPath() ) )
break;
bg.push_back( BackgroundChange(song.m_fLastBeat,song.m_sBackgroundFile) ); bg.push_back( BackgroundChange(song.m_fLastBeat,song.m_sBackgroundFile) );
} while(0);
} }
} }