Skip to content

Commit

Permalink
Add chord cohesion flag to scores, and fix built-in DP scoring. Added…
Browse files Browse the repository at this point in the history
… lua call CountNotesSeparately so themers can check if chord cohesion is currently being used.
  • Loading branch information
xwidghet committed Mar 15, 2017
1 parent 0b45e1f commit e6024e2
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,18 @@ function scoreBoard(pn,position)
end,
};
end

t[#t+1] = LoadFont("Common Large")..{
InitCommand=cmd(xy,frameX+40,frameY*2.49;zoom,0.25;halign,0),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
if score:GetChordCohesion() == true then
self:settext("Chord Cohesion: Yes")
else
self:settext("Chord Cohesion: No")
end
end
};

local fart = {"Holds", "Mines", "Rolls", "Lifts", "Fakes"}
t[#t+1] = Def.Quad{InitCommand=cmd(xy,frameX-5,frameY+230;zoomto,frameWidth/2-10,60;halign,0;valign,0;diffuse,color("#333333CC"))};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,7 @@ t[#t+1] = LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX+offsetX+55,frameY+offsetY+14;zoom,0.5;halign,0),
SetCommand=function(self)
if score ~= nil then
local curscore = getScore(score,0)
local maxscore = getMaxScore(pn,0)
if maxscore == 0 or maxscore == nil then
maxscore = 1
end
local pscore = (curscore/maxscore)

self:settextf("%05.2f%% (%s)",math.floor((pscore)*10000)/100, scoringToText(1))
self:settextf("%05.2f%% (%s)",score:GetPercentDP()*100, scoringToText(1))
else
self:settextf("00.00%% (%s)", scoringToText(1))
end
Expand Down Expand Up @@ -359,6 +352,23 @@ t[#t+1] = LoadFont("Common Normal")..{
ScoreUpdateMessageCommand=cmd(queuecommand,"Set")
}

t[#t+1] = LoadFont("Common Normal")..{
Name="ChordCohesion",
InitCommand=cmd(xy,frameX+frameWidth/40,frameY+frameHeight-10;zoom,0.4;halign,0),
SetCommand=function(self)
if score ~= nil then
if score:GetChordCohesion() == true then
self:settext("Chord Cohesion: Yes")
else
self:settext("Chord Cohesion: No")
end
else
self:settext("Chord Cohesion:")
end
end,
ScoreUpdateMessageCommand=cmd(queuecommand,"Set")
}

t[#t+1] = Def.Quad{
Name="ScrollBar",
InitCommand=cmd(xy,frameX+frameWidth,frameY+frameHeight;zoomto,4,0;halign,1;valign,1;diffuse,getMainColor('highlight');diffusealpha,0.5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ t[#t+1] = Def.ActorFrame{
SetCommand=function(self)
if song and score then
if score:GetWifeScore() == 0 then
self:settextf("%05.2f%%", notShit.floor(GetPercentDP(score)*100)/100)
self:settextf("%05.2f%%", score:GetPercentDP()*100)
self:diffuse(getGradeColor(score:GetGrade()))
else
self:settextf("%05.2f%%", notShit.floor(score:GetWifeScore()*10000)/100)
Expand Down Expand Up @@ -182,7 +182,7 @@ t[#t+1] = Def.ActorFrame{
self:settextf("NA")
self:diffuse(getGradeColor("Grade_Failed"))
else
self:settextf("%05.2f%%", GetPercentDP(score))
self:settextf("%05.2f%%", score:GetPercentDP()*100)
self:diffuse(getGradeColor(score:GetGrade()))
end
else
Expand Down
9 changes: 8 additions & 1 deletion Themes/Til Death/Scripts/00 Utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,14 @@ function isScoreValid(pn,steps,score)
if score:GetGrade() == "Grade_Failed" then
return true
end
if not (steps:GetRadarValues(pn):GetValue('RadarCategory_TapsAndHolds') ==
local numNotes = 0;
if score:GetChordCohesion() == true then
numNotes = steps:GetRadarValues(pn):GetValue('RadarCategory_TapsAndHolds');
else
numNotes = steps:GetRadarValues(pn):GetValue('RadarCategory_Notes');
end

if not (numNotes ==
(score:GetTapNoteScore('TapNoteScore_W1')+
score:GetTapNoteScore('TapNoteScore_W2')+
score:GetTapNoteScore('TapNoteScore_W3')+
Expand Down
12 changes: 6 additions & 6 deletions Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1348,18 +1348,18 @@ FrameOverP2OnCommand=
FrameOverP2OffCommand=

[ScoreKeeperNormal]
PercentScoreWeightCheckpointHit=3
PercentScoreWeightCheckpointMiss=0
PercentScoreWeightHeld=IsGame("pump") and 0 or 3
PercentScoreWeightHitMine=-2
PercentScoreWeightCheckpointHit=2
PercentScoreWeightCheckpointMiss=-8
PercentScoreWeightHeld=IsGame("pump") and 0 or 6
PercentScoreWeightHitMine=-8
PercentScoreWeightMissedHold=0
PercentScoreWeightLetGo=0
PercentScoreWeightMiss=0
PercentScoreWeightMiss=-8
PercentScoreWeightW1=2
PercentScoreWeightW2=2
PercentScoreWeightW3=1
PercentScoreWeightW4=0
PercentScoreWeightW5=0
PercentScoreWeightW5=-4
GradeWeightCheckpointHit=2
GradeWeightCheckpointMiss=-8
GradeWeightHeld=IsGame("pump") and 0 or 6
Expand Down
2 changes: 2 additions & 0 deletions src/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2815,6 +2815,7 @@ class LunaGameState: public Luna<GameState>
DEFINE_METHOD( GetCoinMode, GetCoinMode() )
DEFINE_METHOD( GetPremium, GetPremium() )
DEFINE_METHOD( GetSongOptionsString, m_SongOptions.GetCurrent().GetString() )
DEFINE_METHOD( CountNotesSeparately, CountNotesSeparately() )
static int GetSessionTime(T* p, lua_State *L) { lua_pushnumber(L, p->m_timeGameStarted.GetTimeSinceStart()); return 1; }
static int GetSongOptions( T* p, lua_State *L )
{
Expand Down Expand Up @@ -3371,6 +3372,7 @@ class LunaGameState: public Luna<GameState>
ADD_METHOD( GetAutoGenFarg );
ADD_METHOD( SetAutoGenFarg );
ADD_METHOD( GetEtternaVersion );
ADD_METHOD( CountNotesSeparately );
}
};

Expand Down
8 changes: 8 additions & 0 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct HighScoreImpl
float fSurviveSeconds;
float fMusicRate;
float fJudgeScale;
bool bNoChordCohesion;
bool bEtternaValid;
vector<float> vOffsetVector;
vector<int> vNoteRowVector;
Expand Down Expand Up @@ -221,6 +222,7 @@ XNode *HighScoreImpl::CreateNode() const
pNode->AppendChild( "SSRNormPercent", fSSRNormPercent);
pNode->AppendChild( "Rate", fMusicRate);
pNode->AppendChild( "JudgeScale", fJudgeScale);
pNode->AppendChild( "NoChordCohesion", bNoChordCohesion);
pNode->AppendChild( "EtternaValid", bEtternaValid);

if (vOffsetVector.size() > 1) {
Expand Down Expand Up @@ -278,6 +280,7 @@ void HighScoreImpl::LoadFromNode(const XNode *pNode)
pNode->GetChildValue("SSRNormPercent", fSSRNormPercent);
pNode->GetChildValue("Rate", fMusicRate);
pNode->GetChildValue("JudgeScale", fJudgeScale);
pNode->GetChildValue("NoChordCohesion", bNoChordCohesion);
pNode->GetChildValue("EtternaValid", bEtternaValid);
pNode->GetChildValue("Offsets", s); vOffsetVector = OffsetsToVector(s);
pNode->GetChildValue("NoteRows", s); vNoteRowVector = NoteRowsToVector(s);
Expand Down Expand Up @@ -460,6 +463,8 @@ float HighScore::GetWifeScore() const { return m_Impl->fWifeScore; }
float HighScore::GetSSRNormPercent() const { return m_Impl->fSSRNormPercent; }
float HighScore::GetMusicRate() const { return m_Impl->fMusicRate; }
float HighScore::GetJudgeScale() const { return m_Impl->fJudgeScale; }
bool HighScore::GetChordCohesion() const {
return !m_Impl->bNoChordCohesion; }
bool HighScore::GetEtternaValid() const { return m_Impl->bEtternaValid; }
float HighScore::GetSurviveSeconds() const { return m_Impl->fSurviveSeconds; }
float HighScore::GetSurvivalSeconds() const { return GetSurviveSeconds() + GetLifeRemainingSeconds(); }
Expand Down Expand Up @@ -488,6 +493,7 @@ void HighScore::SetWifeScore(float f) {m_Impl->fWifeScore = f;}
void HighScore::SetSSRNormPercent(float f) { m_Impl->fSSRNormPercent = f; }
void HighScore::SetMusicRate(float f) { m_Impl->fMusicRate = f; }
void HighScore::SetJudgeScale(float f) { m_Impl->fJudgeScale = f; }
void HighScore::SetChordCohesion(bool b) { m_Impl->bNoChordCohesion = b; }
void HighScore::SetEtternaValid(bool b) { m_Impl->bEtternaValid = b; }
void HighScore::SetOffsetVector(const vector<float>& v) { m_Impl->vOffsetVector = v; }
void HighScore::SetNoteRowVector(const vector<int>& v) { m_Impl->vNoteRowVector = v; }
Expand Down Expand Up @@ -948,6 +954,7 @@ class LunaHighScore: public Luna<HighScore>
DEFINE_METHOD( ConvertDpToWife, ConvertDpToWife())
DEFINE_METHOD( GetStageAward, GetStageAward() )
DEFINE_METHOD( GetPeakComboAward, GetPeakComboAward() )
DEFINE_METHOD( GetChordCohesion, GetChordCohesion() )
DEFINE_METHOD( GetEtternaValid , GetEtternaValid())
LunaHighScore()
{
Expand All @@ -962,6 +969,7 @@ class LunaHighScore: public Luna<HighScore>
ADD_METHOD( GetSkillsetSSR );
ADD_METHOD( GetMusicRate );
ADD_METHOD( GetJudgeScale );
ADD_METHOD( GetChordCohesion );
ADD_METHOD( GetDate );
ADD_METHOD( GetSurvivalSeconds );
ADD_METHOD( IsFillInMarker );
Expand Down
2 changes: 2 additions & 0 deletions src/HighScore.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct HighScore
float GetSSRNormPercent() const;
float GetMusicRate() const;
float GetJudgeScale() const;
bool GetChordCohesion() const;
bool GetEtternaValid() const;
/**
* @brief Determine how many seconds the player had left in Survival mode.
Expand Down Expand Up @@ -84,6 +85,7 @@ struct HighScore
void SetSSRNormPercent(float f);
void SetMusicRate(float f);
void SetJudgeScale(float f);
void SetChordCohesion(bool b);
void SetEtternaValid(bool b);
void SetOffsetVector(const vector<float>& v);
void SetNoteRowVector(const vector<int>& v);
Expand Down
14 changes: 1 addition & 13 deletions src/ScoreKeeperNormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,9 @@ int ScoreKeeperNormal::GetPossibleDancePoints( NoteData* nd, const TimingData* t
int ret = 0;

if ( GAMESTATE->CountNotesSeparately() )
{
for ( int i = 0; i < nd->GetNumTracks(); i++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK(*nd, i, row)
{
TapNote tap = nd->GetTapNote(i, row);
if( tap.IsNote() )
ret += TapNoteScoreToDancePoints(TNS_W1, false);
}
}
}
ret += int(radars[RadarCategory_Notes]) * TapNoteScoreToDancePoints(TNS_W1, false);
else
{
ret += int(radars[RadarCategory_TapsAndHolds]) * TapNoteScoreToDancePoints(TNS_W1, false);
}

ret += int(radars[RadarCategory_Holds]) * HoldNoteScoreToDancePoints(HNS_Held, false);
ret += int(radars[RadarCategory_Rolls]) * HoldNoteScoreToDancePoints(HNS_Held, false);
Expand Down
3 changes: 2 additions & 1 deletion src/StageStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ static HighScore FillInHighScore( const PlayerStageStats &pss, const PlayerState
FOREACH_ENUM(Skillset, ss)
hs.SetSkillsetSSR(ss, 0.f);
}

hs.SetMusicRate( GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate);
hs.SetJudgeScale( pss.GetTimingScale());
hs.SetChordCohesion( GAMESTATE->CountNotesSeparately() );
hs.SetAliveSeconds( pss.m_fAliveSeconds );
hs.SetMaxCombo( pss.GetMaxCombo().m_cnt );
hs.SetStageAward( pss.m_StageAward );
Expand Down

0 comments on commit e6024e2

Please sign in to comment.