diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index b161425c86..6b63c2f3bd 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -2466,6 +2466,16 @@ CString GameManager::NotesTypeToThemedString( StepsType nt ) return s; } +CString GameManager::StyleToThemedString( Style style ) +{ + CString s = GetStyleDefForStyle(style)->m_szName; + s = Capitalize( s ); + if( THEME->HasMetric( "Style", s ) ) + return THEME->GetMetric( "Style", s ); + else + return s; +} + Game GameManager::StringToGameType( CString sGameType ) { for( int i=0; i& aStylesAddTo, bool editor=false ); void GetNotesTypesForGame( Game game, vector& aNotesTypeAddTo ); @@ -40,6 +40,7 @@ public: static CString NotesTypeToThemedString( StepsType nt ); static Game StringToGameType( CString sGameType ); Style GameAndStringToStyle( Game game, CString sStyle ); + static CString StyleToThemedString( Style s ); protected: }; diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index c72c71b59a..dfdbd16bcf 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -30,6 +30,7 @@ #include "RageFileManager.h" #include "ScoreKeeperMAX2.h" #include "crypto/CryptRand.h" +#include "UnlockSystem.h" // // Old file versions for backward compatibility @@ -201,7 +202,7 @@ int Profile::GetTotalNumSongsPassed() const return iTotal; } -int Profile::GetTotalPossibleDancePointsForStepsType( StepsType st ) const +int Profile::GetPossibleSongDancePointsForStepsType( StepsType st ) const { int iTotal = 0; @@ -214,6 +215,8 @@ int Profile::GetTotalPossibleDancePointsForStepsType( StepsType st ) const if( pSong->m_SelectionDisplay == Song::SHOW_NEVER ) continue; // skip + if( UNLOCKMAN->SongIsLocked(pSong) ) + continue; vector vSteps = pSong->GetAllSteps(); for( unsigned j=0; j vCourses; @@ -255,7 +265,7 @@ int Profile::GetTotalPossibleDancePointsForStepsType( StepsType st ) const return iTotal; } -int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const +int Profile::GetActualSongDancePointsForStepsType( StepsType st ) const { int iTotal = 0; @@ -303,6 +313,13 @@ int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const } } + return iTotal; +} + +int Profile::GetActualCourseDancePointsForStepsType( StepsType st ) const +{ + int iTotal = 0; + // add course high scores { for( std::map::const_iterator i = m_CourseHighScores.begin(); @@ -335,6 +352,18 @@ int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const return iTotal; } +float Profile::GetPercentCompleteForStepsType( StepsType st ) const +{ + float fPossible = + GetPossibleSongDancePointsForStepsType( st ) + + GetPossibleCourseDancePointsForStepsType( st ); + float fActual = + GetActualSongDancePointsForStepsType( st ) + + GetActualCourseDancePointsForStepsType( st ); + + return fActual / fPossible; +} + CString Profile::GetProfileDisplayNameFromDir( CString sDir ) { Profile profile; diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index e6c6fece42..353dc847ee 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -72,8 +72,11 @@ public: CString GetDisplayTotalCaloriesBurned() const; int GetTotalNumSongsPlayed() const; int GetTotalNumSongsPassed() const; - int GetTotalHighScoreDancePointsForStepsType( StepsType st ) const; - int GetTotalPossibleDancePointsForStepsType( StepsType st ) const; + int GetActualSongDancePointsForStepsType( StepsType st ) const; + int GetActualCourseDancePointsForStepsType( StepsType st ) const; + int GetPossibleSongDancePointsForStepsType( StepsType st ) const; + int GetPossibleCourseDancePointsForStepsType( StepsType st ) const; + float GetPercentCompleteForStepsType( 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/ProfileHtml.cpp b/stepmania/src/ProfileHtml.cpp index 563d0e30d2..c1971ed68e 100644 --- a/stepmania/src/ProfileHtml.cpp +++ b/stepmania/src/ProfileHtml.cpp @@ -345,7 +345,8 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect continue; // skip if( !SHOW_STYLE(style) ) continue; - TABLE_LINE2( pStyleDef->m_szName, pProfile->m_iNumSongsPlayedByStyle[style] ); + CString s = GAMEMAN->StyleToThemedString(style); + TABLE_LINE2( s, pProfile->m_iNumSongsPlayedByStyle[style] ); } END_TABLE; } @@ -651,9 +652,9 @@ void PrintHighScoreListTable( RageFile &f, const HighScoreList& hsl ) if( SHOW_HIGH_SCORE_GRADE ) asTokens.push_back( GradeToThemedString(hs.grade) ); if( SHOW_HIGH_SCORE_SCORE ) - asTokens.push_back( ssprintf("%i, %.2f%%", hs.iScore) ); + asTokens.push_back( ssprintf("%i", hs.iScore) ); if( SHOW_HIGH_SCORE_PERCENT ) - asTokens.push_back( ssprintf("%.2f%%", hs.fPercentDP*100) ); + asTokens.push_back( ssprintf("%05.2f%%", hs.fPercentDP*100) ); TABLE_LINE2( sName, join(", ",asTokens) ); } @@ -750,72 +751,148 @@ void PrintCourseHighScores( RageFile &f, const Profile *pProfile, CString sTitle PrintCourses( f, pProfile, sTitle, PrintHighScoresForCourse ); } -bool PrintGradeTableForStepsType( RageFile &f, const Profile *pProfile, StepsType st ) +bool PrintPercentCompleteForStepsType( RageFile &f, const Profile *pProfile, StepsType st ) { unsigned i; const vector &vpSongs = SONGMAN->GetAllSongs(); + vector vpCourses; + SONGMAN->GetAllCourses( vpCourses, true ); - PRINT_OPEN(f, GAMEMAN->NotesTypeToThemedString(st).c_str() ); + PRINT_OPEN(f, GAMEMAN->NotesTypeToThemedString(st) ); { - TranslatedWrite(f, "\n" ); - - // table header row - TranslatedWrite(f, "" ); - FOREACH_Difficulty( dc ) + BEGIN_TABLE(1); + TABLE_LINE2( "Percent Complete", ssprintf("%06.3f%%",pProfile->GetPercentCompleteForStepsType(st)*100) ); + TABLE_LINE2( "Actual Song Points", pProfile->GetActualSongDancePointsForStepsType(st) ); + TABLE_LINE2( "Actual Course Points", pProfile->GetActualCourseDancePointsForStepsType(st) ); + TABLE_LINE2( "Possible Song Points", pProfile->GetPossibleSongDancePointsForStepsType(st) ); + TABLE_LINE2( "Possible Course Points", pProfile->GetPossibleCourseDancePointsForStepsType(st) ); + // FIXME + END_TABLE; + + PRINT_OPEN(f, "Songs" ); { - if( dc == DIFFICULTY_EDIT ) - continue; // skip - TranslatedWrite(f, ssprintf("", Capitalize(DifficultyToThemedString(dc)).c_str()) ); - } - TranslatedWrite(f, "\n" ); - - // table body rows - for( i=0; i" ); - - TranslatedWrite(f, "" ); + TranslatedWrite(f, "
 %s
