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 @@ -251,6 +251,52 @@ bool confirm_marker_present(

}

void realign_player(const ProgramInfo& info, VideoStream& stream, ProControllerContext& context,
PlayerRealignMode realign_mode,
uint8_t move_x, uint8_t move_y, uint16_t move_duration
){
stream.log("Realigning player direction...");
switch (realign_mode){
case PlayerRealignMode::REALIGN_NEW_MARKER:
stream.log("Setting new map marker...");

handle_unexpected_battles(info, stream, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
open_map_from_overworld(info, stream, context);
});

pbf_press_button(context, BUTTON_ZR, 20, 105);
pbf_move_left_joystick(context, move_x, move_y, move_duration, 1 * TICKS_PER_SECOND);
pbf_press_button(context, BUTTON_A, 20, 105);
pbf_press_button(context, BUTTON_A, 20, 105);

handle_unexpected_battles(info, stream, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
leave_phone_to_overworld(info, stream, context);
});
return;
case PlayerRealignMode::REALIGN_OLD_MARKER:
handle_unexpected_battles(info, stream, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
open_map_from_overworld(info, stream, context, false);
});

handle_unexpected_battles(info, stream, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
leave_phone_to_overworld(info, stream, context);
});

pbf_press_button(context, BUTTON_L, 20, 105);
return;
case PlayerRealignMode::REALIGN_NO_MARKER:
pbf_move_left_joystick(context, move_x, move_y, move_duration, 1 * TICKS_PER_SECOND);
pbf_press_button(context, BUTTON_L, 20, 105);
return;
}

}


void overworld_navigation(
const ProgramInfo& info,
VideoStream& stream,
Expand Down Expand Up @@ -1090,6 +1136,8 @@ void checkpoint_reattempt_loop(

context.wait_for_all_requests();
action(i);

enter_menu_from_overworld(env.program_info(), env.console, context, -1);

break;
}catch(OperationFailedException& e){
Expand Down Expand Up @@ -1154,216 +1202,6 @@ void checkpoint_reattempt_loop_tutorial(



void move_from_glaseado_mountain_to_casseroya_watchtower3(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
context.wait_for_all_requests();

DirectionDetector direction;
direction.change_direction(env.program_info(), env.console, context, 1.448679);

pbf_move_left_joystick(context, 128, 0, 200, 50);


// marker 1 x=0.548438, y=0.273148
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::ZOOM_OUT, 0, 0, 0},
FlyPoint::POKECENTER,
{0.548438, 0.273148}
);

get_on_ride(env.program_info(), env.console, context);

handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 20, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);

// marker 2. : x=0.693229, y=0.459259
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::KEEP_ZOOM, 0, 0, 0},
FlyPoint::POKECENTER,
{0.693229, 0.459259}
);
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 20, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);

fly_to_overlapping_flypoint(env.program_info(), env.console, context);

}


void move_from_casseroya_watchtower3_to_dondozo_titan(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
context.wait_for_all_requests();

// marker 1 x=0.779167, y=0.274074
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::KEEP_ZOOM, 0, 0, 0},
FlyPoint::POKECENTER,
{0.779167, 0.274074}
);

get_on_ride(env.program_info(), env.console, context);

handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_DIALOG, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 20, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);

mash_button_till_overworld(env.console, context, BUTTON_A);

// resume marker 1
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 20, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);

// marker 2. : x=0.76875, y=0.298148
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::KEEP_ZOOM, 0, 0, 0},
FlyPoint::FAST_TRAVEL,
{0.76875, 0.298148}
);
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 30, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);


// marker 3. : x=0.752604, y=0.401852
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::KEEP_ZOOM, 0, 0, 0},
FlyPoint::FAST_TRAVEL,
{0.752604, 0.401852}
);
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_DIALOG, NavigationMovementMode::DIRECTIONAL_SPAM_A,
128, 0, 20, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);

clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE});
env.console.log("Battle Dondozo/Tatsugiri Titan phase 1.");
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);


}

