add judge counts to HighScore. Will this make Stats.xml too big?

This commit is contained in:
Chris Danford
2004-05-27 07:59:46 +00:00
parent 398865a5ec
commit 6a82d3c5a0
5 changed files with 68 additions and 30 deletions
+10
View File
@@ -109,6 +109,16 @@ static const CString TapNoteScoreNames[NUM_TAP_NOTE_SCORES] = {
"Marvelous",
};
XToString( TapNoteScore );
StringToX( TapNoteScore );
static const CString HoldNoteScoreNames[NUM_HOLD_NOTE_SCORES] = {
"None",
"OK",
"NG",
};
XToString( HoldNoteScore );
StringToX( HoldNoteScore );
static const CString MemoryCardStateNames[NUM_MEMORY_CARD_STATES] = {
+3 -6
View File
@@ -189,12 +189,7 @@ enum TapNoteScore {
};
#define FOREACH_TapNoteScore( tns ) FOREACH_ENUM( TapNoteScore, NUM_TAP_NOTE_SCORES, tns )
const CString& TapNoteScoreToString( TapNoteScore tns );
//enum TapNoteTiming {
// TNT_NONE,
// TNT_EARLY,
// TNT_LATE
//};
TapNoteScore StringToTapNoteScore( const CString& str );
enum HoldNoteScore
@@ -205,6 +200,8 @@ enum HoldNoteScore
NUM_HOLD_NOTE_SCORES
};
#define FOREACH_HoldNoteScore( hns ) FOREACH_ENUM( HoldNoteScore, NUM_HOLD_NOTE_SCORES, hns )
const CString& HoldNoteScoreToString( HoldNoteScore tns );
HoldNoteScore StringToHoldNoteScore( const CString& str );
//
+39 -24
View File
@@ -59,6 +59,15 @@ XNode* HighScore::CreateNode() const
pNode->AppendChild( "PlayerGuid", sPlayerGuid );
pNode->AppendChild( "MachineGuid", sMachineGuid );
pNode->AppendChild( "ProductID", iProductID );
XNode* pTapNoteScores = pNode->AppendChild( "TapNoteScores" );
FOREACH_TapNoteScore( tns )
pTapNoteScores->AppendChild( TapNoteScoreToString(tns), iTapNoteScores[tns] );
XNode* pHoldNoteScores = pNode->AppendChild( "HoldNoteScores" );
FOREACH_HoldNoteScore( hns )
pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] );
XNode* pRadarCategories = pNode->AppendChild( "RadarActuals" );
FOREACH_RadarCategory( rc )
pRadarCategories->AppendChild( RadarCategoryToString(rc), fRadarActual[rc] );
return pNode;
}
@@ -66,30 +75,36 @@ XNode* HighScore::CreateNode() const
void HighScore::LoadFromNode( const XNode* pNode )
{
ASSERT( pNode->name == "HighScore" );
for( XNodes::const_iterator child = pNode->childs.begin();
child != pNode->childs.end();
child++ )
{
if( (*child)->name == "Name" ) (*child)->GetValue( sName );
else if( (*child)->name == "Grade" )
{
CString sGrade;
(*child)->GetValue( sGrade );
/* Pre-a19 compatibility; remove eventually: */
if( IsAnInt(sGrade) )
grade = (Grade) atoi( sGrade );
else
grade = StringToGrade( sGrade );
}
else if( (*child)->name == "Score" ) (*child)->GetValue( iScore );
else if( (*child)->name == "PercentDP" ) (*child)->GetValue( fPercentDP );
else if( (*child)->name == "SurviveSeconds" ) (*child)->GetValue( fSurviveSeconds );
else if( (*child)->name == "Modifiers" ) (*child)->GetValue( sModifiers );
else if( (*child)->name == "Time" ) (*child)->GetValue( (int&)time );
else if( (*child)->name == "PlayerGuid" ) (*child)->GetValue( sPlayerGuid );
else if( (*child)->name == "MachineGuid" ) (*child)->GetValue( sMachineGuid );
else if( (*child)->name == "ProductID" ) (*child)->GetValue( iProductID );
}
CString s;
pNode->GetChildValue( "Name", sName );
pNode->GetChildValue( "Grade", s );
/* Pre-a19 compatibility; remove eventually */
if( IsAnInt(s) )
grade = (Grade) atoi( s );
else
grade = StringToGrade( s );
pNode->GetChildValue( "Score", iScore );
pNode->GetChildValue( "PercentDP", fPercentDP );
pNode->GetChildValue( "SurviveSeconds", fSurviveSeconds );
pNode->GetChildValue( "Modifiers", sModifiers );
pNode->GetChildValue( "Time", (int&)time );
pNode->GetChildValue( "PlayerGuid", sPlayerGuid );
pNode->GetChildValue( "MachineGuid", sMachineGuid );
pNode->GetChildValue( "ProductID", iProductID );
XNode* pTapNoteScores = pNode->GetChild( "TapNoteScores" );
if( pTapNoteScores )
FOREACH_TapNoteScore( tns )
pTapNoteScores->GetChildValue( TapNoteScoreToString(tns), iTapNoteScores[tns] );
XNode* pHoldNoteScores = pNode->GetChild( "HoldNoteScores" );
if( pHoldNoteScores )
FOREACH_HoldNoteScore( hns )
pHoldNoteScores->GetChildValue( HoldNoteScoreToString(hns), iHoldNoteScores[hns] );
XNode* pRadarCategories = pNode->GetChild( "RadarActuals" );
if( pRadarCategories )
FOREACH_RadarCategory( rc )
pRadarCategories->GetChildValue( RadarCategoryToString(rc), fRadarActual[rc] );
/* Validate input. */
grade = clamp( grade, GRADE_TIER_1, GRADE_FAILED );
+13
View File
@@ -13,6 +13,7 @@
*/
#include "Grade.h"
#include "GameConstantsAndTypes.h"
struct XNode;
struct HighScore
@@ -27,6 +28,9 @@ struct HighScore
CString sPlayerGuid; // who made this high score
CString sMachineGuid; // where this high score was made
int iProductID;
int iTapNoteScores[NUM_TAP_NOTE_SCORES];
int iHoldNoteScores[NUM_HOLD_NOTE_SCORES];
float fRadarActual[NUM_RADAR_CATEGORIES];
HighScore() { Unset(); }
void Unset()
@@ -41,6 +45,9 @@ struct HighScore
sPlayerGuid = "";
sMachineGuid = "";
iProductID = 0;
ZERO( iTapNoteScores );
ZERO( iHoldNoteScores );
ZERO( fRadarActual );
}
bool operator>=( const HighScore& other ) const;
@@ -57,6 +64,12 @@ struct HighScore
COMPARE( sPlayerGuid );
COMPARE( sMachineGuid );
COMPARE( iProductID );
FOREACH_TapNoteScore( tns )
COMPARE( iTapNoteScores[tns] );
FOREACH_HoldNoteScore( hns )
COMPARE( iHoldNoteScores[hns] );
FOREACH_RadarCategory( rc )
COMPARE( fRadarActual[rc] );
#undef COMPARE
return true;
}
+3
View File
@@ -899,6 +899,9 @@ void ScreenEvaluation::CommitScores(
hs.sPlayerGuid = PROFILEMAN->IsUsingProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : "";
hs.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
hs.iProductID = PREFSMAN->m_iProductID;
memcpy( hs.iTapNoteScores, stageStats.iTapNoteScores[p], sizeof(hs.iTapNoteScores) );
memcpy( hs.iHoldNoteScores, stageStats.iHoldNoteScores[p], sizeof(hs.iHoldNoteScores) );
memcpy( hs.fRadarActual, stageStats.fRadarActual[p], sizeof(hs.fRadarActual) );
StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType;