use a vector for hold note scores

This commit is contained in:
Glenn Maynard
2002-11-03 21:38:22 +00:00
parent 81bb9b57e7
commit 11e1d16008
4 changed files with 16 additions and 27 deletions
+7 -10
View File
@@ -19,23 +19,20 @@ NoteDataWithScoring::NoteDataWithScoring()
Init();
}
void NoteDataWithScoring::Init()
void NoteDataWithScoring::Init(int taps, int holds)
{
NoteData::Init();
InitScoringData();
}
void NoteDataWithScoring::InitScoringData()
{
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
m_TapNoteScores[t][i] = TNS_NONE;
for( int i=0; i<MAX_HOLD_NOTES; i++ )
{
m_HoldNoteScores[i] = HNS_NONE;
m_fHoldNoteLife[i] = 1.0f;
}
m_HoldNoteScores.clear();
m_HoldNoteScores.insert(m_HoldNoteScores.begin(), holds, HNS_NONE);
m_fHoldNoteLife.clear();
// start with full life
m_fHoldNoteLife.insert(m_fHoldNoteLife.begin(), holds, 1.0f);
}
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, const float fEndBeat )
+7 -10
View File
@@ -16,19 +16,16 @@
struct NoteDataWithScoring : public NoteData
{
NoteDataWithScoring();
void Init();
void InitScoringData();
void Init(int taps=0, int holds=0);
// maintain this extra data in addition to the NoteData
TapNoteScore m_TapNoteScores[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS];
HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTES];
float m_fHoldNoteLife[MAX_TAP_NOTE_ROWS]; // 1.0 means this HoldNote has full life.
// 0.0 means this HoldNote is dead
// When this value hits 0.0 for the first time,
// m_HoldScore becomes HSS_NG.
// If the life is > 0.0 when the HoldNote ends, then
// m_HoldScore becomes HSS_OK.
vector<HoldNoteScore> m_HoldNoteScores;
/* 1.0 means this HoldNote has full life.
* 0.0 means this HoldNote is dead
* When this value hits 0.0 for the first time, m_HoldScore becomes HSS_NG.
* If the life is > 0.0 when the HoldNote ends, then m_HoldScore becomes HSS_OK. */
vector<float> m_fHoldNoteLife;
// statistics
int GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
+1 -6
View File
@@ -51,7 +51,7 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber pn, int iPixelsToDrawBeh
m_fPercentFadeToFail = -1;
NoteDataWithScoring::Init();
NoteDataWithScoring::Init(pNoteData->GetNumTapNotes(), pNoteData->GetNumHoldNotes());
for( int i=0; i<MAX_HOLD_NOTES; i++ )
m_bIsHoldingHoldNote[i] = false;
@@ -62,11 +62,6 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber pn, int iPixelsToDrawBeh
for( int c=0; c<m_iNumTracks; c++ )
m_NoteDisplay[c].Load( c, pn );
for( i=0; i<MAX_HOLD_NOTES; i++ )
m_fHoldNoteLife[i] = 1; // start with full life
ASSERT( m_iNumTracks == GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer );
}
+1 -1
View File
@@ -117,7 +117,7 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDi
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
// init scoring
NoteDataWithScoring::Init();
NoteDataWithScoring::Init(pNoteData->GetNumTapNotes(), pNoteData->GetNumHoldNotes());
// copy note data
this->CopyAll( pNoteData );