repositioned MenuElements "play sound on first update" hack inside of Transition where it belongs
This commit is contained in:
@@ -51,15 +51,20 @@ void Transition::Update( float fDeltaTime )
|
||||
|
||||
if( m_State == transitioning )
|
||||
{
|
||||
/* Start the transition on the first update, not in the ctor, so
|
||||
* we don't play a sound while our parent is still loading. */
|
||||
if( m_fSecsIntoTransition==0 ) // first update
|
||||
m_sound.PlayRandom();
|
||||
|
||||
m_BGAnimation.Update( fDeltaTime );
|
||||
if( m_fSecsIntoTransition > m_BGAnimation.GetLengthSeconds() ) // over
|
||||
{
|
||||
SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone );
|
||||
m_fSecsIntoTransition = 0.0;
|
||||
m_State = finished;
|
||||
SCREENMAN->SendMessageToTopScreen( m_MessageToSendWhenDone );
|
||||
}
|
||||
|
||||
m_fSecsIntoTransition += fDeltaTime;
|
||||
else
|
||||
m_fSecsIntoTransition += fDeltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +72,13 @@ void Transition::DrawPrimitives()
|
||||
{
|
||||
// Unless we're transitioning, don't draw because we'll waste resources drawing things
|
||||
// that aren't visible. -Chris
|
||||
if( m_State != transitioning )
|
||||
switch( m_State )
|
||||
{
|
||||
// case waiting:
|
||||
// return;
|
||||
case finished:
|
||||
return;
|
||||
}
|
||||
|
||||
m_BGAnimation.Draw();
|
||||
}
|
||||
@@ -78,7 +88,6 @@ void Transition::StartTransitioning( ScreenMessage send_when_done )
|
||||
ASSERT( m_State == waiting ); // can't call this more than once
|
||||
m_MessageToSendWhenDone = send_when_done;
|
||||
m_State = transitioning;
|
||||
m_sound.PlayRandom();
|
||||
m_fSecsIntoTransition = 0.0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user