From 594587607c60aa545c9f9e4e14c4a7c01bdc7ff0 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 15 Jan 2005 20:37:46 +0000 Subject: [PATCH] Eliminate BGAnimation::LoadFromMovie and BGAnimationLayer::LoadFromMovie. --- stepmania/src/BGAnimation.cpp | 9 --------- stepmania/src/BGAnimation.h | 1 - stepmania/src/BGAnimationLayer.cpp | 11 ----------- stepmania/src/BGAnimationLayer.h | 1 - stepmania/src/Background.cpp | 30 ++++++++++++++++-------------- 5 files changed, 16 insertions(+), 36 deletions(-) diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 079ff26a63..a2bcce5db5 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -178,15 +178,6 @@ void BGAnimation::LoadFromAniDir( const CString &_sAniDir ) } } -void BGAnimation::LoadFromMovie( const CString &sMoviePath ) -{ - Unload(); - - BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric ); - pLayer->LoadFromMovie( sMoviePath ); - AddChild( pLayer ); -} - void BGAnimation::LoadFromNode( const CString &sDir, const XNode& node ) { DEBUG_ASSERT( node.m_sName == "BGAnimation" ); diff --git a/stepmania/src/BGAnimation.h b/stepmania/src/BGAnimation.h index 89a08d119c..503fa15905 100644 --- a/stepmania/src/BGAnimation.h +++ b/stepmania/src/BGAnimation.h @@ -19,7 +19,6 @@ public: void LoadFromStaticGraphic( const CString &sPath ); void LoadFromAniDir( const CString &sAniDir ); - void LoadFromMovie( const CString &sMoviePath ); void LoadFromNode( const CString &sDir, const XNode& node ); protected: diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 5899761181..7fc3d9a128 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -98,17 +98,6 @@ void BGAnimationLayer::LoadFromStaticGraphic( const CString& sPath ) this->AddChild( pSprite ); } -void BGAnimationLayer::LoadFromMovie( const CString& sMoviePath ) -{ - Init(); - Sprite* pSprite = new Sprite; - pSprite->LoadBG( sMoviePath ); - pSprite->StretchTo( FullScreenRectF ); - pSprite->EnableAnimation( false ); - this->AddChild( pSprite ); -} - - void BGAnimationLayer::LoadFromAniLayerFile( const CString& sPath ) { /* Generic BGAs are new. Animation directories with no INI are old and obsolete. diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h index 5888d1dbb2..adc8b0d021 100644 --- a/stepmania/src/BGAnimationLayer.h +++ b/stepmania/src/BGAnimationLayer.h @@ -19,7 +19,6 @@ public: void LoadFromStaticGraphic( const CString& sPath ); void LoadFromAniLayerFile( const CString& sPath ); - void LoadFromMovie( const CString& sMoviePath ); void LoadFromNode( const CString& sAniDir, const XNode& layer ); void Update( float fDeltaTime ); diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 2aad3fd934..8c25a00d7d 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -136,6 +136,15 @@ Actor *MakeVisualization( const CString &sVisPath ) return pFrame; } +Actor *MakeMovie( const CString &sMoviePath ) +{ + Sprite *pSprite = new Sprite; + pSprite->LoadBG( sMoviePath ); + pSprite->StretchTo( FullScreenRectF ); + pSprite->EnableAnimation( false ); + return pSprite; +} + Actor *Background::CreateSongBGA( CString sBGName ) const { BGAnimation *pTempBGA; @@ -162,19 +171,18 @@ Actor *Background::CreateSongBGA( CString sBGName ) const if( sExt.CompareNoCase("avi")==0 || sExt.CompareNoCase("mpg")==0 || sExt.CompareNoCase("mpeg")==0 ) - pTempBGA->LoadFromMovie( asFiles[0] ); + return MakeMovie( asFiles[0] ); else + { + pTempBGA = new BGAnimation; pTempBGA->LoadFromStaticGraphic( asFiles[0] ); - return pTempBGA; + return pTempBGA; + } } // Look for movies in the RandomMovies dir GetDirListing( RANDOMMOVIES_DIR+sBGName, asFiles, false, true ); if( !asFiles.empty() ) - { - pTempBGA = new BGAnimation; - pTempBGA->LoadFromMovie( asFiles[0] ); - return pTempBGA; - } + return MakeMovie( asFiles[0] ); // Look for BGAnims in the BGAnims dir GetDirListing( BG_ANIMS_DIR+sBGName, asFiles, true, true ); @@ -272,13 +280,7 @@ CString Background::CreateRandomBGA() break; } case PrefsManager::BGMODE_MOVIEVIS: ret = MakeVisualization( file ); break; - case PrefsManager::BGMODE_RANDOMMOVIES: - { - BGAnimation *p = new BGAnimation; - p->LoadFromMovie( file ); - ret = p; - break; - } + case PrefsManager::BGMODE_RANDOMMOVIES: ret = MakeMovie( file ); break; default: FAIL_M( ssprintf("%i", PREFSMAN->m_iBackgroundMode) ); } ret->PlayCommand( "On" );