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
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ AutoStory::AutoStory()
, STARTPOINT_TUTORIAL(
"<b>Start Point:</b><br>Program will start with this segment.",
TUTORIAL_SEGMENTS_SELECT_DATABASE(),
LockMode::UNLOCK_WHILE_RUNNING,
LockMode::LOCK_WHILE_RUNNING,
"0"
)
, ENDPOINT_TUTORIAL(
Expand Down Expand Up @@ -679,26 +679,39 @@ std::string AutoStory::end_segment_description(){
return ALL_AUTO_STORY_SEGMENT_LIST()[segment_index]->end_text();
}

size_t AutoStory::get_start_segment_index(){
size_t start = 0;

void AutoStory::run_autostory(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
AutoStoryOptions options{
LANGUAGE,
STARTERCHOICE,
NOTIFICATION_STATUS_UPDATE
};
if (STORY_SECTION == StorySection::TUTORIAL){
start = STARTPOINT_TUTORIAL.index();
}else if (STORY_SECTION == StorySection::MAIN_STORY){
start = (INDEX_OF_LAST_TUTORIAL_SEGMENT + 1) + STARTPOINT_MAINSTORY.index();
}

return start;
}

size_t start = STARTPOINT_TUTORIAL.index();
size_t end = ENDPOINT_TUTORIAL.index();
size_t AutoStory::get_end_segment_index(){
size_t end = 0;

if (STORY_SECTION == StorySection::TUTORIAL){
start = STARTPOINT_TUTORIAL.index();
end = ENDPOINT_TUTORIAL.index();
}else if (STORY_SECTION == StorySection::MAIN_STORY){
start = (INDEX_OF_LAST_TUTORIAL_SEGMENT + 1) + STARTPOINT_MAINSTORY.index();
end = (INDEX_OF_LAST_TUTORIAL_SEGMENT + 1) + ENDPOINT_MAINSTORY.index();
}

return end;
}


void AutoStory::run_autostory(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
AutoStoryOptions options{
LANGUAGE,
STARTERCHOICE,
NOTIFICATION_STATUS_UPDATE
};

for (size_t segment_index = start; segment_index <= end; segment_index++){
for (size_t segment_index = get_start_segment_index(); segment_index <= get_end_segment_index(); segment_index++){
ALL_AUTO_STORY_SEGMENT_LIST()[segment_index]->run_segment(env, context, options);
}
}
Expand Down Expand Up @@ -777,7 +790,7 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex

// Set settings. to ensure autosave is off.
if (CHANGE_SETTINGS){
change_settings_prior_to_autostory(env, context, STARTPOINT_TUTORIAL.index(), LANGUAGE);
change_settings_prior_to_autostory(env, context, get_start_segment_index(), LANGUAGE);
}

run_autostory(env, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste
int loop, int start_loop, int end_loop
);

size_t get_start_segment_index();
size_t get_end_segment_index();

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

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,29 +583,65 @@ void change_settings_prior_to_autostory(
size_t current_segment_num,
Language language
){
if (current_segment_num == 0){ // can't change settings in the intro cutscene
return;
}

// get index of `Options` in the Main Menu, which depends on where you are in Autostory
int8_t options_index;
switch(current_segment_num){
case 0:
return; // can't change settings in the intro cutscene
case 1:
// after Intro cutscene done, in room
// Menu
// - Options
// - Save
options_index = 0;
break;
case 1:
case 2:
// Menu
// - Bag --> unlocked after picked up bag/hat in room. Segment 01, checkpoint 02
// - Options
// - Save
options_index = 1;
break;
case 3:
case 4:
case 5:
case 6:
// Menu
// - Bag
// - Boxes --> unlocked after battling Nemona and receiving Pokedex app. Segment 02, checkpoint 04
// - Options
// - Save
options_index = 2;
break;
case 7:
case 8:
case 9:
// Menu
// - Bag
// - Boxes
// - Poke Portal --> unlocked after arriving at Los Platos and talking to Nemona. Segment 06, checkpoint 11
// - Options
// - Save
options_index = 3;
break;
default:
options_index = 2;
// Menu
// - Bag
// - Boxes
// - Picnic --> unlocked after finishing tutorial. Segment 09, checkpoint 20
// - Poke Portal
// - Options
// - Save
options_index = 4;
break;
}

bool has_minimap = current_segment_num > 1; // the minimap only shows up in segment 2 and beyond
bool has_minimap = current_segment_num >= 2; // the minimap only shows up in segment 2 and beyond

enter_menu_from_overworld(env.program_info(), env.console, context, options_index, MenuSide::RIGHT, has_minimap);
change_settings(env, context, language);
if(has_minimap){
if(!has_minimap){
pbf_mash_button(context, BUTTON_B, 2 * TICKS_PER_SECOND);
}else{
press_Bs_to_back_to_overworld(env.program_info(), env.console, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ void AutoStory_Segment_00::run_segment(

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

checkpoint_00(env, context);

context.wait_for_all_requests();
env.console.log("End Segment 00: Intro Cutscene", COLOR_GREEN);
env.console.overlay().add_log("End Segment 00: Intro Cutscene", COLOR_GREEN);
stats.m_segment++;
env.update_stats();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ void AutoStory_Segment_01::run_segment(

context.wait_for_all_requests();
env.console.log("Start Segment 01: Pick Starter", COLOR_ORANGE);
env.console.overlay().add_log("Start Segment 01: Pick Starter", COLOR_ORANGE);

checkpoint_01(env, context, options.notif_status_update, options.language);
checkpoint_02(env, context, options.notif_status_update);
checkpoint_03(env, context, options.notif_status_update, options.language, options.starter_choice);

context.wait_for_all_requests();
env.console.log("End Segment 02: Pick Starter", COLOR_GREEN);
env.console.overlay().add_log("End Segment 02: Pick Starter", COLOR_GREEN);
env.console.log("End Segment 01: Pick Starter", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ void AutoStory_Segment_02::run_segment(

context.wait_for_all_requests();
env.console.log("Start Segment 02: First Nemona Battle", COLOR_ORANGE);
env.console.overlay().add_log("Start Segment 02: First Nemona Battle", COLOR_ORANGE);

checkpoint_04(env, context, options.notif_status_update);

context.wait_for_all_requests();
env.console.log("End Segment 02: First Nemona Battle", COLOR_GREEN);
env.console.overlay().add_log("End Segment 02: First Nemona Battle", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ void AutoStory_Segment_03::run_segment(SingleSwitchProgramEnvironment& env, ProC

context.wait_for_all_requests();
env.console.log("Start Segment 03: Catch Tutorial", COLOR_ORANGE);
env.console.overlay().add_log("Start Segment 03: Catch Tutorial", COLOR_ORANGE);

checkpoint_05(env, context, options.notif_status_update);
checkpoint_06(env, context, options.notif_status_update);
checkpoint_07(env, context, options.notif_status_update);

context.wait_for_all_requests();
env.console.log("End Segment 03: Catch Tutorial", COLOR_GREEN);
env.console.overlay().add_log("End Segment 03: Catch Tutorial", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ void AutoStory_Segment_04::run_segment(

context.wait_for_all_requests();
env.console.log("Start Segment 04: Rescue Legendary", COLOR_ORANGE);
env.console.overlay().add_log("Start Segment 04: Rescue Legendary", COLOR_ORANGE);

checkpoint_08(env, context, options.notif_status_update);

context.wait_for_all_requests();
env.console.log("End Segment 04: Rescue Legendary", COLOR_GREEN);
env.console.overlay().add_log("End Segment 04: Rescue Legendary", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ void AutoStory_Segment_05::run_segment(

context.wait_for_all_requests();
env.console.log("Start Segment 05: First Arven Battle", COLOR_ORANGE);
env.console.overlay().add_log("Start Segment 05: First Arven Battle", COLOR_ORANGE);

checkpoint_09(env, context, options.notif_status_update);
checkpoint_10(env, context, options.notif_status_update);

context.wait_for_all_requests();
env.console.log("End Segment 05: First Arven Battle", COLOR_GREEN);
env.console.overlay().add_log("End Segment 05: First Arven Battle", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@ void AutoStory_Segment_06::run_segment(

context.wait_for_all_requests();
env.console.log("Start Segment 06: Go to Los Platos", COLOR_ORANGE);
env.console.overlay().add_log("Start Segment 06: Go to Los Platos", COLOR_ORANGE);

checkpoint_11(env, context, options.notif_status_update);

context.wait_for_all_requests();
env.console.log("End Segment 06: Go to Los Platos", COLOR_GREEN);
env.console.overlay().add_log("End Segment 06: Go to Los Platos", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ void AutoStory_Segment_07::run_segment(

context.wait_for_all_requests();
env.console.log("Start Segment 07: Go to Mesagoza South", COLOR_ORANGE);
env.console.overlay().add_log("Start Segment 07: Go to Mesagoza South", COLOR_ORANGE);

checkpoint_12(env, context, options.notif_status_update);

Expand All @@ -64,7 +63,6 @@ void AutoStory_Segment_07::run_segment(

context.wait_for_all_requests();
env.console.log("End Segment 07: Go to Mesagoza South", COLOR_GREEN);
env.console.overlay().add_log("End Segment 07: Go to Mesagoza South", COLOR_GREEN);
stats.m_segment++;
env.update_stats();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void AutoStory_Segment_09::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 09: Complete tutorial", COLOR_ORANGE);
env.console.log("Start Segment 09: Complete tutorial", COLOR_ORANGE);

checkpoint_16(env, context, options.notif_status_update);
checkpoint_17(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void AutoStory_Segment_10::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 10.1: Cortondo Gym - Go to Cortondo city", COLOR_ORANGE);
env.console.log("Start Segment 10.1: Cortondo Gym - Go to Cortondo city", COLOR_ORANGE);

checkpoint_21(env, context, options.notif_status_update);
checkpoint_22(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void AutoStory_Segment_11::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 10.2: Cortondo Gym - Gym challenge", COLOR_ORANGE);
env.console.log("Start Segment 10.2: Cortondo Gym - Gym challenge", COLOR_ORANGE);

checkpoint_24(env, context, options.notif_status_update);
checkpoint_25(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void AutoStory_Segment_12::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 10.3: Cortondo Gym - Gym battle", COLOR_ORANGE);
env.console.log("Start Segment 10.3: Cortondo Gym - Gym battle", COLOR_ORANGE);

checkpoint_28(env, context, options.notif_status_update);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void AutoStory_Segment_13::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 11.1: Bombirdier Titan: Go to West Province Area One Central Pokecenter", COLOR_ORANGE);
env.console.log("Start Segment 11.1: Bombirdier Titan: Go to West Province Area One Central Pokecenter", COLOR_ORANGE);

checkpoint_29(env, context, options.notif_status_update);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void AutoStory_Segment_14::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 11.2: Bombirdier Titan: Battle Bombirdier", COLOR_ORANGE);
env.console.log("Start Segment 11.2: Bombirdier Titan: Battle Bombirdier", COLOR_ORANGE);

checkpoint_30(env, context, options.notif_status_update);
checkpoint_31(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void AutoStory_Segment_15::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 12: Team Star (Dark)", COLOR_ORANGE);
env.console.log("Start Segment 12: Team Star (Dark)", COLOR_ORANGE);

checkpoint_32(env, context, options.notif_status_update);
checkpoint_33(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void AutoStory_Segment_16::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 13.1: Cascarrafa Gym (Water): Get Kofu's wallet", COLOR_ORANGE);
env.console.log("Start Segment 13.1: Cascarrafa Gym (Water): Get Kofu's wallet", COLOR_ORANGE);

checkpoint_35(env, context, options.notif_status_update);
checkpoint_36(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void AutoStory_Segment_17::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 13.2: Cascarrafa Gym (Water): Gym battle", COLOR_ORANGE);
env.console.log("Start Segment 13.2: Cascarrafa Gym (Water): Gym battle", COLOR_ORANGE);

checkpoint_37(env, context, options.notif_status_update);
checkpoint_38(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void AutoStory_Segment_18::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 14: Great Tusk/Iron Treads titan", COLOR_ORANGE);
env.console.log("Start Segment 14: Great Tusk/Iron Treads titan", COLOR_ORANGE);

checkpoint_39(env, context, options.notif_status_update);
checkpoint_40(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void AutoStory_Segment_19::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment 15.2: Klawf Titan: Battle Klawf", COLOR_ORANGE);
env.console.log("Start Segment 15.2: Klawf Titan: Battle Klawf", COLOR_ORANGE);

checkpoint_41(env, context, options.notif_status_update);
checkpoint_42(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void AutoStory_Segment_20::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment ", COLOR_ORANGE);
env.console.log("Start Segment ", COLOR_ORANGE);

checkpoint_43(env, context, options.notif_status_update);
checkpoint_44(env, context, options.notif_status_update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void AutoStory_Segment_21::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment ", COLOR_ORANGE);
env.console.log("Start Segment ", COLOR_ORANGE);

checkpoint_46(env, context, options.notif_status_update);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void AutoStory_Segment_22::run_segment(
AutoStoryStats& stats = env.current_stats<AutoStoryStats>();

context.wait_for_all_requests();
env.console.overlay().add_log("Start Segment ", COLOR_ORANGE);
env.console.log("Start Segment ", COLOR_ORANGE);

// checkpoint_(env, context, options.notif_status_update);

Expand Down
Loading