Prepair for better couple/routine stat tracking.

...gah, what a bad pun.
This commit is contained in:
Jason Felds
2011-07-13 15:22:04 -04:00
parent 72255a931a
commit 84d910d2fc
2 changed files with 276 additions and 11 deletions
+207 -11
View File
@@ -459,6 +459,31 @@ int NoteData::GetLastRow() const
return iOldestRowFoundSoFar;
}
bool NoteData::IsTap(const TapNote &tn, const int row) const
{
return (tn.type != TapNote::empty && tn.type != TapNote::mine
&& tn.type != TapNote::lift && tn.type != TapNote::fake
&& GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(row));
}
bool NoteData::IsMine(const TapNote &tn, const int row) const
{
return (tn.type == TapNote::mine
&& GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(row));
}
bool NoteData::IsLift(const TapNote &tn, const int row) const
{
return (tn.type == TapNote::lift
&& GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(row));
}
bool NoteData::IsFake(const TapNote &tn, const int row) const
{
return (tn.type == TapNote::fake
|| !GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(row));
}
int NoteData::GetNumTapNotes( int iStartIndex, int iEndIndex ) const
{
int iNumNotes = 0;
@@ -466,10 +491,7 @@ int NoteData::GetNumTapNotes( int iStartIndex, int iEndIndex ) const
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
{
const TapNote &tn = GetTapNote(t, r);
if( tn.type != TapNote::empty && tn.type != TapNote::mine
&& tn.type != TapNote::lift && tn.type != TapNote::fake
&& GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(r) )
if (this->IsTap(GetTapNote(t, r), r))
iNumNotes++;
}
}
@@ -500,8 +522,7 @@ int NoteData::GetNumMines( int iStartIndex, int iEndIndex ) const
for( int t=0; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
if( GetTapNote(t, r).type == TapNote::mine
&& GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(r))
if (this->IsMine(GetTapNote(t, r), r))
iNumMines++;
}
@@ -640,8 +661,7 @@ int NoteData::GetNumLifts( int iStartIndex, int iEndIndex ) const
for( int t=0; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
if( GetTapNote(t, r).type == TapNote::lift
&& GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(r))
if( this->IsLift(GetTapNote(t, r), r))
iNumLifts++;
}
@@ -655,14 +675,190 @@ int NoteData::GetNumFakes( int iStartIndex, int iEndIndex ) const
for( int t=0; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
if( GetTapNote(t, r).type == TapNote::fake
|| !GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(r))
iNumFakes++;
if( this->IsFake(GetTapNote(t, r), r))
iNumFakes++;
}
return iNumFakes;
}
bool NoteData::IsPlayer1(const int track, const TapNote &tn) const
{
if (this->IsComposite())
{
return tn.pn == PLAYER_1;
}
return track < (this->GetNumTracks() / 2);
}
pair<int, int> NoteData::GetNumTapNotesTwoPlayer( int iStartIndex, int iEndIndex ) const
{
pair<int, int> num(0, 0);
for( int t=0; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
{
const TapNote &tn = GetTapNote(t, r);
if (this->IsTap(tn, r))
{
if (this->IsPlayer1(t, tn))
num.first++;
else
num.second++;
}
}
}
return num;
}
pair<int, int> NoteData::GetNumRowsWithSimultaneousTapsTwoPlayer(int minTaps,
int startRow,
int endRow) const
{
pair<int, int> num(0, 0);
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( *this, r, startRow, endRow )
{
pair<int, int> found(0, 0);
for( int t=0; t<GetNumTracks(); t++ )
{
const TapNote &tn = GetTapNote(t, r);
if (this->IsTap(tn, r))
{
if (this->IsPlayer1(t, tn))
found.first++;
else
found.second++;
}
}
if (found.first >= minTaps)
num.first++;
if (found.second >= minTaps)
num.second++;
}
return num;
}
pair<int, int> NoteData::GetNumJumpsTwoPlayer( int iStartIndex, int iEndIndex ) const
{
return GetNumRowsWithSimultaneousTapsTwoPlayer( 2, iStartIndex, iEndIndex );
}
pair<int, int> NoteData::GetNumHandsTwoPlayer( int iStartIndex, int iEndIndex ) const
{
return GetNumRowsWithSimultaneousTapsTwoPlayer( 3, iStartIndex, iEndIndex );
}
pair<int, int> NoteData::GetNumQuadsTwoPlayer( int iStartIndex, int iEndIndex ) const
{
return GetNumRowsWithSimultaneousTapsTwoPlayer( 4, iStartIndex, iEndIndex );
}
pair<int, int> NoteData::GetNumHoldNotesTwoPlayer( int iStartIndex, int iEndIndex ) const
{
pair<int, int> num(0, 0);
for( int t=0; t<GetNumTracks(); ++t )
{
NoteData::TrackMap::const_iterator lBegin, lEnd;
GetTapNoteRangeExclusive( t, iStartIndex, iEndIndex, lBegin, lEnd );
for( ; lBegin != lEnd; ++lBegin )
{
if( lBegin->second.type != TapNote::hold_head ||
lBegin->second.subType != TapNote::hold_head_hold )
continue;
if (!GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(lBegin->first))
continue;
if (this->IsPlayer1(t, lBegin->second))
num.first++;
else
num.second++;
}
}
return num;
}
pair<int, int> NoteData::GetNumMinesTwoPlayer( int iStartIndex, int iEndIndex ) const
{
pair<int, int> num(0, 0);
for( int t=0; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
{
const TapNote &tn = GetTapNote(t, r);
if (this->IsMine(tn, r))
{
if (this->IsPlayer1(t, tn))
num.first++;
else
num.second++;
}
}
}
return num;
}
pair<int, int> NoteData::GetNumRollsTwoPlayer( int iStartIndex, int iEndIndex ) const
{
pair<int, int> num(0, 0);
for( int t=0; t<GetNumTracks(); ++t )
{
NoteData::TrackMap::const_iterator lBegin, lEnd;
GetTapNoteRangeExclusive( t, iStartIndex, iEndIndex, lBegin, lEnd );
for( ; lBegin != lEnd; ++lBegin )
{
if( lBegin->second.type != TapNote::hold_head ||
lBegin->second.subType != TapNote::hold_head_roll )
continue;
if (!GAMESTATE->GetProcessedTimingData()->IsJudgableAtRow(lBegin->first))
continue;
if (this->IsPlayer1(t, lBegin->second))
num.first++;
else
num.second++;
}
}
return num;
}
pair<int, int> NoteData::GetNumLiftsTwoPlayer( int iStartIndex, int iEndIndex ) const
{
pair<int, int> num(0, 0);
for( int t=0; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
{
const TapNote &tn = GetTapNote(t, r);
if (this->IsLift(tn, r))
{
if (this->IsPlayer1(t, tn))
num.first++;
else
num.second++;
}
}
}
return num;
}
pair<int, int> NoteData::GetNumFakesTwoPlayer( int iStartIndex, int iEndIndex ) const
{
pair<int, int> num(0, 0);
for( int t=0; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
{
const TapNote &tn = GetTapNote(t, r);
if (this->IsFake(tn, r))
{
if (this->IsPlayer1(t, tn))
num.first++;
else
num.second++;
}
}
}
return num;
}
/*
int NoteData::GetNumMinefields( int iStartIndex, int iEndIndex ) const
{
+69
View File
@@ -90,7 +90,46 @@ private:
// There's no point in inserting empty notes into the map.
// Any blank space in the map is defined to be empty.
vector<TrackMap> m_TapNotes;
/**
* @brief Determine whether this note is for Player 1 or Player 2.
* @param track the track/column the note is in.
* @param tn the note in question. Required for routine mode.
* @return true if it's for player 1, false for player 2. */
bool IsPlayer1(const int track, const TapNote &tn) const;
/**
* @brief Determine if the note in questino should be counted as a tap.
* @param tn the note in question.
* @param row the row it lives in.
* @return true if it's a tap, false otherwise. */
bool IsTap(const TapNote &tn, const int row) const;
/**
* @brief Determine if the note in questino should be counted as a mine.
* @param tn the note in question.
* @param row the row it lives in.
* @return true if it's a mine, false otherwise. */
bool IsMine(const TapNote &tn, const int row) const;
/**
* @brief Determine if the note in questino should be counted as a lift.
* @param tn the note in question.
* @param row the row it lives in.
* @return true if it's a lift, false otherwise. */
bool IsLift(const TapNote &tn, const int row) const;
/**
* @brief Determine if the note in questino should be counted as a fake.
* @param tn the note in question.
* @param row the row it lives in.
* @return true if it's a fake, false otherwise. */
bool IsFake(const TapNote &tn, const int row) const;
pair<int, int> GetNumRowsWithSimultaneousTapsTwoPlayer(int minTaps = 2,
int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
public:
void Init();
@@ -241,6 +280,8 @@ public:
{
return GetNumRowsWithSimultaneousTaps( 2, iStartIndex, iEndIndex );
}
// This row needs at least iMinSimultaneousPresses either tapped or held.
bool RowNeedsAtLeastSimultaneousPresses( int iMinSimultaneousPresses, int row ) const;
@@ -261,6 +302,34 @@ public:
int GetNumLifts( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
int GetNumFakes( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
// the couple/routine style variants of the above.
pair<int, int> GetNumTapNotesTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
pair<int, int> GetNumJumpsTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
pair<int, int> GetNumHandsTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
pair<int, int> GetNumQuadsTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
pair<int, int> GetNumHoldNotesTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
pair<int, int> GetNumMinesTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
pair<int, int> GetNumRollsTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
pair<int, int> GetNumLiftsTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
pair<int, int> GetNumFakesTwoPlayer(int startRow = 0,
int endRow = MAX_NOTE_ROW) const;
// Transformations
void LoadTransformed(const NoteData& original,
int iNewNumTracks,