From 083db90df8f5d86c4eac1740507664f864377604 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 11 Dec 2004 10:22:42 +0000 Subject: [PATCH] unload BGA for screens that don't have a background --- stepmania/src/ScreenManager.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 62758f1827..3663aae649 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -355,21 +355,25 @@ retry: } // Load shared BGAnimation + CString sNewBGA; if( pNewScreen->UsesBackground() ) + sNewBGA = THEME->GetPathToB(sScreenName+" background"); + if( sNewBGA.empty() ) { - CString sNewBGA = THEME->GetPathToB(sScreenName+" background"); - if( m_sLastLoadedBackground != sNewBGA ) - { - // Create the new background before deleting the previous so that we keep - // any common textures loaded. - BGAnimation *pNewBGA = new BGAnimation; - pNewBGA->LoadFromAniDir( sNewBGA ); - SAFE_DELETE( m_pSharedBGA ); - m_pSharedBGA = pNewBGA; + m_pSharedBGA->Unload(); + m_sLastLoadedBackground = ""; + } + else if( m_sLastLoadedBackground != sNewBGA ) + { + // Create the new background before deleting the previous so that we keep + // any common textures loaded. + BGAnimation *pNewBGA = new BGAnimation; + pNewBGA->LoadFromAniDir( sNewBGA ); + SAFE_DELETE( m_pSharedBGA ); + m_pSharedBGA = pNewBGA; - m_sLastLoadedBackground = sNewBGA; - } - } + m_sLastLoadedBackground = sNewBGA; + } bool bWasOnSystemMenu = GAMESTATE->m_bIsOnSystemMenu;