Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor tweaks to press_Bs_to_back_to_overworld() and open_map_from_overworld() #477

Merged
merged 1 commit into from
Sep 9, 2024
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
17 changes: 13 additions & 4 deletions SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ void day_skip_from_overworld(ConsoleHandle& console, BotBaseContext& context){
resume_game_from_home(console, context);
}

void press_Bs_to_back_to_overworld(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context){
void press_Bs_to_back_to_overworld(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context, uint16_t seconds_between_b_presses){
context.wait_for_all_requests();
OverworldWatcher overworld(COLOR_RED);
int ret = run_until(
console, context,
[](BotBaseContext& context){
[seconds_between_b_presses](BotBaseContext& context){
pbf_wait(context, seconds_between_b_presses * TICKS_PER_SECOND); // avoiding pressing B if already in overworld
for (size_t c = 0; c < 10; c++){
pbf_press_button(context, BUTTON_B, 20, 230);
pbf_press_button(context, BUTTON_B, 20, seconds_between_b_presses * TICKS_PER_SECOND);
}
},
{overworld}
Expand All @@ -86,7 +87,12 @@ void press_Bs_to_back_to_overworld(const ProgramInfo& info, ConsoleHandle& conso
}
}

void open_map_from_overworld(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context){
void open_map_from_overworld(
const ProgramInfo& info,
ConsoleHandle& console,
BotBaseContext& context,
bool clear_tutorial
){
{
OverworldWatcher overworld(COLOR_CYAN);
context.wait_for_all_requests();
Expand Down Expand Up @@ -149,6 +155,9 @@ void open_map_from_overworld(const ProgramInfo& info, ConsoleHandle& console, Bo
if (map.map_in_fixed_view()){
return;
}else{ // click R joystick to change to fixed view
if (clear_tutorial){
pbf_press_button(context, BUTTON_A, 20, 105);
}
console.log("Map in rotate view, fix it");
console.overlay().add_log("Change map to fixed view", COLOR_WHITE);
pbf_press_button(context, BUTTON_RCLICK, 20, 105);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ void set_time_to_12am_from_home(const ProgramInfo& info, ConsoleHandle& console,
void day_skip_from_overworld(ConsoleHandle& console, BotBaseContext& context);

// Press B to return to the overworld
void press_Bs_to_back_to_overworld(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context);
void press_Bs_to_back_to_overworld(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context, uint16_t seconds_between_b_presses = 3);

// From overworld, open map. Will change map view from rotated to fixed if not already fixed.
void open_map_from_overworld(const ProgramInfo& info, ConsoleHandle& console, BotBaseContext& context);
void open_map_from_overworld(
const ProgramInfo& info,
ConsoleHandle& console,
BotBaseContext& context,
bool clear_tutorial = false
);

// From map, press A to fly to a travel spot.
// check_fly_menuitem == true: will detect if the "Fly" menuitem is available. Return false if no "Fly" menuitem (the game
Expand Down
Loading