diff --git a/browser.lua b/browser.lua index 538dd02..b493e81 100644 --- a/browser.lua +++ b/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 diff --git a/leaderboard.lua b/leaderboard.lua index 1257047..ef69155 100644 --- a/leaderboard.lua +++ b/leaderboard.lua @@ -253,19 +253,19 @@ local function score_t(map, name, skin, color, time, splits, flags, stat) } end +local MSK_SPEED = 0xF0 +local MSK_WEIGHT = 0xF + local function stat_t(speed, weight) if speed and weight then - return { - ["speed"] = speed, - ["weight"] = weight - } + return (speed << 4) | weight end - return nil + return 0 end local function stat_str(stat) 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 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"]] if stat and not ( pskin - and pskin.kartweight == stat["weight"] - and pskin.kartspeed == stat["speed"] + and pskin.kartweight == stat & MSK_WEIGHT + and pskin.kartspeed == (stat & MSK_SPEED) >> 4 ) then - v.drawString(x + FACERANK_DIM - 2, y + 4, stat["speed"], 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 + 4, (stat & MSK_SPEED) >> 4, V_HUDTRANS | VFLAGS, "small") + v.drawString(x + FACERANK_DIM - 2, y + 8, stat & MSK_WEIGHT, V_HUDTRANS | VFLAGS, "small") end if gui == GUI_ON or (gui == GUI_SPLITS and showSplit) then