Skip to content

Commit 615cd15

Browse files
committed
cleanup
1 parent 9e6a8e3 commit 615cd15

File tree

8 files changed

+238
-90
lines changed

8 files changed

+238
-90
lines changed

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.cpp

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,15 @@ std::vector<std::unique_ptr<AutoStory_Checkpoint>> make_autoStory_checkpoint_lis
302302
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_95>());
303303
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_96>());
304304
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_97>());
305-
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_98>());
306-
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_99>());
305+
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_98>());
306+
checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_99>());
307+
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_100>());
308+
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_101>());
309+
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_102>());
310+
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_103>());
311+
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_104>());
312+
// checkpoint_list.emplace_back(std::make_unique<AutoStory_Checkpoint_105>());
313+
307314
}
308315

309316
return checkpoint_list;
@@ -391,7 +398,7 @@ AutoStory::~AutoStory(){
391398
ENABLE_TEST_REALIGN.remove_listener(*this);
392399
ENABLE_MISC_TEST.remove_listener(*this);
393400
TEST_PBF_LEFT_JOYSTICK.remove_listener(*this);
394-
TEST_PBF_LEFT_JOYSTICK2.remove_listener(*this);
401+
TEST_PBF_JOYSTICK2.remove_listener(*this);
395402
TEST_CURRENT_DIRECTION.remove_listener(*this);
396403
TEST_CHANGE_DIRECTION.remove_listener(*this);
397404
}
@@ -617,8 +624,8 @@ AutoStory::AutoStory()
617624
LockMode::UNLOCK_WHILE_RUNNING,
618625
0
619626
)
620-
, TEST_PBF_LEFT_JOYSTICK2(
621-
"<b>TEST2: pbf_move_left_joystick():</b>",
627+
, TEST_PBF_JOYSTICK2(
628+
"<b>TEST2: pbf_move_right_joystick():</b>",
622629
LockMode::UNLOCK_WHILE_RUNNING,
623630
false
624631
)
@@ -731,7 +738,7 @@ AutoStory::AutoStory()
731738
PA_ADD_OPTION(HOLD_TICKS);
732739
PA_ADD_OPTION(RELEASE_TICKS);
733740

734-
PA_ADD_OPTION(TEST_PBF_LEFT_JOYSTICK2);
741+
PA_ADD_OPTION(TEST_PBF_JOYSTICK2);
735742
PA_ADD_OPTION(X_MOVE2);
736743
PA_ADD_OPTION(Y_MOVE2);
737744
PA_ADD_OPTION(HOLD_TICKS2);
@@ -804,7 +811,7 @@ AutoStory::AutoStory()
804811
ENABLE_TEST_REALIGN.add_listener(*this);
805812
ENABLE_MISC_TEST.add_listener(*this);
806813
TEST_PBF_LEFT_JOYSTICK.add_listener(*this);
807-
TEST_PBF_LEFT_JOYSTICK2.add_listener(*this);
814+
TEST_PBF_JOYSTICK2.add_listener(*this);
808815
TEST_CURRENT_DIRECTION.add_listener(*this);
809816
TEST_CHANGE_DIRECTION.add_listener(*this);
810817
}
@@ -886,7 +893,7 @@ void AutoStory::on_config_value_changed(void* object){
886893
RELEASE_TICKS.set_visibility(ConfigOptionState::DISABLED);
887894
}
888895

