From 6fa1bda0beb8413e68df371dc68b5fe82435f49d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 27 Dec 2004 01:33:09 +0000 Subject: [PATCH] don't load initial static bg if other negative bgchanges are supplied; don't bother loading the bg itself if it's never used --- stepmania/src/Background.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 1f74ad1077..d34a2b5d8a 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -301,18 +301,6 @@ void Background::LoadFromSong( const Song* pSong ) const float fXZoom = RECT_BACKGROUND.GetWidth() / (float)SCREEN_WIDTH; const float fYZoom = RECT_BACKGROUND.GetHeight() / (float)SCREEN_HEIGHT; - CString sSongBGPath = pSong && pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathToG("Common fallback background"); - - // Load the static background that will show before notes start and after notes end - { - BGAnimation *pTempBGA = new BGAnimation; - pTempBGA->LoadFromStaticGraphic( sSongBGPath ); - m_BGAnimations[STATIC_BACKGROUND] = pTempBGA; - } - - - // start off showing the static song background - m_aBGChanges.push_back( BackgroundChange(-10000,STATIC_BACKGROUND) ); if( pSong->HasBGChanges() ) @@ -353,6 +341,25 @@ void Background::LoadFromSong( const Song* pSong ) // sort segments SortBackgroundChangesArray( m_aBGChanges ); + /* If the first BGAnimation isn't negative, add a lead-in image showing the song + * background. */ + if( m_aBGChanges.empty() || m_aBGChanges.front().m_fStartBeat >= 0 ) + m_aBGChanges.insert( m_aBGChanges.begin(), BackgroundChange(-10000,STATIC_BACKGROUND) ); + + // If any BGChanges use the background image, load it. + bool bStaticBackgroundUsed = false; + for( unsigned i=0; iHasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathToG("Common fallback background"); + BGAnimation *pTempBGA = new BGAnimation; + pTempBGA->LoadFromStaticGraphic( sSongBGPath ); + m_BGAnimations[STATIC_BACKGROUND] = pTempBGA; + } + + // Look for the filename "Random", and replace the segment with LoadFromRandom. unsigned i = 0; for( i=0; i