Skip to content
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste

size_t get_start_segment_index();
size_t get_end_segment_index();
size_t get_start_checkpoint_index();
size_t get_end_checkpoint_index();

void run_autostory(SingleSwitchProgramEnvironment& env, ProControllerContext& context);

Expand All @@ -60,6 +62,8 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste

std::string start_segment_description();
std::string end_segment_description();
std::string start_checkpoint_description();
std::string end_checkpoint_description();

private:
OCR::LanguageOCROption LANGUAGE;
Expand All @@ -77,15 +81,26 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste
StringSelectOption STARTPOINT_MAINSTORY;
StringSelectOption ENDPOINT_MAINSTORY;

StringSelectOption START_CHECKPOINT_TUTORIAL;
StringSelectOption END_CHECKPOINT_TUTORIAL;

StringSelectOption START_CHECKPOINT_MAINSTORY;
StringSelectOption END_CHECKPOINT_MAINSTORY;

StaticTextOption SETUP_NOTE;
StaticTextOption MAINSTORY_NOTE;

StaticTextOption START_DESCRIPTION;
StaticTextOption END_DESCRIPTION;

StaticTextOption START_CHECKPOINT_DESCRIPTION;
StaticTextOption END_CHECKPOINT_DESCRIPTION;


EnumDropdownOption<StarterChoice> STARTERCHOICE;

BooleanCheckBoxOption ENABLE_ADVANCED_MODE;

GoHomeWhenDoneOption GO_HOME_WHEN_DONE;

EventNotificationOption NOTIFICATION_STATUS_UPDATE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,7 @@ void swap_starter_moves(SingleSwitchProgramEnvironment& env, ProControllerContex

}