889-
if (TEST_PBF_LEFT_JOYSTICK2){
896+
if (TEST_PBF_JOYSTICK2){
890897
X_MOVE2.set_visibility(ConfigOptionState::ENABLED);
891898
Y_MOVE2.set_visibility(ConfigOptionState::ENABLED);
892899
HOLD_TICKS2.set_visibility(ConfigOptionState::ENABLED);
@@ -1023,8 +1030,14 @@ void AutoStory::test_checkpoints(
10231030
checkpoint_list.push_back([&](){checkpoint_95(env, context, notif_status_update, stats);});
10241031
checkpoint_list.push_back([&](){checkpoint_96(env, context, notif_status_update, stats);});
10251032
checkpoint_list.push_back([&](){checkpoint_97(env, context, notif_status_update, stats);});
1026-
// checkpoint_list.push_back([&](){checkpoint_95(env, context, notif_status_update, stats);});
1027-
// checkpoint_list.push_back([&](){checkpoint_95(env, context, notif_status_update, stats);});
1033+
checkpoint_list.push_back([&](){checkpoint_98(env, context, notif_status_update, stats);});
1034+
checkpoint_list.push_back([&](){checkpoint_99(env, context, notif_status_update, stats);});
1035+
// checkpoint_list.push_back([&](){checkpoint_100(env, context, notif_status_update, stats);});
1036+
// checkpoint_list.push_back([&](){checkpoint_101(env, context, notif_status_update, stats);});
1037+
// checkpoint_list.push_back([&](){checkpoint_102(env, context, notif_status_update, stats);});
1038+
// checkpoint_list.push_back([&](){checkpoint_103(env, context, notif_status_update, stats);});
1039+
// checkpoint_list.push_back([&](){checkpoint_104(env, context, notif_status_update, stats);});
1040+
// checkpoint_list.push_back([&](){checkpoint_105(env, context, notif_status_update, stats);});
10281041

10291042

10301043
if (end == 0){
@@ -1239,8 +1252,8 @@ void AutoStory::test_code(SingleSwitchProgramEnvironment& env, ProControllerCont
12391252
return;
12401253
}
12411254

1242-
if (TEST_PBF_LEFT_JOYSTICK2){
1243-
pbf_move_left_joystick(context, X_MOVE2, Y_MOVE2, HOLD_TICKS2, RELEASE_TICKS2);
1255+
if (TEST_PBF_JOYSTICK2){
1256+
pbf_move_right_joystick(context, X_MOVE2, Y_MOVE2, HOLD_TICKS2, RELEASE_TICKS2);
12441257
return;
12451258
}
12461259

@@ -1289,7 +1302,7 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex
12891302

12901303

12911304
// test code
1292-
if (TEST_FLYPOINT_LOCATIONS || TEST_MOVE_CURSOR_OFFSET_FROM_FLYPOINT || ENABLE_TEST_CHECKPOINTS || ENABLE_TEST_REALIGN || ENABLE_MISC_TEST || TEST_PBF_LEFT_JOYSTICK || TEST_PBF_LEFT_JOYSTICK2 || TEST_CHANGE_DIRECTION || TEST_CURRENT_DIRECTION){
1305+
if (TEST_FLYPOINT_LOCATIONS || TEST_MOVE_CURSOR_OFFSET_FROM_FLYPOINT || ENABLE_TEST_CHECKPOINTS || ENABLE_TEST_REALIGN || ENABLE_MISC_TEST || TEST_PBF_LEFT_JOYSTICK || TEST_PBF_JOYSTICK2 || TEST_CHANGE_DIRECTION || TEST_CURRENT_DIRECTION){
12931306
test_code(env, context);
12941307
return;
12951308
}

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste
133133
SimpleIntegerOption<uint16_t> HOLD_TICKS;
134134
SimpleIntegerOption<uint16_t> RELEASE_TICKS;
135135

136-
BooleanCheckBoxOption TEST_PBF_LEFT_JOYSTICK2;
136+
BooleanCheckBoxOption TEST_PBF_JOYSTICK2;
137137
SimpleIntegerOption<uint8_t> X_MOVE2;
138138
SimpleIntegerOption<uint8_t> Y_MOVE2;
139139
SimpleIntegerOption<uint16_t> HOLD_TICKS2;

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_36.cpp

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void AutoStory_Segment_36::run_segment(
5353
env.console.log("Start Segment " + name(), COLOR_ORANGE);
5454

5555
AutoStory_Checkpoint_96().run_checkpoint(env, context, options, stats);
56-
// AutoStory_Checkpoint_97().run_checkpoint(env, context, options, stats);
56+
AutoStory_Checkpoint_97().run_checkpoint(env, context, options, stats);
5757

5858
context.wait_for_all_requests();
5959
env.console.log("End Segment " + name(), COLOR_GREEN);
@@ -74,19 +74,6 @@ void AutoStory_Checkpoint_97::run_checkpoint(SingleSwitchProgramEnvironment& env
7474
checkpoint_97(env, context, options.notif_status_update, stats);
7575
}
7676

77-
// std::string AutoStory_Checkpoint_98::name() const{ return "098 - " + AutoStory_Segment_3().name(); }
78-
// std::string AutoStory_Checkpoint_98::start_text() const{ return "";}
79-
// std::string AutoStory_Checkpoint_98::end_text() const{ return "";}
80-
// void AutoStory_Checkpoint_98::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
81-
// checkpoint_98(env, context, options.notif_status_update, stats);
82-
// }
83-
84-
// std::string AutoStory_Checkpoint_99::name() const{ return "099 - " + AutoStory_Segment_3().name(); }
85-
// std::string AutoStory_Checkpoint_99::start_text() const{ return "";}
86-
// std::string AutoStory_Checkpoint_99::end_text() const{ return "";}
87-
// void AutoStory_Checkpoint_99::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
88-
// checkpoint_99(env, context, options.notif_status_update, stats);
89-
// }
9077

9178

9279

@@ -96,8 +83,6 @@ void checkpoint_96(SingleSwitchProgramEnvironment& env, ProControllerContext& co
9683

9784
YOLOv5Detector yolo_detector(RESOURCE_PATH() + "PokemonSV/YOLO/A0-station-2.onnx");
9885

99-
#if 0
100-
#endif
10186

10287
pbf_move_left_joystick(context, 128, 255, 500, 100);
10388
pbf_wait(context, 3 * TICKS_PER_SECOND);
@@ -290,37 +275,6 @@ void checkpoint_96(SingleSwitchProgramEnvironment& env, ProControllerContext& co
290275
run_trainer_double_battle_press_A(env.console, context, BattleStopCondition::STOP_DIALOG);
291276
mash_button_till_overworld(env.console, context, BUTTON_A);
292277

293-
294-
295-
#if 0
296-
// align to rock.
297-
// center before:
298-
// center after:
299-
move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "rock", 0.000,
300-
[&](){
301-
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
302-
move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.000); // x-position of target object prior to camera move
303-
pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera
304-
}
305-
);
306-
move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "rock", 0.000,
307-
[&](){
308-
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
309-
pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera
310-
}
311-
);
312-
313-
// move towards rock until box:
314-
move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "rock",
315-
0.000, 0.000,
316-
[&](){
317-
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
318-
move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.000); // realign to target X
319-
pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera
320-
}
321-
);
322-
323-
#endif
324278

325279

326280
});
@@ -360,11 +314,6 @@ void checkpoint_97(SingleSwitchProgramEnvironment& env, ProControllerContext& co
360314
});
361315
}
362316

