From 37c73feae8fcc1181836e300c8771dc4d8f97a78 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 15 Feb 2012 04:12:03 -0600 Subject: [PATCH] [HighScore] Added Max Combo, Stage Award and Peak Award. New Lua bindings for HighScore: GetMaxCombo(), GetStageAward(), GetPeakComboAward(). --- Docs/Changelog_sm5.txt | 6 ++++++ src/HighScore.cpp | 30 ++++++++++++++++++++++++++++-- src/HighScore.h | 6 ++++++ src/StageStats.cpp | 3 +++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index da5d719c9d..ef921a6781 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -8,6 +8,12 @@ ________________________________________________________________________________ StepMania 5.0 alpha 1a | 2012021? -------------------------------------------------------------------------------- +2012/02/15 +---------- +* [HighScore] Added Max Combo, Stage Award and Peak Award. New Lua bindings for + HighScore: GetMaxCombo(), GetStageAward(), GetPeakComboAward(). [AJ] + (the specifics of this are subject to change.) + 2012/02/10 ---------- * [WheelBase, WheelItemBase] Turned WheelItemDataType into a Lua type, diff --git a/src/HighScore.cpp b/src/HighScore.cpp index d2a4ec6ca0..66644ecb06 100644 --- a/src/HighScore.cpp +++ b/src/HighScore.cpp @@ -18,6 +18,9 @@ struct HighScoreImpl int iScore; float fPercentDP; float fSurviveSeconds; + int iMaxCombo; // maximum combo obtained [SM5 alpha 1a+] + StageAward stageAward; // stage award [SM5 alpha 1a+] + PeakComboAward peakComboAward; // peak combo award [SM5 alpha 1a+] RString sModifiers; DateTime dateTime; // return value of time() when screenshot was taken RString sPlayerGuid; // who made this high score @@ -43,6 +46,9 @@ bool HighScoreImpl::operator==( const HighScoreImpl& other ) const COMPARE( sName ); COMPARE( grade ); COMPARE( iScore ); + COMPARE( iMaxCombo ); + COMPARE( stageAward ); + COMPARE( peakComboAward ); COMPARE( fPercentDP ); COMPARE( fSurviveSeconds ); COMPARE( sModifiers ); @@ -69,6 +75,9 @@ HighScoreImpl::HighScoreImpl() iScore = 0; fPercentDP = 0; fSurviveSeconds = 0; + iMaxCombo = 0; + stageAward = StageAward_Invalid; + peakComboAward = PeakComboAward_Invalid; sModifiers = ""; dateTime.Init(); sPlayerGuid = ""; @@ -92,6 +101,9 @@ XNode *HighScoreImpl::CreateNode() const pNode->AppendChild( "Score", iScore ); pNode->AppendChild( "PercentDP", fPercentDP ); pNode->AppendChild( "SurviveSeconds", fSurviveSeconds ); + pNode->AppendChild( "MaxCombo", iMaxCombo ); + pNode->AppendChild( "StageAward", StageAwardToString(stageAward) ); + pNode->AppendChild( "PeakComboAward", PeakComboAwardToString(peakComboAward) ); pNode->AppendChild( "Modifiers", sModifiers ); pNode->AppendChild( "DateTime", dateTime.GetString() ); pNode->AppendChild( "PlayerGuid", sPlayerGuid ); @@ -124,6 +136,9 @@ void HighScoreImpl::LoadFromNode( const XNode *pNode ) pNode->GetChildValue( "Score", iScore ); pNode->GetChildValue( "PercentDP", fPercentDP ); pNode->GetChildValue( "SurviveSeconds", fSurviveSeconds ); + pNode->GetChildValue( "MaxCombo", iMaxCombo ); + pNode->GetChildValue( "StageAward", s ); stageAward = StringToStageAward(s); + pNode->GetChildValue( "PeakComboAward", s ); peakComboAward = StringToPeakComboAward(s); pNode->GetChildValue( "Modifiers", sModifiers ); pNode->GetChildValue( "DateTime", s ); dateTime.FromString( s ); pNode->GetChildValue( "PlayerGuid", sPlayerGuid ); @@ -175,6 +190,9 @@ bool HighScore::IsEmpty() const RString HighScore::GetName() const { return m_Impl->sName; } Grade HighScore::GetGrade() const { return m_Impl->grade; } int HighScore::GetScore() const { return m_Impl->iScore; } +int HighScore::GetMaxCombo() const { return m_Impl->iMaxCombo; } +StageAward HighScore::GetStageAward() const { return m_Impl->stageAward; } +PeakComboAward HighScore::GetPeakComboAward() const { return m_Impl->peakComboAward; } float HighScore::GetPercentDP() const { return m_Impl->fPercentDP; } float HighScore::GetSurviveSeconds() const { return m_Impl->fSurviveSeconds; } float HighScore::GetSurvivalSeconds() const { return GetSurviveSeconds() + GetLifeRemainingSeconds(); } @@ -192,6 +210,9 @@ bool HighScore::GetDisqualified() const { return m_Impl->bDisqualified; } void HighScore::SetName( const RString &sName ) { m_Impl->sName = sName; } void HighScore::SetGrade( Grade g ) { m_Impl->grade = g; } void HighScore::SetScore( int iScore ) { m_Impl->iScore = iScore; } +void HighScore::SetMaxCombo( int i ) { m_Impl->iMaxCombo = i; } +void HighScore::SetStageAward( StageAward a ) { m_Impl->stageAward = a; } +void HighScore::SetPeakComboAward( PeakComboAward a ) { m_Impl->peakComboAward = a; } void HighScore::SetPercentDP( float f ) { m_Impl->fPercentDP = f; } void HighScore::SetAliveSeconds( float f ) { m_Impl->fSurviveSeconds = f; } void HighScore::SetModifiers( RString s ) { m_Impl->sModifiers = s; } @@ -251,7 +272,7 @@ RString HighScore::GetDisplayName() const return GetName(); } - +/* begin HighScoreList */ void HighScoreList::Init() { iNumTimesPlayed = 0; @@ -428,6 +449,7 @@ public: lua_pushboolean( L, bIsFillInMarker ); return 1; } + static int GetMaxCombo( T* p, lua_State *L ) { lua_pushnumber(L, p->GetMaxCombo() ); return 1; } static int GetModifiers( T* p, lua_State *L ) { lua_pushstring(L, p->GetModifiers() ); return 1; } static int GetTapNoteScore( T* p, lua_State *L ) { lua_pushnumber(L, p->GetTapNoteScore( Enum::Check(L, 1) ) ); return 1; } static int GetHoldNoteScore( T* p, lua_State *L ) { lua_pushnumber(L, p->GetHoldNoteScore( Enum::Check(L, 1) ) ); return 1; } @@ -438,6 +460,8 @@ public: return 1; } DEFINE_METHOD( GetGrade, GetGrade() ) + DEFINE_METHOD( GetStageAward, GetStageAward() ) + DEFINE_METHOD( GetPeakComboAward, GetPeakComboAward() ) LunaHighScore() { @@ -447,12 +471,14 @@ public: ADD_METHOD( GetDate ); ADD_METHOD( GetSurvivalSeconds ); ADD_METHOD( IsFillInMarker ); - // sm-ssc additions: ADD_METHOD( GetModifiers ); ADD_METHOD( GetTapNoteScore ); ADD_METHOD( GetHoldNoteScore ); ADD_METHOD( GetRadarValues ); ADD_METHOD( GetGrade ); + ADD_METHOD( GetMaxCombo ); + ADD_METHOD( GetStageAward ); + ADD_METHOD( GetPeakComboAward ); } }; diff --git a/src/HighScore.h b/src/HighScore.h index 3673c98e37..2b473db0dd 100644 --- a/src/HighScore.h +++ b/src/HighScore.h @@ -41,6 +41,9 @@ struct HighScore * @return the number of seconds left. */ float GetSurviveSeconds() const; float GetSurvivalSeconds() const; + int GetMaxCombo() const; + StageAward GetStageAward() const; + PeakComboAward GetPeakComboAward() const; /** * @brief Get the modifiers used for this run. * @return the modifiers. */ @@ -66,6 +69,9 @@ struct HighScore void SetScore( int iScore ); void SetPercentDP( float f ); void SetAliveSeconds( float f ); + void SetMaxCombo( int i ); + void SetStageAward( StageAward a ); + void SetPeakComboAward( PeakComboAward a ); void SetModifiers( RString s ); void SetDateTime( DateTime d ); void SetPlayerGuid( RString s ); diff --git a/src/StageStats.cpp b/src/StageStats.cpp index b2ddbdc981..ecb759e077 100644 --- a/src/StageStats.cpp +++ b/src/StageStats.cpp @@ -135,6 +135,9 @@ static HighScore FillInHighScore( const PlayerStageStats &pss, const PlayerState hs.SetScore( pss.m_iScore ); hs.SetPercentDP( pss.GetPercentDancePoints() ); hs.SetAliveSeconds( pss.m_fAliveSeconds ); + hs.SetMaxCombo( pss.GetMaxCombo().m_cnt ); + hs.SetStageAward( pss.m_StageAward ); + hs.SetPeakComboAward( pss.m_PeakComboAward ); vector asModifiers; {