Skip to content

Commit

Permalink
dummy up basic chaos detector
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Apr 24, 2020
1 parent cc5b6be commit 3f88fd9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 11 deletions.
20 changes: 16 additions & 4 deletions Themes/Til Death/BGAnimations/_calcdisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,13 @@ local modnames = {
"cjl",
"cjr",
"sl",
"sr"
"sr",
"stl",
"str",
"ohtl",
"ohtr",
"cl",
"cr"
}

local modColors = {
Expand All @@ -452,16 +458,22 @@ local modColors = {
color("1.4,1.3,1"),
color("1.4,1.3,0.9"),
color(".4,1.3,1"),
color(".4,1.3,0.9")
color(".4,1.3,0.9"),
color(".7,1.3,1"),
color(".7,1.3,0.9"),
color(".4,0.9,0.3"),
color(".4,0.9,0.3"),
color(".4,0.5,0.59"),
color(".4,0.3,0.49")
}

-- top graph average text
makeskillsetlabeltext = function(i, mod, hand)
return LoadFont("Common Normal") .. {
InitCommand = function(self)
local xspace = 30 -- this is gonna look like shit on 4:3 no matter what so w.e
local xspace = 22 -- this is gonna look like shit on 4:3 no matter what so w.e
self:xy(-plotWidth/2 + 5 + ((i -1) * xspace), plotHeight/3):halign(0)
self:zoom(0.35)
self:zoom(0.3)
self:settext("")
self:maxwidth((plotWidth-10) / 0.5)
if hand % 2 == 0 then
Expand Down
40 changes: 33 additions & 7 deletions src/Etterna/Globals/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ Calc::CalcMain(const vector<NoteInfo>& NoteInfo,
4.5f - difficulty.technical + difficulty.jumpstream, 0.f, 4.5f);
}
*/

difficulty.overall = highest_difficulty(difficulty);
Expand Down Expand Up @@ -804,7 +804,7 @@ Calc::SetCJMod(const vector<NoteInfo>& NoteInfo, vector<float> doot[])

doot[CJ][i] =
CalcClamp(sqrt(sqrt(1.f - (static_cast<float>(chordtaps) /
static_cast<float>(taps) / 3.f))),
static_cast<float>(taps) / 3.f))),
0.5f,
1.f);
}
Expand All @@ -821,7 +821,7 @@ Calc::SetStreamMod(const vector<NoteInfo>& NoteInfo,
for (size_t i = 0; i < nervIntervals.size(); i++) {
unsigned int taps = 0;
unsigned int singletaps = 0;

for (int row : nervIntervals[i]) {
unsigned int notes = column_count(NoteInfo[row].notes);
taps += notes;
Expand All @@ -834,7 +834,8 @@ Calc::SetStreamMod(const vector<NoteInfo>& NoteInfo,
continue;
}

doot[StreamMod][i] = CalcClamp(sqrt(sqrt(1.f - (static_cast<float>(singletaps) /
doot[StreamMod][i] =
CalcClamp(sqrt(sqrt(1.f - (static_cast<float>(singletaps) /
static_cast<float>(taps) / 3.f))),
0.5f,
1.f);
Expand Down Expand Up @@ -884,6 +885,9 @@ Calc::SetSequentialDownscalers(const vector<NoteInfo>& NoteInfo,
int maxseqjumptaps = 0; // basically the biggest sequence of ohj
float ohj = 0.f;

// BEWOOP
vector<float> whatwhat;

for (int row : nervIntervals[i]) {
bool lcol = NoteInfo[row].notes & t1;
bool rcol = NoteInfo[row].notes & t2;
Expand All @@ -904,6 +908,10 @@ Calc::SetSequentialDownscalers(const vector<NoteInfo>& NoteInfo,
else
lastcol = 1;

// dunno what im doing with this yet
if (!lastcol == -1)
whatwhat.push_back(curtime - lasttime);

// yes we want to set this for jumps
lasttime = curtime;

Expand All @@ -913,8 +921,11 @@ Calc::SetSequentialDownscalers(const vector<NoteInfo>& NoteInfo,

// set the largest ohj sequence
maxseqjumptaps = max(maxseqjumptaps, jumptaps);

continue;
}
// push to thing i dunno what im doing with yet
whatwhat.push_back(curtime - lasttime);

int thiscol = lcol < rcol;
if (thiscol != lastcol) { // ignore consecutive notes
Expand Down Expand Up @@ -970,6 +981,21 @@ Calc::SetSequentialDownscalers(const vector<NoteInfo>& NoteInfo,

lastcol = thiscol;
}

// something something push up polyrhythms???
float butt = 0.f;
std::sort(whatwhat.begin(), whatwhat.end());
if (whatwhat.size() <= 1)
butt = 1.f;
else
for (auto in : whatwhat)
for (auto the : whatwhat)
butt += static_cast<float>(static_cast<int>(in * 1000.f) %
static_cast<int>(1000.f * the));

if (!whatwhat.empty())
butt /= static_cast<float>(whatwhat.size()) * 1000.f;

int cvtaps = ltaps + rtaps;

// if this is true we have some combination of single notes and
Expand All @@ -990,7 +1016,7 @@ Calc::SetSequentialDownscalers(const vector<NoteInfo>& NoteInfo,
// no rolls here by definition
doot[Roll][i] = 1.f;
doot[OHTrill][i] = 1.f;
doot[Chaos][i] = 1.f;
doot[Chaos][i] = butt;
continue;
}

Expand Down Expand Up @@ -1027,7 +1053,7 @@ Calc::SetSequentialDownscalers(const vector<NoteInfo>& NoteInfo,
}
yes_trills = cv - notrills; // store high oh trill detection in case
// we want to do stuff with it later
cv += notrills * 1.f; // just straight up add to cv
cv += notrills * 1.f; // just straight up add to cv
}

// then scaled against how many taps we ignored
Expand All @@ -1041,7 +1067,7 @@ Calc::SetSequentialDownscalers(const vector<NoteInfo>& NoteInfo,
// probably)
doot[Roll][i] = CalcClamp(0.5f + sqrt(cv), 0.5f, 1.f);
doot[OHTrill][i] = CalcClamp(0.5f + sqrt(cv), 0.8f, 1.f);
doot[Chaos][i] = 1.f;
doot[Chaos][i] = butt;

// ohj stuff, wip
if (jumptaps < 1 && maxseqjumptaps < 1)
Expand Down

0 comments on commit 3f88fd9

Please sign in to comment.