Skip to content

Commit

Permalink
NOT EVEN SURE I IMPROVED ANYTHING
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Apr 23, 2020
1 parent c4ede5b commit 255ad93
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 92 deletions.
133 changes: 75 additions & 58 deletions Themes/Til Death/BGAnimations/_calcdisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ local function convertPercentToIndexForMods(x)
if output < 0 then output = 0 end
if output > 1 then output = 1 end

local ind = notShit.round(output * #graphVecs[1][1])
local ind = notShit.round(output * #graphVecs["Jump"][1])
if ind < 1 then ind = 1 end
return ind
end
Expand Down Expand Up @@ -182,25 +182,15 @@ local function updateCoolStuff()
if k == "CalcDiffValue" then
for j = 1, #graphVecs[v[i]][h] do
local val = graphVecs[v[i]][h][j]
if val < lowerGraphMin then lowerGraphMin = val end
if val > lowerGraphMax then lowerGraphMax = val end
end
end
end
end
end

-- hardcode these numbers for constant upper graph bounds
upperGraphMin = 0.4
upperGraphMax = 1.3
--[[-- uncomment to have adaptive upper graph
for _, line in ipairs(graphVecs[1]) do
for ind, val in pairs(line) do
if val < upperGraphMin then upperGraphMin = val end
if val > upperGraphMax then upperGraphMax = val end
end
end]]
-- same as immediately above
upperGraphMin = 0.3
upperGraphMax = 1.2
else
graphVecs = {}
end
Expand Down Expand Up @@ -255,9 +245,9 @@ local o =
end
}
}
local gg= {}

