Skip to content

Commit 84a417f

Browse files
committed
SV Egg autonomous: update path to egg basket. change settings to turn on Camera support if fails to get to egg basket.
1 parent 38a0dbf commit 84a417f

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.h"
3030
#include "PokemonSV/Programs/Boxes/PokemonSV_BoxRelease.h"
3131
#include "PokemonSV/Programs/Sandwiches/PokemonSV_SandwichRoutines.h"
32+
#include "PokemonSV/Programs/AutoStory/PokemonSV_MenuOption.h"
3233
#include "PokemonSV_EggAutonomous.h"
3334

3435
namespace PokemonAutomation{
@@ -736,6 +737,26 @@ void EggAutonomous::save_game(SingleSwitchProgramEnvironment& env, ProController
736737
}
737738
}
738739

740+
void change_settings_egg_program(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language){
741+
int8_t options_index = 4;
742+
enter_menu_from_overworld(env.program_info(), env.console, context, options_index, MenuSide::RIGHT);
743+
MenuOption session(env.console, context, language);
744+
745+
std::vector<std::pair<MenuOptionItemEnum, std::vector<MenuOptionToggleEnum>>> options = {
746+
{MenuOptionItemEnum::TEXT_SPEED, {MenuOptionToggleEnum::FAST}},
747+
{MenuOptionItemEnum::SKIP_MOVE_LEARNING, {MenuOptionToggleEnum::ON}},
748+
{MenuOptionItemEnum::GIVE_NICKNAMES, {MenuOptionToggleEnum::OFF}},
749+
{MenuOptionItemEnum::CAMERA_SUPPORT, {MenuOptionToggleEnum::ON}},
750+
{MenuOptionItemEnum::AUTOSAVE, {MenuOptionToggleEnum::OFF}},
751+
752+
};
753+
session.set_options(options);
754+
755+
pbf_mash_button(context, BUTTON_A, 1 * TICKS_PER_SECOND);
756+
clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 5, {CallbackEnum::PROMPT_DIALOG});
757+
press_Bs_to_back_to_overworld(env.program_info(), env.console, context);
758+
}
759+
739760

740761
bool EggAutonomous::handle_recoverable_error(
741762
SingleSwitchProgramEnvironment& env, ProControllerContext& context,
@@ -780,6 +801,10 @@ bool EggAutonomous::handle_recoverable_error(
780801
env.log("Reset game to handle recoverable error");
781802
reset_game(env.program_info(), env.console, context);
782803

804+
if (e.message().find("collect_eggs_from_basket") != std::string::npos){
805+
change_settings_egg_program(env, context, LANGUAGE);
806+
}
807+
783808
return false;
784809
}
785810

SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggAutonomous.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class EggAutonomous : public SingleSwitchProgramInstance{
126126
bool m_in_critical_to_save_stage = false;
127127
};
128128

129-
129+
void change_settings_egg_program(SingleSwitchProgramEnvironment& env, ProControllerContext& context, Language language);
130130

131131

132132
}

SerialPrograms/Source/PokemonSV/Programs/Eggs/PokemonSV_EggRoutines.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,30 @@ void collect_eggs_after_sandwich(
351351
// Recall your ride to reduce obstacles.
352352
pbf_press_button(context, BUTTON_PLUS, 20, 105);
353353

354+
#if 1
355+
// this sequence will purposefully fail if Camera support is off.
356+
// If we fail to reach the egg basket, we can then check that Camera support is on.
357+
358+
// Move forward to table
359+
pbf_move_left_joystick(context, 128, 0, 80, 40);
360+
// Move left
361+
pbf_move_left_joystick(context, 0, 128, 40, 40);
362+
// Move forward to pass table
363+
pbf_move_left_joystick(context, 128, 0, 80, 40);
364+
// Move right
365+
pbf_move_left_joystick(context, 255, 128, 40, 85);
366+
// Move back/right to align to basket
367+
pbf_move_left_joystick(context, 240, 255, 40, 40);
368+
369+
// Move closer to the basket, up to the table
370+
pbf_press_button(context, BUTTON_L, 20, 105);
371+
pbf_move_left_joystick(context, 128, 0, 100, 40);
372+
373+
// face away from the table
374+
pbf_press_button(context, BUTTON_L, 20, 105);
375+
pbf_move_left_joystick(context, 128, 255, 10, 40);
376+
#endif
377+
354378
#if 0
355379
// Move left
356380
pbf_move_left_joystick(context, 0, 128, 80ms, 480ms);
@@ -371,7 +395,9 @@ void collect_eggs_after_sandwich(
371395
pbf_move_left_joystick(context, 255, 128, 80ms, 320ms);
372396
pbf_press_button(context, BUTTON_L, 120ms, 120ms);
373397
pbf_move_left_joystick(context, 128, 0, 160ms, 320ms);
374-
#else
398+
#endif
399+
400+
#if 0
375401
// Move left
376402
pbf_move_left_joystick(context, 0, 128, 40, 40);
377403
// Move forward to pass table

0 commit comments

Comments
 (0)