Skip to content

Commit

Permalink
was lazy, bugs caused, still lazy, but fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 28, 2018
1 parent 7dc34b8 commit b1cab8a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
20 changes: 10 additions & 10 deletions Themes/Til Death/BGAnimations/superscoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ local function byAchieved(scoregoal)
end

local filts = {"All Rates", "Current Rate"}
local currentrateonly = false

local scoretable
local o = Def.ActorFrame{
Expand Down Expand Up @@ -227,22 +226,23 @@ local o = Def.ActorFrame{

LoadFont("Common normal") .. { --current rate toggle
InitCommand=function(self)
self:xy(c5x - 10, headeroff):zoom(tzoom):halign(1):settext(filts[1])
self:xy(c5x - 10, headeroff):zoom(tzoom):halign(1)
end,
HighlightCommand=function(self)
highlightIfOver(self)
end,
UpdateCommand=function(self)
if DLMAN:GetCurrentRateFilter() then
self:settext(filts[2])
else
self:settext(filts[1])
end
end,
MouseLeftClickMessageCommand=function(self)
if isOver(self) then
scoretable = DLMAN:ToggleRateFilter()
DLMAN:ToggleRateFilter()
ind = 0
currentrateonly = not currentrateonly
if currentrateonly then
self:settext(filts[2])
else
self:settext(filts[1])
end
self:GetParent():queuecommand("Update")
self:GetParent():queuecommand("ChartLeaderboardUpdate")
end
end,
},
Expand Down
19 changes: 10 additions & 9 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1765,15 +1765,6 @@ class LunaDownloadManager : public Luna<DownloadManager>
//p->RequestChartLeaderBoard(SArg(1));
p->MakeAThing(SArg(1));
vector<HighScore*> wot;
for (auto& zoop : p->athing)
wot.push_back(&zoop);
LuaHelpers::CreateTableFromArray(wot, L);
return 1;
}

static int ToggleRateFilter(T* p, lua_State* L) {
p->currentrateonly = !p->currentrateonly;
vector<HighScore*> wot;
float currentrate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate;
for (auto& zoop : p->athing) {
if (lround(zoop.GetMusicRate() * 10000.f) != lround(currentrate * 10000.f) && p->currentrateonly)
Expand All @@ -1784,6 +1775,15 @@ class LunaDownloadManager : public Luna<DownloadManager>
return 1;
}

static int ToggleRateFilter(T* p, lua_State* L) {
p->currentrateonly = !p->currentrateonly;
return 1;
}
static int GetCurrentRateFilter(T* p, lua_State* L) {
lua_pushboolean(L, p->currentrateonly);
return 1;
}

LunaDownloadManager()
{
ADD_METHOD(DownloadCoreBundle);
Expand All @@ -1805,6 +1805,7 @@ class LunaDownloadManager : public Luna<DownloadManager>
ADD_METHOD(GetRegisterPage);
ADD_METHOD(RequestChartLeaderBoard);
ADD_METHOD(ToggleRateFilter);
ADD_METHOD(GetCurrentRateFilter);
ADD_METHOD(Logout);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/DownloadManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class DownloadManager
void RefreshRegisterPage();
void MakeAThing(string chartkey);
vector<HighScore> athing;
bool currentrateonly = 0;
bool currentrateonly = false;
void RequestChartLeaderBoard(string chartkey);
void RefreshUserData();
void RefreshUserRank();
Expand Down

0 comments on commit b1cab8a

Please sign in to comment.