add ScreenEnding to show stats

add weight/calories to Profile
This commit is contained in:
Chris Danford
2004-01-07 02:56:47 +00:00
parent 764214cf16
commit 5580eccda5
6 changed files with 45 additions and 11 deletions
+30 -4
View File
@@ -43,8 +43,8 @@ ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our
#define COURSE_SCORES_FILE "CourseScores.dat"
#define STATS_HTML_FILE "stats.html"
#define STYLE_CSS_FILE "style.css"
#define NEW_MEM_CARD_NAME "NewCard"
#define NEW_PROFILE_NAME "NewProfile"
#define NEW_MEM_CARD_NAME ""
#define NEW_PROFILE_NAME ""
#define SM_300_STATISTICS_FILE "statistics.ini"
@@ -64,6 +64,34 @@ static const char *MEM_CARD_DIR[NUM_PLAYERS] =
"@mc2/",
};
CString Profile::GetDisplayName()
{
if( !m_sName.empty() )
return m_sName;
else if( !m_sLastUsedHighScoreName.empty() )
return m_sLastUsedHighScoreName;
else
return "NO NAME";
}
CString Profile::GetDisplayCaloriesBurned()
{
if( m_fWeightPounds == 0 ) // weight not entered
return "N/A";
else
return ssprintf("%f.3Cal",m_fCaloriesBurned);
}
int Profile::GetTotalNumSongsPlayed()
{
int iTotal = 0;
for( int i=0; i<NUM_PLAY_MODES; i++ )
iTotal += m_iNumSongsPlayedByPlayMode[i];
return iTotal;
}
ProfileManager::ProfileManager()
{
for( int p=0; p<NUM_PLAYERS; p++ )
@@ -129,8 +157,6 @@ bool ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIs
bool ProfileManager::CreateProfile( CString sProfileDir, CString sName )
{
ASSERT( !sName.empty() );
bool bResult;
Profile pro;
+8
View File
@@ -30,6 +30,8 @@ struct Profile
m_iTotalPlaySeconds = 0;
m_iTotalGameplaySeconds = 0;
m_iCurrentCombo = 0;
m_fWeightPounds = 0;
m_fCaloriesBurned = 0;
int i;
for( i=0; i<NUM_PLAY_MODES; i++ )
@@ -42,6 +44,10 @@ struct Profile
m_iNumSongsPlayedByMeter[i] = 0;
}
CString GetDisplayName();
CString GetDisplayCaloriesBurned();
int GetTotalNumSongsPlayed();
bool LoadFromIni( CString sIniPath );
bool SaveToIni( CString sIniPath );
CString m_sName;
@@ -52,6 +58,8 @@ struct Profile
int m_iTotalPlaySeconds;
int m_iTotalGameplaySeconds;
int m_iCurrentCombo;
float m_fWeightPounds;
int m_fCaloriesBurned;
int m_iNumSongsPlayedByPlayMode[NUM_PLAY_MODES];
int m_iNumSongsPlayedByStyle[NUM_STYLES];
int m_iNumSongsPlayedByDifficulty[NUM_DIFFICULTIES];
+2
View File
@@ -291,6 +291,7 @@ void Screen::ClearMessageQueue( const ScreenMessage SM )
#include "ScreenTestInput.h"
#include "ScreenBookkeeping.h"
#include "ScreenBranch.h"
#include "ScreenEnding.h"
Screen* Screen::Create( CString sClassName )
{
@@ -395,6 +396,7 @@ Screen* Screen::Create( CString sClassName )
IF_RETURN( ScreenTestInput );
IF_RETURN( ScreenBookkeeping );
IF_RETURN( ScreenBranch );
IF_RETURN( ScreenEnding );
RageException::Throw( "Invalid Screen class name '%s'", sClassName.c_str() );
}
+3 -2
View File
@@ -30,7 +30,7 @@
#define INITIAL_SCREEN THEME->GetMetric("Common","InitialScreen")
ScreenAttract::ScreenAttract( CString sClassName ) : Screen( sClassName )
ScreenAttract::ScreenAttract( CString sClassName, bool bResetGameState ) : Screen( sClassName )
{
LOG->Trace( "ScreenAttract::ScreenAttract(%s)", sClassName.c_str() );
@@ -38,7 +38,8 @@ ScreenAttract::ScreenAttract( CString sClassName ) : Screen( sClassName )
if( sClassName == INITIAL_SCREEN )
GAMESTATE->m_iNumTimesThroughAttract++;
GAMESTATE->Reset();
if( bResetGameState )
GAMESTATE->Reset();
// We have to do initialization in the first update because this->GetElementName() won't
// work until the object has been fully constructed.
+1 -1
View File
@@ -21,7 +21,7 @@
class ScreenAttract : public Screen
{
public:
ScreenAttract( CString sClassName );
ScreenAttract( CString sClassName, bool bResetGameState=true );
virtual ~ScreenAttract();
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
+1 -4
View File
@@ -176,10 +176,7 @@ void ScreenSystemLayer::RefreshCreditsMessages()
Profile* pProfile = PROFILEMAN->GetProfile( (PlayerNumber)p );
if( pProfile )
{
if( !pProfile->m_sLastUsedHighScoreName.empty() )
sCredits = pProfile->m_sLastUsedHighScoreName;
else
sCredits = pProfile->m_sName;
sCredits = pProfile->GetDisplayName();
}
else
{