Skip to content

Commit

Permalink
ETTPC score sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Mar 27, 2018
1 parent 4d5eabd commit 14c5e2d
Show file tree
Hide file tree
Showing 11 changed files with 508 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ local frameY = 140
local frameWidth = SCREEN_CENTER_X-120

function scoreBoard(pn,position)
local t = Def.ActorFrame{
BeginCommand=function(self)
if position == 1 then
self:x(SCREEN_WIDTH-(frameX*2)-frameWidth)
end
end
}

local customWindow
local judge = enabledCustomWindows and 0 or GetTimingDifficulty()
Expand All @@ -105,6 +98,21 @@ function scoreBoard(pn,position)
local dvt = pss:GetOffsetVector()
local totalTaps = pss:GetTotalTaps()

local t = Def.ActorFrame{
BeginCommand=function(self)
if position == 1 then
self:x(SCREEN_WIDTH-(frameX*2)-frameWidth)
end
end,
UpdateNetEvalStatsMessageCommand = function(self)
local s = SCREENMAN:GetTopScreen():GetHighScore()
if s then
score = s
end
dvt = score:GetOffsetVector()
MESSAGEMAN:Broadcast("ScoreChanged")
end,
}
t[#t+1] = Def.Quad{
InitCommand=function(self)
self:xy(frameX-5,frameY):zoomto(frameWidth+10,220):halign(0):valign(0):diffuse(color("#333333CC"))
Expand Down Expand Up @@ -141,6 +149,7 @@ function scoreBoard(pn,position)
BeginCommand=function(self)
self:queuecommand("Set")
end,
ScoreChangedMessageCommand = function(self) self:queuecommand("Set"); end,
SetCommand=function(self)
local meter = score:GetSkillsetSSR("Overall")
self:settextf("%5.2f", meter)
Expand Down Expand Up @@ -171,13 +180,14 @@ function scoreBoard(pn,position)
self:queuecommand("Set")
end,
SetCommand=function(self)
self:diffuse(getGradeColor(pss:GetWifeGrade()))
self:settextf("%05.2f%% (%s)",notShit.floor(pss:GetWifeScore()*10000)/100, "Wife")
self:diffuse(getGradeColor(score:GetWifeGrade()))
self:settextf("%05.2f%% (%s)",notShit.floor(score:GetWifeScore()*10000)/100, "Wife")
end,
ScoreChangedMessageCommand = function(self) self:queuecommand("Set"); end,
CodeMessageCommand=function(self,params)
local totalHolds = pss:GetRadarPossible():GetValue("RadarCategory_Holds") + pss:GetRadarPossible():GetValue("RadarCategory_Rolls")
local holdsHit = pss:GetRadarActual():GetValue("RadarCategory_Holds") + pss:GetRadarActual():GetValue("RadarCategory_Rolls")
local minesHit = pss:GetRadarPossible():GetValue("RadarCategory_Mines") - pss:GetRadarActual():GetValue("RadarCategory_Mines")
local holdsHit = score:GetRadarValues():GetValue("RadarCategory_Holds") + score:GetRadarValues():GetValue("RadarCategory_Rolls")
local minesHit = pss:GetRadarPossible():GetValue("RadarCategory_Mines") - score:GetRadarValues():GetValue("RadarCategory_Mines")
if enabledCustomWindows then
if params.Name == "PrevJudge" then
judge = judge < 2 and #customWindows or judge - 1
Expand Down Expand Up @@ -272,8 +282,9 @@ function scoreBoard(pn,position)
self:queuecommand("Set")
end,
SetCommand=function(self)
self:settext(pss:GetTapNoteScores(v))
self:settext(score:GetTapNoteScore(v))
end,
ScoreChangedMessageCommand = function(self) self:queuecommand("Set"); end,
CodeMessageCommand=function(self,params)
if params.Name == "PrevJudge" or params.Name == "NextJudge" then
if enabledCustomWindows then
Expand Down Expand Up @@ -321,7 +332,8 @@ function scoreBoard(pn,position)
BeginCommand=function(self)
self:queuecommand("Set")
end,
Se2tCommand=function(self)
ScoreChangedMessageCommand = function(self) self:queuecommand("Set"); end,
SetCommand=function(self)
if score:GetChordCohesion() == true then
self:settext("Chord Cohesion: Yes")
else
Expand Down Expand Up @@ -350,8 +362,9 @@ function scoreBoard(pn,position)
self:queuecommand("Set")
end,
SetCommand=function(self)
self:settextf("%03d/%03d",pss:GetRadarActual():GetValue("RadarCategory_"..fart[i]),pss:GetRadarPossible():GetValue("RadarCategory_"..fart[i]))
end
self:settextf("%03d/%03d",score:GetRadarValues():GetValue("RadarCategory_"..fart[i]),pss:GetRadarPossible():GetValue("RadarCategory_"..fart[i]))
end,
ScoreChangedMessageCommand = function(self) self:queuecommand("Set"); end,
};
end