" ); - TranslatedWrite(f, ssprintf("

%s

", pSong->GetDisplayMainTitle().c_str()) ); - TranslatedWrite(f, ssprintf("

%s

", pSong->GetDisplaySubTitle().c_str()) ); - TranslatedWrite(f, "
\n" ); + // table header row + TranslatedWrite(f, "" ); FOREACH_Difficulty( dc ) { if( dc == DIFFICULTY_EDIT ) continue; // skip + if( !SHOW_DIFFICULTY(dc) ) + continue; + TranslatedWrite(f, ssprintf("", DifficultyToThemedString(dc).c_str()) ); + } + TranslatedWrite(f, "\n" ); - Steps* pSteps = pSong->GetStepsByDifficulty( st, dc, false ); - if( pSteps && !pSteps->IsAutogen() ) + // table body rows + for( i=0; im_SelectionDisplay == Song::SHOW_NEVER ) + continue; // skip + + TranslatedWrite(f, "" ); + + TranslatedWrite(f, "" ); + + FOREACH_Difficulty( dc ) { - TranslatedWrite(f,""); - } - else - { - TranslatedWrite(f, "" ); + if( dc == DIFFICULTY_EDIT ) + continue; // skip + if( !SHOW_DIFFICULTY(dc) ) + continue; + Steps* pSteps = pSong->GetStepsByDifficulty( st, dc, false ); + if( pSteps && !pSteps->IsAutogen() ) + { + TranslatedWrite(f,""); + } + else + { + TranslatedWrite(f, "" ); + } } + + TranslatedWrite(f, "\n" ); } - TranslatedWrite(f, "\n" ); + TranslatedWrite(f, "
 %s
