flip left/right in encore

This commit is contained in:
Not 2022-09-04 17:23:32 +02:00
parent 2f5db0f3c7
commit f21bc7d97c
1 changed files with 21 additions and 16 deletions

View File

@ -395,6 +395,7 @@ local function resetKeyRepeat()
repeatCount = 0
end
local ValidButtons = BT_ACCELERATE | BT_BRAKE | BT_FORWARD | BT_BACKWARD | BT_DRIFT
-- return value indicates we want to exit the browser
local function controller(player)
keyRepeat = max(0, $ - 1)
@ -405,32 +406,36 @@ local function controller(player)
local cmd = player.cmd
if not keyRepeat then
if cmd.driftturn > 0 then
updateMapIndex(-1)
updateKeyRepeat()
elseif cmd.driftturn < 0 then
updateMapIndex(1)
updateKeyRepeat()
if not (cmd.buttons & ValidButtons or cmd.driftturn) then
return
end
updateKeyRepeat()
if cmd.buttons & BT_BRAKE then
S_StartSound(nil, 115)
return true
elseif cmd.buttons & BT_ACCELERATE then
COM_BufInsertText(player, "changelevel "..G_BuildMapName(maps[mapIndex]))
return true
elseif cmd.driftturn then
local dir = cmd.driftturn > 0 and -1 or 1
if encoremode then
updateMapIndex(-dir)
else
updateMapIndex(dir)
end
elseif cmd.buttons & BT_FORWARD then
scrollPos = $ - 1
updateKeyRepeat()
elseif cmd.buttons & BT_BACKWARD then
scrollPos = $ + 1
updateKeyRepeat()
elseif cmd.buttons & BT_DRIFT then
scrollPos = 1
if modes and #modes then
mode = $ % #modes + 1
prefMode = modes[mode]
end
updateKeyRepeat()
elseif cmd.buttons & BT_BRAKE then
S_StartSound(nil, 115)
return true
elseif cmd.buttons & BT_ACCELERATE then
S_StartSound(nil, 143)
COM_BufInsertText(player, "changelevel "..G_BuildMapName(maps[mapIndex]))
return true
end
end
end