Skip to content

Commit

Permalink
update rescore functions to screen out mine offsets
Browse files Browse the repository at this point in the history
for each mine hit:
- reduce max points by 2
- reduce gained points by 2

also replaces some foreach macros with range loops
  • Loading branch information
MinaciousGrace committed Jul 14, 2018
1 parent 8337be1 commit 6295fe5
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,13 +1187,24 @@ float HighScore::RescoreToWifeJudge(int x) {
const float tso[] = { 1.50f,1.33f,1.16f,1.00f,0.84f,0.66f,0.50f,0.33f,0.20f };
float ts = tso[x-1];
float p = 0;
FOREACH_CONST(float, m_Impl->vOffsetVector, f)
p += wife2(*f, ts);
for (auto &n : m_Impl->vOffsetVector)
p += wife2(n, ts);

p += (m_Impl->iHoldNoteScores[HNS_LetGo] + m_Impl->iHoldNoteScores[HNS_Missed]) * -6.f;
p += m_Impl->iTapNoteScores[TNS_HitMine] * -8.f;

return p / static_cast<float>(m_Impl->vOffsetVector.size() * 2);
float pmax = static_cast<float>(m_Impl->vOffsetVector.size() * 2);

/* we don't want to have to access notedata when loading or rescording scores so we use the vector length of offset replay data to determine
point denominators however full replays store mine and hold drop offsets, meaning we have to screen them out when calculating the max points -mina*/
if (m_Impl->ReplayType == 2) {
pmax += m_Impl->iTapNoteScores[TNS_HitMine] * -2.f;

// we screened out extra offsets due to mines in the replay from the denominator but we've still increased the numerator with 0.00f offsets (2pts)
p += m_Impl->iTapNoteScores[TNS_HitMine] * -2.f;
}

return p / pmax;
}

float HighScore::RescoreToWifeJudgeDuringLoad(int x) {
Expand All @@ -1203,14 +1214,26 @@ float HighScore::RescoreToWifeJudgeDuringLoad(int x) {
const float tso[] = { 1.50f,1.33f,1.16f,1.00f,0.84f,0.66f,0.50f,0.33f,0.20f };
float ts = tso[x - 1];
float p = 0;
FOREACH_CONST(float, m_Impl->vOffsetVector, f)
p += wife2(*f, ts);
for(auto &n : m_Impl->vOffsetVector)
p += wife2(n, ts);

p += (m_Impl->iHoldNoteScores[HNS_LetGo] + m_Impl->iHoldNoteScores[HNS_Missed]) * -6.f;
p += m_Impl->iTapNoteScores[TNS_HitMine] * -8.f;

float pmax = static_cast<float>(m_Impl->vOffsetVector.size() * 2);

/* we don't want to have to access notedata when loading or rescording scores so we use the vector length of offset replay data to determine
point denominators however full replays store mine and hold drop offsets, meaning we have to screen them out when calculating the max points -mina*/
if (m_Impl->ReplayType == 2) {
pmax += m_Impl->iTapNoteScores[TNS_HitMine] * -2.f;

// we screened out extra offsets due to mines in the replay from the denominator but we've still increased the numerator with 0.00f offsets (2pts)
p += m_Impl->iTapNoteScores[TNS_HitMine] * -2.f;
}

float o = p / pmax;
UnloadReplayData();
return p / static_cast<float>(m_Impl->vOffsetVector.size() * 2);
return o;
}

// do not use for now- mina
Expand Down Expand Up @@ -1373,7 +1396,7 @@ class LunaHighScore: public Luna<HighScore>
// Convert to MS so lua doesn't have to
// these seem really really inefficient now -mina
static int GetOffsetVector(T* p, lua_State *L) {
p->UnloadReplayData();
p->UnloadReplayData();
p->LoadReplayData();

auto v = p->GetOffsetVector();
Expand All @@ -1385,7 +1408,7 @@ class LunaHighScore: public Luna<HighScore>
if (tnv.size() > 0) {
if (tnv[i] != TapNoteType_Mine)
o.emplace_back(v[i] * 1000);
}
}
else {
o.emplace_back(v[i] * 1000);
}
Expand All @@ -1397,7 +1420,7 @@ class LunaHighScore: public Luna<HighScore>
}

static int GetNoteRowVector(T* p, lua_State *L) {
p->UnloadReplayData();
p->UnloadReplayData();
p->LoadReplayData();

auto v = p->GetNoteRowVector();
Expand All @@ -1409,7 +1432,7 @@ class LunaHighScore: public Luna<HighScore>
if (tnv.size() > 0) {
if (tnv[i] != TapNoteType_Mine)
o.emplace_back(v[i]);
}
}
else {
o.emplace_back(v[i]);
}
Expand Down

0 comments on commit 6295fe5

Please sign in to comment.