forked from Not/srb2k-leaderboard
add encore support
This commit is contained in:
parent
c49702c33b
commit
0bde2a7fea
@ -20,6 +20,7 @@ local FILENAME = "leaderboard.txt"
|
|||||||
local nextMap = nil
|
local nextMap = nil
|
||||||
|
|
||||||
local Flags = 0
|
local Flags = 0
|
||||||
|
local F_ENCORE = 0x80
|
||||||
|
|
||||||
-- SPB flags with the least significance first
|
-- SPB flags with the least significance first
|
||||||
local F_SPBATK = 0x1
|
local F_SPBATK = 0x1
|
||||||
@ -352,6 +353,20 @@ local function changelevel(player, ...)
|
|||||||
end
|
end
|
||||||
COM_AddCommand("changelevel", changelevel)
|
COM_AddCommand("changelevel", changelevel)
|
||||||
|
|
||||||
|
local function toggleEncore(player)
|
||||||
|
if not doyoudare(player) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local enc = CV_FindVar("kartencore")
|
||||||
|
if enc.value then
|
||||||
|
COM_BufInsertText(server, "kartencore off")
|
||||||
|
else
|
||||||
|
COM_BufInsertText(server, "kartencore on")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
COM_AddCommand("encore", toggleEncore)
|
||||||
|
|
||||||
local function clearcheats(player)
|
local function clearcheats(player)
|
||||||
if not player.spectator then
|
if not player.spectator then
|
||||||
clearcheats = true
|
clearcheats = true
|
||||||
@ -616,12 +631,25 @@ 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
|
||||||
|
|
||||||
--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 player.name == score["name"] 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
|
||||||
|
|
||||||
|
-- Encore
|
||||||
|
if score["flags"] & F_ENCORE then
|
||||||
|
local bob = sin((leveltime + i * 5) * (ANG10))
|
||||||
|
v.drawScaled(
|
||||||
|
x * FRACUNIT,
|
||||||
|
bob + (y + FACERANK_DIM / 2) * FRACUNIT,
|
||||||
|
FRACUNIT / 6,
|
||||||
|
PATCH["RUBY"],
|
||||||
|
V_HUDTRANS
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
-- SPB
|
-- SPB
|
||||||
if score["flags"] & F_SPBATK then
|
if score["flags"] & F_SPBATK then
|
||||||
local scale = FRACUNIT / 4
|
local scale = FRACUNIT / 4
|
||||||
@ -850,6 +878,7 @@ function cachePatches(v)
|
|||||||
end
|
end
|
||||||
PATCH["BIG"] = v.cachePatch("K_ISGROW")
|
PATCH["BIG"] = v.cachePatch("K_ISGROW")
|
||||||
PATCH["HYUD"] = v.cachePatch("K_ISHYUD")
|
PATCH["HYUD"] = v.cachePatch("K_ISHYUD")
|
||||||
|
PATCH["RUBY"] = v.cachePatch("RUBYICON")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1021,7 +1050,13 @@ local function think()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Autospec
|
-- Autospec
|
||||||
|
-- Encore
|
||||||
if leveltime == 1 then
|
if leveltime == 1 then
|
||||||
|
Flags = $ & !F_ENCORE
|
||||||
|
if encoremode then
|
||||||
|
Flags = $ | F_ENCORE
|
||||||
|
end
|
||||||
|
|
||||||
if p then
|
if p then
|
||||||
for s in players.iterate do
|
for s in players.iterate do
|
||||||
if s.valid and s.spectator then
|
if s.valid and s.spectator then
|
||||||
|
Loading…
Reference in New Issue
Block a user