Store tap offsets. This lets us derive the order notes were hit in;
hopefully ScoreKeeper can be made a little more generic.
This commit is contained in:
@@ -97,14 +97,44 @@ int NoteDataWithScoring::GetNumHoldNotesWithScore( HoldNoteScore hns, const floa
|
|||||||
return iNumSuccessfulHolds;
|
return iNumSuccessfulHolds;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NoteDataWithScoring::IsRowComplete( int index, TapNoteScore minGrade ) const
|
/* Return the minimum tap score of a row. If the row isn't complete (not all
|
||||||
|
* taps have been hit), return TNS_NONE or TNS_MISS. */
|
||||||
|
TapNoteScore NoteDataWithScoring::MinTapNoteScore(unsigned row) const
|
||||||
{
|
{
|
||||||
|
TapNoteScore score = TNS_MARVELOUS;
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
if( GetTapNote(t, index) != TAP_EMPTY && GetTapNoteScore(t, index) < minGrade )
|
{
|
||||||
return false;
|
/* If there's no tap note on this row, skip it; the score will always be TNS_NONE. */
|
||||||
return true;
|
if(GetTapNote(t, row) == TAP_EMPTY) continue;
|
||||||
|
score = min( score, GetTapNoteScore(t, row) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the last tap score of a row: the grade of the tap that completed
|
||||||
|
* the row. If the row isn't complete (not all taps have been hit), return
|
||||||
|
* TNS_NONE or TNS_MISS. */
|
||||||
|
TapNoteScore NoteDataWithScoring::LastTapNoteScore(unsigned row) const
|
||||||
|
{
|
||||||
|
TapNoteScore score = TNS_MARVELOUS;
|
||||||
|
float scoretime = -9999;
|
||||||
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
|
{
|
||||||
|
/* If there's no tap note on this row, skip it; the score will always be TNS_NONE. */
|
||||||
|
if(GetTapNote(t, row) == TAP_EMPTY) continue;
|
||||||
|
|
||||||
|
float tm = GetTapNoteOffset(t, row);
|
||||||
|
if(tm < scoretime) continue;
|
||||||
|
|
||||||
|
score = GetTapNoteScore(t, row);
|
||||||
|
scoretime = tm;
|
||||||
|
}
|
||||||
|
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualRadarValue( RadarCategory rv, float fSongSeconds ) const
|
float NoteDataWithScoring::GetActualRadarValue( RadarCategory rv, float fSongSeconds ) const
|
||||||
{
|
{
|
||||||
switch( rv )
|
switch( rv )
|
||||||
@@ -173,7 +203,7 @@ float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds ) const
|
|||||||
int iNumChaosNotesCompleted = 0;
|
int iNumChaosNotesCompleted = 0;
|
||||||
for( unsigned r=0; r<m_TapNoteScores[0].size(); r++ )
|
for( unsigned r=0; r<m_TapNoteScores[0].size(); r++ )
|
||||||
{
|
{
|
||||||
if( !IsRowEmpty(r) && IsRowComplete(r) && GetNoteType(r) >= NOTE_TYPE_12TH )
|
if( !IsRowEmpty(r) && MinTapNoteScore(r) >= TNS_GREAT && GetNoteType(r) >= NOTE_TYPE_12TH )
|
||||||
iNumChaosNotesCompleted++;
|
iNumChaosNotesCompleted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,6 +242,19 @@ void NoteDataWithScoring::SetTapNoteScore(unsigned track, unsigned row, TapNoteS
|
|||||||
m_TapNoteScores[track][row] = tns;
|
m_TapNoteScores[track][row] = tns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float NoteDataWithScoring::GetTapNoteOffset(unsigned track, unsigned row) const
|
||||||
|
{
|
||||||
|
if(row >= m_TapNoteOffset[track].size())
|
||||||
|
return 0;
|
||||||
|
return m_TapNoteOffset[track][row];
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteDataWithScoring::SetTapNoteOffset(unsigned track, unsigned row, float offset)
|
||||||
|
{
|
||||||
|
extend(m_TapNoteOffset[track], 0.f, row);
|
||||||
|
m_TapNoteOffset[track][row] = offset;
|
||||||
|
}
|
||||||
|
|
||||||
HoldNoteScore NoteDataWithScoring::GetHoldNoteScore(unsigned h) const
|
HoldNoteScore NoteDataWithScoring::GetHoldNoteScore(unsigned h) const
|
||||||
{
|
{
|
||||||
if(h >= m_HoldNoteScores.size())
|
if(h >= m_HoldNoteScores.size())
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ class NoteDataWithScoring : public NoteData
|
|||||||
vector<TapNoteScore> m_TapNoteScores[MAX_NOTE_TRACKS];
|
vector<TapNoteScore> m_TapNoteScores[MAX_NOTE_TRACKS];
|
||||||
vector<HoldNoteScore> m_HoldNoteScores;
|
vector<HoldNoteScore> m_HoldNoteScores;
|
||||||
|
|
||||||
|
/* Offset, in seconds, for each tap grade. Negative numbers mean the note
|
||||||
|
* was hit early; positive numbers mean it was hit late. These values are
|
||||||
|
* only meaningful for graded taps (m_TapNoteScores >= TNS_BOO). */
|
||||||
|
vector<float> m_TapNoteOffset[MAX_NOTE_TRACKS];
|
||||||
|
|
||||||
/* 1.0 means this HoldNote has full life.
|
/* 1.0 means this HoldNote has full life.
|
||||||
* 0.0 means this HoldNote is dead
|
* 0.0 means this HoldNote is dead
|
||||||
* When this value hits 0.0 for the first time, m_HoldScore becomes HSS_NG.
|
* When this value hits 0.0 for the first time, m_HoldScore becomes HSS_NG.
|
||||||
@@ -37,12 +42,15 @@ public:
|
|||||||
|
|
||||||
TapNoteScore GetTapNoteScore(unsigned track, unsigned row) const;
|
TapNoteScore GetTapNoteScore(unsigned track, unsigned row) const;
|
||||||
void SetTapNoteScore(unsigned track, unsigned row, TapNoteScore tns);
|
void SetTapNoteScore(unsigned track, unsigned row, TapNoteScore tns);
|
||||||
|
float GetTapNoteOffset(unsigned track, unsigned row) const;
|
||||||
|
void SetTapNoteOffset(unsigned track, unsigned row, float offset);
|
||||||
HoldNoteScore GetHoldNoteScore(unsigned h) const;
|
HoldNoteScore GetHoldNoteScore(unsigned h) const;
|
||||||
void SetHoldNoteScore(unsigned h, HoldNoteScore hns);
|
void SetHoldNoteScore(unsigned h, HoldNoteScore hns);
|
||||||
float GetHoldNoteLife(unsigned h) const;
|
float GetHoldNoteLife(unsigned h) const;
|
||||||
void SetHoldNoteLife(unsigned h, float f);
|
void SetHoldNoteLife(unsigned h, float f);
|
||||||
|
|
||||||
bool IsRowComplete( int index, TapNoteScore minGrade = TNS_GREAT ) const;
|
TapNoteScore MinTapNoteScore(unsigned row) const;
|
||||||
|
TapNoteScore LastTapNoteScore(unsigned row) const;
|
||||||
|
|
||||||
float GetActualRadarValue( RadarCategory rv, float fSongSeconds ) const;
|
float GetActualRadarValue( RadarCategory rv, float fSongSeconds ) const;
|
||||||
float GetActualStreamRadarValue( float fSongSeconds ) const;
|
float GetActualStreamRadarValue( float fSongSeconds ) const;
|
||||||
|
|||||||
@@ -393,12 +393,13 @@ void Player::Step( int col )
|
|||||||
|
|
||||||
LOG->Trace("(%2d/%2d)Note offset: %f, Score: %i", m_iOffsetSample, SAMPLE_COUNT, fNoteOffset, score);
|
LOG->Trace("(%2d/%2d)Note offset: %f, Score: %i", m_iOffsetSample, SAMPLE_COUNT, fNoteOffset, score);
|
||||||
SetTapNoteScore(col, iIndexOverlappingNote, score);
|
SetTapNoteScore(col, iIndexOverlappingNote, score);
|
||||||
|
SetTapNoteOffset(col, iIndexOverlappingNote, fNoteOffset);
|
||||||
|
|
||||||
if ( score >= TNS_GREAT )
|
if ( score >= TNS_GREAT )
|
||||||
HandleAutosync(fNoteOffset);
|
HandleAutosync(fNoteOffset);
|
||||||
|
|
||||||
if (score > TNS_NONE && IsRowComplete(iIndexOverlappingNote, TNS_BOO) )
|
if (score > TNS_NONE && MinTapNoteScore(iIndexOverlappingNote) >= TNS_BOO )
|
||||||
OnRowDestroyed( score, iIndexOverlappingNote );
|
OnRowDestroyed( iIndexOverlappingNote );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !bDestroyedNote )
|
if( !bDestroyedNote )
|
||||||
@@ -426,18 +427,15 @@ void Player::HandleAutosync(float fNoteOffset)
|
|||||||
m_iOffsetSample = 0;
|
m_iOffsetSample = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::OnRowDestroyed( TapNoteScore lastScore, int iIndexThatWasSteppedOn )
|
|
||||||
|
void Player::OnRowDestroyed( int iIndexThatWasSteppedOn )
|
||||||
{
|
{
|
||||||
LOG->Trace( "Player::OnRowDestroyed" );
|
LOG->Trace( "Player::OnRowDestroyed" );
|
||||||
|
|
||||||
// find the minimum score of the row
|
/* Find the minimum score of the row. This will never be TNS_NONE, since this
|
||||||
TapNoteScore score = TNS_MARVELOUS;
|
* function is only called when a row is completed. */
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
// TapNoteScore score = MinTapNoteScore(iIndexThatWasSteppedOn);
|
||||||
{
|
TapNoteScore score = LastTapNoteScore(iIndexThatWasSteppedOn);
|
||||||
TapNoteScore tns = GetTapNoteScore(t, iIndexThatWasSteppedOn);
|
|
||||||
if( tns >= TNS_BOO )
|
|
||||||
score = min( score, tns );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the whole row was hit with perfects or greats, remove the row
|
/* If the whole row was hit with perfects or greats, remove the row
|
||||||
* from the NoteField, so it disappears. */
|
* from the NoteField, so it disappears. */
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
|
int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
|
||||||
void OnRowDestroyed( TapNoteScore lastScore, int iStepIndex );
|
void OnRowDestroyed( int iStepIndex );
|
||||||
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
|
void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow );
|
||||||
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
|
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
|
||||||
void HandleAutosync(float fNoteOffset);
|
void HandleAutosync(float fNoteOffset);
|
||||||
|
|||||||
Reference in New Issue
Block a user