Add GetMaxCombo.
Store combo rollover separately in the combo record.
This commit is contained in:
@@ -183,7 +183,7 @@ void StageStats::UpdateComboList( PlayerNumber pn, float pos )
|
||||
fFirstPos[pn] = min( pos, fFirstPos[pn] );
|
||||
fLastPos[pn] = max( pos, fLastPos[pn] );
|
||||
|
||||
const int cnt = iCurCombo[pn];
|
||||
int cnt = iCurCombo[pn];
|
||||
if( !cnt )
|
||||
return; /* no combo */
|
||||
|
||||
@@ -193,6 +193,15 @@ void StageStats::UpdateComboList( PlayerNumber pn, float pos )
|
||||
Combo_t NewCombo;
|
||||
NewCombo.start = pos;
|
||||
ComboList[pn].push_back( NewCombo );
|
||||
|
||||
/* If this is the first combo, and the current combo is greater than 1,
|
||||
* then that extra part of the combo must have come from a previous song.
|
||||
* Remember it separately. */
|
||||
if( ComboList[pn].size() == 1 )
|
||||
{
|
||||
ComboList[pn][0].rollover = cnt-1;
|
||||
cnt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Combo_t &combo = ComboList[pn].back();
|
||||
@@ -200,6 +209,23 @@ void StageStats::UpdateComboList( PlayerNumber pn, float pos )
|
||||
combo.cnt = cnt;
|
||||
}
|
||||
|
||||
/* This returns the largest combo contained within the song, as if
|
||||
* m_bComboContinuesBetweenSongs is turned off. */
|
||||
StageStats::Combo_t StageStats::GetMaxCombo( PlayerNumber pn ) const
|
||||
{
|
||||
if( ComboList[pn].size() == 0 )
|
||||
return Combo_t();
|
||||
|
||||
int m = 0;
|
||||
for( unsigned i = 1; i < ComboList[pn].size(); ++i )
|
||||
{
|
||||
if( ComboList[pn][i].cnt > ComboList[pn][m].cnt )
|
||||
m = i;
|
||||
}
|
||||
|
||||
return ComboList[pn][m];
|
||||
}
|
||||
|
||||
/* SetLifeRecord and UpdateComboList take a percentage (0..1) in pos, but the values
|
||||
* will actually be somewhat off as they're based on Song::m_fFirstBeat and m_fLastBeat,
|
||||
* which are per-song, not per-Steps. Scale and shift our records so that they're
|
||||
|
||||
@@ -73,13 +73,17 @@ struct StageStats
|
||||
/* Combo size, in steps. */
|
||||
int cnt;
|
||||
|
||||
Combo_t(): start(-1), size(-1), cnt(-1) { }
|
||||
/* Combo rollover from the last song (see UpdateComboList for details). */
|
||||
int rollover;
|
||||
|
||||
Combo_t(): start(0), size(0), cnt(0), rollover(0) { }
|
||||
bool IsZero() const { return start < 0; }
|
||||
};
|
||||
float fFirstPos[NUM_PLAYERS], fLastPos[NUM_PLAYERS];
|
||||
|
||||
bool FullCombo( PlayerNumber pn ) const;
|
||||
void UpdateComboList( PlayerNumber pn, float pos );
|
||||
Combo_t GetMaxCombo( PlayerNumber pn ) const;
|
||||
|
||||
void Finish();
|
||||
vector<Combo_t> ComboList[NUM_PLAYERS];
|
||||
|
||||
Reference in New Issue
Block a user