diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.cpp b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.cpp index f1cdc7c73..b6857799d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.cpp @@ -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} @@ -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(); @@ -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); diff --git a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.h b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.h index 579f9c36f..ee6e7e9ed 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.h +++ b/SerialPrograms/Source/PokemonSV/Programs/PokemonSV_Navigation.h @@ -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