Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

StageStats.h

Go to the documentation of this file.
00001 /* StageStats - Contains statistics for one stage of play - either one song, or a whole course. */ 00002 00003 #ifndef STAGE_STATS_H 00004 #define STAGE_STATS_H 00005 00006 #include "PlayerNumber.h" 00007 #include "GameConstantsAndTypes.h" 00008 #include "Grade.h" 00009 #include "RadarValues.h" 00010 #include <map> 00011 class Song; 00012 class Steps; 00013 class Style; 00014 00015 struct PlayerStageStats 00016 { 00017 PlayerStageStats() { Init(); } 00018 void Init(); 00019 00020 void AddStats( const PlayerStageStats& other ); // accumulate 00021 00022 Grade GetGrade() const; 00023 float GetPercentDancePoints() const; 00024 vector<Steps*> vpSteps; 00025 float fAliveSeconds; // how far into the music did they last before failing? Updated by Gameplay, scaled by music rate. 00026 00027 /* Set if the player actually failed at any point during the song. This is always 00028 * false in FAIL_OFF. If recovery is enabled and two players are playing, 00029 * this is only set if both players were failing at the same time. */ 00030 bool bFailed; 00031 00032 /* This indicates whether the player bottomed out his bar/ran out of lives at some 00033 * point during the song. It's set in all fail modes. */ 00034 bool bFailedEarlier; 00035 int iPossibleDancePoints; 00036 int iActualDancePoints; 00037 int iTapNoteScores[NUM_TAP_NOTE_SCORES]; 00038 int iHoldNoteScores[NUM_HOLD_NOTE_SCORES]; 00039 int iCurCombo; 00040 int iMaxCombo; 00041 int iCurMissCombo; 00042 int iScore; 00043 int iCurMaxScore; 00044 int iMaxScore; 00045 int iBonus; // bonus to be added on screeneval 00046 RadarValues radarPossible; // filled in by ScreenGameplay on start of notes 00047 RadarValues radarActual; 00048 float fSecondsBeforeFail; // -1 means didn't/hasn't failed 00049 /* The number of songs played and passed, respectively. */ 00050 int iSongsPassed; 00051 int iSongsPlayed; 00052 int iTotalError; 00053 00054 map<float,float> fLifeRecord; 00055 void SetLifeRecordAt( float fLife, float fSecond ); 00056 void GetLifeRecord( float *fLifeOut, int iNumSamples ) const; 00057 float GetLifeRecordAt( float fSecond ) const; 00058 float GetLifeRecordLerpAt( float fSecond ) const; 00059 00060 struct Combo_t 00061 { 00062 /* Start and size of this combo, in the same scale as the combo list mapping and 00063 * the life record. */ 00064 float fStartSecond, fSizeSeconds; 00065 00066 /* Combo size, in steps. */ 00067 int cnt; 00068 00069 /* Size of the combo that didn't come from this stage (rollover from the last song). 00070 * (This is a subset of cnt.) */ 00071 int rollover; 00072 00073 /* Get the size of the combo that came from this song. */ 00074 int GetStageCnt() const { return cnt - rollover; } 00075 00076 Combo_t(): fStartSecond(0), fSizeSeconds(0), cnt(0), rollover(0) { } 00077 bool IsZero() const { return fStartSecond < 0; } 00078 }; 00079 vector<Combo_t> ComboList; 00080 float fFirstSecond; 00081 float fLastSecond; 00082 00083 int GetComboAtStartOfStage() const; 00084 bool FullComboOfScore( TapNoteScore tnsAllGreaterOrEqual ) const; 00085 bool FullCombo() const { return FullComboOfScore(TNS_GREAT); } 00086 bool SingleDigitsOfScore( TapNoteScore tnsAllGreaterOrEqual ) const; 00087 bool OneOfScore( TapNoteScore tnsAllGreaterOrEqual ) const; 00088 int GetTotalTaps() const; 00089 float GetPercentageOfTaps( TapNoteScore tns ) const; 00090 void UpdateComboList( float fSecond, bool rollover ); 00091 Combo_t GetMaxCombo() const; 00092 }; 00093 00094 struct StageStats 00095 { 00096 StageStats() { Init(); } 00097 void Init(); 00098 00099 void AssertValid( PlayerNumber pn ) const; 00100 00101 void AddStats( const StageStats& other ); // accumulate 00102 00103 bool OnePassed() const; 00104 bool AllFailed() const; 00105 bool AllFailedEarlier() const; 00106 00107 int GetAverageMeter( PlayerNumber pn ) const; 00108 00109 PlayMode playMode; 00110 const Style* pStyle; 00111 vector<Song*> vpSongs; 00112 enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType; 00113 float fGameplaySeconds; // how many seconds before gameplay ended. Updated by Gameplay, not scaled by music rate. 00114 00115 PlayerStageStats m_player[NUM_PLAYERS]; 00116 }; 00117 00118 /* 00119 * This was in GameState, but GameState.h is used by tons of files, and this object 00120 * is only used by 20 or so. 00121 * 00122 * Stage Statistics: 00123 * Arcade: for the current stage (one song). 00124 * Nonstop/Oni/Endless: for current course (which usually contains multiple songs) 00125 */ 00126 extern StageStats g_CurStageStats; // current stage (not necessarily passed if Extra Stage) 00127 extern vector<StageStats> g_vPlayedStageStats; 00128 00129 00130 #endif 00131 00132 /* 00133 * (c) 2001-2004 Chris Danford, Glenn Maynard 00134 * All rights reserved. 00135 * 00136 * Permission is hereby granted, free of charge, to any person obtaining a 00137 * copy of this software and associated documentation files (the 00138 * "Software"), to deal in the Software without restriction, including 00139 * without limitation the rights to use, copy, modify, merge, publish, 00140 * distribute, and/or sell copies of the Software, and to permit persons to 00141 * whom the Software is furnished to do so, provided that the above 00142 * copyright notice(s) and this permission notice appear in all copies of 00143 * the Software and that both the above copyright notice(s) and this 00144 * permission notice appear in supporting documentation. 00145 * 00146 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00147 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00148 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00149 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00150 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00151 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00152 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00153 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00154 * PERFORMANCE OF THIS SOFTWARE. 00155 */

Generated on Thu Jan 27 20:57:33 2005 for StepMania by doxygen 1.3.7