From 635d5e43e2243eed21838f6f868b3fed2fcad6a1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 15 Jan 2005 20:48:20 +0000 Subject: [PATCH] eliminate LoadFromStaticGraphic --- stepmania/src/BGAnimation.cpp | 9 --------- stepmania/src/BGAnimation.h | 1 - stepmania/src/BGAnimationLayer.cpp | 18 +++++------------- stepmania/src/BGAnimationLayer.h | 1 - stepmania/src/Background.cpp | 16 ++++++++-------- 5 files changed, 13 insertions(+), 32 deletions(-) diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index a2bcce5db5..e605d0a5fd 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -29,15 +29,6 @@ void BGAnimation::Unload() DeleteAllChildren(); } -void BGAnimation::LoadFromStaticGraphic( const CString &sPath ) -{ - Unload(); - - BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric ); - pLayer->LoadFromStaticGraphic( sPath ); - AddChild( pLayer ); -} - static bool CompareLayerNames( const CString& s1, const CString& s2 ) { int i1, i2; diff --git a/stepmania/src/BGAnimation.h b/stepmania/src/BGAnimation.h index 503fa15905..7d935ed6f2 100644 --- a/stepmania/src/BGAnimation.h +++ b/stepmania/src/BGAnimation.h @@ -17,7 +17,6 @@ public: void Unload(); - void LoadFromStaticGraphic( const CString &sPath ); void LoadFromAniDir( const CString &sAniDir ); void LoadFromNode( const CString &sDir, const XNode& node ); diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 7fc3d9a128..b52473a790 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -86,18 +86,6 @@ void BGAnimationLayer::Init() m_fTileVelocityY = 0; } -/* Static background layers are simple, uncomposited background images with nothing - * behind them. Since they have nothing behind them, they have no need for alpha, - * so turn that off. */ -void BGAnimationLayer::LoadFromStaticGraphic( const CString& sPath ) -{ - Init(); - Sprite* pSprite = new Sprite; - pSprite->LoadBG( sPath ); - pSprite->StretchTo( FullScreenRectF ); - this->AddChild( pSprite ); -} - void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath ) { /* Generic BGAs are new. Animation directories with no INI are old and obsolete. @@ -116,7 +104,11 @@ void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath ) else sSongBGPath = THEME->GetPathToG("Common fallback background"); - LoadFromStaticGraphic( sSongBGPath ); + Sprite* pSprite = new Sprite; + pSprite->LoadBG( sSongBGPath ); + pSprite->StretchTo( FullScreenRectF ); + this->AddChild( pSprite ); + return; // this will ignore other effects in the file name } diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h index adc8b0d021..2f8aa22bc4 100644 --- a/stepmania/src/BGAnimationLayer.h +++ b/stepmania/src/BGAnimationLayer.h @@ -17,7 +17,6 @@ public: void Init(); void Unload(); - void LoadFromStaticGraphic( const CString& sPath ); void LoadFromAniLayerFile( const CString& sPath ); void LoadFromNode( const CString& sAniDir, const XNode& layer ); diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 8c25a00d7d..ac87b49cd3 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -166,7 +166,6 @@ Actor *Background::CreateSongBGA( CString sBGName ) const GetDirListing( m_pSong->GetSongDir()+sBGName, asFiles, false, true ); if( !asFiles.empty() ) { - pTempBGA = new BGAnimation; const CString sExt = GetExtension( asFiles[0]) ; if( sExt.CompareNoCase("avi")==0 || sExt.CompareNoCase("mpg")==0 || @@ -174,9 +173,10 @@ Actor *Background::CreateSongBGA( CString sBGName ) const return MakeMovie( asFiles[0] ); else { - pTempBGA = new BGAnimation; - pTempBGA->LoadFromStaticGraphic( asFiles[0] ); - return pTempBGA; + Sprite *pSprite = new Sprite; + pSprite->LoadBG( asFiles[0] ); + pSprite->StretchTo( FullScreenRectF ); + return pSprite; } } // Look for movies in the RandomMovies dir @@ -400,10 +400,10 @@ void Background::LoadFromSong( const Song* pSong ) if( bStaticBackgroundUsed ) { CString sSongBGPath = pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathToG("Common fallback background"); - BGAnimation *pTempBGA = new BGAnimation; - pTempBGA->LoadFromStaticGraphic( sSongBGPath ); - pTempBGA->PlayCommand( "On" ); - m_BGAnimations[STATIC_BACKGROUND] = pTempBGA; + Sprite* pSprite = new Sprite; + pSprite->LoadBG( sSongBGPath ); + pSprite->StretchTo( FullScreenRectF ); + m_BGAnimations[STATIC_BACKGROUND] = pSprite; }