draw flags

This commit is contained in:
Not 2022-08-31 00:41:05 +02:00
parent 45cefc786e
commit 45effdd048
1 changed files with 51 additions and 1 deletions

View File

@ -109,6 +109,7 @@ local F_SPBATK = 0x1
local F_SPBJUS = 0x2
local F_SPBBIG = 0x4
local F_SPBEXP = 0x8
local F_ENCORE = 0x80
local function drawGamemode(v)
local m = modes[mode] or 0
@ -179,6 +180,53 @@ local function drawGamemode(v)
end
end
local function drawFlags(v, x, y, flags)
local nx = x * FRACUNIT
local ny = y * FRACUNIT + 3 * FRACUNIT
local margin = 4 * FRACUNIT
if flags & F_ENCORE then
local encp = v.cachePatch("RUBYICON")
v.drawScaled(
nx, ny,
FRACUNIT / 6,
encp
)
nx = $ + margin
end
if flags & F_SPBATK then
local scale = FRACUNIT / 4
local shift = 6 * FRACUNIT
nx = $ - shift
ny = $ - shift
if flags & F_SPBJUS then
local hyup = v.cachePatch("K_ISHYUD")
v.drawScaled(nx, ny, scale, hyup)
nx = $ + margin
end
if flags & F_SPBBIG then
local growp = v.cachePatch("K_ISGROW")
v.drawScaled(nx, ny, scale, growp)
nx = $ + margin
end
if flags & F_SPBEXP then
local invp = v.cachePatch("K_ISINV"..(leveltime / 6 % 6 + 1))
v.drawScaled(nx, ny, scale, invp)
end
end
end
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")
end
end
-- draw in columns
-- pos, facerank, name, time, flags
-- ______________________________________________
@ -189,7 +237,7 @@ local column = {
[1] = 18, -- facerank
[2] = 46, -- name
[3] = 216, -- time
[4] = 250 -- flags
[4] = 270 -- flags
}
local function drawScore(v, i, score)
local y = scoresY + i * 18
@ -201,8 +249,10 @@ local function drawScore(v, i, score)
local facerank = skin and v.cachePatch(skin.facerank) or v.cachePatch("M_NORANK")
v.draw(column[1], y, facerank, 0, v.getColormap("sonic", score["color"]))
drawStats(v, column[1], y, score["skin"], score["stat"])
v.drawString(column[2], y, score["name"], V_ALLOWLOWERCASE)
v.drawString(column[3], y, rawget(_G, "TicsToTime")(score["time"]))
drawFlags(v, column[4], y, score["flags"])
end
local function drawBrowser(v, leaderboard)