From 095513c3d705f0f4276204178ce9182284ca9265 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 12 Aug 2005 03:10:53 +0000 Subject: [PATCH] hide more --- stepmania/src/GameCommand.cpp | 4 +++- stepmania/src/HighScore.cpp | 37 +++++++++++++++--------------- stepmania/src/HighScore.h | 7 +++--- stepmania/src/ScreenEvaluation.cpp | 4 ++-- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/stepmania/src/GameCommand.cpp b/stepmania/src/GameCommand.cpp index 04e8afb4d2..5d230166e9 100644 --- a/stepmania/src/GameCommand.cpp +++ b/stepmania/src/GameCommand.cpp @@ -627,8 +627,10 @@ static HighScore MakeRandomHighScore( float fPercentDP ) hs.SetTapNoteScore( tns, rand() % 100 ); FOREACH_HoldNoteScore( hns ) hs.SetHoldNoteScore( hns, rand() % 100 ); + RadarValues rv; FOREACH_RadarCategory( rc ) - hs.radarValues.m_Values.f[rc] = randomf( 0, 1 ); + rv.m_Values.f[rc] = randomf( 0, 1 ); + hs.SetRadarValues( rv ); return hs; } diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index c5f6c2ad4f..1144730487 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -23,6 +23,8 @@ struct HighScoreImpl int iProductID; int iTapNoteScores[NUM_TAP_NOTE_SCORES]; int iHoldNoteScores[NUM_HOLD_NOTE_SCORES]; + RadarValues radarValues; + float fLifeRemainingSeconds; void Unset(); void AppendChildren( XNode *pNode ) const; @@ -49,6 +51,8 @@ bool HighScoreImpl::operator==( const HighScoreImpl& other ) const COMPARE( iTapNoteScores[tns] ); FOREACH_HoldNoteScore( hns ) COMPARE( iHoldNoteScores[hns] ); + COMPARE( radarValues ); + COMPARE( fLifeRemainingSeconds ); #undef COMPARE return true; @@ -68,11 +72,13 @@ void HighScoreImpl::Unset() iProductID = 0; ZERO( iTapNoteScores ); ZERO( iHoldNoteScores ); - + radarValues.MakeUnknown(); + fLifeRemainingSeconds = 0; } void HighScoreImpl::AppendChildren( XNode *pNode ) const { + // TRICKY: Don't write "name to fill in" markers. pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? CString("") : sName ); pNode->AppendChild( "Grade", GradeToString(grade) ); pNode->AppendChild( "Score", iScore ); @@ -91,6 +97,8 @@ void HighScoreImpl::AppendChildren( XNode *pNode ) const FOREACH_HoldNoteScore( hns ) if( hns != HNS_NONE ) // HACK: don't save meaningless "none" count pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); + pNode->AppendChild( radarValues.CreateNode() ); + pNode->AppendChild( "LifeRemainingSeconds", fLifeRemainingSeconds ); } void HighScoreImpl::LoadFromNode( const XNode *pNode ) @@ -116,6 +124,10 @@ void HighScoreImpl::LoadFromNode( const XNode *pNode ) if( pHoldNoteScores ) FOREACH_HoldNoteScore( hns ) pHoldNoteScores->GetChildValue( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); + const XNode* pRadarValues = pNode->GetChild( "RadarValues" ); + if( pRadarValues ) + radarValues.LoadFromNode( pRadarValues ); + pNode->GetChildValue( "LifeRemainingSeconds", fLifeRemainingSeconds ); /* Validate input. */ grade = clamp( grade, GRADE_TIER01, GRADE_FAILED ); @@ -132,8 +144,6 @@ HighScore::HighScore() void HighScore::Unset() { m_Impl->Unset(); - radarValues.MakeUnknown(); - fLifeRemainingSeconds = 0; } CString HighScore::GetName() const { return m_Impl->sName; } @@ -146,7 +156,7 @@ float HighScore::GetPercentDP() const { return m_Impl->fPercentDP; } void HighScore::SetPercentDP( float f ) { m_Impl->fPercentDP = f; } float HighScore::GetSurviveSeconds() const { return m_Impl->fSurviveSeconds; } void HighScore::SetSurviveSeconds( float f ) { m_Impl->fSurviveSeconds = f; } -float HighScore::GetSurvivalSeconds() const { return GetSurviveSeconds() + fLifeRemainingSeconds; } +float HighScore::GetSurvivalSeconds() const { return GetSurviveSeconds() + GetLifeRemainingSeconds(); } CString HighScore::GetModifiers() const { return m_Impl->sModifiers; } void HighScore::SetModifiers( CString s ) { m_Impl->sModifiers = s; } DateTime HighScore::GetDateTime() const { return m_Impl->dateTime; } @@ -161,6 +171,10 @@ int HighScore::GetTapNoteScore( TapNoteScore tns ) const { return m_Impl->iTapNo void HighScore::SetTapNoteScore( TapNoteScore tns, int i ) { m_Impl->iTapNoteScores[tns] = i; } int HighScore::GetHoldNoteScore( HoldNoteScore hns ) const { return m_Impl->iHoldNoteScores[hns]; } void HighScore::SetHoldNoteScore( HoldNoteScore hns, int i ) { m_Impl->iHoldNoteScores[hns] = i; } +const RadarValues &HighScore::GetRadarValues() const { return m_Impl->radarValues; } +void HighScore::SetRadarValues( const RadarValues &rv ) { m_Impl->radarValues = rv; } +float HighScore::GetLifeRemainingSeconds() const { return m_Impl->fLifeRemainingSeconds; } +void HighScore::SetLifeRemainingSeconds( float f ) { m_Impl->fLifeRemainingSeconds = f; } /* We normally don't give direct access to the members. We need this one * for NameToFillIn; use a special accessor so it's easy to find where this @@ -189,13 +203,7 @@ bool HighScore::operator>=( const HighScore& other ) const bool HighScore::operator==( const HighScore& other ) const { - if( *m_Impl != *other.m_Impl ) - return false; -#define COMPARE(x) if( x!=other.x ) return false; - COMPARE( radarValues ); - COMPARE( fLifeRemainingSeconds ); -#undef COMPARE - return true; + return *m_Impl == *other.m_Impl; } XNode* HighScore::CreateNode() const @@ -203,10 +211,7 @@ XNode* HighScore::CreateNode() const XNode* pNode = new XNode; pNode->m_sName = "HighScore"; - // TRICKY: Don't write "name to fill in" markers. m_Impl->AppendChildren( pNode ); - pNode->AppendChild( radarValues.CreateNode() ); - pNode->AppendChild( "LifeRemainingSeconds", fLifeRemainingSeconds ); return pNode; } @@ -215,10 +220,6 @@ void HighScore::LoadFromNode( const XNode* pNode ) ASSERT( pNode->m_sName == "HighScore" ); m_Impl->LoadFromNode( pNode ); - const XNode* pRadarValues = pNode->GetChild( "RadarValues" ); - if( pRadarValues ) - radarValues.LoadFromNode( pRadarValues ); - pNode->GetChildValue( "LifeRemainingSeconds", fLifeRemainingSeconds ); } CString HighScore::GetDisplayName() const diff --git a/stepmania/src/HighScore.h b/stepmania/src/HighScore.h index bb917d85ce..97eaf8a3d5 100644 --- a/stepmania/src/HighScore.h +++ b/stepmania/src/HighScore.h @@ -42,9 +42,10 @@ struct HighScore void SetTapNoteScore( TapNoteScore tns, int i ); int GetHoldNoteScore( HoldNoteScore tns ) const; void SetHoldNoteScore( HoldNoteScore tns, int i ); - - RadarValues radarValues; - float fLifeRemainingSeconds; + const RadarValues &GetRadarValues() const; + void SetRadarValues( const RadarValues &rv ); + float GetLifeRemainingSeconds() const; + void SetLifeRemainingSeconds( float f ); HighScore(); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index f0315ba499..69451c0b28 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -910,8 +910,8 @@ void ScreenEvaluation::CommitScores( hs.SetTapNoteScore( tns, stageStats.m_player[p].iTapNoteScores[tns] ); FOREACH_HoldNoteScore( hns ) hs.SetHoldNoteScore( hns, stageStats.m_player[p].iHoldNoteScores[hns] ); - hs.radarValues = stageStats.m_player[p].radarActual; - hs.fLifeRemainingSeconds = stageStats.m_player[p].fLifeRemainingSeconds; + hs.SetRadarValues( stageStats.m_player[p].radarActual ); + hs.SetLifeRemainingSeconds( stageStats.m_player[p].fLifeRemainingSeconds ); StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;