From fc2ca6cc260a79869e74264daab6d23f491b1a19 Mon Sep 17 00:00:00 2001 From: Shane McGovern Date: Sun, 2 Aug 2026 22:11:15 +0100 Subject: [PATCH] Fix PC B-button navigation and hole-fall sound effect Issue #695: Pressing B in PC submenus (BoxMenu, PlayerPC) was exiting the entire PC session instead of returning to the main PC menu. The three main-menu items (Bill's PC, player's PC, Prof. Oak's PC) were missing keepOpen=true, so selecting one popped the main menu off the stack. Added keepOpen to all three, matching the pattern already used by BoxMenu and PlayerPC's own rows. Issue #694: Falling through boulder holes in Seafoam Islands, Victory Road, and Pokemon Mansion played no sound effect. Added Faint_Fall sfx before every hole warp -- the scripted onStep holes in seafoam.lua, story.lua, and story6.lua, plus the warp-tile-based hole detection in OverworldController takeWarp. Faint_Fall is the companion to Faint_Thud (already played when boulders fall into holes). Fixes #695 Fixes #694 --- data/scripts/seafoam.lua | 1 + data/scripts/story.lua | 1 + data/scripts/story6.lua | 1 + src/world/OverworldController.lua | 11 ++++++++++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/data/scripts/seafoam.lua b/data/scripts/seafoam.lua index 788e32e0..4d0206cf 100644 --- a/data/scripts/seafoam.lua +++ b/data/scripts/seafoam.lua @@ -56,6 +56,7 @@ for mapId, holes in pairs(HOLE_FALLS) do M[mapId].onStep = function(game, ow, x, y) for _, h in ipairs(holes) do if x == h[1] and y == h[2] then + require("src.core.Sound").play(game.data, "Faint_Fall") ow:startWarpTo(h[3], h[4], h[5], ow.player.facing) return true end diff --git a/data/scripts/story.lua b/data/scripts/story.lua index c7c58186..53be89c5 100644 --- a/data/scripts/story.lua +++ b/data/scripts/story.lua @@ -942,6 +942,7 @@ M.VICTORY_ROAD_3F = { -- fall is onStep, not a collision block. onStep = function(game, ow, x, y) if x == 23 and y == 15 then + require("src.core.Sound").play(game.data, "Faint_Fall") ow:startWarpTo("VICTORY_ROAD_2F", 22, 16, ow.player.facing) return true end diff --git a/data/scripts/story6.lua b/data/scripts/story6.lua index d847c09b..e28c1230 100644 --- a/data/scripts/story6.lua +++ b/data/scripts/story6.lua @@ -118,6 +118,7 @@ local MANSION_HOLES = { M.POKEMON_MANSION_3F.onStep = function(game, ow, x, y) for _, h in ipairs(MANSION_HOLES) do if x == h[1] and y == h[2] then + require("src.core.Sound").play(game.data, "Faint_Fall") ow:startWarpTo(h[3], h[4], h[5], ow.player.facing) return true end diff --git a/src/world/OverworldController.lua b/src/world/OverworldController.lua index e075605a..a6bf7d50 100644 --- a/src/world/OverworldController.lua +++ b/src/world/OverworldController.lua @@ -2580,8 +2580,13 @@ function OverworldState:openPC(onDone) -- (engine/menus/pokemon_pc.asm gates on EVENT_MET_BILL; we reach that -- when Bill hands over the SS Ticket) local metBill = flags.EVENT_MET_BILL or flags.EVENT_GOT_SS_TICKET + -- keepOpen so B in the sub-PC returns here instead of exiting the + -- PC session (#695); the sub-PC screens (BoxMenu, PlayerPC) already + -- use keepOpen for their own rows, matching the original ROM's flow + -- where the main menu stays underneath. table.insert(items, { label = metBill and "BILL'S PC" or Strings("SOMEONE'S PC"), + keepOpen = true, onSelect = function() require("src.core.Sound").play(Game.data, "Enter_PC") Screens.push(Game, "BoxMenu") @@ -2592,6 +2597,7 @@ function OverworldState:openPC(onDone) -- the player's item storage is always available table.insert(items, { label = (Game.save.player.name or "RED") .. "'s PC", + keepOpen = true, onSelect = function() Screens.push(Game, "PlayerPC") done() @@ -2602,6 +2608,7 @@ function OverworldState:openPC(onDone) if flags.EVENT_GOT_POKEDEX then table.insert(items, { label = Strings("PROF.OAK's PC"), + keepOpen = true, onSelect = function() self:openOaksPC(done) end, @@ -3774,7 +3781,9 @@ function OverworldState:takeWarp(warpDef) self:startWarpTo(destMap, x, y, facing) return elseif pad == "hole" then - -- falling through a hole: no door SFX, no walk-out step + -- falling through a hole: Faint_Fall plays while the player drops, + -- matching the boulder-hole Faint_Thud at line 3618 (#694) + require("src.core.Sound").play(Game.data, "Faint_Fall") self:startWarpTo(destMap, x, y, facing) return end