363-
// void checkpoint_98(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){
364-
// }
365-
366-
// void checkpoint_99(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){
367-
// }
368317

369318

370319

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_36.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,6 @@ class AutoStory_Checkpoint_97 : public AutoStory_Checkpoint{
4242
virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
4343
};
4444

45-
// class AutoStory_Checkpoint_98 : public AutoStory_Checkpoint{
46-
// public:
47-
// virtual std::string name() const override;
48-
// virtual std::string start_text() const override;
49-
// virtual std::string end_text() const override;
50-
// virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
51-
// };
52-
53-
// class AutoStory_Checkpoint_99 : public AutoStory_Checkpoint{
54-
// public:
55-
// virtual std::string name() const override;
56-
// virtual std::string start_text() const override;
57-
// virtual std::string end_text() const override;
58-
// virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
59-
// };
6045

6146
// start: Inside Area Zero Station 1. Deactivated the locks.
6247
// end: Outside Area Zero Station 2. Defeated Scream Tail/Iron Bundle.
@@ -66,14 +51,6 @@ void checkpoint_96(SingleSwitchProgramEnvironment& env, ProControllerContext& co
6651
// end: Inside Area Zero Station 2. Deactivated the locks.
6752
void checkpoint_97(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats);
6853

69-
// start:
70-
// end:
71-
void checkpoint_98(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats);
72-
73-
// start:
74-
// end:
75-
void checkpoint_99(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats);
76-
7754

7855

7956

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.cpp

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,68 @@ void AutoStory_Segment_37::run_segment(
5252
context.wait_for_all_requests();
5353
env.console.log("Start Segment " + name(), COLOR_ORANGE);
5454

55-
// AutoStory_Checkpoint_9().run_checkpoint(env, context, options, stats);
55+
AutoStory_Checkpoint_98().run_checkpoint(env, context, options, stats);
56+
AutoStory_Checkpoint_99().run_checkpoint(env, context, options, stats);
5657

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

6061
}
6162

63+
std::string AutoStory_Checkpoint_98::name() const{ return "098 - " + AutoStory_Segment_37().name(); }
64+
std::string AutoStory_Checkpoint_98::start_text() const{ return "";}
65+
std::string AutoStory_Checkpoint_98::end_text() const{ return "";}
66+
void AutoStory_Checkpoint_98::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
67+
checkpoint_98(env, context, options.notif_status_update, stats);
68+
}
69+
70+
std::string AutoStory_Checkpoint_99::name() const{ return "099 - " + AutoStory_Segment_37().name(); }
71+
std::string AutoStory_Checkpoint_99::start_text() const{ return "";}
72+
std::string AutoStory_Checkpoint_99::end_text() const{ return "";}
73+
void AutoStory_Checkpoint_99::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
74+
checkpoint_99(env, context, options.notif_status_update, stats);
75+
}
76+
77+
void checkpoint_98(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){
78+
checkpoint_reattempt_loop(env, context, notif_status_update, stats,
79+
[&](size_t attempt_number){
80+
81+
82+
#if 0
83+
// align to rock.
84+
// center before:
85+
// center after:
86+
move_camera_yolo(env, context, CameraAxis::Y, yolo_detector, "rock", 0.000,
87+
[&](){
88+
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
89+
move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.000); // x-position of target object prior to camera move
90+
pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera
91+
}
92+
);
93+
move_camera_yolo(env, context, CameraAxis::X, yolo_detector, "rock", 0.000,
94+
[&](){
95+
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
96+
pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera
97+
}
98+
);
99+
100+
// move towards rock until box:
101+
move_forward_until_yolo_object_above_min_size(env, context, yolo_detector, "rock",
102+
0.000, 0.000,
103+
[&](){
104+
run_wild_battle_press_A(env.console, context, BattleStopCondition::STOP_OVERWORLD);
105+
move_player_to_realign_via_yolo(env, context, yolo_detector, "rock", 0.000); // realign to target X
106+
pbf_move_left_joystick(context, 128, 0, 10, 50); // move forward to align with camera
107+
}
108+
);
109+
110+
#endif
111+
112+
});
113+
}
114+
115+
void checkpoint_99(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats){
116+
}
62117

63118

64119
}

SerialPrograms/Source/PokemonSV/Programs/AutoStory/PokemonSV_AutoStory_Segment_37.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,30 @@ class AutoStory_Segment_37 : public AutoStory_Segment{
2626
) const override;
2727
};
2828

29+
class AutoStory_Checkpoint_98 : public AutoStory_Checkpoint{
30+
public:
31+
virtual std::string name() const override;
32+
virtual std::string start_text() const override;
33+
virtual std::string end_text() const override;
34+
virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
35+
};
36+
37+
class AutoStory_Checkpoint_99 : public AutoStory_Checkpoint{
38+
public:
39+
virtual std::string name() const override;
40+
virtual std::string start_text() const override;
41+
virtual std::string end_text() const override;
42+
virtual void run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const override;
43+
};
44+
45+
46+
// start:
47+
// end:
48+
void checkpoint_98(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats);
49+
50+
// start:
51+
// end:
52+
void checkpoint_99(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats);
2953

3054

3155

0 commit comments

Comments
 (0)