From e97836da3a71ae3636669a66058e330f9ac3c535 Mon Sep 17 00:00:00 2001 From: MinaciousGrace Date: Tue, 6 Dec 2016 19:01:25 -0500 Subject: [PATCH] wife based grades --- .../ScreenEvaluation decorations/default.lua | 2 +- .../wifeTwirl.lua | 2 +- src/HighScore.cpp | 23 +++++++++++++++++++ src/HighScore.h | 1 + src/PlayerStageStats.cpp | 21 +++++++++++++++++ src/PlayerStageStats.h | 1 + 6 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua index ee33159b5c..a84d083970 100644 --- a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua +++ b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua @@ -106,7 +106,7 @@ function scoreBoard(pn,position) InitCommand=cmd(xy,frameX+5,frameY+9;zoom,0.45;halign,0;valign,0), BeginCommand=cmd(queuecommand,"Set"), SetCommand=function(self) - self:diffuse(getGradeColor(pss:GetGrade())) + self:diffuse(getGradeColor(pss:GetWifeGrade())) self:settextf("%05.2f%% (%s)",pss:GetWifeScore()*100, "Wife") end, }; diff --git a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua index 49453ac9b0..35f79183da 100644 --- a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua +++ b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua @@ -141,7 +141,7 @@ t[#t+1] = Def.ActorFrame{ self:diffuse(getGradeColor(Score:GetGrade())) else self:settextf("%05.2f%%", Score:GetWifeScore()*100) - self:diffuse(getGradeColor(Score:GetGrade())) + self:diffuse(getGradeColor(Score:GetWifeGrade())) end else self:settext("") diff --git a/src/HighScore.cpp b/src/HighScore.cpp index 4e3746a0e4..2b63c5668e 100644 --- a/src/HighScore.cpp +++ b/src/HighScore.cpp @@ -1,4 +1,5 @@ #include "global.h" +#include "RageLog.h" #include "HighScore.h" #include "PrefsManager.h" #include "GameConstantsAndTypes.h" @@ -290,6 +291,26 @@ bool HighScore::IsEmpty() const return true; } +Grade HighScore::GetWifeGrade() { + if (GetGrade() == Grade_Failed) + return Grade_Failed; + + float wifescore = GetWifeScore(); + if (wifescore >= 0.9998) + return Grade_Tier01; + if (wifescore >= 0.9975) + return Grade_Tier02; + if (wifescore >= 0.93) + return Grade_Tier03; + if (wifescore >= 0.8) + return Grade_Tier04; + if (wifescore >= 0.7) + return Grade_Tier05; + if (wifescore >= 0.6) + return Grade_Tier06; + return Grade_Tier07; +} + RString HighScore::GetName() const { return m_Impl->sName; } Grade HighScore::GetGrade() const { return m_Impl->grade; } unsigned int HighScore::GetScore() const { return m_Impl->iScore; } @@ -612,6 +633,7 @@ class LunaHighScore: public Luna return 1; } DEFINE_METHOD( GetGrade, GetGrade() ) + DEFINE_METHOD( GetWifeGrade, GetWifeGrade()) DEFINE_METHOD( GetStageAward, GetStageAward() ) DEFINE_METHOD( GetPeakComboAward, GetPeakComboAward() ) @@ -632,6 +654,7 @@ class LunaHighScore: public Luna ADD_METHOD( GetHoldNoteScore ); ADD_METHOD( GetRadarValues ); ADD_METHOD( GetGrade ); + ADD_METHOD( GetWifeGrade ); ADD_METHOD( GetMaxCombo ); ADD_METHOD( GetStageAward ); ADD_METHOD( GetPeakComboAward ); diff --git a/src/HighScore.h b/src/HighScore.h index 2f071f5531..fd6489f123 100644 --- a/src/HighScore.h +++ b/src/HighScore.h @@ -35,6 +35,7 @@ struct HighScore * @brief Determine if any judgments were tallied during this run. * @return true if no judgments were recorded, false otherwise. */ bool IsEmpty() const; + Grade GetWifeGrade(); float GetPercentDP() const; float GetWifeScore() const; float GetSSR() const; diff --git a/src/PlayerStageStats.cpp b/src/PlayerStageStats.cpp index 8096f7ca53..811d91b5f2 100644 --- a/src/PlayerStageStats.cpp +++ b/src/PlayerStageStats.cpp @@ -182,6 +182,25 @@ Grade GetGradeFromPercent( float fPercent ) return grade; } +Grade PlayerStageStats::GetWifeGrade() { + if (GetGrade() == Grade_Failed) + return Grade_Failed; + + if (m_fWifeScore >= 0.9998) + return Grade_Tier01; + if (m_fWifeScore >= 0.9975) + return Grade_Tier02; + if (m_fWifeScore >= 0.93) + return Grade_Tier03; + if (m_fWifeScore >= 0.8) + return Grade_Tier04; + if (m_fWifeScore >= 0.7) + return Grade_Tier05; + if (m_fWifeScore >= 0.6) + return Grade_Tier06; + return Grade_Tier07; +} + Grade PlayerStageStats::GetGrade() const { if( m_bFailed ) @@ -785,6 +804,7 @@ class LunaPlayerStageStats: public Luna DEFINE_METHOD( MaxCombo, GetMaxCombo().m_cnt ) DEFINE_METHOD( GetCurrentLife, GetCurrentLife() ) DEFINE_METHOD( GetGrade, GetGrade() ) + DEFINE_METHOD( GetWifeGrade, GetWifeGrade()) DEFINE_METHOD( GetActualDancePoints, m_iActualDancePoints ) DEFINE_METHOD( GetPossibleDancePoints, m_iPossibleDancePoints ) DEFINE_METHOD( GetCurrentPossibleDancePoints, m_iCurPossibleDancePoints ) @@ -946,6 +966,7 @@ class LunaPlayerStageStats: public Luna ADD_METHOD( MaxCombo ); ADD_METHOD( GetCurrentLife ); ADD_METHOD( GetGrade ); + ADD_METHOD( GetWifeGrade ); ADD_METHOD( GetHighScore ); ADD_METHOD( GetActualDancePoints ); ADD_METHOD( GetPossibleDancePoints ); diff --git a/src/PlayerStageStats.h b/src/PlayerStageStats.h index 386cb6a82f..29a25ffaaa 100644 --- a/src/PlayerStageStats.h +++ b/src/PlayerStageStats.h @@ -28,6 +28,7 @@ class PlayerStageStats static float MakePercentScore( int iActual, int iPossible ); static RString FormatPercentScore( float fPercentScore ); // Calculate the difficulty rating for a specific score obtained by a player - Mina + Grade GetWifeGrade(); float CalcSSR() const; float GetPercentDancePoints() const; float GetWifeScore() const;