Skip to content

Commit

Permalink
wife based grades
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 7, 2016
1 parent 6f19852 commit e97836d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
Expand Down
23 changes: 23 additions & 0 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "global.h"
#include "RageLog.h"
#include "HighScore.h"
#include "PrefsManager.h"
#include "GameConstantsAndTypes.h"
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -612,6 +633,7 @@ class LunaHighScore: public Luna<HighScore>
return 1;
}
DEFINE_METHOD( GetGrade, GetGrade() )
DEFINE_METHOD( GetWifeGrade, GetWifeGrade())
DEFINE_METHOD( GetStageAward, GetStageAward() )
DEFINE_METHOD( GetPeakComboAward, GetPeakComboAward() )

Expand All @@ -632,6 +654,7 @@ class LunaHighScore: public Luna<HighScore>
ADD_METHOD( GetHoldNoteScore );
ADD_METHOD( GetRadarValues );
ADD_METHOD( GetGrade );
ADD_METHOD( GetWifeGrade );
ADD_METHOD( GetMaxCombo );
ADD_METHOD( GetStageAward );
ADD_METHOD( GetPeakComboAward );
Expand Down
1 change: 1 addition & 0 deletions src/HighScore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 21 additions & 0 deletions src/PlayerStageStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -785,6 +804,7 @@ class LunaPlayerStageStats: public Luna<PlayerStageStats>
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 )
Expand Down Expand Up @@ -946,6 +966,7 @@ class LunaPlayerStageStats: public Luna<PlayerStageStats>
ADD_METHOD( MaxCombo );
ADD_METHOD( GetCurrentLife );
ADD_METHOD( GetGrade );
ADD_METHOD( GetWifeGrade );
ADD_METHOD( GetHighScore );
ADD_METHOD( GetActualDancePoints );
ADD_METHOD( GetPossibleDancePoints );
Expand Down
1 change: 1 addition & 0 deletions src/PlayerStageStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e97836d

Please sign in to comment.