Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Movement Mechanics

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<header>: header_symbols=8 (advisory above 6, limit 8)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -50,6 +50,13 @@
inline constexpr Milliseconds RUN_TILE_TIME(133);
// Surfing: a tile per 8 frames.
inline constexpr Milliseconds SURF_TILE_TIME(133);
// Hopping a ledge: 32 frames for the two tiles, walking or running
// (pokefirered DoJumpSpriteMovement(), JUMP_DISTANCE_FAR). Running, a hold
// timed by its tiles spends two of them on the hop and ends a tile short
// (console B, 2026-11-14 20:23 and 20:27, 15.01: "south 8" down Route 7's
// column 8 ended on row 9). Two walking tiles' time to the millisecond:
// a walking hold over a ledge ends where the game's does (cp0007-r..t).
inline constexpr Milliseconds LEDGE_HOP_TIME = TILE_TIME * 2;
// The longest tap measured to only turn a player facing another way, and
// to take exactly one step for one facing its way.
inline constexpr Milliseconds LONGEST_TAP(133);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void OverworldSim::take_steps(Direction direction, Milliseconds pressed, Millise
return;
}
tile = tile_time();
pressed += step->ledge ? tile * 2 : tile;
pressed += step->ledge ? LEDGE_HOP_TIME : tile;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Overworld Walk

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=977 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -366,7 +366,7 @@

} // namespace

