diff --git a/Themes/Rebirth/BGAnimations/offsetplot.lua b/Themes/Rebirth/BGAnimations/offsetplot.lua index 2d2a3f80bf..8ee58e5bf5 100644 --- a/Themes/Rebirth/BGAnimations/offsetplot.lua +++ b/Themes/Rebirth/BGAnimations/offsetplot.lua @@ -206,7 +206,7 @@ local t = Def.ActorFrame { if isOver(bg) then local top = SCREENMAN:GetTopScreen() -- dont break if it will break (we can only do this from the eval screen) - if not top.GetReplaySnapshotJudgmentsForNoterow or not top.GetReplaySnapshotWifePercentForNoterow then + if not top.SetPlayerStageStatsFromReplayData then return end @@ -219,18 +219,20 @@ local t = Def.ActorFrame { local lastsec = GAMESTATE:GetCurrentSteps():GetLastSecond() local row = td:GetBeatFromElapsedTime(percent * lastsec) * 48 - local judgments = top:GetReplaySnapshotJudgmentsForNoterow(row) - local wifescore = top:GetReplaySnapshotWifePercentForNoterow(row) * 100 + local replay = REPLAYS:GetActiveReplay() + local snapshot = replay:GetReplaySnapshotForNoterow(row) + local judgments = snapshot:GetJudgments() + local wifescore = snapshot:GetWifePercent() * 100 local time = SecondsToHHMMSS(td:GetElapsedTimeFromNoteRow(row)) - local mean = top:GetReplaySnapshotMeanForNoterow(row) - local sd = top:GetReplaySnapshotSDForNoterow(row) - - local marvCount = judgments[10] - local perfCount = judgments[9] - local greatCount = judgments[8] - local goodCount = judgments[7] - local badCount = judgments[6] - local missCount = judgments[5] + local mean = snapshot:GetMean() + local sd = snapshot:GetStandardDeviation() + + local marvCount = judgments["W1"] + local perfCount = judgments["W2"] + local greatCount = judgments["W3"] + local goodCount = judgments["W4"] + local badCount = judgments["W5"] + local missCount = judgments["Miss"] -- excessively long string format for translation support local txt = string.format( diff --git a/Themes/Til Death/BGAnimations/offsetplot.lua b/Themes/Til Death/BGAnimations/offsetplot.lua index be54dd0183..9704d6e0fa 100644 --- a/Themes/Til Death/BGAnimations/offsetplot.lua +++ b/Themes/Til Death/BGAnimations/offsetplot.lua @@ -261,17 +261,20 @@ o[#o + 1] = bg:x(xpos) bg:zoomto(txt:GetZoomedWidth() + 4, txt:GetZoomedHeight() + 4) local row = convertXToRow(xpos) - local judgments = SCREENMAN:GetTopScreen():GetReplaySnapshotJudgmentsForNoterow(row) - local wifescore = SCREENMAN:GetTopScreen():GetReplaySnapshotWifePercentForNoterow(row) * 100 - local mean = SCREENMAN:GetTopScreen():GetReplaySnapshotMeanForNoterow(row) - local sd = SCREENMAN:GetTopScreen():GetReplaySnapshotSDForNoterow(row) + local replay = REPLAYS:GetActiveReplay() + local snapshot = replay:GetReplaySnapshotForNoterow(row) + local judgments = snapshot:GetJudgments() + local wifescore = snapshot:GetWifePercent() * 100 + local mean = snapshot:GetMean() + local sd = snapshot:GetStandardDeviation() local timebro = td:GetElapsedTimeFromNoteRow(row) / getCurRateValue() - local marvCount = judgments[10] - local perfCount = judgments[9] - local greatCount = judgments[8] - local goodCount = judgments[7] - local badCount = judgments[6] - local missCount = judgments[5] + + local marvCount = judgments["W1"] + local perfCount = judgments["W2"] + local greatCount = judgments["W3"] + local goodCount = judgments["W4"] + local badCount = judgments["W5"] + local missCount = judgments["Miss"] --txt:settextf("x %f\nrow %f\nbeat %f\nfinalsecond %f", xpos, row, row/48, finalSecond) -- The odd formatting here is in case we want to add translation support. diff --git a/src/Etterna/Models/HighScore/HighScore.h b/src/Etterna/Models/HighScore/HighScore.h index 44dc68d1f9..bb5e1e7fcb 100644 --- a/src/Etterna/Models/HighScore/HighScore.h +++ b/src/Etterna/Models/HighScore/HighScore.h @@ -4,7 +4,7 @@ #include "Etterna/Models/Misc/DateTime.h" #include "Etterna/Models/Misc/GameConstantsAndTypes.h" #include "Etterna/Models/Misc/Grade.h" -#include "Etterna/Models/HighScore/ReplayConstantsAndTypes.h" +#include "Etterna/Models/HighScore/Replay.h" class XNode; struct RadarValues; diff --git a/src/Etterna/Models/HighScore/Replay.cpp b/src/Etterna/Models/HighScore/Replay.cpp index 697b4ba070..20b2f2b909 100644 --- a/src/Etterna/Models/HighScore/Replay.cpp +++ b/src/Etterna/Models/HighScore/Replay.cpp @@ -2213,6 +2213,7 @@ class LunaReplay : public Luna ADD_METHOD(GetTapNoteTypeVector); ADD_METHOD(GetHoldNoteVector); ADD_METHOD(GetMineHitVector); + ADD_METHOD(GetReplaySnapshotForNoterow); } }; diff --git a/src/Etterna/Models/HighScore/Replay.h b/src/Etterna/Models/HighScore/Replay.h index d9cb441f08..8ba3642da6 100644 --- a/src/Etterna/Models/HighScore/Replay.h +++ b/src/Etterna/Models/HighScore/Replay.h @@ -9,6 +9,7 @@ struct HighScore; class TimingData; class Steps; +class Style; class Replay { diff --git a/src/Etterna/Screen/Others/ScreenEvaluation.cpp b/src/Etterna/Screen/Others/ScreenEvaluation.cpp index cddd013366..38178cc7d8 100644 --- a/src/Etterna/Screen/Others/ScreenEvaluation.cpp +++ b/src/Etterna/Screen/Others/ScreenEvaluation.cpp @@ -294,40 +294,6 @@ class LunaScreenEvaluation : public Luna lua_pushboolean(L, true); return 1; } - static int GetReplaySnapshotJudgmentsForNoterow(T* p, lua_State* L) - { - int row = IArg(1); - auto rs = REPLAYS->GetActiveReplay()->GetReplaySnapshotForNoterow(row); - std::vector toPush; - - FOREACH_ENUM(TapNoteScore, tns) - toPush.emplace_back(rs->judgments[tns]); - - LuaHelpers::CreateTableFromArray(toPush, L); - return 1; - } - static int GetReplaySnapshotWifePercentForNoterow(T* p, lua_State* L) - { - int row = IArg(1); - auto rs = REPLAYS->GetActiveReplay()->GetReplaySnapshotForNoterow(row); - - lua_pushnumber(L, rs->curwifescore / rs->maxwifescore); - return 1; - } - static int GetReplaySnapshotSDForNoterow(T* p, lua_State* L) { - int row = IArg(1); - auto rs = REPLAYS->GetActiveReplay()->GetReplaySnapshotForNoterow(row); - - lua_pushnumber(L, rs->standardDeviation); - return 1; - } - static int GetReplaySnapshotMeanForNoterow(T* p, lua_State* L) { - int row = IArg(1); - auto rs = REPLAYS->GetActiveReplay()->GetReplaySnapshotForNoterow(row); - - lua_pushnumber(L, rs->mean); - return 1; - } static int GetReplayRate(T* p, lua_State* L) { Locator::getLogger()->info("Getting replay rate"); @@ -386,10 +352,6 @@ class LunaScreenEvaluation : public Luna { ADD_METHOD(GetStageStats); ADD_METHOD(SetPlayerStageStatsFromReplayData); - ADD_METHOD(GetReplaySnapshotJudgmentsForNoterow); - ADD_METHOD(GetReplaySnapshotWifePercentForNoterow); - ADD_METHOD(GetReplaySnapshotSDForNoterow); - ADD_METHOD(GetReplaySnapshotMeanForNoterow); ADD_METHOD(GetReplayRate); ADD_METHOD(GetReplayJudge); ADD_METHOD(ScoreUsedInvalidModifier); diff --git a/src/Etterna/Singletons/ReplayManager.cpp b/src/Etterna/Singletons/ReplayManager.cpp index 188614ebab..21000a91be 100644 --- a/src/Etterna/Singletons/ReplayManager.cpp +++ b/src/Etterna/Singletons/ReplayManager.cpp @@ -516,10 +516,20 @@ class LunaReplayManager : public Luna p->GetReplay(hs)->PushSelf(L); return 1; } + static int GetActiveReplay(T* p, lua_State* L) { + auto* r = p->GetActiveReplay(); + if (r == nullptr) { + lua_pushnil(L); + } else { + r->PushSelf(L); + } + return 1; + } LunaReplayManager() { ADD_METHOD(GetReplay); + ADD_METHOD(GetActiveReplay); } }; LUA_REGISTER_CLASS(ReplayManager)