diff --git a/stepmania/src/ScoreKeeperNormal.cpp b/stepmania/src/ScoreKeeperNormal.cpp index 8f09b78097..2cce12d691 100644 --- a/stepmania/src/ScoreKeeperNormal.cpp +++ b/stepmania/src/ScoreKeeperNormal.cpp @@ -438,10 +438,11 @@ void ScoreKeeperNormal::HandleTapScore( const TapNote &tn ) void ScoreKeeperNormal::HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ) { - HandleTapNoteScoreInternal( iNumHoldsMissedThisRow == 0? TNS_CheckpointHit:TNS_CheckpointMiss, TNS_CheckpointHit, iNumHoldsHeldThisRow+iNumHoldsMissedThisRow ); + HandleTapNoteScoreInternal( iNumHoldsMissedThisRow == 0? TNS_CheckpointHit:TNS_CheckpointMiss, TNS_CheckpointHit ); + HandleComboInternal( iNumHoldsHeldThisRow, 0, iNumHoldsMissedThisRow ); } -void ScoreKeeperNormal::HandleTapNoteScoreInternal( TapNoteScore tns, TapNoteScore maximum, int iNumTapsInRow ) +void ScoreKeeperNormal::HandleTapNoteScoreInternal( TapNoteScore tns, TapNoteScore maximum ) { // Update dance points. if( !m_pPlayerStageStats->m_bFailed ) @@ -452,36 +453,68 @@ void ScoreKeeperNormal::HandleTapNoteScoreInternal( TapNoteScore tns, TapNoteSco // increment the current total possible dance score m_pPlayerStageStats->m_iCurPossibleDancePoints += TapNoteScoreToDancePoints( maximum ); +} +void ScoreKeeperNormal::HandleComboInternal( int iNumHitContinueCombo, int iNumHitMaintainCombo, int iNumMissedInRow ) +{ // // Regular combo // - const int iComboCountIfHit = m_ComboIsPerRow? 1: iNumTapsInRow; - if( tns >= m_MinScoreToMaintainCombo ) + if( m_ComboIsPerRow ) { - m_pPlayerStageStats->m_iCurMissCombo = 0; - if( tns >= m_MinScoreToContinueCombo ) - m_pPlayerStageStats->m_iCurCombo += iComboCountIfHit; + iNumHitContinueCombo = min( iNumHitContinueCombo, 1 ); + iNumHitMaintainCombo = min( iNumHitMaintainCombo, 1 ); + iNumMissedInRow = min( iNumMissedInRow, 1 ); } - else - { + + if( iNumHitContinueCombo > 0 || iNumHitMaintainCombo > 0 ) + m_pPlayerStageStats->m_iCurMissCombo = 0; + + if( iNumMissedInRow > 0 ) m_pPlayerStageStats->m_iCurCombo = 0; - if( tns == TNS_Miss || tns == TNS_CheckpointMiss ) - m_pPlayerStageStats->m_iCurMissCombo += iComboCountIfHit; + + if( iNumMissedInRow == 0 ) + m_pPlayerStageStats->m_iCurCombo += iNumHitContinueCombo; + else + m_pPlayerStageStats->m_iCurMissCombo += iNumMissedInRow; +} + +void ScoreKeeperNormal::GetRowCounts( const NoteData &nd, int iRow, + int &iNumHitContinueCombo, int &iNumHitMaintainCombo, int &iNumMissedInRow ) +{ + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; + iNumHitContinueCombo = iNumHitMaintainCombo = iNumMissedInRow = 0; + for( int track = 0; track < nd.GetNumTracks(); ++track ) + { + const TapNote &tn = nd.GetTapNote( track, iRow ); + + if( tn.pn != PLAYER_INVALID && tn.pn != pn ) + continue; + if( tn.type != TapNote::tap && tn.type != TapNote::hold_head ) + continue; + TapNoteScore tns = tn.result.tns; + if( tns >= m_MinScoreToContinueCombo ) + ++iNumHitContinueCombo; + else if( tns >= m_MinScoreToMaintainCombo ) + ++iNumHitMaintainCombo; + else if( tns == TNS_Miss || tns == TNS_None ) + ++iNumMissedInRow; } } void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) { - TapNoteScore scoreOfLastTap; - int iNumTapsInRow; - - GetScoreOfLastTapInRow( nd, iRow, scoreOfLastTap, iNumTapsInRow ); - + int iNumHitContinueCombo, iNumHitMaintainCombo, iNumMissedInRow; + GetRowCounts( nd, iRow, iNumHitContinueCombo, iNumHitMaintainCombo, iNumMissedInRow ); + + int iNumTapsInRow = iNumHitContinueCombo + iNumHitMaintainCombo + iNumMissedInRow; if( iNumTapsInRow <= 0 ) return; - HandleTapNoteScoreInternal( scoreOfLastTap, TNS_W1, iNumTapsInRow ); + TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow, m_pPlayerState->m_PlayerNumber ).result.tns; + HandleTapNoteScoreInternal( scoreOfLastTap, TNS_W1 ); + + HandleComboInternal( iNumHitContinueCombo, iNumHitMaintainCombo, iNumMissedInRow ); if( m_pPlayerState->m_PlayerNumber != PLAYER_INVALID ) MESSAGEMAN->Broadcast( enum_add2(Message_CurrentComboChangedP1,m_pPlayerState->m_PlayerNumber) ); diff --git a/stepmania/src/ScoreKeeperNormal.h b/stepmania/src/ScoreKeeperNormal.h index a412bb97e4..6c3a703c49 100644 --- a/stepmania/src/ScoreKeeperNormal.h +++ b/stepmania/src/ScoreKeeperNormal.h @@ -61,7 +61,9 @@ public: void HandleHoldActiveSeconds( float fMusicSecondsHeld ) {}; void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ); - void HandleTapNoteScoreInternal( TapNoteScore tns, TapNoteScore maximum, int iNumTapsInRow ); + void HandleTapNoteScoreInternal( TapNoteScore tns, TapNoteScore maximum ); + void HandleComboInternal( int iNumHitContinueCombo, int iNumHitMaintainCombo, int iNumMissedInRow ); + void GetRowCounts( const NoteData &nd, int iRow, int &iNumHitContinueCombo, int &iNumHitMaintainCombo, int &iNumMissedInRow ); // This must be calculated using only cached radar values so that we can // do it quickly.