Skip to content
2 changes: 2 additions & 0 deletions SerialPrograms/Source/PokemonBDSP/PokemonBDSP_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "Inference/PokemonBDSP_MenuDetector.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_MapGrid_Tests.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_Tests.h"
#include "Programs/AutoStory/PokemonBDSP_AutoStory_Segment00_Tests.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand Down Expand Up @@ -292,6 +293,7 @@ void add_tests(UnitTestDatabase& database){
add_tests_MenuDetector(database);
add_tests_AutoStory_MapGrids(database);
add_tests_AutoStory(database);
add_tests_AutoStory_Segment00(database);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ Each map file's header starts with the same three lines, kept current with the c
| Oreburgh City | decomp (pokediamond) | none yet (01.04, 01.05 run as records) | probe the Center doorstep (x 46 or 47) |
| Oreburgh Gate | decomp (pokediamond) | none yet | |
| Floaroma Town | decomp (pokediamond), the old couple from the console | 01.11 (1x, as a record) | |
| Twinleaf Town | decomp (pokediamond) | none: 00.01 to 00.03 replay recorded stick inputs (#1717), no route on the grid | redo 00.01 to 00.03 as planned walks |
| Verity Lakefront, Lake Verity | decomp (pokediamond) | none: 00.02, 00.03 replay recorded stick inputs (#1717) | redo as planned walks |
| Twinleaf Town | decomp (pokediamond) | none: 00.01 replays recorded stick inputs (#1717); its lines and records are on the grid (Segment00Lines, task #22), tested offline | a new-game run of the lines, then switch 00.01 to them |
| Verity Lakefront | decomp (pokediamond) | none: 00.01 to 00.03 replay recorded stick inputs (#1717); lines and records on the grid, tested offline | the run must say which entrance tile the lake's scene leaves us on |
| Lake Verity | decomp (pokediamond) | none, and no walk: the scene carries us in and the game warps us out | none |
| Oreburgh Gym | decomp (pokediamond) | none: 01.04 walks it as a record (north until a trainer stops us), traced on the grid | a plan on it if the record ever fails |

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
re-runs every checkpoint listed on it. Scenes' trigger rectangles come from the
decomp too (the events files' coord events: Diamond's binaries parsed by hand,
Platinum's JSON readable), listed in `Segment00Lines::scene_triggers()` for
00.01 to 00.03; a line into a scene must step into its rectangle on its last
tile only, which the Segment 00 tests check. The decomp comparison that found the 3/4
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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* BDSP AutoStory - Oreburgh Gym tiles
*
* From: https://github.com/PokemonAutomation/
*
*/

#include "PokemonBDSP_AutoStory_MapGrids.h"
#include "PokemonBDSP_AutoStory_OreburghGym.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonBDSP{
namespace OreburghGym{

using namespace Pokemon;


// Map source: the decomp (Diamond land_data 0228, 2026-10-31) with the
// objects from its events file.
// Console checks: none yet. 01.04 walks it as a record (north until a
// trainer stops us), not as a plan.
// Status: no checkpoint passes on this grid yet.
//
// Decoded from Pokemon Diamond's collision table for this map (the
// pret/pokediamond decompilation,
// files/fielddata/land_data/land_data_release/narc_0228: the only cell of
// matrix 113, at column 0, row 0; MAP_OREBURGH_GYM in
// include/constants/maps.h), with the objects from its events file
// (zone_event narc_0046, events_oreburgh_gym.json in Platinum); BDSP keeps
// Diamond/Pearl's layout. Local (x, y) = world (x - 0, z - 0) in the Gym's
// own matrix; 32 x 32 tiles, of which the floor is columns 1 to 10, rows 3
// to 24. The tiers' edges and the pillars are '#'.
// Door: (5, 24), walked into heading south to leave; coming in puts us on
// (5, 23). Column 5 runs straight from there to Roark on row 3: the Gym is
// walked north up the middle. Objects, from the events file:
// Roark (5, 3), looks south;
// Gym Guide (6, 23), looks south, beside the entrance;
// Youngster (4, 18), looks east, sees 3: (5..7, 18);
// Youngster (7, 11), looks west, sees 4: (3..6, 11);
// the two wall signs, (3, 23) and (7, 23), read from row 23: 'S'.
// Both trainers see the middle column, so a walk north from the entrance
// is stopped twice before Roark (01.04's record).
const TileGrid& grid(){
return story_grid("OreburghGym");
}

const TilePos ENTRANCE{5, 23};
const TilePos ROARK{5, 3};

std::vector<TrainerSight> trainer_sights(){
return {
{"Youngster (first tier)", {4, 18}, Direction::EAST, 3},
{"Youngster (second tier)", {7, 11}, Direction::WEST, 4},
};
}


}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* BDSP AutoStory - Oreburgh Gym tiles
*
* From: https://github.com/PokemonAutomation/
*
* The Gym's inside, decoded from the Pokemon Diamond decompilation
* (pret/pokediamond); see the .cpp's header for the cell, the offset and
* the objects. For checkpoint 01.04's walk up to Roark.
*/

#ifndef PokemonAutomation_PokemonBDSP_AutoStory_OreburghGym_H
#define PokemonAutomation_PokemonBDSP_AutoStory_OreburghGym_H

#include <vector>
#include "Pokemon/Navigation/Pokemon_TileGrid.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonBDSP{
namespace OreburghGym{


const Pokemon::TileGrid& grid();

// Where coming in through the door puts us: the tile above it, beside the
// Gym Guide. Roark stands at the top of the same column.
extern const Pokemon::TilePos ENTRANCE;
extern const Pokemon::TilePos ROARK;

// The two Youngsters, who face the column up the middle from either side:
// walking north from the entrance meets both.
std::vector<Pokemon::TrainerSight> trainer_sights();


}
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@

#include "PokemonBDSP_AutoStory_RouteRecords.h"
#include "PokemonBDSP_AutoStory_JubilifeCity.h"
#include "PokemonBDSP_AutoStory_Route201.h"
#include "PokemonBDSP_AutoStory_Route203.h"
#include "PokemonBDSP_AutoStory_Route204.h"
#include "PokemonBDSP_AutoStory_RavagedPath.h"
#include "PokemonBDSP_AutoStory_OreburghCity.h"
#include "PokemonBDSP_AutoStory_OreburghGym.h"
#include "PokemonBDSP_AutoStory_FloaromaTown.h"
#include "PokemonBDSP_AutoStory_SandgemTown.h"
#include "PokemonBDSP_AutoStory_Segment00Lines.h"
#include "PokemonBDSP_AutoStory_TwinleafTown.h"
#include "PokemonBDSP_AutoStory_VerityLakefront.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand All @@ -20,30 +26,82 @@
using namespace Pokemon;

namespace{
const TileGrid* twinleaf(){ return &TwinleafTown::grid(); }
const TileGrid* route201(){ return &Route201::grid(); }
const TileGrid* lakefront(){ return &VerityLakefront::grid(); }
const TileGrid* sandgem(){ return &SandgemTown::grid(); }
const TileGrid* jubilife(){ return &JubilifeCity::grid(); }
const TileGrid* route203(){ return &Route203::grid(); }
const TileGrid* ravaged_path(){ return &RavagedPath::grid(); }
const TileGrid* route204_north(){ return &Route204::north_grid(); }
const TileGrid* oreburgh_city(){ return &OreburghCity::grid(); }
const TileGrid* oreburgh_gym(){ return &OreburghGym::grid(); }
const TileGrid* floaroma(){ return &FloaromaTown::grid(); }
const TileGrid* none(){ return nullptr; }

// 00.01: the house, Twinleaf, Route 201 and the Lakefront out to the lake.
std::vector<RouteRecord> checkpoint_0001_records(){

Check warning on line 42 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RouteRecords.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonBDSP::RouteRecords::checkpoint_0001_records(): function_lines=28 (advisory above 25, limit 50)
return {
{"00.01", "The house's doorstep to Barry's door", "Twinleaf Town", twinleaf, true, Segment00Lines::HOUSE_DOORSTEP, {
{Direction::WEST, 7, LegEnd::COUNT, "along row 22 to column 13, clear of the south-west house"},
{Direction::NORTH, 10, LegEnd::COUNT, "up column 13 to row 12, below Barry's mailbox"},
{Direction::WEST, 4, LegEnd::COUNT, "onto (9, 12), the one tile that starts Barry's scene: he bursts out of his door"},
{Direction::NORTH, 1, LegEnd::DOOR, "after the scene, into Barry's house; the stairs, his room and the way back out are replays"},
}, "Segment00Lines line 1, not walked by the program yet; the Twinleaf grid and the scene's tile from the Diamond decomp (land_data 0000, zone_event 0389)"},
{"00.01", "Barry's doorstep to Route 201", "Twinleaf Town", twinleaf, true, Segment00Lines::BARRY_DOORSTEP, {
{Direction::EAST, 6, LegEnd::COUNT, "along row 12 to column 15"},
{Direction::NORTH, 12, LegEnd::COUNT, "up column 15 to (15, 0), the last tile in town; the guitarist's stop on row 3 is inert once Barry has talked upstairs"},
{Direction::NORTH, 0, LegEnd::BANNER, "on north onto Route 201"},
}, "Segment00Lines line 2, not walked by the program yet"},
{"00.01", "Route 201: Barry's tall-grass warning, then west to the Lakefront", "Route 201", route201, true, Segment00Lines::ROUTE_201_ARRIVAL, {
{Direction::NORTH, 6, LegEnd::COUNT, "up the exit path to (15, 18): Barry's warning fires on that row"},
{Direction::WEST, 3, LegEnd::COUNT, "after the scene, along row 18 to column 12"},
{Direction::NORTH, 2, LegEnd::COUNT, "to row 16, the lower level's row to the Lakefront"},
{Direction::WEST, 12, LegEnd::COUNT, "to (0, 16), the route's last tile"},
{Direction::WEST, 0, LegEnd::BANNER, "on west onto the Verity Lakefront"},
}, "Segment00Lines lines 2 and 3, not walked by the program yet; traced on Route201::grid(), the decomp's since #111"},
{"00.01", "Verity Lakefront: to below the lake's entrance", "Verity Lakefront", lakefront, true, Segment00Lines::LAKEFRONT_ARRIVAL, {
{Direction::WEST, 11, LegEnd::COUNT, "along row 23 to column 20"},
{Direction::NORTH, 2, LegEnd::COUNT, "to row 21"},
{Direction::WEST, 3, LegEnd::COUNT, "to column 17, the entrance path's east column"},
{Direction::NORTH, 7, LegEnd::COUNT, "up column 17 to (17, 14), two tiles short of the lake's scene; 00.01 ends here"},
}, "Segment00Lines line 3, not walked by the program yet"},
};
}

// The walks planned on a grid (00.04 and 00.05's walk_route goals, 01.03's
// Mine legs, 01.06's Route 203 and Jubilife legs, 01.08's Route 204 South,
// 01.09's Ravaged Path, 01.10's waypoints) are data already, tested in
// PokemonBDSP_AutoStory_Tests.cpp; these are the rest.
//
// Not recorded, because they are not routes: 00.01 to 00.03 (the house,
// Twinleaf, Route 201, the Lakefront and the lake) replay the stick inputs
// Butters recorded for #1717 (tutorial_part_1_navigation, entry_visible,
// tutorial_part_2_navigation, starter_nav: timed holds, diagonals among
// them, and "move until transition"). No tile count can be read off them.
// They get redone as planned walks on the Twinleaf, Verity Lakefront and
// Lake Verity grids (decoded 2026-11-01) in the compact series; until then
// those grids carry no route and no trace.
const std::vector<RouteRecord>& all(){
static const std::vector<RouteRecord> records{
// 00.02 and 00.03: into the lake's scene, and back to Sandgem.
std::vector<RouteRecord> checkpoints_0002_0003_records(){

Check warning on line 72 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RouteRecords.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonBDSP::RouteRecords::checkpoints_0002_0003_records(): function_lines=29 (advisory above 25, limit 50)
return {
{"00.02", "Into the lake's scene", "Verity Lakefront", lakefront, true, Segment00Lines::BELOW_LAKE_ENTRANCE, {
{Direction::NORTH, 2, LegEnd::COUNT, "onto (17, 12): Barry hears Rowan and the two of us walk into Lake Verity"},
{Direction::NORTH, 0, LegEnd::SCENE, "the starter, the Starly and the way back out to (17, 12) are the game's; nothing is walked at the lake"},
}, "starter_nav() presses north twice from where 00.01 ends; Segment00Lines line 3's last two tiles; the scene's tiles from the Diamond decomp (zone_event 0319)"},
{"00.03", "Verity Lakefront: from the lake's entrance back onto Route 201", "Verity Lakefront", lakefront, true, Segment00Lines::LAKE_ENTRANCE, {
{Direction::SOUTH, 9, LegEnd::COUNT, "down column 17 to row 21"},
{Direction::EAST, 12, LegEnd::COUNT, "along row 21 to column 29"},
{Direction::EAST, 0, LegEnd::BANNER, "on east onto Route 201"},
}, "Segment00Lines line 4, not walked by the program yet; which of the two entrance tiles the scene leaves us on is for the console"},
{"00.03", "Route 201: Rowan's scene, then east through the grass to Sandgem", "Route 201", route201, true, Segment00Lines::ROUTE_201_RETURN, {
{Direction::EAST, 5, LegEnd::COUNT, "to (5, 14): Rowan and Dawn's scene fires on that column"},
{Direction::EAST, 12, LegEnd::COUNT, "after the scene, along row 14 to column 17"},
{Direction::EAST, 12, LegEnd::COUNT, "through the tall grass to column 29; the Breeder wanders rows 14 to 16 there"},
{Direction::EAST, 12, LegEnd::COUNT, "to column 41"},
{Direction::NORTH, 7, LegEnd::COUNT, "up column 41 to row 7, beside the north-east grass"},
{Direction::EAST, 1, LegEnd::COUNT, "into the grass"},
{Direction::NORTH, 2, LegEnd::COUNT, "to row 5"},
{Direction::EAST, 10, LegEnd::COUNT, "through the grass to (52, 5), its last tile"},
{Direction::EAST, 11, LegEnd::COUNT, "to (63, 5), the route's last tile"},
{Direction::EAST, 0, LegEnd::BANNER, "on east into Sandgem Town"},
}, "Segment00Lines lines 4 and 5, not walked by the program yet; the grass legs need the wild-battle handling of the replay's walk_through_grass(); traced on Route201::grid()"},
{"00.03", "Sandgem Town: Dawn at the entrance", "Sandgem Town", sandgem, true, Segment00Lines::SANDGEM_ARRIVAL, {
{Direction::EAST, 4, LegEnd::COUNT, "along row 12 to (4, 12): Dawn's scene, which leads us into Rowan's lab for the Pokedex"},
{Direction::EAST, 0, LegEnd::SCENE, "the lab is the game's; 00.03 ends in front of Rowan"},
}, "Segment00Lines line 5, not walked by the program yet; on Sandgem's row 12, where its coord event (zone_event 0396) is"},
};
}

// 01.01 to 01.05: Jubilife to Oreburgh and back out.
std::vector<RouteRecord> segment01_records_to_oreburgh(){

Check warning on line 103 in SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Data/PokemonBDSP_AutoStory_RouteRecords.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonBDSP::RouteRecords::segment01_records_to_oreburgh(): function_lines=36 (advisory above 25, limit 50)
return {
{"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},
Expand All @@ -62,9 +120,9 @@
{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)"},
}, "oreburgh_street_to_gym(); 20 taps measured on the console (r204 to r215, 3 runs on the same tile); the decomp's Center door is at x 47, the taps say the doorstep is x 46"},
{"01.04", "Inside the Oreburgh Gym", "", none, false, std::nullopt, {
{Direction::NORTH, 0, LegEnd::NPC, "up the Gym to its trainers and Roark"},
}, "oreburgh_gym_battles(); no grid for the Gym's inside"},
{"01.04", "Inside the Oreburgh Gym", "Oreburgh Gym", oreburgh_gym, true, OreburghGym::ENTRANCE, {
{Direction::NORTH, 0, LegEnd::NPC, "up column 5 from the entrance to Roark on row 3; the Youngsters at (4, 18) and (7, 11) see the column and stop us on rows 18 and 11 on the way"},
}, "oreburgh_gym_battles(); the Gym's grid from the Diamond decomp (land_data 0228), its trainers and their sight from the events file (zone_event 0046)"},
{"01.05", "Oreburgh Gym to the Gate and out onto Route 203", "Oreburgh City", oreburgh_city, true, OreburghCity::GYM_DOORSTEP, {
{Direction::EAST, 20, LegEnd::COUNT, "D-pad taps from the Gym's doorstep back to the Center's door"},
{Direction::WEST, 0, LegEnd::WALL, "to the stairs' cliff"},
Expand All @@ -76,6 +134,12 @@
{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(); the Center visit between the two taps legs is not a walk"},
};
}

// 01.07 to 01.11: Jubilife north to Floaroma.
std::vector<RouteRecord> segment01_records_from_jubilife(){
return {
{"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"},
Expand All @@ -97,6 +161,34 @@
{Direction::NORTH, 0, LegEnd::NPC, "until the old man stops us (a turn)"},
}, "floaroma_old_couple(); by hand 2026-10-31 (batches m1 to m9), r251a"},
};
}

}

// The walks planned on a grid (00.04 and 00.05's walk_route goals, 01.03's
// Mine legs, 01.06's Route 203 and Jubilife legs, 01.08's Route 204 South,
// 01.09's Ravaged Path, 01.10's waypoints) are data already, tested in
// PokemonBDSP_AutoStory_Tests.cpp; these are the rest.
//
// 00.01 to 00.03 (the house, Twinleaf, Route 201, the Lakefront and the
// lake) still replay the stick inputs Butters recorded for #1717
// (tutorial_part_1_navigation, entry_visible, tutorial_part_2_navigation,
// starter_nav: timed holds, diagonals among them, and "move until
// transition"), off which no tile count can be read. Their records below
// are the same walks as lines on the decomp grids
// (Data/PokemonBDSP_AutoStory_Segment00Lines, task #22), legs the program
// does not walk yet: a new-game run has to confirm where each scene leaves
// the player before Segment_00 switches to them. The house interiors (the
// player's, Barry's) have no grid and stay replays.
const std::vector<RouteRecord>& all(){
static const std::vector<RouteRecord> records = []{
std::vector<RouteRecord> all;
for (auto part : {checkpoint_0001_records, checkpoints_0002_0003_records, segment01_records_to_oreburgh, segment01_records_from_jubilife}){
const std::vector<RouteRecord> records = part();
all.insert(all.end(), records.begin(), records.end());
}
return all;
}();
return records;
}

Expand Down
Loading
Loading