void change_settings_prior_to_autostory(
SingleSwitchProgramEnvironment& env, ProControllerContext& context,
size_t current_segment_num,
Language language
){

void change_settings_prior_to_autostory_segment_mode(SingleSwitchProgramEnvironment& env, ProControllerContext& context, size_t current_segment_num, Language language){
// get index of `Options` in the Main Menu, which depends on where you are in Autostory
int8_t options_index;
std::string assumption_text = "";
Expand Down Expand Up @@ -555,6 +549,97 @@ void change_settings_prior_to_autostory(
env.console.log("change_settings_prior_to_autostory: " + assumption_text + " The index of \"Options\" in the Menu is " + std::to_string(options_index) + ".");

bool has_minimap = current_segment_num >= 2; // the minimap only shows up in segment 2 and beyond
change_settings_prior_to_autostory(env, context, options_index, has_minimap, language);
}

void change_settings_prior_to_autostory_checkpoint_mode(SingleSwitchProgramEnvironment& env, ProControllerContext& context, size_t current_checkpoint_num, Language language){
// get index of `Options` in the Main Menu, which depends on where you are in Autostory
int8_t options_index;
std::string assumption_text = "";
switch(current_checkpoint_num){
case 0:
return; // can't change settings in the intro cutscene
case 1:
case 2:
// after Intro cutscene done, in room
// Menu
// - Options
// - Save
options_index = 0;
assumption_text = "We assume 'Bag' is not yet unlocked.";
break;
case 3:
case 4:
// Menu
// - Bag --> unlocked after picked up bag/hat in room. Segment 01, checkpoint 02
// - Options
// - Save
options_index = 1;
assumption_text = "We assume 'Boxes' is not yet unlocked.";
break;
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
// Menu
// - Bag
// - Boxes --> unlocked after battling Nemona and receiving Pokedex app. Segment 02, checkpoint 04
// - Options
// - Save
options_index = 2;
assumption_text = "We assume 'Poke Portal' is not yet unlocked.";
break;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
// Menu
// - Bag
// - Boxes
// - Poke Portal --> unlocked after arriving at Los Platos and talking to Nemona. Segment 06, checkpoint 11
// - Options
// - Save
options_index = 3;
assumption_text = "We assume 'Picnic' is not yet unlocked.";
break;
default:
if(current_checkpoint_num <= 20){
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "change_settings_prior_to_autostory_checkpoint_mode: current_checkpoint_num should be greater than 20.");
}

// Menu
// - Bag
// - Boxes
// - Picnic --> unlocked after finishing tutorial. Segment 09, checkpoint 20
// - Poke Portal
// - Options
// - Save
options_index = 4;
assumption_text = "We assume that the tutorial is done, and all menu items are unlocked.";
break;
}

env.console.log("change_settings_prior_to_autostory: " + assumption_text + " The index of \"Options\" in the Menu is " + std::to_string(options_index) + ".");

bool has_minimap = current_checkpoint_num >= 3; // the minimap only shows up in checkpoint 3 and beyond
change_settings_prior_to_autostory(env, context, options_index, has_minimap, language);
}


void change_settings_prior_to_autostory(
SingleSwitchProgramEnvironment& env, ProControllerContext& context,
int options_index,
bool has_minimap,
Language language
){

enter_menu_from_overworld(env.program_info(), env.console, context, options_index, MenuSide::RIGHT, has_minimap);
change_settings(env, context, language);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ class AutoStory_Segment {
AutoStoryStats& stats) const = 0;
};

class AutoStory_Checkpoint {
public:
virtual ~AutoStory_Checkpoint() = default;
virtual std::string name() const = 0;
virtual std::string start_text() const = 0;
virtual std::string end_text() const = 0;
virtual void run_checkpoint(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
AutoStoryOptions options,
AutoStoryStats& stats) const = 0;
};


// press A to clear tutorial screens
// throw exception if tutorial screen never detected
Expand Down Expand Up @@ -262,12 +275,15 @@ void get_off_ride(const ProgramInfo& info, VideoStream& stream, ProControllerCon

void get_on_or_off_ride(const ProgramInfo& info, VideoStream& stream, ProControllerContext& context, bool get_on);

void change_settings_prior_to_autostory_segment_mode(SingleSwitchProgramEnvironment& env, ProControllerContext& context, size_t current_segment_num, Language language);
void change_settings_prior_to_autostory_checkpoint_mode(SingleSwitchProgramEnvironment& env, ProControllerContext& context, size_t current_checkpoint_num, Language language);

// change the settings prior to Autostory
// Assumes that `current_segment` represents where we currently are in the story.
void change_settings_prior_to_autostory(
SingleSwitchProgramEnvironment& env, ProControllerContext& context,
size_t current_segment_num,
int options_index,
bool has_minimap,
Language language
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,20 @@ void AutoStory_Segment_00::run_segment(
) const{

context.wait_for_all_requests();
env.console.log("Start Segment 00: Intro Cutscene", COLOR_ORANGE);
env.console.log("Start Segment " + name(), COLOR_ORANGE);

checkpoint_00(env, context);
AutoStory_Checkpoint_00().run_checkpoint(env, context, options, stats);

context.wait_for_all_requests();
env.console.log("End Segment 00: Intro Cutscene", COLOR_GREEN);
env.console.log("End Segment " + name(), COLOR_GREEN);
}

std::string AutoStory_Checkpoint_00::name() const{ return "000 - " + AutoStory_Segment_00().name(); }
std::string AutoStory_Checkpoint_00::start_text() const{ return "After selecting character name, style and the cutscene has started.";}
std::string AutoStory_Checkpoint_00::end_text() const{ return "Done cutscene. Stood up from chair. Walked to left side of room.";}
void AutoStory_Checkpoint_00::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_00(env, context);
}

void checkpoint_00(SingleSwitchProgramEnvironment& env, ProControllerContext& context){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ class AutoStory_Segment_00 : public AutoStory_Segment{
) const override;
};

class AutoStory_Checkpoint_00 : public AutoStory_Checkpoint{
public:
virtual std::string name() const override;
virtual std::string start_text() const override;
virtual std::string end_text() const override;
virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
};


// start: after selecting character name, style and the cutscene has started
// end: stood up from chair. Walked to left side of room.
void checkpoint_00(SingleSwitchProgramEnvironment& env, ProControllerContext& context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,36 @@ void AutoStory_Segment_01::run_segment(
stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 01: Pick Starter", COLOR_ORANGE);
env.console.log("Start Segment " + name(), COLOR_ORANGE);

AutoStory_Checkpoint_01().run_checkpoint(env, context, options, stats);
AutoStory_Checkpoint_02().run_checkpoint(env, context, options, stats);
AutoStory_Checkpoint_03().run_checkpoint(env, context, options, stats);

context.wait_for_all_requests();
env.console.log("End Segment " + name(), COLOR_GREEN);

}

std::string AutoStory_Checkpoint_01::name() const{ return "001 - " + AutoStory_Segment_01().name(); }
std::string AutoStory_Checkpoint_01::start_text() const{ return "Done cutscene. Stood up from chair. Walked to left side of room.";}
std::string AutoStory_Checkpoint_01::end_text() const{ return "Standing in room. Updated settings";}
void AutoStory_Checkpoint_01::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_01(env, context, options.notif_status_update, stats, options.language);
checkpoint_02(env, context, options.notif_status_update, stats);
checkpoint_03(env, context, options.notif_status_update, stats, options.language, options.starter_choice);
}

context.wait_for_all_requests();
env.console.log("End Segment 01: Pick Starter", COLOR_GREEN);
std::string AutoStory_Checkpoint_02::name() const{ return "002 - " + AutoStory_Segment_01().name(); }
std::string AutoStory_Checkpoint_02::start_text() const{ return AutoStory_Checkpoint_01().end_text();}
std::string AutoStory_Checkpoint_02::end_text() const{ return "Standing in front of the 'power of science' NPC. Cleared map tutorial.";}
void AutoStory_Checkpoint_02::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_02(env, context, options.notif_status_update, stats);
}

std::string AutoStory_Checkpoint_03::name() const{ return "003 - " + AutoStory_Segment_01().name(); }
std::string AutoStory_Checkpoint_03::start_text() const{ return AutoStory_Checkpoint_02().end_text();}
std::string AutoStory_Checkpoint_03::end_text() const{ return "Received starter Pokemon. Changed move order. Cleared autoheal tutorial.";}
void AutoStory_Checkpoint_03::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_03(env, context, options.notif_status_update, stats, options.language, options.starter_choice);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,31 @@ class AutoStory_Segment_01 : public AutoStory_Segment{
) const override;
};

