Skip to content

Commit

Permalink
Fix Replays missing negative noterows
Browse files Browse the repository at this point in the history
but do it in a hacky way because thats how we do things
also handle regular replay misses slightly differently
  • Loading branch information
poco0317 committed Sep 8, 2019
1 parent 69aaf3c commit 5820aa7
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/Etterna/Models/Misc/PlayerAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ PlayerAI::GetTapNoteScoreForReplay(const PlayerState* pPlayerState,
// scores.

// LOG->Trace("Given number %f ", fNoteOffset);
if (fNoteOffset <= -1.0f)
return TNS_Miss;
const float fSecondsFromExact = fabsf(fNoteOffset);
// LOG->Trace("TapNoteScore For Replay Seconds From Exact: %f",
// fSecondsFromExact);

if (fSecondsFromExact >= 1.f)
return TNS_Miss;

if (fSecondsFromExact <= Player::GetWindowSeconds(TW_W1))
return TNS_W1;
else if (fSecondsFromExact <= Player::GetWindowSeconds(TW_W2))
Expand Down Expand Up @@ -241,9 +242,9 @@ PlayerAI::TapExistsAtOrBeforeThisRow(int noteRow)
{
// 2 is a replay with column data
if (pScoreData->GetReplayType() == 2) {
return m_ReplayExactTapMap.lower_bound(0)->first <= noteRow;
return m_ReplayExactTapMap.lower_bound(-20000)->first <= noteRow;
} else {
return m_ReplayTapMap.lower_bound(0)->first <= noteRow;
return m_ReplayTapMap.lower_bound(-20000)->first <= noteRow;
}
}

Expand All @@ -254,17 +255,17 @@ PlayerAI::GetTapsAtOrBeforeRow(int noteRow)

// 2 is a replay with column data
if (pScoreData->GetReplayType() == 2) {
auto rowIt = m_ReplayExactTapMap.lower_bound(-100);
auto rowIt = m_ReplayExactTapMap.lower_bound(-20000);
int row = rowIt->first;
for (; row <= noteRow && row != -100;) {
for (; row <= noteRow && row != -20000;) {
vector<TapReplayResult> toMerge = GetTapsToTapForRow(row);
output.insert(output.end(), toMerge.begin(), toMerge.end());
row = GetNextRowNoOffsets(row);
}
} else {
auto rowIt = m_ReplayTapMap.lower_bound(-100);
auto rowIt = m_ReplayTapMap.lower_bound(-20000);
int row = rowIt->first;
for (; row <= noteRow && row != -100;) {
for (; row <= noteRow && row != -20000;) {
vector<TapReplayResult> toMerge = GetTapsToTapForRow(row);
output.insert(output.end(), toMerge.begin(), toMerge.end());
row = GetNextRowNoOffsets(row);
Expand Down Expand Up @@ -308,15 +309,15 @@ PlayerAI::GetNextRowNoOffsets(int currentRow)
auto thing = m_ReplayExactTapMap.lower_bound(currentRow + 1);

if (thing == m_ReplayExactTapMap.end()) {
return -100;
return -20000;
} else {
return thing->first;
}
} else {
auto thing = m_ReplayTapMap.lower_bound(currentRow + 1);

if (thing == m_ReplayTapMap.end()) {
return -100;
return -20000;
} else {
return thing->first;
}
Expand Down

0 comments on commit 5820aa7

Please sign in to comment.