From 0b87d72d716aab051efe82cba8922ad51538ded0 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 10 Nov 2003 01:24:46 +0000 Subject: [PATCH] fix HoldNote scoring --- stepmania/src/NoteData.cpp | 17 ++++++++++++++++- stepmania/src/NoteData.h | 3 ++- stepmania/src/ScoreKeeperMAX2.cpp | 4 ++-- stepmania/src/ScreenGameplay.cpp | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 1b8949030d..a20e8bee71 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -256,7 +256,7 @@ int NoteData::GetNumTapNotes( float fStartBeat, float fEndBeat ) const return iNumNotes; } -int NoteData::GetNumRowsWithTaps( float fStartBeat, float fEndBeat ) const +int NoteData::GetNumRowsWithTap( float fStartBeat, float fEndBeat ) const { int iNumNotes = 0; @@ -271,6 +271,21 @@ int NoteData::GetNumRowsWithTaps( float fStartBeat, float fEndBeat ) const return iNumNotes; } +int NoteData::GetNumRowsWithTapOrHoldHead( float fStartBeat, float fEndBeat ) const +{ + int iNumNotes = 0; + + if(fEndBeat == -1) fEndBeat = GetMaxBeat(); + int iStartIndex = BeatToNoteRow( fStartBeat ); + int iEndIndex = BeatToNoteRow( fEndBeat ); + + for( int i=iStartIndex; i<=iEndIndex; i++ ) + if( IsThereATapOrHoldHeadAtRow(i) ) + iNumNotes++; + + return iNumNotes; +} + int NoteData::GetNumDoubles( float fStartBeat, float fEndBeat ) const { int iNumDoubles = 0; diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index c2170debcb..54fa993be7 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -150,7 +150,8 @@ public: float GetLastBeat() const; // return the beat number of the last note int GetLastRow() const; int GetNumTapNotes( const float fStartBeat = 0, const float fEndBeat = -1 ) const; - int GetNumRowsWithTaps( const float fStartBeat = 0, const float fEndBeat = -1 ) const; + int GetNumRowsWithTap( const float fStartBeat = 0, const float fEndBeat = -1 ) const; + int GetNumRowsWithTapOrHoldHead( const float fStartBeat = 0, const float fEndBeat = -1 ) const; int GetNumDoubles( const float fStartBeat = 0, const float fEndBeat = -1 ) const; /* optimization: for the default of start to end, use the second (faster) */ int GetNumHoldNotes( const float fStartBeat, const float fEndBeat = -1 ) const; diff --git a/stepmania/src/ScoreKeeperMAX2.cpp b/stepmania/src/ScoreKeeperMAX2.cpp index f272702298..0706c4d8e1 100644 --- a/stepmania/src/ScoreKeeperMAX2.cpp +++ b/stepmania/src/ScoreKeeperMAX2.cpp @@ -171,7 +171,7 @@ void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, const Steps* pNotes, c ASSERT( m_iMaxPossiblePoints >= 0 ); m_iMaxScoreSoFar += m_iMaxPossiblePoints; - m_iNumTapsAndHolds = pNoteData->GetNumRowsWithTaps() + pNoteData->GetNumHoldNotes(); + m_iNumTapsAndHolds = pNoteData->GetNumRowsWithTapOrHoldHead() + pNoteData->GetNumHoldNotes(); m_iPointBonus = m_iMaxPossiblePoints; @@ -424,7 +424,7 @@ int ScoreKeeperMAX2::GetPossibleDancePoints( const NoteData &preNoteData, const * The logic here is that if you use a modifier that adds notes, you should have to * hit the new notes to get a high grade. However, if you use one that removes notes, * they should simply be counted as misses. */ - int NumTaps = max( preNoteData.GetNumRowsWithTaps(), postNoteData.GetNumRowsWithTaps() ); + int NumTaps = max( preNoteData.GetNumRowsWithTapOrHoldHead(), postNoteData.GetNumRowsWithTapOrHoldHead() ); int NumHolds = max( preNoteData.GetNumHoldNotes(), postNoteData.GetNumHoldNotes() ); return NumTaps*TapNoteScoreToDancePoints(TNS_MARVELOUS)+ NumHolds*HoldNoteScoreToDancePoints(HNS_OK); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 14a92674d8..be39794965 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -973,7 +973,7 @@ bool ScreenGameplay::IsTimeToPlayTicks() const if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) ) continue; // skip - bAnyoneHasANote |= m_Player[p].IsThereATapAtRow( r ); + bAnyoneHasANote |= m_Player[p].IsThereATapOrHoldHeadAtRow( r ); break; // this will only play the tick for the first player that is joined } }