" ); + TranslatedWrite(f, ssprintf("

%s

", pSong->GetDisplayMainTitle().c_str()) ); + TranslatedWrite(f, ssprintf("

%s

", pSong->GetDisplaySubTitle().c_str()) ); + TranslatedWrite(f, "
"); - TranslatedWrite(f, ssprintf("%d",pSteps->GetMeter()) ); - HighScore hs = pProfile->GetStepsHighScoreList( pSong,pSteps ).GetTopScore(); - Grade grade = hs.grade; - if( grade != GRADE_NO_DATA ) - TranslatedWrite(f, ssprintf("%s",GradeToThemedString(grade).c_str()) ); - TranslatedWrite(f," "); + TranslatedWrite(f, ssprintf("(%d)",pSteps->GetMeter()) ); + HighScore hs = pProfile->GetStepsHighScoreList( pSong,pSteps ).GetTopScore(); + Grade grade = hs.grade; + if( grade != GRADE_NO_DATA ) + { + TranslatedWrite(f, ssprintf(" %s %05.2f%%",GradeToThemedString(grade).c_str(), hs.fPercentDP*100) ); + } + TranslatedWrite(f," 
\n" ); } + PRINT_CLOSE(f); + + PRINT_OPEN(f, "Courses" ); + { + TranslatedWrite(f, "\n" ); - TranslatedWrite(f, "
\n" ); + // table header row + TranslatedWrite(f, " " ); + FOREACH_CourseDifficulty( cd ) + { + TranslatedWrite(f, ssprintf("%s", CourseDifficultyToThemedString(cd).c_str()) ); + } + TranslatedWrite(f, "\n" ); + + // table body rows + for( i=0; iAllSongsAreFixed() ) + continue; + + TranslatedWrite(f, "" ); + + TranslatedWrite(f, "" ); + TranslatedWrite(f, ssprintf("

%s

