add levelselector

This commit is contained in:
Not
2022-08-29 06:08:53 +02:00
parent c83dc1d070
commit b6e6e82bd6
2 changed files with 362 additions and 2 deletions

View File

@ -33,7 +33,7 @@ local RedFlash = {
local StatTrack = false
local UNCLAIMED = "Unclaimed Record"
local HELP_MESSAGE = "\x89Leaderboard Commands:\nretry exit findmap changelevel spba_clearcheats lb_gui rival scroll encore records"
local HELP_MESSAGE = "\x89Leaderboard Commands:\nretry exit findmap changelevel spba_clearcheats lb_gui rival scroll encore records levelselect"
local FILENAME = "leaderboard.txt"
-- Retry / changelevel map
@ -68,6 +68,7 @@ local DS_DEFAULT = 0x0
local DS_SCROLL = 0x1
local DS_AUTO = 0x2
local DS_SCRLTO = 0x4
local DS_BROWSER = 0x8
local drawState = DS_DEFAULT
@ -396,6 +397,18 @@ local function exitlevel(player, ...)
end
COM_AddCommand("exit", exitlevel)
local function browser(player)
if not doyoudare(player) then return end
if not rawget(_G, "DrawBrowser") then
print("Browser is not loaded")
return
end
rawget(_G, "InitBrowser")()
drawState = DS_BROWSER
end
COM_AddCommand("levelselect", browser)
local function zoneAct(map)
local z = ""
if map.zonttl != "" then
@ -835,6 +848,7 @@ function ticsToTime(tics, pure)
G_TicsToCentiseconds(tics)
)
end
rawset(_G, "TicsToTime", ticsToTime)
-- Item patches have the amazing property of being displaced 12x 13y pixels
local iXoffset = 13 * FRACUNIT
@ -1116,11 +1130,16 @@ local function drawScrollTo(v, player, scoreTable, gui)
drawScroll(v, player, scoreTable, gui)
end
local function drawBrowser(v, player)
rawget(_G, "DrawBrowser")(v, lb)
end
local stateFunctions = {
[DS_DEFAULT] = drawDefault,
[DS_SCROLL] = drawScroll,
[DS_AUTO] = drawAuto,
[DS_SCRLTO] = drawScrollTo
[DS_SCRLTO] = drawScrollTo,
[DS_BROWSER] = drawBrowser
}
-- Draw mode and return pos + 1 if success
@ -1457,6 +1476,10 @@ local function think()
scrollAcc = 0
end
end
elseif drawState == DS_BROWSER then
if rawget(_G, "BrowserController")(p) then
drawState = DS_DEFAULT
end
end
if p.lives == 0 then