Skip to content

Commit

Permalink
make newly uploaded replays awesome
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Nov 30, 2018
1 parent 23586b3 commit 21d4393
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/DownloadManager.cpp
Expand Up @@ -1410,6 +1410,7 @@ DownloadManager::RequestReplayData(string scoreid,
vector<float> timestamps;
vector<float> offsets;
vector<int> tracks;
vector<int> rows;
vector<TapNoteType> types;

auto j = json::parse(req.result);
Expand All @@ -1423,12 +1424,17 @@ DownloadManager::RequestReplayData(string scoreid,

timestamps.emplace_back(note[0].get<float>());
offsets.emplace_back(note[1].get<float>() / 1000.f);

if (note.size() > 2) {
if (note.size() == 3) { // pre-0.6 with noterows
rows.emplace_back(note[2].get<int>());
}
if (note.size() > 3) { // 0.6 without noterows
tracks.emplace_back(note[2].get<int>());
types.emplace_back(
static_cast<TapNoteType>(note[3].get<int>()));
}
if (note.size() == 5) { // 0.6 with noterows
rows.emplace_back(note[4].get<int>());
}
}
auto& lbd = DLMAN->chartLeaderboards[chartkey];
auto it = find_if(
Expand All @@ -1440,6 +1446,7 @@ DownloadManager::RequestReplayData(string scoreid,
it->hs.SetOffsetVector(offsets);
it->hs.SetTrackVector(tracks);
it->hs.SetTapNoteTypeVector(types);
it->hs.SetNoteRowVector(rows);

if (tracks.empty())
it->hs.SetReplayType(1);
Expand Down
11 changes: 8 additions & 3 deletions src/ScreenSelectMusic.cpp
Expand Up @@ -1705,8 +1705,11 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>
// from the existing, if the score was cc off then we need to fill in
// extra rows for each tap in the chord -mina
auto timestamps = hs->GetCopyOfSetOnlineReplayTimestampVector();
auto noterows = hs->GetNoteRowVector();
auto REEEEEEEEEEEEEE = hs->GetOffsetVector();
if (!timestamps.empty()) {
if (!timestamps.empty() &&
noterows.empty()) { // if we have noterows from newer uploads, just
// use them -mina
GAMESTATE->SetProcessedTimingData(
GAMESTATE->m_pCurSteps[PLAYER_1]->GetTimingData());
auto* td = GAMESTATE->m_pCurSteps[PLAYER_1]->GetTimingData();
Expand Down Expand Up @@ -1740,9 +1743,11 @@ class LunaScreenSelectMusic : public Luna<ScreenSelectMusic>
GAMESTATE->SetProcessedTimingData(nullptr);
// hs->SetNoteRowVector(ihatemylife);
hs->SetNoteRowVector(noterows);
}

// Since we keep misses on EO as 180ms, we need to convert them
// back.
// Since we keep misses on EO as 180ms, we need to convert them
// back.
if (!timestamps.empty()) {
auto offsets = hs->GetCopyOfOffsetVector();
for (auto& offset : offsets) {
if (fabs(offset) >= .18f)
Expand Down

0 comments on commit 21d4393

Please sign in to comment.