Skip to content

Commit 5a95acf

Browse files
committed
Migrate AutoStory off old controller state joystick API.
1 parent 213da97 commit 5a95acf

File tree

8 files changed

+13
-11
lines changed

8 files changed

+13
-11
lines changed

SerialPrograms/Source/NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ void grip_menu_connect_go_home (ProControllerContext& context);
9898
// button overlapping, you should use ssf_* directly. (though lots of existing
9999
// programs already use this for overlapping)
100100
//
101+
#if 0
101102
void pbf_controller_state(
102103
ProControllerContext& context,
103104
Button button,
@@ -106,6 +107,7 @@ void pbf_controller_state(
106107
uint8_t right_x, uint8_t right_y,
107108
uint16_t ticks
108109
);
110+
#endif
109111
void pbf_controller_state(
110112
ProControllerContext& context,
111113
Button button,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void checkpoint_21(
118118
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 128, 0, 50);
119119
pbf_move_left_joystick(context, 128, 0, 200, 100);
120120
// run and jump over wall
121-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 100);
121+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 800ms);
122122

123123
BlackScreenOverWatcher black_screen(COLOR_RED, { 0.2, 0.2, 0.6, 0.6 });
124124
int ret = wait_until(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void checkpoint_35(
108108
// walk towards elevator
109109
pbf_move_left_joystick(context, 128, 0, 700, 100);
110110
// jump to ensure you get on elevator
111-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 200);
111+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 1600ms);
112112
pbf_wait(context, 3 * TICKS_PER_SECOND);
113113
// wait for overworld to reappear after stepping off elevator
114114
wait_for_overworld(env.program_info(), env.console, context, 30);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void checkpoint_38(
153153
// walk towards elevator
154154
pbf_move_left_joystick(context, 128, 0, 700, 100);
155155
// jump to ensure you get on elevator
156-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 200);
156+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 1600ms);
157157
pbf_wait(context, 3 * TICKS_PER_SECOND);
158158
// wait for overworld to reappear after stepping off elevator
159159
wait_for_overworld(env.program_info(), env.console, context, 30);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void checkpoint_40(
265265

266266
// jump over the fence to exit Mesagoza
267267
pbf_move_left_joystick(context, 128, 0, 200, 50);
268-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 200);
268+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 1600ms);
269269

270270
wait_for_overworld(env.program_info(), env.console, context);
271271

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ void checkpoint_44(
361361

362362
// align to corner 7.5. bush
363363
direction.change_direction(env.program_info(), env.console, context, 3.11);
364-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 150);
364+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 1200ms);
365365
pbf_move_left_joystick(context, 128, 0, 60, 100);
366366
direction.change_direction(env.program_info(), env.console, context, 4.28);
367367
pbf_move_left_joystick(context, 128, 0, 200, 100);
@@ -385,7 +385,7 @@ void checkpoint_44(
385385
// align to corner 8.1. bush
386386
direction.change_direction(env.program_info(), env.console, context, 4.54);
387387
pbf_move_left_joystick(context, 128, 0, 200, 100);
388-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 150);
388+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 1200ms);
389389
pbf_move_left_joystick(context, 128, 0, 200, 100);
390390
direction.change_direction(env.program_info(), env.console, context, 3.60);
391391
pbf_move_left_joystick(context, 128, 0, 400, 100);
@@ -416,7 +416,7 @@ void checkpoint_44(
416416
pbf_move_left_joystick(context, 128, 255, 200, 100);
417417
direction.change_direction(env.program_info(), env.console, context, 4.89);
418418
pbf_move_left_joystick(context, 128, 0, 350, 100);
419-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 180);
419+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 1440ms);
420420
get_off_ride(env.program_info(), env.console, context);
421421
direction.change_direction(env.program_info(), env.console, context, 3.60);
422422
pbf_move_left_joystick(context, 128, 0, 600, 100);
@@ -463,7 +463,7 @@ void checkpoint_44(
463463
// align to corner 11.1. bush
464464
direction.change_direction(env.program_info(), env.console, context, 0.65);
465465
pbf_move_left_joystick(context, 128, 0, 200, 100);
466-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 150);
466+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 1200ms);
467467
pbf_move_left_joystick(context, 128, 0, 800, 100);
468468

469469
direction.change_direction(env.program_info(), env.console, context, 4.49);
@@ -515,7 +515,7 @@ void checkpoint_45(
515515
pbf_move_left_joystick(context, 128, 0, 400, 100);
516516

517517
direction.change_direction(env.program_info(), env.console, context, 2.18);
518-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 150);
518+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 1200ms);
519519
pbf_move_left_joystick(context, 128, 0, 400, 100);
520520
direction.change_direction(env.program_info(), env.console, context, 3.16);
521521
pbf_move_left_joystick(context, 0, 0, 100, 50);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void checkpoint_50(
171171
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
172172
// jump over the fence when stationary
173173
context.wait_for_all_requests();
174-
pbf_controller_state(context, BUTTON_B, DPAD_NONE, 128, 0, 128, 128, 100);
174+
pbf_controller_state(context, BUTTON_B, DPAD_NONE, {0, +1}, {0, 0}, 800ms);
175175
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
176176
}
177177
);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void checkpoint_55(
129129
direction.change_direction(env.program_info(), env.console, context, 2.565);
130130
// run at Orthworm. run into its second position as well.
131131
pbf_move_left_joystick(context, 128, 0, 50, 0);
132-
pbf_controller_state(context, BUTTON_LCLICK, DPAD_NONE, 128, 0, 128, 128, 500);
132+
pbf_controller_state(context, BUTTON_LCLICK, DPAD_NONE, {0, +1}, {0, 0}, 4000ms);
133133
pbf_move_left_joystick(context, 255, 0, 300, 500);
134134

135135
get_off_ride(env.program_info(), env.console, context);

0 commit comments

Comments
 (0)