more stats.html categories

This commit is contained in:
Chris Danford
2003-12-09 10:20:18 +00:00
parent d4397d4644
commit 8d6b19ad7a
7 changed files with 154 additions and 44 deletions
+1
View File
@@ -38,6 +38,7 @@
// Note definitions
//
const int MAX_METER = 12;
const int MIN_METER = 1;
/* This is just cached song data. Not all of it may actually be displayed
* in the radar. */
+40 -24
View File
@@ -169,34 +169,50 @@ void GameState::EndGame()
Profile* pMachineProfile = PROFILEMAN->GetMachineProfile();
for( int p=0; p<NUM_PLAYERS; p++ )
{
int iGameplaySeconds = 0;
for( int i=0; i<m_vPlayedStageStats.size(); i++ )
iGameplaySeconds += m_vPlayedStageStats[i].fAliveSeconds[p];
Profile* pPlayerProfile = PROFILEMAN->GetProfile( (PlayerNumber)p );
pMachineProfile->m_iTotalPlaySeconds += iPlaySeconds;
pMachineProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
if( pPlayerProfile )
pPlayerProfile->m_iTotalPlaySeconds += iPlaySeconds;
if( pPlayerProfile )
pPlayerProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
if( pPlayerProfile )
pPlayerProfile->m_iTotalPlays++;
if( pPlayerProfile )
pPlayerProfile->m_iCurrentCombo =
PREFSMAN->m_bComboContinuesBetweenSongs ?
GAMESTATE->m_CurStageStats.iCurCombo[p] :
0;
}
int iGameplaySeconds = 0;
for( int i=0; i<m_vPlayedStageStats.size(); i++ )
iGameplaySeconds += m_vPlayedStageStats[i].fGameplaySeconds;
pMachineProfile->m_iTotalPlaySeconds += iPlaySeconds;
pMachineProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
pMachineProfile->m_iTotalPlays++;
pMachineProfile->m_iCurrentCombo = 0;
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( !IsHumanPlayer(p) )
continue;
for( int i=0; i<m_vPlayedStageStats.size(); i++ )
{
const StageStats& ss = m_vPlayedStageStats[i];
pMachineProfile->m_iNumSongsPlayedByPlayMode[ss.playMode]++;
pMachineProfile->m_iNumSongsPlayedByStyle[ss.style]++;
pMachineProfile->m_iNumSongsPlayedByDifficulty[ss.pSteps[p]->GetDifficulty()]++;
pMachineProfile->m_iNumSongsPlayedByMeter[ss.iMeter[p]]++;
}
Profile* pPlayerProfile = PROFILEMAN->GetProfile( (PlayerNumber)p );
if( pPlayerProfile )
{
pPlayerProfile->m_iTotalPlaySeconds += iPlaySeconds;
pPlayerProfile->m_iTotalGameplaySeconds += iGameplaySeconds;
pPlayerProfile->m_iTotalPlays++;
pPlayerProfile->m_iCurrentCombo =
PREFSMAN->m_bComboContinuesBetweenSongs ?
GAMESTATE->m_CurStageStats.iCurCombo[p] :
0;
for( int i=0; i<m_vPlayedStageStats.size(); i++ )
{
const StageStats& ss = m_vPlayedStageStats[i];
pPlayerProfile->m_iNumSongsPlayedByPlayMode[ss.playMode]++;
pPlayerProfile->m_iNumSongsPlayedByStyle[ss.style]++;
pPlayerProfile->m_iNumSongsPlayedByDifficulty[ss.pSteps[p]->GetDifficulty()]++;
pPlayerProfile->m_iNumSongsPlayedByMeter[ss.iMeter[p]]++;
}
}
}
BOOKKEEPER->WriteToDisk();
PROFILEMAN->SaveMachineScoresToDisk();
+85 -18
View File
@@ -257,6 +257,16 @@ bool Profile::LoadFromIni( CString sIniPath )
ini.GetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
ini.GetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
ini.GetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
unsigned i;
for( i=0; i<NUM_PLAY_MODES; i++ )
ini.GetValue( "Profile", "NumSongsPlayedByPlayMode"+Capitalize(PlayModeToString((PlayMode)i)), m_iNumSongsPlayedByPlayMode[i] );
for( i=0; i<NUM_STYLES; i++ )
ini.GetValue( "Profile", "NumSongsPlayedByStyle"+Capitalize(GAMEMAN->GetStyleDefForStyle((Style)i)->m_szName), m_iNumSongsPlayedByStyle[i] );
for( i=0; i<NUM_DIFFICULTIES; i++ )
ini.GetValue( "Profile", "NumSongsPlayedByDifficulty"+Capitalize(GAMEMAN->GetStyleDefForStyle((Style)i)->m_szName), m_iNumSongsPlayedByDifficulty[i] );
for( i=0; i<MAX_METER+1; i++ )
ini.GetValue( "Profile", "NumSongsPlayedByMeter"+Capitalize(GAMEMAN->GetStyleDefForStyle((Style)i)->m_szName), m_iNumSongsPlayedByMeter[i] );
return true;
}
@@ -271,6 +281,17 @@ bool Profile::SaveToIni( CString sIniPath )
ini.SetValue( "Profile", "TotalPlaySeconds", m_iTotalPlaySeconds );
ini.SetValue( "Profile", "TotalGameplaySeconds", m_iTotalGameplaySeconds );
ini.SetValue( "Profile", "CurrentCombo", m_iCurrentCombo );
unsigned i;
for( i=0; i<NUM_PLAY_MODES; i++ )
ini.SetValue( "Profile", "NumSongsPlayedByPlayMode"+Capitalize(PlayModeToString((PlayMode)i)), m_iNumSongsPlayedByPlayMode[i] );
for( i=0; i<NUM_STYLES; i++ )
ini.SetValue( "Profile", "NumSongsPlayedByStyle"+Capitalize(GAMEMAN->GetStyleDefForStyle((Style)i)->m_szName), m_iNumSongsPlayedByStyle[i] );
for( i=0; i<NUM_DIFFICULTIES; i++ )
ini.SetValue( "Profile", "NumSongsPlayedByDifficulty"+Capitalize(GAMEMAN->GetStyleDefForStyle((Style)i)->m_szName), m_iNumSongsPlayedByDifficulty[i] );
for( i=0; i<MAX_METER+1; i++ )
ini.SetValue( "Profile", "NumSongsPlayedByMeter"+Capitalize(GAMEMAN->GetStyleDefForStyle((Style)i)->m_szName), m_iNumSongsPlayedByMeter[i] );
ini.WriteFile();
return true;
}
@@ -933,7 +954,7 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
f.PutLine( "<body>" );
}
#define PRINT_SECTION_START(szName) f.Write( ssprintf("<h2><a name='%s'>"szName"</a> <a href='#Table of Contents'>(top)</a></h2>\n", szName) )
#define PRINT_SECTION_START(szName) f.Write( ssprintf("<h2><a name='%s'>"szName"</a> <a href='#top'>(top)</a></h2>\n", szName) )
#define PRINT_SECTION_END f.Write( "\n" )
#define PRINT_DIV_START(szName) f.Write( ssprintf("<div class='section1'>\n" "<h3>%s</h3>\n", szName) )
#define PRINT_DIV_START_ANCHOR(uAnchor,szName) f.Write( ssprintf("<div class='section1'>\n" "<h3><a name='%u'>%s</a></h3>\n", uAnchor, szName) )
@@ -951,33 +972,78 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
// Print table of contents
//
{
f.Write( "<h1><a name='top'>" PRODUCT_NAME_VER "</a></h1>\n" );
PRINT_SECTION_START( "Table of Contents" );
PRINT_DIV_START("Sections");
PRINT_LINK( "My Statistics", "#My Statistics" );
PRINT_DIV_START("Table of Contents");
PRINT_LINK( "Statistics", "#Statistics" );
PRINT_LINK( "Popularity Lists", "#Popularity Lists" );
PRINT_LINK( "Difficulty Table", "#Difficulty Table" );
PRINT_LINK( "Song/Steps List", "#Song/Steps List" );
PRINT_DIV_END;
PRINT_SECTION_END;
}
//
// Print My Statistics
// Print Statistics
//
{
PRINT_SECTION_START( "My Statistics" );
CString sName = pProfile->m_sLastUsedHighScoreName.empty() ?
pProfile->m_sName :
pProfile->m_sLastUsedHighScoreName;
PRINT_DIV_START( sName.c_str() );
PRINT_LINE_S( "LastUsedHighScoreName", pProfile->m_sLastUsedHighScoreName );
PRINT_LINE_B( "UsingProfileDefaultModifiers", pProfile->m_bUsingProfileDefaultModifiers );
PRINT_LINE_S( "DefaultModifiers", pProfile->m_sDefaultModifiers );
PRINT_LINE_I( "TotalPlays", pProfile->m_iTotalPlays );
PRINT_LINE_I( "TotalPlaySeconds", pProfile->m_iTotalPlaySeconds );
PRINT_LINE_I( "TotalGameplaySeconds", pProfile->m_iTotalGameplaySeconds );
PRINT_LINE_I( "CurrentCombo", pProfile->m_iCurrentCombo );
PRINT_DIV_END;
PRINT_SECTION_START( "Statistics" );
// Memory card stats
{
PRINT_DIV_START( "Memory Card" );
PRINT_LINE_S( "Name", pProfile->m_sName );
PRINT_LINE_S( "LastUsedHighScoreName", pProfile->m_sLastUsedHighScoreName );
PRINT_LINE_B( "UsingProfileDefaultModifiers", pProfile->m_bUsingProfileDefaultModifiers );
PRINT_LINE_S( "DefaultModifiers", pProfile->m_sDefaultModifiers );
PRINT_LINE_I( "TotalPlays", pProfile->m_iTotalPlays );
PRINT_LINE_I( "TotalPlaySeconds", pProfile->m_iTotalPlaySeconds );
PRINT_LINE_I( "TotalGameplaySeconds", pProfile->m_iTotalGameplaySeconds );
PRINT_LINE_I( "CurrentCombo", pProfile->m_iCurrentCombo );
PRINT_DIV_END;
}
// Num Songs Played by PlayMode
{
PRINT_DIV_START( "Num Songs Played by PlayMode" );
for( int i=0; i<NUM_PLAY_MODES; i++ )
PRINT_LINE_I( PlayModeToString((PlayMode)i).c_str(), pProfile->m_iNumSongsPlayedByPlayMode[i] );
PRINT_DIV_END;
}
// Num Songs Played by Style
{
PRINT_DIV_START( "Num Songs Played by Style" );
for( int i=0; i<NUM_STYLES; i++ )
{
Style style = (Style)i;
const StyleDef* pStyleDef = GAMEMAN->GetStyleDefForStyle(style);
StepsType st = pStyleDef->m_StepsType;
if( !pStyleDef->m_bUsedForGameplay )
continue; // skip
// only show if this style plays a StepsType that we're showing
if( find(vStepsTypesToShow.begin(),vStepsTypesToShow.end(),st) == vStepsTypesToShow.end() )
continue; // skip
PRINT_LINE_I( pStyleDef->m_szName, pProfile->m_iNumSongsPlayedByStyle[i] );
}
PRINT_DIV_END;
}
// Num Songs Played by Difficulty
{
PRINT_DIV_START( "Num Songs Played by Difficulty" );
for( int i=0; i<NUM_DIFFICULTIES; i++ )
PRINT_LINE_I( DifficultyToString((Difficulty)i).c_str(), pProfile->m_iNumSongsPlayedByDifficulty[i] );
PRINT_DIV_END;
}
// Num Songs Played by Meter
{
PRINT_DIV_START( "Num Songs Played by Meter" );
for( int i=MAX_METER; i>=MIN_METER; i-- )
PRINT_LINE_I( ssprintf("%d",i).c_str(), pProfile->m_iNumSongsPlayedByMeter[i] );
PRINT_DIV_END;
}
PRINT_SECTION_END;
}
@@ -1035,6 +1101,7 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
}
PRINT_DIV_END;
}
PRINT_SECTION_END;
}
+15
View File
@@ -15,6 +15,7 @@
#include "PlayerNumber.h"
#include "GameConstantsAndTypes.h"
#include "Style.h"
struct Profile
{
@@ -29,6 +30,16 @@ struct Profile
m_iTotalPlaySeconds = 0;
m_iTotalGameplaySeconds = 0;
m_iCurrentCombo = 0;
int i;
for( i=0; i<NUM_PLAY_MODES; i++ )
m_iNumSongsPlayedByPlayMode[i] = 0;
for( i=0; i<NUM_STYLES; i++ )
m_iNumSongsPlayedByStyle[i] = 0;
for( i=0; i<NUM_DIFFICULTIES; i++ )
m_iNumSongsPlayedByDifficulty[i] = 0;
for( i=0; i<MAX_METER+1; i++ )
m_iNumSongsPlayedByMeter[i] = 0;
}
bool LoadFromIni( CString sIniPath );
@@ -41,6 +52,10 @@ struct Profile
int m_iTotalPlaySeconds;
int m_iTotalGameplaySeconds;
int m_iCurrentCombo;
int m_iNumSongsPlayedByPlayMode[NUM_PLAY_MODES];
int m_iNumSongsPlayedByStyle[NUM_STYLES];
int m_iNumSongsPlayedByDifficulty[NUM_DIFFICULTIES];
int m_iNumSongsPlayedByMeter[MAX_METER+1];
};
class ProfileManager
+5
View File
@@ -200,6 +200,8 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S
GAMESTATE->m_CurStageStats.pSong = GAMESTATE->m_pCurSong;
else
GAMESTATE->m_CurStageStats.pSong = NULL;
GAMESTATE->m_CurStageStats.playMode = GAMESTATE->m_PlayMode;
GAMESTATE->m_CurStageStats.style = GAMESTATE->m_CurStyle;
for( p=0; p<NUM_PLAYERS; p++ )
{
@@ -1119,6 +1121,9 @@ void ScreenGameplay::Update( float fDeltaTime )
if( GAMESTATE->IsPlayerEnabled(pn) && !GAMESTATE->m_CurStageStats.bFailed[pn])
GAMESTATE->m_CurStageStats.fAliveSeconds [pn] += fDeltaTime * GAMESTATE->m_SongOptions.m_fMusicRate;
// update fGameplaySeconds
GAMESTATE->m_CurStageStats.fGameplaySeconds += fDeltaTime;
//
// Check for end of song
//
+3 -1
View File
@@ -33,12 +33,14 @@ void StageStats::AddStats( const StageStats& other )
{
pSong = NULL; // meaningless
StageType = STAGE_INVALID; // meaningless
memset( fAliveSeconds, 0, sizeof(fAliveSeconds) );
memset( fAliveSeconds, 0, sizeof(fAliveSeconds) ); // why? -Chris
// weight long and marathon songs
ASSERT( other.pSong );
const int iLengthMultiplier = SongManager::GetNumStagesForSong( other.pSong );
fGameplaySeconds += other.fGameplaySeconds;
for( int p=0; p<NUM_PLAYERS; p++ )
{
pSteps[p] = NULL;
+5 -1
View File
@@ -15,6 +15,7 @@
#include "PlayerNumber.h"
#include "GameConstantsAndTypes.h"
#include "Grade.h"
#include "Style.h"
class Song;
class Steps;
@@ -28,11 +29,14 @@ struct StageStats
bool AllFailed() const;
float GetPercentDancePoints( PlayerNumber pn ) const;
PlayMode playMode;
Style style;
Song* pSong;
enum { STAGE_INVALID, STAGE_NORMAL, STAGE_EXTRA, STAGE_EXTRA2 } StageType;
Steps* pSteps[NUM_PLAYERS];
int iMeter[NUM_PLAYERS];
float fAliveSeconds[NUM_PLAYERS]; // how far into the music did they last before failing? Updated by Gameplay.
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.
/* 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,