Skip to content

Commit

Permalink
minor tweak to press_Bs_to_back_to_overworld(). open_map_from_overwor…
Browse files Browse the repository at this point in the history
…ld() can now clear the tutorial screen.
  • Loading branch information
jw098 committed Sep 8, 2024
1 parent 7c4b81a commit 7e91ec1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
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

0 comments on commit 7e91ec1

Please sign in to comment.