hands fixes

This commit is contained in:
Glenn Maynard
2003-12-16 07:58:37 +00:00
parent c694bdc247
commit f2b06a3ea0
3 changed files with 76 additions and 27 deletions
+31 -23
View File
@@ -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<m_iNumTracks; t++ )
{
TapNote tn = GetTapNoteX(t, row);
if( tn == TAP_MINE || tn == TAP_EMPTY ) // mines don't count
continue;
++iNumNotesThisIndex;
}
/* We must have at least one non-hold-body at this row to count it. */
if( !iNumNotesThisIndex )
return false;
if( iNumNotesThisIndex < 3 )
{
/* We have at least one, but not enough. Count holds. */
for( int j=0; j<GetNumHoldNotes(); j++ )
{
const HoldNote &hn = GetHoldNote(j);
if( hn.iStartRow+1 <= row && row <= hn.iEndRow )
++iNumNotesThisIndex;
}
}
return iNumNotesThisIndex >= 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<m_iNumTracks; t++ )
{
TapNote tn = GetTapNoteX(t, i);
if( tn != TAP_MINE && tn != TAP_EMPTY ) // mines don't count
++iNumNotesThisIndex;
}
/* We must have at least one non-hold-body at this row to count it. */
if( !iNumNotesThisIndex )
if( !RowNeedsHands(i) )
continue;
if( iNumNotesThisIndex < 3 )
{
/* We have at least one, but not enough. Count holds. */
for( int j=0; j<GetNumHoldNotes(); j++ )
{
const HoldNote &hn = GetHoldNote(j);
if( hn.iStartRow+1 <= j && j <= hn.iEndRow )
++iNumNotesThisIndex;
}
}
if( iNumNotesThisIndex >= 3 )
iNum++;
iNum++;
}
return iNum;
+1
View File
@@ -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
+44 -4
View File
@@ -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<GetNumTracks(); t++ )
{
TapNote tn = GetTapNoteX(t, i);
if( tn == TAP_MINE || tn == TAP_EMPTY ) // mines don't count
continue;
if( GetTapNoteScore(t, i) <= TNS_BOO )
Missed = true;
}
if( Missed )
continue;
/* Check hold scores. */
for( int j=0; j<GetNumHoldNotes(); j++ )
{
const HoldNote &hn = GetHoldNote(j);
if( hn.iStartRow+1 <= i && i <= hn.iEndRow && GetHoldNoteScore(hn) != HNS_OK )
Missed = true;
}
if( !Missed )
iNum++;
}
return iNum;
}
/* Return the minimum tap score of a row. If the row isn't complete (not all