void move_from_dondozo_titan_phase1_to_phase2(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
context.wait_for_all_requests();

// marker 1 x=0.832292, y=0.54537
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::KEEP_ZOOM, 0, 0, 0},
FlyPoint::FAST_TRAVEL,
{0.832292, 0.54537}
);

get_on_ride(env.program_info(), env.console, context);

handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 20, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);

// marker 2 x=0.393229, y=0.748148
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::ZOOM_IN, 0, 0, 0},
FlyPoint::FAST_TRAVEL,
{0.393229, 0.748148}
);
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 20, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);


// marker 3. go to Dondozo/Tatsugiri part 2 x=0.55625, y=0.324074
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::KEEP_ZOOM, 0, 255, 100},
FlyPoint::FAST_TRAVEL,
{0.55625, 0.324074}
);
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_DIALOG, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 80, 40, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);

clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE});

env.console.log("Battle Dondozo/Tatsugiri Titan phase 2.");
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG);
clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::BATTLE});

env.console.log("Battle Dondozo/Tatsugiri Titan phase 3.");
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG, {CallbackEnum::DIALOG_ARROW});
mash_button_till_overworld(env.console, context, BUTTON_A, 360);

}

void move_from_glaseado_mountain_to_montenevera(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
context.wait_for_all_requests();

Expand Down Expand Up @@ -1723,49 +1561,13 @@ void move_from_montenevera_to_glaseado_gym(SingleSwitchProgramEnvironment& env,

}

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

context.wait_for_all_requests();

// marker 1. set marker to pokecenter
realign_player_from_landmark(
env.program_info(), env.console, context,
{ZoomChange::KEEP_ZOOM, 128, 0, 50},
{ZoomChange::KEEP_ZOOM, 0, 0, 0}
);
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 0, 80, 10, false);
},
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
pbf_move_left_joystick(context, 255, 255, 40, 50);
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
}
);


// marker 2. set marker past pokecenter
handle_unexpected_battles(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 128, 0, 50);
});
overworld_navigation(env.program_info(), env.console, context,
NavigationStopCondition::STOP_TIME, NavigationMovementMode::DIRECTIONAL_ONLY,
128, 15, 12, 12, false); // can't wrap in handle_when_stationary_in_overworld(), since we expect to be stationary when walking into the pokecenter


fly_to_overlapping_flypoint(env.program_info(), env.console, context);

}


void move_from_glaseado_gym_to_north_province_area_one(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
context.wait_for_all_requests();

DirectionDetector direction;
handle_unexpected_battles(env.program_info(), env.console, context,
do_action_and_monitor_for_battles(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){

direction.change_direction(env.program_info(), env.console, context, 3.855289);
Expand Down Expand Up @@ -1876,7 +1678,7 @@ void move_from_glaseado_gym_to_north_province_area_one(SingleSwitchProgramEnviro

void move_from_north_province_area_one_to_fighting_base(SingleSwitchProgramEnvironment& env, ProControllerContext& context){
DirectionDetector direction;
handle_unexpected_battles(env.program_info(), env.console, context,
do_action_and_monitor_for_battles(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){

direction.change_direction(env.program_info(), env.console, context, 1.798578);
Expand Down Expand Up @@ -2331,7 +2133,7 @@ void move_from_west_province_area_one_north_to_alfornada(SingleSwitchProgramEnvi
context.wait_for_all_requests();
DirectionDetector direction;

handle_unexpected_battles(env.program_info(), env.console, context,
do_action_and_monitor_for_battles(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
// marker 1
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 140, 255, 30);
Expand Down Expand Up @@ -2432,7 +2234,7 @@ void move_from_west_province_area_one_north_to_alfornada(SingleSwitchProgramEnvi
{0.633333, 0.304630}
);

handle_unexpected_battles(env.program_info(), env.console, context,
do_action_and_monitor_for_battles(env.program_info(), env.console, context,
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
// walk towards wall
direction.change_direction(env.program_info(), env.console, context, 2.949863);
Expand Down
Loading