This commit is contained in:
Glenn Maynard
2006-10-14 04:55:36 +00:00
parent be34821955
commit ec030b56ba
5 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -472,7 +472,7 @@ void BGAnimationLayer::LoadFromNode( const XNode* pNode )
for( int i=0; i<iNumParticles; i++ ) for( int i=0; i<iNumParticles; i++ )
{ {
Actor* pActor = ActorUtil::MakeActor( sFile ); Actor* pActor = ActorUtil::MakeActor( sFile, this );
if( pActor == NULL ) if( pActor == NULL )
continue; continue;
this->AddChild( pActor ); this->AddChild( pActor );
@@ -510,7 +510,7 @@ void BGAnimationLayer::LoadFromNode( const XNode* pNode )
unsigned NumSprites = m_iNumTilesWide * m_iNumTilesHigh; unsigned NumSprites = m_iNumTilesWide * m_iNumTilesHigh;
for( unsigned i=0; i<NumSprites; i++ ) for( unsigned i=0; i<NumSprites; i++ )
{ {
Actor* pSprite = ActorUtil::MakeActor( sFile ); Actor* pSprite = ActorUtil::MakeActor( sFile, this );
this->AddChild( pSprite ); this->AddChild( pSprite );
pSprite->SetTextureWrapping( true ); // gets rid of some "cracks" pSprite->SetTextureWrapping( true ); // gets rid of some "cracks"
pSprite->SetZoom( randomf(fZoomMin,fZoomMax) ); pSprite->SetZoom( randomf(fZoomMin,fZoomMax) );
+10 -10
View File
@@ -99,9 +99,9 @@ protected:
void Unload(); void Unload();
// return true if created and added to m_BGAnimations // return true if created and added to m_BGAnimations
bool CreateBackground( const Song *pSong, const BackgroundDef &bd ); bool CreateBackground( const Song *pSong, const BackgroundDef &bd, Actor *pParent );
// return def of the background that was created and added to m_BGAnimations. calls CreateBackground // return def of the background that was created and added to m_BGAnimations. calls CreateBackground
BackgroundDef CreateRandomBGA( const Song *pSong, const RString &sEffect, deque<BackgroundDef> &RandomBGAnimations ); BackgroundDef CreateRandomBGA( const Song *pSong, const RString &sEffect, deque<BackgroundDef> &RandomBGAnimations, Actor *pParent );
int FindBGSegmentForBeat( float fBeat ) const; int FindBGSegmentForBeat( float fBeat ) const;
void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<RString,BackgroundTransition> &mapNameToTransition ); void UpdateCurBGChange( const Song *pSong, float fLastMusicSeconds, float fCurrentTime, const map<RString,BackgroundTransition> &mapNameToTransition );
@@ -285,7 +285,7 @@ Actor *MakeVisualization( const RString &sVisPath )
return pFrame; return pFrame;
} }
bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const BackgroundDef &bd ) bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const BackgroundDef &bd, Actor *pParent )
{ {
ASSERT( m_BGAnimations.find(bd) == m_BGAnimations.end() ); ASSERT( m_BGAnimations.find(bd) == m_BGAnimations.end() );
@@ -412,7 +412,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun
return true; return true;
} }
BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const RString &sEffect, deque<BackgroundDef> &RandomBGAnimations ) BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const RString &sEffect, deque<BackgroundDef> &RandomBGAnimations, Actor *pParent )
{ {
if( PREFSMAN->m_RandomBackgroundMode == BGMODE_OFF ) if( PREFSMAN->m_RandomBackgroundMode == BGMODE_OFF )
return BackgroundDef(); return BackgroundDef();
@@ -434,7 +434,7 @@ BackgroundDef BackgroundImpl::Layer::CreateRandomBGA( const Song *pSong, const R
// create the background if it's not already created // create the background if it's not already created
if( iter == m_BGAnimations.end() ) if( iter == m_BGAnimations.end() )
{ {
bool bSuccess = CreateBackground( pSong, bd ); bool bSuccess = CreateBackground( pSong, bd, pParent );
ASSERT( bSuccess ); // we fed it valid files, so this shouldn't fail ASSERT( bSuccess ); // we fed it valid files, so this shouldn't fail
} }
return bd; return bd;
@@ -448,7 +448,7 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac
for( float f=fFirstBeat; f<fEndBeat; f+=BEATS_PER_MEASURE*4 ) for( float f=fFirstBeat; f<fEndBeat; f+=BEATS_PER_MEASURE*4 )
{ {
// Don't fade. It causes frame rate dip, especially on slower machines. // Don't fade. It causes frame rate dip, especially on slower machines.
BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations ); BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this );
if( !bd.IsEmpty() ) if( !bd.IsEmpty() )
{ {
BackgroundChange c = change; BackgroundChange c = change;
@@ -473,7 +473,7 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac
if( !bInRange ) if( !bInRange )
continue; // skip continue; // skip
BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations ); BackgroundDef bd = m_Layer[0].CreateRandomBGA( m_pSong, change.m_def.m_sEffect, m_RandomBGAnimations, this );
if( !bd.IsEmpty() ) if( !bd.IsEmpty() )
{ {
BackgroundChange c = change; BackgroundChange c = change;
@@ -567,7 +567,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
if( bd.m_sFile1 != RANDOM_BACKGROUND_FILE && !bIsAlreadyLoaded ) if( bd.m_sFile1 != RANDOM_BACKGROUND_FILE && !bIsAlreadyLoaded )
{ {
if( layer.CreateBackground( m_pSong, bd ) ) if( layer.CreateBackground( m_pSong, bd, this ) )
{ {
; // do nothing. Create was successful. ; // do nothing. Create was successful.
} }
@@ -576,7 +576,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
if( i == BACKGROUND_LAYER_1 ) if( i == BACKGROUND_LAYER_1 )
{ {
// The background was not found. Try to use a random one instead. // The background was not found. Try to use a random one instead.
bd = layer.CreateRandomBGA( pSong, bd.m_sEffect, m_RandomBGAnimations ); bd = layer.CreateRandomBGA( pSong, bd.m_sEffect, m_RandomBGAnimations, this );
if( bd.IsEmpty() ) if( bd.IsEmpty() )
bd = m_StaticBackgroundDef; bd = m_StaticBackgroundDef;
} }
@@ -646,7 +646,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
bool bIsAlreadyLoaded = mainlayer.m_BGAnimations.find(m_StaticBackgroundDef) != mainlayer.m_BGAnimations.end(); bool bIsAlreadyLoaded = mainlayer.m_BGAnimations.find(m_StaticBackgroundDef) != mainlayer.m_BGAnimations.end();
if( !bIsAlreadyLoaded ) if( !bIsAlreadyLoaded )
{ {
bool bSuccess = mainlayer.CreateBackground( m_pSong, m_StaticBackgroundDef ); bool bSuccess = mainlayer.CreateBackground( m_pSong, m_StaticBackgroundDef, this );
ASSERT( bSuccess ); ASSERT( bSuccess );
} }
} }
+2 -2
View File
@@ -75,7 +75,7 @@ void OptionRow::Clear()
ZERO( m_iChoiceInRowWithFocus ); ZERO( m_iChoiceInRowWithFocus );
} }
void OptionRowType::Load( const RString &sType ) void OptionRowType::Load( const RString &sType, Actor *pParent )
{ {
m_sType = sType; m_sType = sType;
@@ -109,7 +109,7 @@ void OptionRowType::Load( const RString &sType )
if( SHOW_UNDERLINES ) if( SHOW_UNDERLINES )
m_UnderlineParent.Load( sType, OptionsCursor::underline ); m_UnderlineParent.Load( sType, OptionsCursor::underline );
m_textTitle.LoadFromFont( THEME->GetPathF(sType,"title") ); m_textTitle.LoadFromFont( THEME->GetPathF(sType,"title") );
m_sprBullet.Load( ActorUtil::MakeActor( THEME->GetPathG(sType,"bullet") ) ); m_sprBullet.Load( ActorUtil::MakeActor( THEME->GetPathG(sType,"bullet"), pParent ) );
if( SHOW_OPTION_ICONS ) if( SHOW_OPTION_ICONS )
m_OptionIcon.Load( sType ); m_OptionIcon.Load( sType );
} }
+1 -1
View File
@@ -17,7 +17,7 @@ struct OptionRowDefinition;
class OptionRowType class OptionRowType
{ {
public: public:
void Load( const RString &sType ); void Load( const RString &sType, Actor *pParent );
private: private:
RString m_sType; RString m_sType;
+1 -1
View File
@@ -181,7 +181,7 @@ void ScreenOptions::Init()
m_sprMore->PlayCommand( "LoseFocus" ); m_sprMore->PlayCommand( "LoseFocus" );
m_framePage.AddChild( m_sprMore ); m_framePage.AddChild( m_sprMore );
m_OptionRowType.Load( m_sName ); m_OptionRowType.Load( m_sName, this );
} }
void ScreenOptions::InitMenu( const vector<OptionRowHandler*> &vHands ) void ScreenOptions::InitMenu( const vector<OptionRowHandler*> &vHands )