mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-18 03:35:56 +02:00
Selecting a start-menu row pops the start menu before the submenu is pushed (Menu's generic A handler), so B in a submenu had no parent to return to and dropped straight to the overworld. pokered redisplays the start menu instead (RedisplayStartMenu from the party/item/ trainer-card/option handlers), so give each vanilla submenu an onCancel that re-opens the start menu; the saved cursor row (wBattleAndStartSavedMenuItem) restores on re-entry. - PokedexMenu/BagMenu forward opts.onCancel into their ListMenu - TrainerCard dismisses back via onCancel on A or B (WaitForTextScrollButtonPress then RedisplayStartMenu) - OptionsMenu fires onCancel from both B/START and the CANCEL row - PlayerPC rows are keepOpen so B in WITHDRAW/DEPOSIT/TOSS returns to the PC root menu (players_pc.asm), matching the BoxMenu pattern The SAVE flow is untouched: StartMenu_SaveReset falls through to HoldTextDisplayOpen and never redisplays the menu. Battle-opened party/bag screens get no onCancel, so mid-battle cancel behavior is unchanged. Co-authored-by: johnjohto <johnjohto@users.noreply.github.com>
This commit is contained in:
@@ -30,8 +30,10 @@ local function quads16(img, count, stride, x0, y0)
|
||||
return q
|
||||
end
|
||||
|
||||
function TrainerCard.new(game)
|
||||
local self = setmetatable({ game = game }, TrainerCard)
|
||||
function TrainerCard.new(game, opts)
|
||||
opts = opts or {}
|
||||
local self = setmetatable({ game = game, onCancel = opts.onCancel },
|
||||
TrainerCard)
|
||||
local img = tryImage("assets/generated/trainer_card/badges.png")
|
||||
if img then
|
||||
-- badges.2bpp is 8 stacked [face, badge] pairs (DrawBadges FaceBadgeTiles)
|
||||
@@ -66,8 +68,12 @@ end
|
||||
|
||||
function TrainerCard:update(dt)
|
||||
local input = self.game.input
|
||||
-- either button dismisses the card back to the start menu
|
||||
-- (StartMenu_TrainerInfo: WaitForTextScrollButtonPress then
|
||||
-- RedisplayStartMenu)
|
||||
if input:wasPressed("a") or input:wasPressed("b") then
|
||||
self.game.stack:pop()
|
||||
if self.onCancel then self.onCancel() end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user