Skip to content

Commit

Permalink
Fix multi eval
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Feb 16, 2019
1 parent 2a9c734 commit 5aadfa3
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 123 deletions.
228 changes: 108 additions & 120 deletions Themes/Til Death/BGAnimations/MPscoreboard.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


local lines = 10 -- number of scores to display
local framex = SCREEN_WIDTH - capWideScale(get43size(230), 230)
local framey = 60
Expand All @@ -12,51 +10,37 @@ local function input(event)
if event.DeviceInput.button == "DeviceButton_left mouse button" and scoreBoard then
if event.type == "InputEventType_Release" then
for i = 1, #multiscores do
if isOver(scoreBoard:GetChild(i):GetChild("mouseOver")) then
SCREENMAN:GetTopScreen():SetCurrentPlayerByName(multiscores[i].user)
scoreBoard:GetChild(i):GetChild("grade"):visible(
not scoreBoard:GetChild(i):GetChild("grade"):GetVisible()
)
scoreBoard:GetChild(i):GetChild("clear"):visible(
not scoreBoard:GetChild(i):GetChild("clear"):GetVisible()
)
scoreBoard:GetChild(i):GetChild("wife"):visible(
not scoreBoard:GetChild(i):GetChild("wife"):GetVisible()
)
scoreBoard:GetChild(i):GetChild("combo"):visible(
not scoreBoard:GetChild(i):GetChild("combo"):GetVisible()
)
scoreBoard:GetChild(i):GetChild("judge"):visible(
not scoreBoard:GetChild(i):GetChild("judge"):GetVisible()
)
scoreBoard:GetChild(i):GetChild("date"):visible(
not scoreBoard:GetChild(i):GetChild("date"):GetVisible()
)
scoreBoard:GetChild(i):GetChild("option"):visible(
not scoreBoard:GetChild(i):GetChild("option"):GetVisible()
)
if isOver(scoreBoard:GetChildren()[tostring(i)]:GetChild("mouseOver")) then
SCREENMAN:GetTopScreen():SetCurrentPlayerByName(multiscores[i].user)
scoreBoard:GetChild(i):GetChild("grade"):visible(not scoreBoard:GetChild(i):GetChild("grade"):GetVisible())
scoreBoard:GetChild(i):GetChild("clear"):visible(not scoreBoard:GetChild(i):GetChild("clear"):GetVisible())
scoreBoard:GetChild(i):GetChild("wife"):visible(not scoreBoard:GetChild(i):GetChild("wife"):GetVisible())
scoreBoard:GetChild(i):GetChild("combo"):visible(not scoreBoard:GetChild(i):GetChild("combo"):GetVisible())
scoreBoard:GetChild(i):GetChild("judge"):visible(not scoreBoard:GetChild(i):GetChild("judge"):GetVisible())
scoreBoard:GetChild(i):GetChild("date"):visible(not scoreBoard:GetChild(i):GetChild("date"):GetVisible())
scoreBoard:GetChild(i):GetChild("option"):visible(not scoreBoard:GetChild(i):GetChild("option"):GetVisible())
end
end
end
end
end
return false
end

local function Update(self)
for i = 1, lines do
if isOver(self:GetChild(i):GetChild("mouseOver")) then
self:GetChild(i):GetChild("mouseOver"):diffusealpha(0.2)
else
self:GetChild(i):GetChild("mouseOver"):diffusealpha(0)
self:GetChild(i):GetChild("grade"):visible(true)
self:GetChild(i):GetChild("wife"):visible(true)
self:GetChild(i):GetChild("combo"):visible(true)
self:GetChild(i):GetChild("judge"):visible(true)
self:GetChild(i):GetChild("clear"):visible(true)
self:GetChild(i):GetChild("date"):visible(false)
self:GetChild(i):GetChild("option"):visible(false)
end
end
for i = 1, lines do
if isOver(self:GetChild(i):GetChild("mouseOver")) then
self:GetChild(i):GetChild("mouseOver"):diffusealpha(0.2)
else
self:GetChild(i):GetChild("mouseOver"):diffusealpha(0)
self:GetChild(i):GetChild("grade"):visible(true)
self:GetChild(i):GetChild("wife"):visible(true)
self:GetChild(i):GetChild("combo"):visible(true)
self:GetChild(i):GetChild("judge"):visible(true)
self:GetChild(i):GetChild("clear"):visible(true)
self:GetChild(i):GetChild("date"):visible(false)
self:GetChild(i):GetChild("option"):visible(false)
end
end
end

local sortFunction = function(first, second)
Expand All @@ -65,72 +49,72 @@ end

