diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h index a89674104d..9e6618e2eb 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_MovementMechanics.h @@ -50,6 +50,13 @@ inline constexpr Milliseconds TILE_TIME(267); 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); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimTaps.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimTaps.cpp index 2a9a891098..84681172b9 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimTaps.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSimTaps.cpp @@ -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; } } diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp index addd2ff8f3..0f396fff3a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWalk.cpp @@ -381,9 +381,13 @@ bool arrived_without_fade( 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); diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWarpFade_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWarpFade_Tests.cpp index aba711b34b..141e58060a 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWarpFade_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldWarpFade_Tests.cpp @@ -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 body; @@ -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 diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp index aca88d1029..182536d005 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryFaultSweep_Tests.cpp @@ -99,8 +99,6 @@ const std::map KNOWN_FAILING{ "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", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden15.h b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden15.h index 5ab7394f5d..e52c74bd74 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden15.h +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryPlanGolden15.h @@ -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)", diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp index f390852c98..63f9ee7f47 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStorySaffron_Tests.cpp @@ -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" @@ -107,11 +108,55 @@ UnitTestResult test_route7_to_saffron(){ 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(){ + 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> 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 diff --git a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp index e7da4dffed..2026b65c8e 100644 --- a/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp +++ b/SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory_Tests.cpp @@ -858,7 +858,7 @@ UnitTestResult check_lines(const StoryCheckpoint& checkpoint, std::set