class AutoStory_Checkpoint_01 : public AutoStory_Checkpoint{
public:
virtual std::string name() const override;
virtual std::string start_text() const override;
virtual std::string end_text() const override;
virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
};

class AutoStory_Checkpoint_02 : public AutoStory_Checkpoint{
public:
virtual std::string name() const override;
virtual std::string start_text() const override;
virtual std::string end_text() const override;
virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
};


class AutoStory_Checkpoint_03 : public AutoStory_Checkpoint{
public:
virtual std::string name() const override;
virtual std::string start_text() const override;
virtual std::string end_text() const override;
virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
};

// start: stood up from chair. Walked to left side of room.
// end: standing in room. updated settings
void checkpoint_01(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,21 @@ void AutoStory_Segment_02::run_segment(
stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 02: First Nemona Battle", COLOR_ORANGE);
env.console.log("Start Segment " + name(), COLOR_ORANGE);

checkpoint_04(env, context, options.notif_status_update, stats);
AutoStory_Checkpoint_04().run_checkpoint(env, context, options, stats);

context.wait_for_all_requests();
env.console.log("End Segment 02: First Nemona Battle", COLOR_GREEN);
env.console.log("End Segment " + name(), COLOR_GREEN);

}


std::string AutoStory_Checkpoint_04::name() const{ return "004 - " + AutoStory_Segment_02().name(); }
std::string AutoStory_Checkpoint_04::start_text() const{ return "Received starter Pokemon. Changed move order. Cleared autoheal tutorial.";}
std::string AutoStory_Checkpoint_04::end_text() const{ return "Battled Nemona on the beach.";}
void AutoStory_Checkpoint_04::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_04(env, context, options.notif_status_update, stats);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ class AutoStory_Segment_02 : public AutoStory_Segment{
) const override;
};

class AutoStory_Checkpoint_04 : public AutoStory_Checkpoint{
public:
virtual std::string name() const override;
virtual std::string start_text() const override;
virtual std::string end_text() const override;
virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
};


// start: Received starter pokemon and changed move order. Cleared autoheal tutorial.
// end: Battled Nemona on the beach.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,37 @@ void AutoStory_Segment_03::run_segment(SingleSwitchProgramEnvironment& env, ProC
stats.m_segment++;
env.update_stats();
context.wait_for_all_requests();
env.console.log("Start Segment 03: Catch Tutorial", COLOR_ORANGE);
env.console.log("Start Segment " + name(), COLOR_ORANGE);

checkpoint_05(env, context, options.notif_status_update, stats);
checkpoint_06(env, context, options.notif_status_update, stats);
checkpoint_07(env, context, options.notif_status_update, stats);
AutoStory_Checkpoint_05().run_checkpoint(env, context, options, stats);
AutoStory_Checkpoint_06().run_checkpoint(env, context, options, stats);
AutoStory_Checkpoint_07().run_checkpoint(env, context, options, stats);

context.wait_for_all_requests();
env.console.log("End Segment 03: Catch Tutorial", COLOR_GREEN);
env.console.log("End Segment " + name(), COLOR_GREEN);

}

std::string AutoStory_Checkpoint_05::name() const{ return "005 - " + AutoStory_Segment_03().name(); }
std::string AutoStory_Checkpoint_05::start_text() const{ return "Battled Nemona on the beach.";}
std::string AutoStory_Checkpoint_05::end_text() const{ return "Met mom at gate. Received mom's sandwich.";}
void AutoStory_Checkpoint_05::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_05(env, context, options.notif_status_update, stats);
}

std::string AutoStory_Checkpoint_06::name() const{ return "006 - " + AutoStory_Segment_03().name(); }
std::string AutoStory_Checkpoint_06::start_text() const{ return AutoStory_Checkpoint_05().end_text();}
std::string AutoStory_Checkpoint_06::end_text() const{ return "Cleared catch tutorial.";}
void AutoStory_Checkpoint_06::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_06(env, context, options.notif_status_update, stats);
}

std::string AutoStory_Checkpoint_07::name() const{ return "007 - " + AutoStory_Segment_03().name(); }
std::string AutoStory_Checkpoint_07::start_text() const{ return AutoStory_Checkpoint_06().end_text();}
std::string AutoStory_Checkpoint_07::end_text() const{ return "Moved to cliff. Heard mystery cry. Standing in front of Nemona near the cliff.";}
void AutoStory_Checkpoint_07::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_07(env, context, options.notif_status_update, stats);
}

void checkpoint_05(
SingleSwitchProgramEnvironment& env,
Expand Down
Loading