rename cvar lb_spb_separate to lb_spb_combined, display spb flags on rival command

This commit is contained in:
Not 2022-04-27 13:55:41 +02:00
parent 775886f045
commit 5cecda05f1
1 changed files with 22 additions and 8 deletions

View File

@ -177,15 +177,15 @@ local function reinit_lb()
end end
local cv_spb_separate = CV_RegisterVar({ local cv_spb_separate = CV_RegisterVar({
name = "lb_spb_separate", name = "lb_spb_combined",
defaultvalue = 0, defaultvalue = 1,
flags = CV_NETVAR | CV_CALL, flags = CV_NETVAR | CV_CALL,
PossibleValue = CV_YesNo, PossibleValue = CV_YesNo,
func = function(v) func = function(v)
if v.value then if v.value then
ST_SEP = F_SPBATK | F_SPBBIG | F_SPBEXP
else
ST_SEP = F_SPBATK ST_SEP = F_SPBATK
else
ST_SEP = F_SPBATK | F_SPBBIG | F_SPBEXP
end end
reinit_lb() reinit_lb()
@ -538,13 +538,17 @@ local function findRival(player, ...)
return a["rival"]["map"] < b["rival"]["map"] return a["rival"]["map"] < b["rival"]["map"]
end end
local modestrings = {
[F_SPBEXP] = "X",
[F_SPBBIG] = "B",
[F_SPBJUS] = "J",
}
for mode, tbl in pairs(scores) do for mode, tbl in pairs(scores) do
if i >= stop then break end if i >= stop then break end
table.sort(tbl, sortf) table.sort(tbl, sortf)
local spb = mode & F_SPBATK and "SPB" or "TA"
for _, score in ipairs(tbl) do for _, score in ipairs(tbl) do
if o then if o then
o = o - 1 o = o - 1
@ -553,6 +557,16 @@ local function findRival(player, ...)
if i >= stop then break end if i >= stop then break end
i = i + 1 i = i + 1
local modestr = "TA"
if score["rival"]["flags"] & F_SPBATK then
modestr = "SPB"
for k, v in pairs(modestrings) do
if score["rival"]["flags"] & k then
modestr = $ + v
end
end
end
if score["your"] then if score["your"] then
local diff = score["your"]["time"] - score["rival"]["time"] local diff = score["your"]["time"] - score["rival"]["time"]
local color = colors[clamp(-1, diff, 1)] local color = colors[clamp(-1, diff, 1)]
@ -565,7 +579,7 @@ local function findRival(player, ...)
ticsToTime(score["rival"]["time"]), ticsToTime(score["rival"]["time"]),
color, color,
sym[diff<0] + ticsToTime(abs(diff)), sym[diff<0] + ticsToTime(abs(diff)),
spb modestr
) )
) )
else else
@ -576,7 +590,7 @@ local function findRival(player, ...)
G_BuildMapName(score["rival"]["map"]), G_BuildMapName(score["rival"]["map"]),
ticsToTime(score["rival"]["time"]), ticsToTime(score["rival"]["time"]),
ticsToTime(0, true), ticsToTime(0, true),
spb modestr
) )
) )
end end