Remove BGAnimation::GetLengthSeconds; use GetTweenTimeLeft instead.

This commit is contained in:
Glenn Maynard
2005-01-15 18:31:14 +00:00
parent 8cd0d9e04c
commit 78800818e3
8 changed files with 18 additions and 17 deletions
+8 -6
View File
@@ -17,7 +17,6 @@ BGAnimation::BGAnimation( bool Generic )
{
/* See BGAnimationLayer::BGAnimationLayer for explanation. */
m_bGeneric = Generic;
m_fLengthSeconds = 10;
}
BGAnimation::~BGAnimation()
@@ -242,12 +241,15 @@ void BGAnimation::LoadFromNode( const CString &sDir, const XNode& node )
if( !m_bGeneric )
PlayCommand( "On" );
if( !node.GetAttrValue( "LengthSeconds", m_fLengthSeconds ) )
/* Backwards-compatibility: if a "LengthSeconds" value is present, create a dummy
* actor that sleeps for the given length of time. This will extend GetTweenTimeLeft. */
float fLengthSeconds = 0;
if( node.GetAttrValue( "LengthSeconds", fLengthSeconds ) )
{
/* XXX: if m_bGeneric, simply constructing the BG layer won't run "On",
* so at this point GetMaxTweenTimeLeft is probably 0 */
m_fLengthSeconds = this->GetTweenTimeLeft();
Actor *pActor = new Actor;
pActor->SetHidden( true );
pActor->BeginTweening( fLengthSeconds );
AddChild( pActor );
}
}
-3
View File
@@ -23,10 +23,7 @@ public:
void LoadFromVisualization( const CString &sMoviePath );
void LoadFromNode( const CString &sDir, const XNode& node );
float GetLengthSeconds() const { return m_fLengthSeconds; }
protected:
float m_fLengthSeconds;
bool m_bGeneric;
};
+1 -1
View File
@@ -43,7 +43,7 @@ void Foreground::LoadFromSong( const Song *pSong )
bga.m_fStartBeat = change.m_fStartBeat;
const float fStartSecond = pSong->m_Timing.GetElapsedTimeFromBeat( bga.m_fStartBeat );
const float fStopSecond = fStartSecond + bga.m_bga->GetLengthSeconds();
const float fStopSecond = fStartSecond + bga.m_bga->GetTweenTimeLeft();
bga.m_fStopBeat = pSong->m_Timing.GetBeatFromElapsedTime( fStopSecond );
bga.m_bga->SetHidden( true );
+2 -2
View File
@@ -122,11 +122,11 @@ void ScreenAttract::Update( float fDelta )
// The shared background isn't loaded until the screen is actually
// showing. The background is loaded by the time of the first update.
BGAnimation &background = *SCREENMAN->m_pSharedBGA;
float fTimeUntilBeginFadingOut = background.GetLengthSeconds() - m_Out.GetLengthSeconds();
float fTimeUntilBeginFadingOut = background.GetTweenTimeLeft() - m_Out.GetTweenTimeLeft();
if( fTimeUntilBeginFadingOut < 0 )
{
LOG->Warn( "Screen '%s' Out BGAnimation (%f seconds) is longer than Background BGAnimation (%f seconds); background BGA will be truncated",
m_sName.c_str(), m_Out.GetLengthSeconds(), background.GetLengthSeconds() );
m_sName.c_str(), m_Out.GetTweenTimeLeft(), background.GetTweenTimeLeft() );
fTimeUntilBeginFadingOut = 0;
}
this->PostScreenMessage( SM_BeginFadingOut, fTimeUntilBeginFadingOut );
+2 -2
View File
@@ -260,11 +260,11 @@ void ScreenEnding::Update( float fDeltaTime )
if( IsFirstUpdate() )
{
BGAnimation &background = *SCREENMAN->m_pSharedBGA;
float fSecsUntilBeginFadingOut = background.GetLengthSeconds() - m_Out.GetLengthSeconds();
float fSecsUntilBeginFadingOut = background.GetTweenTimeLeft() - m_Out.GetTweenTimeLeft();
if( fSecsUntilBeginFadingOut < 0 )
{
LOG->Warn( "Screen '%s' Out BGAnimation (%f seconds) is longer than Background BGAnimation (%f seconds); background BGA will be truncated",
m_sName.c_str(), m_Out.GetLengthSeconds(), background.GetLengthSeconds() );
m_sName.c_str(), m_Out.GetTweenTimeLeft(), background.GetTweenTimeLeft() );
fSecsUntilBeginFadingOut = 0;
}
this->PostScreenMessage( SM_BeginFadingOut, fSecsUntilBeginFadingOut );
+1 -1
View File
@@ -53,7 +53,7 @@ ScreenStage::ScreenStage( CString sClassName ) : Screen( sClassName )
this->AddChild( &m_Back );
/* Prep the new screen once m_In is complete. */
this->PostScreenMessage( SM_PrepScreen, m_Background.GetLengthSeconds() );
this->PostScreenMessage( SM_PrepScreen, m_Background.GetTweenTimeLeft() );
FOREACH_PlayerNumber(p)
{
+3 -2
View File
@@ -18,6 +18,7 @@ void Transition::Load( CString sBGAniDir )
sBGAniDir += "/";
m_BGAnimation.LoadFromAniDir( sBGAniDir );
m_fLengthSeconds = m_BGAnimation.GetTweenTimeLeft();
m_State = waiting;
m_fSecsIntoTransition = 0.0f;
@@ -58,7 +59,7 @@ void Transition::Update( float fDeltaTime )
}
m_BGAnimation.Update( fDeltaTime );
if( m_fSecsIntoTransition > m_BGAnimation.GetLengthSeconds() ) // over
if( m_fSecsIntoTransition > m_fLengthSeconds ) // over
{
SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone );
m_fSecsIntoTransition = 0.0;
@@ -91,7 +92,7 @@ void Transition::StartTransitioning( ScreenMessage send_when_done )
float Transition::GetLengthSeconds() const
{
return m_BGAnimation.GetLengthSeconds();
return m_fLengthSeconds;
}
float Transition::GetTweenTimeLeft() const
+1
View File
@@ -38,6 +38,7 @@ protected:
BGAnimation m_BGAnimation;
float m_fLengthSeconds;
RandomSample m_sound;
ScreenMessage m_MessageToSendWhenDone;