From e6024e2bb44cbdb97da0394ab6565d9eb535ea6c Mon Sep 17 00:00:00 2001 From: xwidghet Date: Wed, 15 Mar 2017 04:41:23 -0700 Subject: [PATCH] Add chord cohesion flag to scores, and fix built-in DP scoring. Added lua call CountNotesSeparately so themers can check if chord cohesion is currently being used. --- .../ScreenEvaluation decorations/default.lua | 12 +++++++++ .../ScreenSelectMusic decorations/score.lua | 26 +++++++++++++------ .../wifeTwirl.lua | 4 +-- Themes/Til Death/Scripts/00 Utility.lua | 9 ++++++- Themes/_fallback/metrics.ini | 12 ++++----- src/GameState.cpp | 2 ++ src/HighScore.cpp | 8 ++++++ src/HighScore.h | 2 ++ src/ScoreKeeperNormal.cpp | 14 +--------- src/StageStats.cpp | 3 ++- 10 files changed, 61 insertions(+), 31 deletions(-) diff --git a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua index 4b864ce9de..8a509c016d 100644 --- a/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua +++ b/Themes/Til Death/BGAnimations/ScreenEvaluation decorations/default.lua @@ -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"))}; diff --git a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/score.lua b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/score.lua index 97ed10a6dc..ce50cbd2a5 100644 --- a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/score.lua +++ b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/score.lua @@ -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 @@ -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), diff --git a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua index 25595ced27..1517851d84 100644 --- a/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua +++ b/Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/wifeTwirl.lua @@ -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) @@ -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 diff --git a/Themes/Til Death/Scripts/00 Utility.lua b/Themes/Til Death/Scripts/00 Utility.lua index 1e36032ac5..c7d60d508a 100644 --- a/Themes/Til Death/Scripts/00 Utility.lua +++ b/Themes/Til Death/Scripts/00 Utility.lua @@ -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')+ diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 39c96699a9..2694288234 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -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 diff --git a/src/GameState.cpp b/src/GameState.cpp index 82bd81ccdf..9162ae35e7 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -2815,6 +2815,7 @@ class LunaGameState: public Luna 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 ) { @@ -3371,6 +3372,7 @@ class LunaGameState: public Luna ADD_METHOD( GetAutoGenFarg ); ADD_METHOD( SetAutoGenFarg ); ADD_METHOD( GetEtternaVersion ); + ADD_METHOD( CountNotesSeparately ); } }; diff --git a/src/HighScore.cpp b/src/HighScore.cpp index bf8fe25473..2627a48d30 100644 --- a/src/HighScore.cpp +++ b/src/HighScore.cpp @@ -30,6 +30,7 @@ struct HighScoreImpl float fSurviveSeconds; float fMusicRate; float fJudgeScale; + bool bNoChordCohesion; bool bEtternaValid; vector vOffsetVector; vector vNoteRowVector; @@ -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) { @@ -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); @@ -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(); } @@ -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& v) { m_Impl->vOffsetVector = v; } void HighScore::SetNoteRowVector(const vector& v) { m_Impl->vNoteRowVector = v; } @@ -948,6 +954,7 @@ class LunaHighScore: public Luna DEFINE_METHOD( ConvertDpToWife, ConvertDpToWife()) DEFINE_METHOD( GetStageAward, GetStageAward() ) DEFINE_METHOD( GetPeakComboAward, GetPeakComboAward() ) + DEFINE_METHOD( GetChordCohesion, GetChordCohesion() ) DEFINE_METHOD( GetEtternaValid , GetEtternaValid()) LunaHighScore() { @@ -962,6 +969,7 @@ class LunaHighScore: public Luna ADD_METHOD( GetSkillsetSSR ); ADD_METHOD( GetMusicRate ); ADD_METHOD( GetJudgeScale ); + ADD_METHOD( GetChordCohesion ); ADD_METHOD( GetDate ); ADD_METHOD( GetSurvivalSeconds ); ADD_METHOD( IsFillInMarker ); diff --git a/src/HighScore.h b/src/HighScore.h index e4eef783f1..0b2711734b 100644 --- a/src/HighScore.h +++ b/src/HighScore.h @@ -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. @@ -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& v); void SetNoteRowVector(const vector& v); diff --git a/src/ScoreKeeperNormal.cpp b/src/ScoreKeeperNormal.cpp index 0163b95d49..43eff1cd74 100644 --- a/src/ScoreKeeperNormal.cpp +++ b/src/ScoreKeeperNormal.cpp @@ -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); diff --git a/src/StageStats.cpp b/src/StageStats.cpp index d8af4d30b4..df2ec0a467 100644 --- a/src/StageStats.cpp +++ b/src/StageStats.cpp @@ -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 );