From ba29136b3c0137bd1dbbdd4c4fef5b2e9c4b04be Mon Sep 17 00:00:00 2001 From: dayfine Date: Sat, 31 Oct 2026 21:42:49 -0700 Subject: [PATCH 01/10] BDSP AutoStory: Route 201, Route 202, Jubilife and Route 203 grids from the Diamond decomp The four image-traced grids had 3/4 of a tile per row (Bulbapedia's DP map images are 12 px rows for 16 px columns), so every vertical leg planned on them was short and the walls sat on the wrong rows. Take them, Sandgem Town and the Oreburgh Mine B2F from pret/pokediamond's collision tables with devtools/maps decomp, and translate each file's named tiles with its console anchors. Sandgem Town and Route 202 now cover their whole matrix cells, so the grid edges are where the game changes its location banner. - Route 201: 64x25 (was 64x20), dx 96 / dz 839 kept; BORDER_SIGN and the Potion lady unchanged; the tree stub by the north-east grass is on rows 7..12, not 5; a School Kid at (57,8) from the events file. - Route 202: 36x32 (was 36x26); CATCH_SPOT (19,27), SAVE_SPOT (30,24); the three trainers named from the events file with their sight ranges, the fourth "trainer" was a wandering Youngster and is off the grid. - Sandgem Town: 34x32 from the cell's top (every row +4); the road from Route 202 narrows on row 6 and the Lab-Center gap on the doors' row is four wide; the entry stop is (29,5). - Jubilife City: 64x64 (was 64x48) at the decomp's frame; the lamps, doors and the four 00.05 people land where the console placed them (dx 130); the Trainers' School doorway and the Route 218 gate warps are 'D'. - Route 203: 61x24; four sand rows under the ledge, the row to Jubilife is 18; the Diamond-only Youngster near the Gate wanders in BDSP (off). - Oreburgh Mine B2F: the decomp's frame (every row -1); the room's second row open, the west ledge, the top corridor's fifth row. Tests: the plan, wall-hit, route-record and short-walk tests re-planned on the new grids; the Jubilife 00.05 legs are checked with route_plan_costs(), which talk_to_npc() plans with; the Mart lady's one-tile-step walks with town costs; "Save spots to Jubilife" (no plan within max_searched, task #15, on this grid as on the old one) is checked last so the other walks run. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../Programs/AutoStory/Data/MAPS.md | 26 +- .../PokemonBDSP_AutoStory_JubilifeCity.cpp | 254 +++++++++++------- .../Data/PokemonBDSP_AutoStory_JubilifeCity.h | 8 +- .../PokemonBDSP_AutoStory_OreburghMine.cpp | 105 ++++---- .../Data/PokemonBDSP_AutoStory_OreburghMine.h | 2 +- .../Data/PokemonBDSP_AutoStory_Route201.cpp | 106 ++++---- .../Data/PokemonBDSP_AutoStory_Route201.h | 4 +- .../Data/PokemonBDSP_AutoStory_Route202.cpp | 140 +++++----- .../Data/PokemonBDSP_AutoStory_Route202.h | 16 +- .../Data/PokemonBDSP_AutoStory_Route203.cpp | 110 ++++---- .../Data/PokemonBDSP_AutoStory_Route203.h | 2 +- .../PokemonBDSP_AutoStory_RouteRecords.cpp | 14 +- .../PokemonBDSP_AutoStory_SandgemTown.cpp | 150 ++++++----- .../Data/PokemonBDSP_AutoStory_SandgemTown.h | 6 +- .../Data/PokemonBDSP_AutoStory_StoryMaps.cpp | 54 ++-- .../Data/PokemonBDSP_AutoStory_StoryMaps.h | 6 +- .../AutoStory/PokemonBDSP_AutoStory_Tests.cpp | 121 +++++---- ...emonBDSP_AutoStory_SandgemCenterEvents.cpp | 4 +- ...okemonBDSP_AutoStory_SandgemCenterEvents.h | 4 +- .../PokemonBDSP_AutoStory_Segment_01.cpp | 26 +- 20 files changed, 648 insertions(+), 510 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/MAPS.md b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/MAPS.md index 986855cac3..c746ebb1e1 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/MAPS.md +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/MAPS.md @@ -2,10 +2,10 @@ Each map file's header starts with the same three lines, kept current with the code: -- **Map source**: where the tiles come from. "Decomp" means the Pokemon Platinum - decompilation's collision table (pret/pokeplatinum `map_data_NNN.bin`) with the - objects from its events file; BDSP keeps Diamond/Pearl's layout, and Platinum's - few changes show up on the console. "DP image" means a Bulbapedia map image +- **Map source**: where the tiles come from. "Decomp" means a decompilation's + collision table (pret/pokediamond `land_data` narc, or pret/pokeplatinum + `map_data_NNN.bin`) with the objects from its events file; BDSP keeps + Diamond/Pearl's layout, and Platinum's few changes show up on the console. "DP image" means a Bulbapedia map image traced by hand or by colour; those images have 12 px rows for 16 px columns, so a traced grid has 3/4 of a tile per row and drifts by the map's height differences (cliffs are painted taller than their tiles). @@ -15,12 +15,12 @@ Each map file's header starts with the same three lines, kept current with the c | map | source | checkpoints passing | next | |---|---|---|---| -| Route 201 | DP image (3/4 rows) | 00.02-00.04 | re-derive from the decomp | -| Route 202 | DP image (3/4 rows) | 00.04 | re-derive from the decomp | -| Sandgem Town | DP image rows 0-6, decomp rows 7+ | 00.04, 00.05 | two tiles on row 6; row-2 narrowing | -| Jubilife City | DP image (3/4 rows), console NPCs | 00.05, 01.01, 01.06, 01.07 | re-derive from the decomp | -| Oreburgh Mine B2F | DP image (stretched), console | 01.02, 01.03 (3x) | row 18 open, west ledge, top corridor row | -| Route 203 | DP image, east stretch from the console | 01.06 | re-derive the west and middle stretches | +| Route 201 | decomp (Diamond) | none yet (00.02-00.04 and mart_lady passed on the image grid) | re-run them | +| Route 202 | decomp (Diamond) | none yet (00.04 passed on the image grid) | re-run 00.04; the save-spot legs grew three rows | +| Sandgem Town | decomp (Diamond) | none yet (00.04, 00.05 passed with image rows 0-6) | re-run; the Route 202 entry stop is (29,1) | +| Jubilife City | decomp (Diamond), console NPCs | none yet (00.05, 01.01, 01.06, 01.07 passed on the image grid) | re-run; re-anchor the Mart clown and the steps walk | +| Oreburgh Mine B2F | decomp (Diamond) | none yet (01.02, 01.03 passed 3x on the stretched image grid) | re-run both | +| Route 203 | decomp (Diamond) | none yet (01.06 passed on the image grid) | re-run; the row to Jubilife is 18, four sand rows | | Route 204 South | decomp | 01.08 (1x) | more passes | | Ravaged Path | decomp rows 30-53 | 01.09 by hand | program pass | | Route 204 North | decomp | none (01.10) | probe column 23 and the rows under the cave | @@ -28,5 +28,7 @@ Each map file's header starts with the same three lines, kept current with the c Rules: terrain from the decomp, people and Platinum-only edits from the console; a route is coded only over tiles a human or a probe has walked; a map change re-runs every checkpoint listed on it. The decomp comparison that found the 3/4 -rows is the 2026-10-31 report (`compare.md`, with the decoded grids), to be -checked in with the re-derivation. +rows is the 2026-10-31 report (`compare.md`, with the decoded grids); the +re-derivation of 2026-10-31 took every grid above from `devtools/maps decomp +--repo pret/pokediamond` and translated each file's named tiles with its +console anchors. diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp index 0c85e697bf..c0ee4dc8e6 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp @@ -4,6 +4,8 @@ * */ +#include +#include #include "PokemonBDSP_AutoStory_JubilifeCity.h" namespace PokemonAutomation{ @@ -14,82 +16,136 @@ namespace JubilifeCity{ using namespace Pokemon; -// Map source: Bulbapedia DP map image, classified by colour (2026-10-28); -// rows are 3/4 of a tile (64 real rows in 48). The story NPCs are placed -// from the console. -// Console checks: lamps' row and the Center door (00.05), east stairs to -// Route 203 (01.06, r230a), the north street (01.07). The decomp puts -// the traced door columns one column east of the console's. -// Status: 00.05, 01.01, 01.06 and 01.07 pass on it. Next: re-derive from the -// decomp (cells (23..24, 4..5)); re-check door spacing. +// Map source: the decomp (pret/pokediamond land_data narc_0018, 0016, 0017 +// and 0015, 2026-10-31) with the objects from its events file. Platinum +// differs only around the Global Terminal (columns 14..26, rows 30..45). +// Console checks (2026-10-30/31): the lamps (43,53) and (49,53), north from +// (52,53) to the Pokemon Center's door, the School's door from the +// Center's doorstep, the east street to Route 203 (01.06, r230a), the +// north street (01.07), and the four 00.05 people, placed from the +// console on the tiles the events file gives them. +// Status: no checkpoint has run on this grid yet. 00.05, 01.01, 01.06 and +// 01.07 passed on the colour-classified image grid it replaces (48 rows +// for 64) and must be re-run; re-check the Mart clown's tile (he wanders +// 182..184 on row 33 in Diamond) and the hand walk from the steps' top +// east to the house and north to the Center (the decomp has the plaza +// only 171..177 wide on rows 58..59). // -// Read from Bulbapedia's DP map of Jubilife City (1024 x 772 px): 16 px tiles -// from the top-left corner; the last 4 px rows are left out. Road and paved -// plaza are walkable; buildings, roofs, trees, planters, lamps, signs, fences -// and fountains are blocked. Tiles were classified by colour and only the -// ones on the 00.05 route checked by eye, so some open plaza next to a lamp -// or a pattern line may read as blocked; the planner goes around those, and -// anything the map lacks is found by the route walker. -// The DP layout matches BDSP (console B, 2026-10-28): the Trainers' School -// and the Pokemon Center either side of the main road, the Poke Mart and the -// fountain park north of them, the TV station at the top of the main road -// and the Poketch Company in the north-west. -// NPCs are the 00.05 story people, placed from the console: they stand still. -// Columns 59..63 of rows 16..17 are the stairs east to Route 203 (from the -// image, 2026-10-31; not walked on the console yet). -const TileGrid& grid(){ +// Decoded from Pokemon Diamond's collision table: cells (23..24, 4..5) of +// the Sinnoh matrix, with the objects from its events file. Local (x, y) = +// world (x - 128, z - 736); 64 x 64 tiles. The console's measurements on +// the image grid were a column east of its doors; on this grid the lamps, +// the doors and the four people all land where the console put them. +// +// Exits: south, the 3-wide neck (45..47, 61) down to Route 202; east, the +// street (rows 21..24) to Route 203; north, (42..55, 0..1) to Route 204; +// west, the Route 218 gate on rows 22..23 (its warp tiles are 'D'). Doors +// are 'D' tiles walked into from below; the Trainers' School's doorway +// (40,40) and the Global Terminal's (21,42) are warp tiles stepped onto and +// marked 'D' as well, so a plan never steps on them. The main road runs +// from the steps (46..47, 60..62) north between the lamps (43,53), (49,53) +// and on up to the north exit; the doors' row 40 is open between the School +// and the Center (43..49), and the plaza below it is rows 41..52. +// People who stand still, from the events file: the Poketch president +// (46,35) and the clown west of the TV station (36,16), the 00.05 story +// people (hidden by flags before and after); an Ace Trainer (36,25) on the +// north road's west side, a Cashier (26,42), an Expert (44,44), two kids +// (52,46), (54,46) on the plaza and a School Kid (17,55): none of these +// five has been seen on the console yet. The clown by the Mart (55,33) and +// the one by the Poketch Company (15,18) wander three tiles in Diamond but +// stood still on the console (00.05, three runs): on the grid at their +// spawn tiles. Wanderers left off: an Ace Trainer along row 20 (21..23), +// one along row 21 (45..47), a Twin around (33,18), a School Kid on column +// 51 (rows 33..35), a Pokefan around (41,30). Rowan and the grunts at the +// north exit, the Collectors and Dawn are hidden by story flags. +namespace{ +// Rows 0..31: the matrix's cell row 4 (world z 736..767), the north half. +std::vector north_half(){ + // 0 1 2 3 4 5 6 + // 0123456789012345678901234567890123456789012345678901234567890123 + return { + R"(##########################################..............########)", // 0 + R"(##########################################..............########)", // 1 + R"(############################################.....###############)", // 2 + R"(############################################......##############)", // 3 + R"(############################################......##############)", // 4 + R"(############################################......##############)", // 5 + R"(############################################......##############)", // 6 + R"(#############################################....###############)", // 7 + R"(############################....#########.......S.##############)", // 8 + R"(############################....#########.........##############)", // 9 + R"(#########..#########..######....#########.........##############)", // 10 + R"(#########..#########..######....#########.........##############)", // 11 + R"(#########..#########..######....#########.........##############)", // 12 + R"(#########..#########..######....#########.........##############)", // 13 + R"(#########..#########..######....#########.........##############)", // 14 + R"(#########..##D###D##..######....####D####.........##############)", // 15 + R"(#########.............######........N......#.....#######....####)", // 16 + R"(#########.............######......................######....####)", // 17 + R"(..#######......N......######......................######....####)", // 18 + R"(..###########S......########...........S.........S##D###....####)", // 19 + R"(..#.S.#.......................#..........................#.S####)", // 20 + R"(................................................................)", // 21 + R"(D...............................................................)", // 22 + R"(D...............................................................)", // 23 + R"(................................................................)", // 24 + R"(..#...#.......................#.....N....................#..####)", // 25 + R"(..############.............####......####...................####)", // 26 + R"(..############.............####......####................#######)", // 27 + R"(##############.################...##.####..#.....######..#######)", // 28 + R"(##############.################...##.####.........#####..#######)", // 29 + R"(##############.################...................#D############)", // 30 + R"(################################.........................#######)", // 31 + }; +} +// Rows 32..63: cell row 5 (world z 768..799), the south half. +std::vector south_half(){ // 0 1 2 3 4 5 6 // 0123456789012345678901234567890123456789012345678901234567890123 - static const TileGrid grid({ - R"(################################################################)", // 0 - R"(################################################################)", // 1 - R"(##########################################......################)", // 2 - R"(##########################################......################)", // 3 - R"(##########################################......################)", // 4 - R"(###########################...##########.......#################)", // 5 - R"(###########################...##########........################)", // 6 - R"(########.##########.#######...##########..#.....################)", // 7 - R"(########.##########.#######...##########.......#################)", // 8 - R"(########.##########.#######....#########..#....#################)", // 9 - R"(########.##########.#######...#####D####..#....#################)", // 10 - R"(########..#########.#######.......N.......#....#################)", // 11 - R"(########............#######...............#....########....#####)", // 12 - R"(########...##N......#######..........##...#....########....#####)", // 13 - R"(######.#####.......#######.....................#######...#######)", // 14 - R"(##........................................#....#...........#####)", // 15 - R"(##...#..................................................#.......)", // 16 - R"(##...#...###..............###...........................#.......)", // 17 - R"(##...#..#####.################............#............#########)", // 18 - R"(##############################..###########....#.###...#########)", // 19 - R"(##############################..###########....######..#########)", // 20 - R"(##############################..###########....#######..####.###)", // 21 - R"(##############################..##########.....#################)", // 22 - R"(##############################..###########....#......N#########)", // 23 - R"(########.#####################..#.....##.......#........########)", // 24 - R"(########.#####################.......####............#..####.###)", // 25 - R"(########.#####.#########.######.##########..N.....###..#########)", // 26 - R"(##############..########.######.###########....#######.#########)", // 27 - R"(########.#####.############################....#################)", // 28 - R"(########.#####.############################....#################)", // 29 - R"(#################################.##.##D###....####D############)", // 30 - R"(########.#####..#########.#####........................#########)", // 31 - R"(#############....#######..####.####....................#####.###)", // 32 - R"(#############....##.......########.....................#####.###)", // 33 - R"(##############............##############...........N.N.#########)", // 34 - R"(##############............##############...............#########)", // 35 - R"(#############.............##############...........#############)", // 36 - R"(########.#####.###...###.###############...........#############)", // 37 - R"(########.#####.###...###.###############...........#############)", // 38 - R"(########.#####.###...###.###############.#.....#...#############)", // 39 - R"(########.#.#.#...........##########.....S..........#########.###)", // 40 - R"(#########................##########................#########.###)", // 41 - R"(########.........#.......##########................#########.###)", // 42 - R"(########.#.#.#.#..........###############.......############.###)", // 43 - R"(#########################################.........##############)", // 44 - R"(###########################################....#################)", // 45 - R"(###########################################DDDD#################)", // 46 - R"(################################################################)", // 47 - }); + return { + R"(################################.........................##D####)", // 32 + R"(################################.......................N.#######)", // 33 + R"(################################.........................#######)", // 34 + R"(###############............#####..............N..........#######)", // 35 + R"(###############............#####......#####..............#######)", // 36 + R"(###############..#########.#####.##########.......######.#######)", // 37 + R"(###############..#########.#####.##########.......######.#######)", // 38 + R"(###############..#########.#####.###########.....#######.#######)", // 39 + R"(##################################..S.##D##.......##D###########)", // 40 + R"(###############..#########.#####.........................#######)", // 41 + R"(##############...####D####N.###..........................#######)", // 42 + R"(##############...........................................#######)", // 43 + R"(##############.....S........................N............#######)", // 44 + R"(##############...........................................#######)", // 45 + R"(##############.............#########................N.N..#######)", // 46 + R"(###############............#########.#####...............#######)", // 47 + R"(###############............#########.#####...............#######)", // 48 + R"(###############.####..####.###############...............#######)", // 49 + R"(###############.####..####.###############...............#######)", // 50 + R"(###############.####..####.###############...........###########)", // 51 + R"(############D##.####..####.############D##...........###########)", // 52 + R"(##########.................#########.......#.....#...########.##)", // 53 + R"(##########.................#########.................########.##)", // 54 + R"(##########.......N....#..#.#########......S..........########.##)", // 55 + R"(##########............#..#.#########.................########.##)", // 56 + R"(##########.................#########.................########.##)", // 57 + R"(###########################################.......##############)", // 58 + R"(###########################################.......##############)", // 59 + R"(########################################.##.......##############)", // 60 + R"(########################################.####...################)", // 61 + R"(########################################..........##############)", // 62 + R"(########################################..........##############)", // 63 + }; +} +} + +const TileGrid& grid(){ + static const TileGrid grid = []{ + std::vector rows = north_half(); + const std::vector south = south_half(); + rows.insert(rows.end(), south.begin(), south.end()); + return TileGrid(rows); + }(); return grid; } @@ -97,33 +153,43 @@ const TileGrid& grid(){ // below the steps, against the wall just east of them (the banner reads // Jubilife City). West along that wall does not stop at the steps (it runs // to the trees); a tile west, then north, climbs them. North up the main -// road from the steps passes the lamps (41,39), (47,39) and does not stop +// road from the steps passes the lamps (43,53), (49,53) and does not stop // before the north exit. From the lamps' row, west stops at the house at -// (35..39, 34..39) and east at the house at (51..55, 36..42); north from -// (50,39) stops in front of the Pokemon Center. The road's white curbs -// (columns 42 and 47) are not walls, as the colour reading had them. +// (37..42, 47..52) and east at the house at (53..57, 49..56); north from +// (52,53) stops in front of the Pokemon Center. The steps are columns +// 45..47 of row 61; the save stands at (48,62) against (48,61), and the +// tile west then north puts us on column 47, a few rows up. On this grid +// east from rows 58..60 stops at column 49 and north from there at the lamp +// (49,53), not the Center: the climb must end on row 57 or above, or BDSP's +// plaza is wider than Diamond's there (re-check on the console). const std::vector& up_the_steps(){ - static const std::vector tiles{{45, 43}, {46, 43}, {45, 44}, {46, 44}, {45, 45}, {46, 45}}; + static const std::vector tiles{{46, 58}, {47, 58}, {46, 59}, {47, 59}, {46, 60}, {47, 60}}; return tiles; } -// Checked on the console (2026-10-30): from the Pokemon Center's doorstep, -// eleven one-tile holds west put us under this door, not the twelve these -// columns give; one of the two doors is a column off here. -const TilePos TRAINERS_SCHOOL_DOOR{39, 30}; -const TilePos POKEMON_CENTER_DOOR{51, 30}; -const TilePos TV_STATION_DOOR{35, 10}; +// The School's doorway is a warp tile stepped onto from (40,41); the +// Center's door is walked into from (52,41). On the console (2026-10-30) +// eleven one-tile holds west from the Center's doorstep put us under the +// School's door: the doorstep was the tile east of the door's column, as +// story_door_front() allows. +const TilePos TRAINERS_SCHOOL_DOOR{40, 40}; +const TilePos POKEMON_CENTER_DOOR{52, 40}; +const TilePos TV_STATION_DOOR{36, 15}; -// On the main road just north of the school and the Center. Talked to from -// the east, facing west (also works from the south). -const TilePos POKETCH_PRESIDENT{44, 26}; -// Below the Poke Mart's planters, where the road meets the plaza. -const TilePos CLOWN_MART{54, 23}; -// West of the TV station door. -const TilePos CLOWN_TV_STATION{34, 11}; -// East of the Poketch Company's sign. Talked to from the south on the -// console; from the east a walk west along row 13 stops right beside him. -const TilePos CLOWN_POKETCH_COMPANY{13, 13}; +// On the main road, five rows north of the School's and the Center's +// doors' row and six columns west of the Center's door. Talked to from the +// east, facing west (also works from the south). +const TilePos POKETCH_PRESIDENT{46, 35}; +// Below the Poke Mart's planters, where the road meets the plaza: his spawn +// tile; he wanders a tile either side in Diamond, and the console had him +// a tile east of it. +const TilePos CLOWN_MART{55, 33}; +// West of the TV station door, right below it. +const TilePos CLOWN_TV_STATION{36, 16}; +// East of the Poketch Company's sign, a row below it. Talked to from the +// south on the console; from the east a walk west along row 18 stops right +// beside him. +const TilePos CLOWN_POKETCH_COMPANY{15, 18}; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.h index 367a3087ad..941b89ff77 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.h @@ -2,8 +2,8 @@ * * From: https://github.com/PokemonAutomation/ * - * Jubilife City as a tile grid, read from Bulbapedia's DP map, with the - * places and people of checkpoint 00.05. + * Jubilife City as a tile grid, from the Diamond decompilation's collision + * table, with the places and people of checkpoint 00.05. */ #ifndef PokemonAutomation_PokemonBDSP_AutoStory_JubilifeCity_H @@ -21,8 +21,8 @@ namespace JubilifeCity{ const Pokemon::TileGrid& grid(); // Where we may stand after climbing the steps from where 00.05 starts: -// below them, against the wall just east of them (off this map's bottom -// edge), then a tile west and about two tiles north. +// below them, against the wall just east of them, then a tile west and +// about two tiles north. const std::vector& up_the_steps(); // Doors: walk north from the tile below to enter. diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp index ff6ad9c075..2bd3a972cc 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp @@ -14,69 +14,84 @@ namespace OreburghMine{ using namespace Pokemon; -// Map source: Bulbapedia DP map image through devtools/maps/levels.py -// (stretched to 16 px tiles), then the console (2026-10-28). -// Console checks: corridor zigzag, the coal block row, Roark a row above the -// bottom (2026-10-28). -// Status: 01.02 and 01.03 pass 3x on it. Next: the decomp has row 18 open, a -// west ledge, and one more top-corridor row (compare.md 2.6); apply and -// re-run. +// Map source: the decomp (pret/pokediamond land_data narc_0314, matrix 006; +// 2026-10-31) with the objects from its events file; Platinum's +// map_data_337 is the same. +// Console checks (2026-10-28): the corridor's rocks zigzag a row at a time, +// the room's second row passes under the worker on the first, Roark +// stands a row above the bottom row between two rocks; the walk north +// from the corridor's corner reached the entrance hall (r99). +// Status: no checkpoint has run on this grid yet. 01.02 and 01.03 passed +// 3x on the stretched image grid it replaces, which had every row one +// lower, the top corridor a row short, the room's second row blocked +// and no ledge in the west corridor; re-run both. // -// Read from Bulbapedia's DP map Oreburgh_Mine_B2F_DP.png with -// devtools/maps/levels.py (--profile cave --height 512 --offset 0,4 -// --objects on --edits oreburgh_mine_b2f_edits.txt). The archive image is -// squashed to 512x395; stretched back to 512x512 its rocks sit on 16 px -// tiles both ways. Rocks, boulders, crates, the coal block, the workers and -// their Machop are blocked. Checked on the console (2026-10-28): the -// corridor's small rocks zigzag a row at a time; the coal block's top edge -// is drawn over the room's second row, which is walkable and is how to pass -// the worker on the first row; Roark stands a row above the bottom row. +// Decoded from Pokemon Diamond's collision table: the one cell of matrix +// 006, with the objects from its events file. Local (x, y) = world (x, z); +// 32 x 32 tiles. The way up to the entrance hall is the warp tile (15,1), +// marked 'D': stepping onto it leaves the room. The console walked north +// into the hall from column 14 (r99), where this table has the way up only +// at column 15: a stick hold drifts, or BDSP's stairs are wider. +// The corridor from the top (13..17, 2..6) zigzags down to the room's first +// row (15); the room's second row (17) is open from 2 to 29 and passes +// under the worker and his Machop on the first; the coal block fills +// (7..24, 18..25) with the corridors either side; the west corridor has a +// ledge (2..4, 19), crossed southward only; the bottom rows 28..29 run +// under the block. +// Objects, from the events file: Roark (18,28), between two rocks (17,28) +// and (19,28); workers who stand still at (8,28) looking north, (26,20) +// looking west and (21,15) with Machop at (20,15) and (27,15); Poke Balls +// at (4,28) and (26,24), walls until picked up. A Machop wanders along row +// 28, columns 11..13, and is left off the grid. const TileGrid& grid(){ - static const TileGrid grid({ // 0 1 2 3 + // 01234567890123456789012345678901 + static const TileGrid grid({ R"(################################)", // 0 - R"(################################)", // 1 - R"(################################)", // 2 - R"(###############.################)", // 3 + R"(###############D################)", // 1 + R"(#############.....##############)", // 2 + R"(#############.....##############)", // 3 R"(#############.....##############)", // 4 R"(#############.....##############)", // 5 R"(#############.....##############)", // 6 - R"(#############.....##############)", // 7 + R"(#############...################)", // 7 R"(#############...################)", // 8 - R"(#############...################)", // 9 - R"(#############.....##############)", // 10 - R"(#############..#..##############)", // 11 - R"(###############...##############)", // 12 - R"(#############...################)", // 13 - R"(#############.....##############)", // 14 - R"(###############...##############)", // 15 - R"(########...####.....##.....#.###)", // 16 - R"(##............................##)", // 17 - R"(##.#..###################.....##)", // 18 - R"(##....###################.....##)", // 19 - R"(##...######################...##)", // 20 - R"(#####.#####################...##)", // 21 - R"(##.########################...##)", // 22 - R"(##..########################..##)", // 23 - R"(##..########################..##)", // 24 - R"(##....#####################...##)", // 25 - R"(#####.#####################...##)", // 26 + R"(#############.....##############)", // 9 + R"(#############..#..##############)", // 10 + R"(###############...##############)", // 11 + R"(#############...################)", // 12 + R"(#############.....##############)", // 13 + R"(###############...##############)", // 14 + R"(########...####.....NN.....N.###)", // 15 + R"(######.....##.................##)", // 16 + R"(##.#..........................##)", // 17 + R"(##....####################....##)", // 18 + R"(##vvv##..................#....##)", // 19 + R"(##....#..................#N...##)", // 20 + R"(##.##.#..................#....##)", // 21 + R"(##..###..................###..##)", // 22 + R"(##..###..................###..##)", // 23 + R"(##....#..................##...##)", // 24 + R"(##.##.#..................#....##)", // 25 + R"(####..####################....##)", // 26 R"(####..####################....##)", // 27 - R"(####..####################..####)", // 28 - R"(####....#..#.....#N#........####)", // 29 - R"(######......................####)", // 30 + R"(#####...N........#N#........####)", // 28 + R"(######......................####)", // 29 + R"(################################)", // 30 R"(################################)", // 31 }); return grid; } +// The first open row below the warp tile, where the walk in from the hall +// leaves us (or the row below: the plan's first legs run to walls and meet). const std::vector& corridor_top(){ - static const std::vector tiles{{14, 4}, {15, 4}, {16, 4}}; + static const std::vector tiles{{14, 2}, {15, 2}, {16, 2}}; return tiles; } -const TilePos ROARK{18, 29}; -const TilePos CORRIDOR_EXIT_START{14, 11}; +const TilePos ROARK{18, 28}; +const TilePos CORRIDOR_EXIT_START{14, 10}; } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.h index 48764f46ba..4dc823b486 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.h @@ -21,7 +21,7 @@ namespace OreburghMine{ const Pokemon::TileGrid& grid(); // Where the walk in from the entrance hall leaves us: the top of the rocky -// corridor, below its timber frame. +// corridor, the first open row below the warp tile. const std::vector& corridor_top(); // Roark, between two rocks a row above the room's bottom row. Talked to from diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp index 992cda45d7..dbdcc98267 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp @@ -14,31 +14,40 @@ namespace Route201{ using namespace Pokemon; -// Map source: Bulbapedia DP map image, traced by hand (2026-10-28). The -// image has 12 px rows for 16 px columns, so every row is 3/4 of a tile -// (decomp comparison, 2026-10-31). -// Console checks: north-east ledge row, Twinleaf and Sandgem gaps, the -// Potion lady wandering (2026-10-28/29). -// Status: 00.02 to 00.04 pass on it. Next: re-derive from the decomp (cells -// (26,3), (26,4)), keep the console anchors. +// Map source: the decomp (pret/pokediamond land_data narc_0005 and +// narc_0006, 2026-10-31) with the objects from its events file; +// Platinum's map_data_005/006 have the same terrain. +// Console checks: the border sign read from (54,4) facing east, row 3 open +// east of the grass to Sandgem's fence, row 5 to Sandgem without a stop, +// the Potion lady on row 3, wandering (2026-10-28 to 30, CFR "walk"). +// Status: no checkpoint has run on this grid yet. 00.02 to 00.04 and the +// mart_lady checkpoint passed on the image-traced grid it replaces (3/4 +// of a tile per row) and must be re-run. // -// Read from Bulbapedia's DP map of Route 201 (1040 x 320 px). As on the -// Route 202 map, the tile grid starts 8 px in from the left edge: tile -// (x, y) covers pixels [8 + 16x, 24 + 16x) x [16y, 16y + 16). The trees sit -// about 3 px lower on their tiles than on the Route 202 map; tall grass and -// the NPC at the Potion girl fit a grid with no vertical offset. +// Decoded from Pokemon Diamond's collision table: cells (26,3) and (26,4) +// of the Sinnoh matrix, with the objects from its events file. Local (x, y) +// = world (x - 96, z - 839); 64 x 25 tiles, rows 0..2 are padding. The +// columns are the ones the image-traced grid had (its anchors matched the +// decomp exactly); the rows are the game's: the image gave 20 rows for 25. +// Sandgem Town's grid joins at column 64, row -3 (its front row is row 4). // -// Trees follow the Route 202 rules: tiles under trunks or mostly under a -// canopy are blocked. Ledges: row 10 west of the tall grass, and (53..56,7) -// in the north-east. On the console the north-east ledge is one row higher -// than it looks on the DP map, as on Route 202; the west one is unchecked. -// West edge, rows 9..12: towards Lake Verity. South gap (14..17, 19): -// Twinleaf Town. East edge, rows 3..6: Sandgem Town. -// Route 201 has no trainers. Its NPCs wander, so they are left off: a -// planned wall must stay put. The Poke Mart lady, who gives 10 Potions, is -// one of them: she roams the north-east tall grass (42..52, 3) and the open -// ground under the trees above it, and eight runs (r113a..r120a) never got -// her talk, so 00.04 buys its Potions in Sandgem instead. +// Edges: west, rows 6..7 and 11 (Lake Verity, off the map); south, the +// Twinleaf gap (14..17, 21..24); east, rows 3..6, into Sandgem. Ledges: +// row 12 (0..3 and 8..31) and (53..57, 9) in the north-east; both are +// jumped southward only. The north-east grass (42..52, 3..6) is four rows +// deep and its tree stub (51..52) stands on rows 7..12; the middle grass +// (20..29, 13..16) four rows; the south-east grass (42..57, 18) and +// (46..57, 19..20). +// Objects, from the events file: the signs (55,4) to Sandgem (BORDER_SIGN), +// (13,17) to Twinleaf and the Trainer Tips sign (40,12); a School Kid who +// stands at (57,8) looking west (not yet seen on the console). Route 201 +// has no trainers and no items on the ground. Wanderers, left off the grid: +// a Breeder around (27,15), columns 26..28, rows 14..16; a Lass along row +// 16, columns 44..48. The Poke Mart lady, who gives 10 Potions, stands still +// at (44,3) in Diamond but wanders in BDSP (eight runs, r113a..r120a, never +// got her talk), so she is left off too and 00.04 buys its Potions in +// Sandgem. Rowan, Barry and the briefcase by the lake are hidden by story +// flags and left off. const TileGrid& grid(){ // 0 1 2 3 4 5 6 // 0123456789012345678901234567890123456789012345678901234567890123 @@ -48,35 +57,40 @@ const TileGrid& grid(){ R"(################################################################)", // 2 R"(##########################################"""""""""""...........)", // 3 R"(##########################################"""""""""""..S........)", // 4 - R"(##########################################"""""""""##...........)", // 5 - R"(##..####..####....######..##....##..####.."""""""""##...........)", // 6 - R"(##..####..####....######..##....##..####.."""""""""##vvvv.######)", // 7 - R"(##........####............................"""""""""##.....######)", // 8 - R"(....####.................................."""""""""##.....######)", // 9 - R"(vvvv####vvvvvvvvvvvvvvvvvvvvvvvv........S."""""""""##.....######)", // 10 - R"(....####............""""""""""............................######)", // 11 - R"(....................""""""""""............................######)", // 12 - R"(########.....S......##########............................######)", // 13 - R"(##############....############################............######)", // 14 - R"(##############....############################""""""""""""######)", // 15 - R"(##############....##############################################)", // 16 - R"(##############....##############################################)", // 17 - R"(##############....##############################################)", // 18 - R"(##############....##############################################)", // 19 + R"(##########################################"""""""""""...........)", // 5 + R"(##########################################"""""""""""...........)", // 6 + R"(....####..........######..##....##..####.."""""""""##...........)", // 7 + R"(....####..........######..##....##..####.."""""""""##....N......)", // 8 + R"(##........####............................"""""""""##vvvvv######)", // 9 + R"(##........####............................"""""""""##.....######)", // 10 + R"(.........................................."""""""""##.....######)", // 11 + R"(vvvv####vvvvvvvvvvvvvvvvvvvvvvvv........S."""""""""##.....######)", // 12 + R"(....####............""""""""""............................######)", // 13 + R"(....................""""""""""............................######)", // 14 + R"(....................""""""""""............................######)", // 15 + R"(....................""""""""""............................######)", // 16 + R"(########.....S......##########............................######)", // 17 + R"(########............##########............""""""""""""""""######)", // 18 + R"(##############....############################""""""""""""######)", // 19 + R"(##############....############################""""""""""""######)", // 20 + R"(##############....##############################################)", // 21 + R"(##############....##############################################)", // 22 + R"(##############....##############################################)", // 23 + R"(##############....##############################################)", // 24 }); return grid; } -// Pixel (888,64) on the DP map, on the doors' row of Sandgem (world row 4): -// walking east along row 4 from the grass stops at (54,4), and facing east -// from there reads it. -// Checked on the console (2026-10-30, CFR "walk"): a row south of her row -// (row 3), east stops at the sign's west side and A reads "Route 201 -> -// Sandgem Town" (a green box); north from there is one row, to row 3. Row 3 -// runs on east past the sign's north side to the Lab's fence. Row 5, the -// path, runs from the grass's west edge to Sandgem without a stop. +// The arrow sign to Sandgem Town, world (151,843), on the row of Sandgem's +// doors (its row 7). Checked on the console (2026-10-30, CFR "walk"): a row +// south of the lady's row (row 3), east stops at the sign's west side and A +// reads "Route 201 -> Sandgem Town" (a green box); north from there is one +// row, to row 3. Row 3 runs on east past the sign's north side to the Lab's +// fence. Row 5, the path, runs from the grass's west edge to Sandgem without +// a stop. const TilePos BORDER_SIGN{55, 4}; +// Her spawn tile in Diamond is (44,3), the east end of the top grass row. // On the console (by hand, then through the Lab Console; 99715d5d6 and // f823453e9 on bdsp/new-game-intro-v2) she stood at (43,3), and walking // west along row 3 from the trees at its east end stopped at (44,3), facing diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.h index b9792e3607..24481753bf 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.h @@ -2,8 +2,8 @@ * * From: https://github.com/PokemonAutomation/ * - * Route 201 (Twinleaf Town to Sandgem Town) as a tile grid, read from - * Bulbapedia's DP map; BDSP keeps DP's tile layout. + * Route 201 (Twinleaf Town to Sandgem Town) as a tile grid, from the + * Diamond decompilation's collision table; BDSP keeps DP's tile layout. */ #ifndef PokemonAutomation_PokemonBDSP_AutoStory_Route201_H diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp index 459d591a65..f78bc80261 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp @@ -14,30 +14,42 @@ namespace Route202{ using namespace Pokemon; -// Map source: Bulbapedia DP map image, traced by hand (2026-10-28); rows are -// 3/4 of a tile (34 real rows in 26). -// Console checks: south ledge on row 18, east wall at column 30 on row 16 -// (r75), sign (24,20). -// Status: 00.04 passes on it. Next: re-derive from the decomp (cell (25,5)); -// re-check the column-31 wall. +// Map source: the decomp (pret/pokediamond land_data narc_0014, with the +// margins from narc_0006, 0007 and 0173; 2026-10-31) and the objects +// from its events file; Platinum's map_data_014 has the same terrain. +// Console checks: the player under the south ledge at (22,24) beside the +// trees at (21,24), the sign a row below at (24,25), the save spot +// (30,24) against the east trees, Natalie's challenge at (22,22), east +// along the row above the ledge stops at column 30 and column 30 runs +// north to row 4 (r75), the catch spot's walls (2026-10-29/30). +// Status: no checkpoint has run on this grid yet. 00.04 passed on the +// image-traced grid it replaces (26 rows for 32) and must be re-run; +// its legs south of the catch spot are three rows longer here. // -// Read from Bulbapedia's DP map of Route 202 (592 x 416 px). Its tile grid -// starts 8 px in from the left edge, so tile (x, y) covers pixels -// [8 + 16x, 24 + 16x) x [16y, 16y + 16). The half tiles at both side edges -// are trees and are left out. +// Decoded from Pokemon Diamond's collision table: cell (25,5) of the Sinnoh +// matrix, with the objects from its events file. Local (x, y) = world +// (x - 159, z - 800); 36 x 32 tiles, the whole cell, so the grid's edges +// are where the game changes its location banner. The columns are the ones +// the image-traced grid had (its ledges, tree pillars and signs matched the +// decomp exactly); the rows are the game's: the image gave 26 rows for 32. +// Sandgem Town's grid starts on the row below row 31, at column 1. // -// Trees: each tile under a trunk or a canopy that hides most of the ground -// is blocked. The thin top of a canopy that only overhangs the row above a -// tree is not. -// Ledges: rows 9 and 18. On the DP map the south ledge looks like row 19, -// but on the console the player stands at (22,19) right under it, beside -// the trees at (21,19), and the sign at (24,20) is one row below. -// The Poke Ball item at (3,6) is blocked. -// The east tree wall comes in to column 31 at rows 15 to 17: walking east -// along row 16 stops at column 30 on the console (r75), and column 30 is -// open north to row 4. -// NPCs stand on the tile under their feet; the sprites rise into the row -// above. The girl at (22,15), pixel (365,235), is a trainer. +// Exits: north, the gap (11..18, 0) to Jubilife City (EXIT_JUBILIFE in its +// middle); south, (21..30, 31) into Sandgem, where the road narrows to +// 25..30 for two rows. Ledges: row 10 (9..13 and +// 22..27) and row 23 (9..13 and 22..30), jumped southward only. The east +// wall is column 33 from row 10 to 20, column 32 on row 21 and column 31 on +// row 22, the row right above the south ledge: east along that row stops at +// column 30 (r75), and column 30 is open north from there to row 4 under +// Logan's row. +// Objects, from the events file: three trainers who stand still, Youngster +// Tristan (7,13), Lass Natalie (22,18) and Youngster Logan (26,4), all +// facing south, with the sight ranges the events give; a Potion ball (3,6), +// a wall until picked up; the signs (17,4) to Jubilife, (15,16) Trainer Tips +// and (24,25) to Sandgem. A Youngster who is not a trainer wanders along row +// 8, columns 9..11, and is left off the grid (the image-traced grid had him +// as a fourth trainer facing east). Dawn's tile (15,27) is hidden by a +// story flag. const TileGrid& grid(){ // 0 1 2 3 // 012345678901234567890123456789012345 @@ -49,63 +61,65 @@ const TileGrid& grid(){ R"(###""""""........S..""""".N....#####)", // 4 R"(###""""""..........."""""......#####)", // 5 R"(####"""""..........."""""......#####)", // 6 - R"(###"""""".N...########"""......#####)", // 7 - R"(#########.....########.........#####)", // 8 - R"(#########vvvvv########vvvvvv...""###)", // 9 - R"(#######.......########"""""""""""###)", // 10 - R"(#######N..........####"""""""""""###)", // 11 - R"(###...............####"""""""""""###)", // 12 - R"(###............S..####"""""""""""###)", // 13 + R"(###""""""..........."""""......#####)", // 7 + R"(###""""""..........."""""......#####)", // 8 + R"(###"""""".....########.........#####)", // 9 + R"(#########vvvvv########vvvvvv...""###)", // 10 + R"(#########.....########"""""""""""###)", // 11 + R"(#######.......########"""""""""""###)", // 12 + R"(#######N..........####"""""""""""###)", // 13 R"(###...............####"""""""""""###)", // 14 - R"(###....##.........####N."""""""#####)", // 15 - R"(###""""##..............."""""""#####)", // 16 - R"(###""""##....................""#####)", // 17 - R"(###""""##vvvvv########vvvvvvvvv#####)", // 18 - R"(###""""##.....########.........#####)", // 19 - R"(###""""""......""""""...S......#####)", // 20 - R"(###""""""......""""""..........#####)", // 21 - R"(###""""""......""""""..........#####)", // 22 - R"(#####################..........#####)", // 23 - R"(#####################..........#####)", // 24 - R"(#########################......#####)", // 25 + R"(###...............####"""""""""""###)", // 15 + R"(###............S..####"""""""""""###)", // 16 + R"(###...............####"""""""""""###)", // 17 + R"(###...............####N."""""""""###)", // 18 + R"(###""""##..............."""""""""###)", // 19 + R"(###""""##................."""""""###)", // 20 + R"(###""""##....................""""###)", // 21 + R"(###""""##......................#####)", // 22 + R"(###""""##vvvvv########vvvvvvvvv#####)", // 23 + R"(###""""##.....########.........#####)", // 24 + R"(###""""""......""""""...S......#####)", // 25 + R"(###""""""......""""""..........#####)", // 26 + R"(###""""""......""""""..........#####)", // 27 + R"(###""""""......""""""..........#####)", // 28 + R"(###""""""......""""""..........#####)", // 29 + R"(#####################..........#####)", // 30 + R"(#####################..........#####)", // 31 }); return grid; } -// Where 00.03's save after the catch stands: the bottom row of the tall-grass -// patch at (15..20, 20..22), nearest the Sandgem Town entrance at the bottom -// right. On the console the sign at (24,20) is 5 columns right and 2 rows up, -// and walking east stops at the trees after 11 tiles. -const TilePos CATCH_SPOT{19, 22}; +// Where 00.03's save after the catch stands: the middle row of the +// tall-grass patch at (15..20, 25..29), world (178,827). On the console the +// sign at (24,25) is 5 columns right and 2 rows up, walking east stops at +// the trees after 11 tiles and north at the trees after 2; the patch goes +// on two rows below. +const TilePos CATCH_SPOT{19, 27}; // Where 00.04 saves once it has Potions, before Route 202's trainers (the // console's saves from r113a..r117a stand here too): under the south ledge, -// against the east trees. -const TilePos SAVE_SPOT{30, 19}; +// against the east trees, world (189,824). +const TilePos SAVE_SPOT{30, 24}; -// Blue-cap trainer, feet at about (128,186), facing south. -const TilePos TRAINER_A{7, 11}; -// Blue-cap trainer, feet at about (175,125), facing east. -const TilePos TRAINER_B{10, 7}; -// Blue-cap trainer, feet at about (430,77), facing south. -const TilePos TRAINER_C{26, 4}; -// The girl at pixel (365,235), facing south. On the console she challenged -// us at (22,17), walking east along row 17. -const TilePos TRAINER_D{22, 15}; +// From the events file: each trainer's tile, facing and sight range. +// Natalie challenged us at (22,22), walking east along the row above the +// ledge (r75), the fourth tile of her sight. +const TilePos TRAINER_TRISTAN{7, 13}; +const TilePos TRAINER_NATALIE{22, 18}; +const TilePos TRAINER_LOGAN{26, 4}; -// Facing is read from the sprites. The range is a guess; DP trainers on -// early routes see a few tiles. const std::vector& trainer_sights(){ static const std::vector sights{ - {"trainer_a", TRAINER_A, Direction::SOUTH, 4}, - {"trainer_b", TRAINER_B, Direction::EAST, 4}, - {"trainer_c", TRAINER_C, Direction::SOUTH, 4}, - {"trainer_d", TRAINER_D, Direction::SOUTH, 4}, + {"tristan", TRAINER_TRISTAN, Direction::SOUTH, 5}, + {"natalie", TRAINER_NATALIE, Direction::SOUTH, 4}, + {"logan", TRAINER_LOGAN, Direction::SOUTH, 5}, }; return sights; } -// Pixel (256,8): the path in the middle of the 8-tile gap at (11..18, 0). +// The middle of the 8-tile gap at (11..18, 0), world (174,800), below the +// 3-wide neck of Jubilife's south exit (173..175). const TilePos EXIT_JUBILIFE{15, 0}; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.h index f4fd37fac3..cee0a1e49a 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.h @@ -2,8 +2,8 @@ * * From: https://github.com/PokemonAutomation/ * - * Route 202 (Sandgem Town to Jubilife City) as a tile grid. BDSP keeps the - * tile layout of DP, so the grid is read from Bulbapedia's DP map. + * Route 202 (Sandgem Town to Jubilife City) as a tile grid, from the + * Diamond decompilation's collision table; BDSP keeps DP's tile layout. */ #ifndef PokemonAutomation_PokemonBDSP_AutoStory_Route202_H @@ -26,12 +26,12 @@ extern const Pokemon::TilePos CATCH_SPOT; // save stands. Two walls pin it. extern const Pokemon::TilePos SAVE_SPOT; -// The three trainers, south to north. Which one is Tristan, Natalie or -// Logan is not known from the map. -extern const Pokemon::TilePos TRAINER_A; -extern const Pokemon::TilePos TRAINER_B; -extern const Pokemon::TilePos TRAINER_C; -extern const Pokemon::TilePos TRAINER_D; +// The three trainers, from the events file: Youngster Tristan in the west +// field, Lass Natalie above the south ledge, Youngster Logan by the east +// grass. All face south. +extern const Pokemon::TilePos TRAINER_TRISTAN; +extern const Pokemon::TilePos TRAINER_NATALIE; +extern const Pokemon::TilePos TRAINER_LOGAN; // Their sight lines, in this map's tiles. The story wants these battles. const std::vector& trainer_sights(); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp index 16e6ff6600..e1d0f2b896 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp @@ -14,64 +14,84 @@ namespace Route203{ using namespace Pokemon; -// Map source: Bulbapedia DP map image, traced by hand, then the east stretch -// corrected on the console (r227 hand pass, 2026-10-31). -// Console checks: gate warp column, ledge row 15, three sand rows, row 17 -// straight to Jubilife (2026-10-31). -// Status: 01.06 passes on it (r230a). Next: re-derive the west and middle -// stretches from the decomp (cells (23,6), (23,7)). +// Map source: the decomp (pret/pokediamond land_data narc_0019 and +// narc_0020, with Jubilife's column 0 from narc_0016; 2026-10-31) and +// the objects from its events file. Platinum adds an X Defense ball at +// (40,14). +// Console checks (r227 hand pass, 2026-10-31): the Gate's warp at column +// 55, the ledge on row 15 (38..48), the beaten girl at column 43 on the +// second sand row, the row below her straight west to Jubilife (35 +// taps, no row change), the blue-haired trainer at the sand's west end. +// Status: no checkpoint has run on this grid yet. 01.06 passed on the +// image-traced grid it replaces (its east stretch corrected on the +// console) and must be re-run: the decomp has four sand rows under the +// ledge where the console counted three (9 taps south from (55,9); the +// decomp has 10 open tiles, so the first tap may only have turned). // -// Traced by hand from Bulbapedia's Sinnoh_Route_203_DP.png (976 x 368 px, -// 16 px tiles from the top-left corner; three panels joined by stairs). -// Checked on the console with D-pad taps (2026-10-31, r227 hand pass); -// the east stretch's ledge and sand sat two rows too high in the trace. -// - West stretch (columns 0..21): the road on rows 17..19 runs to -// Jubilife City at column 0; a fence closes row 16 west of the sign. -// - Middle stretch (24..35): the pond (29..35, 9..12) cuts the strip -// north of it, by the item ball, off from the rest: r222g's walk got -// stuck up there. The way through is along the bottom, rows 16..17. -// - East stretch (38..55): the Gate's mouth is (56, 9). South from -// (55, 9) goes 9 tiles to row 18. The ledge on row 15 (columns 38..48) -// is crossed southward only. The sand below it is three rows: the girl -// (beaten) stands on row 16 at column 43. -// - Row 17 runs in one straight line west from the sand, over both -// stairs, to Jubilife (35 taps, no row change). Row 16 also crosses the -// east stairs (36..37) but ends at the blue-haired trainer (30, 16) -// (r227b, r228a); row 18 ends at the stairs (r225a, r226a). -// The blue-haired man near the Gate and the woman on the road (13, 17) -// wander, so they are not on the map. -// Trainers ('N') stand still; they are walls once beaten. +// Decoded from Pokemon Diamond's collision table: cells (23,6) and (23,7) +// of the Sinnoh matrix, with the objects from its events file. Local +// (x, y) = world (x - 191, z - 740); 61 x 24 tiles. Column 0 is Jubilife's +// east edge. The columns are the ones the image-traced grid had (its gate +// warp, ledge and signs matched the decomp exactly); the rows are the +// game's: the image squeezed the west and middle stretches. +// - West stretch (columns 5..22): the field (5..22, 4..19) with grass at +// 5..8 (8..13), a ledge (18..22, 13), and the road on rows 17..19 that +// runs to Jubilife at column 0. +// - Middle stretch (23..37): the pond (29..34, 7..11) cuts the strip north +// of it, by the Repel ball (31,5), off from the rest: r222g's walk got +// stuck up there. The way through is along the bottom, rows 16..19. +// - East stretch (38..55): the Gate's mouth is (56,9), its warp tile +// (55,9). South from (55,9) is open to row 19. The ledge on row 15 +// (38..48) is crossed southward only. The sand below it is four rows, +// 16..19: the blue-haired trainer (Youngster Dallas, looks south, sees +// 4) at the sand's west end on its first row, the girl (Youngster +// Sebastian in the events file, looks west, sees 5) at (43,17) on its +// second. +// Row 18 runs in one straight line west from the sand to Jubilife; row 17 +// is blocked by the girl and the trainer, row 19 by trees at (36..37, 19). +// Objects, from the events file: trainers who stand still, 'N': Youngster +// Michael (13,10), looks west, sees 2; Dallas (31,16); Sebastian (43,17); +// Lass Madeline (49,8), looks south, sees 5. Items that block their tile +// until picked up, '#': a Poke Ball (20,10) and a Repel (31,5). Signs: to +// Jubilife (9,16), Trainer Tips (26,10) and (47,12), to Oreburgh (53,7); +// Jubilife's own sign to Route 203 stands at (7,16) in its events, not in +// this map's. Left off: a Lass who wanders along row 17 (14..16) and the +// Youngster at (54,16) who stands still in Diamond but wanders in BDSP (the +// blue-haired man near the Gate, on the console); Barry (10,17) is hidden +// by a story flag. const TileGrid& grid(){ - // 0 1 2 3 4 5 6 - // 0123456789012345678901234567890123456789012345678901234567890 + // 0 1 2 3 4 5 6 + // 0123456789012345678901234567890123456789012345678901234567890 static const TileGrid grid({ R"(#############################################################)", // 0 R"(#############################################################)", // 1 R"(#############################################################)", // 2 R"(#############################################################)", // 3 - R"(#############################################################)", // 4 - R"(#############################################################)", // 5 - R"(#############################.."""""..""""""""""""""#########)", // 6 - R"(#####..............##########..#""""..""""""""""""""S...#####)", // 7 - R"(#####..............##########.........""""""""""N"......#####)", // 8 - R"(#####....##...####....##.....#########""""""""""""......D####)", // 9 - R"(#####""""##...####....##..S..#########""""""""""""......#####)", // 10 - R"(#####""""##...####....##.....#########"""""""""S""""""..#####)", // 11 - R"(#####""""##.N.####..#.##.....#########"""""""""""##"""..#####)", // 12 - R"(#####""""##...####....##....#####"""##....""...."##"""..#####)", // 13 - R"(#####""""##...####vvvv##....#####"""##....""...."##"""..#####)", // 14 - R"(#####"""".............##....#####"""##vvvvvvvvvvv"""""..#####)", // 15 - R"(#####.S...............##......N..""".......N....""""""..#####)", // 16 - R"(........................."""""..."""....................#####)", // 17 - R"(........................##############..................#####)", // 18 - R"(........................#####################################)", // 19 - R"(#############################################################)", // 20 + R"(#####..............###########..""""#########################)", // 4 + R"(#####..............###########.#."""..""""""""""""""#########)", // 5 + R"(#####..................#######........""""""""""""".....#####)", // 6 + R"(#####..................###############"""""""""""....S..#####)", // 7 + R"(#####""""##...####.....#......########"""""""""""N......#####)", // 8 + R"(#####""""##...####.....#......########""""""""""".......D####)", // 9 + R"(#####""""##..N####..#..#..S...########""""""""""".......#####)", // 10 + R"(#####""""##...####.....#......########""""""""""".......#####)", // 11 + R"(#####""""##...####.....#....""""""""##"""""""""S..."""..#####)", // 12 + R"(#####""""##...####vvvvv#...""...".""##"""""""""...."""..#####)", // 13 + R"(#####""................#....######""##.....""....##"""..#####)", // 14 + R"(#####..................#....######""##vvvvvvvvvvv##"""..#####)", // 15 + R"(#####....S.............#...."""N."""............."""""..#####)", // 16 + R"(...........................""""..."".......N....."""""..#####)", // 17 + R"(..........................."".....""............."""""..#####)", // 18 + R"(..........................""""....."##..........""""""..#####)", // 19 + R"(..........................""""".""""#########################)", // 20 R"(#############################################################)", // 21 R"(#############################################################)", // 22 + R"(#############################################################)", // 23 }); return grid; } +// The warp tile the Gate puts us on, and its open neighbours. const std::vector& gate_exit(){ static const std::vector tiles{{55, 9}, {54, 9}, {55, 8}, {55, 10}}; return tiles; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.h index 1aee26300c..9bf526197b 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.h @@ -21,7 +21,7 @@ namespace Route203{ const Pokemon::TileGrid& grid(); // Where stepping out of the Oreburgh Gate may leave us when Route 203's -// banner shows: the tiles west of the cave's mouth. +// banner shows: the warp tile west of the cave's mouth and its neighbours. const std::vector& gate_exit(); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RouteRecords.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RouteRecords.cpp index 85235882ff..b1f126d7f2 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RouteRecords.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RouteRecords.cpp @@ -31,20 +31,20 @@ const TileGrid* none(){ return nullptr; } // PokemonBDSP_AutoStory_Tests.cpp; these are the rest. const std::vector& all(){ static const std::vector records{ - {"01.01", "Jubilife Pokemon Center to Barry on Route 203", "Jubilife City", jubilife, false, std::nullopt, { + {"01.01", "Jubilife Pokemon Center to Barry on Route 203", "Jubilife City", jubilife, true, std::nullopt, { {Direction::SOUTH, 0, LegEnd::NPC, "out of the Center's door; a girl below it stops us"}, {Direction::WEST, 4, LegEnd::COUNT, "stick 720 ms: onto the main road", false}, {Direction::NORTH, 16, LegEnd::COUNT, "stick 3960 ms: up to the street east to Route 203", false}, {Direction::SOUTH, 2, LegEnd::COUNT, "stick 600 ms: back onto the street", false}, {Direction::EAST, 0, LegEnd::NPC, "along the street onto Route 203 until Barry stops us; rows retried 0, +1, +1, -3, -1 when a wall comes first"}, - }, "jubilife_to_barry(); stick holds from the console, 2026-10-29; the Jubilife grid's rows are 3/4 of a tile, so the counts are not traceable on it (task #21)"}, - {"01.02", "Barry to Oreburgh City through the Oreburgh Gate", "Route 203", route203, false, std::nullopt, { + }, "jubilife_to_barry(); stick holds from the console, 2026-10-29, counted in tiles on the image grid's 3/4 rows: recount in taps before giving this record a start tile (task #21)"}, + {"01.02", "Barry to Oreburgh City through the Oreburgh Gate", "Route 203", route203, true, std::nullopt, { {Direction::EAST, 0, LegEnd::WALL, "along the row Barry stopped us on"}, {Direction::NORTH, 0, LegEnd::WALL, "to the top wall, then a row south at a time until east goes on (up to ten)"}, {Direction::EAST, 0, LegEnd::NPC, "to the Hiker"}, {Direction::EAST, 0, LegEnd::TRANSITION, "into the Oreburgh Gate"}, {Direction::EAST, 0, LegEnd::TRANSITION, "through the Gate into Oreburgh City"}, - }, "route203_to_oreburgh(); the west and middle of Route 203's grid are image-traced, the east stretch console-corrected (r227)"}, + }, "route203_to_oreburgh(); no start tile: Barry stops us on whichever row we came along"}, {"01.04", "Oreburgh Pokemon Center doorstep to the Gym", "Oreburgh City", none, false, std::nullopt, { {Direction::WEST, 20, LegEnd::COUNT, "D-pad taps along the Center's row to below the Gym's door"}, {Direction::NORTH, 1, LegEnd::DOOR, "into the Gym (the fade)"}, @@ -61,11 +61,11 @@ const std::vector& all(){ {Direction::WEST, 0, LegEnd::TRANSITION, "into the Oreburgh Gate (a row probed when a wall comes first)"}, {Direction::WEST, 0, LegEnd::BANNER, "through the Gate until Route 203's banner"}, }, "oreburgh_gym_to_center(), oreburgh_to_route203(); no Oreburgh City grid yet (decomp cells pending)"}, - {"01.07", "Jubilife's east edge to Rowan's scene", "Jubilife City", jubilife, false, std::nullopt, { + {"01.07", "Jubilife's east edge to Rowan's scene", "Jubilife City", jubilife, true, std::nullopt, { {Direction::WEST, 14, LegEnd::COUNT, "stick 2 x 1120 ms along the long road to the crossroads with the north street", false}, {Direction::NORTH, 0, LegEnd::SCENE, "up the street until Rowan's scene starts (about 6 s); the green-haired man may stand in the way"}, - }, "jubilife_to_rowan(); by hand 2026-10-31 (18 presses), r230b; Jubilife grid not traceable (rows 3/4)"}, - {"01.08", "Jubilife's north street onto Route 204", "Jubilife City", jubilife, false, std::nullopt, { + }, "jubilife_to_rowan(); by hand 2026-10-31 (18 presses), r230b; the stick hold's count was taken on the image grid's 3/4 rows, so no start tile yet"}, + {"01.08", "Jubilife's north street onto Route 204", "Jubilife City", jubilife, true, std::nullopt, { {Direction::NORTH, 0, LegEnd::BANNER, "up the street until Route 204's banner; the planned walk to the Ravaged Path door follows"}, }, "jubilife_to_ravaged_path() step 1"}, {"01.09", "Ravaged Path's east end out onto Route 204 North", "Ravaged Path", ravaged_path, true, RavagedPath::EAST_END, { diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp index a9ff89b042..cc9da31866 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp @@ -14,94 +14,112 @@ namespace SandgemTown{ using namespace Pokemon; -// Map source: rows 0 to 6 from Bulbapedia's DP map image; rows 7 and on from -// the decomp (map_data_007), signs and doors from its events. -// Console checks: all three doors, five signs, the north road stop at (29,2) -// (2026-10-29). -// Status: 00.04 and 00.05 pass on it. Next: open the Lab-Center gap on row 6 -// ((11,6), (14,6)); re-check where the north road narrows (row 2 or 3). +// Map source: the decomp (pret/pokediamond land_data narc_0007, 2026-10-31) +// with the signs and doors from its events file; Platinum's map_data_007 +// is the same. The rows from the doors down have been the decomp's since +// 2026-10-29; the four rows above the doors were the image's, and the +// grid now starts where the game's map does, four rows higher. +// Console checks: all three doors, five signs, the row below the doors east +// to the trees and north from it, the Lab's sign read facing west, the +// walk south from Route 202 stopping above the Mart (2026-10-29/30). +// Status: no checkpoint has run on this grid yet. 00.04, 00.05 and the +// Sandgem Center and Mart lady checkpoints passed with the image's rows +// above the doors; changed since: every tile is 4 rows lower (the grid +// begins at the map's edge), the road from Route 202 narrows on row 6 +// (the walk south from Route 202 stops at (29,5)), and the gap between +// the Lab's fence and the Center on the doors' row is four wide (11..14). +// Re-run them all. // -// Read from Bulbapedia's DP map of Sandgem Town (Sandgem_Town_DP.png, -// 560 x 368 px). The tile grid starts 8 px in from the left edge, as on the -// route maps: tile (x, y) covers pixels [8 + 16x, 24 + 16x) x [16y, 16y + 16). +// Decoded from Pokemon Diamond's collision table: cell (26,5) of the Sinnoh +// matrix, with the signs and doors from its events file. Local (x, y) = +// world (x - 160, z - 832); 34 x 32 tiles, the whole cell, so the grid's +// edges are where the game changes its location banner. Route 201 joins at +// column -64, row 7 (its row 4 is this grid's row 11); Route 202's road +// comes down onto row 0 at columns 24..29. // // Buildings are blocked; each door is the tile the player walks into, on -// the building's front row. Top left: Professor Rowan's lab, with a fence -// running west along row 6 to the map edge. Top middle: Pokemon Center. -// Top right: Poke Mart. Exits: west, rows 7..11 (Route 201); north, -// (20..29, 0) (Route 202); south, (20..25, 27) (the beach). +// the building's front row (row 10). Top left: Professor Rowan's lab, with a +// fence running west along row 10 to the map edge. Top middle: Pokemon +// Center. Top right: Poke Mart. Exits: west, rows 11..15 (Route 201); north, +// (24..29, 0) (Route 202: the road is 6 wide on rows 0..1, 10 wide on rows +// 2..5 and 6 wide again, columns 20..25, on rows 6..9); south, (20..25, 31) +// (the beach). // -// Rows 7 and on are the game's own collision, not the map image: Platinum's -// land data for Sandgem (pret/pokeplatinum res/field/maps/data/ -// map_data_007.bin, its permissions' collision bit; grid row = the map's -// row - 4, column = the map's column), with the signs and doors from -// res/field/events/events_sandgem_town.json. The image squeezed rows 7..18 -// into 7..15: it put both houses' doors on row 15, where the game has them -// on row 18, and the east house's wall at rows 10..14 where the game has -// open ground. r123a planned a west leg to that wall on row ~11, ran on -// past it and entered the west house's door going north. The townspeople -// south of the Mart (a youngster and two breeders) wander: not marked. +// The image squeezed the rows below the doors: it put both houses' doors +// three rows too high and the east house's wall where the game has open +// ground; r123a planned a west leg to that wall, ran on past it and entered +// the west house's door going north. The townspeople south of the Mart (a +// youngster and two breeders, who stand still in Diamond at (11,22) and +// (23,20)) wander on the console: not marked. Rowan, Barry and Dawn are +// hidden by story flags. // -// Checked on the console: walking south from Route 202 (30,22) stops at -// (29,2) above the Poke Mart, and walking west from there stops at (20,2). -// The lab's sign stands on row 7, in front of the fence: walking west along -// row 7 stops at it. +// Checked on the console: walking south from Route 202 along its column 30 +// stops above the Poke Mart, where the road narrows (counted as two rows +// above the signs' row on the image grid; the decomp has the wall at (29,6), +// so the stop is (29,5)), and walking west from there stops at (20,5). The +// lab's sign stands on row 11, in front of the fence: walking west along +// row 11 stops at it. const TileGrid& grid(){ // 0 1 2 3 // 0123456789012345678901234567890123 static const TileGrid grid({ - R"(####################..........####)", // 0 - R"(####################..........####)", // 1 + R"(########################......####)", // 0 + R"(########################......####)", // 1 R"(####################..........####)", // 2 - R"(####################......########)", // 3 - R"(####################......########)", // 4 - R"(####################......########)", // 5 - R"(########D###..###D##S....S#D######)", // 6 - R"(.....S........................####)", // 7 - R"(..............................####)", // 8 - R"(..............................####)", // 9 - R"(..............................####)", // 10 - R"(..............................####)", // 11 - R"(######........................####)", // 12 - R"(######........................####)", // 13 - R"(######.........#####..........####)", // 14 - R"(##########.....#####..........####)", // 15 - R"(##########.....#####..........####)", // 16 - R"(##########.....#####..........####)", // 17 - R"(#######D##....S#D###..S.......####)", // 18 - R"(######........................####)", // 19 - R"(######........................####)", // 20 - R"(######........................####)", // 21 - R"(######....................########)", // 22 - R"(####################......########)", // 23 - R"(####################......########)", // 24 - R"(####################......########)", // 25 - R"(####################......########)", // 26 + R"(####################..........####)", // 3 + R"(####################..........####)", // 4 + R"(####################..........####)", // 5 + R"(####################......########)", // 6 + R"(####################......########)", // 7 + R"(####################......########)", // 8 + R"(####################......########)", // 9 + R"(########D##....##D##S....S#D######)", // 10 + R"(.....S........................####)", // 11 + R"(..............................####)", // 12 + R"(..............................####)", // 13 + R"(..............................####)", // 14 + R"(..............................####)", // 15 + R"(######........................####)", // 16 + R"(######........................####)", // 17 + R"(######.........#####..........####)", // 18 + R"(##########.....#####..........####)", // 19 + R"(##########.....#####..........####)", // 20 + R"(##########.....#####..........####)", // 21 + R"(#######D##....S#D###..S.......####)", // 22 + R"(######........................####)", // 23 + R"(######........................####)", // 24 + R"(######........................####)", // 25 + R"(######....................########)", // 26 R"(####################......########)", // 27 + R"(####################......########)", // 28 + R"(####################......########)", // 29 + R"(####################......########)", // 30 + R"(####################......########)", // 31 }); return grid; } -// Pixel (144,110): the lab's door, between its two front windows. -const TilePos LAB_DOOR{8, 6}; -// Pixel (288,104): the Pokemon Center's glass door. -const TilePos POKEMON_CENTER_DOOR{17, 6}; -// On the console, walking south from (20,2) stops at (20,5), above it. -const TilePos POKEMON_CENTER_SIGN{20, 6}; -// Pixel (448,104): the Poke Mart's door. -const TilePos POKE_MART_DOOR{27, 6}; +// The lab's door, between its two front windows. +const TilePos LAB_DOOR{8, 10}; +// The Pokemon Center's glass door. +const TilePos POKEMON_CENTER_DOOR{17, 10}; +// On the console, walking south along the road's west edge above it stops +// at (20,9), above it. +const TilePos POKEMON_CENTER_SIGN{20, 10}; +// The Poke Mart's door. +const TilePos POKE_MART_DOOR{27, 10}; // Walking east along the doors' front row stops here, against the trees. -// Checked on the console (2026-10-30, CFR "walk"): east along row 8 (the -// path under the Lab's sign) from Route 201 stops at (29,8), and north from -// there stops here. From below the Center's sign (20,7), west stops at the +// Checked on the console (2026-10-30, CFR "walk"): east along row 12 (the +// path under the Lab's sign) from Route 201 stops at (29,12), and north from +// there stops here. From below the Center's sign (20,11), west stops at the // Lab's sign, which reads facing west; south from there stops at the house // 4 rows down, and north back at the sign's row; west of the house's north // side is trees. A 200 ms hold south took one row; 300 ms took one or two. -const TilePos FRONT_ROW_EAST_END{29, 7}; +const TilePos FRONT_ROW_EAST_END{29, 11}; std::vector below_sign_gap(){ - return {{21, 7}, {22, 7}, {23, 7}, {24, 7}}; + return {{21, 11}, {22, 11}, {23, 11}, {24, 11}}; } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h index 7d34f0b783..60e5f03340 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h @@ -2,8 +2,8 @@ * * From: https://github.com/PokemonAutomation/ * - * Sandgem Town as a tile grid, read from Bulbapedia's DP map; BDSP keeps - * DP's tile layout. + * Sandgem Town as a tile grid, from the Diamond decompilation's collision + * table; BDSP keeps DP's tile layout. */ #ifndef PokemonAutomation_PokemonBDSP_AutoStory_SandgemTown_H @@ -22,7 +22,7 @@ const Pokemon::TileGrid& grid(); extern const Pokemon::TilePos LAB_DOOR; extern const Pokemon::TilePos POKEMON_CENTER_DOOR; -// The sign east of the Pokemon Center's door. Walking north from row 10 in +// The sign east of the Pokemon Center's door. Walking north from row 14 in // its column stops on the tile below it. extern const Pokemon::TilePos POKEMON_CENTER_SIGN; extern const Pokemon::TilePos POKE_MART_DOOR; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp index 6d172ce41c..e8377faeeb 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp @@ -33,25 +33,16 @@ const char* const MAP_ROUTE_204_SOUTH = "Route 204 South"; const char* const MAP_ROUTE_203 = "Route 203"; -// Offsets come from how the Bulbapedia maps join: -// - Route 201 to Sandgem Town: the 16 px strip at the right of the Route -// 201 image matches the left of the Sandgem image, which puts Sandgem's -// tile column 0 on Route 201's column 64. Rows are 3 px apart, so the -// row comes from the edges: Sandgem's lab fence (row 6) lines up with -// the fence post at the right of Route 201's row 3, and Route 201's -// open rows 4..6 meet Sandgem's open rows 7..9. -// - Sandgem Town to Route 202: the 8 px strip at the bottom of the Route -// 202 image matches the top of the Sandgem image 16 px to the right, so -// Route 202's column x + 1 sits above Sandgem's column x. Route 202's -// open bottom row (25..30, 25) then meets Sandgem's (24..29, 0), with -// trees beside both. Sandgem's row 0 is taken as the row below Route -// 202's row 25; the 8 px overlap leaves a half-row doubt. +// Offsets are the maps' places in the game's world grid (the decomp's +// cells): Route 201 at world (96,839), Sandgem Town at (160,832), Route 202 +// at (159,800). Route 201's row 4 is Sandgem's row 11, below the doors, and +// Route 202's road comes down off its row 31 onto Sandgem's row 0. const MapSet& story_maps(){ static const MapSet maps = []{ MapSet maps; maps.add(MAP_ROUTE_201, Route201::grid(), {0, 0}); - maps.add(MAP_SANDGEM_TOWN, SandgemTown::grid(), {64, -3}); - maps.add(MAP_ROUTE_202, Route202::grid(), {63, -29}); + maps.add(MAP_SANDGEM_TOWN, SandgemTown::grid(), {64, -7}); + maps.add(MAP_ROUTE_202, Route202::grid(), {63, -39}); return maps; }(); return maps; @@ -78,29 +69,25 @@ const MapSet& route203_maps(){ } bool on_route203_west_line(const TilePos& pos){ - return pos.y == 17 && pos.x >= 24 && pos.x <= 42; + return pos.y == 18 && pos.x >= 24 && pos.x <= 42; } -// Columns 40..63, rows 8..20 of the Jubilife grid, as a map of its own: -// the cut is the map's edge, which no leg may -// cross or stop on, not a wall a plan could walk "to". In this corner the -// white curbs either side of the north road (columns 42 and 47) are opened: -// the console showed the main road's curbs are not walls (2026-10-30), and -// these look the same; not walked yet. +// Columns 42..63, rows 12..25 of the Jubilife grid (world x 170..191, +// z 748..761), as a map of its own: the cut is the map's edge, which no leg +// may cross or stop on, not a wall a plan could walk "to". namespace{ -const TilePos JUBILIFE_EAST_CORNER{40, 8}; +const TilePos JUBILIFE_EAST_CORNER{42, 12}; +const int JUBILIFE_EAST_BOTTOM = 25; } const MapSet& jubilife_east_maps(){ static const MapSet maps = []{ const TileGrid& city = JubilifeCity::grid(); const TilePos corner = JUBILIFE_EAST_CORNER; std::vector rows; - for (int y = corner.y; y <= 20; y++){ + for (int y = corner.y; y <= JUBILIFE_EAST_BOTTOM; y++){ std::string row; for (int x = corner.x; x < city.width(); x++){ - const TileType type = city.at({x, y}); - const bool curb = (x == 42 || x == 47) && y <= 16 && type == TileType::BLOCKED; - row += tile_char(curb ? TileType::WALKABLE : type); + row += tile_char(city.at({x, y})); } rows.push_back(row); } @@ -111,13 +98,13 @@ const MapSet& jubilife_east_maps(){ return maps; } -// Route 203's road (rows 17..19) meets Jubilife's east stairs, rows 16..17 -// of its grid, at its east edge; the banner shows a tile or two in. Both -// in the corner map's tiles, from the Jubilife grid's. +// Route 203's road (rows 17..19 of its grid) meets Jubilife's east street, +// rows 21..24 of its grid, at its east edge; the banner shows a tile or two +// in. Both in the corner map's tiles, from the Jubilife grid's. const std::vector& jubilife_east_entrance(){ static const std::vector tiles = []{ std::vector tiles; - for (int y = 16; y <= 17; y++){ + for (int y = 21; y <= 24; y++){ for (int x = 61; x <= 63; x++){ tiles.push_back({x - JUBILIFE_EAST_CORNER.x, y - JUBILIFE_EAST_CORNER.y}); } @@ -127,10 +114,11 @@ const std::vector& jubilife_east_entrance(){ return tiles; } +// The north road where it leaves the plaza, columns 44..48 of rows 16..20. bool on_jubilife_north_road(const TilePos& pos){ const int x = pos.x + JUBILIFE_EAST_CORNER.x; const int y = pos.y + JUBILIFE_EAST_CORNER.y; - return x >= 43 && x <= 46 && y >= 12 && y <= 14; + return x >= 44 && x <= 48 && y >= 16 && y <= 20; } const MapSet& oreburgh_mine_maps(){ @@ -195,7 +183,7 @@ std::vector story_door_front(const char* map, const TilePos& door){ std::vector story_after_training_area(){ const TilePos catch_spot = story_maps().to_world(MAP_ROUTE_202, Route202::CATCH_SPOT); std::vector area; - for (int y = catch_spot.y - 2; y <= catch_spot.y; y++){ + for (int y = catch_spot.y - 2; y <= catch_spot.y + 2; y++){ for (int x = catch_spot.x - 1; x <= catch_spot.x + 1; x++){ area.push_back({x, y}); } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h index 0d17c7769a..f2a399b058 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h @@ -31,8 +31,8 @@ const Pokemon::MapSet& story_maps(); // Jubilife City on its own: 00.05 starts there after Dawn's scene, so it is // not joined to Route 202. const Pokemon::MapSet& jubilife_maps(); -// Route 203 on its own (01.06), and whether a tile is on row 17 between the -// two stairs: row 17 runs straight west from there over the west stairs +// Route 203 on its own (01.06), and whether a tile is on row 18 between the +// two cliffs: row 18 runs straight west from there under the west cliff // into Jubilife, so the plan ends there (no leg may leave the map) and a // walk west until Jubilife's banner shows goes on from there. const Pokemon::MapSet& route203_maps(); @@ -80,7 +80,7 @@ std::vector story_door_front(const char* map, const Pokemon::T // Where we may stand after training in the catch grass, in world tiles: the // training walks up and down the catch spot's column, between the tree walls -// north and south of the grass, so a battle may stop us on any of its three +// north and south of the grass, so a battle may stop us on any of its five // rows. A column either side allows for where the catch left us. std::vector story_after_training_area(); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp index c261f8ff19..48a78c7e6a 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp @@ -109,9 +109,9 @@ class Test_TileGridParse : public UnitTest{ int height; }; const Map maps[] = { - {MAP_ROUTE_201, Route201::grid(), 64, 20}, - {MAP_SANDGEM_TOWN, SandgemTown::grid(), 34, 28}, - {MAP_ROUTE_202, Route202::grid(), 36, 26}, + {MAP_ROUTE_201, Route201::grid(), 64, 25}, + {MAP_SANDGEM_TOWN, SandgemTown::grid(), 34, 32}, + {MAP_ROUTE_202, Route202::grid(), 36, 32}, }; for (const Map& map : maps){ if (map.grid.width() != map.width || map.grid.height() != map.height){ @@ -132,10 +132,9 @@ class Test_TileGridParse : public UnitTest{ {MAP_SANDGEM_TOWN, SandgemTown::FRONT_ROW_EAST_END, TileType::WALKABLE}, {MAP_ROUTE_202, Route202::CATCH_SPOT, TileType::TALL_GRASS}, {MAP_ROUTE_202, Route202::SAVE_SPOT, TileType::WALKABLE}, - {MAP_ROUTE_202, Route202::TRAINER_A, TileType::NPC}, - {MAP_ROUTE_202, Route202::TRAINER_B, TileType::NPC}, - {MAP_ROUTE_202, Route202::TRAINER_C, TileType::NPC}, - {MAP_ROUTE_202, Route202::TRAINER_D, TileType::NPC}, + {MAP_ROUTE_202, Route202::TRAINER_TRISTAN, TileType::NPC}, + {MAP_ROUTE_202, Route202::TRAINER_NATALIE, TileType::NPC}, + {MAP_ROUTE_202, Route202::TRAINER_LOGAN, TileType::NPC}, {MAP_ROUTE_202, Route202::EXIT_JUBILIFE, TileType::WALKABLE}, }; const Pokemon::MapSet& world = story_maps(); @@ -165,7 +164,7 @@ class Test_TileGridParse : public UnitTest{ } } - // The maps join where their exits meet. + // The maps join where their exits meet: the grids are the game's cells. struct Join{ const char* from_map; TilePos from; @@ -174,10 +173,10 @@ class Test_TileGridParse : public UnitTest{ TilePos to; }; const Join joins[] = { - {MAP_ROUTE_201, {63, 4}, Direction::EAST, MAP_SANDGEM_TOWN, {0, 7}}, - {MAP_ROUTE_201, {63, 6}, Direction::EAST, MAP_SANDGEM_TOWN, {0, 9}}, - {MAP_SANDGEM_TOWN, {24, 0}, Direction::NORTH, MAP_ROUTE_202, {25, 25}}, - {MAP_SANDGEM_TOWN, {29, 0}, Direction::NORTH, MAP_ROUTE_202, {30, 25}}, + {MAP_ROUTE_201, {63, 4}, Direction::EAST, MAP_SANDGEM_TOWN, {0, 11}}, + {MAP_ROUTE_201, {63, 6}, Direction::EAST, MAP_SANDGEM_TOWN, {0, 13}}, + {MAP_SANDGEM_TOWN, {24, 0}, Direction::NORTH, MAP_ROUTE_202, {25, 31}}, + {MAP_SANDGEM_TOWN, {29, 0}, Direction::NORTH, MAP_ROUTE_202, {30, 31}}, }; for (const Join& join : joins){ const TilePos from = world.to_world(join.from_map, join.from); @@ -223,22 +222,21 @@ class Test_TileGridWallHit : public UnitTest{ {small, {4, 3}, Direction::EAST, {5, 3}, 1, true}, {small, {4, 4}, Direction::EAST, {4, 4}, 0, false}, // into the door {small, {2, 0}, Direction::EAST, {2, 0}, 0, false}, // off the map - {route, Route202::CATCH_SPOT, Direction::WEST, {3, 22}, 16, true}, - {route, Route202::CATCH_SPOT, Direction::NORTH, {19, 20}, 2, true}, - {route, Route202::CATCH_SPOT, Direction::EAST, {30, 22}, 11, true}, + {route, Route202::CATCH_SPOT, Direction::WEST, {3, 27}, 16, true}, + {route, Route202::CATCH_SPOT, Direction::NORTH, {19, 25}, 2, true}, + {route, Route202::CATCH_SPOT, Direction::EAST, {30, 27}, 11, true}, // Measured on the console from the post-catch save. - {route, {30, 22}, Direction::NORTH, {30, 19}, 3, true}, - {route, {30, 19}, Direction::WEST, {22, 19}, 8, true}, - {route, {22, 19}, Direction::SOUTH, {22, 24}, 5, true}, - {route, {7, 12}, Direction::NORTH, {7, 12}, 0, true}, // trainer_a holds the player - // After trainer_d, as measured in r75: the east wall is at column 31 - // on row 16, and column 30 is open up to the trees above row 4. - {route, {22, 16}, Direction::EAST, {30, 16}, 8, true}, - {route, {30, 16}, Direction::NORTH, {30, 4}, 12, true}, + {route, {30, 27}, Direction::NORTH, {30, 24}, 3, true}, + {route, {30, 24}, Direction::WEST, {22, 24}, 8, true}, + {route, Route202::TRAINER_TRISTAN.next(Direction::SOUTH), Direction::NORTH, {7, 14}, 0, true}, // Tristan holds the player + // After Natalie, as measured in r75: on the row right above the south + // ledge the east wall is at column 31; column 30 is open up to row 4. + {route, {22, 22}, Direction::EAST, {30, 22}, 8, true}, + {route, {30, 22}, Direction::NORTH, {30, 4}, 18, true}, // Through the gap east of the north ledge, over the south ledge // and off the bottom edge to Sandgem Town. - {route, {29, 4}, Direction::SOUTH, {29, 25}, 21, false}, - {route, {12, 8}, Direction::SOUTH, {12, 22}, 14, true}, // hops both ledges + {route, {29, 4}, Direction::SOUTH, {29, 31}, 27, false}, + {route, {12, 8}, Direction::SOUTH, {12, 29}, 21, true}, // hops both ledges {route, Route202::EXIT_JUBILIFE, Direction::NORTH, Route202::EXIT_JUBILIFE, 0, false}, }; auto check = [](const Case& c) -> std::string{ @@ -266,6 +264,7 @@ class Test_TileGridWallHit : public UnitTest{ const TilePos below_mart = town(SandgemTown::POKE_MART_DOOR.next(Direction::SOUTH)); const TilePos row_end = town(SandgemTown::FRONT_ROW_EAST_END); const Case sandgem[] = { + {world, maps.to_world(MAP_ROUTE_202, {22, 24}), Direction::SOUTH, maps.to_world(MAP_ROUTE_202, {22, 31}), 7, true}, // under the ledge, down to Sandgem's trees (a timed count said 5) {world, town(SandgemTown::POKEMON_CENTER_DOOR.next(Direction::SOUTH)), Direction::EAST, row_end, 12, true}, {world, below_mart, Direction::EAST, row_end, 2, true}, {world, below_mart, Direction::NORTH, below_mart, 0, false}, @@ -339,10 +338,10 @@ std::string check_plan_stops_readable( // past where the grid said and the last one entered a house. std::string check_plan_avoids_doors( const std::string& name, const Pokemon::MapSet& maps, - const std::vector& from, const std::function& goal + const std::vector& from, const std::function& goal, const Pokemon::RobustPlanCosts& costs = Pokemon::RobustPlanCosts() ){ const TileGrid& grid = maps.world(); - const auto legs = Pokemon::plan_robust_route(grid, from, goal); + const auto legs = Pokemon::plan_robust_route(grid, from, goal, costs); if (!legs){ return name + ": no robust route found."; } @@ -508,63 +507,60 @@ class Test_TileGridPlans : public UnitTest{ above_sign_gap.push_back(hit.stop); } } - // The walks that start or end in the catch grass must stop in it; - // the Sandgem walks (`readable`) never need to. - const struct{ const char* name; std::vector from; std::function goal; bool readable; } walks[] = { + // The walks that start or end in the catch grass must stop in it; the Sandgem + // walks (`readable`) never need to. One-tile-step walks (the Mart lady's) take town costs. + const struct{ const char* name; std::vector from; std::function goal; bool readable; Pokemon::RobustPlanCosts costs; } walks[] = { {"Save spots to the catch grass", story_save_spots(), - [&](const TilePos& pos){ return std::find(grass.begin(), grass.end(), pos) != grass.end(); }, false}, + [&](const TilePos& pos){ return std::find(grass.begin(), grass.end(), pos) != grass.end(); }, false, {}}, {"After training to the Pokemon Center", story_after_training_area(), - [&](const TilePos& pos){ return pos == below_sign; }, false}, + [&](const TilePos& pos){ return pos == below_sign; }, false, {}}, // The Mart's door takes a tile either side: enter_lit_door() lines up by sight. {"Pokemon Center to the Poke Mart", story_door_front(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_DOOR), - [&](const TilePos& pos){ return pos.y == below_mart.y && std::abs(pos.x - below_mart.x) <= 1; }, true}, + [&](const TilePos& pos){ return pos.y == below_mart.y && std::abs(pos.x - below_mart.x) <= 1; }, true, {}}, {"Poke Mart to the trees east of it", story_door_front(MAP_SANDGEM_TOWN, SandgemTown::POKE_MART_DOOR), - [&](const TilePos& pos){ return pos == row_end; }, true}, + [&](const TilePos& pos){ return pos == row_end; }, true, {}}, {"North of the gap between the signs to the save spot", above_sign_gap, - [&](const TilePos& pos){ return pos == save_spot; }, true}, - {"Save spots to Jubilife", story_save_spots(), story_at_jubilife_exit, false}, + [&](const TilePos& pos){ return pos == save_spot; }, true, {}}, // The Sandgem Center test checkpoint: south into town, then to the Center's sign. {"Save spot to Sandgem Town", {save_spot}, - [&](const TilePos& pos){ return pos == sandgem_entry_stop(); }, true}, + [&](const TilePos& pos){ return pos == sandgem_entry_stop(); }, true, {}}, {"Sandgem's entry to the Pokemon Center", {sandgem_entry_stop()}, - [&](const TilePos& pos){ return pos == below_sign; }, true}, + [&](const TilePos& pos){ return pos == below_sign; }, true, {}}, // The Mart lady test checkpoint: out of the Center to the tile west - // of Route 201's border sign, from the lady back to it, and back. - // Those to the sign end with a leg south to the trees in the grass - // west of the sign, which cannot be read; reading the sign after it says - // where we are, and a tile short is walked east to it. + // of Route 201's border sign, from the lady back to it, and back. The + // sign's row has no wall west of it: a step onto it, then east to it. {"Pokemon Center to west of the Route 201 sign", story_door_front(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_DOOR), - [&](const TilePos& pos){ return pos == route201_sign_west(); }, false}, + [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, town_plan_costs()}, {"Poke Mart lady to west of the Route 201 sign", {maps.to_world(MAP_ROUTE_201, Route201::POTION_GIVER_TALK_FROM)}, - [&](const TilePos& pos){ return pos == route201_sign_west(); }, false}, + [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, town_plan_costs()}, {"Route 201 sign to the Pokemon Center", {route201_sign_west()}, - [&](const TilePos& pos){ return pos == below_sign; }, true}, + [&](const TilePos& pos){ return pos == below_sign; }, true, {}}, // The Center walk's re-anchor at the trees east of the Mart. {"Trees east of the Mart to the Pokemon Center", {maps.to_world(MAP_SANDGEM_TOWN, SandgemTown::FRONT_ROW_EAST_END)}, - [&](const TilePos& pos){ return pos == below_sign; }, true}, + [&](const TilePos& pos){ return pos == below_sign; }, true, {}}, // From and back to where the Route 202 checkpoint ends: the doors' - // row by the signs' gap. - {"Below the Center's sign to west of the Route 201 sign", {below_sandgem_center_sign()}, - [&](const TilePos& pos){ return pos == route201_sign_west(); }, false}, + // row by the signs' gap; westward it first walks to the Lab's sign. + {"East of the Lab's sign to west of the Route 201 sign", {east_of_lab_sign()}, + [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, town_plan_costs()}, {"Below the Center's sign to the trees east of the Mart", {below_sandgem_center_sign()}, - [&](const TilePos& pos){ return pos == row_end; }, true}, + [&](const TilePos& pos){ return pos == row_end; }, true, {}}, {"East of the Lab's sign to the trees east of the Mart", {east_of_lab_sign()}, - [&](const TilePos& pos){ return pos == row_end; }, true}, + [&](const TilePos& pos){ return pos == row_end; }, true, {}}, // Its re-anchor after a wild battle in the lady's grass. {"East end of the lady's row to the Route 201 sign", {route201_row_3_east_end()}, - [&](const TilePos& pos){ return pos == route201_sign_west(); }, false}, + [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, town_plan_costs()}, }; for (const auto& walk : walks){ - error = check_robust_plan(logger, walk.name, maps, walk.from, walk.goal); + error = check_robust_plan(logger, walk.name, maps, walk.from, walk.goal, walk.costs); if (!error.empty()){ return error; } - error = check_plan_avoids_doors(walk.name, maps, walk.from, walk.goal); + error = check_plan_avoids_doors(walk.name, maps, walk.from, walk.goal, walk.costs); if (!error.empty()){ return error; } if (walk.readable){ - error = check_plan_stops_readable(walk.name, maps, walk.from, walk.goal); + error = check_plan_stops_readable(walk.name, maps, walk.from, walk.goal, walk.costs); if (!error.empty()){ return error; } @@ -575,7 +571,7 @@ class Test_TileGridPlans : public UnitTest{ // the plan is the user's (2026-10-30): west to the wall, a tile east // into the gap's column, straight south through the gap between the // signs, a tile west, then north until the Center's sign stops us - // (r134a: "south 5" went 6). Not round the town. + // (r134a: "south 5" went 6; seven rows on the game's grid). Not round the town. { const auto legs = Pokemon::plan_robust_route(maps.world(), {sandgem_entry_stop()}, [&](const TilePos& pos){ return pos == below_sign; }, town_plan_costs()); @@ -584,14 +580,14 @@ class Test_TileGridPlans : public UnitTest{ read += " [" + Pokemon::to_string(planned.leg) + "]"; } const std::vector> expected{ - {Direction::WEST, 9}, {Direction::EAST, 1}, {Direction::SOUTH, 6}, {Direction::WEST, 1}, {Direction::NORTH, 2}, + {Direction::WEST, 9}, {Direction::EAST, 1}, {Direction::SOUTH, 7}, {Direction::WEST, 1}, {Direction::NORTH, 2}, }; bool same = legs && legs->size() == expected.size(); for (size_t i = 0; same && i < expected.size(); i++){ same = (*legs)[i].leg.direction == expected[i].first && (*legs)[i].leg.tiles == expected[i].second; } if (!same){ - return "Sandgem's entry to below the Center's sign, town costs: expected west 9, east 1, south 6, west 1, north 2; planned" + + return "Sandgem's entry to below the Center's sign, town costs: expected west 9, east 1, south 7, west 1, north 2; planned" + (read.empty() ? std::string(" nothing") : read) + "."; } logger.log("Sandgem's entry to below the Center's sign, town costs:" + read); @@ -624,7 +620,7 @@ class Test_TileGridPlans : public UnitTest{ } // 00.05 in Jubilife: every leg the segment walks, from where the one - // before it may have left us. + // before it may have left us, with route_plan_costs() as talk_to_npc() plans. { using namespace JubilifeCity; const Pokemon::MapSet& town = jubilife_maps(); @@ -708,7 +704,7 @@ class Test_TileGridPlans : public UnitTest{ // Oreburgh Gate's west exit to its road near Jubilife, and from // Jubilife's east stairs to the foot of its north road. { - std::string leg_error = check_robust_plan(logger, "Route 203: Oreburgh Gate to row 17", route203_maps(), + std::string leg_error = check_robust_plan(logger, "Route 203: Oreburgh Gate to row 18", route203_maps(), Route203::gate_exit(), on_route203_west_line); failed += leg_error.empty() ? "" : leg_error + " "; leg_error = check_robust_plan(logger, "Jubilife: east stairs to the north road", jubilife_east_maps(), @@ -741,9 +737,12 @@ class Test_TileGridPlans : public UnitTest{ const std::string leg_error = check_robust_plan(logger, leg.name, town, leg.from, [&](const TilePos& pos){ return door ? pos.y == to.y && pos.x >= to.x - 1 && pos.x <= to.x + 1 : pos == to; - }, town_plan_costs()); + }, route_plan_costs()); failed += leg_error.empty() ? "" : leg_error + " "; } + // Last: 00.04's step 5 finds no plan within max_searched (task #15), here as on the image grid. + const std::string exit_error = check_robust_plan(logger, "Save spots to Jubilife", maps, story_save_spots(), story_at_jubilife_exit); + failed += exit_error.empty() ? "" : exit_error + " "; if (!failed.empty()){ return failed; } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.cpp index ba5663661d..afcb3ff6da 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.cpp @@ -62,7 +62,7 @@ using Pokemon::pose_known; const char* const ROUTE202_TO_SANDGEM_CENTER_NAME = "Route 202 to Sandgem's Pokemon Center (events)"; TilePos sandgem_entry_stop(){ - return story_maps().to_world(MAP_SANDGEM_TOWN, {29, 2}); + return story_maps().to_world(MAP_SANDGEM_TOWN, {29, 5}); } TilePos below_sandgem_center_sign(){ @@ -70,7 +70,7 @@ TilePos below_sandgem_center_sign(){ } TilePos east_of_lab_sign(){ - return story_maps().to_world(MAP_SANDGEM_TOWN, {6, 7}); + return story_maps().to_world(MAP_SANDGEM_TOWN, {6, 11}); } bool sign_text_matches(const std::string& text, const std::string& key){ diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.h index 6108408750..00d4eb0658 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.h @@ -95,7 +95,9 @@ class SandgemCenterActions{ // Where the walk south stops in Sandgem Town, in world tiles of // story_maps(): Route 202's column 30 runs into Sandgem's column 29, and -// walking south from Route 202 stops at (29,2), above the Poke Mart. +// walking south from Route 202 stops at (29,5), above the Poke Mart, where +// the road narrows (the console counted it as two rows above the signs' row +// on the image grid; the decomp has three, with (29,6) a wall). Pokemon::TilePos sandgem_entry_stop(); // Below the Center's sign, three tiles east of its door: where 00.04's diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_01.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_01.cpp index 0911d5396f..fb94058964 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_01.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_01.cpp @@ -729,7 +729,7 @@ void oreburgh_to_roark(VideoStream& stream, ProControllerContext& context){ // Back up the corridor, then north out through the hall. A route leg // north to the top's wall walks on through it into the hall (r99), and // no wall stops us a row short of it, so the route ends on the corner - // at (14,11), where that leg started, and the walk does the rest. + // at (14,10), where that leg started, and the walk does the rest. const Pokemon::TilePos exit = world(OreburghMine::CORRIDOR_EXIT_START); at = walk_route(stream, context, maps, at, [&](const Pokemon::TilePos& pos){ return pos == exit; }, @@ -1157,31 +1157,31 @@ void oreburgh_to_route203(VideoStream& stream, ProControllerContext& context){ void route203_to_jubilife(VideoStream& stream, ProControllerContext& context){ StepLog step(stream, "01.06", "From the Oreburgh Gate's west exit into Jubilife City", { - "Route 203 on its grid to row 17, below the blue-haired trainer", - "West along row 17 into Jubilife, counting tiles", + "Route 203 on its grid to row 18, below the girl", + "West along row 18 into Jubilife, counting tiles", }); step(1); - // On the grid (Data/PokemonBDSP_AutoStory_Route203, checked by hand): - // south from the Gate, west under the beaten girl to the stairs, north - // to the ledge, west to the blue-haired trainer, and a row down onto row - // 17, which runs straight to Jubilife. Trainers the map does not list + // On the grid (Data/PokemonBDSP_AutoStory_Route203, from the decomp, + // its east stretch checked by hand): south from the Gate down the sand, + // west along the sand's bottom row and on under the girl's row, which + // runs straight to Jubilife as row 18. Trainers the map does not list // are fought where they stop us. std::vector trainers; auto fight = [&](const std::string& who){ talk_or_fight(stream, context, "Route 203: " + who); }; const std::vector at = walk_route(stream, context, route203_maps(), Route203::gate_exit(), - on_route203_west_line, trainers, fight, "Route 203 to row 17"); + on_route203_west_line, trainers, fight, "Route 203 to row 18"); if (at.size() != 1){ - fail(stream, "Route 203: the walk to row 17 did not end on a known tile."); + fail(stream, "Route 203: the walk to row 18 did not end on a known tile."); } step(2); - // Row 17 has no wall before Jubilife, so count the tiles: from column - // `x` it is x + 1 taps to Jubilife's first tile (by hand from (31, 17): + // Row 18 has no wall before Jubilife, so count the tiles: from column + // `x` it is x + 1 taps to Jubilife's first tile (by hand from column 31: // 32 taps, Jubilife's banner on the last one). 01.07 starts there. - dpad_tiles(stream, context, DPAD_LEFT, (size_t)at[0].x + 1, "west along row 17 into Jubilife"); + dpad_tiles(stream, context, DPAD_LEFT, (size_t)at[0].x + 1, "west along row 18 into Jubilife"); context.wait_for_all_requests(); if (!location_banner_showing(*stream.video().snapshot().frame)){ fail(stream, "Route 203: no Jubilife banner after counting the tiles west."); @@ -1195,7 +1195,7 @@ void jubilife_to_rowan(VideoStream& stream, ProControllerContext& context){ }); step(1); - // Route 203's row 17 carries on as Jubilife's long road. From the first + // Route 203's row 18 carries on as Jubilife's long road. From the first // tile the crossroads with the street north to Route 204 is 14 tiles // west; the street is about 4 tiles wide, so a stick hold does (by hand, // 2026-10-31: 2 x 1120 ms landed mid-street; 7 D-pad taps stopped below From b25fbf385ba694dc3339c727ea55bd106c6230e0 Mon Sep 17 00:00:00 2001 From: dayfine Date: Sat, 31 Oct 2026 23:00:47 -0700 Subject: [PATCH 02/10] BDSP AutoStory: name the trainer slug before looking the trainer up, for gcc -Wdangling-reference gcc 13 refuses a reference bound to bdsp_trainer()'s result when the slug is a temporary; the lookup returns a reference into the trainer table, so the slug's lifetime does not matter, but a named slug keeps -Werror quiet. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp index 14c1ac23bf..a65ba113b3 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp @@ -631,7 +631,8 @@ static BattlePlan build_expert_plan(Logger& logger, // Iterate through all listed trainers in sequence order. // For current_trainer, populate move_for_species. for (Trainer t : all_trainers){ - const BDSPTrainerData& tdata = bdsp_trainer(trainer_slug(t)); + const std::string slug = trainer_slug(t); + const BDSPTrainerData& tdata = bdsp_trainer(slug); bool is_current = (t == current_trainer); bool doubles = (tdata.battle_type == BDSPBattleType::DOUBLES); @@ -758,7 +759,8 @@ void handle_expert_battle(const ProgramInfo& /*info*/, using namespace Pokemon; Logger& logger = stream.logger(); - const BDSPTrainerData& trainer_data = bdsp_trainer(trainer_slug(current_trainer)); + const std::string current_slug = trainer_slug(current_trainer); + const BDSPTrainerData& trainer_data = bdsp_trainer(current_slug); const OutsideHelpConfig& help = options.outside_help; bool doubles = (trainer_data.battle_type == BDSPBattleType::DOUBLES); From cbbf690244c504065def06f0b76bf69cf42a1887 Mon Sep 17 00:00:00 2001 From: dayfine Date: Sat, 31 Oct 2026 23:25:09 -0700 Subject: [PATCH 03/10] BDSP AutoStory: name the helper's species slug too, for gcc -Wdangling-reference Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp index a65ba113b3..883fa21a6c 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Battle.cpp @@ -771,7 +771,8 @@ void handle_expert_battle(const ProgramInfo& /*info*/, } // Helper stats — 0IV/0EV at level 100, neutral nature - const BDSPPokemonData& helper_base = bdsp_pokemon("torterra"); + const std::string helper_base_slug = "torterra"; + const BDSPPokemonData& helper_base = bdsp_pokemon(helper_base_slug); int base_atk = (int)calc_stats_nonhp(helper_base.attack, 100, 0, 0, NatureAdjustment::NEUTRAL); int base_spatk = (int)calc_stats_nonhp(helper_base.spatk, 100, 0, 0, NatureAdjustment::NEUTRAL); From 8190c53f8e1e2f2e4025be15a37d44d45d838f0f Mon Sep 17 00:00:00 2001 From: dayfine Date: Sat, 31 Oct 2026 23:55:49 -0700 Subject: [PATCH 04/10] BDSP AutoStory tests: plan five walks with the costs that find a plan on the game's grids On the decomp grids, "After training to the Pokemon Center" finds no plan with the route costs; walk_route() then falls back to the default costs, so the test plans it with those. The four Mart-lady walks to the Route 201 sign find no plan with the default costs: their one-tile steps need the town costs. They are walked by hand, so the plan is only a check of the grid. Every other entry keeps the costs the program plans it with. Checked with a standalone planner harness over the merged grids: every table entry and every 00.05 Jubilife leg finds a plan with these costs and passes the door and tall-grass checks. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../AutoStory/PokemonBDSP_AutoStory_Tests.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp index cbe180a83b..ebe224c5a9 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp @@ -514,9 +514,10 @@ class Test_TileGridPlans : public UnitTest{ // the costs the program plans it with: walk_route()'s route costs // for 00.04's walks, the Sandgem Center events' default costs for // walk() and town costs for walk_in_town(). The planner gives up - // after costs.max_searched sets, and the costs decide how many a - // walk needs: after training to the Center the route costs find a - // plan within 17000 sets, the default costs none within the cap. + // after costs.max_searched sets, and the costs decide whether a + // walk gets a plan: after training to the Center the route costs + // find none on the game's grid and walk_route() falls back to the + // default costs, so that is the plan that runs and is checked here. const struct{ const char* name; std::vector from; @@ -527,7 +528,7 @@ class Test_TileGridPlans : public UnitTest{ {"Save spots to the catch grass", story_save_spots(), [&](const TilePos& pos){ return std::find(grass.begin(), grass.end(), pos) != grass.end(); }, false, route_plan_costs()}, {"After training to the Pokemon Center", story_after_training_area(), - [&](const TilePos& pos){ return pos == below_sign; }, false, route_plan_costs()}, + [&](const TilePos& pos){ return pos == below_sign; }, false, Pokemon::RobustPlanCosts()}, // The Mart's door takes a tile either side: enter_lit_door() lines up by sight. {"Pokemon Center to the Poke Mart", story_door_front(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_DOOR), [&](const TilePos& pos){ return pos.y == below_mart.y && std::abs(pos.x - below_mart.x) <= 1; }, true, route_plan_costs()}, @@ -547,10 +548,13 @@ class Test_TileGridPlans : public UnitTest{ // The Mart lady test checkpoint: out of the Center to the tile west // of Route 201's border sign, from the lady back to it, and back. The // sign's row has no wall west of it: a step onto it, then east to it. + // These legs are walked by hand (walk_until_stopped), so the plan is + // only a check of the grid; the one-tile steps need the town costs, + // the default costs find no plan. {"Pokemon Center to west of the Route 201 sign", story_door_front(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_DOOR), - [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, Pokemon::RobustPlanCosts()}, + [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, town_plan_costs()}, {"Poke Mart lady to west of the Route 201 sign", {maps.to_world(MAP_ROUTE_201, Route201::POTION_GIVER_TALK_FROM)}, - [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, Pokemon::RobustPlanCosts()}, + [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, town_plan_costs()}, {"Route 201 sign to the Pokemon Center", {route201_sign_west()}, [&](const TilePos& pos){ return pos == below_sign; }, true, Pokemon::RobustPlanCosts()}, // The Center walk's re-anchor at the trees east of the Mart. @@ -559,14 +563,14 @@ class Test_TileGridPlans : public UnitTest{ // From and back to where the Route 202 checkpoint ends: the doors' // row by the signs' gap; westward it first walks to the Lab's sign. {"East of the Lab's sign to west of the Route 201 sign", {east_of_lab_sign()}, - [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, Pokemon::RobustPlanCosts()}, + [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, town_plan_costs()}, {"Below the Center's sign to the trees east of the Mart", {below_sandgem_center_sign()}, [&](const TilePos& pos){ return pos == row_end; }, true, Pokemon::RobustPlanCosts()}, {"East of the Lab's sign to the trees east of the Mart", {east_of_lab_sign()}, [&](const TilePos& pos){ return pos == row_end; }, true, Pokemon::RobustPlanCosts()}, // Its re-anchor after a wild battle in the lady's grass. {"East end of the lady's row to the Route 201 sign", {route201_row_3_east_end()}, - [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, Pokemon::RobustPlanCosts()}, + [&](const TilePos& pos){ return pos == route201_sign_west(); }, false, town_plan_costs()}, }; for (const auto& walk : walks){ error = check_robust_plan(logger, walk.name, maps, walk.from, walk.goal, walk.costs); From ddcbdb21c1dc7ef60c83a234fe8b96e0ce0fda3b Mon Sep 17 00:00:00 2001 From: dayfine Date: Sun, 1 Nov 2026 09:23:54 -0800 Subject: [PATCH 05/10] BDSP maps: Route 202's catch patch is three grass rows, Sandgem's road stop is named Moved here from #121 (bdsp/mvp-v3), where console runs r253..r258 found them; this PR owns the decomp grids. - Route 202: trees, not grass, at (15..20, 28..29): the console's catch patch is three rows between tree rows, as the image-traced grid had it (r253: west along row 29 stopped at column 21); a tree at (21, 30), south of the pocket at (21, 29) where the catch's save loads (r254). CATCH_SPOT (19, 27) is the patch's bottom row. - story_after_training_area() keeps only standable tiles (the planner refuses starts on trees); story_catch_save_area() is where the catch's save may stand: the patch and the lawn column east of it to the pocket. - Sandgem: ROUTE_202_ENTRY_STOP (29, 5), where the walk south from Route 202 stops above the Mart; sandgem_entry_stop() uses it. Tests (PokemonBDSP_AutoStory_MapGrid_Tests.cpp): the patch's columns run rows 25..27 between trees, and plans from the save area and the pocket end in the grass; Sandgem's Center door (17, 10), its sign (20, 10) and the open row below them; plans into Sandgem from every tile of the training area. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../Source/PokemonBDSP/PokemonBDSP_Tests.cpp | 2 + .../Data/PokemonBDSP_AutoStory_Route202.cpp | 24 ++- .../PokemonBDSP_AutoStory_SandgemTown.cpp | 1 + .../Data/PokemonBDSP_AutoStory_SandgemTown.h | 3 + .../Data/PokemonBDSP_AutoStory_StoryMaps.cpp | 22 ++- .../Data/PokemonBDSP_AutoStory_StoryMaps.h | 11 +- .../PokemonBDSP_AutoStory_MapGrid_Tests.cpp | 171 ++++++++++++++++++ .../PokemonBDSP_AutoStory_MapGrid_Tests.h | 28 +++ ...emonBDSP_AutoStory_SandgemCenterEvents.cpp | 2 +- SerialPrograms/cmake/SourceFiles.cmake | 2 + 10 files changed, 252 insertions(+), 14 deletions(-) create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.h diff --git a/SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Tests.cpp index 10dd5da86f..929a888bbd 100644 --- a/SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Tests.cpp @@ -18,6 +18,7 @@ #include "Programs/AutoStory/PokemonBDSP_AutoStoryTools.h" #include "PokemonBDSP_Tests.h" #include "Inference/PokemonBDSP_MenuDetector.h" +#include "Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.h" #include "Programs/AutoStory/PokemonBDSP_AutoStory_Tests.h" namespace PokemonAutomation{ @@ -289,6 +290,7 @@ bool run_bag_screenshot_tests(Logger& logger, const std::string& folder){ void add_tests(UnitTestDatabase& database){ database.add(); add_tests_MenuDetector(database); + add_tests_AutoStory_MapGrids(database); add_tests_AutoStory(database); } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp index f78bc80261..e52e11c6ab 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp @@ -21,7 +21,11 @@ using namespace Pokemon; // trees at (21,24), the sign a row below at (24,25), the save spot // (30,24) against the east trees, Natalie's challenge at (22,22), east // along the row above the ledge stops at column 30 and column 30 runs -// north to row 4 (r75), the catch spot's walls (2026-10-29/30). +// north to row 4 (r75), the catch spot's walls (2026-10-29/30); trees, +// not grass, at (15..20, 28..29) below the catch patch (r253: west +// along row 29 stopped at column 21, beside the trees); a tree at +// (21, 30), south of the pocket at (21, 29) where the catch's save +// loads (r254: south from there was blocked at once). // Status: no checkpoint has run on this grid yet. 00.04 passed on the // image-traced grid it replaces (26 rows for 32) and must be re-run; // its legs south of the catch spot are three rows longer here. @@ -46,7 +50,9 @@ using namespace Pokemon; // Tristan (7,13), Lass Natalie (22,18) and Youngster Logan (26,4), all // facing south, with the sight ranges the events give; a Potion ball (3,6), // a wall until picked up; the signs (17,4) to Jubilife, (15,16) Trainer Tips -// and (24,25) to Sandgem. A Youngster who is not a trainer wanders along row +// and (24,25) to Sandgem. BDSP has trees where Diamond's catch patch has +// its two bottom rows, (15..20, 28..29): the console's patch is three rows +// between tree rows, as the image-traced grid had it. A Youngster who is not a trainer wanders along row // 8, columns 9..11, and is left off the grid (the image-traced grid had him // as a fourth trainer facing east). Dawn's tile (15,27) is hidden by a // story flag. @@ -82,20 +88,20 @@ const TileGrid& grid(){ R"(###""""""......""""""...S......#####)", // 25 R"(###""""""......""""""..........#####)", // 26 R"(###""""""......""""""..........#####)", // 27 - R"(###""""""......""""""..........#####)", // 28 - R"(###""""""......""""""..........#####)", // 29 - R"(#####################..........#####)", // 30 + R"(###""""""......######..........#####)", // 28 + R"(###""""""......######..........#####)", // 29 + R"(######################.........#####)", // 30 R"(#####################..........#####)", // 31 }); return grid; } -// Where 00.03's save after the catch stands: the middle row of the -// tall-grass patch at (15..20, 25..29), world (178,827). On the console the +// Where 00.03's save after the catch stands: the bottom row of the +// tall-grass patch at (15..20, 25..27), world (178,827). On the console the // sign at (24,25) is 5 columns right and 2 rows up, walking east stops at -// the trees after 11 tiles and north at the trees after 2; the patch goes -// on two rows below. +// the trees after 11 tiles and north at the trees after 2; south are trees +// (the decomp's two more grass rows are trees in BDSP, r253). const TilePos CATCH_SPOT{19, 27}; // Where 00.04 saves once it has Potions, before Route 202's trainers (the // console's saves from r113a..r117a stand here too): under the south ledge, diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp index cc9da31866..d2aeaa1a2d 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp @@ -100,6 +100,7 @@ const TileGrid& grid(){ } +const TilePos ROUTE_202_ENTRY_STOP{29, 5}; // The lab's door, between its two front windows. const TilePos LAB_DOOR{8, 10}; // The Pokemon Center's glass door. diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h index 60e5f03340..cb5d223828 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h @@ -20,6 +20,9 @@ namespace SandgemTown{ const Pokemon::TileGrid& grid(); +// Where the walk south from Route 202 down the road's east side stops, +// above the Poke Mart where the road narrows. +extern const Pokemon::TilePos ROUTE_202_ENTRY_STOP; extern const Pokemon::TilePos LAB_DOOR; extern const Pokemon::TilePos POKEMON_CENTER_DOOR; // The sign east of the Pokemon Center's door. Walking north from row 14 in diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp index 0521675c23..25f7180d5f 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp @@ -202,12 +202,30 @@ std::vector story_door_front(const char* map, const TilePos& door){ return {below.next(Direction::WEST), below, below.next(Direction::EAST)}; } +std::vector story_catch_save_area(){ + const MapSet& maps = story_maps(); + std::vector area; + for (int y = 25; y <= 29; y++){ + for (int x = 15; x <= 21; x++){ + const TilePos pos = maps.to_world(MAP_ROUTE_202, {x, y}); + if (maps.world().standable(pos)){ + area.push_back(pos); + } + } + } + return area; +} + std::vector story_after_training_area(){ - const TilePos catch_spot = story_maps().to_world(MAP_ROUTE_202, Route202::CATCH_SPOT); + const MapSet& maps = story_maps(); + const TilePos catch_spot = maps.to_world(MAP_ROUTE_202, Route202::CATCH_SPOT); std::vector area; for (int y = catch_spot.y - 2; y <= catch_spot.y + 2; y++){ for (int x = catch_spot.x - 1; x <= catch_spot.x + 1; x++){ - area.push_back({x, y}); + // The rows below the catch spot are trees in BDSP. + if (maps.world().standable({x, y})){ + area.push_back({x, y}); + } } } return area; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h index 02cac7789b..3e27b3dc7a 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h @@ -79,6 +79,13 @@ bool story_at_jubilife_exit(const Pokemon::TilePos& world); // ledge (00.04 saves there once it has Potions, before Route 202's trainers). std::vector story_save_spots(); +// Where 00.04b's save after the catch may stand, in world tiles: wherever +// the catch's walks in the grass ended, the patch (15..20, 25..27) and the +// lawn column east of it, (21, 25..29), down to the pocket behind the tree +// row where r252's catch ended and saved (the save loads there: (21, 29) +// by the screen, the 202 sign 3 columns right and 4 rows up). +std::vector story_catch_save_area(); + // Where a walk out of the door `door` of `map` may leave us, in world tiles: // the tile below it and its neighbours either side, since the door opening // is not lined up with one tile (Jubilife's Center, r85). @@ -86,8 +93,8 @@ std::vector story_door_front(const char* map, const Pokemon::T // Where we may stand after training in the catch grass, in world tiles: the // training walks up and down the catch spot's column, between the tree walls -// north and south of the grass, so a battle may stop us on any of its five -// rows. A column either side allows for where the catch left us. +// north and south of the grass, so a battle may stop us on any of its +// three rows. A column either side allows for where the catch left us. std::vector story_after_training_area(); // Route 202's trainers, in world tiles of story_maps(). diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp new file mode 100644 index 0000000000..c013b4bfde --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp @@ -0,0 +1,171 @@ +/* BDSP AutoStory Map Grid Tests + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include +#include +#include +#include +#include +#include "Common/Cpp/TestRunners/UnitTestDatabase.h" +#include "CommonFramework/ImageTypes/ImageViewRGB32.h" +#include "Pokemon/Navigation/Pokemon_MapSet.h" +#include "Pokemon/Navigation/Pokemon_TileGrid.h" +#include "Data/PokemonBDSP_AutoStory_Route202.h" +#include "Data/PokemonBDSP_AutoStory_SandgemTown.h" +#include "Data/PokemonBDSP_AutoStory_StoryMaps.h" +#include "Utils/PokemonBDSP_AutoStory_RouteWalk.h" +#include "PokemonBDSP_AutoStory_MapGrid_Tests.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonBDSP{ + + +namespace{ + +using Pokemon::Direction; +using Pokemon::MapSet; +using Pokemon::TileGrid; +using Pokemon::TilePos; +using Pokemon::TileType; + +// 00.04's training walks up and down the catch patch, three grass rows +// between tree rows, and needs the walk there to end in its grass: r253 +// and r254 loaded the catch's save in the pocket behind the trees at +// (21, 29), planned from the catch spot instead, and walked up and down +// the lawn east of the grass for three minutes without a battle. +class Test_Route202CatchGrass : public UnitTest{ +public: + Test_Route202CatchGrass() + : UnitTest("PokemonBDSP::AutoStory - Route 202: the catch patch and the walk to it") + {} + virtual UnitTestResult run(Logger& logger, CancellableScope&) const override{ + const TileGrid& route = Route202::grid(); + for (int x = 15; x <= 20; x++){ + const Pokemon::WallHit up = Pokemon::walk_to_wall(route, {x, 27}, Direction::NORTH); + const Pokemon::WallHit down = Pokemon::walk_to_wall(route, {x, 25}, Direction::SOUTH); + if (!(up.stop == TilePos{x, 25}) || !(down.stop == TilePos{x, 27})){ + return "Catch patch column " + std::to_string(x) + ": north from row 27 stops at " + + Pokemon::to_string(up.stop) + ", south from row 25 at " + Pokemon::to_string(down.stop) + + "; expected rows 25 and 27, between tree rows."; + } + } + const MapSet& maps = story_maps(); + const std::vector area = story_after_training_area(); + const auto in_grass = [&](const TilePos& pos){ + return maps.world().at(pos) == TileType::TALL_GRASS && std::find(area.begin(), area.end(), pos) != area.end(); + }; + // As walk_route() plans: the route costs, else the default costs. + // From the whole area the catch's save may stand in, and from the + // pocket behind the trees alone, where r252 saved. + const TilePos pocket = maps.to_world(MAP_ROUTE_202, {21, 29}); + const std::vector>> starts{ + {"the catch's save area", story_catch_save_area()}, + {"the pocket behind the trees", {pocket}}, + }; + std::optional> legs; + for (const auto& [name, from] : starts){ + legs = Pokemon::plan_robust_route(maps.world(), from, in_grass, route_plan_costs()); + if (!legs){ + legs = Pokemon::plan_robust_route(maps.world(), from, in_grass, Pokemon::RobustPlanCosts()); + } + if (!legs || legs->empty()){ + return "From " + name + " to the catch grass: no plan."; + } + for (const TilePos& pos : legs->back().after){ + if (!in_grass(pos)){ + return "From " + name + " to the catch grass: the walk may end on " + maps.describe(pos) + ", not in the grass."; + } + } + logger.log("From " + name + " to the catch grass: " + std::to_string(legs->size()) + " legs, ending in the grass."); + } + return true; + } +}; + +// 00.04's way to Sandgem's Pokemon Center ends below the Center's sign, +// walking north into it, then taps west along the doors' row to below the +// door: the row must be open there, the door straight north of where the +// taps end, and nothing else (a sign, the Mart's door) on the way. +class Test_SandgemCenterApproach : public UnitTest{ +public: + Test_SandgemCenterApproach() + : UnitTest("PokemonBDSP::AutoStory - Sandgem Town: below the Center's sign to below its door") + {} + virtual UnitTestResult run(Logger& logger, CancellableScope&) const override{ + const TileGrid& town = SandgemTown::grid(); + const TilePos sign = SandgemTown::POKEMON_CENTER_SIGN; + const TilePos door = SandgemTown::POKEMON_CENTER_DOOR; + if (town.at(sign) != TileType::SIGN || town.at(door) != TileType::DOOR || door.y != sign.y || door.x >= sign.x){ + return "The Center's sign " + Pokemon::to_string(sign) + " and door " + Pokemon::to_string(door) + + " are not a sign and a door west of it on one row."; + } + TilePos pos = sign.next(Direction::SOUTH); + for (int tap = 0; tap < sign.x - door.x; tap++){ + const std::optional next = town.step(pos, Direction::WEST); + if (!next){ + return "West from " + Pokemon::to_string(pos) + " is blocked."; + } + if (town.at(next->next(Direction::NORTH)) != TileType::BLOCKED && *next != door.next(Direction::SOUTH)){ + return "Above " + Pokemon::to_string(*next) + " is not the Center's wall."; + } + pos = *next; + } + if (!(pos == door.next(Direction::SOUTH))){ + return "The taps end at " + Pokemon::to_string(pos) + ", not below the door " + Pokemon::to_string(door) + "."; + } + logger.log("Sandgem: below the sign " + Pokemon::to_string(sign.next(Direction::SOUTH)) + ", " + + std::to_string(sign.x - door.x) + " taps west to below the door " + Pokemon::to_string(door) + "."); + return true; + } +}; + +// After training, 00.04 walks from wherever the training left us into +// Sandgem, to where the road stops above the Mart, with the default costs +// (heal_at_sandgem_center()): from the whole area and from each of its +// tiles alone, a plan must exist and end there. +class Test_TrainingToSandgem : public UnitTest{ +public: + Test_TrainingToSandgem() + : UnitTest("PokemonBDSP::AutoStory - Route 202: from every tile of the training area into Sandgem") + {} + virtual UnitTestResult run(Logger& logger, CancellableScope&) const override{ + const MapSet& maps = story_maps(); + const TilePos entry = maps.to_world(MAP_SANDGEM_TOWN, SandgemTown::ROUTE_202_ENTRY_STOP); + const std::vector area = story_after_training_area(); + std::vector> starts{area}; + for (const TilePos& pos : area){ + starts.push_back({pos}); + } + for (const std::vector& from : starts){ + const auto legs = Pokemon::plan_robust_route(maps.world(), from, + [&](const TilePos& pos){ return pos == entry; }, Pokemon::RobustPlanCosts()); + const std::string name = from.size() == 1 ? maps.describe(from[0]) : "the whole training area"; + if (!legs || legs->empty()){ + return "From " + name + " into Sandgem: no plan."; + } + if (legs->back().after.size() != 1 || !(legs->back().after[0] == entry)){ + return "From " + name + " into Sandgem: the plan does not end on " + maps.describe(entry) + "."; + } + logger.log("From " + name + " into Sandgem: " + std::to_string(legs->size()) + " legs."); + } + return true; + } +}; + +} + + +void add_tests_AutoStory_MapGrids(UnitTestDatabase& database){ + database.add(); + database.add(); + database.add(); +} + + +} +} +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.h new file mode 100644 index 0000000000..a7f7250b2b --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.h @@ -0,0 +1,28 @@ +/* BDSP AutoStory Map Grid Tests + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#ifndef PokemonAutomation_PokemonBDSP_AutoStory_MapGrid_Tests_H +#define PokemonAutomation_PokemonBDSP_AutoStory_MapGrid_Tests_H + +#include "Common/Cpp/TestRunners/UnitTest.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonBDSP{ + + + +// Offline checks of the decomp grids against what the console showed: +// Route 202's catch patch between tree rows and the walks in and out of +// it, and Sandgem's Pokemon Center door, its sign and the row below them. +void add_tests_AutoStory_MapGrids(UnitTestDatabase& database); + + + +} +} +} +#endif diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.cpp index b81c722979..b3974652cd 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_SandgemCenterEvents.cpp @@ -65,7 +65,7 @@ using Pokemon::pose_known; const char* const ROUTE202_TO_SANDGEM_CENTER_NAME = "Route 202 to Sandgem's Pokemon Center (events)"; TilePos sandgem_entry_stop(){ - return story_maps().to_world(MAP_SANDGEM_TOWN, {29, 5}); + return story_maps().to_world(MAP_SANDGEM_TOWN, SandgemTown::ROUTE_202_ENTRY_STOP); } TilePos below_sandgem_center_sign(){ diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index b59547da29..63d40888ac 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -1570,6 +1570,8 @@ file(GLOB LIBRARY_SOURCES Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.h Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.cpp Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_StoryMaps.h + Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp + Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.h Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.h Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Location.cpp From 04b00fa8cc1017adb537d48811d9f7e419cb5c02 Mon Sep 17 00:00:00 2001 From: dayfine Date: Sun, 1 Nov 2026 09:32:21 -0800 Subject: [PATCH 06/10] BDSP maps: the grids are JSON files in the shared schema; the C++ tables go Each of the 15 story maps on this branch is now a JSON file in the shared map schema (Pokemon_MapData.h), PokemonBDSP/Maps/.json in Packages' Resources, converted once from the C++ tables (cell for cell; '"' grass is '~', a standing 'N' is an npc object on open ground). The tables are removed; each X::grid() returns story_grid("X"), which reads the map through the shared parse_map() and turns it into a TileGrid (PokemonBDSP_AutoStory_MapGrids): the copy the program installs from Packages, or else the built-in copy. The built-in copy, for the unit tests and CI without Packages, is PokemonBDSP_AutoStory_Maps_TestData*.cpp, generated by devtools/maps/bdsp_maps.py --json-dir ... --cpp ... (--check to verify), one raw literal per map, byte for byte the JSON file, split into parts under the 1000-line file limit. Named tiles stay C++ constants. Tests: every built-in map loads, and the JSON glyphs map to BDSP tiles (water and wanderers have none). The route and grid tests now plan on the JSON-loaded grids. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../PokemonBDSP_AutoStory_FloaromaTown.cpp | 38 +- .../PokemonBDSP_AutoStory_JubilifeCity.cpp | 90 +- .../Data/PokemonBDSP_AutoStory_LakeVerity.cpp | 38 +- .../Data/PokemonBDSP_AutoStory_MapGrids.cpp | 135 +++ .../Data/PokemonBDSP_AutoStory_MapGrids.h | 53 ++ .../PokemonBDSP_AutoStory_Maps_TestData.cpp | 58 ++ .../PokemonBDSP_AutoStory_Maps_TestData.h | 32 + .../PokemonBDSP_AutoStory_Maps_TestData_1.cpp | 850 ++++++++++++++++++ .../PokemonBDSP_AutoStory_Maps_TestData_2.cpp | 258 ++++++ .../PokemonBDSP_AutoStory_OreburghCity.cpp | 70 +- .../PokemonBDSP_AutoStory_OreburghGate.cpp | 38 +- .../PokemonBDSP_AutoStory_OreburghMine.cpp | 39 +- .../PokemonBDSP_AutoStory_RavagedPath.cpp | 60 +- .../Data/PokemonBDSP_AutoStory_Route201.cpp | 32 +- .../Data/PokemonBDSP_AutoStory_Route202.cpp | 39 +- .../Data/PokemonBDSP_AutoStory_Route203.cpp | 31 +- .../Data/PokemonBDSP_AutoStory_Route204.cpp | 38 +- .../PokemonBDSP_AutoStory_Route204South.cpp | 37 +- .../PokemonBDSP_AutoStory_SandgemTown.cpp | 39 +- .../PokemonBDSP_AutoStory_TwinleafTown.cpp | 38 +- .../PokemonBDSP_AutoStory_VerityLakefront.cpp | 38 +- .../PokemonBDSP_AutoStory_MapGrid_Tests.cpp | 86 ++ SerialPrograms/cmake/SourceFiles.cmake | 6 + devtools/maps/bdsp_maps.py | 137 +++ 24 files changed, 1645 insertions(+), 635 deletions(-) create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp create mode 100644 devtools/maps/bdsp_maps.py diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_FloaromaTown.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_FloaromaTown.cpp index ea0b44d151..c91f67d5ea 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_FloaromaTown.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_FloaromaTown.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_FloaromaTown.h" namespace PokemonAutomation{ @@ -66,42 +67,7 @@ using namespace Pokemon; // has), and it has a Beauty at (10, 19) looking south instead of the man at // (11, 26). const TileGrid& grid(){ - static const TileGrid grid({ - // 0 1 2 3 - R"(######........................##)", // 0 - R"(##NN##........................##)", // 1 - R"(..............................##)", // 2 - R"(..............................##)", // 3 - R"(..............................##)", // 4 - R"(..............................##)", // 5 - R"(..............................##)", // 6 - R"(..................#####.......##)", // 7 - R"(..................#####.......##)", // 8 - R"(..................#####.......##)", // 9 - R"(......N...........#####.......##)", // 10 - R"(..........####...S##.##N......##)", // 11 - R"(..........####................##)", // 12 - R"(..........####................##)", // 13 - R"(..........#D##................##)", // 14 - R"(.......................####..S##)", // 15 - R"(.......................####...##)", // 16 - R"(.......................#D##...##)", // 17 - R"(..............................##)", // 18 - R"(.............S..................)", // 19 - R"(................................)", // 20 - R"(...................N............)", // 21 - R"(................................)", // 22 - R"(..NN..........#####....####...##)", // 23 - R"(..............#####....####...##)", // 24 - R"(..............#####....####...##)", // 25 - R"(...........N..##D##....#D##...##)", // 26 - R"(..............................##)", // 27 - R"(..............................##)", // 28 - R"(..............................##)", // 29 - R"(########.#...###################)", // 30 - R"(########.#...###################)", // 31 - }); - return grid; + return story_grid("FloaromaTown"); } const TilePos ROUTE_204_ARRIVAL{11, 29}; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp index c0ee4dc8e6..16089d130c 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp @@ -6,6 +6,7 @@ #include #include +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_JubilifeCity.h" namespace PokemonAutomation{ @@ -58,95 +59,8 @@ using namespace Pokemon; // one along row 21 (45..47), a Twin around (33,18), a School Kid on column // 51 (rows 33..35), a Pokefan around (41,30). Rowan and the grunts at the // north exit, the Collectors and Dawn are hidden by story flags. -namespace{ -// Rows 0..31: the matrix's cell row 4 (world z 736..767), the north half. -std::vector north_half(){ - // 0 1 2 3 4 5 6 - // 0123456789012345678901234567890123456789012345678901234567890123 - return { - R"(##########################################..............########)", // 0 - R"(##########################################..............########)", // 1 - R"(############################################.....###############)", // 2 - R"(############################################......##############)", // 3 - R"(############################################......##############)", // 4 - R"(############################################......##############)", // 5 - R"(############################################......##############)", // 6 - R"(#############################################....###############)", // 7 - R"(############################....#########.......S.##############)", // 8 - R"(############################....#########.........##############)", // 9 - R"(#########..#########..######....#########.........##############)", // 10 - R"(#########..#########..######....#########.........##############)", // 11 - R"(#########..#########..######....#########.........##############)", // 12 - R"(#########..#########..######....#########.........##############)", // 13 - R"(#########..#########..######....#########.........##############)", // 14 - R"(#########..##D###D##..######....####D####.........##############)", // 15 - R"(#########.............######........N......#.....#######....####)", // 16 - R"(#########.............######......................######....####)", // 17 - R"(..#######......N......######......................######....####)", // 18 - R"(..###########S......########...........S.........S##D###....####)", // 19 - R"(..#.S.#.......................#..........................#.S####)", // 20 - R"(................................................................)", // 21 - R"(D...............................................................)", // 22 - R"(D...............................................................)", // 23 - R"(................................................................)", // 24 - R"(..#...#.......................#.....N....................#..####)", // 25 - R"(..############.............####......####...................####)", // 26 - R"(..############.............####......####................#######)", // 27 - R"(##############.################...##.####..#.....######..#######)", // 28 - R"(##############.################...##.####.........#####..#######)", // 29 - R"(##############.################...................#D############)", // 30 - R"(################################.........................#######)", // 31 - }; -} -// Rows 32..63: cell row 5 (world z 768..799), the south half. -std::vector south_half(){ - // 0 1 2 3 4 5 6 - // 0123456789012345678901234567890123456789012345678901234567890123 - return { - R"(################################.........................##D####)", // 32 - R"(################################.......................N.#######)", // 33 - R"(################################.........................#######)", // 34 - R"(###############............#####..............N..........#######)", // 35 - R"(###############............#####......#####..............#######)", // 36 - R"(###############..#########.#####.##########.......######.#######)", // 37 - R"(###############..#########.#####.##########.......######.#######)", // 38 - R"(###############..#########.#####.###########.....#######.#######)", // 39 - R"(##################################..S.##D##.......##D###########)", // 40 - R"(###############..#########.#####.........................#######)", // 41 - R"(##############...####D####N.###..........................#######)", // 42 - R"(##############...........................................#######)", // 43 - R"(##############.....S........................N............#######)", // 44 - R"(##############...........................................#######)", // 45 - R"(##############.............#########................N.N..#######)", // 46 - R"(###############............#########.#####...............#######)", // 47 - R"(###############............#########.#####...............#######)", // 48 - R"(###############.####..####.###############...............#######)", // 49 - R"(###############.####..####.###############...............#######)", // 50 - R"(###############.####..####.###############...........###########)", // 51 - R"(############D##.####..####.############D##...........###########)", // 52 - R"(##########.................#########.......#.....#...########.##)", // 53 - R"(##########.................#########.................########.##)", // 54 - R"(##########.......N....#..#.#########......S..........########.##)", // 55 - R"(##########............#..#.#########.................########.##)", // 56 - R"(##########.................#########.................########.##)", // 57 - R"(###########################################.......##############)", // 58 - R"(###########################################.......##############)", // 59 - R"(########################################.##.......##############)", // 60 - R"(########################################.####...################)", // 61 - R"(########################################..........##############)", // 62 - R"(########################################..........##############)", // 63 - }; -} -} - const TileGrid& grid(){ - static const TileGrid grid = []{ - std::vector rows = north_half(); - const std::vector south = south_half(); - rows.insert(rows.end(), south.begin(), south.end()); - return TileGrid(rows); - }(); - return grid; + return story_grid("JubilifeCity"); } // Checked on the console (2026-10-30, CFR "walk"): 00.05's save stands diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.cpp index f7172ce4bd..3198d18e18 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_LakeVerity.h" namespace PokemonAutomation{ @@ -56,42 +57,7 @@ using namespace Pokemon; // separate map (MAP_LAKE_VERITY_GALACTIC), reached from the same Lakefront // warp tiles. const TileGrid& grid(){ - static const TileGrid grid({ - // 0 1 2 3 - R"(################################)", // 0 - R"(################################)", // 1 - R"(################################)", // 2 - R"(################################)", // 3 - R"(......############....##########)", // 4 - R"(......############....##########)", // 5 - R"(.......###########......########)", // 6 - R"(.......###########......########)", // 7 - R"(.......###########".....########)", // 8 - R"(.......###########""....########)", // 9 - R"(################""""....########)", // 10 - R"(################NN""....########)", // 11 - R"(##############."""""..##########)", // 12 - R"(##############.""""...##########)", // 13 - R"(############..."""..############)", // 14 - R"(############........############)", // 15 - R"(##########..........############)", // 16 - R"(##########..........############)", // 17 - R"(############......##############)", // 18 - R"(############....N.##############)", // 19 - R"(############......##############)", // 20 - R"(############......##############)", // 21 - R"(##############..################)", // 22 - R"(################################)", // 23 - R"(################################)", // 24 - R"(################################)", // 25 - R"(################################)", // 26 - R"(################################)", // 27 - R"(################################)", // 28 - R"(################################)", // 29 - R"(################################)", // 30 - R"(################################)", // 31 - }); - return grid; + return story_grid("LakeVerity"); } } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp new file mode 100644 index 0000000000..26f50c3fbd --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp @@ -0,0 +1,135 @@ +/* BDSP AutoStory - Map grids + * + * From: https://github.com/PokemonAutomation/ + * + */ + +#include +#include +#include "Common/Cpp/Exceptions.h" +#include "Common/Cpp/Json/JsonValue.h" +#include "PokemonBDSP_AutoStory_Maps_TestData.h" +#include "PokemonBDSP_AutoStory_MapGrids.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonBDSP{ + +using Pokemon::MapData; +using Pokemon::TileGrid; +using Pokemon::TileKind; +using Pokemon::TilePos; +using Pokemon::TileType; + + +namespace{ + +std::optional tile_type_of(TileKind kind){ + switch (kind){ + case TileKind::WALL: return TileType::BLOCKED; + case TileKind::OPEN: return TileType::WALKABLE; + case TileKind::TALL_GRASS: return TileType::TALL_GRASS; + case TileKind::LEDGE_SOUTH: return TileType::LEDGE; + case TileKind::DOOR: return TileType::DOOR; + case TileKind::SIGN: return TileType::SIGN; + default: return std::nullopt; + } +} + +} + +TileGrid tile_grid_from_map(const MapData& map){ + std::vector rows; + for (int y = 0; y < map.tiles.height; y++){ + std::string row; + for (int x = 0; x < map.tiles.width; x++){ + const TileKind kind = map.tiles.at(TilePos{x, y}); + const std::optional type = tile_type_of(kind); + if (!type){ + throw ParseException(std::format( + "{}: glyph '{}' at {} has no BDSP tile.", map.name, Pokemon::glyph_of(kind), Pokemon::to_string(TilePos{x, y}) + )); + } + row += Pokemon::tile_char(*type); + } + rows.push_back(std::move(row)); + } + for (const Pokemon::MapObject& object : map.objects){ + if (object.kind != Pokemon::ObjectKind::NPC || object.wander){ + throw ParseException(std::format("{}: object {} is not a person standing still.", map.name, object.name)); + } + rows[object.y][object.x] = Pokemon::tile_char(TileType::NPC); + } + return TileGrid(rows); +} + +std::optional grid_difference(const TileGrid& here, const TileGrid& there){ + if (here.width() != there.width() || here.height() != there.height()){ + return std::format("{} x {} here, {} x {} there", here.width(), here.height(), there.width(), there.height()); + } + for (int y = 0; y < here.height(); y++){ + for (int x = 0; x < here.width(); x++){ + const TilePos pos{x, y}; + if (here.at(pos) != there.at(pos)){ + return std::format( + "{}: '{}' here, '{}' there", + Pokemon::to_string(pos), Pokemon::tile_char(here.at(pos)), Pokemon::tile_char(there.at(pos)) + ); + } + } + } + return std::nullopt; +} + + +namespace{ + +std::map& installed_grids(){ + static std::map grids; + return grids; +} + +const std::map& built_in_grids(){ + static const std::map grids = []{ + std::map parsed; + for (const auto& [name, json] : test_map_json()){ + const MapData map = Pokemon::parse_map(parse_json(json), name + ".json (built in)"); + if (map.name != name){ + throw ParseException(std::format("{}.json (built in): name is \"{}\".", name, map.name)); + } + parsed.emplace(name, tile_grid_from_map(map)); + } + return parsed; + }(); + return grids; +} + +} + +const TileGrid& built_in_grid(const std::string& name){ + const std::map& grids = built_in_grids(); + if (auto iter = grids.find(name); iter != grids.end()){ + return iter->second; + } + throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "No BDSP story map named \"" + name + "\"."); +} + +const TileGrid& story_grid(const std::string& name){ + const std::map& grids = installed_grids(); + if (auto iter = grids.find(name); iter != grids.end()){ + return iter->second; + } + return built_in_grid(name); +} + +void install_story_grids(std::map grids){ + if (installed_grids().empty()){ + installed_grids() = std::move(grids); + } +} + + + +} +} +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h new file mode 100644 index 0000000000..7bb7683081 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h @@ -0,0 +1,53 @@ +/* BDSP AutoStory - Map grids + * + * From: https://github.com/PokemonAutomation/ + * + * The story's maps are JSON files in the shared map schema + * (Pokemon_MapData.h), read with the shared loader and turned into the tile + * grids the planner walks. Each map's X::grid() returns story_grid("X"). + * + */ + +#ifndef PokemonAutomation_PokemonBDSP_AutoStory_MapGrids_H +#define PokemonAutomation_PokemonBDSP_AutoStory_MapGrids_H + +#include +#include +#include +#include "Pokemon/Navigation/Pokemon_MapData.h" +#include "Pokemon/Navigation/Pokemon_TileGrid.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonBDSP{ + + +// A map's tiles as a tile grid: walls, open ground, tall grass, south +// ledges, doors and signs; a standing person ("npc" object) is an NPC tile. +// Throws ParseException, naming the map, for what BDSP's grids have no +// tile for (water, ledges other than south, items, wanderers). +Pokemon::TileGrid tile_grid_from_map(const Pokemon::MapData& map); + +// "(x, y): 'N' here, '.' there", or nothing when the grids are the same +// size and equal cell for cell. +std::optional grid_difference(const Pokemon::TileGrid& here, const Pokemon::TileGrid& there); + +// The built-in copy of the map `name` (test_map_json()), parsed once. +// Throws InternalProgramError for a name it does not have. +const Pokemon::TileGrid& built_in_grid(const std::string& name); + +// The grid of the map `name`: the one installed from Packages' files by +// install_story_grids(), which the program does when it starts, else the +// built-in copy (the unit tests, which have no Packages). +const Pokemon::TileGrid& story_grid(const std::string& name); + +// Makes story_grid() hand out `grids` from then on. Once only: callers keep +// copies of what they were handed first. +void install_story_grids(std::map grids); + + + +} +} +} +#endif diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp new file mode 100644 index 0000000000..0d836d47c5 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp @@ -0,0 +1,58 @@ +/* BDSP AutoStory - Maps test data + * + * From: https://github.com/PokemonAutomation/ + * + * generated by devtools/maps/bdsp_maps.py --json-dir Packages/Resources/PokemonBDSP/Maps --cpp SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp, do not edit + * + */ + +#include "PokemonBDSP_AutoStory_Maps_TestData.h" + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonBDSP{ + + +extern const char* const TEST_MAP_JSON_TwinleafTown; +extern const char* const TEST_MAP_JSON_VerityLakefront; +extern const char* const TEST_MAP_JSON_LakeVerity; +extern const char* const TEST_MAP_JSON_Route201; +extern const char* const TEST_MAP_JSON_SandgemTown; +extern const char* const TEST_MAP_JSON_Route202; +extern const char* const TEST_MAP_JSON_JubilifeCity; +extern const char* const TEST_MAP_JSON_Route203; +extern const char* const TEST_MAP_JSON_OreburghGate; +extern const char* const TEST_MAP_JSON_OreburghCity; +extern const char* const TEST_MAP_JSON_OreburghMine; +extern const char* const TEST_MAP_JSON_Route204South; +extern const char* const TEST_MAP_JSON_RavagedPath; +extern const char* const TEST_MAP_JSON_Route204North; +extern const char* const TEST_MAP_JSON_FloaromaTown; + + +const std::vector>& test_map_json(){ + static const std::vector> maps{ + {"TwinleafTown", TEST_MAP_JSON_TwinleafTown}, + {"VerityLakefront", TEST_MAP_JSON_VerityLakefront}, + {"LakeVerity", TEST_MAP_JSON_LakeVerity}, + {"Route201", TEST_MAP_JSON_Route201}, + {"SandgemTown", TEST_MAP_JSON_SandgemTown}, + {"Route202", TEST_MAP_JSON_Route202}, + {"JubilifeCity", TEST_MAP_JSON_JubilifeCity}, + {"Route203", TEST_MAP_JSON_Route203}, + {"OreburghGate", TEST_MAP_JSON_OreburghGate}, + {"OreburghCity", TEST_MAP_JSON_OreburghCity}, + {"OreburghMine", TEST_MAP_JSON_OreburghMine}, + {"Route204South", TEST_MAP_JSON_Route204South}, + {"RavagedPath", TEST_MAP_JSON_RavagedPath}, + {"Route204North", TEST_MAP_JSON_Route204North}, + {"FloaromaTown", TEST_MAP_JSON_FloaromaTown}, + }; + return maps; +} + + + +} +} +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h new file mode 100644 index 0000000000..7370120994 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h @@ -0,0 +1,32 @@ +/* BDSP AutoStory - Maps test data + * + * From: https://github.com/PokemonAutomation/ + * + * The story's maps as their JSON text, built in so the unit tests (and the + * map accessors, before the program has loaded Packages' copies) read the + * maps without Packages. The .cpp is generated by devtools/maps/bdsp_maps.py + * from the JSON files in Packages' Resources/PokemonBDSP/Maps. + * + */ + +#ifndef PokemonAutomation_PokemonBDSP_AutoStory_Maps_TestData_H +#define PokemonAutomation_PokemonBDSP_AutoStory_Maps_TestData_H + +#include +#include +#include + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonBDSP{ + + +// Each map's name (its file name without ".json") and its JSON text. +const std::vector>& test_map_json(); + + + +} +} +} +#endif diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp new file mode 100644 index 0000000000..41329cf6ec --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp @@ -0,0 +1,850 @@ +/* BDSP AutoStory - Maps test data + * + * From: https://github.com/PokemonAutomation/ + * + * generated by devtools/maps/bdsp_maps.py --json-dir Packages/Resources/PokemonBDSP/Maps --cpp SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp, do not edit + * + */ + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonBDSP{ + + +extern const char* const TEST_MAP_JSON_TwinleafTown = +R"json({ + "name": "TwinleafTown", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_TwinleafTown.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "############........############", + "#######....#........#....#######", + "#######....#........#....#######", + "############........############", + "######....................######", + "######....................######", + "######....................######", + "######..#####.............######", + "######..#####......####...######", + "######..#####......####...######", + "######..######.....####...######", + "######..#D###S.....#D##...######", + "######....................######", + "######....................######", + "######..........S.........######", + "######....................######", + "######....................######", + "######.............#####..######", + "######...####......#####..######", + "######...####......#####..######", + "######...####.....######..######", + "######...#D##.....S#D###..######", + "######....................######", + "######....................######", + "######....................######", + "######....................######", + "######....................######", + "######......########......######", + "################################", + "################################", + "################################", + "################################" + ], + "objects": [ + { + "name": "npc_12_5", + "kind": "npc", + "x": 12, + "y": 5 + }, + { + "name": "npc_12_25", + "kind": "npc", + "x": 12, + "y": 25 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_VerityLakefront = +R"json({ + "name": "VerityLakefront", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "....############################", + "....############################", + "....############################", + "....############################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################..##############", + "################..##############", + "################..##############", + "##############.S....#...........", + "##############......#.....####..", + "##############......#.....####..", + "##############......#...........", + "##############......#...........", + "##############......#vvvvv##vvvv", + "################..........##....", + "################................", + "##################..............", + "##################..............", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################" + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_LakeVerity = +R"json({ + "name": "LakeVerity", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################", + "################################", + "################################", + "################################", + "......############....##########", + "......############....##########", + ".......###########......########", + ".......###########......########", + ".......###########~.....########", + ".......###########~~....########", + "################~~~~....########", + "################..~~....########", + "##############.~~~~~..##########", + "##############.~~~~...##########", + "############...~~~..############", + "############........############", + "##########..........############", + "##########..........############", + "############......##############", + "############......##############", + "############......##############", + "############......##############", + "##############..################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################" + ], + "objects": [ + { + "name": "npc_16_11", + "kind": "npc", + "x": 16, + "y": 11 + }, + { + "name": "npc_17_11", + "kind": "npc", + "x": 17, + "y": 11 + }, + { + "name": "npc_16_19", + "kind": "npc", + "x": 16, + "y": 19 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_Route201 = +R"json({ + "name": "Route201", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################################################", + "################################################################", + "################################################################", + "##########################################~~~~~~~~~~~...........", + "##########################################~~~~~~~~~~~..S........", + "##########################################~~~~~~~~~~~...........", + "##########################################~~~~~~~~~~~...........", + "....####..........######..##....##..####..~~~~~~~~~##...........", + "....####..........######..##....##..####..~~~~~~~~~##...........", + "##........####............................~~~~~~~~~##vvvvv######", + "##........####............................~~~~~~~~~##.....######", + "..........................................~~~~~~~~~##.....######", + "vvvv####vvvvvvvvvvvvvvvvvvvvvvvv........S.~~~~~~~~~##.....######", + "....####............~~~~~~~~~~............................######", + "....................~~~~~~~~~~............................######", + "....................~~~~~~~~~~............................######", + "....................~~~~~~~~~~............................######", + "########.....S......##########............................######", + "########............##########............~~~~~~~~~~~~~~~~######", + "##############....############################~~~~~~~~~~~~######", + "##############....############################~~~~~~~~~~~~######", + "##############....##############################################", + "##############....##############################################", + "##############....##############################################", + "##############....##############################################" + ], + "objects": [ + { + "name": "npc_57_8", + "kind": "npc", + "x": 57, + "y": 8 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_SandgemTown = +R"json({ + "name": "SandgemTown", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "########################......####", + "########################......####", + "####################..........####", + "####################..........####", + "####################..........####", + "####################..........####", + "####################......########", + "####################......########", + "####################......########", + "####################......########", + "########D##....##D##S....S#D######", + ".....S........................####", + "..............................####", + "..............................####", + "..............................####", + "..............................####", + "######........................####", + "######........................####", + "######.........#####..........####", + "##########.....#####..........####", + "##########.....#####..........####", + "##########.....#####..........####", + "#######D##....S#D###..S.......####", + "######........................####", + "######........................####", + "######........................####", + "######....................########", + "####################......########", + "####################......########", + "####################......########", + "####################......########", + "####################......########" + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_Route202 = +R"json({ + "name": "Route202", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "###########........#################", + "###########........#################", + "###########........#################", + "###########........#################", + "###~~~~~~........S..~~~~~......#####", + "###~~~~~~...........~~~~~......#####", + "####~~~~~...........~~~~~......#####", + "###~~~~~~...........~~~~~......#####", + "###~~~~~~...........~~~~~......#####", + "###~~~~~~.....########.........#####", + "#########vvvvv########vvvvvv...~~###", + "#########.....########~~~~~~~~~~~###", + "#######.......########~~~~~~~~~~~###", + "#######...........####~~~~~~~~~~~###", + "###...............####~~~~~~~~~~~###", + "###...............####~~~~~~~~~~~###", + "###............S..####~~~~~~~~~~~###", + "###...............####~~~~~~~~~~~###", + "###...............####..~~~~~~~~~###", + "###~~~~##...............~~~~~~~~~###", + "###~~~~##.................~~~~~~~###", + "###~~~~##....................~~~~###", + "###~~~~##......................#####", + "###~~~~##vvvvv########vvvvvvvvv#####", + "###~~~~##.....########.........#####", + "###~~~~~~......~~~~~~...S......#####", + "###~~~~~~......~~~~~~..........#####", + "###~~~~~~......~~~~~~..........#####", + "###~~~~~~......######..........#####", + "###~~~~~~......######..........#####", + "######################.........#####", + "#####################..........#####" + ], + "objects": [ + { + "name": "npc_26_4", + "kind": "npc", + "x": 26, + "y": 4 + }, + { + "name": "npc_7_13", + "kind": "npc", + "x": 7, + "y": 13 + }, + { + "name": "npc_22_18", + "kind": "npc", + "x": 22, + "y": 18 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_JubilifeCity = +R"json({ + "name": "JubilifeCity", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "##########################################..............########", + "##########################################..............########", + "############################################.....###############", + "############################################......##############", + "############################################......##############", + "############################################......##############", + "############################################......##############", + "#############################################....###############", + "############################....#########.......S.##############", + "############################....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..##D###D##..######....####D####.........##############", + "#########.............######...............#.....#######....####", + "#########.............######......................######....####", + "..#######.............######......................######....####", + "..###########S......########...........S.........S##D###....####", + "..#.S.#.......................#..........................#.S####", + "................................................................", + "D...............................................................", + "D...............................................................", + "................................................................", + "..#...#.......................#..........................#..####", + "..############.............####......####...................####", + "..############.............####......####................#######", + "##############.################...##.####..#.....######..#######", + "##############.################...##.####.........#####..#######", + "##############.################...................#D############", + "################################.........................#######", + "################################.........................##D####", + "################################.........................#######", + "################################.........................#######", + "###############............#####.........................#######", + "###############............#####......#####..............#######", + "###############..#########.#####.##########.......######.#######", + "###############..#########.#####.##########.......######.#######", + "###############..#########.#####.###########.....#######.#######", + "##################################..S.##D##.......##D###########", + "###############..#########.#####.........................#######", + "##############...####D####..###..........................#######", + "##############...........................................#######", + "##############.....S.....................................#######", + "##############...........................................#######", + "##############.............#########.....................#######", + "###############............#########.#####...............#######", + "###############............#########.#####...............#######", + "###############.####..####.###############...............#######", + "###############.####..####.###############...............#######", + "###############.####..####.###############...........###########", + "############D##.####..####.############D##...........###########", + "##########.................#########.......#.....#...########.##", + "##########.................#########.................########.##", + "##########............#..#.#########......S..........########.##", + "##########............#..#.#########.................########.##", + "##########.................#########.................########.##", + "###########################################.......##############", + "###########################################.......##############", + "########################################.##.......##############", + "########################################.####...################", + "########################################..........##############", + "########################################..........##############" + ], + "objects": [ + { + "name": "npc_36_16", + "kind": "npc", + "x": 36, + "y": 16 + }, + { + "name": "npc_15_18", + "kind": "npc", + "x": 15, + "y": 18 + }, + { + "name": "npc_36_25", + "kind": "npc", + "x": 36, + "y": 25 + }, + { + "name": "npc_55_33", + "kind": "npc", + "x": 55, + "y": 33 + }, + { + "name": "npc_46_35", + "kind": "npc", + "x": 46, + "y": 35 + }, + { + "name": "npc_26_42", + "kind": "npc", + "x": 26, + "y": 42 + }, + { + "name": "npc_44_44", + "kind": "npc", + "x": 44, + "y": 44 + }, + { + "name": "npc_52_46", + "kind": "npc", + "x": 52, + "y": 46 + }, + { + "name": "npc_54_46", + "kind": "npc", + "x": 54, + "y": 46 + }, + { + "name": "npc_17_55", + "kind": "npc", + "x": 17, + "y": 55 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_Route203 = +R"json({ + "name": "Route203", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "#############################################################", + "#############################################################", + "#############################################################", + "#############################################################", + "#####..............###########..~~~~#########################", + "#####..............###########.#.~~~..~~~~~~~~~~~~~~#########", + "#####..................#######........~~~~~~~~~~~~~.....#####", + "#####..................###############~~~~~~~~~~~....S..#####", + "#####~~~~##...####.....#......########~~~~~~~~~~~.......#####", + "#####~~~~##...####.....#......########~~~~~~~~~~~.......D####", + "#####~~~~##...####..#..#..S...########~~~~~~~~~~~.......#####", + "#####~~~~##...####.....#......########~~~~~~~~~~~.......#####", + "#####~~~~##...####.....#....~~~~~~~~##~~~~~~~~~S...~~~..#####", + "#####~~~~##...####vvvvv#...~~...~.~~##~~~~~~~~~....~~~..#####", + "#####~~................#....######~~##.....~~....##~~~..#####", + "#####..................#....######~~##vvvvvvvvvvv##~~~..#####", + "#####....S.............#....~~~..~~~.............~~~~~..#####", + "...........................~~~~...~~.............~~~~~..#####", + "...........................~~.....~~.............~~~~~..#####", + "..........................~~~~.....~##..........~~~~~~..#####", + "..........................~~~~~.~~~~#########################", + "#############################################################", + "#############################################################", + "#############################################################" + ], + "objects": [ + { + "name": "npc_49_8", + "kind": "npc", + "x": 49, + "y": 8 + }, + { + "name": "npc_13_10", + "kind": "npc", + "x": 13, + "y": 10 + }, + { + "name": "npc_31_16", + "kind": "npc", + "x": 31, + "y": 16 + }, + { + "name": "npc_43_17", + "kind": "npc", + "x": 43, + "y": 17 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_OreburghGate = +R"json({ + "name": "OreburghGate", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghGate.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################", + "################################", + "################################", + "################################", + "############..#......###########", + "###########..........###########", + "###########........#.###########", + "###########..###################", + "###########..###################", + "###########..###################", + "###########.####################", + "############.###################", + "###########.####################", + "###########..###################", + "###########..###################", + "###########..###################", + "###########..###################", + "###########..###################", + "############.###################", + "###########..###################", + "#####...##...##########...#.####", + "####....##...##########.....####", + "###D........................D###", + "####...#....................####", + "###########..............#.#####", + "############.......#############", + "###########..#.#...#############", + "################################", + "################################", + "################################", + "################################", + "################################" + ], + "objects": [ + { + "name": "npc_7_20", + "kind": "npc", + "x": 7, + "y": 20 + }, + { + "name": "npc_24_21", + "kind": "npc", + "x": 24, + "y": 21 + }, + { + "name": "npc_17_25", + "kind": "npc", + "x": 17, + "y": 25 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_OreburghCity = +R"json({ + "name": "OreburghCity", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghCity.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "#########################################......#################", + "#########################################...S..#################", + "#########################################......#################", + "#########################################......#################", + "#########################################...####################", + "#########################################...####################", + "#########################################....###################", + "############.#####.######.#.############.....###################", + "###########..#####..#####...############.....###################", + "#########....#####..#####...############.....###################", + "##.....########D######D######D##########.....###################", + "##..S..###..........................####........#.#...##########", + "##..................................####.....S........##########", + "#D..................................####..............##########", + "##..................................####..............####.#####", + "##..................................####..............####.#####", + "##.....###.............#######......#D##..............####.#####", + "##.....##.......####...#######...............#####....####.#####", + "#########.......####.#.#######..............######......#.######", + "#########.......####...#######..............######.....#########", + "#########.......#D####S###D###...............##D##.....#########", + "#########........................................#.....#########", + "#########........................................#.....#########", + "#########........................................#....##########", + "#########........................................#....##########", + "#########........................................#....##########", + "##########.#.#..########.........................#....##########", + "########################.######.############.....#....##########", + "########################.######.###........#.....#....##D#######", + "########################.######.###.#..#...#.....#.........#####", + "############################################.....###############", + "############################################.....###############", + "############################################.....###############", + "############################################.....###############", + "############################################.....###############", + "############################################.....###############", + "############################################.....##D############", + "###################################.########.....#...........###", + "###################################.....####.....#...........###", + "###################################.....####.....#...........###", + "###################################....#####.....#...........###", + "#####################################..#.........#...........###", + "#####################################..#..#.#....#....#.#....###", + "#####################################..#..#.#....#....#.#....###", + "###################################....#.....................###", + "###################################....#.....................###", + "###################################....#.....................###", + "###################################....#.....................###", + "###################################....#.....................###", + "###################################..###..#.#................###", + "###################################..###..#.#...#.#########.####", + "###################################..###........#.#########.####", + "###################################....#..........#####.....####", + "###################################...............#####.....####", + "#####################################.............##.........###", + "#####################################..####.#.....###.....######", + "#####################################..####.#S....###.....######", + "###########################################.......####.......###", + "############################################.....#####.......###", + "############################################.....#####.....#####", + "######################################################..#..#####", + "################################################################", + "################################################################", + "################################################################" + ], + "objects": [ + { + "name": "npc_10_16", + "kind": "npc", + "x": 10, + "y": 16 + }, + { + "name": "npc_11_25", + "kind": "npc", + "x": 11, + "y": 25 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_OreburghMine = +R"json({ + "name": "OreburghMine", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################", + "###############D################", + "#############.....##############", + "#############.....##############", + "#############.....##############", + "#############.....##############", + "#############.....##############", + "#############...################", + "#############...################", + "#############.....##############", + "#############..#..##############", + "###############...##############", + "#############...################", + "#############.....##############", + "###############...##############", + "########...####..............###", + "######.....##.................##", + "##.#..........................##", + "##....####################....##", + "##vvv##..................#....##", + "##....#..................#....##", + "##.##.#..................#....##", + "##..###..................###..##", + "##..###..................###..##", + "##....#..................##...##", + "##.##.#..................#....##", + "####..####################....##", + "####..####################....##", + "#####............#.#........####", + "######......................####", + "################################", + "################################" + ], + "objects": [ + { + "name": "npc_20_15", + "kind": "npc", + "x": 20, + "y": 15 + }, + { + "name": "npc_21_15", + "kind": "npc", + "x": 21, + "y": 15 + }, + { + "name": "npc_27_15", + "kind": "npc", + "x": 27, + "y": 15 + }, + { + "name": "npc_26_20", + "kind": "npc", + "x": 26, + "y": 20 + }, + { + "name": "npc_8_28", + "kind": "npc", + "x": 8, + "y": 28 + }, + { + "name": "npc_18_28", + "kind": "npc", + "x": 18, + "y": 28 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_Route204South = +R"json({ + "name": "Route204South", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204South.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################", + "###########D###.################", + "########..S.....################", + "########........################", + "########........################", + "##########...~##################", + "##########...~##################", + "##########..~~##################", + "##########..~~##################", + "####~~~~~~~~~~##################", + "####~~~~~~~~~~##################", + "####~~~~~~~~~~##################", + "####~~~~~~~~~~############...###", + "####~~~~~~~~~~############....##", + "####~~~~~~~~~~#..###############", + "##~~~~~~~~~~~~#..###############", + "##~~~~~~~~~~~~#..###############", + "##~~~~~~~~~~~~S.################", + "##~~~~~.........################", + "##~~~~~.........#.##############", + "##~~~~~.........#.##############", + "##.#########....#.##############", + "############....#......~########", + "############....######~~########", + "############....######~~########", + "############....######~~########", + "############....######~~########", + "############....######~~########", + "###.######.#....#..~~~~~########", + "##..######.#....#...~~~~########", + "##########.#....#.......########", + "############....######..########" + ], + "objects": [ + { + "name": "npc_11_8", + "kind": "npc", + "x": 11, + "y": 8 + }, + { + "name": "npc_7_18", + "kind": "npc", + "x": 7, + "y": 18 + }, + { + "name": "npc_12_21", + "kind": "npc", + "x": 12, + "y": 21 + } + ] +} +)json"; + + + + +} +} +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp new file mode 100644 index 0000000000..130ffd216c --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp @@ -0,0 +1,258 @@ +/* BDSP AutoStory - Maps test data + * + * From: https://github.com/PokemonAutomation/ + * + * generated by devtools/maps/bdsp_maps.py --json-dir Packages/Resources/PokemonBDSP/Maps --cpp SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp, do not edit + * + */ + +namespace PokemonAutomation{ +namespace NintendoSwitch{ +namespace PokemonBDSP{ + + +extern const char* const TEST_MAP_JSON_RavagedPath = +R"json({ + "name": "RavagedPath", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RavagedPath.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "..#####################.........#", + "....############................#", + "....############................#", + "....############................#", + "....############................#", + "....############................#", + "....##.#####.###................#", + "....##.#....#.##................#", + "....##.##.#...#########.........#", + "....##....#..##########.........#", + "....##.#.#.......#...############", + "....###.....######...############", + "....##############....#.......###", + "....##############....#.......###", + "..............####....##......###", + "..............####...#######D####", + "..............####...############", + "..............####...####.......#", + "..............####...####.......#", + "..............####...####.......#", + "..............####...####.......#", + "..............#####D#####.......#", + "..............###########.......#", + "..............###########.......#" + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_Route204North = +R"json({ + "name": "Route204North", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "########.#...###################", + "########.#...###################", + "####.....#...########.##########", + "##########...#......#.##########", + "#####....#...#......#...........", + "#####....#~~~#......#...######..", + "#####....#~~####################", + "##########~~~.........##########", + "##........~~~~~.......##########", + "##..######.~~~~..S....##########", + "###.#....#.~~~........##########", + "##..#....#.~~.........##########", + "##########..............########", + "##########..............########", + "##########...####~~~~~~~########", + "##########vvv####~~~~~~~########", + "##########...######~~~~~########", + "##########...######~~~~~########", + "##########...######~~~~~########", + "##########...######~.~~~########", + "##########............~~########", + "##########............##########", + "##########............##########", + "##########...##.....#.##########", + "##########...##.......##########", + "##########...###################", + "##########...#######.###########", + "##########............##########", + "##########............##########", + "##########............##########", + "##########............##########", + "##########...###################" + ], + "objects": [ + { + "name": "npc_31_4", + "kind": "npc", + "x": 31, + "y": 4 + }, + { + "name": "npc_15_7", + "kind": "npc", + "x": 15, + "y": 7 + }, + { + "name": "npc_16_7", + "kind": "npc", + "x": 16, + "y": 7 + }, + { + "name": "npc_20_12", + "kind": "npc", + "x": 20, + "y": 12 + }, + { + "name": "npc_17_20", + "kind": "npc", + "x": 17, + "y": 20 + } + ] +} +)json"; + +extern const char* const TEST_MAP_JSON_FloaromaTown = +R"json({ + "name": "FloaromaTown", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_FloaromaTown.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "######........................##", + "##..##........................##", + "..............................##", + "..............................##", + "..............................##", + "..............................##", + "..............................##", + "..................#####.......##", + "..................#####.......##", + "..................#####.......##", + "..................#####.......##", + "..........####...S##.##.......##", + "..........####................##", + "..........####................##", + "..........#D##................##", + ".......................####..S##", + ".......................####...##", + ".......................#D##...##", + "..............................##", + ".............S..................", + "................................", + "................................", + "................................", + "..............#####....####...##", + "..............#####....####...##", + "..............#####....####...##", + "..............##D##....#D##...##", + "..............................##", + "..............................##", + "..............................##", + "########.#...###################", + "########.#...###################" + ], + "objects": [ + { + "name": "npc_2_1", + "kind": "npc", + "x": 2, + "y": 1 + }, + { + "name": "npc_3_1", + "kind": "npc", + "x": 3, + "y": 1 + }, + { + "name": "npc_6_10", + "kind": "npc", + "x": 6, + "y": 10 + }, + { + "name": "npc_23_11", + "kind": "npc", + "x": 23, + "y": 11 + }, + { + "name": "npc_19_21", + "kind": "npc", + "x": 19, + "y": 21 + }, + { + "name": "npc_2_23", + "kind": "npc", + "x": 2, + "y": 23 + }, + { + "name": "npc_3_23", + "kind": "npc", + "x": 3, + "y": 23 + }, + { + "name": "npc_11_26", + "kind": "npc", + "x": 11, + "y": 26 + } + ] +} +)json"; + + + + +} +} +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghCity.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghCity.cpp index a9df9b327e..781af0c643 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghCity.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghCity.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_OreburghCity.h" namespace PokemonAutomation{ @@ -76,74 +77,7 @@ using namespace Pokemon; // and (39, 38), a Battle Girl at (51, 21), a Machop at (56, 46) and a // wandering Machop around (35, 45), none of which Diamond has. const TileGrid& grid(){ - static const TileGrid grid({ - // 0 1 2 3 4 5 6 - R"(#########################################......#################)", // 0 - R"(#########################################...S..#################)", // 1 - R"(#########################################......#################)", // 2 - R"(#########################################......#################)", // 3 - R"(#########################################...####################)", // 4 - R"(#########################################...####################)", // 5 - R"(#########################################....###################)", // 6 - R"(############.#####.######.#.############.....###################)", // 7 - R"(###########..#####..#####...############.....###################)", // 8 - R"(#########....#####..#####...############.....###################)", // 9 - R"(##.....########D######D######D##########.....###################)", // 10 - R"(##..S..###..........................####........#.#...##########)", // 11 - R"(##..................................####.....S........##########)", // 12 - R"(#D..................................####..............##########)", // 13 - R"(##..................................####..............####.#####)", // 14 - R"(##..................................####..............####.#####)", // 15 - R"(##.....###N............#######......#D##..............####.#####)", // 16 - R"(##.....##.......####...#######...............#####....####.#####)", // 17 - R"(#########.......####.#.#######..............######......#.######)", // 18 - R"(#########.......####...#######..............######.....#########)", // 19 - R"(#########.......#D####S###D###...............##D##.....#########)", // 20 - R"(#########........................................#.....#########)", // 21 - R"(#########........................................#.....#########)", // 22 - R"(#########........................................#....##########)", // 23 - R"(#########........................................#....##########)", // 24 - R"(#########..N.....................................#....##########)", // 25 - R"(##########.#.#..########.........................#....##########)", // 26 - R"(########################.######.############.....#....##########)", // 27 - R"(########################.######.###........#.....#....##D#######)", // 28 - R"(########################.######.###.#..#...#.....#.........#####)", // 29 - R"(############################################.....###############)", // 30 - R"(############################################.....###############)", // 31 - R"(############################################.....###############)", // 32 - R"(############################################.....###############)", // 33 - R"(############################################.....###############)", // 34 - R"(############################################.....###############)", // 35 - R"(############################################.....##D############)", // 36 - R"(###################################.########.....#...........###)", // 37 - R"(###################################.....####.....#...........###)", // 38 - R"(###################################.....####.....#...........###)", // 39 - R"(###################################....#####.....#...........###)", // 40 - R"(#####################################..#.........#...........###)", // 41 - R"(#####################################..#..#.#....#....#.#....###)", // 42 - R"(#####################################..#..#.#....#....#.#....###)", // 43 - R"(###################################....#.....................###)", // 44 - R"(###################################....#.....................###)", // 45 - R"(###################################....#.....................###)", // 46 - R"(###################################....#.....................###)", // 47 - R"(###################################....#.....................###)", // 48 - R"(###################################..###..#.#................###)", // 49 - R"(###################################..###..#.#...#.#########.####)", // 50 - R"(###################################..###........#.#########.####)", // 51 - R"(###################################....#..........#####.....####)", // 52 - R"(###################################...............#####.....####)", // 53 - R"(#####################################.............##.........###)", // 54 - R"(#####################################..####.#.....###.....######)", // 55 - R"(#####################################..####.#S....###.....######)", // 56 - R"(###########################################.......####.......###)", // 57 - R"(############################################.....#####.......###)", // 58 - R"(############################################.....#####.....#####)", // 59 - R"(######################################################..#..#####)", // 60 - R"(################################################################)", // 61 - R"(################################################################)", // 62 - R"(################################################################)", // 63 - }); - return grid; + return story_grid("OreburghCity"); } const TilePos POKEMON_CENTER_DOOR{47, 20}; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghGate.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghGate.cpp index d9cc7439a1..310728cda5 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghGate.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghGate.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_OreburghGate.h" namespace PokemonAutomation{ @@ -41,42 +42,7 @@ using namespace Pokemon; // (24, 22..24) and Curtis (17, 22..24). Platinum decodes this cave // identically, terrain and objects. const TileGrid& grid(){ - static const TileGrid grid({ - // 0 1 2 3 - R"(################################)", // 0 - R"(################################)", // 1 - R"(################################)", // 2 - R"(################################)", // 3 - R"(############..#......###########)", // 4 - R"(###########..........###########)", // 5 - R"(###########........#.###########)", // 6 - R"(###########..###################)", // 7 - R"(###########..###################)", // 8 - R"(###########..###################)", // 9 - R"(###########.####################)", // 10 - R"(############.###################)", // 11 - R"(###########.####################)", // 12 - R"(###########..###################)", // 13 - R"(###########..###################)", // 14 - R"(###########..###################)", // 15 - R"(###########..###################)", // 16 - R"(###########..###################)", // 17 - R"(############.###################)", // 18 - R"(###########..###################)", // 19 - R"(#####..N##...##########...#.####)", // 20 - R"(####....##...##########.N...####)", // 21 - R"(###D........................D###)", // 22 - R"(####...#....................####)", // 23 - R"(###########..............#.#####)", // 24 - R"(############.....N.#############)", // 25 - R"(###########..#.#...#############)", // 26 - R"(################################)", // 27 - R"(################################)", // 28 - R"(################################)", // 29 - R"(################################)", // 30 - R"(################################)", // 31 - }); - return grid; + return story_grid("OreburghGate"); } } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp index 2bd3a972cc..53e2d1dd6d 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_OreburghMine.h" namespace PokemonAutomation{ @@ -44,43 +45,7 @@ using namespace Pokemon; // at (4,28) and (26,24), walls until picked up. A Machop wanders along row // 28, columns 11..13, and is left off the grid. const TileGrid& grid(){ - // 0 1 2 3 - // 01234567890123456789012345678901 - static const TileGrid grid({ - R"(################################)", // 0 - R"(###############D################)", // 1 - R"(#############.....##############)", // 2 - R"(#############.....##############)", // 3 - R"(#############.....##############)", // 4 - R"(#############.....##############)", // 5 - R"(#############.....##############)", // 6 - R"(#############...################)", // 7 - R"(#############...################)", // 8 - R"(#############.....##############)", // 9 - R"(#############..#..##############)", // 10 - R"(###############...##############)", // 11 - R"(#############...################)", // 12 - R"(#############.....##############)", // 13 - R"(###############...##############)", // 14 - R"(########...####.....NN.....N.###)", // 15 - R"(######.....##.................##)", // 16 - R"(##.#..........................##)", // 17 - R"(##....####################....##)", // 18 - R"(##vvv##..................#....##)", // 19 - R"(##....#..................#N...##)", // 20 - R"(##.##.#..................#....##)", // 21 - R"(##..###..................###..##)", // 22 - R"(##..###..................###..##)", // 23 - R"(##....#..................##...##)", // 24 - R"(##.##.#..................#....##)", // 25 - R"(####..####################....##)", // 26 - R"(####..####################....##)", // 27 - R"(#####...N........#N#........####)", // 28 - R"(######......................####)", // 29 - R"(################################)", // 30 - R"(################################)", // 31 - }); - return grid; + return story_grid("OreburghMine"); } // The first open row below the warp tile, where the walk in from the hall diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RavagedPath.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RavagedPath.cpp index 1af104acc6..500bc58358 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RavagedPath.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RavagedPath.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_RavagedPath.h" namespace PokemonAutomation{ @@ -33,64 +34,7 @@ using namespace Pokemon; // Bulbapedia's Ravaged_Path_DP.png (stretched from 528x672 to 528x864), with // '?' where the untraced west chambers continue; nothing we walk is there. const TileGrid& grid(){ - static const TileGrid grid({ - // 0 1 2 3 - R"(#################################)", // 0 - R"(#################################)", // 1 - R"(#################################)", // 2 - R"(#################################)", // 3 - R"(#################################)", // 4 - R"(#################################)", // 5 - R"(#################################)", // 6 - R"(#################################)", // 7 - R"(#################################)", // 8 - R"(#################################)", // 9 - R"(#################################)", // 10 - R"(#################################)", // 11 - R"(#################################)", // 12 - R"(#################################)", // 13 - R"(#################################)", // 14 - R"(#################################)", // 15 - R"(#################################)", // 16 - R"(#################################)", // 17 - R"(#################################)", // 18 - R"(#################################)", // 19 - R"(#################################)", // 20 - R"(#################################)", // 21 - R"(#################################)", // 22 - R"(#################################)", // 23 - R"(#################################)", // 24 - R"(#################################)", // 25 - R"(#################################)", // 26 - R"(#################################)", // 27 - R"(#################################)", // 28 - R"(#################################)", // 29 - R"(..#####################.........#)", // 30 - R"(....############................#)", // 31 - R"(....############................#)", // 32 - R"(....############................#)", // 33 - R"(....############................#)", // 34 - R"(....############................#)", // 35 - R"(....##.#####.###................#)", // 36 - R"(....##.#....#.##................#)", // 37 - R"(....##.##.#...#########.........#)", // 38 - R"(....##....#..##########.........#)", // 39 - R"(....##.#.#.......#...############)", // 40 - R"(....###.....######...############)", // 41 - R"(....##############....#.......###)", // 42 - R"(....##############....#.......###)", // 43 - R"(..............####....##......###)", // 44 - R"(..............####...#######D####)", // 45 - R"(..............####...############)", // 46 - R"(..............####...####.......#)", // 47 - R"(..............####...####.......#)", // 48 - R"(..............####...####.......#)", // 49 - R"(..............####...####.......#)", // 50 - R"(..............#####D#####.......#)", // 51 - R"(..............###########.......#)", // 52 - R"(..............###########.......#)", // 53 - }); - return grid; + return story_grid("RavagedPath"); } const std::vector& rocks(){ diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp index dbdcc98267..aedb4a723e 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_Route201.h" namespace PokemonAutomation{ @@ -49,36 +50,7 @@ using namespace Pokemon; // Sandgem. Rowan, Barry and the briefcase by the lake are hidden by story // flags and left off. const TileGrid& grid(){ - // 0 1 2 3 4 5 6 - // 0123456789012345678901234567890123456789012345678901234567890123 - static const TileGrid grid({ - R"(################################################################)", // 0 - R"(################################################################)", // 1 - R"(################################################################)", // 2 - R"(##########################################"""""""""""...........)", // 3 - R"(##########################################"""""""""""..S........)", // 4 - R"(##########################################"""""""""""...........)", // 5 - R"(##########################################"""""""""""...........)", // 6 - R"(....####..........######..##....##..####.."""""""""##...........)", // 7 - R"(....####..........######..##....##..####.."""""""""##....N......)", // 8 - R"(##........####............................"""""""""##vvvvv######)", // 9 - R"(##........####............................"""""""""##.....######)", // 10 - R"(.........................................."""""""""##.....######)", // 11 - R"(vvvv####vvvvvvvvvvvvvvvvvvvvvvvv........S."""""""""##.....######)", // 12 - R"(....####............""""""""""............................######)", // 13 - R"(....................""""""""""............................######)", // 14 - R"(....................""""""""""............................######)", // 15 - R"(....................""""""""""............................######)", // 16 - R"(########.....S......##########............................######)", // 17 - R"(########............##########............""""""""""""""""######)", // 18 - R"(##############....############################""""""""""""######)", // 19 - R"(##############....############################""""""""""""######)", // 20 - R"(##############....##############################################)", // 21 - R"(##############....##############################################)", // 22 - R"(##############....##############################################)", // 23 - R"(##############....##############################################)", // 24 - }); - return grid; + return story_grid("Route201"); } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp index e52e11c6ab..9bb6b1a2a3 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_Route202.h" namespace PokemonAutomation{ @@ -57,43 +58,7 @@ using namespace Pokemon; // as a fourth trainer facing east). Dawn's tile (15,27) is hidden by a // story flag. const TileGrid& grid(){ - // 0 1 2 3 - // 012345678901234567890123456789012345 - static const TileGrid grid({ - R"(###########........#################)", // 0 - R"(###########........#################)", // 1 - R"(###########........#################)", // 2 - R"(###########........#################)", // 3 - R"(###""""""........S..""""".N....#####)", // 4 - R"(###""""""..........."""""......#####)", // 5 - R"(####"""""..........."""""......#####)", // 6 - R"(###""""""..........."""""......#####)", // 7 - R"(###""""""..........."""""......#####)", // 8 - R"(###"""""".....########.........#####)", // 9 - R"(#########vvvvv########vvvvvv...""###)", // 10 - R"(#########.....########"""""""""""###)", // 11 - R"(#######.......########"""""""""""###)", // 12 - R"(#######N..........####"""""""""""###)", // 13 - R"(###...............####"""""""""""###)", // 14 - R"(###...............####"""""""""""###)", // 15 - R"(###............S..####"""""""""""###)", // 16 - R"(###...............####"""""""""""###)", // 17 - R"(###...............####N."""""""""###)", // 18 - R"(###""""##..............."""""""""###)", // 19 - R"(###""""##................."""""""###)", // 20 - R"(###""""##....................""""###)", // 21 - R"(###""""##......................#####)", // 22 - R"(###""""##vvvvv########vvvvvvvvv#####)", // 23 - R"(###""""##.....########.........#####)", // 24 - R"(###""""""......""""""...S......#####)", // 25 - R"(###""""""......""""""..........#####)", // 26 - R"(###""""""......""""""..........#####)", // 27 - R"(###""""""......######..........#####)", // 28 - R"(###""""""......######..........#####)", // 29 - R"(######################.........#####)", // 30 - R"(#####################..........#####)", // 31 - }); - return grid; + return story_grid("Route202"); } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp index e1d0f2b896..642168d015 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_Route203.h" namespace PokemonAutomation{ @@ -60,35 +61,7 @@ using namespace Pokemon; // blue-haired man near the Gate, on the console); Barry (10,17) is hidden // by a story flag. const TileGrid& grid(){ - // 0 1 2 3 4 5 6 - // 0123456789012345678901234567890123456789012345678901234567890 - static const TileGrid grid({ - R"(#############################################################)", // 0 - R"(#############################################################)", // 1 - R"(#############################################################)", // 2 - R"(#############################################################)", // 3 - R"(#####..............###########..""""#########################)", // 4 - R"(#####..............###########.#."""..""""""""""""""#########)", // 5 - R"(#####..................#######........""""""""""""".....#####)", // 6 - R"(#####..................###############"""""""""""....S..#####)", // 7 - R"(#####""""##...####.....#......########"""""""""""N......#####)", // 8 - R"(#####""""##...####.....#......########""""""""""".......D####)", // 9 - R"(#####""""##..N####..#..#..S...########""""""""""".......#####)", // 10 - R"(#####""""##...####.....#......########""""""""""".......#####)", // 11 - R"(#####""""##...####.....#....""""""""##"""""""""S..."""..#####)", // 12 - R"(#####""""##...####vvvvv#...""...".""##"""""""""...."""..#####)", // 13 - R"(#####""................#....######""##.....""....##"""..#####)", // 14 - R"(#####..................#....######""##vvvvvvvvvvv##"""..#####)", // 15 - R"(#####....S.............#...."""N."""............."""""..#####)", // 16 - R"(...........................""""..."".......N....."""""..#####)", // 17 - R"(..........................."".....""............."""""..#####)", // 18 - R"(..........................""""....."##..........""""""..#####)", // 19 - R"(..........................""""".""""#########################)", // 20 - R"(#############################################################)", // 21 - R"(#############################################################)", // 22 - R"(#############################################################)", // 23 - }); - return grid; + return story_grid("Route203"); } // The warp tile the Gate puts us on, and its open neighbours. diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.cpp index cc15602760..eee289d1ce 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_Route204.h" namespace PokemonAutomation{ @@ -41,42 +42,7 @@ using namespace Pokemon; // Before 2026-10-31 this grid was traced from Bulbapedia's DP map image, // whose rows are 12 px to the columns' 16: every row was 3/4 of a tile. const TileGrid& north_grid(){ - static const TileGrid grid({ - // 0 1 2 3 - R"(########.#...###################)", // 0 - R"(########.#...###################)", // 1 - R"(####.....#...########.##########)", // 2 - R"(##########...#......#.##########)", // 3 - R"(#####....#...#......#..........N)", // 4 - R"(#####....#"""#......#...######..)", // 5 - R"(#####....#""####################)", // 6 - R"(##########"""..NN.....##########)", // 7 - R"(##........""""".......##########)", // 8 - R"(##..######.""""..S....##########)", // 9 - R"(###.#....#."""........##########)", // 10 - R"(##..#....#."".........##########)", // 11 - R"(##########..........N...########)", // 12 - R"(##########..............########)", // 13 - R"(##########...####"""""""########)", // 14 - R"(##########vvv####"""""""########)", // 15 - R"(##########...######"""""########)", // 16 - R"(##########...######"""""########)", // 17 - R"(##########...######"""""########)", // 18 - R"(##########...######"."""########)", // 19 - R"(##########.......N....""########)", // 20 - R"(##########............##########)", // 21 - R"(##########............##########)", // 22 - R"(##########...##.....#.##########)", // 23 - R"(##########...##.......##########)", // 24 - R"(##########...###################)", // 25 - R"(##########...#######.###########)", // 26 - R"(##########............##########)", // 27 - R"(##########............##########)", // 28 - R"(##########............##########)", // 29 - R"(##########............##########)", // 30 - R"(##########...###################)", // 31 - }); - return grid; + return story_grid("Route204North"); } const TilePos CAVE_EXIT{20, 26}; diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204South.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204South.cpp index cef5a1ede8..4f022f4dce 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204South.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204South.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_Route204South.h" namespace PokemonAutomation{ @@ -41,41 +42,7 @@ using namespace Pokemon; // Row 31, columns 12 to 15, joins the top of Jubilife's north street: // walking south there leaves the route. const TileGrid& grid(){ - static const TileGrid grid({ - R"(################################)", // 0 - R"(###########D###.################)", // 1 - R"(########..S.....################)", // 2 - R"(########........################)", // 3 - R"(########........################)", // 4 - R"(##########..."##################)", // 5 - R"(##########..."##################)", // 6 - R"(##########..""##################)", // 7 - R"(##########.N""##################)", // 8 - R"(####""""""""""##################)", // 9 - R"(####""""""""""##################)", // 10 - R"(####""""""""""##################)", // 11 - R"(####""""""""""############...###)", // 12 - R"(####""""""""""############....##)", // 13 - R"(####""""""""""#..###############)", // 14 - R"(##""""""""""""#..###############)", // 15 - R"(##""""""""""""#..###############)", // 16 - R"(##""""""""""""S.################)", // 17 - R"(##"""""N........################)", // 18 - R"(##""""".........#.##############)", // 19 - R"(##""""".........#.##############)", // 20 - R"(##.#########N...#.##############)", // 21 - R"(############....#......"########)", // 22 - R"(############....######""########)", // 23 - R"(############....######""########)", // 24 - R"(############....######""########)", // 25 - R"(############....######""########)", // 26 - R"(############....######""########)", // 27 - R"(###.######.#....#.."""""########)", // 28 - R"(##..######.#....#...""""########)", // 29 - R"(##########.#....#.......########)", // 30 - R"(############....######..########)", // 31 - }); - return grid; + return story_grid("Route204South"); } std::vector jubilife_entry(){ diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp index d2aeaa1a2d..84afae03f1 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_SandgemTown.h" namespace PokemonAutomation{ @@ -60,43 +61,7 @@ using namespace Pokemon; // lab's sign stands on row 11, in front of the fence: walking west along // row 11 stops at it. const TileGrid& grid(){ - // 0 1 2 3 - // 0123456789012345678901234567890123 - static const TileGrid grid({ - R"(########################......####)", // 0 - R"(########################......####)", // 1 - R"(####################..........####)", // 2 - R"(####################..........####)", // 3 - R"(####################..........####)", // 4 - R"(####################..........####)", // 5 - R"(####################......########)", // 6 - R"(####################......########)", // 7 - R"(####################......########)", // 8 - R"(####################......########)", // 9 - R"(########D##....##D##S....S#D######)", // 10 - R"(.....S........................####)", // 11 - R"(..............................####)", // 12 - R"(..............................####)", // 13 - R"(..............................####)", // 14 - R"(..............................####)", // 15 - R"(######........................####)", // 16 - R"(######........................####)", // 17 - R"(######.........#####..........####)", // 18 - R"(##########.....#####..........####)", // 19 - R"(##########.....#####..........####)", // 20 - R"(##########.....#####..........####)", // 21 - R"(#######D##....S#D###..S.......####)", // 22 - R"(######........................####)", // 23 - R"(######........................####)", // 24 - R"(######........................####)", // 25 - R"(######....................########)", // 26 - R"(####################......########)", // 27 - R"(####################......########)", // 28 - R"(####################......########)", // 29 - R"(####################......########)", // 30 - R"(####################......########)", // 31 - }); - return grid; + return story_grid("SandgemTown"); } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_TwinleafTown.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_TwinleafTown.cpp index ad16d52eef..b7d0f60bb6 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_TwinleafTown.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_TwinleafTown.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_TwinleafTown.h" namespace PokemonAutomation{ @@ -51,42 +52,7 @@ using namespace Pokemon; // No trainers. Platinum decodes the same terrain and objects; its one extra, // an arrow signpost at world (109, 856), stands in Route 201's cell. const TileGrid& grid(){ - static const TileGrid grid({ - // 0 1 2 3 - R"(############........############)", // 0 - R"(#######....#........#....#######)", // 1 - R"(#######....#........#....#######)", // 2 - R"(############........############)", // 3 - R"(######....................######)", // 4 - R"(######......N.............######)", // 5 - R"(######....................######)", // 6 - R"(######..#####.............######)", // 7 - R"(######..#####......####...######)", // 8 - R"(######..#####......####...######)", // 9 - R"(######..######.....####...######)", // 10 - R"(######..#D###S.....#D##...######)", // 11 - R"(######....................######)", // 12 - R"(######....................######)", // 13 - R"(######..........S.........######)", // 14 - R"(######....................######)", // 15 - R"(######....................######)", // 16 - R"(######.............#####..######)", // 17 - R"(######...####......#####..######)", // 18 - R"(######...####......#####..######)", // 19 - R"(######...####.....######..######)", // 20 - R"(######...#D##.....S#D###..######)", // 21 - R"(######....................######)", // 22 - R"(######....................######)", // 23 - R"(######....................######)", // 24 - R"(######......N.............######)", // 25 - R"(######....................######)", // 26 - R"(######......########......######)", // 27 - R"(################################)", // 28 - R"(################################)", // 29 - R"(################################)", // 30 - R"(################################)", // 31 - }); - return grid; + return story_grid("TwinleafTown"); } } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp index 5d995cf9ea..a696281964 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp @@ -4,6 +4,7 @@ * */ +#include "PokemonBDSP_AutoStory_MapGrids.h" #include "PokemonBDSP_AutoStory_VerityLakefront.h" namespace PokemonAutomation{ @@ -46,42 +47,7 @@ using namespace Pokemon; // Platinum decodes the same terrain; it has no Barry object here and calls // the sign a trainer-tips signpost. const TileGrid& grid(){ - static const TileGrid grid({ - // 0 1 2 3 - R"(....############################)", // 0 - R"(....############################)", // 1 - R"(....############################)", // 2 - R"(....############################)", // 3 - R"(################################)", // 4 - R"(################################)", // 5 - R"(################################)", // 6 - R"(################################)", // 7 - R"(################################)", // 8 - R"(################################)", // 9 - R"(################################)", // 10 - R"(################..##############)", // 11 - R"(################..##############)", // 12 - R"(################..##############)", // 13 - R"(##############.S....#...........)", // 14 - R"(##############......#.....####..)", // 15 - R"(##############......#.....####..)", // 16 - R"(##############......#...........)", // 17 - R"(##############......#...........)", // 18 - R"(##############......#vvvvv##vvvv)", // 19 - R"(################..........##....)", // 20 - R"(################................)", // 21 - R"(##################..............)", // 22 - R"(##################..............)", // 23 - R"(################################)", // 24 - R"(################################)", // 25 - R"(################################)", // 26 - R"(################################)", // 27 - R"(################################)", // 28 - R"(################################)", // 29 - R"(################################)", // 30 - R"(################################)", // 31 - }); - return grid; + return story_grid("VerityLakefront"); } } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp index c013b4bfde..e8d3eb0b72 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp @@ -5,14 +5,19 @@ */ #include +#include #include #include #include #include +#include "Common/Cpp/Exceptions.h" +#include "Common/Cpp/Json/JsonValue.h" #include "Common/Cpp/TestRunners/UnitTestDatabase.h" #include "CommonFramework/ImageTypes/ImageViewRGB32.h" #include "Pokemon/Navigation/Pokemon_MapSet.h" #include "Pokemon/Navigation/Pokemon_TileGrid.h" +#include "Data/PokemonBDSP_AutoStory_MapGrids.h" +#include "Data/PokemonBDSP_AutoStory_Maps_TestData.h" #include "Data/PokemonBDSP_AutoStory_Route202.h" #include "Data/PokemonBDSP_AutoStory_SandgemTown.h" #include "Data/PokemonBDSP_AutoStory_StoryMaps.h" @@ -156,10 +161,91 @@ class Test_TrainingToSandgem : public UnitTest{ } }; +// The built-in maps (the JSON files' text, test_map_json()) all parse +// through the shared loader into tile grids, each named as its file. +class Test_BuiltInMaps : public UnitTest{ +public: + Test_BuiltInMaps() + : UnitTest("PokemonBDSP::AutoStory - Map grids: the built-in JSON maps load") + {} + virtual UnitTestResult run(Logger& logger, CancellableScope&) const override{ + if (test_map_json().empty()){ + return std::string("No built-in maps."); + } + for (const auto& [name, json] : test_map_json()){ + try{ + const TileGrid& grid = built_in_grid(name); + logger.log(std::format("{}: {} x {}", name, grid.width(), grid.height())); + }catch (Exception& e){ + return std::format("{}: {}: {}", name, e.name(), e.message()); + } + } + return true; + } +}; + +// The JSON glyphs as BDSP tiles: every BDSP tile and a person standing; +// water and a wanderer have none. +struct GlyphCase{ + std::string name; + std::string json; + // The grid's rows, or empty when reading it must throw. + std::vector rows; +}; + +class Test_MapGlyphs : public UnitTest{ +public: + Test_MapGlyphs() + : UnitTest("PokemonBDSP::AutoStory - Map grids: JSON glyphs as tile grids") + {} + virtual UnitTestResult run(Logger&, CancellableScope&) const override{ + const std::vector cases{ + { + .name = "every BDSP tile, and a person standing", + .json = R"({"name": "T", "source": {"decomp_file": "f", "revision": "r", "date": "d"}, + "tiles": ["#.~", "vDS"], + "objects": [{"name": "npc_1_0", "kind": "npc", "x": 1, "y": 0}]})", + .rows = {"#N\"", "vDS"}, + }, + { + .name = "water has no BDSP tile", + .json = R"({"name": "T", "source": {"decomp_file": "f", "revision": "r", "date": "d"}, "tiles": ["#w"]})", + .rows = {}, + }, + { + .name = "a wanderer has no BDSP tile", + .json = R"({"name": "T", "source": {"decomp_file": "f", "revision": "r", "date": "d"}, "tiles": ["#.."], + "objects": [{"name": "lass", "kind": "npc", "x": 1, "y": 0, "wander": {"x0": 1, "y0": 0, "x1": 2, "y1": 0}}]})", + .rows = {}, + }, + }; + for (const GlyphCase& item : cases){ + std::optional grid; + std::string error; + try{ + grid = tile_grid_from_map(Pokemon::parse_map(parse_json(item.json), item.name)); + }catch (ParseException& e){ + error = e.message(); + } + if (item.rows.empty() != !grid){ + return item.name + (grid ? ": read a grid, expected a ParseException." : ": expected a grid, read: " + error); + } + if (grid){ + if (const std::optional difference = grid_difference(*grid, TileGrid(item.rows))){ + return item.name + ": differs from the expected rows at " + *difference + "."; + } + } + } + return true; + } +}; + } void add_tests_AutoStory_MapGrids(UnitTestDatabase& database){ + database.add(); + database.add(); database.add(); database.add(); database.add(); diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 63d40888ac..88f195e9ba 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -1563,6 +1563,12 @@ file(GLOB LIBRARY_SOURCES Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_TwinleafTown.h Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.cpp Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.h + Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp + Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h + Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp + Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h + Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp + Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.h Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.h diff --git a/devtools/maps/bdsp_maps.py b/devtools/maps/bdsp_maps.py new file mode 100644 index 0000000000..ec113b7634 --- /dev/null +++ b/devtools/maps/bdsp_maps.py @@ -0,0 +1,137 @@ +"""Embeds the BDSP AutoStory maps (JSON) in a C++ test-data file. + +Usage: + python3 devtools/maps/bdsp_maps.py --json-dir Packages/Resources/PokemonBDSP/Maps \ + --cpp SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp + ... --check (regenerate in memory; exit 1 if the file's bytes differ) + +The maps are JSON files in the shared map schema +(SerialPrograms/Source/Pokemon/Navigation/Pokemon_MapData.h), in Packages' +Resources/PokemonBDSP/Maps; the program loads them from there. They are the +source: this script does not build them, it copies each one's text, +byte for byte, into one R"json(...)json" literal per map (adjacent literals +under 16000 bytes each, split at line breaks, for MSVC's literal limit), so +the unit tests read the same maps without Packages. The literals go in parts +_1.cpp, _2.cpp, ... of at most 900 lines (the code-health file +limit is 1000); --cpp itself holds test_map_json(), which the matching .h +declares. The C++ tables the files were first written from (in +pret/pokediamond's terms, see each map's .cpp) were converted once, at +ddcbdb21c, with json.dump(indent=4). +""" +import argparse +import os +import sys + +# The maps embedded, in order. Each PR that adds a map adds it here. +MAPS = [ + 'TwinleafTown', 'VerityLakefront', 'LakeVerity', 'Route201', 'SandgemTown', + 'Route202', 'JubilifeCity', 'Route203', 'OreburghGate', 'OreburghCity', + 'OreburghMine', 'Route204South', 'RavagedPath', 'Route204North', + 'FloaromaTown', +] + +MAX_LITERAL = 16000 + + +def literals(text): + """The text as adjacent raw literals, each under MAX_LITERAL bytes.""" + parts, current = [], '' + for line in text.splitlines(keepends=True): + if current and len(current) + len(line) > MAX_LITERAL: + parts.append(current) + current = '' + current += line + if current: + parts.append(current) + for part in parts: + if 'json)' in part or len(part.encode('utf-8')) > MAX_LITERAL: + raise SystemExit('a map does not fit the literals') + return parts + + +# Lines per generated file: the code-health check stops a file at 1000. +MAX_FILE_LINES = 900 + + +def header(args_text): + return [ + '/* BDSP AutoStory - Maps test data', + ' *', + ' * From: https://github.com/PokemonAutomation/', + ' *', + ' * generated by devtools/maps/bdsp_maps.py ' + args_text + ', do not edit', + ' *', + ' */', + '', + ] + + +def namespaces(lines): + return ['namespace PokemonAutomation{', 'namespace NintendoSwitch{', 'namespace PokemonBDSP{', '', ''] + \ + lines + ['', '', '', '}', '}', '}', ''] + + +def symbol(name): + return 'TEST_MAP_JSON_' + name + + +def generate(json_dir, args_text, cpp): + """{path: text} for the index file `cpp` and its parts. Each map's text + is a namespace-scope literal in a part, filled to MAX_FILE_LINES; the + index's test_map_json() lists them in MAPS order.""" + stem = cpp[:-len('.cpp')] + parts, current = [], [] + for name in MAPS: + with open(os.path.join(json_dir, name + '.json'), encoding='utf-8', newline='') as f: + text = f.read() + block = ['extern const char* const ' + symbol(name) + ' ='] + \ + ['R"json(' + part + ')json"' for part in literals(text)] + block[-1] += ';' + block += [''] + block_lines = sum(line.count('\n') + 1 for line in block) + size = sum(line.count('\n') + 1 for line in current) + if current and size + block_lines > MAX_FILE_LINES - 30: + parts.append(current) + current = [] + current += block + parts.append(current) + files = {} + for number, body in enumerate(parts, 1): + files[stem + '_' + str(number) + '.cpp'] = '\n'.join(header(args_text) + namespaces(body)) + index = [] + for name in MAPS: + index.append('extern const char* const ' + symbol(name) + ';') + index += ['', '', 'const std::vector>& test_map_json(){', + ' static const std::vector> maps{'] + index += [' {"' + name + '", ' + symbol(name) + '},' for name in MAPS] + index += [' };', ' return maps;', '}'] + files[cpp] = '\n'.join(header(args_text) + ['#include "' + os.path.basename(stem) + '.h"', ''] + namespaces(index)) + return files + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split('\n')[0]) + parser.add_argument('--json-dir', required=True, help='folder of the map .json files') + parser.add_argument('--cpp', required=True, help='the test-data .cpp to write') + parser.add_argument('--check', action='store_true', help='exit 1 if --cpp differs from what would be written') + args = parser.parse_args() + args_text = '--json-dir ' + args.json_dir + ' --cpp ' + args.cpp + files = generate(args.json_dir, args_text, args.cpp) + if args.check: + for path, text in files.items(): + if not os.path.exists(path): + print(path + ': missing; run without --check.') + sys.exit(1) + with open(path, encoding='utf-8', newline='') as f: + if f.read() != text: + print(path + ': differs from the JSON files; run without --check.') + sys.exit(1) + print(args.cpp + ': up to date (' + str(len(files)) + ' files).') + return + for path, text in files.items(): + with open(path, 'w', encoding='utf-8', newline='\n') as f: + f.write(text) + print(path + ': ' + str(text.count('\n')) + ' lines.') + +if __name__ == '__main__': + main() From 77361dd126a7710008c1306a2a110a0e188594d1 Mon Sep 17 00:00:00 2001 From: dayfine Date: Sun, 1 Nov 2026 09:43:36 -0800 Subject: [PATCH 07/10] BDSP maps: the JSON files are committed and built in by CMake, not generated C++ The 15 maps are plain files in PokemonBDSP/Programs/AutoStory/Maps, the same files as Packages' Resources/PokemonBDSP/Maps. CMake builds them into the program for the unit tests with nav/shared's pa_embed_text_files() as bdsp_map_json() (declared in MapGrids.h); story_grid()'s built-in copy reads from it. The generated Maps_TestData*.cpp go. devtools/maps/bdsp_maps.py now only checks (--check --json-dir ) that Packages has the same files byte for byte; nothing builds the maps any more. The Route 201 comments no longer say the Poke Mart lady wanders: she stands still in Diamond's events file and on the console (the user, 2026-11-01); r113a..r120a missed her by the walk. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- SerialPrograms/CMakeLists.txt | 2 + .../Data/PokemonBDSP_AutoStory_MapGrids.cpp | 3 +- .../Data/PokemonBDSP_AutoStory_MapGrids.h | 9 +- .../PokemonBDSP_AutoStory_Maps_TestData.cpp | 58 -- .../PokemonBDSP_AutoStory_Maps_TestData.h | 32 - .../PokemonBDSP_AutoStory_Maps_TestData_1.cpp | 850 ------------------ .../PokemonBDSP_AutoStory_Maps_TestData_2.cpp | 258 ------ .../Data/PokemonBDSP_AutoStory_Route201.cpp | 16 +- .../Programs/AutoStory/Maps/FloaromaTown.json | 92 ++ .../Programs/AutoStory/Maps/JubilifeCity.json | 136 +++ .../Programs/AutoStory/Maps/LakeVerity.json | 62 ++ .../Programs/AutoStory/Maps/OreburghCity.json | 88 ++ .../Programs/AutoStory/Maps/OreburghGate.json | 62 ++ .../Programs/AutoStory/Maps/OreburghMine.json | 80 ++ .../Programs/AutoStory/Maps/RavagedPath.json | 64 ++ .../Programs/AutoStory/Maps/Route201.json | 43 + .../Programs/AutoStory/Maps/Route202.json | 62 ++ .../Programs/AutoStory/Maps/Route203.json | 60 ++ .../AutoStory/Maps/Route204North.json | 74 ++ .../AutoStory/Maps/Route204South.json | 62 ++ .../Programs/AutoStory/Maps/SandgemTown.json | 42 + .../Programs/AutoStory/Maps/TwinleafTown.json | 56 ++ .../AutoStory/Maps/VerityLakefront.json | 42 + .../PokemonBDSP_AutoStory_MapGrid_Tests.cpp | 7 +- SerialPrograms/cmake/SourceFiles.cmake | 4 - devtools/maps/bdsp_maps.py | 148 +-- 26 files changed, 1078 insertions(+), 1334 deletions(-) delete mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp delete mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h delete mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp delete mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/FloaromaTown.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/JubilifeCity.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/LakeVerity.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghCity.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghGate.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghMine.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/RavagedPath.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route201.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route202.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route203.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route204North.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route204South.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/SandgemTown.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/TwinleafTown.json create mode 100644 SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/VerityLakefront.json diff --git a/SerialPrograms/CMakeLists.txt b/SerialPrograms/CMakeLists.txt index d0966df32f..021c06a41f 100644 --- a/SerialPrograms/CMakeLists.txt +++ b/SerialPrograms/CMakeLists.txt @@ -197,6 +197,8 @@ add_library(SerialProgramsLib STATIC ${CORE_LIBRARY_SOURCES} ${LIBRARY_SOURCES}) include(cmake/EmbedTextFiles.cmake) pa_embed_text_files(SerialProgramsLib Source/Pokemon/Navigation/TestMaps Pokemon/Navigation/Pokemon_Navigation_Tests.h PokemonAutomation::Pokemon navigation_test_map_json) +pa_embed_text_files(SerialProgramsLib Source/PokemonBDSP/Programs/AutoStory/Maps + PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h PokemonAutomation::NintendoSwitch::PokemonBDSP bdsp_map_json) # Create binary target diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp index 26f50c3fbd..25f8e9173e 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp @@ -8,7 +8,6 @@ #include #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/Json/JsonValue.h" -#include "PokemonBDSP_AutoStory_Maps_TestData.h" #include "PokemonBDSP_AutoStory_MapGrids.h" namespace PokemonAutomation{ @@ -92,7 +91,7 @@ std::map& installed_grids(){ const std::map& built_in_grids(){ static const std::map grids = []{ std::map parsed; - for (const auto& [name, json] : test_map_json()){ + for (const auto& [name, json] : bdsp_map_json()){ const MapData map = Pokemon::parse_map(parse_json(json), name + ".json (built in)"); if (map.name != name){ throw ParseException(std::format("{}.json (built in): name is \"{}\".", name, map.name)); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h index 7bb7683081..26cd972ab1 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include "Pokemon/Navigation/Pokemon_MapData.h" #include "Pokemon/Navigation/Pokemon_TileGrid.h" @@ -22,6 +24,11 @@ namespace NintendoSwitch{ namespace PokemonBDSP{ +// (name, JSON text) of each map in PokemonBDSP/Programs/AutoStory/Maps/, +// the same files as Packages' Resources/PokemonBDSP/Maps, built into the +// program by pa_embed_text_files() (cmake/EmbedTextFiles.cmake). +const std::vector>& bdsp_map_json(); + // A map's tiles as a tile grid: walls, open ground, tall grass, south // ledges, doors and signs; a standing person ("npc" object) is an NPC tile. // Throws ParseException, naming the map, for what BDSP's grids have no @@ -32,7 +39,7 @@ Pokemon::TileGrid tile_grid_from_map(const Pokemon::MapData& map); // size and equal cell for cell. std::optional grid_difference(const Pokemon::TileGrid& here, const Pokemon::TileGrid& there); -// The built-in copy of the map `name` (test_map_json()), parsed once. +// The built-in copy of the map `name` (bdsp_map_json()), parsed once. // Throws InternalProgramError for a name it does not have. const Pokemon::TileGrid& built_in_grid(const std::string& name); diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp deleted file mode 100644 index 0d836d47c5..0000000000 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* BDSP AutoStory - Maps test data - * - * From: https://github.com/PokemonAutomation/ - * - * generated by devtools/maps/bdsp_maps.py --json-dir Packages/Resources/PokemonBDSP/Maps --cpp SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp, do not edit - * - */ - -#include "PokemonBDSP_AutoStory_Maps_TestData.h" - -namespace PokemonAutomation{ -namespace NintendoSwitch{ -namespace PokemonBDSP{ - - -extern const char* const TEST_MAP_JSON_TwinleafTown; -extern const char* const TEST_MAP_JSON_VerityLakefront; -extern const char* const TEST_MAP_JSON_LakeVerity; -extern const char* const TEST_MAP_JSON_Route201; -extern const char* const TEST_MAP_JSON_SandgemTown; -extern const char* const TEST_MAP_JSON_Route202; -extern const char* const TEST_MAP_JSON_JubilifeCity; -extern const char* const TEST_MAP_JSON_Route203; -extern const char* const TEST_MAP_JSON_OreburghGate; -extern const char* const TEST_MAP_JSON_OreburghCity; -extern const char* const TEST_MAP_JSON_OreburghMine; -extern const char* const TEST_MAP_JSON_Route204South; -extern const char* const TEST_MAP_JSON_RavagedPath; -extern const char* const TEST_MAP_JSON_Route204North; -extern const char* const TEST_MAP_JSON_FloaromaTown; - - -const std::vector>& test_map_json(){ - static const std::vector> maps{ - {"TwinleafTown", TEST_MAP_JSON_TwinleafTown}, - {"VerityLakefront", TEST_MAP_JSON_VerityLakefront}, - {"LakeVerity", TEST_MAP_JSON_LakeVerity}, - {"Route201", TEST_MAP_JSON_Route201}, - {"SandgemTown", TEST_MAP_JSON_SandgemTown}, - {"Route202", TEST_MAP_JSON_Route202}, - {"JubilifeCity", TEST_MAP_JSON_JubilifeCity}, - {"Route203", TEST_MAP_JSON_Route203}, - {"OreburghGate", TEST_MAP_JSON_OreburghGate}, - {"OreburghCity", TEST_MAP_JSON_OreburghCity}, - {"OreburghMine", TEST_MAP_JSON_OreburghMine}, - {"Route204South", TEST_MAP_JSON_Route204South}, - {"RavagedPath", TEST_MAP_JSON_RavagedPath}, - {"Route204North", TEST_MAP_JSON_Route204North}, - {"FloaromaTown", TEST_MAP_JSON_FloaromaTown}, - }; - return maps; -} - - - -} -} -} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h deleted file mode 100644 index 7370120994..0000000000 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h +++ /dev/null @@ -1,32 +0,0 @@ -/* BDSP AutoStory - Maps test data - * - * From: https://github.com/PokemonAutomation/ - * - * The story's maps as their JSON text, built in so the unit tests (and the - * map accessors, before the program has loaded Packages' copies) read the - * maps without Packages. The .cpp is generated by devtools/maps/bdsp_maps.py - * from the JSON files in Packages' Resources/PokemonBDSP/Maps. - * - */ - -#ifndef PokemonAutomation_PokemonBDSP_AutoStory_Maps_TestData_H -#define PokemonAutomation_PokemonBDSP_AutoStory_Maps_TestData_H - -#include -#include -#include - -namespace PokemonAutomation{ -namespace NintendoSwitch{ -namespace PokemonBDSP{ - - -// Each map's name (its file name without ".json") and its JSON text. -const std::vector>& test_map_json(); - - - -} -} -} -#endif diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp deleted file mode 100644 index 41329cf6ec..0000000000 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp +++ /dev/null @@ -1,850 +0,0 @@ -/* BDSP AutoStory - Maps test data - * - * From: https://github.com/PokemonAutomation/ - * - * generated by devtools/maps/bdsp_maps.py --json-dir Packages/Resources/PokemonBDSP/Maps --cpp SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp, do not edit - * - */ - -namespace PokemonAutomation{ -namespace NintendoSwitch{ -namespace PokemonBDSP{ - - -extern const char* const TEST_MAP_JSON_TwinleafTown = -R"json({ - "name": "TwinleafTown", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_TwinleafTown.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "############........############", - "#######....#........#....#######", - "#######....#........#....#######", - "############........############", - "######....................######", - "######....................######", - "######....................######", - "######..#####.............######", - "######..#####......####...######", - "######..#####......####...######", - "######..######.....####...######", - "######..#D###S.....#D##...######", - "######....................######", - "######....................######", - "######..........S.........######", - "######....................######", - "######....................######", - "######.............#####..######", - "######...####......#####..######", - "######...####......#####..######", - "######...####.....######..######", - "######...#D##.....S#D###..######", - "######....................######", - "######....................######", - "######....................######", - "######....................######", - "######....................######", - "######......########......######", - "################################", - "################################", - "################################", - "################################" - ], - "objects": [ - { - "name": "npc_12_5", - "kind": "npc", - "x": 12, - "y": 5 - }, - { - "name": "npc_12_25", - "kind": "npc", - "x": 12, - "y": 25 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_VerityLakefront = -R"json({ - "name": "VerityLakefront", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "....############################", - "....############################", - "....############################", - "....############################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################..##############", - "################..##############", - "################..##############", - "##############.S....#...........", - "##############......#.....####..", - "##############......#.....####..", - "##############......#...........", - "##############......#...........", - "##############......#vvvvv##vvvv", - "################..........##....", - "################................", - "##################..............", - "##################..............", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################" - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_LakeVerity = -R"json({ - "name": "LakeVerity", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "################################", - "################################", - "################################", - "################################", - "......############....##########", - "......############....##########", - ".......###########......########", - ".......###########......########", - ".......###########~.....########", - ".......###########~~....########", - "################~~~~....########", - "################..~~....########", - "##############.~~~~~..##########", - "##############.~~~~...##########", - "############...~~~..############", - "############........############", - "##########..........############", - "##########..........############", - "############......##############", - "############......##############", - "############......##############", - "############......##############", - "##############..################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################", - "################################" - ], - "objects": [ - { - "name": "npc_16_11", - "kind": "npc", - "x": 16, - "y": 11 - }, - { - "name": "npc_17_11", - "kind": "npc", - "x": 17, - "y": 11 - }, - { - "name": "npc_16_19", - "kind": "npc", - "x": 16, - "y": 19 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_Route201 = -R"json({ - "name": "Route201", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "################################################################", - "################################################################", - "################################################################", - "##########################################~~~~~~~~~~~...........", - "##########################################~~~~~~~~~~~..S........", - "##########################################~~~~~~~~~~~...........", - "##########################################~~~~~~~~~~~...........", - "....####..........######..##....##..####..~~~~~~~~~##...........", - "....####..........######..##....##..####..~~~~~~~~~##...........", - "##........####............................~~~~~~~~~##vvvvv######", - "##........####............................~~~~~~~~~##.....######", - "..........................................~~~~~~~~~##.....######", - "vvvv####vvvvvvvvvvvvvvvvvvvvvvvv........S.~~~~~~~~~##.....######", - "....####............~~~~~~~~~~............................######", - "....................~~~~~~~~~~............................######", - "....................~~~~~~~~~~............................######", - "....................~~~~~~~~~~............................######", - "########.....S......##########............................######", - "########............##########............~~~~~~~~~~~~~~~~######", - "##############....############################~~~~~~~~~~~~######", - "##############....############################~~~~~~~~~~~~######", - "##############....##############################################", - "##############....##############################################", - "##############....##############################################", - "##############....##############################################" - ], - "objects": [ - { - "name": "npc_57_8", - "kind": "npc", - "x": 57, - "y": 8 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_SandgemTown = -R"json({ - "name": "SandgemTown", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "########################......####", - "########################......####", - "####################..........####", - "####################..........####", - "####################..........####", - "####################..........####", - "####################......########", - "####################......########", - "####################......########", - "####################......########", - "########D##....##D##S....S#D######", - ".....S........................####", - "..............................####", - "..............................####", - "..............................####", - "..............................####", - "######........................####", - "######........................####", - "######.........#####..........####", - "##########.....#####..........####", - "##########.....#####..........####", - "##########.....#####..........####", - "#######D##....S#D###..S.......####", - "######........................####", - "######........................####", - "######........................####", - "######....................########", - "####################......########", - "####################......########", - "####################......########", - "####################......########", - "####################......########" - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_Route202 = -R"json({ - "name": "Route202", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "###########........#################", - "###########........#################", - "###########........#################", - "###########........#################", - "###~~~~~~........S..~~~~~......#####", - "###~~~~~~...........~~~~~......#####", - "####~~~~~...........~~~~~......#####", - "###~~~~~~...........~~~~~......#####", - "###~~~~~~...........~~~~~......#####", - "###~~~~~~.....########.........#####", - "#########vvvvv########vvvvvv...~~###", - "#########.....########~~~~~~~~~~~###", - "#######.......########~~~~~~~~~~~###", - "#######...........####~~~~~~~~~~~###", - "###...............####~~~~~~~~~~~###", - "###...............####~~~~~~~~~~~###", - "###............S..####~~~~~~~~~~~###", - "###...............####~~~~~~~~~~~###", - "###...............####..~~~~~~~~~###", - "###~~~~##...............~~~~~~~~~###", - "###~~~~##.................~~~~~~~###", - "###~~~~##....................~~~~###", - "###~~~~##......................#####", - "###~~~~##vvvvv########vvvvvvvvv#####", - "###~~~~##.....########.........#####", - "###~~~~~~......~~~~~~...S......#####", - "###~~~~~~......~~~~~~..........#####", - "###~~~~~~......~~~~~~..........#####", - "###~~~~~~......######..........#####", - "###~~~~~~......######..........#####", - "######################.........#####", - "#####################..........#####" - ], - "objects": [ - { - "name": "npc_26_4", - "kind": "npc", - "x": 26, - "y": 4 - }, - { - "name": "npc_7_13", - "kind": "npc", - "x": 7, - "y": 13 - }, - { - "name": "npc_22_18", - "kind": "npc", - "x": 22, - "y": 18 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_JubilifeCity = -R"json({ - "name": "JubilifeCity", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "##########################################..............########", - "##########################################..............########", - "############################################.....###############", - "############################################......##############", - "############################################......##############", - "############################################......##############", - "############################################......##############", - "#############################################....###############", - "############################....#########.......S.##############", - "############################....#########.........##############", - "#########..#########..######....#########.........##############", - "#########..#########..######....#########.........##############", - "#########..#########..######....#########.........##############", - "#########..#########..######....#########.........##############", - "#########..#########..######....#########.........##############", - "#########..##D###D##..######....####D####.........##############", - "#########.............######...............#.....#######....####", - "#########.............######......................######....####", - "..#######.............######......................######....####", - "..###########S......########...........S.........S##D###....####", - "..#.S.#.......................#..........................#.S####", - "................................................................", - "D...............................................................", - "D...............................................................", - "................................................................", - "..#...#.......................#..........................#..####", - "..############.............####......####...................####", - "..############.............####......####................#######", - "##############.################...##.####..#.....######..#######", - "##############.################...##.####.........#####..#######", - "##############.################...................#D############", - "################################.........................#######", - "################################.........................##D####", - "################################.........................#######", - "################################.........................#######", - "###############............#####.........................#######", - "###############............#####......#####..............#######", - "###############..#########.#####.##########.......######.#######", - "###############..#########.#####.##########.......######.#######", - "###############..#########.#####.###########.....#######.#######", - "##################################..S.##D##.......##D###########", - "###############..#########.#####.........................#######", - "##############...####D####..###..........................#######", - "##############...........................................#######", - "##############.....S.....................................#######", - "##############...........................................#######", - "##############.............#########.....................#######", - "###############............#########.#####...............#######", - "###############............#########.#####...............#######", - "###############.####..####.###############...............#######", - "###############.####..####.###############...............#######", - "###############.####..####.###############...........###########", - "############D##.####..####.############D##...........###########", - "##########.................#########.......#.....#...########.##", - "##########.................#########.................########.##", - "##########............#..#.#########......S..........########.##", - "##########............#..#.#########.................########.##", - "##########.................#########.................########.##", - "###########################################.......##############", - "###########################################.......##############", - "########################################.##.......##############", - "########################################.####...################", - "########################################..........##############", - "########################################..........##############" - ], - "objects": [ - { - "name": "npc_36_16", - "kind": "npc", - "x": 36, - "y": 16 - }, - { - "name": "npc_15_18", - "kind": "npc", - "x": 15, - "y": 18 - }, - { - "name": "npc_36_25", - "kind": "npc", - "x": 36, - "y": 25 - }, - { - "name": "npc_55_33", - "kind": "npc", - "x": 55, - "y": 33 - }, - { - "name": "npc_46_35", - "kind": "npc", - "x": 46, - "y": 35 - }, - { - "name": "npc_26_42", - "kind": "npc", - "x": 26, - "y": 42 - }, - { - "name": "npc_44_44", - "kind": "npc", - "x": 44, - "y": 44 - }, - { - "name": "npc_52_46", - "kind": "npc", - "x": 52, - "y": 46 - }, - { - "name": "npc_54_46", - "kind": "npc", - "x": 54, - "y": 46 - }, - { - "name": "npc_17_55", - "kind": "npc", - "x": 17, - "y": 55 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_Route203 = -R"json({ - "name": "Route203", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "#############################################################", - "#############################################################", - "#############################################################", - "#############################################################", - "#####..............###########..~~~~#########################", - "#####..............###########.#.~~~..~~~~~~~~~~~~~~#########", - "#####..................#######........~~~~~~~~~~~~~.....#####", - "#####..................###############~~~~~~~~~~~....S..#####", - "#####~~~~##...####.....#......########~~~~~~~~~~~.......#####", - "#####~~~~##...####.....#......########~~~~~~~~~~~.......D####", - "#####~~~~##...####..#..#..S...########~~~~~~~~~~~.......#####", - "#####~~~~##...####.....#......########~~~~~~~~~~~.......#####", - "#####~~~~##...####.....#....~~~~~~~~##~~~~~~~~~S...~~~..#####", - "#####~~~~##...####vvvvv#...~~...~.~~##~~~~~~~~~....~~~..#####", - "#####~~................#....######~~##.....~~....##~~~..#####", - "#####..................#....######~~##vvvvvvvvvvv##~~~..#####", - "#####....S.............#....~~~..~~~.............~~~~~..#####", - "...........................~~~~...~~.............~~~~~..#####", - "...........................~~.....~~.............~~~~~..#####", - "..........................~~~~.....~##..........~~~~~~..#####", - "..........................~~~~~.~~~~#########################", - "#############################################################", - "#############################################################", - "#############################################################" - ], - "objects": [ - { - "name": "npc_49_8", - "kind": "npc", - "x": 49, - "y": 8 - }, - { - "name": "npc_13_10", - "kind": "npc", - "x": 13, - "y": 10 - }, - { - "name": "npc_31_16", - "kind": "npc", - "x": 31, - "y": 16 - }, - { - "name": "npc_43_17", - "kind": "npc", - "x": 43, - "y": 17 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_OreburghGate = -R"json({ - "name": "OreburghGate", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghGate.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "################################", - "################################", - "################################", - "################################", - "############..#......###########", - "###########..........###########", - "###########........#.###########", - "###########..###################", - "###########..###################", - "###########..###################", - "###########.####################", - "############.###################", - "###########.####################", - "###########..###################", - "###########..###################", - "###########..###################", - "###########..###################", - "###########..###################", - "############.###################", - "###########..###################", - "#####...##...##########...#.####", - "####....##...##########.....####", - "###D........................D###", - "####...#....................####", - "###########..............#.#####", - "############.......#############", - "###########..#.#...#############", - "################################", - "################################", - "################################", - "################################", - "################################" - ], - "objects": [ - { - "name": "npc_7_20", - "kind": "npc", - "x": 7, - "y": 20 - }, - { - "name": "npc_24_21", - "kind": "npc", - "x": 24, - "y": 21 - }, - { - "name": "npc_17_25", - "kind": "npc", - "x": 17, - "y": 25 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_OreburghCity = -R"json({ - "name": "OreburghCity", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghCity.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "#########################################......#################", - "#########################################...S..#################", - "#########################################......#################", - "#########################################......#################", - "#########################################...####################", - "#########################################...####################", - "#########################################....###################", - "############.#####.######.#.############.....###################", - "###########..#####..#####...############.....###################", - "#########....#####..#####...############.....###################", - "##.....########D######D######D##########.....###################", - "##..S..###..........................####........#.#...##########", - "##..................................####.....S........##########", - "#D..................................####..............##########", - "##..................................####..............####.#####", - "##..................................####..............####.#####", - "##.....###.............#######......#D##..............####.#####", - "##.....##.......####...#######...............#####....####.#####", - "#########.......####.#.#######..............######......#.######", - "#########.......####...#######..............######.....#########", - "#########.......#D####S###D###...............##D##.....#########", - "#########........................................#.....#########", - "#########........................................#.....#########", - "#########........................................#....##########", - "#########........................................#....##########", - "#########........................................#....##########", - "##########.#.#..########.........................#....##########", - "########################.######.############.....#....##########", - "########################.######.###........#.....#....##D#######", - "########################.######.###.#..#...#.....#.........#####", - "############################################.....###############", - "############################################.....###############", - "############################################.....###############", - "############################################.....###############", - "############################################.....###############", - "############################################.....###############", - "############################################.....##D############", - "###################################.########.....#...........###", - "###################################.....####.....#...........###", - "###################################.....####.....#...........###", - "###################################....#####.....#...........###", - "#####################################..#.........#...........###", - "#####################################..#..#.#....#....#.#....###", - "#####################################..#..#.#....#....#.#....###", - "###################################....#.....................###", - "###################################....#.....................###", - "###################################....#.....................###", - "###################################....#.....................###", - "###################################....#.....................###", - "###################################..###..#.#................###", - "###################################..###..#.#...#.#########.####", - "###################################..###........#.#########.####", - "###################################....#..........#####.....####", - "###################################...............#####.....####", - "#####################################.............##.........###", - "#####################################..####.#.....###.....######", - "#####################################..####.#S....###.....######", - "###########################################.......####.......###", - "############################################.....#####.......###", - "############################################.....#####.....#####", - "######################################################..#..#####", - "################################################################", - "################################################################", - "################################################################" - ], - "objects": [ - { - "name": "npc_10_16", - "kind": "npc", - "x": 10, - "y": 16 - }, - { - "name": "npc_11_25", - "kind": "npc", - "x": 11, - "y": 25 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_OreburghMine = -R"json({ - "name": "OreburghMine", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "################################", - "###############D################", - "#############.....##############", - "#############.....##############", - "#############.....##############", - "#############.....##############", - "#############.....##############", - "#############...################", - "#############...################", - "#############.....##############", - "#############..#..##############", - "###############...##############", - "#############...################", - "#############.....##############", - "###############...##############", - "########...####..............###", - "######.....##.................##", - "##.#..........................##", - "##....####################....##", - "##vvv##..................#....##", - "##....#..................#....##", - "##.##.#..................#....##", - "##..###..................###..##", - "##..###..................###..##", - "##....#..................##...##", - "##.##.#..................#....##", - "####..####################....##", - "####..####################....##", - "#####............#.#........####", - "######......................####", - "################################", - "################################" - ], - "objects": [ - { - "name": "npc_20_15", - "kind": "npc", - "x": 20, - "y": 15 - }, - { - "name": "npc_21_15", - "kind": "npc", - "x": 21, - "y": 15 - }, - { - "name": "npc_27_15", - "kind": "npc", - "x": 27, - "y": 15 - }, - { - "name": "npc_26_20", - "kind": "npc", - "x": 26, - "y": 20 - }, - { - "name": "npc_8_28", - "kind": "npc", - "x": 8, - "y": 28 - }, - { - "name": "npc_18_28", - "kind": "npc", - "x": 18, - "y": 28 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_Route204South = -R"json({ - "name": "Route204South", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204South.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "################################", - "###########D###.################", - "########..S.....################", - "########........################", - "########........################", - "##########...~##################", - "##########...~##################", - "##########..~~##################", - "##########..~~##################", - "####~~~~~~~~~~##################", - "####~~~~~~~~~~##################", - "####~~~~~~~~~~##################", - "####~~~~~~~~~~############...###", - "####~~~~~~~~~~############....##", - "####~~~~~~~~~~#..###############", - "##~~~~~~~~~~~~#..###############", - "##~~~~~~~~~~~~#..###############", - "##~~~~~~~~~~~~S.################", - "##~~~~~.........################", - "##~~~~~.........#.##############", - "##~~~~~.........#.##############", - "##.#########....#.##############", - "############....#......~########", - "############....######~~########", - "############....######~~########", - "############....######~~########", - "############....######~~########", - "############....######~~########", - "###.######.#....#..~~~~~########", - "##..######.#....#...~~~~########", - "##########.#....#.......########", - "############....######..########" - ], - "objects": [ - { - "name": "npc_11_8", - "kind": "npc", - "x": 11, - "y": 8 - }, - { - "name": "npc_7_18", - "kind": "npc", - "x": 7, - "y": 18 - }, - { - "name": "npc_12_21", - "kind": "npc", - "x": 12, - "y": 21 - } - ] -} -)json"; - - - - -} -} -} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp deleted file mode 100644 index 130ffd216c..0000000000 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* BDSP AutoStory - Maps test data - * - * From: https://github.com/PokemonAutomation/ - * - * generated by devtools/maps/bdsp_maps.py --json-dir Packages/Resources/PokemonBDSP/Maps --cpp SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp, do not edit - * - */ - -namespace PokemonAutomation{ -namespace NintendoSwitch{ -namespace PokemonBDSP{ - - -extern const char* const TEST_MAP_JSON_RavagedPath = -R"json({ - "name": "RavagedPath", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RavagedPath.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "#################################", - "..#####################.........#", - "....############................#", - "....############................#", - "....############................#", - "....############................#", - "....############................#", - "....##.#####.###................#", - "....##.#....#.##................#", - "....##.##.#...#########.........#", - "....##....#..##########.........#", - "....##.#.#.......#...############", - "....###.....######...############", - "....##############....#.......###", - "....##############....#.......###", - "..............####....##......###", - "..............####...#######D####", - "..............####...############", - "..............####...####.......#", - "..............####...####.......#", - "..............####...####.......#", - "..............####...####.......#", - "..............#####D#####.......#", - "..............###########.......#", - "..............###########.......#" - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_Route204North = -R"json({ - "name": "Route204North", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "########.#...###################", - "########.#...###################", - "####.....#...########.##########", - "##########...#......#.##########", - "#####....#...#......#...........", - "#####....#~~~#......#...######..", - "#####....#~~####################", - "##########~~~.........##########", - "##........~~~~~.......##########", - "##..######.~~~~..S....##########", - "###.#....#.~~~........##########", - "##..#....#.~~.........##########", - "##########..............########", - "##########..............########", - "##########...####~~~~~~~########", - "##########vvv####~~~~~~~########", - "##########...######~~~~~########", - "##########...######~~~~~########", - "##########...######~~~~~########", - "##########...######~.~~~########", - "##########............~~########", - "##########............##########", - "##########............##########", - "##########...##.....#.##########", - "##########...##.......##########", - "##########...###################", - "##########...#######.###########", - "##########............##########", - "##########............##########", - "##########............##########", - "##########............##########", - "##########...###################" - ], - "objects": [ - { - "name": "npc_31_4", - "kind": "npc", - "x": 31, - "y": 4 - }, - { - "name": "npc_15_7", - "kind": "npc", - "x": 15, - "y": 7 - }, - { - "name": "npc_16_7", - "kind": "npc", - "x": 16, - "y": 7 - }, - { - "name": "npc_20_12", - "kind": "npc", - "x": 20, - "y": 12 - }, - { - "name": "npc_17_20", - "kind": "npc", - "x": 17, - "y": 20 - } - ] -} -)json"; - -extern const char* const TEST_MAP_JSON_FloaromaTown = -R"json({ - "name": "FloaromaTown", - "source": { - "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_FloaromaTown.cpp", - "revision": "ddcbdb21c1dc", - "date": "2026-11-01" - }, - "tiles": [ - "######........................##", - "##..##........................##", - "..............................##", - "..............................##", - "..............................##", - "..............................##", - "..............................##", - "..................#####.......##", - "..................#####.......##", - "..................#####.......##", - "..................#####.......##", - "..........####...S##.##.......##", - "..........####................##", - "..........####................##", - "..........#D##................##", - ".......................####..S##", - ".......................####...##", - ".......................#D##...##", - "..............................##", - ".............S..................", - "................................", - "................................", - "................................", - "..............#####....####...##", - "..............#####....####...##", - "..............#####....####...##", - "..............##D##....#D##...##", - "..............................##", - "..............................##", - "..............................##", - "########.#...###################", - "########.#...###################" - ], - "objects": [ - { - "name": "npc_2_1", - "kind": "npc", - "x": 2, - "y": 1 - }, - { - "name": "npc_3_1", - "kind": "npc", - "x": 3, - "y": 1 - }, - { - "name": "npc_6_10", - "kind": "npc", - "x": 6, - "y": 10 - }, - { - "name": "npc_23_11", - "kind": "npc", - "x": 23, - "y": 11 - }, - { - "name": "npc_19_21", - "kind": "npc", - "x": 19, - "y": 21 - }, - { - "name": "npc_2_23", - "kind": "npc", - "x": 2, - "y": 23 - }, - { - "name": "npc_3_23", - "kind": "npc", - "x": 3, - "y": 23 - }, - { - "name": "npc_11_26", - "kind": "npc", - "x": 11, - "y": 26 - } - ] -} -)json"; - - - - -} -} -} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp index aedb4a723e..2a79840580 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp @@ -20,7 +20,7 @@ using namespace Pokemon; // Platinum's map_data_005/006 have the same terrain. // Console checks: the border sign read from (54,4) facing east, row 3 open // east of the grass to Sandgem's fence, row 5 to Sandgem without a stop, -// the Potion lady on row 3, wandering (2026-10-28 to 30, CFR "walk"). +// the Potion lady on row 3 (2026-10-28 to 30, CFR "walk"). // Status: no checkpoint has run on this grid yet. 00.02 to 00.04 and the // mart_lady checkpoint passed on the image-traced grid it replaces (3/4 // of a tile per row) and must be re-run. @@ -44,11 +44,11 @@ using namespace Pokemon; // stands at (57,8) looking west (not yet seen on the console). Route 201 // has no trainers and no items on the ground. Wanderers, left off the grid: // a Breeder around (27,15), columns 26..28, rows 14..16; a Lass along row -// 16, columns 44..48. The Poke Mart lady, who gives 10 Potions, stands still -// at (44,3) in Diamond but wanders in BDSP (eight runs, r113a..r120a, never -// got her talk), so she is left off too and 00.04 buys its Potions in -// Sandgem. Rowan, Barry and the briefcase by the lake are hidden by story -// flags and left off. +// 16, columns 44..48. The Poke Mart lady, who gives 10 Potions, stands +// still at (44,3) in Diamond's events file and on the console (the user, +// 2026-11-01): left off the grid, since her talk is walked to, not planned +// (r113a..r120a missed her by the walk, not by her moving). Rowan, Barry +// and the briefcase by the lake are hidden by story flags and left off. const TileGrid& grid(){ return story_grid("Route201"); } @@ -66,8 +66,8 @@ const TilePos BORDER_SIGN{55, 4}; // On the console (by hand, then through the Lab Console; 99715d5d6 and // f823453e9 on bdsp/new-game-intro-v2) she stood at (43,3), and walking // west along row 3 from the trees at its east end stopped at (44,3), facing -// her; her lines need one A each, 1.5 s apart. Later runs (r113a..r120a) -// found her wandering. +// her; her lines need one A each, 1.5 s apart. r113a..r120a +// missed her talk walking to her, not because she moved. // Checked on the console (2026-10-30, CFR "walk"), twice: from the grass's // west edge on row 5, north stops at the trees 2 rows up, and east from // there stops at her. r135a missed her walking west along row 4. diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/FloaromaTown.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/FloaromaTown.json new file mode 100644 index 0000000000..733c172f5c --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/FloaromaTown.json @@ -0,0 +1,92 @@ +{ + "name": "FloaromaTown", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_FloaromaTown.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "######........................##", + "##..##........................##", + "..............................##", + "..............................##", + "..............................##", + "..............................##", + "..............................##", + "..................#####.......##", + "..................#####.......##", + "..................#####.......##", + "..................#####.......##", + "..........####...S##.##.......##", + "..........####................##", + "..........####................##", + "..........#D##................##", + ".......................####..S##", + ".......................####...##", + ".......................#D##...##", + "..............................##", + ".............S..................", + "................................", + "................................", + "................................", + "..............#####....####...##", + "..............#####....####...##", + "..............#####....####...##", + "..............##D##....#D##...##", + "..............................##", + "..............................##", + "..............................##", + "########.#...###################", + "########.#...###################" + ], + "objects": [ + { + "name": "npc_2_1", + "kind": "npc", + "x": 2, + "y": 1 + }, + { + "name": "npc_3_1", + "kind": "npc", + "x": 3, + "y": 1 + }, + { + "name": "npc_6_10", + "kind": "npc", + "x": 6, + "y": 10 + }, + { + "name": "npc_23_11", + "kind": "npc", + "x": 23, + "y": 11 + }, + { + "name": "npc_19_21", + "kind": "npc", + "x": 19, + "y": 21 + }, + { + "name": "npc_2_23", + "kind": "npc", + "x": 2, + "y": 23 + }, + { + "name": "npc_3_23", + "kind": "npc", + "x": 3, + "y": 23 + }, + { + "name": "npc_11_26", + "kind": "npc", + "x": 11, + "y": 26 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/JubilifeCity.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/JubilifeCity.json new file mode 100644 index 0000000000..7c7c5574c0 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/JubilifeCity.json @@ -0,0 +1,136 @@ +{ + "name": "JubilifeCity", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_JubilifeCity.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "##########################################..............########", + "##########################################..............########", + "############################################.....###############", + "############################################......##############", + "############################################......##############", + "############################################......##############", + "############################################......##############", + "#############################################....###############", + "############################....#########.......S.##############", + "############################....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..#########..######....#########.........##############", + "#########..##D###D##..######....####D####.........##############", + "#########.............######...............#.....#######....####", + "#########.............######......................######....####", + "..#######.............######......................######....####", + "..###########S......########...........S.........S##D###....####", + "..#.S.#.......................#..........................#.S####", + "................................................................", + "D...............................................................", + "D...............................................................", + "................................................................", + "..#...#.......................#..........................#..####", + "..############.............####......####...................####", + "..############.............####......####................#######", + "##############.################...##.####..#.....######..#######", + "##############.################...##.####.........#####..#######", + "##############.################...................#D############", + "################################.........................#######", + "################################.........................##D####", + "################################.........................#######", + "################################.........................#######", + "###############............#####.........................#######", + "###############............#####......#####..............#######", + "###############..#########.#####.##########.......######.#######", + "###############..#########.#####.##########.......######.#######", + "###############..#########.#####.###########.....#######.#######", + "##################################..S.##D##.......##D###########", + "###############..#########.#####.........................#######", + "##############...####D####..###..........................#######", + "##############...........................................#######", + "##############.....S.....................................#######", + "##############...........................................#######", + "##############.............#########.....................#######", + "###############............#########.#####...............#######", + "###############............#########.#####...............#######", + "###############.####..####.###############...............#######", + "###############.####..####.###############...............#######", + "###############.####..####.###############...........###########", + "############D##.####..####.############D##...........###########", + "##########.................#########.......#.....#...########.##", + "##########.................#########.................########.##", + "##########............#..#.#########......S..........########.##", + "##########............#..#.#########.................########.##", + "##########.................#########.................########.##", + "###########################################.......##############", + "###########################################.......##############", + "########################################.##.......##############", + "########################################.####...################", + "########################################..........##############", + "########################################..........##############" + ], + "objects": [ + { + "name": "npc_36_16", + "kind": "npc", + "x": 36, + "y": 16 + }, + { + "name": "npc_15_18", + "kind": "npc", + "x": 15, + "y": 18 + }, + { + "name": "npc_36_25", + "kind": "npc", + "x": 36, + "y": 25 + }, + { + "name": "npc_55_33", + "kind": "npc", + "x": 55, + "y": 33 + }, + { + "name": "npc_46_35", + "kind": "npc", + "x": 46, + "y": 35 + }, + { + "name": "npc_26_42", + "kind": "npc", + "x": 26, + "y": 42 + }, + { + "name": "npc_44_44", + "kind": "npc", + "x": 44, + "y": 44 + }, + { + "name": "npc_52_46", + "kind": "npc", + "x": 52, + "y": 46 + }, + { + "name": "npc_54_46", + "kind": "npc", + "x": 54, + "y": 46 + }, + { + "name": "npc_17_55", + "kind": "npc", + "x": 17, + "y": 55 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/LakeVerity.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/LakeVerity.json new file mode 100644 index 0000000000..74cc0b162e --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/LakeVerity.json @@ -0,0 +1,62 @@ +{ + "name": "LakeVerity", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################", + "################################", + "################################", + "################################", + "......############....##########", + "......############....##########", + ".......###########......########", + ".......###########......########", + ".......###########~.....########", + ".......###########~~....########", + "################~~~~....########", + "################..~~....########", + "##############.~~~~~..##########", + "##############.~~~~...##########", + "############...~~~..############", + "############........############", + "##########..........############", + "##########..........############", + "############......##############", + "############......##############", + "############......##############", + "############......##############", + "##############..################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################" + ], + "objects": [ + { + "name": "npc_16_11", + "kind": "npc", + "x": 16, + "y": 11 + }, + { + "name": "npc_17_11", + "kind": "npc", + "x": 17, + "y": 11 + }, + { + "name": "npc_16_19", + "kind": "npc", + "x": 16, + "y": 19 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghCity.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghCity.json new file mode 100644 index 0000000000..2e5dfc89b8 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghCity.json @@ -0,0 +1,88 @@ +{ + "name": "OreburghCity", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghCity.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "#########################################......#################", + "#########################################...S..#################", + "#########################################......#################", + "#########################################......#################", + "#########################################...####################", + "#########################################...####################", + "#########################################....###################", + "############.#####.######.#.############.....###################", + "###########..#####..#####...############.....###################", + "#########....#####..#####...############.....###################", + "##.....########D######D######D##########.....###################", + "##..S..###..........................####........#.#...##########", + "##..................................####.....S........##########", + "#D..................................####..............##########", + "##..................................####..............####.#####", + "##..................................####..............####.#####", + "##.....###.............#######......#D##..............####.#####", + "##.....##.......####...#######...............#####....####.#####", + "#########.......####.#.#######..............######......#.######", + "#########.......####...#######..............######.....#########", + "#########.......#D####S###D###...............##D##.....#########", + "#########........................................#.....#########", + "#########........................................#.....#########", + "#########........................................#....##########", + "#########........................................#....##########", + "#########........................................#....##########", + "##########.#.#..########.........................#....##########", + "########################.######.############.....#....##########", + "########################.######.###........#.....#....##D#######", + "########################.######.###.#..#...#.....#.........#####", + "############################################.....###############", + "############################################.....###############", + "############################################.....###############", + "############################################.....###############", + "############################################.....###############", + "############################################.....###############", + "############################################.....##D############", + "###################################.########.....#...........###", + "###################################.....####.....#...........###", + "###################################.....####.....#...........###", + "###################################....#####.....#...........###", + "#####################################..#.........#...........###", + "#####################################..#..#.#....#....#.#....###", + "#####################################..#..#.#....#....#.#....###", + "###################################....#.....................###", + "###################################....#.....................###", + "###################################....#.....................###", + "###################################....#.....................###", + "###################################....#.....................###", + "###################################..###..#.#................###", + "###################################..###..#.#...#.#########.####", + "###################################..###........#.#########.####", + "###################################....#..........#####.....####", + "###################################...............#####.....####", + "#####################################.............##.........###", + "#####################################..####.#.....###.....######", + "#####################################..####.#S....###.....######", + "###########################################.......####.......###", + "############################################.....#####.......###", + "############################################.....#####.....#####", + "######################################################..#..#####", + "################################################################", + "################################################################", + "################################################################" + ], + "objects": [ + { + "name": "npc_10_16", + "kind": "npc", + "x": 10, + "y": 16 + }, + { + "name": "npc_11_25", + "kind": "npc", + "x": 11, + "y": 25 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghGate.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghGate.json new file mode 100644 index 0000000000..4d5c076f41 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghGate.json @@ -0,0 +1,62 @@ +{ + "name": "OreburghGate", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghGate.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################", + "################################", + "################################", + "################################", + "############..#......###########", + "###########..........###########", + "###########........#.###########", + "###########..###################", + "###########..###################", + "###########..###################", + "###########.####################", + "############.###################", + "###########.####################", + "###########..###################", + "###########..###################", + "###########..###################", + "###########..###################", + "###########..###################", + "############.###################", + "###########..###################", + "#####...##...##########...#.####", + "####....##...##########.....####", + "###D........................D###", + "####...#....................####", + "###########..............#.#####", + "############.......#############", + "###########..#.#...#############", + "################################", + "################################", + "################################", + "################################", + "################################" + ], + "objects": [ + { + "name": "npc_7_20", + "kind": "npc", + "x": 7, + "y": 20 + }, + { + "name": "npc_24_21", + "kind": "npc", + "x": 24, + "y": 21 + }, + { + "name": "npc_17_25", + "kind": "npc", + "x": 17, + "y": 25 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghMine.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghMine.json new file mode 100644 index 0000000000..64d1f82b96 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/OreburghMine.json @@ -0,0 +1,80 @@ +{ + "name": "OreburghMine", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_OreburghMine.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################", + "###############D################", + "#############.....##############", + "#############.....##############", + "#############.....##############", + "#############.....##############", + "#############.....##############", + "#############...################", + "#############...################", + "#############.....##############", + "#############..#..##############", + "###############...##############", + "#############...################", + "#############.....##############", + "###############...##############", + "########...####..............###", + "######.....##.................##", + "##.#..........................##", + "##....####################....##", + "##vvv##..................#....##", + "##....#..................#....##", + "##.##.#..................#....##", + "##..###..................###..##", + "##..###..................###..##", + "##....#..................##...##", + "##.##.#..................#....##", + "####..####################....##", + "####..####################....##", + "#####............#.#........####", + "######......................####", + "################################", + "################################" + ], + "objects": [ + { + "name": "npc_20_15", + "kind": "npc", + "x": 20, + "y": 15 + }, + { + "name": "npc_21_15", + "kind": "npc", + "x": 21, + "y": 15 + }, + { + "name": "npc_27_15", + "kind": "npc", + "x": 27, + "y": 15 + }, + { + "name": "npc_26_20", + "kind": "npc", + "x": 26, + "y": 20 + }, + { + "name": "npc_8_28", + "kind": "npc", + "x": 8, + "y": 28 + }, + { + "name": "npc_18_28", + "kind": "npc", + "x": 18, + "y": 28 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/RavagedPath.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/RavagedPath.json new file mode 100644 index 0000000000..3f366c4d02 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/RavagedPath.json @@ -0,0 +1,64 @@ +{ + "name": "RavagedPath", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RavagedPath.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "#################################", + "..#####################.........#", + "....############................#", + "....############................#", + "....############................#", + "....############................#", + "....############................#", + "....##.#####.###................#", + "....##.#....#.##................#", + "....##.##.#...#########.........#", + "....##....#..##########.........#", + "....##.#.#.......#...############", + "....###.....######...############", + "....##############....#.......###", + "....##############....#.......###", + "..............####....##......###", + "..............####...#######D####", + "..............####...############", + "..............####...####.......#", + "..............####...####.......#", + "..............####...####.......#", + "..............####...####.......#", + "..............#####D#####.......#", + "..............###########.......#", + "..............###########.......#" + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route201.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route201.json new file mode 100644 index 0000000000..e2e53e12d1 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route201.json @@ -0,0 +1,43 @@ +{ + "name": "Route201", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route201.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################################################", + "################################################################", + "################################################################", + "##########################################~~~~~~~~~~~...........", + "##########################################~~~~~~~~~~~..S........", + "##########################################~~~~~~~~~~~...........", + "##########################################~~~~~~~~~~~...........", + "....####..........######..##....##..####..~~~~~~~~~##...........", + "....####..........######..##....##..####..~~~~~~~~~##...........", + "##........####............................~~~~~~~~~##vvvvv######", + "##........####............................~~~~~~~~~##.....######", + "..........................................~~~~~~~~~##.....######", + "vvvv####vvvvvvvvvvvvvvvvvvvvvvvv........S.~~~~~~~~~##.....######", + "....####............~~~~~~~~~~............................######", + "....................~~~~~~~~~~............................######", + "....................~~~~~~~~~~............................######", + "....................~~~~~~~~~~............................######", + "########.....S......##########............................######", + "########............##########............~~~~~~~~~~~~~~~~######", + "##############....############################~~~~~~~~~~~~######", + "##############....############################~~~~~~~~~~~~######", + "##############....##############################################", + "##############....##############################################", + "##############....##############################################", + "##############....##############################################" + ], + "objects": [ + { + "name": "npc_57_8", + "kind": "npc", + "x": 57, + "y": 8 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route202.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route202.json new file mode 100644 index 0000000000..362f4e0df8 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route202.json @@ -0,0 +1,62 @@ +{ + "name": "Route202", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route202.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "###########........#################", + "###########........#################", + "###########........#################", + "###########........#################", + "###~~~~~~........S..~~~~~......#####", + "###~~~~~~...........~~~~~......#####", + "####~~~~~...........~~~~~......#####", + "###~~~~~~...........~~~~~......#####", + "###~~~~~~...........~~~~~......#####", + "###~~~~~~.....########.........#####", + "#########vvvvv########vvvvvv...~~###", + "#########.....########~~~~~~~~~~~###", + "#######.......########~~~~~~~~~~~###", + "#######...........####~~~~~~~~~~~###", + "###...............####~~~~~~~~~~~###", + "###...............####~~~~~~~~~~~###", + "###............S..####~~~~~~~~~~~###", + "###...............####~~~~~~~~~~~###", + "###...............####..~~~~~~~~~###", + "###~~~~##...............~~~~~~~~~###", + "###~~~~##.................~~~~~~~###", + "###~~~~##....................~~~~###", + "###~~~~##......................#####", + "###~~~~##vvvvv########vvvvvvvvv#####", + "###~~~~##.....########.........#####", + "###~~~~~~......~~~~~~...S......#####", + "###~~~~~~......~~~~~~..........#####", + "###~~~~~~......~~~~~~..........#####", + "###~~~~~~......######..........#####", + "###~~~~~~......######..........#####", + "######################.........#####", + "#####################..........#####" + ], + "objects": [ + { + "name": "npc_26_4", + "kind": "npc", + "x": 26, + "y": 4 + }, + { + "name": "npc_7_13", + "kind": "npc", + "x": 7, + "y": 13 + }, + { + "name": "npc_22_18", + "kind": "npc", + "x": 22, + "y": 18 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route203.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route203.json new file mode 100644 index 0000000000..b646ec65c9 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route203.json @@ -0,0 +1,60 @@ +{ + "name": "Route203", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route203.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "#############################################################", + "#############################################################", + "#############################################################", + "#############################################################", + "#####..............###########..~~~~#########################", + "#####..............###########.#.~~~..~~~~~~~~~~~~~~#########", + "#####..................#######........~~~~~~~~~~~~~.....#####", + "#####..................###############~~~~~~~~~~~....S..#####", + "#####~~~~##...####.....#......########~~~~~~~~~~~.......#####", + "#####~~~~##...####.....#......########~~~~~~~~~~~.......D####", + "#####~~~~##...####..#..#..S...########~~~~~~~~~~~.......#####", + "#####~~~~##...####.....#......########~~~~~~~~~~~.......#####", + "#####~~~~##...####.....#....~~~~~~~~##~~~~~~~~~S...~~~..#####", + "#####~~~~##...####vvvvv#...~~...~.~~##~~~~~~~~~....~~~..#####", + "#####~~................#....######~~##.....~~....##~~~..#####", + "#####..................#....######~~##vvvvvvvvvvv##~~~..#####", + "#####....S.............#....~~~..~~~.............~~~~~..#####", + "...........................~~~~...~~.............~~~~~..#####", + "...........................~~.....~~.............~~~~~..#####", + "..........................~~~~.....~##..........~~~~~~..#####", + "..........................~~~~~.~~~~#########################", + "#############################################################", + "#############################################################", + "#############################################################" + ], + "objects": [ + { + "name": "npc_49_8", + "kind": "npc", + "x": 49, + "y": 8 + }, + { + "name": "npc_13_10", + "kind": "npc", + "x": 13, + "y": 10 + }, + { + "name": "npc_31_16", + "kind": "npc", + "x": 31, + "y": 16 + }, + { + "name": "npc_43_17", + "kind": "npc", + "x": 43, + "y": 17 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route204North.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route204North.json new file mode 100644 index 0000000000..6ec036b174 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route204North.json @@ -0,0 +1,74 @@ +{ + "name": "Route204North", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "########.#...###################", + "########.#...###################", + "####.....#...########.##########", + "##########...#......#.##########", + "#####....#...#......#...........", + "#####....#~~~#......#...######..", + "#####....#~~####################", + "##########~~~.........##########", + "##........~~~~~.......##########", + "##..######.~~~~..S....##########", + "###.#....#.~~~........##########", + "##..#....#.~~.........##########", + "##########..............########", + "##########..............########", + "##########...####~~~~~~~########", + "##########vvv####~~~~~~~########", + "##########...######~~~~~########", + "##########...######~~~~~########", + "##########...######~~~~~########", + "##########...######~.~~~########", + "##########............~~########", + "##########............##########", + "##########............##########", + "##########...##.....#.##########", + "##########...##.......##########", + "##########...###################", + "##########...#######.###########", + "##########............##########", + "##########............##########", + "##########............##########", + "##########............##########", + "##########...###################" + ], + "objects": [ + { + "name": "npc_31_4", + "kind": "npc", + "x": 31, + "y": 4 + }, + { + "name": "npc_15_7", + "kind": "npc", + "x": 15, + "y": 7 + }, + { + "name": "npc_16_7", + "kind": "npc", + "x": 16, + "y": 7 + }, + { + "name": "npc_20_12", + "kind": "npc", + "x": 20, + "y": 12 + }, + { + "name": "npc_17_20", + "kind": "npc", + "x": 17, + "y": 20 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route204South.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route204South.json new file mode 100644 index 0000000000..752d5baf82 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/Route204South.json @@ -0,0 +1,62 @@ +{ + "name": "Route204South", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204South.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "################################", + "###########D###.################", + "########..S.....################", + "########........################", + "########........################", + "##########...~##################", + "##########...~##################", + "##########..~~##################", + "##########..~~##################", + "####~~~~~~~~~~##################", + "####~~~~~~~~~~##################", + "####~~~~~~~~~~##################", + "####~~~~~~~~~~############...###", + "####~~~~~~~~~~############....##", + "####~~~~~~~~~~#..###############", + "##~~~~~~~~~~~~#..###############", + "##~~~~~~~~~~~~#..###############", + "##~~~~~~~~~~~~S.################", + "##~~~~~.........################", + "##~~~~~.........#.##############", + "##~~~~~.........#.##############", + "##.#########....#.##############", + "############....#......~########", + "############....######~~########", + "############....######~~########", + "############....######~~########", + "############....######~~########", + "############....######~~########", + "###.######.#....#..~~~~~########", + "##..######.#....#...~~~~########", + "##########.#....#.......########", + "############....######..########" + ], + "objects": [ + { + "name": "npc_11_8", + "kind": "npc", + "x": 11, + "y": 8 + }, + { + "name": "npc_7_18", + "kind": "npc", + "x": 7, + "y": 18 + }, + { + "name": "npc_12_21", + "kind": "npc", + "x": 12, + "y": 21 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/SandgemTown.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/SandgemTown.json new file mode 100644 index 0000000000..b7fcdb8c29 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/SandgemTown.json @@ -0,0 +1,42 @@ +{ + "name": "SandgemTown", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_SandgemTown.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "########################......####", + "########################......####", + "####################..........####", + "####################..........####", + "####################..........####", + "####################..........####", + "####################......########", + "####################......########", + "####################......########", + "####################......########", + "########D##....##D##S....S#D######", + ".....S........................####", + "..............................####", + "..............................####", + "..............................####", + "..............................####", + "######........................####", + "######........................####", + "######.........#####..........####", + "##########.....#####..........####", + "##########.....#####..........####", + "##########.....#####..........####", + "#######D##....S#D###..S.......####", + "######........................####", + "######........................####", + "######........................####", + "######....................########", + "####################......########", + "####################......########", + "####################......########", + "####################......########", + "####################......########" + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/TwinleafTown.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/TwinleafTown.json new file mode 100644 index 0000000000..92dfcf72c1 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/TwinleafTown.json @@ -0,0 +1,56 @@ +{ + "name": "TwinleafTown", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_TwinleafTown.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "############........############", + "#######....#........#....#######", + "#######....#........#....#######", + "############........############", + "######....................######", + "######....................######", + "######....................######", + "######..#####.............######", + "######..#####......####...######", + "######..#####......####...######", + "######..######.....####...######", + "######..#D###S.....#D##...######", + "######....................######", + "######....................######", + "######..........S.........######", + "######....................######", + "######....................######", + "######.............#####..######", + "######...####......#####..######", + "######...####......#####..######", + "######...####.....######..######", + "######...#D##.....S#D###..######", + "######....................######", + "######....................######", + "######....................######", + "######....................######", + "######....................######", + "######......########......######", + "################################", + "################################", + "################################", + "################################" + ], + "objects": [ + { + "name": "npc_12_5", + "kind": "npc", + "x": 12, + "y": 5 + }, + { + "name": "npc_12_25", + "kind": "npc", + "x": 12, + "y": 25 + } + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/VerityLakefront.json b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/VerityLakefront.json new file mode 100644 index 0000000000..d82818b601 --- /dev/null +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/VerityLakefront.json @@ -0,0 +1,42 @@ +{ + "name": "VerityLakefront", + "source": { + "decomp_file": "SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp", + "revision": "ddcbdb21c1dc", + "date": "2026-11-01" + }, + "tiles": [ + "....############################", + "....############################", + "....############################", + "....############################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################..##############", + "################..##############", + "################..##############", + "##############.S....#...........", + "##############......#.....####..", + "##############......#.....####..", + "##############......#...........", + "##############......#...........", + "##############......#vvvvv##vvvv", + "################..........##....", + "################................", + "##################..............", + "##################..............", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################", + "################################" + ] +} diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp index e8d3eb0b72..54c276f4cd 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp @@ -17,7 +17,6 @@ #include "Pokemon/Navigation/Pokemon_MapSet.h" #include "Pokemon/Navigation/Pokemon_TileGrid.h" #include "Data/PokemonBDSP_AutoStory_MapGrids.h" -#include "Data/PokemonBDSP_AutoStory_Maps_TestData.h" #include "Data/PokemonBDSP_AutoStory_Route202.h" #include "Data/PokemonBDSP_AutoStory_SandgemTown.h" #include "Data/PokemonBDSP_AutoStory_StoryMaps.h" @@ -161,7 +160,7 @@ class Test_TrainingToSandgem : public UnitTest{ } }; -// The built-in maps (the JSON files' text, test_map_json()) all parse +// The built-in maps (the JSON files' text, bdsp_map_json()) all parse // through the shared loader into tile grids, each named as its file. class Test_BuiltInMaps : public UnitTest{ public: @@ -169,10 +168,10 @@ class Test_BuiltInMaps : public UnitTest{ : UnitTest("PokemonBDSP::AutoStory - Map grids: the built-in JSON maps load") {} virtual UnitTestResult run(Logger& logger, CancellableScope&) const override{ - if (test_map_json().empty()){ + if (bdsp_map_json().empty()){ return std::string("No built-in maps."); } - for (const auto& [name, json] : test_map_json()){ + for (const auto& [name, json] : bdsp_map_json()){ try{ const TileGrid& grid = built_in_grid(name); logger.log(std::format("{}: {} x {}", name, grid.width(), grid.height())); diff --git a/SerialPrograms/cmake/SourceFiles.cmake b/SerialPrograms/cmake/SourceFiles.cmake index 88f195e9ba..a3d27d04d5 100644 --- a/SerialPrograms/cmake/SourceFiles.cmake +++ b/SerialPrograms/cmake/SourceFiles.cmake @@ -1565,10 +1565,6 @@ file(GLOB LIBRARY_SOURCES Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_LakeVerity.h Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h - Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp - Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.h - Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_1.cpp - Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData_2.cpp Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.cpp Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_VerityLakefront.h Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Route204.h diff --git a/devtools/maps/bdsp_maps.py b/devtools/maps/bdsp_maps.py index ec113b7634..af92795a49 100644 --- a/devtools/maps/bdsp_maps.py +++ b/devtools/maps/bdsp_maps.py @@ -1,137 +1,51 @@ -"""Embeds the BDSP AutoStory maps (JSON) in a C++ test-data file. +"""Checks that Packages' BDSP AutoStory maps are the ones in this repository. Usage: - python3 devtools/maps/bdsp_maps.py --json-dir Packages/Resources/PokemonBDSP/Maps \ - --cpp SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_Maps_TestData.cpp - ... --check (regenerate in memory; exit 1 if the file's bytes differ) + python3 devtools/maps/bdsp_maps.py --check --json-dir Packages/Resources/PokemonBDSP/Maps The maps are JSON files in the shared map schema -(SerialPrograms/Source/Pokemon/Navigation/Pokemon_MapData.h), in Packages' -Resources/PokemonBDSP/Maps; the program loads them from there. They are the -source: this script does not build them, it copies each one's text, -byte for byte, into one R"json(...)json" literal per map (adjacent literals -under 16000 bytes each, split at line breaks, for MSVC's literal limit), so -the unit tests read the same maps without Packages. The literals go in parts -_1.cpp, _2.cpp, ... of at most 900 lines (the code-health file -limit is 1000); --cpp itself holds test_map_json(), which the matching .h -declares. The C++ tables the files were first written from (in -pret/pokediamond's terms, see each map's .cpp) were converted once, at -ddcbdb21c, with json.dump(indent=4). +(SerialPrograms/Source/Pokemon/Navigation/Pokemon_MapData.h). They live in +SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps, where CMake builds +them into the program for the unit tests (pa_embed_text_files()), and the +program loads Packages' copies, Resources/PokemonBDSP/Maps, when it starts. +The two must be the same files: --check exits 1, naming the first that +differs, if they are not. Edit the repository's files and copy them to +Packages. + +The files were converted once (at ddcbdb21c) from the C++ tables that +pret/pokediamond's maps had been decoded into; nothing builds them now. """ import argparse import os import sys -# The maps embedded, in order. Each PR that adds a map adds it here. -MAPS = [ - 'TwinleafTown', 'VerityLakefront', 'LakeVerity', 'Route201', 'SandgemTown', - 'Route202', 'JubilifeCity', 'Route203', 'OreburghGate', 'OreburghCity', - 'OreburghMine', 'Route204South', 'RavagedPath', 'Route204North', - 'FloaromaTown', -] +REPO_MAPS = 'SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps' -MAX_LITERAL = 16000 - -def literals(text): - """The text as adjacent raw literals, each under MAX_LITERAL bytes.""" - parts, current = [], '' - for line in text.splitlines(keepends=True): - if current and len(current) + len(line) > MAX_LITERAL: - parts.append(current) - current = '' - current += line - if current: - parts.append(current) - for part in parts: - if 'json)' in part or len(part.encode('utf-8')) > MAX_LITERAL: - raise SystemExit('a map does not fit the literals') - return parts - - -# Lines per generated file: the code-health check stops a file at 1000. -MAX_FILE_LINES = 900 - - -def header(args_text): - return [ - '/* BDSP AutoStory - Maps test data', - ' *', - ' * From: https://github.com/PokemonAutomation/', - ' *', - ' * generated by devtools/maps/bdsp_maps.py ' + args_text + ', do not edit', - ' *', - ' */', - '', - ] - - -def namespaces(lines): - return ['namespace PokemonAutomation{', 'namespace NintendoSwitch{', 'namespace PokemonBDSP{', '', ''] + \ - lines + ['', '', '', '}', '}', '}', ''] - - -def symbol(name): - return 'TEST_MAP_JSON_' + name - - -def generate(json_dir, args_text, cpp): - """{path: text} for the index file `cpp` and its parts. Each map's text - is a namespace-scope literal in a part, filled to MAX_FILE_LINES; the - index's test_map_json() lists them in MAPS order.""" - stem = cpp[:-len('.cpp')] - parts, current = [], [] - for name in MAPS: - with open(os.path.join(json_dir, name + '.json'), encoding='utf-8', newline='') as f: - text = f.read() - block = ['extern const char* const ' + symbol(name) + ' ='] + \ - ['R"json(' + part + ')json"' for part in literals(text)] - block[-1] += ';' - block += [''] - block_lines = sum(line.count('\n') + 1 for line in block) - size = sum(line.count('\n') + 1 for line in current) - if current and size + block_lines > MAX_FILE_LINES - 30: - parts.append(current) - current = [] - current += block - parts.append(current) - files = {} - for number, body in enumerate(parts, 1): - files[stem + '_' + str(number) + '.cpp'] = '\n'.join(header(args_text) + namespaces(body)) - index = [] - for name in MAPS: - index.append('extern const char* const ' + symbol(name) + ';') - index += ['', '', 'const std::vector>& test_map_json(){', - ' static const std::vector> maps{'] - index += [' {"' + name + '", ' + symbol(name) + '},' for name in MAPS] - index += [' };', ' return maps;', '}'] - files[cpp] = '\n'.join(header(args_text) + ['#include "' + os.path.basename(stem) + '.h"', ''] + namespaces(index)) - return files +def json_files(folder): + return sorted(name for name in os.listdir(folder) if name.endswith('.json')) def main(): parser = argparse.ArgumentParser(description=__doc__.split('\n')[0]) - parser.add_argument('--json-dir', required=True, help='folder of the map .json files') - parser.add_argument('--cpp', required=True, help='the test-data .cpp to write') - parser.add_argument('--check', action='store_true', help='exit 1 if --cpp differs from what would be written') + parser.add_argument('--check', action='store_true', required=True, + help='compare the repository\'s maps with --json-dir\'s, byte for byte') + parser.add_argument('--json-dir', required=True, help='Packages\' Resources/PokemonBDSP/Maps') + parser.add_argument('--repo', default='.', help='Arduino-Source checkout') args = parser.parse_args() - args_text = '--json-dir ' + args.json_dir + ' --cpp ' + args.cpp - files = generate(args.json_dir, args_text, args.cpp) - if args.check: - for path, text in files.items(): - if not os.path.exists(path): - print(path + ': missing; run without --check.') + repo_maps = os.path.join(args.repo, REPO_MAPS) + ours, theirs = json_files(repo_maps), json_files(args.json_dir) + if ours != theirs: + print('The map files differ: only here ' + str(sorted(set(ours) - set(theirs))) + + ', only in ' + args.json_dir + ' ' + str(sorted(set(theirs) - set(ours))) + '.') + sys.exit(1) + for name in ours: + with open(os.path.join(repo_maps, name), 'rb') as a, open(os.path.join(args.json_dir, name), 'rb') as b: + if a.read() != b.read(): + print(name + ': differs from ' + os.path.join(args.json_dir, name) + '.') sys.exit(1) - with open(path, encoding='utf-8', newline='') as f: - if f.read() != text: - print(path + ': differs from the JSON files; run without --check.') - sys.exit(1) - print(args.cpp + ': up to date (' + str(len(files)) + ' files).') - return - for path, text in files.items(): - with open(path, 'w', encoding='utf-8', newline='\n') as f: - f.write(text) - print(path + ': ' + str(text.count('\n')) + ' lines.') + print(str(len(ours)) + ' maps: the same files.') + if __name__ == '__main__': main() From 0576b042e67d6ef8320c6762e63470078caa116f Mon Sep 17 00:00:00 2001 From: dayfine Date: Sun, 1 Nov 2026 09:44:16 -0800 Subject: [PATCH 08/10] BDSP maps: the program reads the built-in maps only; TODO to move them to Packages The user's decision (2026-11-01): keep the maps as files in this repository for now. story_grid() reads bdsp_map_json() (the committed JSON files, built in by CMake) and nothing else; there is no installed copy from Packages to prefer. TODO notes at the loader and in bdsp_maps.py say to move them to PokemonAutomation/Packages (Resources/PokemonBDSP/Maps) when ready. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../Data/PokemonBDSP_AutoStory_MapGrids.cpp | 29 ++++--------------- .../Data/PokemonBDSP_AutoStory_MapGrids.h | 22 +++++--------- .../PokemonBDSP_AutoStory_MapGrid_Tests.cpp | 6 ++-- devtools/maps/bdsp_maps.py | 12 ++++---- 4 files changed, 22 insertions(+), 47 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp index 25f8e9173e..0b7a20d966 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.cpp @@ -83,18 +83,13 @@ std::optional grid_difference(const TileGrid& here, const TileGrid& namespace{ -std::map& installed_grids(){ - static std::map grids; - return grids; -} - -const std::map& built_in_grids(){ +const std::map& story_grids(){ static const std::map grids = []{ std::map parsed; for (const auto& [name, json] : bdsp_map_json()){ - const MapData map = Pokemon::parse_map(parse_json(json), name + ".json (built in)"); + const MapData map = Pokemon::parse_map(parse_json(json), name + ".json"); if (map.name != name){ - throw ParseException(std::format("{}.json (built in): name is \"{}\".", name, map.name)); + throw ParseException(std::format("{}.json: name is \"{}\".", name, map.name)); } parsed.emplace(name, tile_grid_from_map(map)); } @@ -105,26 +100,12 @@ const std::map& built_in_grids(){ } -const TileGrid& built_in_grid(const std::string& name){ - const std::map& grids = built_in_grids(); - if (auto iter = grids.find(name); iter != grids.end()){ - return iter->second; - } - throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "No BDSP story map named \"" + name + "\"."); -} - const TileGrid& story_grid(const std::string& name){ - const std::map& grids = installed_grids(); + const std::map& grids = story_grids(); if (auto iter = grids.find(name); iter != grids.end()){ return iter->second; } - return built_in_grid(name); -} - -void install_story_grids(std::map grids){ - if (installed_grids().empty()){ - installed_grids() = std::move(grids); - } + throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "No BDSP story map named \"" + name + "\"."); } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h index 26cd972ab1..41f0d61d64 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_MapGrids.h @@ -3,15 +3,17 @@ * From: https://github.com/PokemonAutomation/ * * The story's maps are JSON files in the shared map schema - * (Pokemon_MapData.h), read with the shared loader and turned into the tile + * (Pokemon_MapData.h), PokemonBDSP/Programs/AutoStory/Maps, built into the + * program by CMake, read with the shared loader and turned into the tile * grids the planner walks. Each map's X::grid() returns story_grid("X"). * + * TODO: move the maps to PokemonAutomation/Packages (Resources/PokemonBDSP/Maps) when ready + * */ #ifndef PokemonAutomation_PokemonBDSP_AutoStory_MapGrids_H #define PokemonAutomation_PokemonBDSP_AutoStory_MapGrids_H -#include #include #include #include @@ -25,8 +27,7 @@ namespace PokemonBDSP{ // (name, JSON text) of each map in PokemonBDSP/Programs/AutoStory/Maps/, -// the same files as Packages' Resources/PokemonBDSP/Maps, built into the -// program by pa_embed_text_files() (cmake/EmbedTextFiles.cmake). +// built into the program by pa_embed_text_files() (cmake/EmbedTextFiles.cmake). const std::vector>& bdsp_map_json(); // A map's tiles as a tile grid: walls, open ground, tall grass, south @@ -39,19 +40,10 @@ Pokemon::TileGrid tile_grid_from_map(const Pokemon::MapData& map); // size and equal cell for cell. std::optional grid_difference(const Pokemon::TileGrid& here, const Pokemon::TileGrid& there); -// The built-in copy of the map `name` (bdsp_map_json()), parsed once. -// Throws InternalProgramError for a name it does not have. -const Pokemon::TileGrid& built_in_grid(const std::string& name); - -// The grid of the map `name`: the one installed from Packages' files by -// install_story_grids(), which the program does when it starts, else the -// built-in copy (the unit tests, which have no Packages). +// The grid of the map `name`, read from bdsp_map_json() once. Throws +// InternalProgramError for a name it does not have. const Pokemon::TileGrid& story_grid(const std::string& name); -// Makes story_grid() hand out `grids` from then on. Once only: callers keep -// copies of what they were handed first. -void install_story_grids(std::map grids); - } diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp index 54c276f4cd..2e9f7aa7f4 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.cpp @@ -160,8 +160,8 @@ class Test_TrainingToSandgem : public UnitTest{ } }; -// The built-in maps (the JSON files' text, bdsp_map_json()) all parse -// through the shared loader into tile grids, each named as its file. +// The maps (the JSON files built in, bdsp_map_json()) all parse through +// the shared loader into tile grids, each named as its file. class Test_BuiltInMaps : public UnitTest{ public: Test_BuiltInMaps() @@ -173,7 +173,7 @@ class Test_BuiltInMaps : public UnitTest{ } for (const auto& [name, json] : bdsp_map_json()){ try{ - const TileGrid& grid = built_in_grid(name); + const TileGrid& grid = story_grid(name); logger.log(std::format("{}: {} x {}", name, grid.width(), grid.height())); }catch (Exception& e){ return std::format("{}: {}: {}", name, e.name(), e.message()); diff --git a/devtools/maps/bdsp_maps.py b/devtools/maps/bdsp_maps.py index af92795a49..51e8e3c2e0 100644 --- a/devtools/maps/bdsp_maps.py +++ b/devtools/maps/bdsp_maps.py @@ -6,11 +6,13 @@ The maps are JSON files in the shared map schema (SerialPrograms/Source/Pokemon/Navigation/Pokemon_MapData.h). They live in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps, where CMake builds -them into the program for the unit tests (pa_embed_text_files()), and the -program loads Packages' copies, Resources/PokemonBDSP/Maps, when it starts. -The two must be the same files: --check exits 1, naming the first that -differs, if they are not. Edit the repository's files and copy them to -Packages. +them into the program (pa_embed_text_files()). Once Packages has copies in +Resources/PokemonBDSP/Maps, the two must be the same files: --check exits +1, naming the first that differs, if they are not. + +TODO: move the maps to PokemonAutomation/Packages (Resources/PokemonBDSP/Maps) when ready. +Until then the program reads only the repository's copies, and this check +is for that move. The files were converted once (at ddcbdb21c) from the C++ tables that pret/pokediamond's maps had been decoded into; nothing builds them now. From 82f06310169e37345def292d3b05b4a855c15035 Mon Sep 17 00:00:00 2001 From: dayfine Date: Sun, 1 Nov 2026 09:48:50 -0800 Subject: [PATCH 09/10] BDSP AutoStory 00.04: into Sandgem by the road, then the town plan to the Center On the decomp grids, with the catch patch three rows, the one walk from the training area to below the Center's sign finds no plan (tile grid plans: "After training to the Pokemon Center: no robust route found"), and on r252 its default-costs plan went round the houses south of the Mart and ended two tiles short. Two walks instead: down the road with the default costs to where it stops above the Mart (ROUTE_202_ENTRY_STOP), then the Sandgem Center events' town plan, which ends walking north into the Center's sign. Made first on #121 (cd3d0b30a); it goes with the grids. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../AutoStory/PokemonBDSP_AutoStory_Tests.cpp | 10 +++++----- .../PokemonBDSP_AutoStory_Segment_00.cpp | 16 ++++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp index ebe224c5a9..9c117daa5a 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/PokemonBDSP_AutoStory_Tests.cpp @@ -515,9 +515,9 @@ class Test_TileGridPlans : public UnitTest{ // for 00.04's walks, the Sandgem Center events' default costs for // walk() and town costs for walk_in_town(). The planner gives up // after costs.max_searched sets, and the costs decide whether a - // walk gets a plan: after training to the Center the route costs - // find none on the game's grid and walk_route() falls back to the - // default costs, so that is the plan that runs and is checked here. + // walk gets a plan: after training, 00.04 walks to Sandgem's entry + // with the default costs (the route costs find none within the cap), + // then to the Center with the town costs, checked leg by leg below. const struct{ const char* name; std::vector from; @@ -527,8 +527,8 @@ class Test_TileGridPlans : public UnitTest{ } walks[] = { {"Save spots to the catch grass", story_save_spots(), [&](const TilePos& pos){ return std::find(grass.begin(), grass.end(), pos) != grass.end(); }, false, route_plan_costs()}, - {"After training to the Pokemon Center", story_after_training_area(), - [&](const TilePos& pos){ return pos == below_sign; }, false, Pokemon::RobustPlanCosts()}, + {"After training to Sandgem's entry", story_after_training_area(), + [&](const TilePos& pos){ return pos == sandgem_entry_stop(); }, false, Pokemon::RobustPlanCosts()}, // The Mart's door takes a tile either side: enter_lit_door() lines up by sight. {"Pokemon Center to the Poke Mart", story_door_front(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_DOOR), [&](const TilePos& pos){ return pos.y == below_mart.y && std::abs(pos.x - below_mart.x) <= 1; }, true, route_plan_costs()}, diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_00.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_00.cpp index 2103422258..a5c8c1d355 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_00.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_00.cpp @@ -693,17 +693,21 @@ namespace PokemonAutomation { } } - // South into Sandgem Town, to the tile below the Pokemon Center's sign, - // which the house west of its column and the sign pin (r75 walked this - // and healed). The Center's door is three tiles west; the heal lines up - // with it by sight. Returns where we stand after: below the door. + // South into Sandgem Town in two walks (down the road to where it stops + // above the Mart, then the town plan into the Center's sign; on the + // decomp grids one walk finds no plan within the cap, and r252's went + // round the houses and ended two tiles short), and in by sight. + // Returns where we stand after: below the door. static std::vector heal_at_sandgem_center( VideoStream& stream, ProControllerContext& context, const MapSet& maps, std::vector& trainers, const RouteTrainerFight& fight ) { + const TilePos entry = maps.to_world(MAP_SANDGEM_TOWN, SandgemTown::ROUTE_202_ENTRY_STOP); const TilePos below_sign = maps.to_world(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_SIGN.next(Pokemon::Direction::SOUTH)); - walk_route(stream, context, maps, story_after_training_area(), - [&](const TilePos& pos) { return pos == below_sign; }, trainers, fight, "To the Pokemon Center"); + const std::vector at = walk_route(stream, context, maps, story_after_training_area(), + [&](const TilePos& pos) { return pos == entry; }, trainers, fight, "Into Sandgem Town", {}, Pokemon::RobustPlanCosts()); + walk_route(stream, context, maps, at, + [&](const TilePos& pos) { return pos == below_sign; }, trainers, fight, "To the Pokemon Center", {}, town_plan_costs()); heal_at_pokemon_center(stream, context, "Sandgem Town Pokemon Center"); return story_door_front(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_DOOR); } From b7af347c67fe0e38df88c21609a30b1f20bbfb57 Mon Sep 17 00:00:00 2001 From: dayfine Date: Sun, 1 Nov 2026 09:49:17 -0800 Subject: [PATCH 10/10] BDSP AutoStory 00.04: the Sandgem walks' comment under the file-length limit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E --- .../PokemonBDSP_AutoStory_Segment_00.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_00.cpp b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_00.cpp index a5c8c1d355..30b19917dd 100644 --- a/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_00.cpp +++ b/SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/StorySegments/PokemonBDSP_AutoStory_Segment_00.cpp @@ -693,20 +693,16 @@ namespace PokemonAutomation { } } - // South into Sandgem Town in two walks (down the road to where it stops - // above the Mart, then the town plan into the Center's sign; on the - // decomp grids one walk finds no plan within the cap, and r252's went - // round the houses and ended two tiles short), and in by sight. - // Returns where we stand after: below the door. + // Into Sandgem down the road, then the town plan into the Center's sign (one walk + // found no plan, r252 ended two tiles short), and in by sight. Returns: below the door. static std::vector heal_at_sandgem_center( VideoStream& stream, ProControllerContext& context, const MapSet& maps, std::vector& trainers, const RouteTrainerFight& fight ) { const TilePos entry = maps.to_world(MAP_SANDGEM_TOWN, SandgemTown::ROUTE_202_ENTRY_STOP); const TilePos below_sign = maps.to_world(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_SIGN.next(Pokemon::Direction::SOUTH)); - const std::vector at = walk_route(stream, context, maps, story_after_training_area(), - [&](const TilePos& pos) { return pos == entry; }, trainers, fight, "Into Sandgem Town", {}, Pokemon::RobustPlanCosts()); - walk_route(stream, context, maps, at, + walk_route(stream, context, maps, walk_route(stream, context, maps, story_after_training_area(), + [&](const TilePos& pos) { return pos == entry; }, trainers, fight, "Into Sandgem Town", {}, Pokemon::RobustPlanCosts()), [&](const TilePos& pos) { return pos == below_sign; }, trainers, fight, "To the Pokemon Center", {}, town_plan_costs()); heal_at_pokemon_center(stream, context, "Sandgem Town Pokemon Center"); return story_door_front(MAP_SANDGEM_TOWN, SandgemTown::POKEMON_CENTER_DOOR);