continue merging NoteDataWithScoring stuff
This commit is contained in:
@@ -12,9 +12,6 @@ NoteDataWithScoring::NoteDataWithScoring()
|
|||||||
void NoteDataWithScoring::Init()
|
void NoteDataWithScoring::Init()
|
||||||
{
|
{
|
||||||
NoteData::Init();
|
NoteData::Init();
|
||||||
|
|
||||||
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
|
|
||||||
m_TapNoteScores[t].clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, float fEndBeat ) const
|
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, float fEndBeat ) const
|
||||||
@@ -32,7 +29,8 @@ int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float
|
|||||||
{
|
{
|
||||||
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
|
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
|
||||||
{
|
{
|
||||||
if( GetTapNoteScore(t, r) >= tns )
|
const TapNote &tn = GetTapNote(t, r);
|
||||||
|
if( tn.result.tns >= tns )
|
||||||
iNumSuccessfulTapNotes++;
|
iNumSuccessfulTapNotes++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,12 +56,13 @@ int NoteDataWithScoring::GetNumNWithScore( TapNoteScore tns, int MinTaps, const
|
|||||||
TapNoteScore minTapNoteScore = TNS_MARVELOUS;
|
TapNoteScore minTapNoteScore = TNS_MARVELOUS;
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
switch( GetTapNote(t, i).type )
|
const TapNote &tn = GetTapNote(t,i);
|
||||||
|
switch( tn.type )
|
||||||
{
|
{
|
||||||
case TapNote::tap:
|
case TapNote::tap:
|
||||||
case TapNote::hold_head:
|
case TapNote::hold_head:
|
||||||
iNumNotesThisIndex++;
|
iNumNotesThisIndex++;
|
||||||
minTapNoteScore = min( minTapNoteScore, GetTapNoteScore(t, i) );
|
minTapNoteScore = min( minTapNoteScore, tn.result.tns );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( iNumNotesThisIndex >= MinTaps && minTapNoteScore >= tns )
|
if( iNumNotesThisIndex >= MinTaps && minTapNoteScore >= tns )
|
||||||
@@ -110,7 +109,8 @@ int NoteDataWithScoring::GetSuccessfulMines( float fStartBeat, float fEndBeat )
|
|||||||
{
|
{
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( this->GetTapNote(t,i).type == TapNote::mine && GetTapNoteScore(t, i) != TNS_HIT_MINE )
|
const TapNote &tn = GetTapNote(t,i);
|
||||||
|
if( tn.type == TapNote::mine && tn.result.tns != TNS_HIT_MINE )
|
||||||
iNumSuccessfulMinesNotes++;
|
iNumSuccessfulMinesNotes++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ int NoteDataWithScoring::GetSuccessfulHands( float fStartBeat, float fEndBeat )
|
|||||||
continue;
|
continue;
|
||||||
if( tn.type == TapNote::mine ) // mines don't count
|
if( tn.type == TapNote::mine ) // mines don't count
|
||||||
continue;
|
continue;
|
||||||
if( GetTapNoteScore(t, i) <= TNS_BOO )
|
if( tn.result.tns <= TNS_BOO )
|
||||||
Missed = true;
|
Missed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,10 +186,10 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore(unsigned row) const
|
|||||||
{
|
{
|
||||||
/* Don't coun, or else the score
|
/* Don't coun, or else the score
|
||||||
* will always be TNS_NONE. */
|
* will always be TNS_NONE. */
|
||||||
TapNote tn = GetTapNote(t, row);
|
const TapNote &tn = GetTapNote(t, row);
|
||||||
if( tn.type == TapNote::empty || tn.type == TapNote::mine)
|
if( tn.type == TapNote::empty || tn.type == TapNote::mine)
|
||||||
continue;
|
continue;
|
||||||
score = min( score, GetTapNoteScore(t, row) );
|
score = min( score, tn.result.tns );
|
||||||
}
|
}
|
||||||
|
|
||||||
return score;
|
return score;
|
||||||
@@ -203,6 +203,7 @@ bool NoteDataWithScoring::IsRowCompletelyJudged(unsigned row) const
|
|||||||
/* Return the last tap score of a row: the grade of the tap that completed
|
/* Return the last tap score of a row: the grade of the tap that completed
|
||||||
* the row. If the row has no tap notes, return -1. If any tap notes aren't
|
* the row. If the row has no tap notes, return -1. If any tap notes aren't
|
||||||
* graded (any tap is TNS_NONE) or are missed (TNS_MISS), return it. */
|
* graded (any tap is TNS_NONE) or are missed (TNS_MISS), return it. */
|
||||||
|
/* XXX: this will fill in many empty tap notes due to excess GetTapnote calls */
|
||||||
int NoteDataWithScoring::LastTapNoteScoreTrack(unsigned row) const
|
int NoteDataWithScoring::LastTapNoteScoreTrack(unsigned row) const
|
||||||
{
|
{
|
||||||
float scoretime = -9999;
|
float scoretime = -9999;
|
||||||
@@ -210,16 +211,17 @@ int NoteDataWithScoring::LastTapNoteScoreTrack(unsigned row) const
|
|||||||
for( int t=0; t<GetNumTracks(); t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
/* Skip empty tracks and mines */
|
/* Skip empty tracks and mines */
|
||||||
TapNote tn = GetTapNote(t, row);
|
const TapNote &tn = GetTapNote(t, row);
|
||||||
if( tn.type == TapNote::empty || tn.type == TapNote::mine )
|
if( tn.type == TapNote::empty || tn.type == TapNote::mine )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TapNoteScore tns = GetTapNoteScore(t, row);
|
TapNoteScore tns = tn.result.tns;
|
||||||
|
|
||||||
if( tns == TNS_MISS || tns == TNS_NONE )
|
if( tns == TNS_MISS || tns == TNS_NONE )
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
float tm = GetTapNoteOffset(t, row);
|
|
||||||
|
float tm = tn.result.fTapNoteOffset;
|
||||||
if(tm < scoretime) continue;
|
if(tm < scoretime) continue;
|
||||||
|
|
||||||
scoretime = tm;
|
scoretime = tm;
|
||||||
@@ -233,7 +235,7 @@ TapNoteScore NoteDataWithScoring::LastTapNoteScore(unsigned row) const
|
|||||||
{
|
{
|
||||||
int track = LastTapNoteScoreTrack(row);
|
int track = LastTapNoteScoreTrack(row);
|
||||||
if(track == -1) return TNS_NONE;
|
if(track == -1) return TNS_NONE;
|
||||||
return GetTapNoteScore(track, row);
|
return GetTapNote(track, row).result.tns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* From aaroninjapan.com (http://www.aaroninjapan.com/ddr2.html)
|
/* From aaroninjapan.com (http://www.aaroninjapan.com/ddr2.html)
|
||||||
@@ -335,36 +337,6 @@ void extend(vector<T> &v, T val, unsigned pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TapNoteScore NoteDataWithScoring::GetTapNoteScore(unsigned track, unsigned row) const
|
|
||||||
{
|
|
||||||
if(row >= m_TapNoteScores[track].size())
|
|
||||||
return TNS_NONE;
|
|
||||||
return m_TapNoteScores[track][row].tns;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NoteDataWithScoring::SetTapNoteScore(unsigned track, unsigned row, TapNoteScore tns)
|
|
||||||
{
|
|
||||||
extend(m_TapNoteScores[track], TapNoteResult(), row);
|
|
||||||
TapNoteResult tnr = m_TapNoteScores[track][row];
|
|
||||||
tnr.tns = tns;
|
|
||||||
m_TapNoteScores[track][row] = tnr;
|
|
||||||
}
|
|
||||||
|
|
||||||
float NoteDataWithScoring::GetTapNoteOffset(unsigned track, unsigned row) const
|
|
||||||
{
|
|
||||||
if(row >= m_TapNoteScores[track].size())
|
|
||||||
return 0;
|
|
||||||
return m_TapNoteScores[track][row].fTapNoteOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NoteDataWithScoring::SetTapNoteOffset(unsigned track, unsigned row, float offset)
|
|
||||||
{
|
|
||||||
extend(m_TapNoteScores[track], TapNoteResult(), row);
|
|
||||||
TapNoteResult tnr = m_TapNoteScores[track][row];
|
|
||||||
tnr.fTapNoteOffset = offset;
|
|
||||||
m_TapNoteScores[track][row] = tnr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -17,9 +17,6 @@ struct RowTrack: public pair<int,int>
|
|||||||
|
|
||||||
class NoteDataWithScoring : public NoteData
|
class NoteDataWithScoring : public NoteData
|
||||||
{
|
{
|
||||||
// maintain this extra data in addition to the NoteData
|
|
||||||
vector<TapNoteResult> m_TapNoteScores[MAX_NOTE_TRACKS];
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NoteDataWithScoring();
|
NoteDataWithScoring();
|
||||||
void Init();
|
void Init();
|
||||||
@@ -30,19 +27,16 @@ public:
|
|||||||
int GetNumHoldNotesWithScore( HoldNoteScore hns, const float fStartBeat = 0, const float fEndBeat = -1 ) const;
|
int GetNumHoldNotesWithScore( HoldNoteScore hns, const float fStartBeat = 0, const float fEndBeat = -1 ) const;
|
||||||
int GetSuccessfulMines( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
|
int GetSuccessfulMines( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
|
||||||
int GetSuccessfulHands( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
|
int GetSuccessfulHands( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
|
||||||
TapNoteScore GetTapNoteScore(unsigned track, unsigned row) const;
|
|
||||||
void SetTapNoteScore(unsigned track, unsigned row, TapNoteScore tns);
|
|
||||||
float GetTapNoteOffset(unsigned track, unsigned row) const;
|
|
||||||
void SetTapNoteOffset(unsigned track, unsigned row, float offset);
|
|
||||||
|
|
||||||
bool IsRowCompletelyJudged(unsigned row) const;
|
bool IsRowCompletelyJudged(unsigned row) const;
|
||||||
TapNoteScore MinTapNoteScore(unsigned row) const;
|
TapNoteScore MinTapNoteScore(unsigned row) const;
|
||||||
int LastTapNoteScoreTrack(unsigned row) const;
|
|
||||||
TapNoteScore LastTapNoteScore(unsigned row) const;
|
TapNoteScore LastTapNoteScore(unsigned row) const;
|
||||||
|
|
||||||
void GetActualRadarValues( PlayerNumber pn, float fSongSeconds, RadarValues& out ) const;
|
void GetActualRadarValues( PlayerNumber pn, float fSongSeconds, RadarValues& out ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int LastTapNoteScoreTrack(unsigned row) const;
|
||||||
|
|
||||||
float GetActualStreamRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
float GetActualStreamRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
||||||
float GetActualVoltageRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
float GetActualVoltageRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
||||||
float GetActualAirRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
float GetActualAirRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ struct TapNote
|
|||||||
|
|
||||||
/* This data is only used and manipulated by NoteDataWithScoring. It's only in
|
/* This data is only used and manipulated by NoteDataWithScoring. It's only in
|
||||||
* here for the sake of efficiency. */
|
* here for the sake of efficiency. */
|
||||||
|
TapNoteResult result;
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned MAX_NUM_ATTACKS = 2*2*2; // 3 bits to hold the attack index currently
|
const unsigned MAX_NUM_ATTACKS = 2*2*2; // 3 bits to hold the attack index currently
|
||||||
|
|||||||
+18
-11
@@ -371,7 +371,7 @@ void Player::Update( float fDeltaTime )
|
|||||||
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
||||||
|
|
||||||
// if they got a bad score or haven't stepped on the corresponding tap yet
|
// if they got a bad score or haven't stepped on the corresponding tap yet
|
||||||
const TapNoteScore tns = m_NoteData.GetTapNoteScore( hn.iTrack, hn.iStartRow );
|
const TapNoteScore tns = m_NoteData.GetTapNote( hn.iTrack, hn.iStartRow ).result.tns;
|
||||||
const bool bSteppedOnTapNote = tns != TNS_NONE && tns != TNS_MISS; // did they step on the start of this hold?
|
const bool bSteppedOnTapNote = tns != TNS_NONE && tns != TNS_MISS; // did they step on the start of this hold?
|
||||||
|
|
||||||
float fLife = hn.result.fLife;
|
float fLife = hn.result.fLife;
|
||||||
@@ -641,9 +641,10 @@ int Player::GetClosestNoteDirectional( int col, int iStartRow, int iMaxRowsAhead
|
|||||||
/* Is iRow the row we want? */
|
/* Is iRow the row we want? */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if( m_NoteData.GetTapNote(col, iRow).type == TapNote::empty )
|
TapNote tn = m_NoteData.GetTapNote(col, iRow);
|
||||||
|
if( tn.type == TapNote::empty )
|
||||||
break;
|
break;
|
||||||
if( !bAllowGraded && m_NoteData.GetTapNoteScore(col, iRow) != TNS_NONE )
|
if( !bAllowGraded && tn.result.tns != TNS_NONE )
|
||||||
break;
|
break;
|
||||||
return iRow;
|
return iRow;
|
||||||
} while(0);
|
} while(0);
|
||||||
@@ -947,10 +948,12 @@ void Player::Step( int col, RageTimer tm )
|
|||||||
score, col, fStepSeconds, fCurrentMusicSeconds, fMusicSeconds, fNoteOffset );
|
score, col, fStepSeconds, fCurrentMusicSeconds, fMusicSeconds, fNoteOffset );
|
||||||
// LOG->Trace("Note offset: %f (fSecondsFromPerfect = %f), Score: %i", fNoteOffset, fSecondsFromPerfect, score);
|
// LOG->Trace("Note offset: %f (fSecondsFromPerfect = %f), Score: %i", fNoteOffset, fSecondsFromPerfect, score);
|
||||||
|
|
||||||
m_NoteData.SetTapNoteScore(col, iIndexOverlappingNote, score);
|
tn.result.tns = score;
|
||||||
|
|
||||||
if( score != TNS_NONE )
|
if( score != TNS_NONE )
|
||||||
m_NoteData.SetTapNoteOffset(col, iIndexOverlappingNote, -fNoteOffset);
|
tn.result.fTapNoteOffset = -fNoteOffset;
|
||||||
|
|
||||||
|
m_NoteData.SetTapNote( col, iIndexOverlappingNote, tn );
|
||||||
|
|
||||||
if( m_pPlayerState->m_PlayerController == PC_HUMAN &&
|
if( m_pPlayerState->m_PlayerController == PC_HUMAN &&
|
||||||
score >= TNS_GREAT )
|
score >= TNS_GREAT )
|
||||||
@@ -1129,19 +1132,23 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
|
|||||||
{
|
{
|
||||||
/* XXX: cleaner to pick the things we do want to apply misses to, instead of
|
/* XXX: cleaner to pick the things we do want to apply misses to, instead of
|
||||||
* the things we don't? */
|
* the things we don't? */
|
||||||
switch( m_NoteData.GetTapNote(t, r).type )
|
TapNote tn = m_NoteData.GetTapNote(t, r);
|
||||||
|
switch( tn.type )
|
||||||
{
|
{
|
||||||
case TapNote::empty:
|
case TapNote::empty:
|
||||||
case TapNote::attack:
|
case TapNote::attack:
|
||||||
case TapNote::mine:
|
case TapNote::mine:
|
||||||
continue; /* no note here */
|
continue; /* no note here */
|
||||||
}
|
}
|
||||||
if( m_NoteData.GetTapNoteScore(t, r) != TNS_NONE ) /* note here is already hit */
|
if( tn.result.tns != TNS_NONE ) /* note here is already hit */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
tn.result.tns = TNS_MISS;
|
||||||
|
|
||||||
// A normal note. Penalize for not stepping on it.
|
// A normal note. Penalize for not stepping on it.
|
||||||
MissedNoteOnThisRow = true;
|
MissedNoteOnThisRow = true;
|
||||||
m_NoteData.SetTapNoteScore( t, r, TNS_MISS );
|
|
||||||
|
m_NoteData.SetTapNote( t, r, tn );
|
||||||
|
|
||||||
if( m_pPlayerStageStats )
|
if( m_pPlayerStageStats )
|
||||||
{
|
{
|
||||||
@@ -1174,9 +1181,9 @@ void Player::CrossedRow( int iNoteRow )
|
|||||||
{
|
{
|
||||||
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( m_NoteData.GetTapNote(t, iNoteRow).type != TapNote::empty )
|
TapNote tn = m_NoteData.GetTapNote(t, iNoteRow);
|
||||||
if( m_NoteData.GetTapNoteScore(t, iNoteRow) == TNS_NONE )
|
if( tn.type != TapNote::empty && tn.result.tns == TNS_NONE )
|
||||||
Step( t, now );
|
Step( t, now );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user