From 2875a6ff0042a3d3479931a938351d7c11c75adc Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Thu, 7 Apr 2011 06:37:47 +0700 Subject: [PATCH] make keysounds on hold notes work on pump mode. --- src/Player.cpp | 79 +++++++++++++++++++++++++++++--------------------- src/Player.h | 1 + 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/src/Player.cpp b/src/Player.cpp index 6e620bdec2..c3e6b86ce8 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -1291,6 +1291,8 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vectorpTN; @@ -1303,15 +1305,11 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vector= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() ) + { + // handle a case for hold notes + if( tn.type == TapNote::hold_head ) + { + // if the hold is not already held + if( tn.HoldResult.hns == HNS_None ) + { + // if the hold is already activated + TapNoteScore tns = tn.result.tns; + if( tns != TNS_None && tns != TNS_Miss && score == TNS_None ) + { + // the sound must also be already playing + if( m_vKeysounds[tn.iKeysoundIndex].IsPlaying() ) + { + // if all of these conditions are met, don't play the sound. + return; + } + } + } + } + m_vKeysounds[tn.iKeysoundIndex].Play(); + m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", 1); + } +} + void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, bool bRelease, Player::ButtonType pbt ) { if( IsOniDead() ) @@ -2461,37 +2488,23 @@ done_checking_hopo: } if( iRowOfOverlappingNoteOrRow != -1 ) { - bool bShouldPlayNextKeysound = true; - - if( bShouldPlayNextKeysound ) + switch( pbt ) { - - switch( pbt ) + DEFAULT_FAIL(pbt); + case ButtonType_StrumFretsChanged: + for( int i=0; i= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() && (tn.type != TapNote::hold_head || (!tn.HoldResult.bActive || (tn.HoldResult.fOverlappedTime == 0 || (tn.HoldResult.hns == HNS_Held)))) ) - { - m_vKeysounds[tn.iKeysoundIndex].Play(); - m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", 1); - } - } - break; - case ButtonType_Step: - case ButtonType_Hopo: - const TapNote &tn = m_NoteData.GetTapNote( col, iRowOfOverlappingNoteOrRow ); - if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() && (tn.type != TapNote::hold_head || (!tn.HoldResult.bActive || (tn.HoldResult.fOverlappedTime == 0 || (tn.HoldResult.hns == HNS_Held)))) ) - { - m_vKeysounds[tn.iKeysoundIndex].Play(); - m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", 1); - } - break; + const TapNote &tn = m_NoteData.GetTapNote( i, iRowOfOverlappingNoteOrRow ); + PlayKeysound( tn, score ); } - + break; + case ButtonType_Step: + case ButtonType_Hopo: + const TapNote &tn = m_NoteData.GetTapNote( col, iRowOfOverlappingNoteOrRow ); + PlayKeysound( tn, score ); + break; } + } } // XXX: diff --git a/src/Player.h b/src/Player.h index a72a4b57e0..b8923b9372 100644 --- a/src/Player.h +++ b/src/Player.h @@ -117,6 +117,7 @@ protected: void DrawTapJudgments(); void DrawHoldJudgments(); void SendComboMessages( int iOldCombo, int iOldMissCombo ); + void PlayKeysound( const TapNote &tn, TapNoteScore score ); void SetJudgment( TapNoteScore tns, int iFirstTrack, float fTapNoteOffset ); // -1 if no track as in TNS_Miss void SetHoldJudgment( TapNoteScore tns, HoldNoteScore hns, int iTrack );