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 @@ -4,6 +4,7 @@
*
*/

#include "CommonFramework/Exceptions/OperationFailedException.h"
#include "Kernels/Waterfill/Kernels_Waterfill_Types.h"
#include "CommonFramework/ImageTypes/ImageViewRGB32.h"
#include "CommonFramework/Tools/DebugDumper.h"
Expand Down Expand Up @@ -174,8 +175,11 @@ void DirectionDetector::change_direction(
VideoSnapshot screen = stream.video().snapshot();
double current = get_current_direction(stream, screen);
if (current < 0){
stream.log("Unable to detect current direction.");
return;
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"change_direction(): Unable to detect current direction.",
stream
);
}
double target = std::fmod(direction, (2 * PI));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,19 @@ void checkpoint_61(
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
[&](size_t attempt_number){

// first, clear Pokemon in Minimap.
env.console.log("Fly to neighbouring Pokecenter, then fly back, to clear any pokemon covering the minimap.");
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 0, 0, 0});
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 0, 0, 0});

// marker 1 keep{0.490625, 0.594444} in{0.589583, 0.569444}
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::ZOOM_IN, 0, 0, 0},
FlyPoint::POKECENTER,
{0.589583, 0.569444}
);

DirectionDetector direction;
VideoSnapshot snapshot = env.console.video().snapshot();
double current_direction = direction.get_current_direction(env.console, snapshot);
if (current_direction == -1){ // if unable to detect current direction, fly to neighbouring Pokecenter, then fly back. To hopefully clear any pokemon covering the Minimap.
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 0, 0, 0});
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 0, 0, 0});
}

direction.change_direction(env.program_info(), env.console, context, 0.278620);
pbf_move_left_joystick(context, 128, 0, 400, 50);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,19 @@ void checkpoint_71(SingleSwitchProgramEnvironment& env, ProControllerContext& co
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
[&](size_t attempt_number){
DirectionDetector direction;
VideoSnapshot snapshot = env.console.video().snapshot();
double current_direction = direction.get_current_direction(env.console, snapshot);
if (current_direction == -1){ // if unable to detect current direction, fly to neighbouring Pokecenter, then fly back. To hopefully clear any pokemon covering the Minimap.
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 0, 128, 75});
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 255, 128, 75});
}

env.console.log("Fly to neighbouring Pokecenter, then fly back, to clear any pokemon covering the minimap.");

// place down marker as a workaround with an issue with fly_to_overworld_from_map
// fly_to_overworld_from_map() will fail since the snowy background on the map will false positive the destinationMenuItemWatcher (MapDestinationMenuDetector at box {0.523000, 0.680000, 0.080000, 0.010000}), which causes the fly to fail
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::KEEP_ZOOM, 128, 255, 35},
FlyPoint::POKECENTER,
{0.54375, 0.662037}
);

move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 0, 128, 75});
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 255, 128, 75});


direction.change_direction(env.program_info(), env.console, context, 1.536225);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void checkpoint_76(SingleSwitchProgramEnvironment& env, ProControllerContext& co
wait_for_overworld(env.program_info(), env.console, context, 30);

// place down marker as a workaround with an issue with fly_to_overworld_from_map
// fly_to_overworld_from_map() will fail since the snowy background on the map will false positive the destinationMenuItemWatcher, which causes the fly to fail
// fly_to_overworld_from_map() will fail since the snowy background on the map will false positive the destinationMenuItemWatcher (MapDestinationMenuDetector at box {0.523000, 0.680000, 0.080000, 0.010000}), which causes the fly to fail
place_marker_offset_from_flypoint(env.program_info(), env.console, context,
{ZoomChange::ZOOM_IN, 0, 0, 0},
FlyPoint::POKECENTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@ void checkpoint_83(SingleSwitchProgramEnvironment& env, ProControllerContext& co
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
[&](size_t attempt_number){
DirectionDetector direction;
VideoSnapshot snapshot = env.console.video().snapshot();
double current_direction = direction.get_current_direction(env.console, snapshot);
if (current_direction == -1){ // if unable to detect current direction, fly to neighbouring Pokecenter, then fly back. To hopefully clear any pokemon covering the Minimap.
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 128, 0, 150});
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 128, 255, 150});
}

env.console.log("Fly to neighbouring Pokecenter, then fly back, to clear any pokemon covering the minimap.");
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 128, 0, 150});
move_cursor_towards_flypoint_and_go_there(env.program_info(), env.console, context, {ZoomChange::KEEP_ZOOM, 128, 255, 150});

realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 255, 140, 70);

Expand Down