Skip to content

Commit

Permalink
allow docked scoreboard to remember its position
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 28, 2018
1 parent 6f9990f commit 47822b1
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ local ret = Def.ActorFrame{
self:queuecommand("Set"):visible(false)
self:GetChild("LocalScores"):visible(false)
self:GetChild("ScoreDisplay"):xy(frameX,frameY):visible(false)

if FILTERMAN:oopsimlazylol() then -- set saved position and auto collapse
nestedTab = 2
self:GetChild("LocalScores"):visible(false)
self:GetChild("ScoreDisplay"):xy(FILTERMAN:grabposx("Doot"),FILTERMAN:grabposy("Doot")):visible(true)
self:playcommand("Collapse")
end
end,
OffCommand=function(self)
self:bouncebegin(0.2):xy(-500,0):diffusealpha(0) -- visible(false)
Expand Down
15 changes: 14 additions & 1 deletion Themes/Til Death/BGAnimations/superscoreboard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@ local o = Def.ActorFrame{
row2yoff = 1
collapsed = true
self:diffusealpha(0.8)

if FILTERMAN:grabposx("Doot") <= 10 or FILTERMAN:grabposy("Doot") <= 45 or FILTERMAN:grabposx("Doot") >= SCREEN_WIDTH - 60 or FILTERMAN:grabposy("Doot") >= SCREEN_HEIGHT - 45 then
self:xy(10, 45)
else
self:xy(FILTERMAN:grabposx("Doot"),FILTERMAN:grabposy("Doot"))
end

FILTERMAN:HelpImTrappedInAChineseFortuneCodingFactory(true)
self:playcommand("Init")
end,
ExpandCommand=function(self)
Expand All @@ -172,6 +180,7 @@ local o = Def.ActorFrame{
row2yoff = 1
collapsed = false
self:diffusealpha(1)
FILTERMAN:HelpImTrappedInAChineseFortuneCodingFactory(false)
self:playcommand("Init")
end,

Expand All @@ -189,6 +198,7 @@ local o = Def.ActorFrame{
end,
MouseRightClickMessageCommand=function(self)
if isOver(self) and not collapsed then
FILTERMAN:HelpImTrappedInAChineseFortuneCodingFactory(true)
self:GetParent():GetParent():playcommand("Collapse")
elseif isOver(self) then
self:GetParent():GetParent():playcommand("Expand")
Expand All @@ -214,7 +224,10 @@ local o = Def.ActorFrame{
self:diffusealpha(0.6):diffuse(color("#fafafa"))
if INPUTFILTER:IsBeingPressed("Mouse 0", "Mouse") then
self:diffusealpha(0):zoomto(400,400)
self:GetParent():xy(INPUTFILTER:GetMouseX()-width/2, INPUTFILTER:GetMouseY() - self:GetY())
local nx = INPUTFILTER:GetMouseX() - width/2
local ny = INPUTFILTER:GetMouseY() - self:GetY()
self:GetParent():xy(nx,ny)
FILTERMAN:savepos("Doot", nx, ny)
else
self:zoomto(dwidth/2,pdh/2)
end
Expand Down
28 changes: 28 additions & 0 deletions src/FilterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,29 @@ class LunaFilterManager : public Luna<FilterManager>
lua_pushboolean(L, p->HighestSkillsetsOnly);
return 1;
}

static int HelpImTrappedInAChineseFortuneCodingFactory(T* p, lua_State* L) {
p->galaxycollapsed = BArg(1);
return 1;
}
static int oopsimlazylol(T* p, lua_State* L) {
lua_pushboolean(L, p->galaxycollapsed);
return 1;
}
static int grabposx(T* p, lua_State* L) {
lua_pushnumber(L, p->watte[SArg(1)].first);
return 1;
}
static int grabposy(T* p, lua_State* L) {
lua_pushnumber(L, p->watte[SArg(1)].second);
return 1;
}
static int savepos(T* p, lua_State* L) {
p->watte[SArg(1)].first = IArg(2);
p->watte[SArg(1)].second = IArg(3);
return 1;
}

LunaFilterManager() {
ADD_METHOD(SetSSFilter);
ADD_METHOD(GetSSFilter);
Expand All @@ -140,6 +163,11 @@ class LunaFilterManager : public Luna<FilterManager>
ADD_METHOD(GetFilterMode);
ADD_METHOD(ToggleHighestSkillsetsOnly);
ADD_METHOD(GetHighestSkillsetsOnly);
ADD_METHOD(HelpImTrappedInAChineseFortuneCodingFactory);
ADD_METHOD(oopsimlazylol);
ADD_METHOD(grabposx);
ADD_METHOD(grabposy);
ADD_METHOD(savepos);
}
};

Expand Down
7 changes: 7 additions & 0 deletions src/FilterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define FilterManager_H
#include "GameConstantsAndTypes.h"
#include "PlayerNumber.h"
#include <unordered_map>

class PlayerState;
class FilterManager {
Expand All @@ -21,6 +22,12 @@ class FilterManager {
bool HighestSkillsetsOnly = false;
bool AnyActiveFilter();

// not actually filter stuff! but this doesn't get enough love so i'm going to put it here until i make something for it -mina
int miniboarddockx = 0;
int miniboarddocky = 0;
bool galaxycollapsed = false;
unordered_map<string, pair<int, int>> watte;

//Lua
void PushSelf(lua_State *L);
};
Expand Down

0 comments on commit 47822b1

Please sign in to comment.