Skip to content

Commit

Permalink
Merge pull request #8 from Nickito12/master
Browse files Browse the repository at this point in the history
Fix wifesearching online
  • Loading branch information
MinaciousGrace authored Dec 25, 2016
2 parents 081c546 + 8557c48 commit fe2bd47
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,56 @@ t[#t+1] = LoadActor("currenttime")
t[#t+1] = LoadFont("Common Large")..{InitCommand=cmd(xy,5,32;halign,0;valign,1;zoom,0.55;diffuse,getMainColor("positive");settext,"Select Music:")}
t[#t+1] = LoadActor("../_cursor")
t[#t+1] = LoadActor("../_halppls")
--t[#t+1] = LoadActor("textentrysearchbar")
t[#t+1] = LoadActor("searchbar")--Remove and uncomment the above line once the wheel gets reloaded when a song select event arrives from smo
t[#t+1] = LoadActor("textentrysearchbar")

local skillsets = {
Overall = 0,
Speed = 0,
Stam = 0,
Jack = 0,
}


if GAMESTATE:IsPlayerEnabled(PLAYER_1) then
profile = GetPlayerOrMachineProfile(PLAYER_1)
if profile ~= nil then
skillsets.Overall = profile:GetPlayerRating()
skillsets.Speed = profile:GetPlayerSpeedRating()
skillsets.Stam = profile:GetPlayerStamRating()
skillsets.Jack = profile:GetPlayerJackRating()
end
end



local function littlebits(i)
local t = Def.ActorFrame{
LoadFont("Common Normal") .. {
InitCommand=cmd(xy,SCREEN_WIDTH/3,SCREEN_HEIGHT-50+i*10;halign,1;zoom,0.35;diffuse,getMainColor('positive')),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
self:settext(ms.SkillSets[i]..":")
end,
PlayerJoinedMessageCommand=cmd(queuecommand,"Set"),
PlayerUnjoinedMessageCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Normal") .. {
InitCommand=cmd(xy,SCREEN_WIDTH/3+30,SCREEN_HEIGHT-50+i*10;halign,1;zoom,0.35;diffuse,getMainColor('positive')),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
self:settextf("%5.2f",skillsets[ms.SkillSets[i]])
end,
PlayerJoinedMessageCommand=cmd(queuecommand,"Set"),
PlayerUnjoinedMessageCommand=cmd(queuecommand,"Set"),
}
}
return t
end


for i=1,#ms.SkillSets do
t[#t+1] = littlebits(i)
end


return t
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,54 @@ local t = Def.ActorFrame {
InitCommand=cmd(horizalign,left;x,bestratex;y,bestratey;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
LoadFont("Common Normal") .. {
Text="Minas calc:";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X-30;y,besty;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
Text="MSD";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+45;y,besty+20;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
LoadFont("Common Normal") .. {
Text="Speed";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+45;y,besty+50;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
LoadFont("Common Normal") .. {
Text="Stam";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+45;y,besty+80;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
LoadFont("Common Normal") .. {
Text="Jack";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+45;y,besty+110;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
LoadFont("Common Normal") .. {
Name="MinasCalcValue1";
Text="0";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+45;y,besty+30;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
LoadFont("Common Normal") .. {
Name="MinasCalcValue2";
Text="0";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+45;y,besty+60;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
LoadFont("Common Normal") .. {
Name="MinasCalcValue3";
Text="0";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+45;y,besty+90;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
LoadFont("Common Normal") .. {
Name="MinasCalcValue4";
Text="0";
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+45;y,besty+120;zoom,0.4;diffuse,1,1,1,1;strokecolor,Color("Outline"));
};
-- Music Rate Display
LoadFont("Common Normal") .. {
Name="RateLabel",
InitCommand=cmd(horizalign,left;x,SCREEN_CENTER_X+25;y,besty;;visible,true;zoom,0.4;maxwidth,capWideScale(get43size(360),360)/capWideScale(get43size(0.45),0.45)),
BeginCommand=function(self)
self:settext(getCurRateDisplayString())
end,
CodeMessageCommand=function(self,params)
local rate = getCurRateValue()
ChangeMusicRate(rate,params)
self:settext(getCurRateDisplayString())
end,
},
LoadFont("Common Normal") .. {
Name="MinasCalcValue";
Text="0";
Expand Down Expand Up @@ -162,8 +207,14 @@ local function Update(self)
P1NPS:settext(string.format("%0.2f",P1Taps/ChartLenghtInSec));


self:GetChild("MinasCalcValue"):settextf("%05.2f",GetCurrSteps:GetMSD(getCurRateValue(),0)); -- sets mina's calc value

self:GetChild("MinasCalcValue1"):settextf("%05.2f",GetCurrSteps:GetMSD(getCurRateValue(),0));
self:GetChild("MinasCalcValue2"):settextf("%05.2f",GetCurrSteps:GetMSD(getCurRateValue(),1));
self:GetChild("MinasCalcValue3"):settextf("%05.2f",GetCurrSteps:GetMSD(getCurRateValue(),2));
self:GetChild("MinasCalcValue4"):settextf("%05.2f",GetCurrSteps:GetMSD(getCurRateValue(),3));
MESSAGEMAN:Broadcast("UpdateMSDInfo")

self:GetChild("RateLabel"):settext(getCurRateDisplayString());

local difficulty = GetCurrSteps:GetDifficulty();
local stepsType = GetCurrSteps:GetStepsType();

Expand Down
136 changes: 113 additions & 23 deletions Themes/Til Death/BGAnimations/ScreenSelectMusic decorations/msd.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
--Local vars
local update = false
local steps
local song
local frameX = 10
local frameY = 45
local frameWidth = capWideScale(320,400)
local frameHeight = 350
local fontScale = 0.4
local distY = 15
local offsetX = 10
local offsetY = 20
local pn = GAMESTATE:GetEnabledPlayers()[1]
local greatest = 0
local steps
local meter = {}
meter[1] = 0.00

--Actor Frame
local t = Def.ActorFrame{
BeginCommand=cmd(queuecommand,"Set";visible,false),
OffCommand=cmd(bouncebegin,0.2;xy,-500,0;diffusealpha,0),
Expand All @@ -12,6 +28,18 @@ local t = Def.ActorFrame{
self:visible(true)
song = GAMESTATE:GetCurrentSong()
steps = GAMESTATE:GetCurrentSteps(PLAYER_1)

--Find max MSD value, store MSD values in meter[]
greatest=0
if song and steps then
for i=1,#ms.SkillSets do
meter[i+1] = steps:GetMSD(getCurRateValue(), i-1)
if meter[i+1] > meter[greatest+1] then
greatest = i
end
end
end

MESSAGEMAN:Broadcast("UpdateMSDInfo")
update = true
else
Expand All @@ -24,45 +52,50 @@ local t = Def.ActorFrame{
PlayerJoinedMessageCommand=cmd(queuecommand,"Set"),
}

local frameX = 10
local frameY = 45
local frameWidth = capWideScale(320,400)
local frameHeight = 350
local fontScale = 0.4
local distY = 15
local offsetX = 10
local offsetY = 20
local pn = GAMESTATE:GetEnabledPlayers()[1]


--BG quad
t[#t+1] = Def.Quad{InitCommand=cmd(xy,frameX,frameY;zoomto,frameWidth,frameHeight;halign,0;valign,0;diffuse,color("#333333CC"))}

-- should make a highlight or something to indicate the greatest value at a quick glance
--Skillset label function
local function littlebits(i)
local t = Def.ActorFrame{
LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+15,frameY+160 + 22*i;halign,0;valign,0;zoom,0.5;maxwidth,110/0.6),
InitCommand=cmd(xy,frameX+35,frameY+120 + 22*i;halign,0;valign,0;zoom,0.5;maxwidth,110/0.6),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
--skillset name
if song and steps then
self:settext(ms.SkillSets[i]..":")
else
self:settext("")
end
--highlight
if greatest == i then
self:diffuse(getMainColor('positive'))
else
self:diffuse(getMainColor('negative'))
end
--If negative BPM empty label
if steps:GetTimingData():HasWarps() then
self:settext("");
end
end,
UpdateMSDInfoCommand=cmd(queuecommand,"Set"),
},
LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+205,frameY+160 + 22*i;halign,1;valign,0;zoom,0.5;maxwidth,110/0.6),
InitCommand=cmd(xy,frameX+225,frameY+120 + 22*i;halign,1;valign,0;zoom,0.5;maxwidth,110/0.6),
BeginCommand=cmd(queuecommand,"Set"),
SetCommand=function(self)
if song and steps then
local meter = steps:GetMSD(getCurRateValue(), i-1) -- c++ indexing
self:settextf("%05.2f",meter)
self:diffuse(ByMSD(meter))
--local meter = steps:GetMSD(getCurRateValue(), i-1) -- c++ indexing -- Done through an array when looking for the greater value
self:settextf("%05.2f",meter[i+1])
self:diffuse(ByMSD(meter[i+1]))
else
self:settext("")
end
--If negative BPM empty label
if steps:GetTimingData():HasWarps() then
self:settext("");
end
end,
CurrentRateChangedMessageCommand=cmd(queuecommand,"Set"),
UpdateMSDInfoCommand=cmd(queuecommand,"Set"),
Expand All @@ -71,6 +104,7 @@ local function littlebits(i)
return t
end

--Song Title
t[#t+1] = Def.Quad{InitCommand=cmd(xy,frameX,frameY;zoomto,frameWidth,offsetY;halign,0;valign,0;diffuse,getMainColor('frames');diffusealpha,0.5)}
t[#t+1] = LoadFont("Common Normal")..{InitCommand=cmd(xy,frameX+5,frameY+offsetY-9;zoom,0.6;halign,0;diffuse,getMainColor('positive');settext,"MSD Breakdown (Wip)")}
t[#t+1] = LoadFont("Common Large")..{
Expand All @@ -85,21 +119,77 @@ t[#t+1] = LoadFont("Common Large")..{
UpdateMSDInfoCommand=cmd(queuecommand,"Set"),
}


-- Music Rate Display
t[#t+1] = LoadFont("Common Large") .. {
InitCommand=cmd(xy,frameX+frameWidth-100,frameY+offsetY+65;visible,true;halign,0;zoom,0.4;maxwidth,capWideScale(get43size(360),360)/capWideScale(get43size(0.45),0.45)),
BeginCommand=function(self)
self:settext(getCurRateDisplayString())
end,
CurrentRateChangedCommand=function(self)
self:settext(getCurRateDisplayString())
end
}

--Difficulty
t[#t+1] = LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX+5,frameY+55;zoom,0.6;halign,0),
Name="StepsAndMeter",
InitCommand=cmd(xy,frameX+frameWidth-offsetX,frameY+offsetY+50;zoom,0.5;halign,1),
SetCommand=function(self)
if song then
self:settext(getDifficulty(GAMESTATE:GetCurrentSteps(PLAYER_1):GetDifficulty()))
self:diffuse(getDifficultyColor(GetCustomDifficulty(GAMESTATE:GetCurrentSteps(PLAYER_1):GetStepsType(),GAMESTATE:GetCurrentSteps(PLAYER_1):GetDifficulty())))
steps = GAMESTATE:GetCurrentSteps(pn)
if steps ~= nil then
local diff = getDifficulty(steps:GetDifficulty())
local stype = ToEnumShortString(steps:GetStepsType()):gsub("%_"," ")
local meter = steps:GetMeter()
if update then
self:settext(stype.." "..diff.." "..meter)
self:diffuse(getDifficultyColor(GetCustomDifficulty(steps:GetStepsType(),steps:GetDifficulty())))
end
end
end,
ScoreUpdateMessageCommand=cmd(queuecommand,"Set")
}


--NPS
t[#t+1] = LoadFont("Common Normal")..{
Name="NPS";
InitCommand=cmd(xy,frameX+frameWidth-15,frameY+60;zoom,0.4;halign,1;);
SetCommand=function(self)
steps = GAMESTATE:GetCurrentSteps(pn)
--local song = GAMESTATE:GetCurrentSong()
local notecount = 0
local length = 1
if steps ~= nil and song ~= nil and update then
length = song:GetStepsSeconds()
notecount = steps:GetRadarValues(pn):GetValue("RadarCategory_Notes")
self:settext(string.format("%0.2f Average NPS",notecount/length))
self:diffuse(Saturation(getDifficultyColor(GetCustomDifficulty(steps:GetStepsType(),steps:GetDifficulty())),0.3))
else
self:settext("")
self:settext("0.00 Average NPS")
end
end;
CurrentSongChangedMessageCommand=cmd(queuecommand,"Set");
CurrentStepsP1ChangedMessageCommand=cmd(queuecommand,"Set");
CurrentStepsP2ChangedMessageCommand=cmd(queuecommand,"Set");
};

--Negative BPMs label
t[#t+1] = LoadFont("Common Normal")..{
InitCommand=cmd(xy,frameX+45,frameY+135;zoom,0.8;halign,0;diffuse,getMainColor('negative');settext,"Negative Bpms";),
SetCommand=function(self)
if steps:GetTimingData():HasWarps() then
self:settext("Negative Bpms");
else
self:settext("");
end
end,
UpdateMSDInfoCommand=cmd(queuecommand,"Set"),
}

--Skillset labels
for i=1,#ms.SkillSets do
t[#t+1] = littlebits(i)
end

return t
return t
1 change: 1 addition & 0 deletions src/ScreenNetSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
}
}

m_MusicWheel.ReloadSongList(false, "");
vector <Song *> AllSongs = SONGMAN->GetAllSongs();
unsigned i;
for( i=0; i < AllSongs.size(); i++ )
Expand Down

0 comments on commit fe2bd47

Please sign in to comment.