From 391265497f7acee62308cc53570d172ad1105ad1 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 8 May 2004 03:34:49 +0000 Subject: [PATCH] html cleanup --- stepmania/Themes/default/metrics.ini | 50 +++++---- stepmania/src/ProfileHtml.cpp | 149 +++++++++++++++++++-------- stepmania/src/TimeConstants.cpp | 5 - stepmania/src/TimeConstants.h | 1 - 4 files changed, 136 insertions(+), 69 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 1cb5338f56..a4eabe6382 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -4300,6 +4300,38 @@ LevelP2OnCommand=addy,-140 Title=StepMania Data Footer=generated by StepMania VerificationInstructions= +ShowPlayModeArcade=1 +ShowPlayModeNonstop=1 +ShowPlayModeOni=1 +ShowPlayModeEndless=1 +ShowPlayModeBattle=1 +ShowPlayModeRave=1 +ShowRadarCategoryStream=1 +ShowRadarCategoryVoltage=1 +ShowRadarCategoryAir=1 +ShowRadarCategoryFreeze=1 +ShowRadarCategoryChaos=1 +ShowRadarCategoryTaps=1 +ShowRadarCategoryJumps=1 +ShowRadarCategoryHolds=1 +ShowRadarCategoryMines=1 +ShowRadarCategoryHands=1 +ShowDifficultyBeginner=0 +ShowDifficultyEasy=1 +ShowDifficultyMedium=1 +ShowDifficultyHard=1 +ShowDifficultyChallenge=1 +ShowDifficultyEdit=1 +ShowStyleSingle=1 +ShowStyleVersus=1 +ShowStyleDouble=1 +ShowStyleCouple=1 +ShowStyleCabinet=0 +ShowStepsTypeDance-single=1 +ShowStepsTypeDance-double=1 +ShowStepsTypeDance-couple=1 +ShowStepsTypeDance-solo=1 +ShowStepsTypeLights-cabinet=0 [Grade] Tier01=AAAA @@ -4328,21 +4360,3 @@ Fallback=ScreenWithMenuElements ScrollRandom=1 ScrollRoulette=1 ScrollLeap=1 - -[ProfileHtml] -ShowPlayModeArcade=1 -ShowPlayModeNonstop=1 -ShowPlayModeOni=1 -ShowPlayModeEndless=1 -ShowPlayModeBattle=1 -ShowPlayModeRave=1 -ShowRadarCategoryStream=1 -ShowRadarCategoryVoltage=1 -ShowRadarCategoryAir=1 -ShowRadarCategoryFreeze=1 -ShowRadarCategoryChaos=1 -ShowRadarCategoryTaps=1 -ShowRadarCategoryJumps=1 -ShowRadarCategoryHolds=1 -ShowRadarCategoryMines=1 -ShowRadarCategoryHands=1 diff --git a/stepmania/src/ProfileHtml.cpp b/stepmania/src/ProfileHtml.cpp index 9f2a5384e0..e3f73c1ed9 100644 --- a/stepmania/src/ProfileHtml.cpp +++ b/stepmania/src/ProfileHtml.cpp @@ -36,8 +36,11 @@ const CString STYLE_CSS = "Style.css"; #define TITLE THEME->GetMetric("ProfileHtml","Title") #define FOOTER THEME->GetMetric("ProfileHtml","Footer") #define VERIFICATION_TEXT THEME->GetMetric("ProfileHtml","VerificationText") -#define SHOW_PLAY_MODE(pm) THEME->GetMetric("ProfileHtml","ShowPlayMode"+PlayModeToString(pm)) +#define SHOW_PLAY_MODE(pm) THEME->GetMetricB("ProfileHtml","ShowPlayMode"+PlayModeToString(pm)) #define SHOW_RADAR_CATEGORY(rc) THEME->GetMetricB("ProfileHtml","ShowRadarCategory"+RadarCategoryToString(rc)) +#define SHOW_STYLE(s) THEME->GetMetricB("ProfileHtml","ShowStyle"+Capitalize(GAMEMAN->GetStyleDefForStyle(s)->m_szName)) +#define SHOW_DIFFICULTY(dc) THEME->GetMetricB("ProfileHtml","ShowDifficulty"+DifficultyToString(dc)) +#define SHOW_STEPS_TYPE(st) THEME->GetMetricB("ProfileHtml","ShowStepsType"+Capitalize(GAMEMAN->NotesTypeToString(st))) #define NEWLINE "\r\n" @@ -175,6 +178,12 @@ inline void PrintTable(RageFile &f,Table &table) TranslatedWrite(f, line.sValue ); TranslatedWrite(f,""); } + else + { + TranslatedWrite(f," "); + TranslatedWrite(f," "); + } + TranslatedWrite(f, "\n" ); TranslatedWrite(f,"\n"); @@ -282,17 +291,19 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect PRINT_OPEN(f,"General Info",true); { BEGIN_TABLE(2); - TABLE_LINE2( "DisplayName", pProfile->m_sDisplayName ); + TABLE_LINE2( "DisplayName", pProfile->m_sDisplayName.empty() ? "(empty)" : pProfile->m_sDisplayName ); TABLE_LINE2( "ID", pProfile->m_sGuid ); TABLE_LINE2( "LastUsedHighScoreName", pProfile->m_sLastUsedHighScoreName ); + TABLE_LINE2( "LastPlayedMachineID", pProfile->m_sLastPlayedMachineGuid ); TABLE_LINE2( "UsingProfileDefaultModifiers", pProfile->m_bUsingProfileDefaultModifiers ); - TABLE_LINE2( "DefaultModifiers", pProfile->m_sDefaultModifiers ); + PlayerOptions po; + po.FromString( pProfile->m_sDefaultModifiers ); + TABLE_LINE2( "DefaultModifiers", po.GetThemedString() ); TABLE_LINE2( "TotalPlays", pProfile->m_iTotalPlays ); TABLE_LINE2( "TotalPlay", SecondsToHHMMSS( (float) pProfile->m_iTotalPlaySeconds) ); TABLE_LINE2( "TotalGameplay", SecondsToHHMMSS( (float) pProfile->m_iTotalGameplaySeconds) ); TABLE_LINE2( "CurrentCombo", pProfile->m_iCurrentCombo ); TABLE_LINE2( "TotalCaloriesBurned", pProfile->GetDisplayTotalCaloriesBurned() ); - TABLE_LINE2( "LastPlayedMachineID", pProfile->m_sGuid ); TABLE_LINE2( "TotalTapsAndHolds", pProfile->m_iTotalTapsAndHolds ); TABLE_LINE2( "TotalJumps", pProfile->m_iTotalJumps ); TABLE_LINE2( "TotalHolds", pProfile->m_iTotalHolds ); @@ -320,9 +331,8 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect PRINT_OPEN(f,"Num Songs Played by Style"); { BEGIN_TABLE(4); - for( int i=0; iGetStyleDefForStyle(style); StepsType st = pStyleDef->m_StepsType; if( !pStyleDef->m_bUsedForGameplay ) @@ -330,7 +340,9 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect // only show if this style plays a StepsType that we're showing if( find(vStepsTypesToShow.begin(),vStepsTypesToShow.end(),st) == vStepsTypesToShow.end() ) continue; // skip - TABLE_LINE2( pStyleDef->m_szName, pProfile->m_iNumSongsPlayedByStyle[i] ); + if( !SHOW_STYLE(style) ) + continue; + TABLE_LINE2( pStyleDef->m_szName, pProfile->m_iNumSongsPlayedByStyle[style] ); } END_TABLE; } @@ -341,7 +353,11 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect { BEGIN_TABLE(4); FOREACH_Difficulty( dc ) + { + if( !SHOW_DIFFICULTY(dc) ) + continue; TABLE_LINE2( DifficultyToThemedString(dc), pProfile->m_iNumSongsPlayedByDifficulty[dc] ); + } END_TABLE; } PRINT_CLOSE(f); @@ -643,7 +659,8 @@ bool PrintHighScoresForSong( RageFile &f, const Profile *pProfile, Song* pSong ) vector vpSteps = pSong->GetAllSteps(); - PRINT_OPEN(f, pSong->GetFullDisplayTitle() ); + bool bPrintedOpen = false; + { // // Print Steps list @@ -655,11 +672,16 @@ bool PrintHighScoresForSong( RageFile &f, const Profile *pProfile, Song* pSong ) continue; // skip autogen if( pProfile->GetStepsNumTimesPlayed(pSong,pSteps)==0 ) continue; // skip - const HighScoreList &hsl = pProfile->GetStepsHighScoreList( pSong,pSteps ); if( hsl.vHighScores.empty() ) continue; + if( !bPrintedOpen ) + { + PRINT_OPEN(f, pSong->GetFullDisplayTitle() ); + bPrintedOpen = true; + } + CString s = GAMEMAN->NotesTypeToThemedString(pSteps->m_StepsType) + " - " + @@ -671,9 +693,10 @@ bool PrintHighScoresForSong( RageFile &f, const Profile *pProfile, Song* pSong ) PRINT_CLOSE(f); } } - PRINT_CLOSE(f); + if( bPrintedOpen ) + PRINT_CLOSE(f); - return true; + return bPrintedOpen; } bool PrintHighScoresForCourse( RageFile &f, const Profile *pProfile, Course* pCourse ) @@ -1012,45 +1035,81 @@ void PrintCaloriesBurned( RageFile &f, const Profile *pProfile, CString sTitle, { PRINT_OPEN(f, sTitle ); { - TranslatedWrite(f,"\n"); + PRINT_OPEN(f, "Totals", true); + { + BEGIN_TABLE(1); - // header row - TranslatedWrite(f,""); - TranslatedWrite(f,""); - { - for( int i=0; i"+DayOfWeekToShortString(i)+""); - } - TranslatedWrite(f,""); - TranslatedWrite(f,"\n"); + TABLE_LINE2("All Time", pProfile->GetDisplayTotalCaloriesBurned() ); + TABLE_LINE2("Per Song", ssprintf("%.2f",pProfile->m_fTotalCaloriesBurned/pProfile->GetTotalNumSongsPlayed()) ); + TABLE_LINE2("Per Second of Gameplay", ssprintf("%.2f",pProfile->m_fTotalCaloriesBurned/(float)pProfile->m_iTotalGameplaySeconds) ); - // row for each week - tm when = GetLocalTime(); - when = GetNextSunday( when ); - when = AddDays( when, -DAYS_IN_WEEK ); + END_TABLE; + } + PRINT_CLOSE(f); + + PRINT_OPEN(f, "By Week", false); { - for( int i=0; i"); - TranslatedWrite(f,""); - for( int i=0; iGetCaloriesBurnedForDay( day ); + fWeekCals += fDayCals; + when = AddDays( when, +1 ); + } + + TABLE_LINE2(LastWeekToString(w), Commify((int)fWeekCals) ); + + when = AddDays( when, -DAYS_IN_WEEK*2 ); + } + } + + END_TABLE; + } + PRINT_CLOSE(f); + + PRINT_OPEN(f, "By Day of Week", false); + { + float fCaloriesByDay[DAYS_IN_WEEK]; + ZERO( fCaloriesByDay ); + + // row for each week + tm when = GetLocalTime(); + when = GetNextSunday( when ); + when = AddDays( when, -DAYS_IN_WEEK ); + for( int w=0; wGetCaloriesBurnedForDay( day ); - fWeekCals += fDayCals; - CString sCalories; - if( fDayCals ) - sCalories = Commify( (int)fDayCals ); - TranslatedWrite(f,""); + fCaloriesByDay[d] += fDayCals; when = AddDays( when, +1 ); } - TranslatedWrite(f,""); - TranslatedWrite(f,"\n"); + when = AddDays( when, -DAYS_IN_WEEK*2 ); } + + BEGIN_TABLE(2); + + for( int d=0; d\n"); + PRINT_CLOSE(f); } PRINT_CLOSE(f); } @@ -1121,9 +1180,11 @@ void SaveStatsWebPage( break; } } - - if( bOneSongHasStepsForThisStepsType ) - vStepsTypesToShow.push_back( st ); + if( !bOneSongHasStepsForThisStepsType ) + continue; + if( !SHOW_STEPS_TYPE(st) ) + continue; + vStepsTypesToShow.push_back( st ); } } @@ -1170,7 +1231,6 @@ TITLE.c_str(), STYLE_CSS.c_str() ) ); } CString sName = pProfile->GetDisplayName(); - CString sMachineName = pProfile->m_sGuid; time_t ltime = time( NULL ); CString sTime = ctime( <ime ); @@ -1179,10 +1239,9 @@ TITLE.c_str(), STYLE_CSS.c_str() ) ); { case HTML_TYPE_PLAYER: sNameCell = ssprintf( - "Player Name: %s
\n" - "Last Machine: %s
\n" + "%s
\n" "%s\n", - sName.c_str(), sMachineName.c_str(), sTime.c_str() ); + sName.c_str(), sTime.c_str() ); break; case HTML_TYPE_MACHINE: sNameCell = ssprintf( diff --git a/stepmania/src/TimeConstants.cpp b/stepmania/src/TimeConstants.cpp index fdb7a24733..997a2dabcd 100644 --- a/stepmania/src/TimeConstants.cpp +++ b/stepmania/src/TimeConstants.cpp @@ -58,11 +58,6 @@ CString DayOfWeekToString( int iDayOfWeekIndex ) return DAY_OF_WEEK_TO_NAME[iDayOfWeekIndex]; } -CString DayOfWeekToShortString( int iDayOfWeekIndex ) -{ - return DayOfWeekToString(iDayOfWeekIndex).Left(3); -} - CString HourInDayToString( int iHourInDayIndex ) { return ssprintf("%02d:00", iHourInDayIndex); diff --git a/stepmania/src/TimeConstants.h b/stepmania/src/TimeConstants.h index 73629641c9..99f17bbb60 100644 --- a/stepmania/src/TimeConstants.h +++ b/stepmania/src/TimeConstants.h @@ -24,7 +24,6 @@ const int MONTHS_IN_YEAR = 12; CString DayInYearToString( int iDayInYearIndex ); CString LastDayToString( int iLastDayIndex ); CString DayOfWeekToString( int iDayOfWeekIndex ); -CString DayOfWeekToShortString( int iDayOfWeekIndex ); CString HourInDayToString( int iHourIndex ); CString MonthToString( int iMonthIndex ); CString LastWeekToString( int iLastWeekIndex );
Total
"+LastWeekToString(i)+""+sCalories+""+Commify((int)fWeekCals)+"