Skip to content

PokemonFRLG: navigation helpers (Sevii Islands Fly, field moves, items, party order) - #1905

Open
thewhitewolfking wants to merge 1 commit into
PokemonAutomation:mainfrom
thewhitewolfking:frlg-navigation
Open

thewhitewolfking wants to merge 1 commit into
PokemonAutomation:mainfrom
thewhitewolfking:frlg-navigation

Conversation

@thewhitewolfking

@thewhitewolfking thewhitewolfking commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Third split-up piece of #1887: reusable navigation moved into PokemonFRLG_Navigation, as suggested in review. No OCR.

Testing: the timings come from #1887's EXP Farmer runs on hardware (flying to One and Seven Island from the top-left corner, Cut, Surf, Max Repel). New and not yet tested on hardware: flying from the other corners (Three, Four, Five, Six Island) and picking SWITCH by wrapping around the Pokemon's menu.

Comment on lines +1178 to +1184
// Then tap across to the town.
int corner_x = target.corner_right ? SEVII_MAP_WIDTH - 1 : 0;
int corner_y = target.corner_bottom ? SEVII_MAP_HEIGHT - 1 : 0;
int dx = target.x - corner_x;
int dy = target.y - corner_y;
fly_map_cursor_tap(context, dx > 0 ? DPAD_RIGHT : DPAD_LEFT, dx > 0 ? dx : -dx);
fly_map_cursor_tap(context, dy > 0 ? DPAD_DOWN : DPAD_UP, dy > 0 ? dy : -dy);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flying from the Kanto map uses long presses rather than a series of taps, and these tend to be quite consistent. I'd prefer not to have two different approaches for the same thing, and the long presses will be slightly faster

int y;
bool corner_right;
bool corner_bottom;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Kanto don't have their coordinates directly stored (I just recorded inputs manually and replayed them to test for consistency), and they always start from the top left corner for simplicity. This new approach is fine, but I'd prefer not to have two independent approaches for the same thing. See https://github.com/PokemonAutomation/Arduino-Source/blob/main/SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Navigation.cpp#L1029-L1079 for the Kanto approach

Comment on lines +1216 to +1260
void use_field_move_from_overworld(ConsoleHandle& console, ProControllerContext& context, int from_last, int field_move){
uint16_t errors = 0;

while (true){
if (errors > 5){
OperationFailedExceptionWithScreenshot::fire(
ErrorReportMode::SEND_ERROR_REPORT,
"use_field_move_from_overworld(): Failed to open the Pokemon's menu 5 times in a row.",
console
);
}

open_party_menu_from_overworld(console, context);
// From slot 1, up goes to CANCEL, then to the last slot, then upward.
for (int i = 0; i < 2 + from_last; i++){
pbf_move_left_joystick(context, {0, +1}, 200ms, 300ms);
}

PartySelectionWatcher menu_opened(COLOR_RED);
context.wait_for_all_requests();
int ret = run_until<ProControllerContext>(
console, context,
[](ProControllerContext& context){
pbf_press_button(context, BUTTON_A, 200ms, 1800ms);
},
{ menu_opened }
);
if (ret < 0){
console.log("Failed to open the Pokemon's menu.");
errors++;
pbf_mash_button(context, BUTTON_B, 3000ms);
continue;
}

// The menu lists SUMMARY, then the field moves in the order the
// Pokemon knows them, then SWITCH, ITEM and CANCEL.
for (int i = 0; i < 1 + field_move; i++){
pbf_move_left_joystick(context, {0, -1}, 200ms, 300ms);
}
pbf_press_button(context, BUTTON_A, 200ms, 800ms);
context.wait_for_all_requests();
console.log("Used field move " + std::to_string(field_move + 1) + " of the Pokemon " + std::to_string(from_last) + " from the last.");
return;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a generalization of some existing functions for using Sweet Scent, Teleport, and Fly. Having this separate to avoid repeated code is good, but we should also incorporate it into open_fly_map_from_overworld, use_teleport_from_overworld, and use_sweet_scent_from_overworld to avoid redundancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants