diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index e452377afc..4bfe5532f5 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -1536,55 +1536,24 @@ void Player::RandomizeNotes( int iNoteRow ) void Player::HandleTapRowScore( unsigned row ) { - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - const TapNote &lastTN = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, row, pn ); - TapNoteScore scoreOfLastTap = lastTN.result.tns; - - bool NoCheating = true; + bool bNoCheating = true; #ifdef DEBUG - NoCheating = false; + bNoCheating = false; #endif if( GAMESTATE->m_bDemonstrationOrJukebox ) - NoCheating = false; + bNoCheating = false; // don't accumulate points if AutoPlay is on. - if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) + if( bNoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) return; - /* Update miss combo, and handle "combo stopped" messages. */ - /* When is m_pPlayerStageStats NULL? Would it be cleaner to pass Player a dummy - * PlayerStageStats in this case, instead of having to carefully check for NULL - * every time we use it? -glenn */ - int iDummy = 0; - int &iCurCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurCombo : iDummy; - int &iCurMissCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurMissCombo : iDummy; - switch( scoreOfLastTap ) - { - case TNS_W1: - case TNS_W2: - case TNS_W3: - iCurMissCombo = 0; - SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 ); - break; + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; + TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult(m_NoteData, row, pn).result.tns; + const int iOldCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurCombo : 0; - case TNS_Miss: - ++iCurMissCombo; + if( scoreOfLastTap == TNS_Miss ) m_LastTapNoteScore = TNS_Miss; - case TNS_W4: - case TNS_W5: - if( iCurCombo > 50 ) - SCREENMAN->PostMessageToTopScreen( SM_ComboStopped, 0 ); - iCurCombo = 0; - break; - - default: - ASSERT( 0 ); - } - - /* The score keeper updates the hit combo. Remember the old combo for handling announcers. */ - const int iOldCombo = iCurCombo; - for( int track = 0; track < m_NoteData.GetNumTracks(); ++track ) { const TapNote &tn = m_NoteData.GetTapNote( track, row ); @@ -1598,11 +1567,21 @@ void Player::HandleTapRowScore( unsigned row ) if( m_pSecondaryScoreKeeper ) m_pSecondaryScoreKeeper->HandleTapScore( tn ); } - + + bool bComboStopped = false; + bool bMissComboStopped = false; + if( m_pPrimaryScoreKeeper != NULL ) - m_pPrimaryScoreKeeper->HandleTapRowScore( m_NoteData, row ); + m_pPrimaryScoreKeeper->HandleTapRowScore( m_NoteData, row, bComboStopped, bMissComboStopped ); + if( bMissComboStopped ) + SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 ); + if( bComboStopped && iOldCombo > 50 ) + SCREENMAN->PostMessageToTopScreen( SM_ComboStopped, 0 ); if( m_pSecondaryScoreKeeper != NULL ) - m_pSecondaryScoreKeeper->HandleTapRowScore( m_NoteData, row ); + m_pSecondaryScoreKeeper->HandleTapRowScore( m_NoteData, row, bComboStopped, bMissComboStopped ); + + const int iCurCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurCombo : 0; + const int iCurMissCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurMissCombo : 0; if( m_pPlayerStageStats && m_pCombo ) { diff --git a/stepmania/src/ScoreKeeper.h b/stepmania/src/ScoreKeeper.h index d2a775acdb..cf17d02908 100644 --- a/stepmania/src/ScoreKeeper.h +++ b/stepmania/src/ScoreKeeper.h @@ -49,7 +49,7 @@ public: virtual void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) = 0; // before a song plays (called multiple times if course) virtual void HandleTapScore( const TapNote &tn ) = 0; - virtual void HandleTapRowScore( const NoteData &nd, int iRow ) = 0; + virtual void HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped ) = 0; virtual void HandleHoldScore( const TapNote &tn ) = 0; protected: diff --git a/stepmania/src/ScoreKeeperNormal.cpp b/stepmania/src/ScoreKeeperNormal.cpp index 11d0f2766d..c93a223d08 100644 --- a/stepmania/src/ScoreKeeperNormal.cpp +++ b/stepmania/src/ScoreKeeperNormal.cpp @@ -350,10 +350,13 @@ void ScoreKeeperNormal::HandleTapScore( const TapNote &tn ) } } -void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) +void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped ) { TapNoteScore scoreOfLastTap; int iNumTapsInRow; + + bComboStopped = false; + bMissComboStopped = false; GetScoreOfLastTapInRow( nd, iRow, scoreOfLastTap, iNumTapsInRow ); if( iNumTapsInRow <= 0 ) @@ -373,10 +376,20 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) // Regular combo // const int iComboCountIfHit = m_bComboIsPerRow? 1: iNumTapsInRow; - if( scoreOfLastTap >= m_MinScoreToContinueCombo ) - m_pPlayerStageStats->iCurCombo += iComboCountIfHit; + if( scoreOfLastTap >= m_MinScoreToMaintainCombo ) + { + bMissComboStopped = true; + m_pPlayerStageStats->iCurMissCombo = 0; + if( scoreOfLastTap >= m_MinScoreToContinueCombo ) + m_pPlayerStageStats->iCurCombo += iComboCountIfHit; + } else if( scoreOfLastTap < m_MinScoreToMaintainCombo ) + { + bComboStopped = true; m_pPlayerStageStats->iCurCombo = 0; + if( scoreOfLastTap == TNS_Miss ) + ++m_pPlayerStageStats->iCurMissCombo; + } AddScore( scoreOfLastTap ); // only score once per row diff --git a/stepmania/src/ScoreKeeperNormal.h b/stepmania/src/ScoreKeeperNormal.h index 20b330cc83..8a386f893a 100644 --- a/stepmania/src/ScoreKeeperNormal.h +++ b/stepmania/src/ScoreKeeperNormal.h @@ -51,7 +51,7 @@ public: void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); void HandleTapScore( const TapNote &tn ); - void HandleTapRowScore( const NoteData &nd, int iRow ); + void HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped ); void HandleHoldScore( const TapNote &tn ); // This must be calculated using only cached radar values so that we can diff --git a/stepmania/src/ScoreKeeperRave.cpp b/stepmania/src/ScoreKeeperRave.cpp index e39c5cb0da..75f7c6c716 100644 --- a/stepmania/src/ScoreKeeperRave.cpp +++ b/stepmania/src/ScoreKeeperRave.cpp @@ -31,12 +31,15 @@ void ScoreKeeperRave::HandleTapScore( const TapNote &tn ) #define CROSSED( val ) (fOld < val && fNew >= val) #define CROSSED_ATTACK_LEVEL( level ) CROSSED(1.f/NUM_ATTACK_LEVELS*(level+1)) -void ScoreKeeperRave::HandleTapRowScore( const NoteData &nd, int iRow ) +void ScoreKeeperRave::HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped ) { TapNoteScore scoreOfLastTap; int iNumTapsInRow; float fPercentToMove; - + + bComboStopped = false; + bMissComboStopped = false; + GetScoreOfLastTapInRow( nd, iRow, scoreOfLastTap, iNumTapsInRow ); if( iNumTapsInRow <= 0 ) return; diff --git a/stepmania/src/ScoreKeeperRave.h b/stepmania/src/ScoreKeeperRave.h index 0b122e4f5c..4d6ef82c67 100644 --- a/stepmania/src/ScoreKeeperRave.h +++ b/stepmania/src/ScoreKeeperRave.h @@ -13,7 +13,7 @@ public: ScoreKeeperRave( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); void OnNextSong( int iSongInCourseIndex, const Steps *pSteps, const NoteData *pNoteData ) { } void HandleTapScore( const TapNote &tn ); - void HandleTapRowScore( const NoteData &nd, int iRow ); + void HandleTapRowScore( const NoteData &nd, int iRow, bool &bComboStopped, bool &bMissComboStopped ); void HandleHoldScore( const TapNote &tn ); protected: