Skip to content

Commit

Permalink
fix chord density graph lower bound problem
Browse files Browse the repository at this point in the history
no longer does nothing below 1.0x
btw this is the same solution that used to crash BUT IT DOESNT NOW NO IDEA WHY
  • Loading branch information
poco0317 committed Aug 25, 2023
1 parent f2177b7 commit 14a84db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Themes/Rebirth/BGAnimations/chordDensityGraph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions Themes/Til Death/BGAnimations/_chorddensitygraph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 7 additions & 5 deletions src/Etterna/Models/StepsAndStyles/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ Steps::GetNPSVector(const NoteData& nd,
const std::vector<int>& nerv,
const float rate) -> std::vector<int>
{
std::vector<int> doot(static_cast<int>(etaner.back()));
std::vector<int> doot(static_cast<int>(etaner.back() / rate));
auto notecounter = 0;
auto lastinterval = 0;

Expand Down Expand Up @@ -797,9 +797,11 @@ Steps::GetCNPSVector(const NoteData& nd,
const int chordsize,
const float rate) -> std::vector<int>
{
std::vector<int> doot(static_cast<int>(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<int> doot(static_cast<int>(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<int>(nerv.size()); ++i) {
Expand Down Expand Up @@ -1018,7 +1020,7 @@ class LunaSteps : public Luna<Steps>
}
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;
Expand Down

0 comments on commit 14a84db

Please sign in to comment.