forked from Not/srb2k-leaderboard
compress stats into a single number
This commit is contained in:
17
browser.lua
17
browser.lua
@ -266,15 +266,18 @@ local function drawFlags(v, x, y, flags)
|
||||
end
|
||||
end
|
||||
|
||||
local MSK_SPEED = 0xF0
|
||||
local MSK_WEIGHT = 0xF
|
||||
|
||||
local function drawStats(v, x, y, skin, stats)
|
||||
local s = skins[skin]
|
||||
if not (s
|
||||
and s.kartspeed == stats["speed"]
|
||||
and s.kartweight == stats["weight"]
|
||||
)
|
||||
and stats then
|
||||
v.drawString(x-2, y-2, stats["speed"], V_ALLOWLOWERCASE, "thin")
|
||||
v.drawString(x + 13, y + 9, stats["weight"], V_ALLOWLOWERCASE, "thin")
|
||||
if stats
|
||||
and not (s
|
||||
and s.kartspeed == (stats & MSK_SPEED) >> 4
|
||||
and s.kartweight == stats & MSK_WEIGHT
|
||||
) then
|
||||
v.drawString(x-2, y-2, (stats & MSK_SPEED) >> 4, V_ALLOWLOWERCASE, "thin")
|
||||
v.drawString(x + 13, y + 9, stats & MSK_WEIGHT, V_ALLOWLOWERCASE, "thin")
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user