From 5b3a0330b9121540a6bea34080c5774c3d6c3764 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 10 Jul 2003 03:37:13 +0000 Subject: [PATCH] add OffCommand to BGAnimation --- stepmania/src/BGAnimation.cpp | 8 +++++++- stepmania/src/BGAnimation.h | 2 ++ stepmania/src/BGAnimationLayer.cpp | 19 +++++++++++++++---- stepmania/src/BGAnimationLayer.h | 5 ++++- stepmania/src/MenuElements.cpp | 2 ++ stepmania/src/ScreenCaution.cpp | 10 ++++++++-- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index b5b1bce784..a6f28f292d 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -173,4 +173,10 @@ void BGAnimation::SetDiffuse( const RageColor &c ) { for( unsigned i=0; iSetDiffuse(c); - } +} + +void BGAnimation::PlayOffCommand() +{ + for( unsigned i=0; iPlayOffCommand(); +} diff --git a/stepmania/src/BGAnimation.h b/stepmania/src/BGAnimation.h index 7ddd5f80bf..a17d9395fc 100644 --- a/stepmania/src/BGAnimation.h +++ b/stepmania/src/BGAnimation.h @@ -42,6 +42,8 @@ public: float GetLengthSeconds() { return m_fLengthSeconds; } + void PlayOffCommand(); + protected: vector m_Layers; float m_fLengthSeconds; diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 2fa133fddb..3435c34b9f 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -522,7 +522,8 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) } ini.GetValueI( sLayer, "Type", (int&)m_Type ); - ini.GetValue ( sLayer, "Command", m_sCommand ); + ini.GetValue ( sLayer, "Command", m_sOnCommand ); + ini.GetValue ( sLayer, "OffCommand", m_sOffCommand ); ini.GetValueF( sLayer, "FOV", m_fFOV ); ini.GetValueB( sLayer, "Lighting", m_bLighting ); ini.GetValueF( sLayer, "StretchTexCoordVelocityX", m_fStretchTexCoordVelocityX ); @@ -627,10 +628,10 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) m_pActors[i]->SetState( rand()%m_pActors[i]->GetNumStates() ); } - if( m_sCommand != "" ) + if( m_sOnCommand != "" ) { for( unsigned i=0; iCommand( m_sCommand ); + m_pActors[i]->Command( m_sOnCommand ); } } @@ -962,7 +963,7 @@ void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop pSprite->GetTexture()->Play(); for( unsigned i=0; iCommand( m_sCommand ); + m_pActors[i]->Command( m_sOnCommand ); } void BGAnimationLayer::LosingFocus() @@ -972,3 +973,13 @@ void BGAnimationLayer::LosingFocus() pSprite->GetTexture()->Pause(); } + + +void BGAnimationLayer::PlayOffCommand() +{ + if( m_sOffCommand != "" ) + { + for( unsigned i=0; iCommand( m_sOffCommand ); + } +} \ No newline at end of file diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h index 21d1085e47..e04596befc 100644 --- a/stepmania/src/BGAnimationLayer.h +++ b/stepmania/src/BGAnimationLayer.h @@ -44,6 +44,8 @@ public: void GainingFocus( float fRate, bool bRewindMovie, bool bLoop ); void LosingFocus(); + void PlayOffCommand(); + protected: vector m_pActors; RageVector3 m_vParticleVelocity[MAX_SPRITES]; @@ -95,7 +97,8 @@ protected: // // common stuff - CString m_sCommand; + CString m_sOnCommand; + CString m_sOffCommand; float m_fUpdateRate; // get by GainingFocus float m_fFOV; // -1 = no change bool m_bLighting; diff --git a/stepmania/src/MenuElements.cpp b/stepmania/src/MenuElements.cpp index 3d7a500650..f82898940d 100644 --- a/stepmania/src/MenuElements.cpp +++ b/stepmania/src/MenuElements.cpp @@ -112,6 +112,8 @@ void MenuElements::StartTransitioning( ScreenMessage smSendWhenDone ) m_sprFooter.Command( FOOTER_OFF_COMMAND ); m_textHelp.Command( HELP_OFF_COMMAND ); + m_Background.PlayOffCommand(); + m_Out.StartTransitioning(smSendWhenDone); /* Ack. If the transition finishes transparent (eg. _options to options), diff --git a/stepmania/src/ScreenCaution.cpp b/stepmania/src/ScreenCaution.cpp index 6b90df1649..3331ca6e45 100644 --- a/stepmania/src/ScreenCaution.cpp +++ b/stepmania/src/ScreenCaution.cpp @@ -70,8 +70,11 @@ void ScreenCaution::HandleScreenMessage( const ScreenMessage SM ) switch( SM ) { case SM_StartClosing: - if( !m_Out.IsTransitioning() ) + if( !m_In.IsTransitioning() && !m_Out.IsTransitioning() ) + { + m_Background.PlayOffCommand(); m_Out.StartTransitioning( SM_GoToNextScreen ); + } break; case SM_DoneOpening: SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("caution") ); @@ -87,8 +90,11 @@ void ScreenCaution::HandleScreenMessage( const ScreenMessage SM ) void ScreenCaution::MenuStart( PlayerNumber pn ) { - if( !m_Out.IsTransitioning() ) + if( !m_In.IsTransitioning() && !m_Out.IsTransitioning() ) + { + m_Background.PlayOffCommand(); m_Out.StartTransitioning( SM_GoToNextScreen ); + } } void ScreenCaution::MenuBack( PlayerNumber pn )