From 8af1f7003d091a1f5f930567955c289a3b5de36f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 12 Aug 2005 02:55:48 +0000 Subject: [PATCH] hide more --- stepmania/src/GameCommand.cpp | 8 ++-- stepmania/src/HighScore.cpp | 44 +++++++++++++------- stepmania/src/HighScore.h | 13 ++++-- stepmania/src/ScreenEvaluation.cpp | 8 ++-- stepmania/src/ScreenNameEntryTraditional.cpp | 4 +- 5 files changed, 47 insertions(+), 30 deletions(-) diff --git a/stepmania/src/GameCommand.cpp b/stepmania/src/GameCommand.cpp index eb72ddcde0..8ac521652b 100644 --- a/stepmania/src/GameCommand.cpp +++ b/stepmania/src/GameCommand.cpp @@ -618,10 +618,10 @@ static HighScore MakeRandomHighScore( float fPercentDP ) hs.SetSurviveSeconds( randomf(30.0f, 100.0f) ); PlayerOptions po; po.ChooseRandomMofifiers(); - hs.sModifiers = po.GetString(); - hs.dateTime = DateTime::GetNowDateTime(); - hs.sPlayerGuid = Profile::MakeGuid(); - hs.sMachineGuid = Profile::MakeGuid(); + hs.SetModifiers( po.GetString() ); + hs.SetDateTime( DateTime::GetNowDateTime() ); + hs.SetPlayerGuid( Profile::MakeGuid() ); + hs.SetMachineGuid( Profile::MakeGuid() ); hs.iProductID = rand()%10; FOREACH_TapNoteScore( tns ) hs.iTapNoteScores[tns] = rand() % 100; diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index f60791530e..467918c2ba 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -16,6 +16,10 @@ struct HighScoreImpl int iScore; float fPercentDP; float fSurviveSeconds; + CString sModifiers; + 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 void Unset(); void AppendChildren( XNode *pNode ) const; @@ -33,6 +37,10 @@ bool HighScoreImpl::operator==( const HighScoreImpl& other ) const COMPARE( iScore ); COMPARE( fPercentDP ); COMPARE( fSurviveSeconds ); + COMPARE( sModifiers ); + COMPARE( dateTime ); + COMPARE( sPlayerGuid ); + COMPARE( sMachineGuid ); #undef COMPARE return true; @@ -45,6 +53,10 @@ void HighScoreImpl::Unset() iScore = 0; fPercentDP = 0; fSurviveSeconds = 0; + sModifiers = ""; + dateTime.Init(); + sPlayerGuid = ""; + sMachineGuid = ""; } @@ -55,6 +67,10 @@ void HighScoreImpl::AppendChildren( XNode *pNode ) const pNode->AppendChild( "Score", iScore ); pNode->AppendChild( "PercentDP", fPercentDP ); pNode->AppendChild( "SurviveSeconds", fSurviveSeconds ); + pNode->AppendChild( "Modifiers", sModifiers ); + pNode->AppendChild( "DateTime", dateTime ); + pNode->AppendChild( "PlayerGuid", sPlayerGuid ); + pNode->AppendChild( "MachineGuid", sMachineGuid ); } void HighScoreImpl::LoadFromNode( const XNode *pNode ) @@ -67,6 +83,10 @@ void HighScoreImpl::LoadFromNode( const XNode *pNode ) pNode->GetChildValue( "Score", iScore ); pNode->GetChildValue( "PercentDP", fPercentDP ); pNode->GetChildValue( "SurviveSeconds", fSurviveSeconds ); + pNode->GetChildValue( "Modifiers", sModifiers ); + pNode->GetChildValue( "DateTime", dateTime ); + pNode->GetChildValue( "PlayerGuid", sPlayerGuid ); + pNode->GetChildValue( "MachineGuid", sMachineGuid ); /* Validate input. */ grade = clamp( grade, GRADE_TIER01, GRADE_FAILED ); @@ -83,10 +103,6 @@ HighScore::HighScore() void HighScore::Unset() { m_Impl->Unset(); - sModifiers = ""; - dateTime.Init(); - sPlayerGuid = ""; - sMachineGuid = ""; iProductID = 0; ZERO( iTapNoteScores ); ZERO( iHoldNoteScores ); @@ -105,6 +121,14 @@ 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; } +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; } +void HighScore::SetDateTime( DateTime d ) { m_Impl->dateTime = d; } +CString HighScore::GetPlayerGuid() const { return m_Impl->sPlayerGuid; } +void HighScore::SetPlayerGuid( CString s ) { m_Impl->sPlayerGuid = s; } +CString HighScore::GetMachineGuid() const { return m_Impl->sMachineGuid; } +void HighScore::SetMachineGuid( CString s ) { m_Impl->sMachineGuid = s; } /* 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 @@ -136,10 +160,6 @@ 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( sModifiers ); - COMPARE( dateTime ); - COMPARE( sPlayerGuid ); - COMPARE( sMachineGuid ); COMPARE( iProductID ); FOREACH_TapNoteScore( tns ) COMPARE( iTapNoteScores[tns] ); @@ -158,10 +178,6 @@ XNode* HighScore::CreateNode() const // TRICKY: Don't write "name to fill in" markers. m_Impl->AppendChildren( pNode ); - pNode->AppendChild( "Modifiers", sModifiers ); - pNode->AppendChild( "DateTime", dateTime ); - pNode->AppendChild( "PlayerGuid", sPlayerGuid ); - pNode->AppendChild( "MachineGuid", sMachineGuid ); pNode->AppendChild( "ProductID", iProductID ); XNode* pTapNoteScores = pNode->AppendChild( "TapNoteScores" ); FOREACH_TapNoteScore( tns ) @@ -181,10 +197,6 @@ void HighScore::LoadFromNode( const XNode* pNode ) ASSERT( pNode->m_sName == "HighScore" ); m_Impl->LoadFromNode( pNode ); - pNode->GetChildValue( "Modifiers", sModifiers ); - pNode->GetChildValue( "DateTime", dateTime ); - pNode->GetChildValue( "PlayerGuid", sPlayerGuid ); - pNode->GetChildValue( "MachineGuid", sMachineGuid ); pNode->GetChildValue( "ProductID", iProductID ); const XNode* pTapNoteScores = pNode->GetChild( "TapNoteScores" ); if( pTapNoteScores ) diff --git a/stepmania/src/HighScore.h b/stepmania/src/HighScore.h index d8f1bc2d7e..9f11fd6f1f 100644 --- a/stepmania/src/HighScore.h +++ b/stepmania/src/HighScore.h @@ -28,10 +28,15 @@ struct HighScore float GetSurviveSeconds() const; void SetSurviveSeconds( float f ); float GetSurvivalSeconds() const; - CString sModifiers; - 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 + CString GetModifiers() const; + void SetModifiers( CString s ); + DateTime GetDateTime() const; + void SetDateTime( DateTime d ); + CString GetPlayerGuid() const; + void SetPlayerGuid( CString s ); + CString GetMachineGuid() const; + void SetMachineGuid( CString s ); + int iProductID; int iTapNoteScores[NUM_TAP_NOTE_SCORES]; int iHoldNoteScores[NUM_HOLD_NOTE_SCORES]; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index ee67d81013..f3c6a36ad6 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -901,10 +901,10 @@ void ScreenEvaluation::CommitScores( hs.SetScore( stageStats.m_player[p].iScore ); hs.SetPercentDP( stageStats.m_player[p].GetPercentDancePoints() ); hs.SetSurviveSeconds( stageStats.m_player[p].fAliveSeconds ); - hs.sModifiers = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetString(); - hs.dateTime = DateTime::GetNowDateTime(); - hs.sPlayerGuid = PROFILEMAN->IsPersistentProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : CString(""); - hs.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid; + hs.SetModifiers( GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.GetString() ); + hs.SetDateTime( DateTime::GetNowDateTime() ); + hs.SetPlayerGuid( PROFILEMAN->IsPersistentProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : CString("") ); + hs.SetMachineGuid( PROFILEMAN->GetMachineProfile()->m_sGuid ); hs.iProductID = PREFSMAN->m_iProductID; memcpy( hs.iTapNoteScores, stageStats.m_player[p].iTapNoteScores, sizeof(hs.iTapNoteScores) ); memcpy( hs.iHoldNoteScores, stageStats.m_player[p].iHoldNoteScores, sizeof(hs.iHoldNoteScores) ); diff --git a/stepmania/src/ScreenNameEntryTraditional.cpp b/stepmania/src/ScreenNameEntryTraditional.cpp index 1c43aa81ea..41a8d0c1dc 100644 --- a/stepmania/src/ScreenNameEntryTraditional.cpp +++ b/stepmania/src/ScreenNameEntryTraditional.cpp @@ -70,7 +70,7 @@ void HighScoreWheelItem::Load( int iRankIndex, const HighScore& hs ) m_textDate.SetName( "Date" ); m_textDate.LoadFromFont( THEME->GetPathF(m_sName,"date") ); - m_textDate.SetText( ssprintf("%02d/%02d", hs.dateTime.tm_mon+1, hs.dateTime.tm_mday) ); + m_textDate.SetText( ssprintf("%02d/%02d", hs.GetDateTime().tm_mon+1, hs.GetDateTime().tm_mday) ); m_textDate.SetShadowLength( 2 ); this->AddChild( &m_textDate ); SET_XY_AND_ON_COMMAND( m_textDate ); @@ -172,7 +172,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S hs.SetGrade( GRADE_TIER03 ); hs.SetPercentDP( ss.m_player[p].GetPercentDancePoints() ); hs.SetScore( ss.m_player[p].iScore ); - hs.dateTime = DateTime::GetNowDateTime(); + hs.SetDateTime( DateTime::GetNowDateTime() ); int a, b; PROFILEMAN->AddStepsScore( ss.vpPlayedSongs[0], pSteps, p, hs, a, b ); PROFILEMAN->AddStepsScore( ss.vpPlayedSongs[0], pSteps, p, hs, a, b );