From f2b06a3ea0b17eae695396a92c502a76be4157c6 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 16 Dec 2003 07:58:37 +0000 Subject: [PATCH] hands fixes --- stepmania/src/NoteData.cpp | 54 +++++++++++++++------------ stepmania/src/NoteData.h | 1 + stepmania/src/NoteDataWithScoring.cpp | 48 ++++++++++++++++++++++-- 3 files changed, 76 insertions(+), 27 deletions(-) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 0762fddc79..21057b958c 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -478,6 +478,35 @@ int NoteData::GetNumRowsWithTapOrHoldHead( float fStartBeat, float fEndBeat ) co return iNumNotes; } +int NoteData::RowNeedsHands( const int row ) const +{ + int iNumNotesThisIndex = 0; + for( int t=0; t= 3; +} + int NoteData::GetNumHands( float fStartBeat, float fEndBeat ) const { /* Count the number of times you have to use your hands. This includes @@ -498,31 +527,10 @@ int NoteData::GetNumHands( float fStartBeat, float fEndBeat ) const int iNum = 0; for( int i=iStartIndex; i<=iEndIndex; i++ ) { - int iNumNotesThisIndex = 0; - for( int t=0; t= 3 ) - iNum++; + iNum++; } return iNum; diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index de21237fee..d7bce7f879 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -128,6 +128,7 @@ public: /* optimization: for the default of start to end, use the second (faster) */ int GetNumHoldNotes( const float fStartBeat, const float fEndBeat = -1 ) const; int GetNumHoldNotes() const { return m_HoldNotes.size(); } + int RowNeedsHands( int row ) const; // Transformations void LoadTransformed( const NoteData* pOriginal, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] ); // -1 for iOriginalTracksToTakeFrom means no track diff --git a/stepmania/src/NoteDataWithScoring.cpp b/stepmania/src/NoteDataWithScoring.cpp index 1c9cf7e0d5..68a018dfdc 100644 --- a/stepmania/src/NoteDataWithScoring.cpp +++ b/stepmania/src/NoteDataWithScoring.cpp @@ -132,11 +132,51 @@ int NoteDataWithScoring::GetSuccessfulMines( float fStartBeat, float fEndBeat ) return iNumSuccessfulMinesNotes; } -/* See NoteData::GetNumHands for the maximum calculation. We need to line up to that. - * A "hands" */ -int NoteDataWithScoring::GetSuccessfulHands( const float fStartBeat, const float fEndBeat ) const +/* See NoteData::GetNumHands(). */ +int NoteDataWithScoring::GetSuccessfulHands( float fStartBeat, float fEndBeat ) const { - return 0; + if( fEndBeat == -1 ) + fEndBeat = GetMaxBeat(); + + int iStartIndex = BeatToNoteRow( fStartBeat ); + int iEndIndex = BeatToNoteRow( fEndBeat ); + + /* Clamp to known-good ranges. */ + iStartIndex = max( iStartIndex, 0 ); + iEndIndex = min( iEndIndex, GetMaxRow()-1 ); + + int iNum = 0; + for( int i=iStartIndex; i<=iEndIndex; i++ ) + { + if( !RowNeedsHands(i) ) + continue; + + bool Missed = false; + for( int t=0; t