Files
itgmania212121/stepmania/src/StageStats.h
T

115 lines
4.0 KiB
C++
Raw Normal View History

#ifndef StageStats_H
#define StageStats_H
/*
-----------------------------------------------------------------------------
Class: StageStats
Desc: Contains statistics for one stage of play - either one song, or a whole course.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "PlayerNumber.h"
#include "GameConstantsAndTypes.h"
#include "Grade.h"
2003-12-09 10:20:18 +00:00
#include "Style.h"
2003-12-22 01:55:03 +00:00
#include <map>
class Song;
class Steps;
struct StageStats
{
StageStats();
void AddStats( const StageStats& other ); // accumulate
2003-12-18 03:22:58 +00:00
Grade GetGrade( PlayerNumber pn ) const;
2003-09-06 00:33:09 +00:00
bool OnePassed() const;
2003-11-03 23:55:58 +00:00
bool AllFailed() const;
2003-12-31 20:58:14 +00:00
bool AllFailedEarlier() const;
2003-10-12 21:48:05 +00:00
float GetPercentDancePoints( PlayerNumber pn ) const;
2003-12-09 10:20:18 +00:00
PlayMode playMode;
Style style;
Song* pSong;
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
Steps* pSteps[NUM_PLAYERS];
int iMeter[NUM_PLAYERS];
2003-12-09 10:20:18 +00:00
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.
2003-10-13 03:24:28 +00:00
/* 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];
2003-10-13 03:24:28 +00:00
/* 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];
2003-03-16 20:55:45 +00:00
int iCurCombo[NUM_PLAYERS];
int iMaxCombo[NUM_PLAYERS];
int iCurMissCombo[NUM_PLAYERS];
2003-06-18 20:08:39 +00:00
int iScore[NUM_PLAYERS];
2003-08-11 12:14:26 +00:00
int iBonus[NUM_PLAYERS]; // bonus to be added on screeneval
2003-01-30 07:18:33 +00:00
float fRadarPossible[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; // filled in by ScreenGameplay on start of notes
float fRadarActual[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; // filled in by ScreenGameplay on start of notes
float fSecondsBeforeFail[NUM_PLAYERS]; // -1 means didn't/hasn't failed
/* The number of songs played and passed, respectively. */
int iSongsPassed[NUM_PLAYERS];
int iSongsPlayed[NUM_PLAYERS];
2003-07-31 23:01:02 +00:00
int iTotalError[NUM_PLAYERS];
2003-10-16 06:49:02 +00:00
2003-12-22 01:55:03 +00:00
map<float,float> fLifeRecord[NUM_PLAYERS];
2003-10-16 06:49:02 +00:00
void SetLifeRecord( PlayerNumber pn, float life, float pos );
void GetLifeRecord( PlayerNumber pn, float *life, int nout ) const;
2003-12-22 01:55:03 +00:00
float GetLifeRecordAt( PlayerNumber pn, float pos ) const;
float GetLifeRecordLerpAt( PlayerNumber pn, float pos ) const;
2003-10-23 06:17:12 +00:00
/* pos,combo */
struct Combo_t
{
/* Start and size of this combo, in the same scale as the combo list mapping and
* the life record. */
float start, size;
/* Combo size, in steps. */
int cnt;
2003-12-22 23:25:33 +00:00
/* Size of the combo that didn't come from this stage (rollover from the last song).
* (This is a subset of cnt.) */
2003-11-02 17:05:11 +00:00
int rollover;
2003-12-22 23:25:33 +00:00
/* Get the size of the combo that came from this song. */
int GetStageCnt() const { return cnt - rollover; }
2003-11-02 17:05:11 +00:00
Combo_t(): start(0), size(0), cnt(0), rollover(0) { }
2003-10-23 06:17:12 +00:00
bool IsZero() const { return start < 0; }
};
2003-12-22 01:55:03 +00:00
vector<Combo_t> ComboList[NUM_PLAYERS];
2003-10-30 04:41:03 +00:00
float fFirstPos[NUM_PLAYERS], fLastPos[NUM_PLAYERS];
2003-10-23 06:17:12 +00:00
2003-10-30 04:41:03 +00:00
bool FullCombo( PlayerNumber pn ) const;
2003-12-23 04:44:34 +00:00
void UpdateComboList( PlayerNumber pn, float pos, bool rollover );
2003-11-02 17:05:11 +00:00
Combo_t GetMaxCombo( PlayerNumber pn ) const;
};
/*
* This was in GameState, but GameState.h is used by tons of files, and this object
* is only used by 20 or so.
*
* Stage Statistics:
* Arcade: for the current stage (one song).
* Nonstop/Oni/Endless: for current course (which usually contains multiple songs)
*/
extern StageStats g_CurStageStats; // current stage (not necessarily passed if Extra Stage)
extern vector<StageStats> g_vPlayedStageStats;
#endif