From 1deb1dd9c0330ee00b90a7df2893497ea4bd6955 Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Thu, 9 Jun 2016 16:05:49 -0600 Subject: [PATCH] Changed ScreenGameplay to not allow Ready and Go announcer sounds to play at the same time if the animation is zero length. --- src/ScreenGameplay.cpp | 54 +++++++++++++++++++++++++++++++++++------- src/ScreenGameplay.h | 5 ++++ 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index 118fe29bec..9ae5fee2a7 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -325,6 +325,7 @@ ScreenGameplay::ScreenGameplay() m_pSongBackground = NULL; m_pSongForeground = NULL; m_bForceNoNetwork = false; + m_delaying_ready_announce= false; GAMESTATE->m_AdjustTokensBySongCostForFinalStageCheck= false; } @@ -2685,21 +2686,58 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) CHECKPOINT_M( ssprintf("HandleScreenMessage(%s)", ScreenMessageHelpers::ScreenMessageToString(SM).c_str()) ); if( SM == SM_DoneFadingIn ) { - SOUND->PlayOnceFromAnnouncer( "gameplay ready" ); + // If the ready animation is zero length, then playing the sound will + // make it overlap with the go sound. + // If the Ready animation is zero length, and the Go animation is not, + // only play the Go sound. + // If they're both zero length, only play the Ready sound. + // Otherwise, play both sounds. + // -Kyz m_Ready.StartTransitioning( SM_PlayGo ); + if(m_Ready.GetTweenTimeLeft() <= .0f) + { + m_delaying_ready_announce= true; + } + else + { + m_delaying_ready_announce= false; + SOUND->PlayOnceFromAnnouncer("gameplay ready"); + } } else if( SM == SM_PlayGo ) { - if( GAMESTATE->IsAnExtraStage() ) - SOUND->PlayOnceFromAnnouncer( "gameplay here we go extra" ); - else if( GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() == 0 ) - SOUND->PlayOnceFromAnnouncer( "gameplay here we go final" ); - else - SOUND->PlayOnceFromAnnouncer( "gameplay here we go normal" ); + m_Go.StartTransitioning( SM_None ); + bool should_play_go= true; + if(m_delaying_ready_announce) + { + if(m_Go.GetTweenTimeLeft() <= .0f) + { + SOUND->PlayOnceFromAnnouncer("gameplay ready"); + should_play_go= false; + } + else + { + should_play_go= true; + } + } + if(should_play_go) + { + if( GAMESTATE->IsAnExtraStage() ) + { + SOUND->PlayOnceFromAnnouncer( "gameplay here we go extra" ); + } + else if( GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() == 0 ) + { + SOUND->PlayOnceFromAnnouncer( "gameplay here we go final" ); + } + else + { + SOUND->PlayOnceFromAnnouncer( "gameplay here we go normal" ); + } + } GAMESTATE->m_DanceStartTime.Touch(); - m_Go.StartTransitioning( SM_None ); GAMESTATE->m_bGameplayLeadIn.Set( false ); m_DancingState = STATE_DANCING; // STATE CHANGE! Now the user is allowed to press Back } diff --git a/src/ScreenGameplay.h b/src/ScreenGameplay.h index 4c78bc3f33..d1989ca2f0 100644 --- a/src/ScreenGameplay.h +++ b/src/ScreenGameplay.h @@ -328,6 +328,11 @@ protected: virtual PlayerInfo &GetPlayerInfoForInput( const InputEventPlus& iep ) { return m_vPlayerInfo[iep.pn]; } RageTimer m_timerGameplaySeconds; + + // m_delaying_ready_announce is for handling a case where the ready + // announcer sound needs to be delayed. See HandleScreenMessage for more. + // -Kyz + bool m_delaying_ready_announce; // HACK: We have no idea whether we're actually using SMOnline or not. // No, seriously, NOWHERE is it stored what room we're in or whether we're in a room at all.