diff --git a/README.md b/README.md index dc26f13..1c81994 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ The game file is **game.gba**. You can also open it directly in mGBA without reb - **Go fishing:** talk to **Fisher Coral**, the red-haired person in turquoise on the right side of Seashell Beach. Press X again to receive a reusable **Poké Rod** in your bag; choose Save from the Start menu to keep it after restarting. Bring Sprout, walk to the water's edge, face down toward the sea, and press **X** to hook **Tidefin**, an original Water-type fish. Weaken it and press **Backspace** to throw a Poké Ball. Catching still requires balls from Ranger Finn and space on your team. Older saves keep their gifts and catches. - **Get your first partner:** talk to Professor Mellon and press X to advance her conversation. She gives you **Sprout**, an original Grass-type partner at level five. This is a one-time gift; later conversations check on Sprout instead. - **Character artwork:** the player and Ranger Finn use boy sprites; Mila and Professor Mellon use distinct long-haired girl sprites. Mellon keeps her white coat and gray hair. Both styles have front, back, and side views. -- **Backspace (GBA Select button):** open your team. Use Left/Right to browse Sprout and your caught creatures, then press **X (A)** to choose the displayed creature as your following and battling partner. Backspace or Z (B) returns without changing your choice. Choose Save from the Start menu to retain your selection. Movement pauses while the team screen is open. +- **Backspace (GBA Select button):** open your team directly while exploring. Use Left/Right to browse Sprout and your caught creatures, then press **X (A)** to choose the displayed creature as your following and battling partner and return. Backspace or Z (B) returns without changing your choice. Team opened directly returns to the world; Team opened from Start returns to the sidebar. Choose Save from the Start menu to retain your selection. - **Your partner follows you:** Sprout or your selected caught creature follows your path and travels through doors and map exits with you. Each uses its own artwork. Choose Sprout again from the team screen whenever you like. - **Battle the golden creature:** with Sprout on your team, walk close to the golden creature in Greenleaf Village and press X. Use Left/Right to choose **Tackle** or **Leaf Tap**, then X to attack. The golden creature responds with Bump. Press Z (B) to run away. At the result screen, press X or Z to return to the map. Sprout recovers fully after each battle. - **Wild encounters:** with Sprout, walk around either tall-grass patch on Sunpetal Trail. **Fernfox** (Grass), **Emberwing** (Fire), or **Pebblit** (Rock) can appear automatically. Each has its own original 24×24 sprite, palette, health, and attack. Encounters only happen while moving in grass, with a short breather between battles. Leaf Tap is stronger against Pebblit and weaker against Emberwing. Fighting and running use the same keys as the golden-creature battle. - **Get Poké Balls:** talk to **Ranger Finn**, the person in orange just left of Sunpetal Trail's central path. Press X again to receive **five Poké Balls**. This gift is given once. Press Backspace to see the count on the team screen, even if you do not have Sprout yet. - **Catch a creature:** press **Backspace during a battle** to throw one Poké Ball. Lower health improves the chance; at one-quarter health or less, the catch is guaranteed. A failed throw still uses the ball and lets the creature attack. You cannot catch a fainted creature. Successful catches join your saved team, with room for Sprout plus five catches (duplicates are allowed). A full team does not waste a ball. The village's golden creature disappears from the map once caught. Press X after the catch result, then Backspace and Left/Right to view your new friend. Press X to make it your partner. - **Battle with caught creatures:** your selected partner fights in both land and fishing battles, using its own maximum health, Tackle, and a second move: Golden's Bump, Fernfox's Leaf Tap, Emberwing's Spark, Pebblit's Roll, or Tidefin's Water Jet. Partners recover fully after battles. Choose partners outside battle, not during a turn. -- **Return (GBA Start button):** open the **Save / Close** right sidebar while exploring. The world stays visible and paused. Up/Down chooses an option, X (A) activates it, and Z (B) or Return closes it. Saved/failed messages wait for a fresh X, Z, or Return press. Start no longer resets your position; the menu cannot open during conversations, battles, or the team screen. Music and S (R) mute continue working while it is open. +- **Return (GBA Start button):** open the **Team / Bag / Save / Close** right sidebar while exploring. Up/Down wraps through the four options and X (A) activates one. Team uses the same screen as Select. Bag shows your Poké Ball count (including zero) and rod ownership; it is read-only, with X or Z returning to the sidebar. Z (B) closes the sidebar or returns from a submenu; Return closes the entire menu from any page. Saved/failed messages wait for a fresh X, Z, or Return press. All menu pages pause walking and encounters; closing restores the same scene and position. Start no longer resets your position, and menus cannot open during conversations or battles. Music and S (R) mute continue working while menus are open. - **S (GBA R shoulder button):** mute or unmute the music, including during battles and menus. This setting lasts until you restart the ROM. If those keys do not match your emulator settings, check mGBA's keyboard input settings. @@ -62,7 +62,7 @@ Those numbers mean red, green, and blue, each from 0 to 31. Try `RGB(29, 6, 6)` - `source/story.c`: conversations and gifts. - `source/save.c`: versioned cartridge SRAM records and validation. - `source/hud.c`: map status, scene drawing, and the team screen. -- `source/menu.c`: Save / Close sidebar input and drawing. +- `source/menu.c`: Team / Bag / Save / Close menu input and drawing, including the Select shortcut. - `source/audio.c` and `source/audio.h`: original chiptune scores and the GBA sound-channel sequencer. - `source/wild_creatures.h`: original wild-creature sprites and palettes. - `source/start.s`: code that starts the GBA hardware. diff --git a/source/game.h b/source/game.h index 1e798ae..0c3f644 100644 --- a/source/game.h +++ b/source/game.h @@ -116,7 +116,9 @@ void draw_battle(void); void load_progress(void); void saved_location(struct Location *out); int save_progress(const struct Location *location); -enum SaveMenuPhase { SAVE_MENU_CLOSED, SAVE_MENU_OPTIONS, SAVE_MENU_SAVED, SAVE_MENU_FAILED }; +enum SaveMenuPhase { SAVE_MENU_CLOSED, SAVE_MENU_OPTIONS, SAVE_MENU_SAVED, SAVE_MENU_FAILED, + SAVE_MENU_TEAM, SAVE_MENU_BAG }; +enum { MENU_TEAM, MENU_BAG, MENU_SAVE, MENU_CLOSE, MENU_COUNT }; enum { SAVE_MENU_X = 160, SAVE_MENU_Y = 6, SAVE_MENU_W = 74, SAVE_MENU_H = 148 }; struct SaveMenuState { enum SaveMenuPhase phase; @@ -126,6 +128,8 @@ struct SaveMenuState { extern struct SaveMenuState save_menu; int save_menu_input(unsigned keys, int can_open, const struct Location *location); void draw_save_menu(void); +void draw_menu_scene(int x, int y); +void draw_bag(void); int has_caught(enum Species kind); int near_npc(int x, int y); int begin_conversation(int x, int y); diff --git a/source/hud.c b/source/hud.c index 5c1afb6..a2a3446 100644 --- a/source/hud.c +++ b/source/hud.c @@ -1,4 +1,5 @@ #include "game.h" +static void draw_bag_summary(void); void status(const char *message) { @@ -81,7 +82,14 @@ void draw_team_member(int member) large_text(28, 76, "VISIT PROFESSOR MELLON", ink); text(28, 96, "HER HOUSE IS EAST OF GREENLEAF VILLAGE", ink); } - /* A small bag summary is visible even before you receive Sprout. */ + draw_bag_summary(); + rectangle(0, 142, WIDTH, 18, cream); + text(8, 148, "LEFT RIGHT TEAM A CHOOSE B SELECT BACK", ink); +} + +static void draw_bag_summary(void) +{ + u16 ink = RGB(5, 8, 11); rectangle(24, 118, 8, 8, ink); rectangle(25, 119, 6, 3, RGB(29, 8, 9)); rectangle(25, 122, 6, 3, RGB(31, 31, 28)); @@ -94,6 +102,19 @@ void draw_team_member(int member) count_text[count_index] = 0; text(88, 119, count_text, ink); if (rod_owned) text(133, 119, "POKE ROD", ink); +} + +void draw_bag(void) +{ + u16 ink = RGB(5, 8, 11), cream = RGB(30, 30, 26); + rectangle(0, 0, WIDTH, HEIGHT, RGB(15, 24, 20)); + status("YOUR BAG"); + rectangle(8, 25, 224, 112, ink); + rectangle(10, 27, 220, 108, cream); + large_text(24, 45, "ITEMS", ink); + text(24, 66, "POKE BALLS ARE USED DURING BATTLE", ink); + text(24, 80, "THIS SCREEN IS READ ONLY", ink); + draw_bag_summary(); rectangle(0, 142, WIDTH, 18, cream); - text(8, 148, "ARROWS TEAM A CHOOSE PARTNER B BACK", ink); + text(8, 148, "A B BACK START CLOSE", ink); } diff --git a/source/main.c b/source/main.c index d876f0f..e2ec4e6 100644 --- a/source/main.c +++ b/source/main.c @@ -66,8 +66,6 @@ int main(void) DISPLAY = 0x0080; /* Hide the screen until the scene is drawn. */ int x = 108, y = 103, frame = 0, greeting = 0; int dialogue_page = -1; /* -1 means we are not talking. */ - int team_open = 0; - int team_member = 0; unsigned previous = 0; start_movement_timer(); load_progress(); @@ -91,51 +89,24 @@ int main(void) int menu_was_open = save_menu.phase != SAVE_MENU_CLOSED; const struct Location here = {current_room, x, y, player_facing}; int menu_changed = save_menu_input(keys, - !team_open && battle.phase == BATTLE_OFF && dialogue_page < 0, &here); + battle.phase == BATTLE_OFF && dialogue_page < 0, &here); if (menu_was_open || save_menu.phase != SAVE_MENU_CLOSED) { pause_movement_at(now); if (menu_changed) { - if (save_menu.phase == SAVE_MENU_CLOSED) { - DISPLAY = 0x0080; - draw_scene(x, y); - present_frame(); - DISPLAY = 0x0403; - } else { - draw_save_menu(); - present_frame(); - } + DISPLAY = 0x0080; + draw_menu_scene(x, y); + present_frame(); + DISPLAY = 0x0403; pause_movement_at(movement_time()); } else present_frame(); continue; } int movement_ticks = 0; - if (team_open || battle.phase != BATTLE_OFF || dialogue_page >= 0) + if (battle.phase != BATTLE_OFF || dialogue_page >= 0) pause_movement_at(now); else movement_ticks = movement_ticks_at(now); random_state += 0x9e3779b9u; /* Mix in how long the player waits. */ - if (team_open) { - if (partner_owned && (pressed & (LEFT | RIGHT))) { - int members = caught_count + 1; - team_member = (team_member + ((pressed & RIGHT) ? 1 : members - 1)) % members; - DISPLAY = 0x0080; - draw_team_member(team_member); - present_frame(); - DISPLAY = 0x0403; - pause_movement_at(movement_time()); - } else if (pressed & (SELECT | A | B)) { - if ((pressed & A) && choose_partner(team_member)) reset_follower(x, y); - team_open = 0; - DISPLAY = 0x0080; - draw_scene(x, y); - present_frame(); - DISPLAY = 0x0403; - pause_movement_at(movement_time()); - } else { - present_frame(); - } - continue; - } if (battle.phase != BATTLE_OFF) { if (battle_input(pressed)) { if (battle.phase == BATTLE_OFF) { @@ -177,16 +148,6 @@ int main(void) present_frame(); continue; } - if (pressed & SELECT) { - team_open = 1; - team_member = 0; - DISPLAY = 0x0080; - draw_team(); - present_frame(); - DISPLAY = 0x0403; - pause_movement_at(movement_time()); - continue; - } int old_x = x, old_y = y; int old_follower_x = follower_x, old_follower_y = follower_y; enum Facing old_facing = player_facing; diff --git a/source/menu.c b/source/menu.c index 06abdf7..f7e236e 100644 --- a/source/menu.c +++ b/source/menu.c @@ -1,18 +1,42 @@ #include "game.h" struct SaveMenuState save_menu; +static int team_member, team_parent; int save_menu_input(unsigned keys, int can_open, const struct Location *location) { unsigned pressed = keys & ~save_menu.previous; save_menu.previous = keys; if (save_menu.phase == SAVE_MENU_CLOSED) { - if (!can_open || !(pressed & START)) return 0; - save_menu.phase = SAVE_MENU_OPTIONS; + if (!can_open || !(pressed & (START | SELECT))) return 0; + save_menu.phase = pressed & START ? SAVE_MENU_OPTIONS : SAVE_MENU_TEAM; + team_parent = 0; + team_member = 0; save_menu.selection = 0; return 1; } - if (pressed & (B | START)) { + if (pressed & START) { + save_menu.phase = SAVE_MENU_CLOSED; + return 1; + } + if (save_menu.phase == SAVE_MENU_TEAM || save_menu.phase == SAVE_MENU_BAG) { + if (pressed & (B | SELECT | A)) { + if (save_menu.phase == SAVE_MENU_TEAM && (pressed & A) && + !(pressed & (B | SELECT)) && choose_partner(team_member)) + reset_follower(location->x, location->y); + save_menu.phase = team_parent ? SAVE_MENU_OPTIONS : SAVE_MENU_CLOSED; + return 1; + } + unsigned direction = pressed & (LEFT | RIGHT); + if (save_menu.phase == SAVE_MENU_TEAM && partner_owned && + (direction == LEFT || direction == RIGHT)) { + int members = caught_count + 1; + team_member = (team_member + (direction == RIGHT ? 1 : members - 1)) % members; + return 1; + } + return 0; + } + if (pressed & B) { save_menu.phase = SAVE_MENU_CLOSED; return 1; } @@ -22,18 +46,34 @@ int save_menu_input(unsigned keys, int can_open, const struct Location *location return 1; } if (pressed & A) { - if (save_menu.selection) save_menu.phase = SAVE_MENU_CLOSED; - else save_menu.phase = save_progress(location) ? SAVE_MENU_SAVED : SAVE_MENU_FAILED; + if (save_menu.selection == MENU_CLOSE) save_menu.phase = SAVE_MENU_CLOSED; + else if (save_menu.selection == MENU_SAVE) + save_menu.phase = save_progress(location) ? SAVE_MENU_SAVED : SAVE_MENU_FAILED; + else { + team_parent = 1; + team_member = 0; + save_menu.phase = save_menu.selection == MENU_TEAM ? SAVE_MENU_TEAM : SAVE_MENU_BAG; + } return 1; } unsigned direction = pressed & (UP | DOWN); if (direction == UP || direction == DOWN) { - save_menu.selection ^= 1; + save_menu.selection = (save_menu.selection + (direction == DOWN ? 1 : MENU_COUNT - 1)) % MENU_COUNT; return 1; } return 0; } +void draw_menu_scene(int x, int y) +{ + if (save_menu.phase == SAVE_MENU_TEAM) draw_team_member(team_member); + else if (save_menu.phase == SAVE_MENU_BAG) draw_bag(); + else { + draw_scene(x, y); + if (save_menu.phase != SAVE_MENU_CLOSED) draw_save_menu(); + } +} + void draw_save_menu(void) { u16 ink = RGB(5, 8, 11), cream = RGB(30, 30, 26); @@ -42,18 +82,18 @@ void draw_save_menu(void) rectangle(x + 2, y + 2, SAVE_MENU_W - 4, SAVE_MENU_H - 4, cream); large_text(x + 16, y + 10, "MENU", ink); rectangle(x + 6, y + 23, SAVE_MENU_W - 12, 1, RGB(15, 24, 20)); - text(x + 8, y + 85, "SAVES TEAM", ink); - text(x + 8, y + 95, "ITEMS AND", ink); - text(x + 8, y + 105, "LOCATION", ink); + text(x + 8, y + 99, "SAVES TEAM", ink); + text(x + 8, y + 108, "ITEMS AND", ink); + text(x + 8, y + 117, "LOCATION", ink); if (save_menu.phase == SAVE_MENU_OPTIONS) { - int selected_y = y + 32 + save_menu.selection * 20; + int selected_y = y + 28 + save_menu.selection * 16; rectangle(x + 6, selected_y, SAVE_MENU_W - 12, 16, RGB(23, 28, 21)); rectangle(x + 10, selected_y + 5, 1, 5, ink); rectangle(x + 11, selected_y + 6, 1, 3, ink); rectangle(x + 12, selected_y + 7, 1, 1, ink); - large_text(x + 20, y + 37, "SAVE", ink); - large_text(x + 20, y + 57, "CLOSE", ink); - text(x + 8, y + 124, "UP DOWN", ink); + static const char *const labels[] = {"TEAM", "BAG", "SAVE", "CLOSE"}; + for (int i = 0; i < MENU_COUNT; ++i) large_text(x + 20, y + 33 + i * 16, labels[i], ink); + text(x + 8, y + 126, "UP DOWN", ink); text(x + 8, y + 133, "A SELECT", ink); text(x + 8, y + 142, "B START CLOSE", ink); } else { diff --git a/tests/test_menu.c b/tests/test_menu.c index 30a46f1..10c8f9f 100644 --- a/tests/test_menu.c +++ b/tests/test_menu.c @@ -2,6 +2,90 @@ static void release_keys(void) { assert(!menu_input(0, 1)); } +static void press(unsigned keys) +{ + release_keys(); + assert(menu_input(keys, 1)); +} + +static void check_submenus(void) +{ + unsigned char saved[sizeof(test_save)]; + memcpy(saved, test_save, sizeof(saved)); + static u16 expected[WIDTH * HEIGHT], zero[WIDTH * HEIGHT]; + current_room = OUTSIDE; + int x = 108, y = 103; + player_facing = FACING_UP; + partner_owned = caught_count = active_member = ball_count = rod_owned = 0; + for (int owned = 0; owned < 2; ++owned) { + partner_owned = owned; + caught_count = owned ? 2 : 0; + caught_species[0] = FERNFOX; caught_species[1] = TIDEFIN; + for (int parent = 0; parent < 2; ++parent) { + press(parent ? START : SELECT); + if (parent) press(A); + assert(save_menu.phase == SAVE_MENU_TEAM); + assert(!menu_input(parent ? A : SELECT, 1)); + draw_menu_scene(x, y); + write_preview(owned ? "build/menu-team-owned-preview.ppm" : "build/menu-team-empty-preview.ppm"); + if (owned) { + press(LEFT); assert(!menu_input(LEFT, 1)); + press(RIGHT); press(LEFT); + draw_menu_scene(x, y); + write_preview("build/menu-team-caught-preview.ppm"); + press(A); + assert(active_member == 2); + } else { + int fx = follower_x, fy = follower_y, head = trail_head; + press(B); + assert(follower_x == fx && follower_y == fy && trail_head == head); + } + assert(save_menu.phase == (parent ? SAVE_MENU_OPTIONS : SAVE_MENU_CLOSED)); + assert(!menu_input(owned ? A : B, 1)); + if (parent) { + render_scene(x, y); draw_save_menu(); + memcpy(expected, SCREEN, sizeof(expected)); + draw_team(); draw_menu_scene(x, y); + assert(memcmp(expected, SCREEN, sizeof(expected)) == 0); + press(A); press(SELECT); + assert(save_menu.phase == SAVE_MENU_OPTIONS); + press(B); + } + render_scene(x, y); memcpy(expected, SCREEN, sizeof(expected)); + draw_bag(); draw_menu_scene(x, y); + assert(memcmp(expected, SCREEN, sizeof(expected)) == 0); + } + } + press(START); + for (int i = 1; i <= MENU_COUNT; ++i) { + press(DOWN); assert(save_menu.selection == i % MENU_COUNT); + assert(!menu_input(DOWN, 1)); + } + press(DOWN); press(A); + assert(save_menu.phase == SAVE_MENU_BAG); + assert(!menu_input(A, 1)); + for (int full = 0; full < 2; ++full) { + ball_count = full ? 99 : 0; rod_owned = full; + test_pixels[0] = test_pixels[WIDTH * HEIGHT + 1] = 0xbeef; + reset_dirty_rows(); draw_menu_scene(x, y); + assert(pending_pixels() == WIDTH * HEIGHT); + assert(test_pixels[0] == 0xbeef && test_pixels[WIDTH * HEIGHT + 1] == 0xbeef); + write_preview(full ? "build/bag-full-preview.ppm" : "build/bag-zero-preview.ppm"); + if (!full) memcpy(zero, SCREEN, sizeof(zero)); + else assert(memcmp(zero, SCREEN, sizeof(zero)) != 0); + } + press(B); assert(save_menu.phase == SAVE_MENU_OPTIONS); + assert(!menu_input(B, 1)); + press(A); press(START); + assert(save_menu.phase == SAVE_MENU_CLOSED && !menu_input(START, 1)); + press(SELECT); press(START); + assert(save_menu.phase == SAVE_MENU_CLOSED); + assert(x == 108 && y == 103 && player_facing == FACING_UP && current_room == OUTSIDE); + assert(memcmp(saved, test_save, sizeof(saved)) == 0); + load_progress(); + save_menu = (struct SaveMenuState){SAVE_MENU_CLOSED, 0, 0}; +} + void check_save_menu(void) { unsigned char saved[sizeof(test_save)]; @@ -24,7 +108,7 @@ void check_save_menu(void) release_keys(); assert(menu_input(UP, 1) && save_menu.selection == 0); release_keys(); - assert(menu_input(UP, 1) && save_menu.selection == 1); + assert(menu_input(UP, 1) && save_menu.selection == MENU_CLOSE); release_keys(); assert(menu_input(A, 1) && save_menu.phase == SAVE_MENU_CLOSED); const unsigned cancel[] = {B, START}; @@ -38,6 +122,10 @@ void check_save_menu(void) assert(memcmp(saved, test_save, sizeof(saved)) == 0); release_keys(); assert(menu_input(START, 1)); + for (int i = 0; i < MENU_SAVE; ++i) { + release_keys(); + assert(menu_input(DOWN, 1)); + } release_keys(); assert(menu_input(A, 1) && save_menu.phase == SAVE_MENU_SAVED); test_save[0] = 0; @@ -61,7 +149,7 @@ void check_save_menu(void) memcpy(expected, SCREEN, sizeof(expected)); for (int phase = SAVE_MENU_OPTIONS; phase <= SAVE_MENU_FAILED; ++phase) { save_menu.phase = (enum SaveMenuPhase)phase; - for (int choice = 0; choice < 2; ++choice) { + for (int choice = 0; choice < MENU_COUNT; ++choice) { save_menu.selection = choice; test_pixels[0] = test_pixels[WIDTH * HEIGHT + 1] = 0xbeef; reset_dirty_rows(); @@ -83,6 +171,11 @@ void check_save_menu(void) "build/game-saved-preview.ppm", "build/save-failed-preview.ppm"}; write_preview(paths[phase - SAVE_MENU_OPTIONS]); } + if (room == OUTSIDE && phase == SAVE_MENU_OPTIONS) { + const char *paths[] = {"build/menu-team-preview.ppm", "build/menu-bag-preview.ppm", + "build/menu-save-preview.ppm", "build/menu-close-preview.ppm"}; + write_preview(paths[choice]); + } } render_scene(108, 103); assert(memcmp(expected, SCREEN, sizeof(expected)) == 0); @@ -92,4 +185,5 @@ void check_save_menu(void) assert(random_state == rng && grass_steps == grass && door_open == door); current_room = old_room; save_menu = (struct SaveMenuState){SAVE_MENU_CLOSED, 0, 0}; + check_submenus(); } diff --git a/tests/test_progress.c b/tests/test_progress.c index 7a5eb1f..7592cfd 100644 --- a/tests/test_progress.c +++ b/tests/test_progress.c @@ -56,6 +56,10 @@ void check_progress(void) memcpy(kinds, caught_species, sizeof(kinds)); assert(!menu_input(0, 1)); assert(menu_input(START, 1)); + for (int i = 0; i < MENU_SAVE; ++i) { + assert(!menu_input(0, 1)); + assert(menu_input(DOWN, 1)); + } assert(!menu_input(0, 1)); assert(menu_input(A, 1) && save_menu.phase == SAVE_MENU_FAILED); int after[] = {partner_owned, balls_given, rod_owned, ball_count, caught_count, active_member}; diff --git a/tests/test_support.c b/tests/test_support.c index b7ca9dd..2dbe241 100644 --- a/tests/test_support.c +++ b/tests/test_support.c @@ -21,6 +21,10 @@ void save_at_menu(const struct Location *location, enum SaveMenuPhase expected) { assert(!save_menu_input(0, 1, location)); assert(save_menu_input(START, 1, location) && save_menu.phase == SAVE_MENU_OPTIONS); + for (int i = 0; i < MENU_SAVE; ++i) { + assert(!save_menu_input(0, 1, location)); + assert(save_menu_input(DOWN, 1, location)); + } assert(!save_menu_input(0, 1, location)); assert(save_menu_input(A, 1, location) && save_menu.phase == expected); assert(!save_menu_input(0, 1, location));