Skip to content

Commit

Permalink
new plan actually call is judgable during nerv generation
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed May 8, 2020
1 parent 8de0e26 commit 9d63b19
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Etterna/Actor/Gameplay/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ Player::Load()
curwifescore = 0.f;
maxwifescore = 0.f;

m_NoteData.LogNonEmptyRows();
m_NoteData.LogNonEmptyRows(m_Timing);
nerv = m_NoteData.GetNonEmptyRowVector();
const vector<float>& etaner = m_Timing->BuildAndGetEtaner(nerv);
if (m_pPlayerStageStats != nullptr)
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/Misc/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ class LunaHighScore : public Luna<HighScore>
GAMESTATE->m_pCurSteps->GetTimingData());
auto* td = GAMESTATE->m_pCurSteps->GetTimingData();
auto nd = GAMESTATE->m_pCurSteps->GetNoteData();
auto nerv = nd.BuildAndGetNerv();
auto nerv = nd.BuildAndGetNerv(td);
auto sdifs = td->BuildAndGetEtaner(nerv);
vector<int> noterows;
for (auto t : timestamps) {
Expand Down
40 changes: 21 additions & 19 deletions src/Etterna/Models/NoteData/NoteData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,23 +223,24 @@ NoteData::SerializeNoteData2(TimingData* ts,
for (int t = 0; t < tracks; ++t) {
const auto& tm = m_TapNotes[t];
for (const auto& r : tm)
if (r.second.IsNote()) {
// initialize in map
auto res = lal.emplace(r.first, 1 << t);
if (!res.second)
// already added, but last column wasn't
// actually a tap, start here
if (lal.at(r.first) == 128)
lal.at(r.first) = 1 << t;
else
// already added and is a tap, update info
lal.at(r.first) |= 1 << t;
} else
// we need to keep track of more than just taps fo
// if we want to use this for key generation
// this won't alter tap values if there's something like
// 11MM
lal.emplace(r.first, 128);
if (ts->IsJudgableAtRow(r.first))
if (r.second.IsNote()) {
// initialize in map
auto res = lal.emplace(r.first, 1 << t);
if (!res.second)
// already added, but last column wasn't
// actually a tap, start here
if (lal.at(r.first) == 128)
lal.at(r.first) = 1 << t;
else
// already added and is a tap, update info
lal.at(r.first) |= 1 << t;
} else
// we need to keep track of more than just taps fo
// if we want to use this for key generation
// this won't alter tap values if there's something like
// 11MM
lal.emplace(r.first, 128);
}
NonEmptyRowVector.clear();
NonEmptyRowVector.reserve(lal.size());
Expand All @@ -266,11 +267,12 @@ NoteData::SerializeNoteData2(TimingData* ts,
}

void
NoteData::LogNonEmptyRows()
NoteData::LogNonEmptyRows(TimingData* ts)
{
NonEmptyRowVector.clear();
FOREACH_NONEMPTY_ROW_ALL_TRACKS(*this, row)
NonEmptyRowVector.emplace_back(row);
if (ts->IsJudgableAtRow(row))
NonEmptyRowVector.emplace_back(row);
}
/* significantly faster than the above, but use case is more restrictive
and it's not that big a deal
Expand Down
6 changes: 3 additions & 3 deletions src/Etterna/Models/NoteData/NoteData.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class NoteData
void Init();

// Mina stuf
void LogNonEmptyRows();
void LogNonEmptyRows(TimingData* ts);
void UnsetNerv() {
NonEmptyRowVector.clear();
NonEmptyRowVector.shrink_to_fit();
Expand All @@ -247,9 +247,9 @@ class NoteData
SerializedNoteData.clear();
SerializedNoteData.shrink_to_fit();
}
const vector<int>& BuildAndGetNerv()
const vector<int>& BuildAndGetNerv(TimingData* ts)
{
LogNonEmptyRows();
LogNonEmptyRows(ts);
return NonEmptyRowVector;
}
int WifeTotalScoreCalc(TimingData* td,
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/NoteLoaders/NotesLoaderSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ SMLoader::LoadNoteDataFromSimfile(const RString& path, Steps& out)
tmp.m_StepsType = out.m_StepsType;
tmp.SetSMNoteData(noteData);
NoteData tnd = tmp.GetNoteData();
tnd.LogNonEmptyRows();
tnd.LogNonEmptyRows(&tmp.m_Timing);

auto ck = tmp.GenerateChartKey(tnd, tmp.GetTimingData());
if (ck != out.GetChartKey())
Expand Down
11 changes: 5 additions & 6 deletions src/Etterna/Models/StepsAndStyles/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,7 @@ Steps::CalcEtternaMetadata()
const vector<NoteInfo>& cereal =
m_pNoteData->SerializeNoteData2(GetTimingData(), false);

if(!GetTimingData()->HasWarps() && !GetTimingData()->HasFakes())
diffByRate = MinaSDCalc_OLD(cereal);
diffByRate = MinaSDCalc_OLD(cereal);

ChartKey = GenerateChartKey(*m_pNoteData, GetTimingData());

Expand All @@ -419,7 +418,7 @@ float
Steps::DoATestThing(float ev, Skillset ss)
{
Decompress();
const vector<int>& nerv = m_pNoteData->BuildAndGetNerv();
const vector<int>& nerv = m_pNoteData->BuildAndGetNerv(GetTimingData());
const vector<float>& etaner = GetTimingData()->BuildAndGetEtaner(nerv);
const vector<NoteInfo>& cereal = m_pNoteData->SerializeNoteData(etaner);

Expand Down Expand Up @@ -883,7 +882,7 @@ class LunaSteps : public Luna<Steps>
float goal = FArg(2);
CLAMP(rate, 0.7f, 3.f);
auto nd = p->GetNoteData();
auto loot = nd.BuildAndGetNerv();
auto loot = nd.BuildAndGetNerv(p->GetTimingData());
const vector<float>& etaner =
p->GetTimingData()->BuildAndGetEtaner(loot);
auto& ni = nd.SerializeNoteData(etaner);
Expand Down Expand Up @@ -917,7 +916,7 @@ class LunaSteps : public Luna<Steps>
{
lua_newtable(L);
auto nd = p->GetNoteData();
auto loot = nd.BuildAndGetNerv();
auto loot = nd.BuildAndGetNerv(p->GetTimingData());

LuaHelpers::CreateTableFromArray(
loot, L); // row (we need timestamps technically)
Expand Down Expand Up @@ -953,7 +952,7 @@ class LunaSteps : public Luna<Steps>
auto nd = p->GetNoteData();
if (nd.IsEmpty())
return 0;
vector<int> nerv = nd.BuildAndGetNerv();
vector<int> nerv = nd.BuildAndGetNerv(p->GetTimingData());
if (nerv.back() != nd.GetLastRow())
nerv.emplace_back(nd.GetLastRow());
const vector<float>& etaner =
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Screen/Others/ScreenInstallOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ DoInstalls(CommandLineActions::CommandLineArgs args)
NoteData nd;
steps->GetNoteData(nd);

nd.LogNonEmptyRows();
nd.LogNonEmptyRows(td);
auto& nerv = nd.GetNonEmptyRowVector();
auto& etaner = td->BuildAndGetEtaner(nerv);
auto& serializednd = nd.SerializeNoteData(etaner);
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Screen/Others/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1691,7 +1691,7 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>
GAMESTATE->SetProcessedTimingData(
GAMESTATE->m_pCurSteps->GetTimingData());
auto* td = GAMESTATE->m_pCurSteps->GetTimingData();
auto nerv = nd.BuildAndGetNerv();
auto nerv = nd.BuildAndGetNerv(td);
auto sdifs = td->BuildAndGetEtaner(nerv);
vector<int> noterows;
for (auto t : timestamps) {
Expand Down

0 comments on commit 9d63b19

Please sign in to comment.