From c51214174f2b74d1326ad3dbbc7cba5d8ddf8872 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 16 Jan 2007 02:32:27 +0000 Subject: [PATCH] implement m_bMuteOnError --- stepmania/src/ScreenGameplay.cpp | 37 ++++++++++++++++++++++++++++++++ stepmania/src/ScreenGameplay.h | 1 + 2 files changed, 38 insertions(+) diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index f5a1abeb93..a9f0ca6063 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -22,6 +22,7 @@ #include "ScoreKeeperRave.h" #include "LyricsLoader.h" #include "ActorUtil.h" +#include "RageSoundReader.h" #include "RageTextureManager.h" #include "GameSoundManager.h" #include "CombinedLifeMeterTug.h" @@ -329,6 +330,8 @@ ScreenGameplay::ScreenGameplay() void ScreenGameplay::Init() { + SubscribeToMessage( "Judgment" ); + PLAYER_TYPE.Load( m_sName, "PlayerType" ); PLAYER_INIT_COMMAND.Load( m_sName, "PlayerInitCommand" ); GIVE_UP_START_TEXT.Load( m_sName, "GiveUpStartText" ); @@ -2605,7 +2608,41 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) ScreenWithMenuElements::HandleScreenMessage( SM ); } +void ScreenGameplay::HandleMessage( const Message &msg ) +{ + if( msg == "Judgment" ) + { + PlayerNumber pn; + msg.GetParam( "Player", pn ); + FOREACH_EnabledPlayerNumberInfo( m_vPlayerInfo, pi ) + { + if( pi->m_pn != pn ) + continue; + if( !pi->GetPlayerState()->m_PlayerOptions.GetCurrent().m_bMuteOnError ) + continue; + + RageSoundReader *pSoundReader = m_pSoundMusic->GetSoundReader(); + + HoldNoteScore hns; + msg.GetParam( "HoldNoteScore", hns ); + TapNoteScore tns; + msg.GetParam( "TapNoteScore", tns ); + + bool bOn = false; + if( hns != HoldNoteScore_Invalid ) + bOn = hns != HNS_LetGo; + else + bOn = tns != TNS_Miss; + + if( pSoundReader ) + pSoundReader->SetProperty( "Volume", bOn? 1.0f:0.0f ); + } + } + + ScreenWithMenuElements::HandleMessage( msg ); +} + void ScreenGameplay::Cancel( ScreenMessage smSendWhenDone ) { m_pSoundMusic->Stop(); diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 1f77bfb96c..796da85187 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -107,6 +107,7 @@ public: virtual void Update( float fDeltaTime ); virtual void Input( const InputEventPlus &input ); virtual void HandleScreenMessage( const ScreenMessage SM ); + virtual void HandleMessage( const Message &msg ); virtual void Cancel( ScreenMessage smSendWhenDone ); virtual ScreenType GetScreenType() const { return gameplay; }