local t =
Def.ActorFrame {
Name = "scoreBoard",
InitCommand = function(self)
self:SetUpdateFunction(Update)
end,
BeginCommand = function(self)
SCREENMAN:GetTopScreen():AddInputCallback(input)
multiscores = NSMAN:GetEvalScores()
Name = "scoreBoard",
InitCommand = function(self)
self:SetUpdateFunction(Update)
end,
BeginCommand = function(self)
SCREENMAN:GetTopScreen():AddInputCallback(input)
multiscores = NSMAN:GetEvalScores()
table.sort(multiscores, sortFunction)
for i=1, math.min(#multiscores) do
self:GetChild(i):queuecommand("UpdateNetScore")
end
end,
NewMultiScoreMessageCommand = function(self)
multiscores = NSMAN:GetEvalScores()
for i = 1, math.min(#multiscores) do
self:GetChild(i):queuecommand("UpdateNetScore")
end
end,
NewMultiScoreMessageCommand = function(self)
multiscores = NSMAN:GetEvalScores()
table.sort(multiscores, sortFunction)
for i=1, math.min(#multiscores) do
self:GetChild(i):queuecommand("UpdateNetScore")
end
end
for i = 1, math.min(#multiscores) do
self:GetChild(i):queuecommand("UpdateNetScore")
end
end
}

local function scoreitem(pn, i)
local t =
Def.ActorFrame {
Name = tostring(i),
InitCommand = function(self)
self:visible(false)
end,
UpdateNetScoreCommand = function(self)
self:visible(i <= #multiscores)
end,
Name = tostring(i),
InitCommand = function(self)
self:visible(false)
end,
UpdateNetScoreCommand = function(self)
self:visible(i <= #multiscores)
end,
--The main quad
Def.Quad {
InitCommand = function(self)
self:xy(framex, framey + ((i-1) * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(
self:xy(framex, framey + ((i - 1) * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(
color("#333333")
):diffusealpha(1):diffuserightedge(color("#33333333"))
end
},
--Highlight quad for the current score
Def.Quad {
InitCommand = function(self)
self:xy(framex, framey + ((i-1) * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(
self:xy(framex, framey + ((i - 1) * spacing) - 4):zoomto(frameWidth, 30):halign(0):valign(0):diffuse(
color("#ffffff")
):diffusealpha(0.3):diffuserightedge(color("#33333300"))
end,
UpdateNetScoreCommand = function(self)
self:visible(SCREENMAN:GetTopScreen():GetCurrentPlayer() == i)
end,
UpdateNetEvalStatsMessageCommand = function(self)
self:visible(SCREENMAN:GetTopScreen():GetCurrentPlayer() == i)
end
},
end,
UpdateNetScoreCommand = function(self)
self:visible(SCREENMAN:GetTopScreen():GetCurrentPlayer() == i)
end,
UpdateNetEvalStatsMessageCommand = function(self)
self:visible(SCREENMAN:GetTopScreen():GetCurrentPlayer() == i)
end
},
--Quad that will act as the bounding box for mouse rollover/click stuff.
Def.Quad {
Name = "mouseOver",
UpdateNetScoreCommand = function(self)
self:xy(framex, framey + ((i-1) * spacing) - 4):zoomto(frameWidth*2, 30):halign(0):valign(0):diffuse(
self:xy(framex, framey + ((i - 1) * spacing) - 4):zoomto(frameWidth * 2, 30):halign(0):valign(0):diffuse(
getMainColor("highlight")
):diffusealpha(0)
end
},
--ClearType lamps
Def.Quad {
UpdateNetScoreCommand = function(self)
self:xy(framex, framey + ((i-1) * spacing) - 4):zoomto(8, 30):halign(0):valign(0):diffuse(
self:xy(framex, framey + ((i - 1) * spacing) - 4):zoomto(8, 30):halign(0):valign(0):diffuse(
getClearTypeFromScore(pn, hs, 2)
)
end
Expand All @@ -139,49 +123,53 @@ local function scoreitem(pn, i)
LoadFont("Common normal") ..
{
InitCommand = function(self)
self:xy(framex - 8, framey + 12 + ((i-1) * spacing)):zoom(0.35)
self:xy(framex - 8, framey + 12 + ((i - 1) * spacing)):zoom(0.35)
end,
UpdateNetScoreCommand = function(self)
self:settext(i)
if SCREENMAN:GetTopScreen():GetCurrentPlayer() == i then
self:diffuse(color("#ffcccc"))
else
self:diffuse(color("#FFFFFF"))
end
end,
UpdateNetEvalStatsMessageCommand = function(self)
self:playcommand("UpdateNetScore")
end
},
else
self:diffuse(color("#FFFFFF"))
end
end,
UpdateNetEvalStatsMessageCommand = function(self)
self:playcommand("UpdateNetScore")
end
},
LoadFont("Common normal") ..
{
Name = "wife",
InitCommand = function(self)
self:xy(framex + 10, framey + 11 + ((i-1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
self:xy(framex + 10, framey + 11 + ((i - 1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
end,
UpdateNetScoreCommand = function(self)
self:settextf("%05.2f%% (%s) - %sx", notShit.floor(multiscores[i].highscore:GetWifeScore() * 10000) / 100, "Wife",
string.format("%.2f", multiscores[i].highscore:GetMusicRate()):gsub("%.?0+$", ""))
self:settextf(
"%05.2f%% (%s) - %sx",
notShit.floor(multiscores[i].highscore:GetWifeScore() * 10000) / 100,
"Wife",
string.format("%.2f", multiscores[i].highscore:GetMusicRate()):gsub("%.?0+$", "")
)
end
},
},
LoadFont("Common normal") ..
{
Name = "user",
InitCommand = function(self)
self:xy(framex + 10, framey + 1 + ((i-1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
end,
UpdateNetScoreCommand = function(self)
self:settextf(multiscores[i].user)
if Grade:Reverse()[GetGradeFromPercent(multiscores[i].highscore:GetWifeScore())] < 2 then -- this seeems right -mina
self:rainbowscroll(true)
end
end
},
{
Name = "user",
InitCommand = function(self)
self:xy(framex + 10, framey + 1 + ((i - 1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.3)
end,
UpdateNetScoreCommand = function(self)
self:settextf(multiscores[i].user)
if Grade:Reverse()[GetGradeFromPercent(multiscores[i].highscore:GetWifeScore())] < 2 then -- this seeems right -mina
self:rainbowscroll(true)
end
end
},
LoadFont("Common normal") ..
{
Name = "option",
InitCommand = function(self)
self:xy(framex + 10, framey + 11 + ((i-1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
self:xy(framex + 10, framey + 11 + ((i - 1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
end,
UpdateNetScoreCommand = function(self)
self:settext(multiscores[i].highscore:GetModifiers())
Expand All @@ -190,9 +178,9 @@ local function scoreitem(pn, i)
},
LoadFont("Common normal") ..
{
Name = "grade",
Name = "grade",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 2 + ((i-1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 2 + ((i - 1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
Expand All @@ -203,9 +191,9 @@ local function scoreitem(pn, i)
},
LoadFont("Common normal") ..
{
Name = "clear",
Name = "clear",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 12 + ((i-1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 12 + ((i - 1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
Expand All @@ -216,9 +204,9 @@ local function scoreitem(pn, i)
},
LoadFont("Common normal") ..
{
Name = "combo",
Name = "combo",
InitCommand = function(self)
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 22 + ((i-1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
self:xy(framex + 130 + capWideScale(get43size(0), 50), framey + 22 + ((i - 1) * spacing)):zoom(0.35):halign(0.5):maxwidth(
(frameWidth - 15) / 0.35
)
end,
Expand All @@ -230,24 +218,25 @@ local function scoreitem(pn, i)
{
Name = "judge",
InitCommand = function(self)
self:xy(framex + 10, framey + 20 + ((i-1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
self:xy(framex + 10, framey + 20 + ((i - 1) * spacing)):zoom(0.35):halign(0):maxwidth((frameWidth - 15) / 0.35)
end,
UpdateNetScoreCommand = function(self)
self:settextf("%d / %d / %d / %d / %d / %d",
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W1"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W2"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W3"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W4"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W5"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_Miss")
)
self:settextf(
"%d / %d / %d / %d / %d / %d",
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W1"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W2"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W3"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W4"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_W5"),
multiscores[i].highscore:GetTapNoteScore("TapNoteScore_Miss")
)
end
},
LoadFont("Common normal") ..
{
Name = "date",
InitCommand = function(self)
self:xy(framex + 10, framey + 20 + ((i-1) * spacing)):zoom(0.35):halign(0)
self:xy(framex + 10, framey + 20 + ((i - 1) * spacing)):zoom(0.35):halign(0)
end,
UpdateNetScoreCommand = function(self)
self:settext(multiscores[i].highscore:GetDate())
Expand All @@ -258,9 +247,8 @@ local function scoreitem(pn, i)
return t
end

for i=1,lines do
for i = 1, lines do
t[#t + 1] = scoreitem(1, i)
end


return t
2 changes: 1 addition & 1 deletion src/NetworkSyncManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ ETTProtocol::Update(NetworkSyncManager* n, float fDeltaTime)
for (json::iterator trackIt = jTracks.begin();
trackIt != jTracks.end();
++trackIt)
noterows.emplace_back(trackIt->get<int>());
tracks.emplace_back(trackIt->get<int>());
hs.SetOffsetVector(offsets);
hs.SetNoteRowVector(noterows);
hs.SetTrackVector(tracks);
Expand Down
2 changes: 0 additions & 2 deletions src/ScreenEvaluation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ ScreenEvaluation::Init()
if (GamePreferences::m_AutoPlay == PC_REPLAY) {
m_pStageStats->m_player.m_HighScore.SetRadarValues(
m_pStageStats->m_player.m_radarActual);
} else if (GamePreferences::m_AutoPlay != PC_REPLAY) {
m_pStageStats->FinalizeScores(true);
}

// Run this here, so STATSMAN->m_CurStageStats is available to overlays.
Expand Down

0 comments on commit 5aadfa3

Please sign in to comment.