diff --git a/Themes/Til Death/BGAnimations/superscoreboard.lua b/Themes/Til Death/BGAnimations/superscoreboard.lua index 2e463a387b..8570e57fdf 100644 --- a/Themes/Til Death/BGAnimations/superscoreboard.lua +++ b/Themes/Til Death/BGAnimations/superscoreboard.lua @@ -67,6 +67,7 @@ end local filts = {"All Rates", "Current Rate"} local topornah = {"Top Scores", "All Scores"} +local ccornah = {"Show Invalid", "Hide Invalid"} local scoretable = {} local o = @@ -301,7 +302,7 @@ local o = if collapsed then self:xy(c5x - 175, headeroff):zoom(tzoom):halign(1):valign(1) else - self:xy(c5x - 115, headeroff):zoom(tzoom):halign(1):valign(1) + self:xy(c5x - 160, headeroff):zoom(tzoom):halign(1):valign(1) end end, HighlightCommand = function(self) @@ -321,6 +322,36 @@ local o = self:GetParent():queuecommand("GetFilteredLeaderboard") end end + }, + LoadFont("Common normal") .. + { + --ccon/off filter toggle + InitCommand = function(self) + if collapsed then + self:visible(false) + --self:xy(c5x - 110, headeroff):zoom(tzoom):halign(1):valign(1) + else + self:visible(true) + self:xy(c5x - 80, headeroff):zoom(tzoom):halign(1):valign(1) + end + end, + HighlightCommand = function(self) + highlightIfOver(self) + end, + UpdateCommand = function(self) + if DLMAN:GetCCFilter() then + self:settext(ccornah[1]) + else + self:settext(ccornah[2]) + end + end, + MouseLeftClickMessageCommand = function(self) + if isOver(self) then + DLMAN:ToggleCCFilter() + ind = 0 + self:GetParent():queuecommand("GetFilteredLeaderboard") + end + end } } diff --git a/src/Etterna/Singletons/DownloadManager.cpp b/src/Etterna/Singletons/DownloadManager.cpp index 1d7c9feb4a..23867f50b1 100644 --- a/src/Etterna/Singletons/DownloadManager.cpp +++ b/src/Etterna/Singletons/DownloadManager.cpp @@ -2731,6 +2731,8 @@ class LunaDownloadManager : public Luna for (auto& score : leaderboardScores) { auto& leaderboardHighScore = score.hs; + if (p->ccoffonly && !score.nocc) + continue; if (p->currentrateonly && lround(leaderboardHighScore.GetMusicRate() * 10000.f) != lround(currentrate * 10000.f)) @@ -2778,6 +2780,16 @@ class LunaDownloadManager : public Luna lua_pushboolean(L, p->topscoresonly); return 1; } + static int ToggleCCFilter(T* p, lua_State* L) + { + p->ccoffonly = !p->ccoffonly; + return 0; + } + static int GetCCFilter(T* p, lua_State* L) + { + lua_pushboolean(L, p->ccoffonly); + return 1; + } static int SendReplayDataForOldScore(T* p, lua_State* L) { DLMAN->UploadScoreWithReplayDataFromDisk(SArg(1)); @@ -2815,6 +2827,8 @@ class LunaDownloadManager : public Luna ADD_METHOD(GetCurrentRateFilter); ADD_METHOD(ToggleTopScoresOnlyFilter); ADD_METHOD(GetTopScoresOnlyFilter); + ADD_METHOD(ToggleCCFilter); + ADD_METHOD(GetCCFilter); ADD_METHOD(SendReplayDataForOldScore); ADD_METHOD(Logout); } diff --git a/src/Etterna/Singletons/DownloadManager.h b/src/Etterna/Singletons/DownloadManager.h index 446d091d2c..16099878e2 100644 --- a/src/Etterna/Singletons/DownloadManager.h +++ b/src/Etterna/Singletons/DownloadManager.h @@ -225,8 +225,8 @@ class DownloadManager done); // Sends login request if not already logging in void OnLogin(); bool UploadScores(); // Uploads all scores not yet uploaded to current - bool UpdateOnlineScoreReplayData(); // attempts updates existing replaydata - // server (Async, 1 request per score) + bool UpdateOnlineScoreReplayData(); // attempts updates existing replaydata + // server (Async, 1 request per score) void RefreshPackList(const string& url); void init(); @@ -278,6 +278,7 @@ class DownloadManager void RefreshRegisterPage(); bool currentrateonly = false; bool topscoresonly = true; + bool ccoffonly = true; void RefreshCountryCodes(); void RequestReplayData(const string& scorekey, int userid, @@ -314,4 +315,3 @@ class DownloadManager extern shared_ptr DLMAN; #endif -