make UseSongBG work for BGAnimations not inside of Background (e.g. on ScreenStage)

This commit is contained in:
Chris Danford
2003-03-10 02:46:01 +00:00
parent 89040e1ba1
commit f5402584f9
7 changed files with 35 additions and 22 deletions
+9 -4
View File
@@ -17,6 +17,8 @@
#include "IniFile.h" #include "IniFile.h"
#include "BGAnimationLayer.h" #include "BGAnimationLayer.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "Song.h"
#include "ThemeManager.h"
BGAnimation::BGAnimation() BGAnimation::BGAnimation()
@@ -45,7 +47,7 @@ void BGAnimation::LoadFromStaticGraphic( CString sPath )
m_Layers.push_back( pLayer ); m_Layers.push_back( pLayer );
} }
void BGAnimation::LoadFromAniDir( CString sAniDir, CString sSongBGPath ) void BGAnimation::LoadFromAniDir( CString sAniDir )
{ {
Unload(); Unload();
@@ -71,7 +73,7 @@ void BGAnimation::LoadFromAniDir( CString sAniDir, CString sSongBGPath )
if( pKey == NULL ) if( pKey == NULL )
break; break;
BGAnimationLayer* pLayer = new BGAnimationLayer; BGAnimationLayer* pLayer = new BGAnimationLayer;
pLayer->LoadFromIni( sAniDir, sLayer, sSongBGPath ); pLayer->LoadFromIni( sAniDir, sLayer );
m_Layers.push_back( pLayer ); m_Layers.push_back( pLayer );
} }
} }
@@ -101,7 +103,7 @@ void BGAnimation::LoadFromAniDir( CString sAniDir, CString sSongBGPath )
if( sFName.Left(1) == "_" ) if( sFName.Left(1) == "_" )
continue; // don't directly load files starting with an underscore continue; // don't directly load files starting with an underscore
BGAnimationLayer* pLayer = new BGAnimationLayer; BGAnimationLayer* pLayer = new BGAnimationLayer;
pLayer->LoadFromAniLayerFile( asImagePaths[i], sSongBGPath ); pLayer->LoadFromAniLayerFile( asImagePaths[i] );
m_Layers.push_back( pLayer ); m_Layers.push_back( pLayer );
} }
} }
@@ -116,11 +118,14 @@ void BGAnimation::LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind )
m_Layers.push_back( pLayer ); m_Layers.push_back( pLayer );
} }
void BGAnimation::LoadFromVisualization( CString sVisPath, CString sSongBGPath ) void BGAnimation::LoadFromVisualization( CString sVisPath )
{ {
Unload(); Unload();
BGAnimationLayer* pLayer; BGAnimationLayer* pLayer;
Song* pSong = GAMESTATE->m_pCurSong;
CString sSongBGPath = pSong && pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","Common fallback background");
pLayer = new BGAnimationLayer; pLayer = new BGAnimationLayer;
pLayer->LoadFromStaticGraphic( sSongBGPath ); pLayer->LoadFromStaticGraphic( sSongBGPath );
m_Layers.push_back( pLayer ); m_Layers.push_back( pLayer );
+2 -2
View File
@@ -28,9 +28,9 @@ public:
void Unload(); void Unload();
void LoadFromStaticGraphic( CString sPath ); void LoadFromStaticGraphic( CString sPath );
void LoadFromAniDir( CString sAniDir, CString sSongBGPath="" ); void LoadFromAniDir( CString sAniDir );
void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ); void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind );
void LoadFromVisualization( CString sMoviePath, CString sSongBGPath ); void LoadFromVisualization( CString sMoviePath );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void DrawPrimitives(); virtual void DrawPrimitives();
+10 -2
View File
@@ -20,6 +20,8 @@
#include <math.h> #include <math.h>
#include "RageTimer.h" #include "RageTimer.h"
#include "RageLog.h" #include "RageLog.h"
#include "Song.h"
#include "ThemeManager.h"
inline float GetOffScreenLeft( Actor* pActor ) { return SCREEN_LEFT - pActor->GetZoomedWidth()/2; } inline float GetOffScreenLeft( Actor* pActor ) { return SCREEN_LEFT - pActor->GetZoomedWidth()/2; }
@@ -145,8 +147,11 @@ void BGAnimationLayer::LoadFromVisualization( CString sMoviePath )
} }
void BGAnimationLayer::LoadFromAniLayerFile( CString sPath, CString sSongBGPath ) void BGAnimationLayer::LoadFromAniLayerFile( CString sPath )
{ {
Song* pSong = GAMESTATE->m_pCurSong;
CString sSongBGPath = pSong && pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","Common fallback background");
Init(); Init();
CString lcPath = sPath; CString lcPath = sPath;
lcPath.MakeLower(); lcPath.MakeLower();
@@ -438,8 +443,11 @@ void BGAnimationLayer::LoadFromAniLayerFile( CString sPath, CString sSongBGPath
} }
void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer, CString sSongBGPath ) void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
{ {
Song* pSong = GAMESTATE->m_pCurSong;
CString sSongBGPath = pSong && pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","Common fallback background");
Init(); Init();
if( sAniDir.Right(1) != "/" ) if( sAniDir.Right(1) != "/" )
sAniDir += "/"; sAniDir += "/";
+2 -2
View File
@@ -27,10 +27,10 @@ public:
void Init(); void Init();
void LoadFromStaticGraphic( CString sPath ); void LoadFromStaticGraphic( CString sPath );
void LoadFromAniLayerFile( CString sPath, CString sSongBGPath ); void LoadFromAniLayerFile( CString sPath );
void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ); void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind );
void LoadFromVisualization( CString sMoviePath ); void LoadFromVisualization( CString sMoviePath );
void LoadFromIni( CString sDir, CString sLayer, CString sSongBGPath ); void LoadFromIni( CString sDir, CString sLayer );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Draw(); virtual void Draw();
+10 -10
View File
@@ -93,7 +93,7 @@ void Background::LoadFromAniDir( CString sAniDir )
m_BGAnimations.push_back( pTempBGA ); m_BGAnimations.push_back( pTempBGA );
} }
BGAnimation *Background::GetBGA(const Song *pSong, const BackgroundChange &aniseg, const CString &bgpath) const BGAnimation *Background::GetBGA(const Song *pSong, const BackgroundChange &aniseg) const
{ {
BGAnimation *pTempBGA; BGAnimation *pTempBGA;
@@ -107,7 +107,7 @@ BGAnimation *Background::GetBGA(const Song *pSong, const BackgroundChange &anise
if( !asFiles.empty() ) if( !asFiles.empty() )
{ {
pTempBGA = new BGAnimation; pTempBGA = new BGAnimation;
pTempBGA->LoadFromAniDir( asFiles[0], bgpath ); pTempBGA->LoadFromAniDir( asFiles[0] );
return pTempBGA; return pTempBGA;
} }
// Look for BG movies in the song dir // Look for BG movies in the song dir
@@ -132,7 +132,7 @@ BGAnimation *Background::GetBGA(const Song *pSong, const BackgroundChange &anise
if( !asFiles.empty() ) if( !asFiles.empty() )
{ {
pTempBGA = new BGAnimation; pTempBGA = new BGAnimation;
pTempBGA->LoadFromAniDir( asFiles[0], bgpath ); pTempBGA->LoadFromAniDir( asFiles[0] );
return pTempBGA; return pTempBGA;
} }
@@ -141,7 +141,7 @@ BGAnimation *Background::GetBGA(const Song *pSong, const BackgroundChange &anise
if( !asFiles.empty() ) if( !asFiles.empty() )
{ {
pTempBGA = new BGAnimation; pTempBGA = new BGAnimation;
pTempBGA->LoadFromVisualization( asFiles[0], bgpath ); pTempBGA->LoadFromVisualization( asFiles[0] );
return pTempBGA; return pTempBGA;
} }
return NULL; return NULL;
@@ -154,7 +154,7 @@ void Background::LoadFromSong( Song* pSong )
const float fXZoom = RECT_BACKGROUND.GetWidth() / (float)SCREEN_WIDTH; const float fXZoom = RECT_BACKGROUND.GetWidth() / (float)SCREEN_WIDTH;
const float fYZoom = RECT_BACKGROUND.GetHeight() / (float)SCREEN_HEIGHT; const float fYZoom = RECT_BACKGROUND.GetHeight() / (float)SCREEN_HEIGHT;
const CString sSongBackgroundPath = pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","Background fallback"); CString sSongBGPath = pSong && pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","Common fallback background");
// //
// Load the static background that will before notes start and after notes end // Load the static background that will before notes start and after notes end
@@ -162,7 +162,7 @@ void Background::LoadFromSong( Song* pSong )
{ {
BGAnimation *pTempBGA = new BGAnimation; BGAnimation *pTempBGA = new BGAnimation;
pTempBGA->LoadFromStaticGraphic( sSongBackgroundPath ); pTempBGA->LoadFromStaticGraphic( sSongBGPath );
m_BGAnimations.push_back( pTempBGA ); m_BGAnimations.push_back( pTempBGA );
} }
@@ -178,7 +178,7 @@ void Background::LoadFromSong( Song* pSong )
const BackgroundChange& aniseg = pSong->m_BackgroundChanges[i]; const BackgroundChange& aniseg = pSong->m_BackgroundChanges[i];
bool bFade = i==0; bool bFade = i==0;
BGAnimation *pTempBGA = GetBGA(pSong, aniseg, sSongBackgroundPath); BGAnimation *pTempBGA = GetBGA(pSong, aniseg);
if(pTempBGA != NULL) if(pTempBGA != NULL)
{ {
@@ -231,12 +231,12 @@ void Background::LoadFromSong( Song* pSong )
{ {
unsigned index = rand() % arrayPossibleMovies.size(); unsigned index = rand() % arrayPossibleMovies.size();
pTempBGA = new BGAnimation; pTempBGA = new BGAnimation;
pTempBGA->LoadFromVisualization( arrayPossibleMovies[index], sSongBackgroundPath ); pTempBGA->LoadFromVisualization( arrayPossibleMovies[index] );
} }
else else
{ {
pTempBGA = new BGAnimation; pTempBGA = new BGAnimation;
pTempBGA->LoadFromStaticGraphic( sSongBackgroundPath ); pTempBGA->LoadFromStaticGraphic( sSongBGPath );
} }
m_BGAnimations.push_back( pTempBGA ); m_BGAnimations.push_back( pTempBGA );
} }
@@ -255,7 +255,7 @@ void Background::LoadFromSong( Song* pSong )
{ {
unsigned index = rand() % arrayPossibleAnims.size(); unsigned index = rand() % arrayPossibleAnims.size();
BGAnimation *pTempBGA = new BGAnimation; BGAnimation *pTempBGA = new BGAnimation;
pTempBGA->LoadFromAniDir( arrayPossibleAnims[index], sSongBackgroundPath ); pTempBGA->LoadFromAniDir( arrayPossibleAnims[index] );
m_BGAnimations.push_back( pTempBGA ); m_BGAnimations.push_back( pTempBGA );
arrayPossibleAnims.erase( arrayPossibleAnims.begin()+index, arrayPossibleAnims.erase( arrayPossibleAnims.begin()+index,
arrayPossibleAnims.begin()+index+1 ); arrayPossibleAnims.begin()+index+1 );
+1 -1
View File
@@ -54,7 +54,7 @@ public:
protected: protected:
bool DangerVisible(); bool DangerVisible();
BGAnimation *GetBGA(const Song *pSong, const BackgroundChange &aniseg, const CString &bgpath) const; BGAnimation *GetBGA(const Song *pSong, const BackgroundChange &aniseg) const;
BGAnimation m_BGADanger; BGAnimation m_BGADanger;
+1 -1
View File
@@ -166,7 +166,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
m_BannerWithFrame[0].SetXY( BANNER_X, BANNER_Y ); m_BannerWithFrame[0].SetXY( BANNER_X, BANNER_Y );
this->AddChild( &m_BannerWithFrame[0] ); this->AddChild( &m_BannerWithFrame[0] );
m_sprStage.Load( THEME->GetPathTo("Graphics","ScreenEvaluation "+GAMESTATE->GetStageText()) ); m_sprStage.Load( THEME->GetPathTo("Graphics","ScreenEvaluation stage "+GAMESTATE->GetStageText()) );
m_sprStage.SetXY( STAGE_X, STAGE_Y ); m_sprStage.SetXY( STAGE_X, STAGE_Y );
this->AddChild( &m_sprStage ); this->AddChild( &m_sprStage );