From 14a84db64fee6183dfb435a24f44facc3ba25668 Mon Sep 17 00:00:00 2001 From: Barinade Date: Fri, 25 Aug 2023 13:12:41 -0500 Subject: [PATCH] fix chord density graph lower bound problem no longer does nothing below 1.0x btw this is the same solution that used to crash BUT IT DOESNT NOW NO IDEA WHY --- Themes/Rebirth/BGAnimations/chordDensityGraph.lua | 4 ++-- Themes/Til Death/BGAnimations/_chorddensitygraph.lua | 5 ++--- src/Etterna/Models/StepsAndStyles/Steps.cpp | 12 +++++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Themes/Rebirth/BGAnimations/chordDensityGraph.lua b/Themes/Rebirth/BGAnimations/chordDensityGraph.lua index 3ec7ef1663..684deea587 100644 --- a/Themes/Rebirth/BGAnimations/chordDensityGraph.lua +++ b/Themes/Rebirth/BGAnimations/chordDensityGraph.lua @@ -133,7 +133,7 @@ end local function updateGraphMultiVertex(parent, self, steps) if steps then local ncol = steps:GetNumColumns() - local rate = math.max(1, getCurRateValue()) + local rate = math.max(0.05, getCurRateValue()) local graphVectors = steps:GetCDGraphVectors(rate) local txt = parent:GetChild("NPSText") if graphVectors == nil then @@ -146,7 +146,7 @@ local function updateGraphMultiVertex(parent, self, steps) local npsVector = graphVectors[1] -- refers to the cps vector for 1 (tap notes) local numberOfColumns = #npsVector - local columnWidth = sizing.Width / numberOfColumns * rate + local columnWidth = sizing.Width / numberOfColumns -- set height scale of graph relative to the max nps local heightScale = 0 diff --git a/Themes/Til Death/BGAnimations/_chorddensitygraph.lua b/Themes/Til Death/BGAnimations/_chorddensitygraph.lua index e9807e4279..e87cc765f9 100644 --- a/Themes/Til Death/BGAnimations/_chorddensitygraph.lua +++ b/Themes/Til Death/BGAnimations/_chorddensitygraph.lua @@ -45,7 +45,7 @@ local function updateGraphMultiVertex(parent, realgraph) local steps = GAMESTATE:GetCurrentSteps() if steps then local ncol = steps:GetNumColumns() - local rate = math.max(1, getCurRateValue()) + local rate = math.max(0.05, getCurRateValue()) local graphVectors = steps:GetCDGraphVectors(rate) if graphVectors == nil then -- reset everything if theres nothing to show @@ -57,8 +57,7 @@ local function updateGraphMultiVertex(parent, realgraph) local npsVector = graphVectors[1] -- refers to the cps vector for 1 (tap notes) parent.npsVector = npsVector local numberOfColumns = #npsVector - local columnWidth = wodth/numberOfColumns * rate - + local columnWidth = wodth/numberOfColumns -- set height scale of graph relative to the max nps local hodth = 0 for i=1,#npsVector do diff --git a/src/Etterna/Models/StepsAndStyles/Steps.cpp b/src/Etterna/Models/StepsAndStyles/Steps.cpp index 28c68d64e5..20eef53f24 100644 --- a/src/Etterna/Models/StepsAndStyles/Steps.cpp +++ b/src/Etterna/Models/StepsAndStyles/Steps.cpp @@ -726,7 +726,7 @@ Steps::GetNPSVector(const NoteData& nd, const std::vector& nerv, const float rate) -> std::vector { - std::vector doot(static_cast(etaner.back())); + std::vector doot(static_cast(etaner.back() / rate)); auto notecounter = 0; auto lastinterval = 0; @@ -797,9 +797,11 @@ Steps::GetCNPSVector(const NoteData& nd, const int chordsize, const float rate) -> std::vector { - std::vector doot(static_cast(etaner.back())); - auto chordnotecounter = 0; // number of NOTES inside chords of this size, so - // 5 jumps = 10 notes, 3 hands = 9 notes, etc + std::vector doot(static_cast(etaner.back() / rate)); + + // number of NOTES inside chords of this size, so + // 5 jumps = 10 notes, 3 hands = 9 notes, etc + auto chordnotecounter = 0; auto lastinterval = 0; for (auto i = 0; i < static_cast(nerv.size()); ++i) { @@ -1018,7 +1020,7 @@ class LunaSteps : public Luna } static auto GetCDGraphVectors(T* p, lua_State* L) -> int { - const auto rate = std::clamp(FArg(1), 0.7F, 3.F); + const auto rate = std::clamp(FArg(1), 0.05F, 3.F); auto nd = p->GetNoteData(); if (nd.IsEmpty()) { return 0;