diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 20ab31bf89..788e57dfcd 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -4536,18 +4536,10 @@ ShowStyleDouble=1 ShowStyleCouple=1 ShowStyleSolo=1 ShowStyleReal=1 - - -ShowHighScoreGrade=1 -ShowHighScoreScore=1 -ShowHighScorePercent=1 -ShowRadarCategoryStream=1 -ShowRadarCategoryVoltage=1 -ShowRadarCategoryAir=1 -ShowRadarCategoryFreeze=1 -ShowRadarCategoryChaos=1 -ShowRadarCategoryTaps=1 -ShowRadarCategoryJumps=1 -ShowRadarCategoryHolds=1 -ShowRadarCategoryMines=1 -ShowRadarCategoryHands=1 +InternetRankingHomeUrl=http://www.stepmania.com/stepmania +InternetRankingUploadUrl=http://www.stepmania.com/stepmania/upload_stats.php +InternetRankingViewGuidUrl=http://www.stepmania.com/stepmania/view_guid.php +StatsTitle=StepMania Stats +StatsHeader=StepMania Stats +StatsFooterText=generated by StepMania +StatsFooterLink=http://www.stepmania.com diff --git a/stepmania/src/CatalogXml.cpp b/stepmania/src/CatalogXml.cpp index 31c7afe981..902eaf17ce 100644 --- a/stepmania/src/CatalogXml.cpp +++ b/stepmania/src/CatalogXml.cpp @@ -23,6 +23,7 @@ #define INTERNET_RANKING_HOME_URL THEME->GetMetric ("CatalogXml","InternetRankingHomeUrl") #define INTERNET_RANKING_UPLOAD_URL THEME->GetMetric ("CatalogXml","InternetRankingUploadUrl") #define INTERNET_RANKING_VIEW_GUID_URL THEME->GetMetric ("CatalogXml","InternetRankingViewGuidUrl") +#define STATS_TITLE THEME->GetMetric ("CatalogXml","StatsTitle") #define STATS_HEADER THEME->GetMetric ("CatalogXml","StatsHeader") #define STATS_FOOTER_TEXT THEME->GetMetric ("CatalogXml","StatsFooterText") #define STATS_FOOTER_LINK THEME->GetMetric ("CatalogXml","StatsFooterLink") @@ -183,11 +184,46 @@ void SaveCatalogXml() pNode2->AppendAttr( "DisplayAs", GradeToThemedString(g) ); } } + + { + FOREACH_TapNoteScore( tns ) + { + XNode* pNode2 = pNode->AppendChild( "TapNoteScore", TapNoteScoreToString(tns) ); + pNode2->AppendAttr( "DisplayAs", TapNoteScoreToThemedString(tns) ); + } + } + + { + FOREACH_HoldNoteScore( hns ) + { + XNode* pNode2 = pNode->AppendChild( "HoldNoteScore", HoldNoteScoreToString(hns) ); + pNode2->AppendAttr( "DisplayAs", HoldNoteScoreToThemedString(hns) ); + } + } + + { + FOREACH_RadarCategory( rc ) + { + XNode* pNode2 = pNode->AppendChild( "RadarValue", RadarCategoryToString(rc) ); + pNode2->AppendAttr( "DisplayAs", RadarCategoryToThemedString(rc) ); + } + } + + { + set modifiers; + THEME->GetModifierNames( modifiers ); + for( set::const_iterator iter = modifiers.begin(); iter != modifiers.end(); iter++ ) + { + XNode* pNode2 = pNode->AppendChild( "Modifier", *iter ); + pNode2->AppendAttr( "DisplayAs", PlayerOptions::ThemeMod(*iter) ); + } + } } xml.AppendChild( "InternetRankingHomeUrl", INTERNET_RANKING_HOME_URL ); xml.AppendChild( "InternetRankingUploadUrl", INTERNET_RANKING_UPLOAD_URL ); xml.AppendChild( "InternetRankingViewGuidUrl", INTERNET_RANKING_VIEW_GUID_URL ); + xml.AppendChild( "StatsTitle", STATS_TITLE ); xml.AppendChild( "StatsHeader", STATS_HEADER ); xml.AppendChild( "StatsFooterText", STATS_FOOTER_TEXT ); xml.AppendChild( "StatsFooterLink", STATS_FOOTER_LINK ); diff --git a/stepmania/src/DateTime.h b/stepmania/src/DateTime.h index 0f9bea78cb..73ec40ad6f 100644 --- a/stepmania/src/DateTime.h +++ b/stepmania/src/DateTime.h @@ -43,6 +43,20 @@ struct DateTime : public tm // they're equal return true; } + bool operator==( const DateTime& other ) const + { +#define COMPARE(x) if( x!=other.x ) return false; + COMPARE( tm_year ); + COMPARE( tm_mon ); + COMPARE( tm_mday ); + COMPARE( tm_hour ); + COMPARE( tm_min ); + COMPARE( tm_sec ); +#undef COMPARE + return true; + } + bool operator!=( const DateTime& other ) const { return !operator==(other); } + static DateTime GetNowDateTime(); static DateTime GetNowDate(); // GetNowDateTime() with time chopped off diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp index 148474f2ff..9d9f343049 100644 --- a/stepmania/src/GameConstantsAndTypes.cpp +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -99,6 +99,7 @@ static const CString TapNoteScoreNames[NUM_TAP_NOTE_SCORES] = { }; XToString( TapNoteScore ); StringToX( TapNoteScore ); +XToThemedString( TapNoteScore ); static const CString HoldNoteScoreNames[NUM_HOLD_NOTE_SCORES] = { @@ -108,6 +109,7 @@ static const CString HoldNoteScoreNames[NUM_HOLD_NOTE_SCORES] = { }; XToString( HoldNoteScore ); StringToX( HoldNoteScore ); +XToThemedString( HoldNoteScore ); static const CString MemoryCardStateNames[NUM_MEMORY_CARD_STATES] = { diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index f840af978f..b404e46a92 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -164,6 +164,7 @@ enum TapNoteScore { }; #define FOREACH_TapNoteScore( tns ) FOREACH_ENUM( TapNoteScore, NUM_TAP_NOTE_SCORES, tns ) const CString& TapNoteScoreToString( TapNoteScore tns ); +CString TapNoteScoreToThemedString( TapNoteScore tns ); TapNoteScore StringToTapNoteScore( const CString& str ); @@ -175,7 +176,8 @@ enum HoldNoteScore NUM_HOLD_NOTE_SCORES }; #define FOREACH_HoldNoteScore( hns ) FOREACH_ENUM( HoldNoteScore, NUM_HOLD_NOTE_SCORES, hns ) -const CString& HoldNoteScoreToString( HoldNoteScore tns ); +const CString& HoldNoteScoreToString( HoldNoteScore hns ); +CString HoldNoteScoreToThemedString( HoldNoteScore hns ); HoldNoteScore StringToHoldNoteScore( const CString& str ); diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index db0a5cda9d..9d2063bd24 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -44,7 +44,7 @@ XNode* HighScore::CreateNode() const pNode->AppendChild( "PercentDP", fPercentDP ); pNode->AppendChild( "SurviveSeconds", fSurviveSeconds ); pNode->AppendChild( "Modifiers", sModifiers ); - pNode->AppendChild( "Time", (int)time ); + pNode->AppendChild( "DateTime", dateTime ); pNode->AppendChild( "PlayerGuid", sPlayerGuid ); pNode->AppendChild( "MachineGuid", sMachineGuid ); pNode->AppendChild( "ProductID", iProductID ); @@ -54,8 +54,7 @@ XNode* HighScore::CreateNode() const XNode* pHoldNoteScores = pNode->AppendChild( "HoldNoteScores" ); FOREACH_HoldNoteScore( hns ) pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); - XNode* pRadarCategories = pNode->AppendChild( "RadarActuals" ); - pRadarCategories->AppendChild( radarValues.CreateNode() ); + pNode->AppendChild( radarValues.CreateNode() ); return pNode; } @@ -77,7 +76,7 @@ void HighScore::LoadFromNode( const XNode* pNode ) pNode->GetChildValue( "PercentDP", fPercentDP ); pNode->GetChildValue( "SurviveSeconds", fSurviveSeconds ); pNode->GetChildValue( "Modifiers", sModifiers ); - pNode->GetChildValue( "Time", (int&)time ); + pNode->GetChildValue( "DateTime", dateTime ); pNode->GetChildValue( "PlayerGuid", sPlayerGuid ); pNode->GetChildValue( "MachineGuid", sMachineGuid ); pNode->GetChildValue( "ProductID", iProductID ); diff --git a/stepmania/src/HighScore.h b/stepmania/src/HighScore.h index 89bd34e1fb..443883bbdc 100644 --- a/stepmania/src/HighScore.h +++ b/stepmania/src/HighScore.h @@ -6,6 +6,7 @@ #include "Grade.h" #include "GameConstantsAndTypes.h" #include "RadarValues.h" +#include "DateTime.h" struct XNode; @@ -17,7 +18,7 @@ struct HighScore float fPercentDP; float fSurviveSeconds; CString sModifiers; - time_t time; // return value of time() when screenshot was taken + DateTime dateTime; // return value of time() when screenshot was taken CString sPlayerGuid; // who made this high score CString sMachineGuid; // where this high score was made int iProductID; @@ -34,7 +35,7 @@ struct HighScore fPercentDP = 0; fSurviveSeconds = 0; sModifiers = ""; - time = 0; + dateTime.Init(); sPlayerGuid = ""; sMachineGuid = ""; iProductID = 0; @@ -53,7 +54,7 @@ struct HighScore COMPARE( fPercentDP ); COMPARE( fSurviveSeconds ); COMPARE( sModifiers ); - COMPARE( time ); + COMPARE( dateTime ); COMPARE( sPlayerGuid ); COMPARE( sMachineGuid ); COMPARE( iProductID ); diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 0873b6358f..5a96af1676 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -89,7 +89,7 @@ void Profile::InitGeneralData() m_iNumToasties = 0; m_UnlockedSongs.clear(); m_sLastPlayedMachineGuid = ""; - m_LastPlayedDate = DateTime::GetNowDate(); + m_LastPlayedDate.Init(); m_iTotalTapsAndHolds = 0; m_iTotalJumps = 0; m_iTotalHolds = 0; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 16cb6350e8..2cd771ebf7 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -929,7 +929,7 @@ void ScreenEvaluation::CommitScores( hs.fPercentDP = stageStats.GetPercentDancePoints( p ); hs.fSurviveSeconds = stageStats.fAliveSeconds[p]; hs.sModifiers = GAMESTATE->m_PlayerOptions[p].GetString(); - hs.time = time(NULL); + hs.dateTime = DateTime::GetNowDateTime(); hs.sPlayerGuid = PROFILEMAN->IsUsingProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : ""; hs.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid; hs.iProductID = PREFSMAN->m_iProductID; diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 942300d860..a2087823b9 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -642,6 +642,21 @@ CString ThemeManager::GetPathToN( CString sFileName, bool bOptional ) { CString CString ThemeManager::GetPathToS( CString sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathS(sClassName,sElement,bOptional); } CString ThemeManager::GetPathToO( CString sFileName, bool bOptional ) { CString sClassName, sElement; FileNameToClassAndElement(sFileName,sClassName,sElement); return GetPathO(sClassName,sElement,bOptional); } +void ThemeManager::GetModifierNames( set& AddTo ) +{ + const IniFile::key *cur = m_pIniCurMetrics->GetKey( "OptionNames" ); + const IniFile::key *base = m_pIniBaseMetrics->GetKey( "OptionNames" ); + + for( IniFile::key::const_iterator iter = cur->begin(); iter != cur->end(); iter++ ) + { + AddTo.insert( iter->first ); + } + for( IniFile::key::const_iterator iter = base->begin(); iter != base->end(); iter++ ) + { + AddTo.insert( iter->first ); + } +} + /* * (c) 2001-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/ThemeManager.h b/stepmania/src/ThemeManager.h index e3ca7ad37d..8d771586ac 100644 --- a/stepmania/src/ThemeManager.h +++ b/stepmania/src/ThemeManager.h @@ -5,6 +5,7 @@ #include "RageTypes.h" #include "RageTimer.h" +#include class IniFile; @@ -27,6 +28,7 @@ public: void NextTheme(); void ReloadMetrics(); void ReloadMetricsIfNecessary(); + void GetModifierNames( set& AddTo ); /* I renamed these for two reasons. The overload conflicts with the ones below: * GetPathToB( str, str ) was matching the ones below instead of these. It's also