split StageStats into player-specific and non-player-specific structs

This commit is contained in:
Chris Danford
2004-12-20 10:47:41 +00:00
parent f840c014a9
commit 09d018444e
23 changed files with 638 additions and 547 deletions
+65 -51
View File
@@ -12,59 +12,48 @@ class Song;
class Steps;
class Style;
struct StageStats
struct PlayerStageStats
{
StageStats() { Init(); }
PlayerStageStats() { Init(); }
void Init();
void AssertValid( PlayerNumber pn ) const;
void AddStats( const StageStats& other ); // accumulate
Grade GetGrade( PlayerNumber pn ) const;
bool OnePassed() const;
bool AllFailed() const;
bool AllFailedEarlier() const;
float GetPercentDancePoints( PlayerNumber pn ) const;
void AddStats( const PlayerStageStats& other ); // accumulate
PlayMode playMode;
const Style* pStyle;
vector<Song*> vpSongs;
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
vector<Steps*> vpSteps[NUM_PLAYERS];
int GetAverageMeter( PlayerNumber pn ) const;
float fAliveSeconds[NUM_PLAYERS]; // how far into the music did they last before failing? Updated by Gameplay, scaled by music rate.
float fGameplaySeconds; // how many seconds before gameplay ended. Updated by Gameplay, not scaled by music rate.
Grade GetGrade() const;
float GetPercentDancePoints() const;
vector<Steps*> vpSteps;
float fAliveSeconds; // how far into the music did they last before failing? Updated by Gameplay, scaled by music rate.
/* Set if the player actually failed at any point during the song. This is always
* false in FAIL_OFF. If recovery is enabled and two players are playing,
* this is only set if both players were failing at the same time. */
bool bFailed[NUM_PLAYERS];
bool bFailed;
/* This indicates whether the player bottomed out his bar/ran out of lives at some
* point during the song. It's set in all fail modes. */
bool bFailedEarlier[NUM_PLAYERS];
int iPossibleDancePoints[NUM_PLAYERS];
int iActualDancePoints[NUM_PLAYERS];
int iTapNoteScores[NUM_PLAYERS][NUM_TAP_NOTE_SCORES];
int iHoldNoteScores[NUM_PLAYERS][NUM_HOLD_NOTE_SCORES];
int iCurCombo[NUM_PLAYERS];
int iMaxCombo[NUM_PLAYERS];
int iCurMissCombo[NUM_PLAYERS];
int iScore[NUM_PLAYERS];
int iBonus[NUM_PLAYERS]; // bonus to be added on screeneval
RadarValues radarPossible[NUM_PLAYERS]; // filled in by ScreenGameplay on start of notes
RadarValues radarActual[NUM_PLAYERS];
float fSecondsBeforeFail[NUM_PLAYERS]; // -1 means didn't/hasn't failed
bool bFailedEarlier;
int iPossibleDancePoints;
int iActualDancePoints;
int iTapNoteScores[NUM_TAP_NOTE_SCORES];
int iHoldNoteScores[NUM_HOLD_NOTE_SCORES];
int iCurCombo;
int iMaxCombo;
int iCurMissCombo;
int iScore;
int iBonus; // bonus to be added on screeneval
RadarValues radarPossible; // filled in by ScreenGameplay on start of notes
RadarValues radarActual;
float fSecondsBeforeFail; // -1 means didn't/hasn't failed
/* The number of songs played and passed, respectively. */
int iSongsPassed[NUM_PLAYERS];
int iSongsPlayed[NUM_PLAYERS];
int iTotalError[NUM_PLAYERS];
int iSongsPassed;
int iSongsPlayed;
int iTotalError;
map<float,float> fLifeRecord[NUM_PLAYERS];
void SetLifeRecordAt( PlayerNumber pn, float fLife, float fSecond );
void GetLifeRecord( PlayerNumber pn, float *fLifeOut, int iNumSamples ) const;
float GetLifeRecordAt( PlayerNumber pn, float fSecond ) const;
float GetLifeRecordLerpAt( PlayerNumber pn, float fSecond ) const;
map<float,float> fLifeRecord;
void SetLifeRecordAt( float fLife, float fSecond );
void GetLifeRecord( float *fLifeOut, int iNumSamples ) const;
float GetLifeRecordAt( float fSecond ) const;
float GetLifeRecordLerpAt( float fSecond ) const;
struct Combo_t
{
@@ -85,18 +74,43 @@ struct StageStats
Combo_t(): fStartSecond(0), fSizeSeconds(0), cnt(0), rollover(0) { }
bool IsZero() const { return fStartSecond < 0; }
};
vector<Combo_t> ComboList[NUM_PLAYERS];
float fFirstSecond[NUM_PLAYERS], fLastSecond[NUM_PLAYERS];
vector<Combo_t> ComboList;
float fFirstSecond;
float fLastSecond;
int GetComboAtStartOfStage( PlayerNumber pn ) const;
bool FullComboOfScore( PlayerNumber pn, TapNoteScore tnsAllGreaterOrEqual ) const;
bool FullCombo( PlayerNumber pn ) const { return FullComboOfScore(pn,TNS_GREAT); }
bool SingleDigitsOfScore( PlayerNumber pn, TapNoteScore tnsAllGreaterOrEqual ) const;
bool OneOfScore( PlayerNumber pn, TapNoteScore tnsAllGreaterOrEqual ) const;
int GetTotalTaps( PlayerNumber pn ) const;
float GetPercentageOfTaps( PlayerNumber pn, TapNoteScore tns ) const;
void UpdateComboList( PlayerNumber pn, float fSecond, bool rollover );
Combo_t GetMaxCombo( PlayerNumber pn ) const;
int GetComboAtStartOfStage() const;
bool FullComboOfScore( TapNoteScore tnsAllGreaterOrEqual ) const;
bool FullCombo() const { return FullComboOfScore(TNS_GREAT); }
bool SingleDigitsOfScore( TapNoteScore tnsAllGreaterOrEqual ) const;
bool OneOfScore( TapNoteScore tnsAllGreaterOrEqual ) const;
int GetTotalTaps() const;
float GetPercentageOfTaps( TapNoteScore tns ) const;
void UpdateComboList( float fSecond, bool rollover );
Combo_t GetMaxCombo() const;
};
struct StageStats
{
StageStats() { Init(); }
void Init();
void AssertValid( PlayerNumber pn ) const;
void AddStats( const StageStats& other ); // accumulate
bool OnePassed() const;
bool AllFailed() const;
bool AllFailedEarlier() const;
int GetAverageMeter( PlayerNumber pn ) const;
PlayMode playMode;
const Style* pStyle;
vector<Song*> vpSongs;
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
float fGameplaySeconds; // how many seconds before gameplay ended. Updated by Gameplay, not scaled by music rate.
PlayerStageStats m_player[NUM_PLAYERS];
};
/*