compress stats into a single number
This commit is contained in:
parent
6953f343dc
commit
2d4784f62e
17
browser.lua
17
browser.lua
@ -266,15 +266,18 @@ local function drawFlags(v, x, y, flags)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local MSK_SPEED = 0xF0
|
||||||
|
local MSK_WEIGHT = 0xF
|
||||||
|
|
||||||
local function drawStats(v, x, y, skin, stats)
|
local function drawStats(v, x, y, skin, stats)
|
||||||
local s = skins[skin]
|
local s = skins[skin]
|
||||||
if not (s
|
if stats
|
||||||
and s.kartspeed == stats["speed"]
|
and not (s
|
||||||
and s.kartweight == stats["weight"]
|
and s.kartspeed == (stats & MSK_SPEED) >> 4
|
||||||
)
|
and s.kartweight == stats & MSK_WEIGHT
|
||||||
and stats then
|
) then
|
||||||
v.drawString(x-2, y-2, stats["speed"], V_ALLOWLOWERCASE, "thin")
|
v.drawString(x-2, y-2, (stats & MSK_SPEED) >> 4, V_ALLOWLOWERCASE, "thin")
|
||||||
v.drawString(x + 13, y + 9, stats["weight"], V_ALLOWLOWERCASE, "thin")
|
v.drawString(x + 13, y + 9, stats & MSK_WEIGHT, V_ALLOWLOWERCASE, "thin")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -253,19 +253,19 @@ local function score_t(map, name, skin, color, time, splits, flags, stat)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local MSK_SPEED = 0xF0
|
||||||
|
local MSK_WEIGHT = 0xF
|
||||||
|
|
||||||
local function stat_t(speed, weight)
|
local function stat_t(speed, weight)
|
||||||
if speed and weight then
|
if speed and weight then
|
||||||
return {
|
return (speed << 4) | weight
|
||||||
["speed"] = speed,
|
|
||||||
["weight"] = weight
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
return nil
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local function stat_str(stat)
|
local function stat_str(stat)
|
||||||
if stat then
|
if stat then
|
||||||
return string.format("%d%d", stat["speed"], stat["weight"])
|
return string.format("%d%d", (stat & MSK_SPEED) >> 4, stat & MSK_WEIGHT)
|
||||||
end
|
end
|
||||||
|
|
||||||
return "0"
|
return "0"
|
||||||
@ -987,11 +987,11 @@ local function drawScore(v, player, pos, x, y, gui, faceRank, score, drawPos, te
|
|||||||
local pskin = score["skin"] and skins[score["skin"]]
|
local pskin = score["skin"] and skins[score["skin"]]
|
||||||
if stat and not (
|
if stat and not (
|
||||||
pskin
|
pskin
|
||||||
and pskin.kartweight == stat["weight"]
|
and pskin.kartweight == stat & MSK_WEIGHT
|
||||||
and pskin.kartspeed == stat["speed"]
|
and pskin.kartspeed == (stat & MSK_SPEED) >> 4
|
||||||
) then
|
) then
|
||||||
v.drawString(x + FACERANK_DIM - 2, y + 4, stat["speed"], V_HUDTRANS | VFLAGS, "small")
|
v.drawString(x + FACERANK_DIM - 2, y + 4, (stat & MSK_SPEED) >> 4, V_HUDTRANS | VFLAGS, "small")
|
||||||
v.drawString(x + FACERANK_DIM - 2, y + 8, stat["weight"], V_HUDTRANS | VFLAGS, "small")
|
v.drawString(x + FACERANK_DIM - 2, y + 8, stat & MSK_WEIGHT, V_HUDTRANS | VFLAGS, "small")
|
||||||
end
|
end
|
||||||
|
|
||||||
if gui == GUI_ON or (gui == GUI_SPLITS and showSplit) then
|
if gui == GUI_ON or (gui == GUI_SPLITS and showSplit) then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user