Expand Down
59 changes: 40 additions & 19 deletions Themes/Til Death/BGAnimations/ScreenNetEvaluation decorations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,28 @@ end


function scoreBoard(pn,position)
local judge = GetTimingDifficulty()
local pss = STATSMAN:GetCurStageStats():GetPlayerStageStats(pn)
local score = SCOREMAN:GetMostRecentScore()
local smallest,largest
local devianceTable
local t = Def.ActorFrame{
BeginCommand=function(self)
if position == 1 then
self:x(SCREEN_WIDTH-(frameX*2)-frameWidth)
end
end
end,
UpdateNetEvalStatsMessageCommand = function(self)
local s = SCREENMAN:GetTopScreen():GetHighScore()
if s then
score = s
devianceTable = score:GetOffsetVector()
smallest,largest = wifeRange(devianceTable)
MESSAGEMAN:Broadcast("ScoreChanged")
end
end,
}

local judge = GetTimingDifficulty()
local pss = STATSMAN:GetCurStageStats():GetPlayerStageStats(pn)
local score = SCOREMAN:GetMostRecentScore()

t[#t+1] = Def.Quad{
InitCommand=function(self)
Expand Down Expand Up @@ -257,6 +268,7 @@ function scoreBoard(pn,position)
BeginCommand=function(self)
self:queuecommand("Set")
end,
ScoreChangedMessageCommand = function(self) self:queuecommand("Set"); end,
SetCommand=function(self)
local meter = score:GetSkillsetSSR("Overall")
self:settextf("%5.2f", meter)
Expand Down Expand Up @@ -425,11 +437,6 @@ function scoreBoard(pn,position)
InitCommand=function(self)
self:Load("StepsDisplayEvaluation",pn):SetFromGameState(pn)
end;
UpdateNetEvalStatsMessageCommand=function(self,param)
if GAMESTATE:IsPlayerEnabled(pn) then
self:SetFromSteps(param.Steps)
end;
end;
}
t[#t+1] = StandardDecorationFromTable( "StepsDisplay" .. ToEnumShortString(pn), t2 )
end
Expand All @@ -443,9 +450,10 @@ function scoreBoard(pn,position)
BeginCommand=function(self)
self:queuecommand("Set")
end,
ScoreChangedMessageCommand = function(self) self:queuecommand("Set"); end,
SetCommand=function(self)
self:diffuse(getGradeColor(pss:GetWifeGrade()))
self:settextf("%05.2f%% (%s)",notShit.floor(pss:GetWifeScore()*10000)/100, "Wife")
self:diffuse(getGradeColor(score:GetWifeGrade()))
self:settextf("%05.2f%% (%s)",notShit.floor(score:GetWifeScore()*10000)/100, "Wife")
end,
CodeMessageCommand=function(self,params)
if params.Name == "PrevJudge" and judge > 1 then
Expand Down Expand Up @@ -473,7 +481,10 @@ function scoreBoard(pn,position)
end,
SetCommand=function(self)
self:settext(GAMESTATE:GetPlayerState(PLAYER_1):GetPlayerOptionsString('ModsLevel_Current'))
end
end,
ScoreChangedMessageCommand=function(self)
self:settext(SCREENMAN:GetTopScreen():GetOptions() or "")
end,
}