", pCourse->m_sName.c_str()) ); + TranslatedWrite(f, "" ); + + FOREACH_CourseDifficulty( cd ) + { + if( pCourse->HasCourseDifficulty(st,cd) ) + { + TranslatedWrite(f,""); + TranslatedWrite(f, ssprintf("(%d)",pCourse->GetMeter(cd)) ); + HighScore hs = pProfile->GetCourseHighScoreList(pCourse, st, cd).GetTopScore(); + Grade grade = hs.grade; + if( grade != GRADE_NO_DATA ) + { + TranslatedWrite(f, ssprintf(" %s %05.2f%%",GradeToThemedString(grade).c_str(), hs.fPercentDP*100) ); + } + TranslatedWrite(f,""); + } + else + { + TranslatedWrite(f, " " ); + } + } + + TranslatedWrite(f, "\n" ); + } + + TranslatedWrite(f, "\n" ); + } + PRINT_CLOSE(f); } PRINT_CLOSE(f); return true; } -void PrintGradeTable( RageFile &f, const Profile *pProfile, CString sTitle, vector &vpSongs, vector &vpAllSteps, vector &vStepsTypesToShow, map mapStepsToSong, vector vpCourses ) +void PrintPercentComplete( RageFile &f, const Profile *pProfile, CString sTitle, vector &vpSongs, vector &vpAllSteps, vector &vStepsTypesToShow, map mapStepsToSong, vector vpCourses ) { - PrintStepsTypes( f, pProfile, sTitle, vStepsTypesToShow, PrintGradeTableForStepsType ); + PrintStepsTypes( f, pProfile, sTitle, vStepsTypesToShow, PrintPercentCompleteForStepsType ); } bool PrintInventoryForSong( RageFile &f, const Profile *pProfile, Song* pSong ) @@ -833,7 +910,7 @@ bool PrintInventoryForSong( RageFile &f, const Profile *pProfile, Song* pSong ) sThemedRadarCategory[rc] = RadarCategoryToThemedString(rc); } - PRINT_OPEN(f, pSong->GetFullDisplayTitle().c_str() ); + PRINT_OPEN(f, pSong->GetFullDisplayTitle() ); { BEGIN_TABLE(2); TABLE_LINE2( "Artist", pSong->GetDisplayArtist() ); @@ -877,7 +954,7 @@ bool PrintInventoryForSong( RageFile &f, const Profile *pProfile, Song* pSong ) const CString &sCat = sThemedRadarCategory[cat]; float fVal = pSteps->GetRadarValues()[cat]; - CString sVal = ssprintf( "%.2f", fVal ); + CString sVal = ssprintf( "%05.2f", fVal ); TABLE_LINE2( sCat, sVal ); } END_TABLE; @@ -1278,7 +1355,7 @@ TITLE.c_str(), STYLE_CSS.c_str() ) ); PrintCourseHighScores( f, pProfile, "My Course High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); PrintScreenshots( f, pProfile, "My Screenshots", sDir ); PrintCaloriesBurned( f, pProfile, "My Calories Burned", sDir ); - PrintGradeTable( f, pProfile, "My Grade Table", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); + PrintPercentComplete( f, pProfile, "My Percent Complete", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); PrintPopularity( f, pProfile, "Last Machine Popularity", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); PrintSongHighScores( f, pProfile, "Last Machine Song High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); PrintCourseHighScores( f, pProfile, "Last Machine Course High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); @@ -1290,7 +1367,7 @@ TITLE.c_str(), STYLE_CSS.c_str() ) ); PrintCourseHighScores( f, pProfile, "Course High Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); PrintScreenshots( f, pProfile, "Screenshots", sDir ); PrintCaloriesBurned( f, pProfile, "Calories Burned", sDir ); - PrintGradeTable( f, pProfile, "Grade Table", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); + PrintPercentComplete( f, pProfile, "Percent Complete", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); PrintInventoryList( f, pProfile, "Song Information", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); PrintBookkeeping( f, pProfile, "Bookkeeping", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses ); break; diff --git a/stepmania/src/ScreenEnding.cpp b/stepmania/src/ScreenEnding.cpp index 95b9e6976a..19fd20cc6e 100644 --- a/stepmania/src/ScreenEnding.cpp +++ b/stepmania/src/ScreenEnding.cpp @@ -54,11 +54,7 @@ CString GetStatsLineValue( PlayerNumber pn, int iLine ) StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; switch( iLine ) { - case PERCENT_COMPLETE: - { - double fPercent = 100.0 * pProfile->GetTotalHighScoreDancePointsForStepsType(st) / (double)pProfile->GetTotalPossibleDancePointsForStepsType(st); - return ssprintf( "%02.3f%%", fPercent ); - } + case PERCENT_COMPLETE: return ssprintf( "%06.3f%%", pProfile->GetPercentCompleteForStepsType(st)*100 ); case TOTAL_CALORIES: return pProfile->GetDisplayTotalCaloriesBurned(); case TOTAL_SONGS_PLAYED: return Commify( pProfile->GetTotalNumSongsPlayed() ); case CURRENT_COMBO: return Commify( pProfile->m_iCurrentCombo );