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