for k,v in ipairs(judges) do
Expand All @@ -489,6 +500,10 @@ function scoreBoard(pn,position)
BeginCommand=function(self)
self:glowshift():effectcolor1(color("1,1,1,"..tostring(pss:GetPercentageOfTaps(v)*0.4))):effectcolor2(color("1,1,1,0")):sleep(0.5):decelerate(2):zoomx(frameWidth*pss:GetPercentageOfTaps(v))
end,
ScoreChangedMessageCommand = function(self)
local rescoreJudges = score:RescoreJudges(judge)
self:zoomx(frameWidth*rescoreJudges[k]/(#(score:GetOffsetVector())))
end,
CodeMessageCommand=function(self,params)
if params.Name == "PrevJudge" or params.Name == "NextJudge" then
local rescoreJudges = score:RescoreJudges(judge)
Expand Down Expand Up @@ -517,6 +532,9 @@ function scoreBoard(pn,position)
SetCommand=function(self)
self:settext(pss:GetTapNoteScores(v))
end,
ScoreChangedMessageCommand = function(self)
self:settext(score:GetTapNoteScore(v))
end,
CodeMessageCommand=function(self,params)
if params.Name == "PrevJudge" or params.Name == "NextJudge" then
local rescoreJudges = score:RescoreJudges(judge)
Expand All @@ -531,6 +549,9 @@ function scoreBoard(pn,position)
BeginCommand=function(self)
self:queuecommand("Set")
end,
ScoreChangedMessageCommand = function(self)
self:settextf("(%03.2f%%)",score:GetTapNoteScore(v)/(#(score:GetOffsetVector()))*100)
end,
SetCommand=function(self)
self:settextf("(%03.2f%%)",pss:GetPercentageOfTaps(v)*100)
end,
Expand Down Expand Up @@ -575,14 +596,14 @@ function scoreBoard(pn,position)
self:xy(frameWidth+25,frameY+230):zoomto(frameWidth/2+10,60):halign(1):valign(0):diffuse(color("#333333CC"))
end;
}
local smallest,largest = wifeRange(devianceTable)
smallest,largest = wifeRange(devianceTable)
local doot = {"Mean", "Mean(Abs)", "Sd", "Smallest", "Largest"}
local mcscoot = {
wifeMean(devianceTable),
ms.tableSum(devianceTable, 1,true)/#devianceTable,
wifeSd(devianceTable),
smallest,
largest
function() return wifeMean(devianceTable) end,
function() return ms.tableSum(devianceTable, 1,true)/#devianceTable end,
function() return wifeSd(devianceTable) end,
function() smallest end,
function() largest end
}

for i=1,#doot do
Expand All @@ -593,7 +614,7 @@ function scoreBoard(pn,position)
}
t[#t+1] = LoadFont("Common Normal")..{
InitCommand=function(self)
self:xy(frameWidth+20,frameY+230+10*i):zoom(0.4):halign(1):settextf("%5.2fms",mcscoot[i])
self:xy(frameWidth+20,frameY+230+10*i):zoom(0.4):halign(1):settextf("%5.2fms",mcscoot[i]())
end
}
end
Expand Down
16 changes: 14 additions & 2 deletions Themes/Til Death/BGAnimations/offsetplot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local pss = STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_1)
local dvt = pss:GetOffsetVector()
local nrt = pss:GetNoteRowVector()
local td = GAMESTATE:GetCurrentSteps(PLAYER_1):GetTimingData()
local wuab = {}
local finalSecond = GAMESTATE:GetCurrentSong(PLAYER_1):GetLastSecond()

local function fitX(x) -- Scale time values to fit within plot width.
Expand Down Expand Up @@ -73,6 +74,18 @@ local o = Def.ActorFrame{
maxOffset = (enabledCustomWindows and judge ~= 0) and customWindow.judgeWindows.boo or math.max(180, 180*tso)
MESSAGEMAN:Broadcast("JudgeDisplayChanged")
end,
UpdateNetEvalStatsMessageCommand = function(self)
local s = SCREENMAN:GetTopScreen():GetHighScore()
if s then
score = s
dvt = score:GetOffsetVector()
nrt = score:GetNoteRowVector()
for i=1,#nrt do
wuab[i] = td:GetElapsedTimeFromNoteRow(nrt[i])
end
end
MESSAGEMAN:Broadcast("JudgeDisplayChanged")
end,
}
-- Center Bar
o[#o+1] = Def.Quad{
Expand Down Expand Up @@ -107,7 +120,6 @@ o[#o+1] = Def.Quad{InitCommand=function(self)
self:zoomto(plotWidth+plotMargin,plotHeight+plotMargin):diffuse(color("0.05,0.05,0.05,0.05")):diffusealpha(0.8)
end}
-- Convert noterows to timestamps and plot dots
local wuab = {}
for i=1,#nrt do
wuab[i] = td:GetElapsedTimeFromNoteRow(nrt[i])
end
Expand Down Expand Up @@ -136,7 +148,7 @@ o[#o+1] = Def.ActorMultiVertex{
end,
JudgeDisplayChangedMessageCommand=function(self)
local verts = {};
for i=1,#nrt do
for i=1,#dvt do
local x = fitX(wuab[i]);
local y = fitY(dvt[i]);
local fit = (enabledCustomWindows and judge ~= 0) and customWindow.judgeWindows.boo + 3 or math.max(183, 183*tso)
Expand Down
23 changes: 14 additions & 9 deletions src/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1254,22 +1254,27 @@ class LunaHighScore: public Luna<HighScore>

// Convert to MS so lua doesn't have to
static int GetOffsetVector(T* p, lua_State *L) {
if (p->LoadReplayData()) {
vector<float> doot = p->GetOffsetVector();
for (size_t i = 0; i < doot.size(); ++i)
doot[i] = doot[i] * 1000;
LuaHelpers::CreateTableFromArray(doot, L);
p->UnloadReplayData();
auto v = p->GetOffsetVector();
bool loaded = v.size() > 0;
if (loaded || p->LoadReplayData()) {
for (size_t i = 0; i < v.size(); ++i)
v[i] = v[i] * 1000;
LuaHelpers::CreateTableFromArray(v, L);
if (!loaded)
p->UnloadReplayData();
}
else
lua_pushnil(L);
return 1;
}

static int GetNoteRowVector(T* p, lua_State *L) {
if (p->LoadReplayData()) {
LuaHelpers::CreateTableFromArray(p->GetNoteRowVector(), L);
p->UnloadReplayData();
auto& v = p->GetNoteRowVector();
bool loaded = v.size() > 0;
if (loaded || p->LoadReplayData()) {
LuaHelpers::CreateTableFromArray(v, L);
if(!loaded)
p->UnloadReplayData();
}
else
lua_pushnil(L);
Expand Down
Loading

0 comments on commit 14c5e2d

Please sign in to comment.