-- graph bg
gg[#o + 1] = Def.Quad {
o[#o + 1] = Def.Quad {
InitCommand = function(self)
self:zoomto(plotWidth, plotHeight):diffuse(color("#232323")):diffusealpha(
bgalpha
Expand Down Expand Up @@ -290,24 +280,35 @@ gg[#o + 1] = Def.Quad {
bg:x(goodXPos)
bg:y(ypos + 3)
local index = convertPercentToIndexForMods(perc)

local farts = {}
local toofartstoofury = ""
local fartsfartsFOUR = {}
for i, mod in pairs(CalcDebugTypes["CalcPatternMod"]) do
for h = 1, 2 do
local blah = "L"
if h == 2 then
blah = "R"
end
farts[#farts + 1] = graphVecs[mod][h]
fartsfartsFOUR[#fartsfartsFOUR + 1] = mod..blah
end
end
-- add stammod
for h = 1, 2 do
local blah = "L"
if h == 2 then
blah = "R"
end
farts[#farts + 1] = graphVecs["StamMod"][h]
fartsfartsFOUR[#fartsfartsFOUR + 1] = "StamMod"..blah
end

-- this is so bad it ceases to be lazy, it's more work than iterating :|
local ohjl = graphVecs[1][1][index]
local ohjr = graphVecs[1][2][index]
local anchrl = graphVecs[1][3][index]
local anchrr = graphVecs[1][4][index]
local rolll = graphVecs[1][5][index]
local rollr = graphVecs[1][6][index]
local hsdsl = graphVecs[1][7][index]
local hsdsr = graphVecs[1][8][index]
local jumpdsl = graphVecs[1][9][index]
local jumpdsr = graphVecs[1][10][index]
local cjl = graphVecs[1][11][index]
local cjr = graphVecs[1][12][index]
local sl = graphVecs[1][13][index]
local sr = graphVecs[1][14][index]
txt:settextf("ohjl: %5.4f\nohjr: %5.4f\nanchrl: %5.4f\nanchrr: %5.4f\nrolll: %5.4f\nrollr: %5.4f\nhsdsl: %5.4f\nhsdsr: %5.4f\njumpdsl: %5.4f\njumpdsr: %5.4f\nsl: %5.4f\nsr: %5.4f\ncjl: %5.4f\ncjr: %5.4f",
ohjl, ohjr, anchrl, anchrr, rolll, rollr, hsdsl, hsdsr, jumpdsl, jumpdsr, sl, sr, cjl, cjr)
for k, v in pairs(farts) do
local txt = string.format(fartsfartsFOUR[k]..": %5.4f\n", v[index])
toofartstoofury = toofartstoofury .. txt
end
txt:settext(toofartstoofury)
else
bar:visible(false)
txt:visible(false)
Expand All @@ -317,7 +318,7 @@ gg[#o + 1] = Def.Quad {
}

-- second bg
gg[#o + 1] = Def.Quad {
o[#o + 1] = Def.Quad {
Name = "G2BG",
InitCommand = function(self)
self:y(plotHeight + 5)
Expand Down Expand Up @@ -353,23 +354,36 @@ gg[#o + 1] = Def.Quad {
bg:y(ypos + 3)

local index = convertPercentToIndexForMods(perc)
local npsl = graphVecs[2][1][index]
local npsr = graphVecs[2][2][index]
local msl = graphVecs[2][3][index]
local msr = graphVecs[2][4][index]
local bmsdl = graphVecs[2][5][index]
local bmsdr = graphVecs[2][6][index]
local msdl = graphVecs[2][7][index]
local msdr = graphVecs[2][8][index]
local pll = graphVecs[2][9][index]
local plr = graphVecs[2][10][index]
if msdl == nil then
txt:settext("")
else
txt:settextf("npsl: %5.4f\nnpsr: %5.4f\nmsl: %5.4f\nmsr: %5.4f\nbmsdl: %5.4f\nbmsdr: %5.4f\nmsdl: %5.4f\nmsdr: %5.4f\npll: %5.4f\nplr: %5.4f",
npsl, npsr, msl, msr, bmsdl, bmsdr, msdl, msdr, pll, plr)
--txt:settextf("Percent: %5.4f\nOverall: %.2f\nStream: %.2f\nJumpstream: %.2f\nHandstream: %.2f\nStamina: %.2f\nJackspeed: %.2f\nChordjack: %.2f\nTechnical: %.2f", (ssrLowerBoundWife + (ssrUpperBoundWife-ssrLowerBoundWife)*perc)*100, ovrl, strm, js, hs, stam, jack, chjk, tech)
local farts = {}
local toofartstoofury = ""
local fartsfartsFOUR = {}
for i, mod in pairs(CalcDebugTypes["CalcDiffValue"]) do
for h = 1, 2 do
local blah = "L"
if h == 2 then
blah = "R"
end
farts[#farts + 1] = graphVecs[mod][h]
fartsfartsFOUR[#fartsfartsFOUR + 1] = mod..blah
end
end

-- add ptloss
for h = 1, 2 do
local blah = "L"
if h == 2 then
blah = "R"
end
farts[#farts + 1] = graphVecs["PtLoss"][h]
fartsfartsFOUR[#fartsfartsFOUR + 1] = "PtLoss"..blah
end

for k, v in pairs(farts) do
local txt = string.format(fartsfartsFOUR[k]..": %5.4f\n", v[index])
toofartstoofury = toofartstoofury .. txt
end

txt:settext(toofartstoofury)
else
bar:visible(false)
txt:visible(false)
Expand Down Expand Up @@ -404,7 +418,7 @@ o[#o + 1] = LoadFont("Common Normal") .. {
5 = Jumpstream downscaler
anything else = no output
]]
modnames = {
local modnames = {
"ohjl",
"ohjr",
"anchl",
Expand Down Expand Up @@ -466,7 +480,7 @@ makeskillsetlabeltext = function(i, mod, hand)
end
end
self:diffuse(modColors[i])
self:settextf("%s: %.4f", modnames[i * 2 ], aves[i])
self:settextf("%s: %.4f", modnames[i], aves[i])
end
end
}
Expand All @@ -475,13 +489,13 @@ end
-- lower graph average text
o[#o + 1] = LoadFont("Common Normal") .. {
InitCommand = function(self)
self:xy(-plotWidth/2 + 5, plotHeight + plotHeight/3):halign(0)
self:xy(-plotWidth/2 + 5, plotHeight/2 + 20):halign(0)
self:zoom(0.5)
self:settext("")
end,
DoTheThingCommand = function(self)
if song and enabled then
self:settextf("Upper Bound: %.4f\nLower Bound: %.4f", lowerGraphMax, lowerGraphMin)
self:settextf("Upper Bound: %.4f", lowerGraphMax)
end
end
}
Expand Down Expand Up @@ -622,15 +636,18 @@ end
-- add stam since it's not technically a pattern mod
o[#o+1] = topGraphLine("StamMod", modColors[(#CalcDebugTypes["CalcPatternMod"] * 2) + 1], 1)
o[#o+1] = topGraphLine("StamMod", modColors[(#CalcDebugTypes["CalcPatternMod"] * 2) + 2], 2)
o[#o+1] = makeskillsetlabeltext((#CalcDebugTypes["CalcPatternMod"] * 2) + 1, "StamMod", 1)
o[#o+1] = makeskillsetlabeltext((#CalcDebugTypes["CalcPatternMod"] * 2) + 2, "StamMod", 2)
o[#o+1] = topGraphLine("base_line", modColors[14]) -- super hack to make 1.0 value indicator line

for i, mod in pairs(CalcDebugTypes["CalcDiffValue"]) do
--o[#o+1] = bottomGraphLine(i, skillsetColors[i])
o[#o+1] = bottomGraphLineMSD(mod, skillsetColors[(i * 2) - 1], 1)
o[#o+1] = bottomGraphLineMSD(mod, skillsetColors[i * 2], 2)
if i > 2 then -- cut out the base stuff atm cause noise
o[#o+1] = bottomGraphLineMSD(mod, skillsetColors[(i * 2) - 1], 1)
o[#o+1] = bottomGraphLineMSD(mod, skillsetColors[i * 2], 2)
end
end
o[#o+1] = topGraphLine("PtLoss", skillsetColors[(#CalcDebugTypes["CalcPatternMod"] * 2) + 1], 1)
o[#o+1] = topGraphLine("PtLoss", skillsetColors[(#CalcDebugTypes["CalcPatternMod"] * 2) + 2], 2)
o[#o+1] = bottomGraphLineMSD("PtLoss", skillsetColors[(#CalcDebugTypes["CalcDiffValue"] * 2) + 1], 1)
o[#o+1] = bottomGraphLineMSD("PtLoss", skillsetColors[(#CalcDebugTypes["CalcDiffValue"] * 2) + 2], 2)

-- a bunch of things for stuff and things
o[#o + 1] = LoadFont("Common Normal") .. {
Expand Down
41 changes: 21 additions & 20 deletions src/Etterna/Globals/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,6 @@ Calc::InitializeHands(const vector<NoteInfo>& NoteInfo, float music_rate)
numitv = static_cast<int>(
std::ceil(NoteInfo.back().rowTime / (music_rate * IntervalSpan)));

if (debugmode) {
left_hand.debugValues.resize(DebugCount);
right_hand.debugValues.resize(DebugCount);
for (int i = 0; i < DebugCount; ++i) {
left_hand.debugValues[i].resize(numitv);
right_hand.debugValues[i].resize(numitv);
}
}

// these get changed/updated frequently so allocate them once at the start
left_hand.adj_diff.resize(numitv);
right_hand.adj_diff.resize(numitv);
Expand Down Expand Up @@ -426,15 +417,24 @@ Calc::InitializeHands(const vector<NoteInfo>& NoteInfo, float music_rate)

// pattern mods and base msd never change so set them immediately
if (debugmode) {
left_hand.debugValues.resize(3);
right_hand.debugValues.resize(3);
left_hand.debugValues[0].resize(NUM_CalcPatternMod);
right_hand.debugValues[0].resize(NUM_CalcPatternMod);
left_hand.debugValues[1].resize(NUM_CalcDiffValue);
right_hand.debugValues[1].resize(NUM_CalcDiffValue);
left_hand.debugValues[2].resize(NUM_CalcDebugMisc);
right_hand.debugValues[2].resize(NUM_CalcDebugMisc);

for (size_t i = 0; i < ModCount; ++i) {
left_hand.debugValues[i] = left_hand.doot[i];
right_hand.debugValues[i] = right_hand.doot[i];
left_hand.debugValues[0][i] = left_hand.doot[i];
right_hand.debugValues[0][i] = right_hand.doot[i];
}

// set everything but final adjusted output here
for (size_t i = 0; i < NUM_CalcDiffValue - 1; ++i) {
left_hand.debugValues[i] = left_hand.soap[i];
right_hand.debugValues[i] = right_hand.soap[i];
left_hand.debugValues[1][i] = left_hand.soap[i];
right_hand.debugValues[1][i] = right_hand.soap[i];
}
}

Expand Down Expand Up @@ -588,7 +588,7 @@ Hand::StamAdjust(float x, vector<float>& diff, bool debug)
mod = CalcClamp(mod, floor, ceil);
stam_adj_diff[i] = diff[i] * mod;
if (debug)
debugValues[StamMod][i] = mod;
debugValues[2][StamMod][i] = mod;
}
}

Expand Down Expand Up @@ -653,10 +653,11 @@ Hand::CalcInternal(float x, int ss, bool stam, bool debug)
const vector<float>& v = stam ? stam_adj_diff : adj_diff;

if (debug) {

debugValues[2][StamMod].resize(v.size());
debugValues[2][PtLoss].resize(v.size());
// final debug output should always be with stam activated
StamAdjust(x, adj_diff, true);
debugValues[MSD] = stam_adj_diff;
debugValues[1][MSD] = stam_adj_diff;
}

float output = 0.f;
Expand All @@ -667,7 +668,7 @@ Hand::CalcInternal(float x, int ss, bool stam, bool debug)

output += gainedpoints;
if (debug)
debugValues[PtLoss][i] =
debugValues[2][PtLoss][i] =
(static_cast<float>(v_itvpoints[i]) - gainedpoints);
}

Expand Down Expand Up @@ -1046,7 +1047,7 @@ void
MinaSDCalcDebug(const vector<NoteInfo>& NoteInfo,
float musicrate,
float goal,
vector<vector<vector<float>>>& handInfo)
vector<vector<vector<vector<float>>>>& handInfo)
{
if (NoteInfo.size() <= 1)
return;
Expand All @@ -1056,8 +1057,8 @@ MinaSDCalcDebug(const vector<NoteInfo>& NoteInfo,
debugRun->CalcMain(NoteInfo, musicrate, min(goal, ssrcap));

// Locate and modify the uses of left/right debug in the code
handInfo.push_back(debugRun->left_hand.debugValues);
handInfo.push_back(debugRun->right_hand.debugValues);
handInfo.emplace_back(debugRun->left_hand.debugValues);
handInfo.emplace_back(debugRun->right_hand.debugValues);
}

int
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/Globals/MinaCalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Hand
// on the above, and it needs to be recalculated every time the player_skill
// value changes, again based on the above
std::vector<float> stam_adj_diff;
std::vector<std::vector<float>> debugValues;
std::vector<std::vector<std::vector<float>>> debugValues;

private:
const bool SmoothDifficulty =
Expand Down Expand Up @@ -220,6 +220,6 @@ MINACALC_API void
MinaSDCalcDebug(const std::vector<NoteInfo>& NoteInfo,
float musicrate,
float goal,
std::vector<std::vector<std::vector<float>>>& handInfo);
std::vector<std::vector<std::vector<std::vector<float>>>>& handInfo);
MINACALC_API int
GetCalcVersion();
22 changes: 11 additions & 11 deletions src/Etterna/Models/StepsAndStyles/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1002,37 +1002,37 @@ class LunaSteps : public Luna<Steps>
L, CalcPatternModToString(static_cast<CalcPatternMod>(i)));
lua_createtable(L, 0, 2);
for (int j = 0; j < 2; ++j) {
vector<float> poop = p->calcdebugoutput[j][i];
vector<float> poop = p->calcdebugoutput[j][0][i];
LuaHelpers::CreateTableFromArray(poop, L);
lua_rawseti(L, -2, j + 1);
}
lua_rawset(L, -3);
}
lua_rawset(L, -3);

lua_pushstring(L, RString("CalcDebugMisc"));
lua_createtable(L, 0, NUM_CalcDebugMisc);
for (int i = 0; i < NUM_CalcDebugMisc; ++i) {
lua_pushstring(L, RString("CalcDiffValue"));
lua_createtable(L, 0, NUM_CalcDiffValue);
for (int i = 0; i < NUM_CalcDiffValue; ++i) {
lua_pushstring(
L, CalcDebugMiscToString(static_cast<CalcDebugMisc>(i)));
L, CalcDiffValueToString(static_cast<CalcDiffValue>(i)));
lua_createtable(L, 0, 2);
for (int j = 0; j < 2; ++j) {
vector<float> poop = p->calcdebugoutput[j][i];
vector<float> poop = p->calcdebugoutput[j][1][i];
LuaHelpers::CreateTableFromArray(poop, L);
lua_rawseti(L, -2, j + 1);
}
lua_rawset(L, -3);
}
lua_rawset(L, -3);

lua_pushstring(L, RString("CalcDiffValue"));
lua_createtable(L, 0, NUM_CalcDiffValue);
for (int i = 0; i < NUM_CalcDiffValue; ++i) {
lua_pushstring(L, RString("CalcDebugMisc"));
lua_createtable(L, 0, NUM_CalcDebugMisc);
for (int i = 0; i < NUM_CalcDebugMisc; ++i) {
lua_pushstring(
L, CalcDiffValueToString(static_cast<CalcDiffValue>(i)));
L, CalcDebugMiscToString(static_cast<CalcDebugMisc>(i)));
lua_createtable(L, 0, 2);
for (int j = 0; j < 2; ++j) {
vector<float> poop = p->calcdebugoutput[j][i];
vector<float> poop = p->calcdebugoutput[j][2][i];
LuaHelpers::CreateTableFromArray(poop, L);
lua_rawseti(L, -2, j + 1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/StepsAndStyles/Steps.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class Steps
void CalcEtternaMetadata();
float DoATestThing(float ev, Skillset ss);
void GetCalcDebugOutput(); // now spits out everything with 1 calc call
vector<vector<vector<float>>> calcdebugoutput; // probably should clear this periodically
vector<vector<vector<vector<float>>>> calcdebugoutput; // probably should clear this periodically

string GenerateBustedChartKey(NoteData& nd, TimingData* td, int cores);
vector<string> bustedkeys;
Expand Down

0 comments on commit 255ad93

Please sign in to comment.