bool arrived_without_fade(

Check warning on line 369 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::OverworldWalkSteps::arrived_without_fade( const ImageViewRGB32 & before , const ImageViewRGB32 & now , const ImageViewRGB32 & later , const ImageFloatBox & game , const RouteStep & step): function_lines=26 (advisory above 25, limit 50)
const ImageViewRGB32& before, const ImageViewRGB32& now, const ImageViewRGB32& later,
const ImageFloatBox& game, const RouteStep& step
){
Expand All @@ -381,9 +381,13 @@
if (scrolled_rmsd(now_box, later_box, 0, 0) >= SAME_SCENE_RMSD){
return false;
}
// Water's waves make any scene after it look like another one: a door
// north has to show the building it leads into.
if (step.direction == Direction::NORTH && !black_below(later_box)){
// A still screen is no proof of a warp: a wall stops the player as
// still, and water's waves make any scene after it look like another
// one. The screen has to show a building's or a gate's map, with the
// black below it (console B, 2026-11-14 20:27, 15.01: "east 9 (warp)"
// held into Route 7's gate wall a row above its door was taken as the
// warp).
if (!black_below(later_box)){
return false;
}
return warp_left_scene(before, later, game, step.direction, step.tiles + step.warp_slack + 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,38 @@ UnitTestResult test_water_is_not_the_center(){
return true;
}

// A field of grass: a pattern that repeats every 16-pixel tile, another
// scene than the store floor's.
ImageRGB32 grass_field(){
ImageRGB32 image(240, 160);
for (size_t y = 0; y < 160; y++){
for (size_t x = 0; x < 240; x++){
image.pixel(x, y) = (x % 16 < 8) ^ (y % 16 < 8) ? 0xff78c850 : 0xff50a040;
}
}
return image;
}

// 15.01 west_of_tea_guard: "east 9 (warp)" to Route 7's gate, held from a
// row above the door into the gate's wall (console B, 2026-11-14 20:23
// and 20:27). The scene after the hold is another than before it, and
// still, as a wall stop is; it is outdoors, with no black below, so it is
// not the gate.
UnitTestResult test_wall_stop_is_not_the_gate(){
const ImageFloatBox game(0, 0, 1, 1);
RouteStep step;
step.direction = Direction::EAST;
step.tiles = 9;
step.warps = true;
step.end.map = "Route7_EastEntrance";
const ImageRGB32 before = store_floor();
const ImageRGB32 after = grass_field();
if (OverworldWalkSteps::arrived_without_fade(before, after, after, game, step)){
return "Expected a still scene with no black below not to be taken as the gate.";
}
return true;
}

struct ArrivalScreenInput{
std::string name;
std::function<UnitTestResult()> body;
Expand Down Expand Up @@ -243,6 +275,7 @@ class Test_ArrivalScreen : public UnitTest{
const ArrivalScreenCase ARRIVAL_SCREEN_CASES[] = {
{.input = {"the lift room after a missed fade, by its screen", test_lift_room_arrival}, .expectation = {}},
{.input = {"water after a missed fade is not the Center", test_water_is_not_the_center}, .expectation = {}},
{.input = {"a wall stop outdoors after a missed fade is not the gate", test_wall_stop_is_not_the_gate}, .expectation = {}},
};

} // namespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* AutoStory Fault Sweep Tests

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=862 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -99,8 +99,6 @@
"below_oak on Route 1 gives up after 9 stops part-way (seeds 16, 30): count stops that make no progress, not every battle"},
{"PokemonFRLG::AutoStory - Fault sweep: 10.06, scene end pose",
"below_fuji_house plans from (4, 7), where Mr. Fuji's script warps the player (warp 4, 7, exact); from a tile off, no wall in his house funnels the walk onto (3, 4): legs that re-anchor, if the console shows the warp can land elsewhere"},
{"PokemonFRLG::AutoStory - Fault sweep: 18.01, late fade",
"pad_to_top_right: a pad hop stays on SaffronCity_Gym, so a fade seen late (or a slow fade-in) leaves no scene change to confirm the warp and the step finds no fade: a scene check for a warp within one map (the player's tile moved from the pad), as the walker's scene_confirms_missed_fade does for a leg"},
{"PokemonFRLG::AutoStory - Fault sweep: 09.01, unseen step",
"Rocket Hideout's arrow maze: an unseen tap leaves the player on the leg's start or its end, and from what the screen shows the two look alike: a test tap toward a tile blocked from one but not the other tells them apart"},
{"PokemonFRLG::AutoStory - Fault sweep: 04.05, clean run",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ namespace PokemonFRLG{

// The stored plan lines from segment 15 on, after FRLG_PLAN_GOLDEN_14's.
inline constexpr std::string_view FRLG_PLAN_GOLDEN_15[] = {
"15.01 west_of_tea_guard from CeladonCity_PokemonCenter_1F (7, 4) facing north to Route7_EastEntrance (5, 4) facing east",
"15.01 to_gate_wall from CeladonCity_PokemonCenter_1F (7, 4) facing north to Route7 (15, 11) facing north",
"15.01 walk south 5 (warp) -> CeladonCity (48, 12) [walk only]",
"15.01 walk east 19 -> Route7 (7, 2) [connection 12]",
"15.01 walk south 8 -> Route7 (7, 10)",
"15.01 walk east 9 (warp) -> Route7_EastEntrance (1, 5)",
"15.01 walk south 9 (to wall) -> Route7 (7, 11)",
"15.01 walk east 8 (to wall) -> Route7 (15, 11)",
"15.01 face north -> Route7 (15, 11)",
"15.01 west_of_tea_guard from Route7 (15, 11) facing north to Route7_EastEntrance (5, 4) facing east",
"15.01 walk north 1 -> Route7 (15, 10) [tapped]",
"15.01 walk east 1 (warp) -> Route7_EastEntrance (1, 5)",
"15.01 walk east 4 -> Route7_EastEntrance (5, 5)",
"15.01 walk north 1 (to wall) -> Route7_EastEntrance (5, 4)",
"15.01 face east -> Route7_EastEntrance (5, 4)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h"
#include "VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h"
#include "PokemonFRLG_AutoStoryEvents.h"
#include "PokemonFRLG_AutoStoryPacedRoute.h"
#include "PokemonFRLG_AutoStoryRooms.h"
#include "PokemonFRLG_AutoStoryRowSim.h"
#include "PokemonFRLG_AutoStoryRows_Tests.h"
Expand Down Expand Up @@ -107,11 +108,55 @@
return true;
}

// 15.01's walk to the gate as console B ran it (2026-11-14 20:23 and
// 20:27, twice alike): running, and the game not holding the player up on
// the crossing east onto Route 7, so the open leg east ran a column long,
// onto column 8. Dead-reckoned, "south 8" down that column hopped the
// ledge on row 8, which took two of its tiles, and ended on row 9; "east 9
// (warp)" then held into the gate's wall a row above its door. Held to
// walls, the walk ends at the door from column 7 or 8 alike.
UnitTestResult test_route7_gate_running_crossing_not_held_up(){

Check warning on line 118 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::test_route7_gate_running_crossing_not_held_up(): function_lines=32 (advisory above 25, limit 50)
const StoryCheckpoint& row = checkpoint("15.01");
StoryPose at = *story_pose(Pokemon::pose_of(*row.start));
SimScript script;
script.timing.tile = MovementMechanics::RUN_TILE_TIME;
script.connections_stall = false;
OverworldSim sim(story_maps(), MapPosition{at.map, at.tile}, *at.facing, script);
SimWalkerRules rules;
rules.speed = MoveSpeed::RUN;
for (const StoryStep& step : row.steps){
if (step.name == "tea_trigger"){
break;
}
const std::optional<std::vector<RouteStep>> route = walked_route(at, step, story_maps(), sim.state().gates);
if (!route || route->empty()){
return std::format("15.01 {}: no route from {}.", step.name, to_string(MapPosition{at.map, at.tile}));
}
const RoutePlanning planning{
.maps = &story_maps(), .gates = sim.state().gates, .costs = story_route_costs(),
.start = MapPosition{at.map, at.tile}, .label = step.name
};
if (const std::string failure = OverworldSimWalker(sim, rules).run(*route, planning); !failure.empty()){
return std::format("15.01 {}: ended on {}; {}", step.name, to_string(sim.state().position), failure);
}
at = StoryPose{route->back().end.map, route->back().end.point, route->back().facing_after};
}
const MapPosition west_of_trigger{"Route7_EastEntrance", {5, 4}};
if (!(sim.state().position == west_of_trigger)){
return std::format("15.01: ended on {}, not west of the guard's trigger, {}.", to_string(sim.state().position), to_string(west_of_trigger));
}
return true;
}

const AutoStorySaffronCase AUTO_STORY_SAFFRON_CASES[] = {
{
.input = {.name = "15.01 Route 7's gate with the TEA to Saffron's Center", .body = test_route7_to_saffron},
.expectation = {.description = "onto the guard's trigger, below Saffron's Center door, nobody met"},
},
{
.input = {.name = "15.01 running, the crossing onto Route 7 not held up", .body = test_route7_gate_running_crossing_not_held_up},
.expectation = {.description = "a column long after the crossing, the walk still ends at the gate's guard"},
},
};

} // namespace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* AutoStory Tests

Check warning on line 1 in SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (bypass)

<file>: file_lines=1670 over limit 1000, bypassed by the tag at line 11: "stage 4 adds the Cerulean trigger and Nugget Bridge walk tests, which share this file's walk helpers; split with them later"
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -858,7 +858,7 @@
// From the Running Shoes on, routes and legs keep out of the grass (but
// in caves, which are all grass, onto a GRIND's or a capture's patch, on legs held to walls round Route 6's trainers, and under a Repel the table used), off warps to maps not loaded and out of
// trainers' lines, but for the three Route 3 trainers, Mt. Moon's Grunt
// at (12, 20), Nugget Bridge's five, Route 25's four, Route 6's Jeff, Vermilion Gym's three, Route 9's three, Rock Tunnel's eight, Route 8's Rich, the Rocket Hideout's Lift Key Grunt, the Pokemon Tower's four Channelers and three Grunts, and Fuchsia Gym's Kayden and Kirk and Celadon Gym's Tamia and Lori the table steps
// at (12, 20), Nugget Bridge's five, Route 25's four, Route 6's Jeff, Vermilion Gym's three, Route 9's three, Rock Tunnel's eight, Route 8's Rich, the Rocket Hideout's Lift Key Grunt, the Pokemon Tower's four Channelers and three Grunts, and Fuchsia Gym's Kayden and Kirk and Celadon Gym's Tamia and Lori, Silph Co. 5F's corridor Rocket and Viridian Gym's Warren and Takashi the table steps
// in front of to fight; where they cross a wandering trainer's sight, the walk can place
// the player if the trainer stops them; and where they cross the sight of
// one who looks around, on a leg to a wall.
Expand Down Expand Up @@ -1069,10 +1069,10 @@
}
has_shoes = has_shoes || checkpoint.id == "03.03";
}
if (beaten.size() != 43){
if (beaten.size() != 44){
return "Expected to fight Colton, Greg and James on Route 3, the Grunt at (12, 20) in Mt. Moon, Nugget Bridge's five"
", Franklin, Kelsey, Nob and Haley on Route 25, Jeff on Route 6, Dwayne, Baily and Tucker in Vermilion Gym, Alicia, Jeremy and Conner on Route 9"
", Ashton, Winston, Martha, Allen, Lenny, Sofia, Dudley and Dana in Rock Tunnel, Rich on Route 8, the Lift Key Grunt on B4F, Ruth, Tammy, Jennifer and Emilia and the three Grunts in the Pokemon Tower, and Kayden , Kirk in Fuchsia Gym, and Tamia and Lori in Celadon Gym, and Warren and Takashi in Viridian Gym; the table fights "
", Ashton, Winston, Martha, Allen, Lenny, Sofia, Dudley and Dana in Rock Tunnel, Rich on Route 8, the Lift Key Grunt on B4F, Ruth, Tammy, Jennifer and Emilia and the three Grunts in the Pokemon Tower, and Kayden , Kirk in Fuchsia Gym, and Tamia and Lori in Celadon Gym, the Rocket in Silph Co. 5F's corridor, and Warren and Takashi in Viridian Gym; the table fights "
+ std::to_string(beaten.size()) + " trainers.";
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@
"title": "Celadon to Saffron: the TEA to Route 7's gate guard, heal at Saffron's Center",
"start": {"map": "CeladonCity_PokemonCenter_1F", "tiles": [[7, 4]], "facing": "north"},
"events": [
{
"id": "to_gate_wall",
"kind": "route",
"action": "run",
"args": {
"target": {"map": "Route7", "tiles": [[15, 11]], "facing": "north"}
},
"why": "out of Celadon's Center (its ground floor coded), east through the city onto Route 7 and, in two legs that end at walls, to the gate's west wall a row below its door (15, 10): south down column 7 to the row behind the underground path house's roof, where row 12 stops the player, then east to the gate. Dead-reckoned, the walk ran a column long on the crossing east (the game didn't hold the player up there) and the hold south down column 8 hopped its ledge, which took two of its tiles, and ended a row short, against the gate's wall (console B, 2026-11-14 20:23 and 20:27); held to walls, column 7 or 8 ends on row 11 alike"
},
{
"id": "west_of_tea_guard",
"kind": "route",
"action": "run",
"args": {
"target": {"map": "Route7_EastEntrance", "tiles": [[5, 4]], "facing": "east"}
},
"why": "out of Celadon's Center (its ground floor coded), east through the city and along Route 7 into its east gate (pokeguy bikes, 1:27:07 to 1:27:30), to (5, 4), a tile west of the guard's top trigger (6, 4)"
"why": "a step north onto the door's tile (15, 10), east through the gate's west door (pokeguy bikes, 1:27:07 to 1:27:30), to (5, 4), a tile west of the guard's top trigger (6, 4)"
},
{
"id": "tea_trigger",
Expand Down
Loading