Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
174f751
FRLG AutoStory sim tests: a row's steps on the sim in a file of their…
dayfine Nov 3, 2026
4c1eebf
FRLG AutoStory 00.21 and 00.22: Route 6 to Vermilion, the S.S. Anne
dayfine Nov 3, 2026
4761f75
FRLG: image test for WhiteDialogDetector on the S.S. Anne's white hull
dayfine Nov 3, 2026
7fd42c2
FRLG: WhiteDialogDetector checks the dialog's blue frame
dayfine Nov 3, 2026
ea22fd8
FRLG: the win-chance sim plays the battle loop's Antidote, logs its l…
dayfine Nov 3, 2026
2fe142e
FRLG battle loop: real YES/NOs only, Disable over "no PP", the sim's …
dayfine Nov 4, 2026
6f17c46
FRLG AutoStory 00.23-00.25: Cut, Vermilion Gym's trash cans, Lt. Surge
dayfine Nov 4, 2026
370a0f5
Merge branch 'frlg/stage6-vermilion' of https://github.com/dayfine/Ar…
dayfine Nov 4, 2026
ee9fcf1
FRLG AutoStory 00.23-00.24: the sim's Surge numbers after the merge
dayfine Nov 4, 2026
43ee40b
FRLG summary: read the Oddish's moves; an unnamed move keeps its row
dayfine Nov 4, 2026
7268069
FRLG teach: red tests for the TM's "Machine set!" scene
dayfine Nov 4, 2026
010db08
FRLG teach: A through the TM's scene, never B
dayfine Nov 4, 2026
b992332
FRLG teach: red tests for "Poof!" read as "learned" and a stuck scene
dayfine Nov 4, 2026
212854c
FRLG teach: A on every look of the TM's scene; leave() waits for it once
dayfine Nov 4, 2026
00a2077
FRLG walk: hold a warp a tile further after an open leg over a connec…
dayfine Nov 4, 2026
027ae80
FRLG 00.24: check Lt. Surge's win chance in the Center before the grind
dayfine Nov 4, 2026
d8b375f
FRLG sim: Double Team's AI score and two-turn moves (Lt. Surge, m73)
dayfine Nov 4, 2026
b48afbc
FRLG 00.25: to the nurse off Oak's aide's row; stop a battle with no …
dayfine Nov 4, 2026
130344d
Merge commit '7b6a28cebae30896aa10d00378d84ebba6322d6b' into HEAD
dayfine Nov 5, 2026
36455d1
Merge origin/frlg/stage5-bill into frlg/stage6-vermilion (align with …
dayfine Nov 6, 2026
f527922
Merge origin/frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 6, 2026
d034ec7
Use string views for Vermilion Gym test checkpoint lookups
dayfine Nov 7, 2026
89f9e03
Merge origin/frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 7, 2026
7ca8178
Merge remote-tracking branch 'origin/frlg/stage5-bill' into frlg/stag…
dayfine Nov 8, 2026
823228a
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 8, 2026
dfb943a
Merge remote-tracking branch 'origin/frlg/stage5-bill' into HEAD
dayfine Nov 9, 2026
26649fe
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 9, 2026
e250707
Merge frlg/stage5-bill (story action table) into frlg/stage6-vermilion
dayfine Nov 9, 2026
703f32f
FRLG AutoStory: GAME steps as rows of the story action table
dayfine Nov 9, 2026
c82b79b
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 9, 2026
8698c80
Merge frlg/stage5-bill: check the save stands at the checkpoint's sta…
dayfine Nov 9, 2026
37008e1
Merge frlg/stage5-bill: keep the simulation tests' line endings
dayfine Nov 9, 2026
db0cc2a
Merge frlg/stage5-bill: time an interrupt's step from its screen events
dayfine Nov 9, 2026
14d8a5c
FRLG AutoStory sim: run the story through the action table
dayfine Nov 9, 2026
9839daf
Merge frlg/stage5-bill: check a loaded save's start against a kept frame
dayfine Nov 9, 2026
b0f7e3f
Merge 2ab5af7b0 (#122 via parent) into frlg/stage6-vermilion
dayfine Nov 9, 2026
52103a2
Merge FRLG between-step interrupts (b93d1d36e) into #222
dayfine Nov 9, 2026
effe4c0
Merge FRLG between-step interrupts (82e3821bf) into #222
dayfine Nov 9, 2026
1417971
FRLG AutoStory sim: clear dialogs between steps as the console does
dayfine Nov 9, 2026
fe3210e
Merge FRLG interrupt actions move (12c744e6a) into #222
dayfine Nov 9, 2026
ff71c61
Merge frlg/stage5-bill into frlg/stage6-vermilion (hold watchers for …
dayfine Nov 9, 2026
592d740
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 9, 2026
b6421e4
Merge frlg/stage5-bill into frlg/stage6-vermilion (wait for a battle'…
dayfine Nov 9, 2026
edc2002
Merge frlg/stage5-bill into frlg/stage6-vermilion (scene ends after i…
dayfine Nov 9, 2026
8885f95
Merge frlg/stage5-bill into frlg/stage6-vermilion: a step on the Swit…
dayfine Nov 9, 2026
ab46733
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 10, 2026
fddde42
Merge origin/frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 10, 2026
201cda0
Merge frlg/stage5-bill (#336) into frlg/stage6-json: stage 6's rows a…
dayfine Nov 10, 2026
e3ab8e1
FRLG AutoStory: delete stage 6's C++ story rows, parity proven
dayfine Nov 10, 2026
7dadd34
Merge pull request #337 from dayfine/frlg/stage6-json
dayfine Nov 10, 2026
0bba8ab
Merge frlg/stage5-bill (182af7029) into frlg/stage6-vermilion
dayfine Nov 11, 2026
975d551
Merge branch 'frlg/stage5-bill' into frlg/stage6-vermilion
dayfine Nov 11, 2026
75ae6d2
Merge branch 'frlg/stage5-bill' into frlg/stage6-vermilion
dayfine Nov 11, 2026
d4bb0c5
Merge origin/frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 12, 2026
df75377
Merge origin/frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 13, 2026
7568230
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 14, 2026
23b0c5a
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 14, 2026
c640065
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 14, 2026
5fd1911
Merge frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 14, 2026
82d010e
Merge origin/frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 14, 2026
f0e468d
Merge origin/frlg/stage5-bill into frlg/stage6-vermilion
dayfine Nov 15, 2026
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
Expand Up @@ -54,6 +54,23 @@ constexpr std::string_view MAP_NAMES[] = {
"CeruleanCity_Gym",
"Route25",
"Route25_SeaCottage",
// The burgled house, the way south out of Cerulean; Route 5, the
// Underground Path and Route 6 to Vermilion City, and the S.S.
// Anne's way to the Captain.
"CeruleanCity_House2",
"Route5",
"UndergroundPath_NorthEntrance",
"UndergroundPath_NorthSouthTunnel",
"UndergroundPath_SouthEntrance",
"Route6",
"VermilionCity",
"VermilionCity_PokemonCenter_1F",
"SSAnne_Exterior",
"SSAnne_1F_Corridor",
"SSAnne_2F_Corridor",
"SSAnne_CaptainsOffice",
// Vermilion Gym, past the tree Cut fells.
"VermilionCity_Gym",
"CeruleanCave_1F",
"CeruleanCave_2F",
"CeruleanCave_B1F",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
* new game in Pallet Town through Viridian City, Route 2 and Viridian
* Forest to Brock's gym in Pewter City, Route 3, Mt. Moon and Route 4;
* and Cerulean City, its Pokemon Center, Mart and Gym, Route 24 (Nugget
* Bridge) and Route 25 to Bill's Sea Cottage, and the three floors of
* Cerulean Cave, where Mewtwo waits on B1F.
* Bridge) and Route 25 to Bill's Sea Cottage; the burgled house, Route 5,
* the Underground Path and Route 6 to Vermilion City and its Pokemon
* Center, and the S.S. Anne's corridors to the Captain's office; and the
* three floors of Cerulean Cave, where Mewtwo waits on B1F.
*
* Each map is a pinned PokemonSimulation JSON resource, prepared under
* Packages/Resources/Pokemon/Maps/frlg and built into the program by CMake
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/* Overworld Maps Tests

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

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=747 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
*/

#include <algorithm>
#include <chrono>
#include <format>
#include <functional>
Expand Down Expand Up @@ -362,6 +363,107 @@
return true;
}

// Cerulean's burgled house, Route 5, the Underground Path, Route 6,
// Vermilion City and the S.S. Anne load and join: from Cerulean's Pokemon
// Center a route plans through the house, its back yard and the
// Underground Path to Vermilion's nurse, and from there onto
// the ship and up to the Captain. The rival a new game hides
// (FLAG_HIDE_SS_ANNE_RIVAL, flag set "new_game") stands on the Captain's
// door until then: with him there, no route reaches the Captain. With
// Surf's cost below 0, no route surfs.
UnitTestResult test_vermilion_maps(){

Check warning on line 374 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::test_vermilion_maps(): function_lines=42 (advisory above 25, limit 50)
const std::vector<MapData> all = overworld_maps();
for (std::string_view name : {
"CeruleanCity_House2", "Route5", "UndergroundPath_NorthEntrance", "UndergroundPath_NorthSouthTunnel", "UndergroundPath_SouthEntrance",
"Route6", "VermilionCity", "VermilionCity_PokemonCenter_1F",
"SSAnne_Exterior", "SSAnne_1F_Corridor", "SSAnne_2F_Corridor", "SSAnne_CaptainsOffice",
}){
if (built_in(all, std::string(name)) == nullptr){
return std::format("Missing map {}.", name);
}
}
const std::set<std::string> new_game = map_flag_set(all, "new_game");
if (new_game.count("FLAG_HIDE_SS_ANNE_RIVAL") == 0){
return "Expected FLAG_HIDE_SS_ANNE_RIVAL in flag set new_game.";
}
const std::vector<MapData> maps = overworld_maps(new_game);
const MapPosition nurse{"VermilionCity_PokemonCenter_1F", map_point(maps, "VermilionCity_PokemonCenter_1F", "nurse_front")};
if (nurse.point != TilePos{7, 4}){
return "Unexpected nurse_front in Vermilion's Pokemon Center.";
}
if (!plans_from_cerulean_nurse(maps, RouteGoal{nurse, Direction::NORTH})){
return "No route from Cerulean's Pokemon Center through the burgled house and the Underground Path to Vermilion's.";
}
const RouteGoal captain{MapPosition{"SSAnne_CaptainsOffice", {5, 5}}, Direction::NORTH};
RouteCosts walking = default_route_costs();
walking[RouteCost::SURF] = -1;
const std::optional<std::vector<RouteStep>> aboard = plan_overworld_route(maps, nurse, captain, walking, Direction::NORTH);
if (!aboard){
return "No route from Vermilion's Pokemon Center onto the S.S. Anne to the Captain.";
}
// The harbor's water (20..23, 23..27) is the shorter way south; a
// player without Surf walks round it.
for (const RouteStep& step : *aboard){
if (step.action == RouteAction::SURF){
return "Expected the way aboard on land, not " + to_string(step) + ".";

Check warning on line 408 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
}
}
if (plan_overworld_route(all, nurse, captain, default_route_costs(), Direction::NORTH)){
return "Expected the rival on the Captain's door to block the way while shown.";
}
return true;
}

// Vermilion Gym loads and joins the city by its door (14, 25), behind the
// tree (19, 24), an object Cut removes: from the Center no route on land
// reaches the gym, from the tree's tile one does. The beams on rows 6 and
// 7 are written off (OPENED_TILES), so a route reaches Lt. Surge (5, 2);
// the cans on rows 10, 12 and 14 are walls. Dwayne (8, 13) and Baily
// (2, 11) look every way, sight 3; Tucker (7, 8) west.
UnitTestResult test_vermilion_gym_map(){

Check warning on line 423 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps_Tests.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::test_vermilion_gym_map(): function_lines=43 (advisory above 25, limit 50)
const std::vector<MapData> maps = overworld_maps(map_flag_set(overworld_maps(), "new_game"));
const MapData* gym = built_in(maps, "VermilionCity_Gym");
if (gym == nullptr){
return "Missing map VermilionCity_Gym.";
}
RouteCosts walking = default_route_costs();
walking[RouteCost::SURF] = -1;
const MapPosition nurse{"VermilionCity_PokemonCenter_1F", {7, 4}};
const RouteGoal door{MapPosition{"VermilionCity_Gym", {5, 18}}, std::nullopt};
if (plan_overworld_route(maps, nurse, door, walking, Direction::NORTH)){
return "Expected the tree (19, 24) to shut the gym off from the Center.";
}
if (!plan_overworld_route(maps, MapPosition{"VermilionCity", {19, 24}}, door, walking, Direction::SOUTH)){
return "No route from the tree's tile into the gym.";
}
if (!plan_overworld_route(maps, MapPosition{"VermilionCity_Gym", {5, 8}}, RouteGoal{MapPosition{"VermilionCity_Gym", {5, 3}}, Direction::NORTH}, walking, Direction::NORTH)){
return "Expected a route through the beams, off, to Lt. Surge.";
}
for (int can : {1, 3, 5, 7, 9}){
for (int row : {10, 12, 14}){
if (tile_at(*gym, TilePos{can, row}) != TileKind::WALL){
return std::format("Expected a can at ({}, {}).", can, row);
}
}
}
struct Seen{
std::string_view name;
TilePos tile;
bool seen;
};
for (const Seen& check : std::initializer_list<Seen>{
{"sailor", {8, 15}, true}, {"sailor", {7, 15}, false}, {"sailor", {5, 13}, true}, {"sailor", {4, 13}, false},
{"balding_man", {2, 13}, true}, {"balding_man", {3, 13}, false}, {"balding_man", {5, 11}, true}, {"balding_man", {6, 11}, false},
{"gentleman", {4, 8}, true}, {"gentleman", {5, 9}, false}, {"gentleman", {8, 8}, false},
}){
const auto object = std::find_if(gym->objects.begin(), gym->objects.end(), [&](const MapObject& o){ return o.name == check.name; });
if (object == gym->objects.end() || trainer_may_see(*gym, *object, check.tile) != check.seen){
return std::format("{} {} ({}, {}).", check.name, check.seen ? "should see" : "shouldn't see", check.tile.x, check.tile.y);
}
}
return true;
}

// A planned step walks where its map doesn't let the player run, and only
// there: out of Pewter's Pokemon Center to the Gym.
UnitTestResult test_walk_only_indoors(){
Expand Down Expand Up @@ -619,6 +721,14 @@
.input = {.name = "Cerulean's Mart and Gym, Route 25 and Bill's Sea Cottage", .body = test_cerulean_maps},
.expectation = {.description = "validates Cerulean City, Gym, Mart, Route 25 and Sea Cottage map data"},
},
{
.input = {.name = "Route 5 and 6 to Vermilion City and the S.S. Anne", .body = test_vermilion_maps},
.expectation = {.description = "validates Route 5, Route 6, Vermilion City and S.S. Anne maps"},
},
{
.input = {.name = "Vermilion Gym: behind the tree, beams, cans and trainers' sight", .body = test_vermilion_gym_map},
.expectation = {.description = "validates Vermilion Gym layout, electric fences and trainer sightlines"},
},
};

} // namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,30 @@ WalkedTiles walked_near(const RouteStep& step, int estimate, Milliseconds tile_t
};
}

std::vector<RouteStep> with_warp_slack(std::vector<RouteStep> route){
const auto same_axis = [](Direction a, Direction b){ return (int)a % 2 == (int)b % 2; };
std::optional<Direction> further;
for (RouteStep& step : route){
if (step.action != RouteAction::WALK){
continue;
}
if (step.warps){
if (further && step.direction != *further && same_axis(step.direction, *further)){
step.warp_slack = 1;
}
further.reset();
continue;
}
if (step.to_wall && further && same_axis(step.direction, *further)){
further.reset();
}
if (!step.to_wall && !step.connection_steps.empty()){
further = step.direction;
}
}
return route;
}

WalkedTiles whole_leg(const RouteStep& step){
return WalkedTiles{.min = 0, .max = step.tiles};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class RouteRun{
, m_calls(calls)
, m_lines(calls, planning)
, m_steps(calls, planning != nullptr ? planning->wall_check : WallCheck::TAP)
, m_plan(route)
, m_plan(with_warp_slack(route))
, m_at(planning != nullptr ? planning->start : std::nullopt)
, m_facing(facing)
{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace{
Pokemon::LegSpec leg_spec(const RouteStep& step, MoveSpeed speed){
Pokemon::LegSpec leg;
leg.direction = step.direction;
leg.tiles = step.tiles;
leg.tiles = step.tiles + step.warp_slack;
leg.to_wall = step.to_wall;
leg.tile_time = tile_time(step, speed);
leg.stop_on_interrupt = !step.to_wall;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Overworld Route

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

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

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

std::optional<Pokemon::Step<State>> press(const State& state, Direction direction) const{
const std::optional<Transition> transition = PokemonFRLG::press(m_maps, state, direction);
if (!transition){
if (!transition || (transition->action == RouteAction::SURF && route_cost(m_costs, RouteCost::SURF) < 0)){
return std::nullopt;
}
Pokemon::Step<State> step;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum class RouteCost{
TILE,
TURN, // extra for a leg in a new direction
WARP, // the fade in and out
SURF, // the dialog and the animation
SURF, // the dialog and the animation; below 0, never
GRASS_TILE, // extra for tall grass, where wild Pokemon appear
// Extra for a leg that ends where the player could keep walking: it has
// to be timed, and if a message or a battle stops it part-way, where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ struct RouteStep{
// by the tiles alone ended a tile short (console B, 2026-11-03, rows
// 00.14, 00.16 and 00.20).
std::vector<int> connection_steps = {};
// WALK onto a warp: how many tiles further the player may stand from
// it than planned, which the hold goes on for, stopping at the fade.
// An open leg over a map connection before it may end a tile further
// on, when the game doesn't hold the player up there (console B,
// 2026-11-03, row 00.24). Set by with_warp_slack() when a route runs.
int warp_slack = 0;
// Which way the player faces after the step. Arriving at a door or a
// cave mouth, the game walks the player a tile out, facing south.
Direction facing_after = Direction::NORTH;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Overworld Sim

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

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

<file>: file_lines=777 (advisory above 500, limit 1000)
*
* From: https://github.com/PokemonAutomation/
*
Expand Down Expand Up @@ -53,6 +53,8 @@
constexpr Milliseconds NO_BATTLE_WAIT(15000);
constexpr Milliseconds BATTLE_TIME(10000);
constexpr Milliseconds MESSAGE_CLOSE(1000);
// The questions, "<MON> used CUT!" and the tree falling.
constexpr Milliseconds CUT_TIME(4000);
// Rows of black below a small room, seen from this near its bottom.
constexpr int BLACK_BELOW_ROWS = 5;
constexpr int SMALL_ROOM_ROWS = 20;
Expand Down Expand Up @@ -301,6 +303,10 @@
update_view();
if (step.warped){
m_state.warps++;
for (auto& [index, tree] : m_cut_trees){
m_maps[index].objects.push_back(tree);
}
m_cut_trees.clear();
m_frozen = true;
schedule(pressed + timing.tile, SimScreen::FADE, false);
schedule(pressed + timing.tile + timing.fade, SimScreen::OVERWORLD, true);
Expand Down Expand Up @@ -371,7 +377,7 @@
bump(direction, pressed);
return;
}
if (step->map != m_map && !step->warped){
if (m_script.connections_stall && step->map != m_map && !step->warped){
// The step onto a connected map waits a tile while the game
// loads it: a hold timed by its tiles alone ended a tile short
// (console B, 2026-11-03, rows 00.14, 00.16 and 00.20).
Expand Down Expand Up @@ -478,6 +484,24 @@
return true;
}

bool OverworldSim::cut_tree(){
std::vector<MapObject>& objects = m_maps[m_map].objects;
const TilePos ahead = m_player.position.next(m_state.facing);
for (size_t c = 0; c < objects.size(); c++){
if (objects[c].name == "cut_tree" && objects[c].x == ahead.x && objects[c].y == ahead.y
&& m_state.screen == SimScreen::OVERWORLD && !m_frozen
){
m_cut_trees.emplace_back(m_map, objects[c]);
objects.erase(objects.begin() + c);
advance_to(m_now + CUT_TIME);
note("cut the tree on " + to_string(MapPosition{map().name, ahead}) + ".");

Check warning on line 497 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
return true;
}
}
violation("no tree to cut " + std::string(direction_name(m_state.facing)) + " of " + to_string(m_state.position) + ".");

Check warning on line 501 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

style: build strings with std::format, not + on a literal / std::to_string / std::string (fork AGENTS.md "Strings")
return false;
}



//
Expand Down Expand Up @@ -614,7 +638,7 @@
const std::vector<Interrupt>& ints = interrupts(step);
Pokemon::LegSpec leg;
leg.direction = step.direction;
leg.tiles = step.tiles;
leg.tiles = step.tiles + step.warp_slack;
leg.to_wall = step.to_wall;
leg.tile_time = TILE_TIME;
leg.stop_on_interrupt = !step.to_wall;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <optional>
#include <set>
#include <string>
#include <utility>
#include <string_view>
#include <vector>
#include "Common/Cpp/Time.h"
Expand All @@ -48,7 +49,7 @@


// Simulates overworld movement, encounters and dialogs.
class OverworldSim{

Check warning on line 52 in SerialPrograms/Source/VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldSim.h

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::NintendoSwitch::PokemonFRLG::OverworldSim: public_methods=7 (advisory above 5, limit 7)
public:
OverworldSim(std::vector<MapData> maps, MapPosition start, Direction facing, SimScript script = {});

Expand Down Expand Up @@ -78,6 +79,11 @@
// battle follows it.
bool close_message();

// Cuts the tree the player faces (an object named "cut_tree") with
// YES to the game's question: it is gone until the player next warps,
// as its hide flag is a FLAG_TEMP. Returns whether there was one.
bool cut_tree();

private:
// A screen that shows at `at`; `unfreeze`: the player can move again.
struct Pending{
Expand Down Expand Up @@ -128,6 +134,8 @@
std::optional<size_t> m_trainer_speaking;
// The trainer whose battle is on screen or about to show.
std::optional<size_t> m_trainer;
// The trees cut since the last warp, and their maps.
std::vector<std::pair<int, MapObject>> m_cut_trees;
int m_grass_steps = 0;
int m_holds = 0;
SimState m_state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ struct SimScript{
// don't mark as grass: Mt. Moon B2F's tiles closed on one side ('8')
// are cave floor too (console B, 2026-11-03).
std::set<std::string> wild_floor_maps;
// Whether the game holds the player up a tile on a step onto a
// connected map. It did north onto Nugget Bridge (console B,
// 2026-11-03, rows 00.16 and 00.20), not south from Route 6 into
// Vermilion City (row 00.24).
bool connections_stall = true;
SimTiming timing;
};

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

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

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

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



// Story row 00.24 from Route 6 to Vermilion City's nurse: the open leg
// south 14 crosses onto Vermilion City and is held a tile longer for the
// game holding the player up there. It didn't: the player ended a tile
// south of (23, 7), the leg west on (15, 8), and the north 1 onto the
// Center's door only reached the tile below it: "no fade in and out"
// (console B, 2026-11-03). Either way the door is reached.
UnitTestResult test_route6_to_vermilion_center(){
const MapPosition nurse = at("VermilionCity_PokemonCenter_1F", 7, 4);
for (const bool stalls : {true, false}){
SimCase c{.start = at("Route6", 11, 33), .facing = Direction::EAST, .goal = nurse};
c.script.connections_stall = stalls;
const SimRun now = run_case(c);
if (!arrived(now, c.goal) || now.state.warps != 1){
return std::format("Expected the nurse reached by the Center's door, the crossing {}:", stalls ? "stalled" : "not stalled") + describe(now);
}
}
return true;
}

const OverworldSimCase OVERWORLD_SIM_CASES[] = {
{.input = {"the forest's north gate: no fade or black read as a battle", test_forest_north_gate}, .expectation = {},},
{.input = {"a battle on a leg onto a warp", test_battle_on_warp_leg}, .expectation = {},},
Expand All @@ -955,7 +974,8 @@
{.input = {"Cerulean Gym: to Misty and back round the pool, no trainer met", test_cerulean_gym_walks}, .expectation = {},},
{.input = {"Cerulean Gym: the straight ways meet Luis and Diana", test_cerulean_gym_lines}, .expectation = {},},
{.input = {"Cerulean: the Center to the rival's row and Nugget Bridge", test_cerulean_to_bridge}, .expectation = {},},
{.input = {"Nugget Bridge: each trainer met on the step onto their row", test_nugget_bridge_legs}, .expectation = {},},};
{.input = {"Nugget Bridge: each trainer met on the step onto their row", test_nugget_bridge_legs}, .expectation = {},}, {.input = {"Route 6 into Vermilion's Pokemon Center, the crossing stalled or not", test_route6_to_vermilion_center}, .expectation = {}},
};

void add_tests_OverworldSim(UnitTestDatabase& database){
for (const auto& item : OVERWORLD_SIM_CASES){
Expand All @@ -967,4 +987,4 @@

} // namespace PokemonFRLG
} // namespace NintendoSwitch
} // namespace PokemonAutomation
} // namespace PokemonAutomation
Loading
Loading