palette: a battle menu the cartridge still holds an A on deals no pad

RUN's A is taken and the menu's box stays up while the game stops asking the joypad; a
macro dealt on those frames pressed at a menu already gone and held the pad for its cursor
wait. Empty until the cartridge asks again, 12.13's reading.
This commit is contained in:
acamilo 2026-09-24 04:49:40 +00:00
parent 68b756d824
commit e170812e7c
2 changed files with 24 additions and 0 deletions

View file

@ -547,6 +547,16 @@ pub fn scene_set(scene: Scene, state: &mut dyn MacroState) -> Vec<MacroKind> {
// list* closed it again; neither spent a turn, and the two of them were half the pad // list* closed it again; neither spent a turn, and the two of them were half the pad
// between them. Two buttons that undo each other with nothing else changing are section // between them. Two buttons that undo each other with nothing else changing are section
// 12.2's trap spread over two sub-states of one turn. // 12.2's trap spread over two sub-states of one turn.
// **A battle menu the cartridge is still holding an A on is not the fly's to answer**
// (row 63). The A that chose RUN, FIGHT or the Potion is taken, and the game stops asking
// the joypad while it acts on it -- so `hJoyLast` keeps that A, and the menu's box and
// cursor bytes stay on screen for as many as sixteen frames after its answer. A macro dealt
// there presses at a menu that is already gone: measured from the row-63 checkpoint, every
// `RUN` from FIGHT's column was followed by a `MOVE 4` dealt on the frame after, which
// pressed UP at "Got away safely!" and held the pad for its whole cursor wait. The pad is
// empty for those frames, which is 12.13's reading: the cartridge is driving, and it gives
// the buttons back on the first frame it asks again.
Scene::Battle { own_turn: true, .. } if state.a_latched() => Vec::new(),
Scene::Battle { own_turn: true, .. } => match battle_menu(state) { Scene::Battle { own_turn: true, .. } => match battle_menu(state) {
// The move list. `BACK` is a button here because there is a list to leave (12.9) -- // The move list. `BACK` is a button here because there is a list to leave (12.9) --
// but only while the moves can be *read*: a battler the seam cannot place leaves all // but only while the moves can be *read*: a battler the seam cannot place leaves all

View file

@ -2409,6 +2409,20 @@ fn move_one_is_not_fights_backstop_beside_a_usable_move() {
assert_eq!(moves, ["MOVE 1", "MOVE 2"]); assert_eq!(moves, ["MOVE 1", "MOVE 2"]);
} }
#[test]
fn a_battle_menu_the_cartridge_still_holds_an_a_on_deals_no_pad() {
// Row 63: RUN's A is taken, and the menu's box stays up while the game stops asking the
// joypad. The frame after `RUN` finished dealt `MOVE 4` over that box, which pressed at "Got
// away safely!" and held the pad through its whole cursor wait. Until the cartridge asks
// again the menu is not the fly's to answer.
let mut world = World::battle();
assert!(!pad_of(&mut world).is_empty());
world.latched_until = world.frames + 10;
assert_eq!(pad_of(&mut world), Vec::<&str>::new(), "the cartridge is acting on its last A");
world.frames += 10;
assert!(pad_of(&mut world).contains(&"MOVE 1"), "and the pad is back when it asks again");
}
#[test] #[test]
fn buy_potion_takes_buy_then_the_item_then_confirms_twice() { fn buy_potion_takes_buy_then_the_item_then_confirms_twice() {
let mut world = World::room(); let mut world = World::room();