HTML: Difficulty Table -> Percent Complete

This commit is contained in:
Chris Danford
2004-05-08 08:09:18 +00:00
parent cbc1ecd495
commit 4eec17d42e
6 changed files with 174 additions and 58 deletions
+10
View File
@@ -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<NUM_GAMES; i++ )
+2 -1
View File
@@ -25,7 +25,7 @@ public:
~GameManager();
GameDef* GetGameDefForGame( Game g );
const StyleDef* GetStyleDefForStyle( Style s );
static const StyleDef* GetStyleDefForStyle( Style s );
void GetStylesForGame( Game game, vector<Style>& aStylesAddTo, bool editor=false );
void GetNotesTypesForGame( Game game, vector<StepsType>& 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:
};
+31 -2
View File
@@ -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<Steps*> vSteps = pSong->GetAllSteps();
for( unsigned j=0; j<vSteps.size(); j++ )
@@ -229,6 +232,13 @@ int Profile::GetTotalPossibleDancePointsForStepsType( StepsType st ) const
}
}
return iTotal;
}
int Profile::GetPossibleCourseDancePointsForStepsType( StepsType st ) const
{
int iTotal = 0;
// add course high scores
{
vector<Course*> 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<CourseID,HighScoresForACourse>::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;
+5 -2
View File
@@ -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;
+125 -48
View File
@@ -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<Song*> &vpSongs = SONGMAN->GetAllSongs();
vector<Course*> vpCourses;
SONGMAN->GetAllCourses( vpCourses, true );
PRINT_OPEN(f, GAMEMAN->NotesTypeToThemedString(st).c_str() );
PRINT_OPEN(f, GAMEMAN->NotesTypeToThemedString(st) );
{
TranslatedWrite(f, "<table class='difficulty'>\n" );
// table header row
TranslatedWrite(f, "<tr><td>&nbsp;</td>" );
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("<td>%s</td>", Capitalize(DifficultyToThemedString(dc)).c_str()) );
}
TranslatedWrite(f, "</tr>\n" );
// table body rows
for( i=0; i<vpSongs.size(); i++ )
{
Song* pSong = vpSongs[i];
TranslatedWrite(f, "<tr>" );
TranslatedWrite(f, "<td>" );
TranslatedWrite(f, ssprintf("<p class='songtitle'>%s</p>", pSong->GetDisplayMainTitle().c_str()) );
TranslatedWrite(f, ssprintf("<p class='songsubtitle'>%s</p>", pSong->GetDisplaySubTitle().c_str()) );
TranslatedWrite(f, "</td>" );
TranslatedWrite(f, "<table class='difficulty'>\n" );
// table header row
TranslatedWrite(f, "<tr><td>&nbsp;</td>" );
FOREACH_Difficulty( dc )
{
if( dc == DIFFICULTY_EDIT )
continue; // skip
if( !SHOW_DIFFICULTY(dc) )
continue;
TranslatedWrite(f, ssprintf("<td>%s</td>", DifficultyToThemedString(dc).c_str()) );
}
TranslatedWrite(f, "</tr>\n" );
Steps* pSteps = pSong->GetStepsByDifficulty( st, dc, false );
if( pSteps && !pSteps->IsAutogen() )
// table body rows
for( i=0; i<vpSongs.size(); i++ )
{
Song* pSong = vpSongs[i];
if( pSong->m_SelectionDisplay == Song::SHOW_NEVER )
continue; // skip
TranslatedWrite(f, "<tr>" );
TranslatedWrite(f, "<td>" );
TranslatedWrite(f, ssprintf("<p class='songtitle'>%s</p>", pSong->GetDisplayMainTitle().c_str()) );
TranslatedWrite(f, ssprintf("<p class='songsubtitle'>%s</p>", pSong->GetDisplaySubTitle().c_str()) );
TranslatedWrite(f, "</td>" );
FOREACH_Difficulty( dc )
{
TranslatedWrite(f,"<td>");
TranslatedWrite(f, ssprintf("<font class='meter'>%d</font>",pSteps->GetMeter()) );
HighScore hs = pProfile->GetStepsHighScoreList( pSong,pSteps ).GetTopScore();
Grade grade = hs.grade;
if( grade != GRADE_NO_DATA )
TranslatedWrite(f, ssprintf("<font class='grade'>%s</font>",GradeToThemedString(grade).c_str()) );
TranslatedWrite(f,"</td>");
}
else
{
TranslatedWrite(f, "<td>&nbsp;</td>" );
if( dc == DIFFICULTY_EDIT )
continue; // skip
if( !SHOW_DIFFICULTY(dc) )
continue;
Steps* pSteps = pSong->GetStepsByDifficulty( st, dc, false );
if( pSteps && !pSteps->IsAutogen() )
{
TranslatedWrite(f,"<td>");
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("&nbsp;%s %05.2f%%",GradeToThemedString(grade).c_str(), hs.fPercentDP*100) );
}
TranslatedWrite(f,"</td>");
}
else
{
TranslatedWrite(f, "<td>&nbsp;</td>" );
}
}
TranslatedWrite(f, "</tr>\n" );
}
TranslatedWrite(f, "</tr>\n" );
TranslatedWrite(f, "</table>\n" );
}
PRINT_CLOSE(f);
PRINT_OPEN(f, "Courses" );
{
TranslatedWrite(f, "<table class='difficulty'>\n" );
TranslatedWrite(f, "</table>\n" );
// table header row
TranslatedWrite(f, "<tr><td>&nbsp;</td>" );
FOREACH_CourseDifficulty( cd )
{
TranslatedWrite(f, ssprintf("<td>%s</td>", CourseDifficultyToThemedString(cd).c_str()) );
}
TranslatedWrite(f, "</tr>\n" );
// table body rows
for( i=0; i<vpCourses.size(); i++ )
{
Course* pCourse = vpCourses[i];
if( !pCourse->AllSongsAreFixed() )
continue;
TranslatedWrite(f, "<tr>" );
TranslatedWrite(f, "<td>" );
TranslatedWrite(f, ssprintf("<p class='songtitle'>%s</p>", pCourse->m_sName.c_str()) );
TranslatedWrite(f, "</td>" );
FOREACH_CourseDifficulty( cd )
{
if( pCourse->HasCourseDifficulty(st,cd) )
{
TranslatedWrite(f,"<td>");
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("&nbsp;%s %05.2f%%",GradeToThemedString(grade).c_str(), hs.fPercentDP*100) );
}
TranslatedWrite(f,"</td>");
}
else
{
TranslatedWrite(f, "<td>&nbsp;</td>" );
}
}
TranslatedWrite(f, "</tr>\n" );
}
TranslatedWrite(f, "</table>\n" );
}
PRINT_CLOSE(f);
}
PRINT_CLOSE(f);
return true;
}
void PrintGradeTable( RageFile &f, const Profile *pProfile, CString sTitle, vector<Song*> &vpSongs, vector<Steps*> &vpAllSteps, vector<StepsType> &vStepsTypesToShow, map<Steps*,Song*> mapStepsToSong, vector<Course*> vpCourses )
void PrintPercentComplete( RageFile &f, const Profile *pProfile, CString sTitle, vector<Song*> &vpSongs, vector<Steps*> &vpAllSteps, vector<StepsType> &vStepsTypesToShow, map<Steps*,Song*> mapStepsToSong, vector<Course*> 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;
+1 -5
View File
@@ -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 );