toggle encore with item button
This commit is contained in:
parent
f21bc7d97c
commit
5fe7a6966a
29
browser.lua
29
browser.lua
@ -12,6 +12,8 @@ local ZoneAct = lb_ZoneAct
|
|||||||
local TicsToTime = lb_TicsToTime
|
local TicsToTime = lb_TicsToTime
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
local cv_kartencore
|
||||||
|
|
||||||
local function mapIndexOffset(n)
|
local function mapIndexOffset(n)
|
||||||
return (mapIndex + n + #maps - 1) % #maps + 1
|
return (mapIndex + n + #maps - 1) % #maps + 1
|
||||||
end
|
end
|
||||||
@ -53,6 +55,7 @@ local mappY = 26
|
|||||||
local ttlY = mappY + FixedMul(30, FRACUNIT / scalar)
|
local ttlY = mappY + FixedMul(30, FRACUNIT / scalar)
|
||||||
local scoresY = ttlY + 16
|
local scoresY = ttlY + 16
|
||||||
|
|
||||||
|
local sin = sin
|
||||||
local function drawMapPatch(v, offset)
|
local function drawMapPatch(v, offset)
|
||||||
local scale = FRACUNIT / (abs(offset) + scalar)
|
local scale = FRACUNIT / (abs(offset) + scalar)
|
||||||
local mapName = G_BuildMapName(getMap(offset))
|
local mapName = G_BuildMapName(getMap(offset))
|
||||||
@ -68,6 +71,26 @@ local function drawMapPatch(v, offset)
|
|||||||
scale,
|
scale,
|
||||||
mapp
|
mapp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local function drawEncore(v)
|
||||||
|
if not cv_kartencore then
|
||||||
|
cv_kartencore = CV_FindVar("kartencore")
|
||||||
|
end
|
||||||
|
|
||||||
|
if not cv_kartencore.value then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local rubyp = v.cachePatch("RUBYICON")
|
||||||
|
local bob = sin(leveltime * ANG10) * 2
|
||||||
|
v.drawScaled(
|
||||||
|
hlfScrnWdth * FRACUNIT,
|
||||||
|
mappY * FRACUNIT + bob,
|
||||||
|
FRACUNIT,
|
||||||
|
rubyp
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local colors = {
|
local colors = {
|
||||||
@ -319,6 +342,7 @@ local function drawBrowser(v)
|
|||||||
|
|
||||||
-- current map
|
-- current map
|
||||||
drawMapPatch(v, 0)
|
drawMapPatch(v, 0)
|
||||||
|
drawEncore(v)
|
||||||
drawMapStrings(v)
|
drawMapStrings(v)
|
||||||
drawGamemode(v)
|
drawGamemode(v)
|
||||||
|
|
||||||
@ -395,7 +419,8 @@ local function resetKeyRepeat()
|
|||||||
repeatCount = 0
|
repeatCount = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local ValidButtons = BT_ACCELERATE | BT_BRAKE | BT_FORWARD | BT_BACKWARD | BT_DRIFT
|
local ValidButtons = BT_ACCELERATE | BT_BRAKE | BT_FORWARD | BT_BACKWARD | BT_DRIFT | BT_ATTACK
|
||||||
|
|
||||||
-- return value indicates we want to exit the browser
|
-- return value indicates we want to exit the browser
|
||||||
local function controller(player)
|
local function controller(player)
|
||||||
keyRepeat = max(0, $ - 1)
|
keyRepeat = max(0, $ - 1)
|
||||||
@ -418,6 +443,8 @@ local function controller(player)
|
|||||||
elseif cmd.buttons & BT_ACCELERATE then
|
elseif cmd.buttons & BT_ACCELERATE then
|
||||||
COM_BufInsertText(player, "changelevel "..G_BuildMapName(maps[mapIndex]))
|
COM_BufInsertText(player, "changelevel "..G_BuildMapName(maps[mapIndex]))
|
||||||
return true
|
return true
|
||||||
|
elseif cmd.buttons & BT_ATTACK then
|
||||||
|
COM_BufInsertText(player, "encore")
|
||||||
elseif cmd.driftturn then
|
elseif cmd.driftturn then
|
||||||
local dir = cmd.driftturn > 0 and -1 or 1
|
local dir = cmd.driftturn > 0 and -1 or 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user