diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index aaca336e5d..c72c71b59a 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -201,6 +201,60 @@ int Profile::GetTotalNumSongsPassed() const return iTotal; } +int Profile::GetTotalPossibleDancePointsForStepsType( StepsType st ) const +{ + int iTotal = 0; + + // add steps high scores + { + const vector vSongs = SONGMAN->GetAllSongs(); + for( unsigned i=0; im_SelectionDisplay == Song::SHOW_NEVER ) + continue; // skip + + vector vSteps = pSong->GetAllSteps(); + for( unsigned j=0; jm_StepsType != st ) + continue; // skip + + const RadarValues& fRadars = pSteps->GetRadarValues(); + iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); + } + } + } + + // add course high scores + { + vector vCourses; + SONGMAN->GetAllCourses( vCourses, false ); + for( unsigned i=0; iAllSongsAreFixed() ) + continue; + + FOREACH_CourseDifficulty( cd ) + { + if( !pCourse->HasCourseDifficulty(st,cd) ) + continue; + + const RadarValues& fRadars = pCourse->GetRadarValues(st,cd); + iTotal += ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); + } + } + } + + return iTotal; +} + int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const { int iTotal = 0; @@ -214,6 +268,9 @@ int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const SongID id = i->first; Song* pSong = id.ToSong(); + if( pSong->m_SelectionDisplay == Song::SHOW_NEVER ) + continue; // skip + // If the Song isn't loaded on the current machine, then we can't // get radar values to compute dance points. if( pSong == NULL ) @@ -233,14 +290,15 @@ int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const if( pSteps == NULL ) continue; + if( pSteps->m_StepsType != st ) + continue; + const HighScoresForASteps& h = j->second; const HighScoreList& hs = h.hs; - if( pSteps->m_StepsType == st ) - { - const RadarValues& fRadars = pSteps->GetRadarValues(); - int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); - iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP ); - } + + const RadarValues& fRadars = pSteps->GetRadarValues(); + int iPossibleDP = ScoreKeeperMAX2::GetPossibleDancePoints( fRadars ); + iTotal += (int)truncf( hs.GetTopScore().fPercentDP * iPossibleDP ); } } } @@ -274,7 +332,6 @@ int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const } } - return iTotal; } diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index ab99ed6884..e6c6fece42 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -73,6 +73,7 @@ public: int GetTotalNumSongsPlayed() const; int GetTotalNumSongsPassed() const; int GetTotalHighScoreDancePointsForStepsType( StepsType st ) const; + int GetTotalPossibleDancePointsForStepsType( StepsType st ) const; static CString GetProfileDisplayNameFromDir( CString sDir ); int GetSongNumTimesPlayed( const Song* pSong ) const; int GetSongNumTimesPlayed( const SongID& songID ) const; diff --git a/stepmania/src/ScreenEnding.cpp b/stepmania/src/ScreenEnding.cpp index 9547353545..19a3966ca6 100644 --- a/stepmania/src/ScreenEnding.cpp +++ b/stepmania/src/ScreenEnding.cpp @@ -37,7 +37,7 @@ CString GetStatsLineTitle( PlayerNumber pn, int iLine ) { static const CString s[NUM_ENDING_STATS_LINES] = { - "Total %s Points", + "%s Percent Complete", "Total Calories", "Total Songs Played", "Current Combo", @@ -54,10 +54,14 @@ CString GetStatsLineValue( PlayerNumber pn, int iLine ) StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; switch( iLine ) { - case 0: return Commify( pProfile->GetTotalHighScoreDancePointsForStepsType(st) ); - case 1: return pProfile->GetDisplayTotalCaloriesBurned(); - case 2: return Commify( pProfile->GetTotalNumSongsPlayed() ); - case 3: return Commify( pProfile->m_iCurrentCombo ); + case PERCENT_COMPLETE: + { + double fPercent = 100.0 * pProfile->GetTotalHighScoreDancePointsForStepsType(st) / (double)pProfile->GetTotalPossibleDancePointsForStepsType(st); + return ssprintf( "%02.4f%%", fPercent ); + } + case TOTAL_CALORIES: return pProfile->GetDisplayTotalCaloriesBurned(); + case TOTAL_SONGS_PLAYED: return Commify( pProfile->GetTotalNumSongsPlayed() ); + case CURRENT_COMBO: return Commify( pProfile->m_iCurrentCombo ); default: ASSERT(0); return ""; } } @@ -69,14 +73,14 @@ ScreenEnding::ScreenEnding( CString sClassName ) : ScreenAttract( sClassName, fa SONGMAN->GetSongs( arraySongs ); SongUtil::SortSongPointerArrayByTitle( arraySongs ); - for( int p=0; pIsHumanPlayer(p) ) continue; // skip - Profile* pProfile = PROFILEMAN->GetProfile( (PlayerNumber)p ); + Profile* pProfile = PROFILEMAN->GetProfile( p ); m_textPlayerName[p].LoadFromFont( THEME->GetPathToF("ScreenEnding player name") ); m_textPlayerName[p].SetText( pProfile ? pProfile->GetDisplayName() : "NO CARD" ); diff --git a/stepmania/src/ScreenEnding.h b/stepmania/src/ScreenEnding.h index 7a1324f577..9b66343f3b 100644 --- a/stepmania/src/ScreenEnding.h +++ b/stepmania/src/ScreenEnding.h @@ -13,6 +13,15 @@ #include "BitmapText.h" #include "ScreenAttract.h" +enum EndingStatsLine +{ + PERCENT_COMPLETE, + TOTAL_CALORIES, + TOTAL_SONGS_PLAYED, + CURRENT_COMBO, + NUM_ENDING_STATS_LINES +}; + class ScreenEnding : public ScreenAttract { public: @@ -24,7 +33,6 @@ public: private: BitmapText m_textPlayerName[NUM_PLAYERS]; -#define NUM_ENDING_STATS_LINES 4 BitmapText m_textStatsTitle[NUM_PLAYERS][NUM_ENDING_STATS_LINES]; BitmapText m_textStatsValue[NUM_PLAYERS][NUM_ENDING_STATS_LINES];