Merge pull request #333 from johnjohto/fix-midstep-buttons

Gate overworld buttons on the completed step (#286)
This commit is contained in:
bryanthaboi
2026-07-28 12:19:31 -04:00
committed by GitHub
2 changed files with 133 additions and 1 deletions
+18 -1
View File
@@ -969,6 +969,24 @@ end
function OverworldState:handleInput()
local input = Game.input
-- the wall-bonk SFX cooldown ticks with any held direction, step or not
-- (it is a port invention, not part of JoypadOverworld, so the
-- wWalkCounter gate below must not freeze it mid-step)
if self:dirHeld() then
self.bumpCooldown = math.max(0, (self.bumpCooldown or 0) - 1)
end
-- OverworldLoop (home/overworld.asm) gates ALL of JoypadOverworld on
-- wWalkCounter == 0 ("if the player sprite has not yet completed the
-- walking animation" it jumps straight to .moveAhead): A, START and
-- direction initiation are only ever looked at while the player stands
-- on a tile, and a button pressed mid-step is simply never seen.
-- Without this gate a mid-step A/START pushed its TextBox/StartMenu
-- right there and froze Red between tiles, mid-animation (#286). Held
-- directions need no buffering -- isDown below picks them up on the
-- landing frame.
if self.player.moving then return end
if input:wasPressed("a") then
self:interact()
return
@@ -1005,7 +1023,6 @@ function OverworldState:handleInput()
self.bumpCooldown = 16
end
end
self.bumpCooldown = math.max(0, (self.bumpCooldown or 0) - 1)
return result
end
end