forked from Not/srb2k-leaderboard
flash score on finish
This commit is contained in:
parent
5a74a428b1
commit
d7955feaf8
@ -15,6 +15,21 @@ local EncoreInitial = nil
|
|||||||
local cv_teamchange
|
local cv_teamchange
|
||||||
local scoreTable
|
local scoreTable
|
||||||
|
|
||||||
|
|
||||||
|
-- Text flash on finish
|
||||||
|
local FlashTics = 0
|
||||||
|
local FlashRate
|
||||||
|
local FlashVFlags
|
||||||
|
local YellowFlash = {
|
||||||
|
[0] = V_YELLOWMAP,
|
||||||
|
[1] = V_ORANGEMAP,
|
||||||
|
[2] = 0
|
||||||
|
}
|
||||||
|
local RedFlash = {
|
||||||
|
[0] = V_REDMAP,
|
||||||
|
[1] = 0
|
||||||
|
}
|
||||||
|
|
||||||
-- Tracks if stats have been written or not
|
-- Tracks if stats have been written or not
|
||||||
local StatTrack = false
|
local StatTrack = false
|
||||||
|
|
||||||
@ -706,6 +721,7 @@ addHook("MapLoad", function()
|
|||||||
drawState = DS_DEFAULT
|
drawState = DS_DEFAULT
|
||||||
scrollY = 50 * FRACUNIT
|
scrollY = 50 * FRACUNIT
|
||||||
scrollAcc = 0
|
scrollAcc = 0
|
||||||
|
FlashTics = 0
|
||||||
|
|
||||||
allowJoin(true)
|
allowJoin(true)
|
||||||
--printTable(lb)
|
--printTable(lb)
|
||||||
@ -798,10 +814,11 @@ local FACERANK_DIM = 16
|
|||||||
local FACERANK_SPC = FACERANK_DIM + 4
|
local FACERANK_SPC = FACERANK_DIM + 4
|
||||||
local function drawScore(v, player, pos, x, y, gui, faceRank, score, drawPos, textVFlags)
|
local function drawScore(v, player, pos, x, y, gui, faceRank, score, drawPos, textVFlags)
|
||||||
textVFlags = textVFlags or V_HUDTRANSHALF
|
textVFlags = textVFlags or V_HUDTRANSHALF
|
||||||
|
local me = player.name == score["name"]
|
||||||
|
|
||||||
--draw Patch/chili
|
--draw Patch/chili
|
||||||
v.draw(x, y, faceRank, V_HUDTRANS | VFLAGS, v.getColormap("sonic", score["color"]))
|
v.draw(x, y, faceRank, V_HUDTRANS | VFLAGS, v.getColormap("sonic", score["color"]))
|
||||||
if player.name == score["name"] then
|
if me then
|
||||||
v.draw(x, y, PATCH["CHILI"][(leveltime / 4) % 8], V_HUDTRANS | VFLAGS)
|
v.draw(x, y, PATCH["CHILI"][(leveltime / 4) % 8], V_HUDTRANS | VFLAGS)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -897,11 +914,16 @@ local function drawScore(v, player, pos, x, y, gui, faceRank, score, drawPos, te
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local flashV = 0
|
||||||
|
if me and FlashTics > leveltime then
|
||||||
|
flashV = FlashVFlags[leveltime / FlashRate % (#FlashVFlags + 1)]
|
||||||
|
end
|
||||||
|
|
||||||
v.drawString(
|
v.drawString(
|
||||||
x + FACERANK_DIM + px,
|
x + FACERANK_DIM + px,
|
||||||
y + py,
|
y + py,
|
||||||
name,
|
name,
|
||||||
textVFlags | V_ALLOWLOWERCASE | VFLAGS,
|
textVFlags | V_ALLOWLOWERCASE | VFLAGS | flashV,
|
||||||
stralign
|
stralign
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -919,7 +941,7 @@ local function drawScore(v, player, pos, x, y, gui, faceRank, score, drawPos, te
|
|||||||
x + px + FACERANK_DIM,
|
x + px + FACERANK_DIM,
|
||||||
y + 8,
|
y + 8,
|
||||||
ticsToTime(score["time"], true),
|
ticsToTime(score["time"], true),
|
||||||
textVFlags | bodium[min(pos, 4)] | VFLAGS
|
textVFlags | bodium[min(pos, 4)] | VFLAGS | flashV
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1116,10 +1138,16 @@ local function saveTime(player)
|
|||||||
if lbComp(newscore, scoreTable[i]) then
|
if lbComp(newscore, scoreTable[i]) then
|
||||||
table.remove(scoreTable, i)
|
table.remove(scoreTable, i)
|
||||||
S_StartSound(nil, 130)
|
S_StartSound(nil, 130)
|
||||||
|
FlashTics = leveltime + TICRATE * 3
|
||||||
|
FlashRate = 1
|
||||||
|
FlashVFlags = YellowFlash
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
-- You suck lol
|
-- You suck lol
|
||||||
S_StartSound(nil, 201)
|
S_StartSound(nil, 201)
|
||||||
|
FlashTics = leveltime + TICRATE * 3
|
||||||
|
FlashRate = 3
|
||||||
|
FlashVFlags = RedFlash
|
||||||
scroll_to(player)
|
scroll_to(player)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user