Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cc3450b
devtools: generate FRLG overworld maps as JSON from pokefirered
dayfine Nov 1, 2026
e770e3f
FRLG: overworld maps as plain data (tiles, grid, named points, flags)
dayfine Nov 1, 2026
d0bb032
FRLG: plan overworld routes with the shared leg planner
dayfine Nov 1, 2026
b734805
Pokemon navigation: leg walker with game-supplied movers and interrupts
dayfine Nov 1, 2026
6952e6c
FRLG: read which way the standing player faces
dayfine Nov 1, 2026
ab9a22e
FRLG: walk overworld routes with the leg walker
dayfine Nov 1, 2026
20291b6
Merge nav/shared (7008f8c67, #114) into frlg/mvp
dayfine Nov 1, 2026
b2e6af2
devtools: write FRLG maps into a C++ file for tests, and check it
dayfine Nov 1, 2026
5e99260
FRLG fix: check that the overworld is up before each step
dayfine Nov 1, 2026
9a8924b
FRLG fix: stop on a trainer battle instead of fleeing it
dayfine Nov 1, 2026
a31833d
devtools: check committed FRLG map files against the generator
dayfine Nov 1, 2026
165e907
Merge nav/shared (b426f749f, #114) into frlg/mvp
dayfine Nov 1, 2026
e5136bf
FRLG: leave the elevation grid out of maps that are all ground
dayfine Nov 1, 2026
1195b1b
Merge nav/shared (c7a2136f1) into frlg/mvp
dayfine Nov 1, 2026
bbc9ae2
Merge nav/shared (716bb5ae0) into frlg/mvp
dayfine Nov 1, 2026
878f884
Merge nav/shared (a38e45766, #114) into frlg/mvp: the leg walker now …
dayfine Nov 1, 2026
31601ef
Merge nav/story-steps (93075ab9c, #122) into frlg/mvp: FRLG builds on…
dayfine Nov 1, 2026
2172b9e
FRLG: #117 is the maps and the planner; the walker moves to #118
dayfine Nov 1, 2026
32acef6
Merge nav/story-steps (48ff39d51) into frlg/mvp
dayfine Nov 1, 2026
a6c81da
Merge nav/story-steps (daf7a0968) into frlg/mvp
dayfine Nov 1, 2026
232d718
Merge nav/story-steps (e67d36ccb) into frlg/mvp
dayfine Nov 1, 2026
dc99cf1
Merge nav/story-steps (b966c5d93) into frlg/mvp
dayfine Nov 1, 2026
8358f5a
Merge nav/story-steps (705b81fb6) into frlg/mvp
dayfine Nov 2, 2026
449ed43
FRLG: maps in the shared Pokemon::MapData schema
dayfine Nov 2, 2026
82c740f
FRLG: test maps in the shared schema
dayfine Nov 2, 2026
0bc538b
FRLG route: wall holds, leg tiles and a cost for open legs through grass
dayfine Nov 2, 2026
7c546fe
Merge origin/nav/story-steps into frlg/mvp
dayfine Nov 2, 2026
fc901ec
Merge nav/story-steps into frlg/mvp
dayfine Nov 2, 2026
9cf7e2a
FRLG: PlayerFacingReader image tests read the facing from the file name
dayfine Nov 3, 2026
f9893dd
Merge branch 'nav/story-steps' into frlg/mvp
dayfine Nov 3, 2026
b583188
FRLG maps: whether a trainer may see a tile
dayfine Nov 3, 2026
cfc85e2
FRLG route: never hold a leg into a warp to a map that isn't loaded
dayfine Nov 3, 2026
3414eaf
Leg walker: an open leg stopped at an interrupt says how far the timi…
dayfine Nov 3, 2026
ea20ba3
Merge nav/story-steps (24444f0fc, #122: verify mode) into frlg/mvp
dayfine Nov 3, 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
2 changes: 2 additions & 0 deletions SerialPrograms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/VideoGames/PokemonFRLG/Overworld/Maps
VideoGames/PokemonFRLG/Overworld/PokemonFRLG_OverworldMaps.h PokemonAutomation::NintendoSwitch::PokemonFRLG overworld_map_json)


# Create binary target
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}


LegResult walk_leg_with(const LegSpec& leg, const LegCalls& calls, size_t max_interruptions){

Check warning on line 50 in SerialPrograms/Source/Pokemon/Navigation/Pokemon_LegWalker.cpp

View workflow job for this annotation

GitHub Actions / code-health

Code health (advisory)

PokemonAutomation::Pokemon::walk_leg_with( const LegSpec & leg , const LegCalls & calls , size_t max_interruptions): function_lines=44 (advisory above 25, limit 50)
LegResult result;
int remaining = leg.tiles;
while (true){
Expand All @@ -63,9 +63,16 @@
calls.clear(outcome->interrupt);
const std::string seen = std::format("{} after {}ms", calls.name(outcome->interrupt), outcome->elapsed.count());
if (stops_here(leg, result, *outcome)){
calls.log(seen + ", stopping the leg.");
result.exact = false;
result.stopped = true;
if (leg.to_wall){
calls.log(seen + ", stopping the leg.");
return result;
}
// The caller finds the player again, near where the timing says.
result.tiles = leg.tiles - remaining
+ tiles_before_interrupt(leg, outcome->elapsed, calls.detection_delay(outcome->interrupt), remaining);
calls.log(std::format("{}, about {} of {} tiles walked, stopping the leg.", seen, result.tiles, leg.tiles));
return result;
}
if (leg.to_wall){
Expand Down
4 changes: 3 additions & 1 deletion SerialPrograms/Source/Pokemon/Navigation/Pokemon_LegWalker.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ struct LegResult{
bool exact = true;
size_t interruptions = 0;
// The leg stopped at an interrupt (stop_on_interrupt, stop_if_blocked):
// the player is somewhere along it, and `tiles` is not known.
// the player is somewhere along it. For an open leg `tiles` is then how
// many the interrupt's timing says were walked (tiles_before_interrupt()),
// for the caller to look around; for a leg to a wall it is 0.
bool stopped = false;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ UnitTestResult test_open_leg_interrupted_at_end(){
return true;
}

// An open leg set to stop at an interrupt doesn't walk on from a guess.
// An open leg set to stop at an interrupt doesn't walk on from a guess; it
// says how far the timing puts the player, for the caller to look around.
UnitTestResult test_open_leg_stops(){
ScriptedLeg script;
script.outcomes = {after_step(2)};
Expand All @@ -140,6 +141,9 @@ UnitTestResult test_open_leg_stops(){
if (script.holds.size() != 1 || !result.stopped || result.exact || script.cleared.size() != 1){
return "Expected one hold, the interrupt cleared, and the leg stopped.";
}
if (result.tiles != 2){
return std::format("Expected the timing to put the player 2 tiles in, got {}.", result.tiles);
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
{
"name": "CeruleanCave_1F",
"source": {
"decomp_file": "data/maps/CeruleanCave_1F/map.json",
"revision": "ce6406d8c2eaf46d543c8a2606de0c3cb1951982",
"date": "2026-10-31"
},
"tiles": [
"########################################",
"#######...##.#########wwwwwwwww#..##..##",
"#######......#########wwwwwwwww#......##",
"#######..##..#wwwwwwwwwwwwwwwww#......##",
"##.####..##..#wwwwwwwwww#...#ww##.######",
"##.#.........#wwwwwwwwww#...#wwwwwwwwww#",
"#..#....##...#www#..........#wwwwwwwwww#",
"#..#....##...#www#..........#wwwwwwwwww#",
"#..#....##...#www#.................#www#",
"####....##.###www#...######...#....#www#",
"##.#....#www##www#...##.####.......#www#",
"##......#www##www##.###...##.......#www#",
"##......#wwwwwwww#....#...##...#####www#",
"##......#wwwwwwww#..#.##.###...###.....#",
"##..##..#wwwwwwww#.........#...#.......#",
"##..#...#www#....##......###...#.....###",
"##......#...#....####...####...#...#####",
"##......#...#..................#...#####",
"#####.###...##.#...............#...#####",
"#####..........#...............#...#####",
"#####..........#...............#...#####",
"#####..........#################...#####",
"########################################"
],
"elevation": [
"0000000000000000000000000000000000000000",
"0000000333003000000000111111111033003300",
"0000000333333000000000111111111033333300",
"0000000330033011111111111111111033333300",
"0030000330033011111111110444011003000000",
"0030333333333011111111110444011111111110",
"0330333300333011104444444444011111111110",
"0330333300333011104444444444011111111110",
"0330333300333011104444444444444444401110",
"0000333300300011104440000004440444401110",
"0030333301110011104440030000444444401110",
"0033333301110011100000033300444444401110",
"0033333301111111103333033300444000001110",
"0033333301111111103303003000444000333330",
"0033003301111111103333333330444033333330",
"0033033301110444400333333000444033333000",
"0033333303330444400003330000444033300000",
"0033333303330444444444444444444033300000",
"0000030003330000444444444444444033300000",
"0000033333333330444444444444444033300000",
"0000033333333330444444444444444033300000",
"0000033333333330000000000000000033300000",
"0000000000000000000000000000000000000000"
],
"points": {
"entrance": [33, 21],
"warp_0": [33, 21],
"warp_1": [34, 2],
"warp_2": [1, 7],
"warp_3": [10, 2],
"warp_4": [5, 15],
"warp_5": [30, 10],
"warp_6": [24, 11],
"warp_7": [2, 4]
},
"warps": [
{
"x": 33,
"y": 21,
"enter": "walk_south",
"to_map": "CeruleanCity",
"to_point": "warp_7"
},
{
"x": 34,
"y": 2,
"enter": "step_on",
"to_map": "CeruleanCave_2F",
"to_point": "warp_0"
},
{
"x": 1,
"y": 7,
"enter": "step_on",
"to_map": "CeruleanCave_B1F",
"to_point": "warp_0"
},
{
"x": 10,
"y": 2,
"enter": "step_on",
"to_map": "CeruleanCave_2F",
"to_point": "warp_1"
},
{
"x": 5,
"y": 15,
"enter": "step_on",
"to_map": "CeruleanCave_2F",
"to_point": "warp_2"
},
{
"x": 30,
"y": 10,
"enter": "step_on",
"to_map": "CeruleanCave_2F",
"to_point": "warp_3"
},
{
"x": 24,
"y": 11,
"enter": "step_on",
"to_map": "CeruleanCave_2F",
"to_point": "warp_4"
},
{
"x": 2,
"y": 4,
"enter": "step_on",
"to_map": "CeruleanCave_2F",
"to_point": "warp_5"
}
],
"objects": [
{
"name": "item_ball",
"kind": "item",
"x": 7,
"y": 3,
"hide_flag": "FLAG_HIDE_CERULEAN_CAVE_1F_NUGGET"
},
{
"name": "item_ball",
"kind": "item",
"x": 11,
"y": 16,
"hide_flag": "FLAG_HIDE_CERULEAN_CAVE_1F_FULL_RESTORE"
},
{
"name": "item_ball",
"kind": "item",
"x": 25,
"y": 5,
"hide_flag": "FLAG_HIDE_CERULEAN_CAVE_1F_MAX_ELIXIR"
},
{
"name": "rock_smash_rock",
"kind": "npc",
"x": 7,
"y": 21,
"hide_flag": "FLAG_TEMP_12"
},
{
"name": "rock_smash_rock",
"kind": "npc",
"x": 13,
"y": 21,
"hide_flag": "FLAG_TEMP_13"
},
{
"name": "rock_smash_rock",
"kind": "npc",
"x": 5,
"y": 20,
"hide_flag": "FLAG_TEMP_14"
},
{
"name": "rock_smash_rock",
"kind": "npc",
"x": 14,
"y": 20,
"hide_flag": "FLAG_TEMP_15"
},
{
"name": "rock_smash_rock",
"kind": "npc",
"x": 11,
"y": 21,
"hide_flag": "FLAG_TEMP_16"
},
{
"name": "rock_smash_rock",
"kind": "npc",
"x": 9,
"y": 18,
"hide_flag": "FLAG_TEMP_17"
}
],
"flag_sets": {},
"connections": []
}
Loading
Loading