Skip to content

Commit

Permalink
Merge branch 'minafetchaintworkins' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 20, 2018
2 parents 1ca6cfa + 77d12c6 commit 657d713
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,7 @@ local function makedoots(i)
end,
OnCommand=function(self)
local bundle = DLMAN:GetCoreBundle(minidoots[i]:lower())
local sumsize = 0
for i=1,#bundle do
sumsize = sumsize + bundle[i]:GetSize()
end
self:settextf("(%dmb)", sumsize/1024/1024)
self:settextf("(%dmb)", bundle["TotalSize")

end
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ local t = Def.ActorFrame{
end,
SetCommand=function(self)
self:finishtweening()
if getTabIndex() == 8 then
if getTabIndex() == 8 and update then
MESSAGEMAN:Broadcast("MouseRightClick")
elseif getTabIndex() == 8 then
self:queuecommand("On")
self:visible(true)
update = true
Expand Down Expand Up @@ -730,13 +732,9 @@ local iamspartacus = capWideScale(0,20)
local noiamspartacus = capWideScale(20,40)
local selectedbundle = false

local bundleinfo
local bundlename
local bundleindex

local bundlerating = 0
local bundlesize = 0

local function makedoots(i)
local packinfo
local t = Def.ActorFrame{
Expand All @@ -752,23 +750,8 @@ local function makedoots(i)
selectedbundle = true
bundlename = minidoots[i]
bundleindex = i

currentpage = 1
packlist = DLMAN:GetCoreBundle(bundlename:lower())

-- these should prolly be shifted into the internal bundle object -mina
local sumrating = 0
local sumsize = 0
if #packlist > 0 then
for i=1,#packlist do
sumsize = sumsize + packlist[i]:GetSize()
sumrating = sumrating + packlist[i]:GetAvgDifficulty()
end

bundlerating = sumrating/#packlist
bundlesize = sumsize/1024/1024
end

MESSAGEMAN:Broadcast("bundletime")
MESSAGEMAN:Broadcast("UpdatePacks")
end
Expand Down Expand Up @@ -801,21 +784,8 @@ local function makesuperdoots(i)
selectedbundle = true
bundlename = minidoots[i].."-Expanded"
bundleindex = i

currentpage = 1
packlist = DLMAN:GetCoreBundle(bundlename:lower())

local sumrating = 0
local sumsize = 0
if #packlist > 0 then
for i=1,#packlist do
sumsize = sumsize + packlist[i]:GetSize()
sumrating = sumrating + packlist[i]:GetAvgDifficulty()
end
bundlerating = sumrating/#packlist
bundlesize = sumsize/1024/1024
end

MESSAGEMAN:Broadcast("bundletime")
MESSAGEMAN:Broadcast("UpdatePacks")
end
Expand Down Expand Up @@ -866,7 +836,7 @@ t[#t+1] = LoadFont("Common normal") .. {
self:settext("Core Bundles (Expanded):")
end,
bundletimeMessageCommand=function(self)
self:settextf("Total Size: %d(MB)", bundlesize)
self:settextf("Total Size: %d(MB)", packlist["TotalSize"])
end,
MouseRightClickMessageCommand=function(self)
if update then
Expand All @@ -880,8 +850,8 @@ t[#t+1] = LoadFont("Common normal") .. {
self:xy(250+noiamspartacus,bundlegumbley - 36):zoom(0.5):halign(0):valign(0):visible(false)
end,
bundletimeMessageCommand=function(self)
self:settextf("Avg: %5.2f", bundlerating)
self:diffuse(byMSD(bundlerating))
self:settextf("Avg: %5.2f", packlist["AveragePackDifficulty"])
self:diffuse(byMSD(packlist["AveragePackDifficulty"]))
self:visible(true)
end,
MouseRightClickMessageCommand=function(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ local sortTable = {
SortOrder_Stamina = 'Stamina',
SortOrder_JackSpeed = 'JackSpeed',
SortOrder_Chordjack = 'Chordjack',
SortOrder_Technical = 'Technical'
SortOrder_Technical = 'Technical',
SortOrder_Length = 'Length',
}

t[#t+1] = Def.Quad{
Expand Down
43 changes: 32 additions & 11 deletions Themes/Til Death/BGAnimations/offsetplot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ local plotWidth, plotHeight = 400,120
local plotX, plotY = SCREEN_WIDTH - 9 - plotWidth/2, SCREEN_HEIGHT - 56 - plotHeight/2
local dotDims, plotMargin = 2, 4
local maxOffset = math.max(180, 180*tso)
local baralpha = 0.2
local bgalpha = 0.8
local textzoom = 0.35

-- initialize tables we need for replay data here, we don't know where we'll be loading from yet
local dvt = {}
Expand Down Expand Up @@ -54,6 +56,7 @@ local o = Def.ActorFrame{
if SCREENMAN:GetTopScreen():GetName() == "ScreenScoreTabOffsetPlot" then -- loaded from scoretab not eval so we need to read from disk and adjust plot display
plotWidth, plotHeight = SCREEN_WIDTH,SCREEN_WIDTH*0.3
self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y)
textzoom = 0.5
bgalpha = 1

-- the internals here are really inefficient this should be handled better (internally) -mina
Expand Down Expand Up @@ -116,34 +119,34 @@ local o = Def.ActorFrame{
MESSAGEMAN:Broadcast("JudgeDisplayChanged")
end,
}
-- Background
o[#o+1] = Def.Quad{JudgeDisplayChangedMessageCommand=function(self)
self:zoomto(plotWidth+plotMargin,plotHeight+plotMargin):diffuse(color("0.05,0.05,0.05,0.05")):diffusealpha(bgalpha)
end}
-- Center Bar
o[#o+1] = Def.Quad{
JudgeDisplayChangedMessageCommand=function(self)
self:zoomto(plotWidth+plotMargin,1):diffuse(byJudgment("TapNoteScore_W1"))
self:zoomto(plotWidth+plotMargin,1):diffuse(byJudgment("TapNoteScore_W1")):diffusealpha(baralpha)
end
}
local fantabars = {22.5, 45, 90, 135}
local bantafars = {"TapNoteScore_W2", "TapNoteScore_W3", "TapNoteScore_W4", "TapNoteScore_W5"}
for i=1, #fantabars do
o[#o+1] = Def.Quad{
JudgeDisplayChangedMessageCommand=function(self)
self:zoomto(plotWidth+plotMargin,1):diffuse(byJudgment(bantafars[i]))
self:zoomto(plotWidth+plotMargin,1):diffuse(byJudgment(bantafars[i])):diffusealpha(baralpha)
local fit = (enabledCustomWindows and judge ~= 0) and customWindow.judgeWindows[judges[i]] or tso*fantabars[i]
self:y( fitY(fit))
end
}
o[#o+1] = Def.Quad{
JudgeDisplayChangedMessageCommand=function(self)
self:zoomto(plotWidth+plotMargin,1):diffuse(byJudgment(bantafars[i]))
self:zoomto(plotWidth+plotMargin,1):diffuse(byJudgment(bantafars[i])):diffusealpha(baralpha)
local fit = (enabledCustomWindows and judge ~= 0) and customWindow.judgeWindows[judges[i]] or tso*fantabars[i]
self:y( fitY(-fit))
end
}
end
-- Background
o[#o+1] = Def.Quad{JudgeDisplayChangedMessageCommand=function(self)
self:zoomto(plotWidth+plotMargin,plotHeight+plotMargin):diffuse(color("0.05,0.05,0.05,0.05")):diffusealpha(bgalpha)
end}

local dotWidth = dotDims / 2
o[#o+1] = Def.ActorMultiVertex{
Expand Down Expand Up @@ -197,17 +200,35 @@ o[#o+1] = Def.ActorMultiVertex{
end
}

-- filter
o[#o+1] = LoadFont("Common Normal")..{
JudgeDisplayChangedMessageCommand=function(self)
self:xy(0,plotHeight/2-2):zoom(textzoom):halign(0.5):valign(1)
if #ntt > 0 then
if handspecific then
if left then
self:settext("Highlighting left hand taps")
else
self:settext("Highlighting right hand taps")
end
else
self:settext("Down toggles highlights")
end
else
self:settext("")
end
end
}

-- Early/Late markers
o[#o+1] = LoadFont("Common Normal")..{
JudgeDisplayChangedMessageCommand=function(self)
self:xy(-plotWidth/2,-plotHeight/2+2):settextf("Late (+%ims)", maxOffset):zoom(0.35):halign(0):valign(0)
self:settextf("Late (+%ims)", maxOffset)
self:xy(-plotWidth/2,-plotHeight/2+2):zoom(textzoom):halign(0):valign(0):settextf("Late (+%ims)", maxOffset)
end
}
o[#o+1] = LoadFont("Common Normal")..{
JudgeDisplayChangedMessageCommand=function(self)
self:xy(-plotWidth/2,plotHeight/2-2):settextf("Early (-%ims)", maxOffset):zoom(0.35):halign(0):valign(1)
self:settextf("Early (-%ims)", maxOffset)
self:xy(-plotWidth/2,plotHeight/2-2):zoom(textzoom):halign(0):valign(1):settextf("Early (-%ims)", maxOffset)
end
}

Expand Down
1 change: 1 addition & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ StaminaText=Stamina
JackSpeedText=JackSpeed
ChordjackText=Chordjack
TechnicalText=Technical
LengthText=Length
TopGradesText=Top Grades
[NetworkSyncManager]
Expand Down
3 changes: 2 additions & 1 deletion Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ RecentSongsToShow=30

UseEasyMarkerFlag=false

ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,Genre,Recent,Favorites,Overall,Stream,Jumpstream,Handstream,Stamina,JackSpeed,Chordjack,Technical"
ModeMenuChoiceNames="Preferred,Group,Title,Bpm,Popularity,TopGrades,Artist,Genre,Recent,Favorites,Overall,Stream,Jumpstream,Handstream,Stamina,JackSpeed,Chordjack,Technical,Length"
ChoicePreferred="sort,Preferred"
ChoiceGroup="sort,Group"
ChoiceTitle="sort,Title"
Expand All @@ -923,6 +923,7 @@ ChoiceStamina="sort,Stamina"
ChoiceJackSpeed="sort,JackSpeed"
ChoiceChordjack="sort,Chordjack"
ChoiceTechnical="sort,Technical"
ChoiceLength="sort,Length"

CustomWheelItemNames=""

Expand Down
21 changes: 20 additions & 1 deletion src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,17 +1635,36 @@ class LunaDownloadManager : public Luna<DownloadManager>
}
static int GetCoreBundle(T* p, lua_State* L)
{
// this should probably return nil but only if we make it its own lua thing first -mina
auto bundle = DLMAN->GetCoreBundle(SArg(1));
lua_createtable(L, bundle.size(), 0);
for (size_t i = 0; i < bundle.size(); ++i) {
bundle[i]->PushSelf(L);
lua_rawseti(L, -2, i + 1);
}

size_t totalsize = 0;
float avgpackdiff = 0.f;

for (auto p : bundle) {
totalsize += p->size;
avgpackdiff += p->avgDifficulty;
}

if(!bundle.empty())
avgpackdiff /= bundle.size();
totalsize = totalsize / 1024 / 1024;

// this may be kind of unintuitive but lets roll with it for now -mina
lua_pushnumber(L, totalsize);
lua_setfield(L, -2, "TotalSize");
lua_pushnumber(L, avgpackdiff);
lua_setfield(L, -2, "AveragePackDifficulty");

return 1;
}
static int DownloadCoreBundle(T* p, lua_State* L)
{
// pass "novice", "expert" etc, should start a queue and download packs in sequence rather than concurrently to minimize time before can begin -mina
DLMAN->DownloadCoreBundle(SArg(1));
return 1;
}
Expand Down
3 changes: 2 additions & 1 deletion src/GameConstantsAndTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ static const char *SortOrderNames[] = {
"Stamina",
"JackSpeed",
"Chordjack",
"Technical"
"Technical",
"Length"
};
XToString( SortOrder );
StringToX( SortOrder );
Expand Down
1 change: 1 addition & 0 deletions src/GameConstantsAndTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ enum SortOrder
SORT_JackSpeed,
SORT_Chordjack,
SORT_Technical,
SORT_LENGTH,
NUM_SortOrder,
SortOrder_Invalid
};
Expand Down
3 changes: 3 additions & 0 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ const RadarValues &HighScore::GetRadarValues() const { return m_Impl->radarValue
float HighScore::GetLifeRemainingSeconds() const { return m_Impl->fLifeRemainingSeconds; }
bool HighScore::GetDisqualified() const { return m_Impl->bDisqualified; }
int HighScore::GetTopScore() const { return m_Impl->TopScore; }
int HighScore::GetReplayType() const { return m_Impl->ReplayType; }

void HighScore::SetName( const string &sName ) { m_Impl->sName = sName; }
void HighScore::SetChartKey( const string &ck) { m_Impl->ChartKey = ck; }
Expand Down Expand Up @@ -1530,6 +1531,7 @@ class LunaHighScore: public Luna<HighScore>
DEFINE_METHOD( GetEtternaValid , GetEtternaValid() )
DEFINE_METHOD( HasReplayData, HasReplayData() )
DEFINE_METHOD( GetChartKey, GetChartKey())
DEFINE_METHOD(GetReplayType, GetReplayType())
LunaHighScore()
{
ADD_METHOD( GetName );
Expand Down Expand Up @@ -1566,6 +1568,7 @@ class LunaHighScore: public Luna<HighScore>
ADD_METHOD( GetTapNoteTypeVector );
ADD_METHOD( GetTapNoteSubTypeVector );
ADD_METHOD( GetChartKey );
ADD_METHOD( GetReplayType );
}
};

Expand Down
1 change: 1 addition & 0 deletions src/HighScore.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct HighScore
vector<TapNoteSubType> GetCopyOfTapNoteSubTypeVector() const;
string GetScoreKey() const;
int GetTopScore() const;
int GetReplayType() const;
/**
* @brief Determine how many seconds the player had left in Survival mode.
* @return the number of seconds left. */
Expand Down
3 changes: 3 additions & 0 deletions src/MusicWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,9 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
case SORT_Technical:
SongUtil::SortSongPointerArrayByGroupAndMSD(arraySongs, Skill_Technical);
break;
case SORT_LENGTH:
SongUtil::SortSongPointerArrayByLength(arraySongs);
break;
default:
FAIL_M("Unhandled sort order! Aborting...");
}
Expand Down
4 changes: 1 addition & 3 deletions src/ScreenSelectMusic.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ class ScreenSelectMusic : public ScreenWithMenuElements
{
case SelectionState_SelectingSong:
return TWO_PART_SELECTION ? SelectionState_SelectingSteps : SelectionState_Finalized;
case SelectionState_SelectingSteps:
return SelectionState_Finalized;
case SelectionState_Finalized:
default:
return SelectionState_Finalized;
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/SongUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static int CompareSongPointersByGroup(const Song *pSong1, const Song *pSong2)
}
std::function<int(const Song *pSong1, const Song *pSong2)> CompareSongPointersByGroupAndMSD(Skillset ss)
{
return [&ss](const Song *pSong1, const Song *pSong2) {
return [ss](const Song *pSong1, const Song *pSong2) {
int g = CompareSongPointersByGroup(pSong1, pSong2);
if (g == 0)
/* Same group; compare by MSD. */
Expand Down Expand Up @@ -627,6 +627,14 @@ RString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
case SORT_POPULARITY:
case SORT_RECENT:
return RString();
case SORT_LENGTH:
{
const int iSortLengthSize = 60;
int iMaxLength = static_cast<int>(pSong->m_fMusicLengthSeconds);
iMaxLength += (iSortLengthSize - (iMaxLength%iSortLengthSize) - 1);
int iMinLength = iMaxLength - (iSortLengthSize - 1);
return ssprintf("%s-%s", SecondsToMMSS(static_cast<float>(iMinLength)).c_str(), SecondsToMMSS(static_cast<float>(iMaxLength)).c_str());
}
case SORT_TOP_GRADES:
{
auto p = PROFILEMAN->GetProfile(PLAYER_1);
Expand Down

0 comments on commit 657d713

Please sign in to comment.