fix this up
This commit is contained in:
@@ -19,22 +19,15 @@ NoteDataWithScoring::NoteDataWithScoring()
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataWithScoring::Init(int taps, int holds)
|
void NoteDataWithScoring::Init()
|
||||||
{
|
{
|
||||||
NoteData::Init();
|
NoteData::Init();
|
||||||
|
|
||||||
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
|
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
|
||||||
{
|
|
||||||
m_TapNoteScores[t].clear();
|
m_TapNoteScores[t].clear();
|
||||||
m_TapNoteScores[t].insert(m_TapNoteScores[t].begin(), taps, TNS_NONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_HoldNoteScores.clear();
|
m_HoldNoteScores.clear();
|
||||||
m_HoldNoteScores.insert(m_HoldNoteScores.begin(), holds, HNS_NONE);
|
|
||||||
|
|
||||||
m_fHoldNoteLife.clear();
|
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 )
|
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, const float fEndBeat )
|
||||||
@@ -178,3 +171,54 @@ float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds )
|
|||||||
float fReturn = GetNumHoldNotesWithScore(HNS_OK) / fSongSeconds;
|
float fReturn = GetNumHoldNotesWithScore(HNS_OK) / fSongSeconds;
|
||||||
return min( fReturn, 1.0f );
|
return min( fReturn, 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void extend(vector<T> &v, T val, unsigned pos)
|
||||||
|
{
|
||||||
|
int needed = pos - v.size() + 1;
|
||||||
|
if(needed > 0)
|
||||||
|
{
|
||||||
|
needed += 100; /* optimization: give it a little more than it needs */
|
||||||
|
v.insert(v.end(), needed, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TapNoteScore NoteDataWithScoring::GetTapNoteScore(unsigned track, unsigned row) const
|
||||||
|
{
|
||||||
|
if(row >= m_TapNoteScores[track].size())
|
||||||
|
return TNS_NONE;
|
||||||
|
return m_TapNoteScores[track][row];
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteDataWithScoring::SetTapNoteScore(unsigned track, unsigned row, TapNoteScore tns)
|
||||||
|
{
|
||||||
|
extend(m_TapNoteScores[track], TNS_NONE, row);
|
||||||
|
m_TapNoteScores[track][row] = tns;
|
||||||
|
}
|
||||||
|
|
||||||
|
HoldNoteScore NoteDataWithScoring::GetHoldNoteScore(unsigned h) const
|
||||||
|
{
|
||||||
|
if(h >= m_HoldNoteScores.size())
|
||||||
|
return HNS_NONE;
|
||||||
|
return m_HoldNoteScores[h];
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteDataWithScoring::SetHoldNoteScore(unsigned h, HoldNoteScore hns)
|
||||||
|
{
|
||||||
|
extend(m_HoldNoteScores, HNS_NONE, h);
|
||||||
|
m_HoldNoteScores[h] = hns;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteDataWithScoring::SetHoldNoteLife(unsigned h, float f)
|
||||||
|
{
|
||||||
|
extend(m_fHoldNoteLife, 1.0f, h);
|
||||||
|
m_fHoldNoteLife[h] = f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float NoteDataWithScoring::GetHoldNoteLife(unsigned h) const
|
||||||
|
{
|
||||||
|
// start with full life
|
||||||
|
if(h >= m_fHoldNoteLife.size())
|
||||||
|
return 1.0f;
|
||||||
|
return m_fHoldNoteLife[h];
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ class NoteDataWithScoring : public NoteData
|
|||||||
{
|
{
|
||||||
// maintain this extra data in addition to the NoteData
|
// maintain this extra data in addition to the NoteData
|
||||||
vector<TapNoteScore> m_TapNoteScores[MAX_NOTE_TRACKS];
|
vector<TapNoteScore> m_TapNoteScores[MAX_NOTE_TRACKS];
|
||||||
|
|
||||||
vector<HoldNoteScore> m_HoldNoteScores;
|
vector<HoldNoteScore> m_HoldNoteScores;
|
||||||
|
|
||||||
/* 1.0 means this HoldNote has full life.
|
/* 1.0 means this HoldNote has full life.
|
||||||
@@ -28,43 +27,20 @@ class NoteDataWithScoring : public NoteData
|
|||||||
vector<float> m_fHoldNoteLife;
|
vector<float> m_fHoldNoteLife;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
NoteDataWithScoring();
|
NoteDataWithScoring();
|
||||||
void Init(int taps=0, int holds=0);
|
void Init();
|
||||||
|
|
||||||
// statistics
|
// statistics
|
||||||
int GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
int GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||||
int GetNumDoublesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
int GetNumDoublesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||||
int GetNumHoldNotesWithScore( HoldNoteScore hns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
int GetNumHoldNotesWithScore( HoldNoteScore hns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||||
|
|
||||||
const TapNoteScore &GetTapNoteScore(int track, int row) const
|
TapNoteScore GetTapNoteScore(unsigned track, unsigned row) const;
|
||||||
{
|
void SetTapNoteScore(unsigned track, unsigned row, TapNoteScore tns);
|
||||||
ASSERT(row < int(m_TapNoteScores[track].size()));
|
HoldNoteScore GetHoldNoteScore(unsigned h) const;
|
||||||
return m_TapNoteScores[track][row];
|
void SetHoldNoteScore(unsigned h, HoldNoteScore hns);
|
||||||
}
|
float GetHoldNoteLife(unsigned h) const;
|
||||||
TapNoteScore &GetTapNoteScore(int track, int row)
|
void SetHoldNoteLife(unsigned h, float f);
|
||||||
{
|
|
||||||
ASSERT(row < int(m_TapNoteScores[track].size()));
|
|
||||||
return m_TapNoteScores[track][row];
|
|
||||||
}
|
|
||||||
const HoldNoteScore &GetHoldNoteScore(int h) const
|
|
||||||
{
|
|
||||||
ASSERT(h < int(m_HoldNoteScores.size()));
|
|
||||||
return m_HoldNoteScores[h];
|
|
||||||
}
|
|
||||||
HoldNoteScore &GetHoldNoteScore(int h)
|
|
||||||
{
|
|
||||||
ASSERT(h < int(m_HoldNoteScores.size()));
|
|
||||||
return m_HoldNoteScores[h];
|
|
||||||
}
|
|
||||||
float &GetHoldNoteLife(int h)
|
|
||||||
{
|
|
||||||
return m_fHoldNoteLife[h];
|
|
||||||
}
|
|
||||||
const float &GetHoldNoteLife(int h) const
|
|
||||||
{
|
|
||||||
return m_fHoldNoteLife[h];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsRowComplete( int index );
|
bool IsRowComplete( int index );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user