Skip to content

Commit 602c122

Browse files
committed
Partial ticks migration for AutoStory.
1 parent adaa185 commit 602c122

File tree

40 files changed

+552
-425
lines changed

40 files changed

+552
-425
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,8 +1207,8 @@ void realign_player_from_landmark(
12071207
}
12081208
uint8_t move_x1 = move_cursor_near_landmark.move_x;
12091209
uint8_t move_y1 = move_cursor_near_landmark.move_y;
1210-
uint16_t move_duration1 = move_cursor_near_landmark.move_duration;
1211-
pbf_move_left_joystick(context, move_x1, move_y1, move_duration1, 1 * TICKS_PER_SECOND);
1210+
Milliseconds move_duration1 = move_cursor_near_landmark.move_duration;
1211+
pbf_move_left_joystick(context, move_x1, move_y1, move_duration1, 1000ms);
12121212

12131213
// move cursor to pokecenter
12141214
double push_scale = 0.29 * adjustment_table[try_count];
@@ -1243,8 +1243,8 @@ void realign_player_from_landmark(
12431243
}
12441244
uint8_t move_x2 = move_cursor_to_target.move_x;
12451245
uint8_t move_y2 = move_cursor_to_target.move_y;
1246-
uint16_t move_duration2 = move_cursor_to_target.move_duration;
1247-
pbf_move_left_joystick(context, move_x2, move_y2, move_duration2, 1 * TICKS_PER_SECOND);
1246+
Milliseconds move_duration2 = move_cursor_to_target.move_duration;
1247+
pbf_move_left_joystick(context, move_x2, move_y2, move_duration2, 1000ms);
12481248

12491249
// place down marker
12501250
pbf_press_button(context, BUTTON_A, 20, 105);
@@ -1337,8 +1337,8 @@ void move_cursor_towards_flypoint_and_go_there(
13371337
}
13381338
uint8_t move_x1 = move_cursor_near_flypoint.move_x;
13391339
uint8_t move_y1 = move_cursor_near_flypoint.move_y;
1340-
uint16_t move_duration1 = move_cursor_near_flypoint.move_duration;
1341-
pbf_move_left_joystick(context, move_x1, move_y1, move_duration1, 1 * TICKS_PER_SECOND);
1340+
Milliseconds move_duration1 = move_cursor_near_flypoint.move_duration;
1341+
pbf_move_left_joystick(context, move_x1, move_y1, move_duration1, 1000ms);
13421342

13431343
double push_scale = 0.29 * adjustment_table[try_count];
13441344
if (!fly_to_visible_closest_flypoint_cur_zoom_level(info, stream, context, fly_point, push_scale)){

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void checkpoint_02(
131131
env.console.log("Go to the kitchen, talk with mom");
132132
env.console.overlay().add_log("Go to the kitchen, talk with mom", COLOR_WHITE);
133133
pbf_move_left_joystick(context, 128, 255, 2000ms, 160ms);
134-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60, 0, 128);
134+
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60000ms, 0, 128);
135135

136136
env.console.log("clear_dialog: Talk with Mom.");
137137
clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 5, {});
@@ -140,7 +140,7 @@ void checkpoint_02(
140140
env.console.log("Go to the front door, talk with Clavell");
141141
env.console.overlay().add_log("Go to the front door, talk with Clavell", COLOR_WHITE);
142142
pbf_move_left_joystick(context, 230, 200, 2000ms, 160ms);
143-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60, 255, 128);
143+
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60000ms, 255, 128);
144144

145145
env.console.log("clear_dialog: Talk with Clavell at front door.");
146146
clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 5, {});
@@ -162,15 +162,15 @@ void checkpoint_02(
162162
pbf_move_left_joystick(context, 0, 0, 3000ms, 160ms);
163163
pbf_move_left_joystick(context, 0, 128, 3000ms, 160ms);
164164
pbf_move_left_joystick(context, 128, 255, 4000ms, 160ms);
165-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60, 0, 128);
165+
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60000ms, 0, 128);
166166

167167
env.console.log("clear_dialog: Talk with Clavell at living room.");
168168
clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 10, {});
169169

170170
context.wait_for_all_requests();
171171
env.console.log("Go outside, receive Rotom Phone");
172172
env.console.overlay().add_log("Go outside, receive Rotom Phone", COLOR_WHITE);
173-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60, 245, 230);
173+
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60000ms, 245, 230);
174174

175175
env.console.log("clear_dialog: Talk with Clavell outside. Receive Rotom phone. Stop when detect overworld.");
176176
clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60, {CallbackEnum::OVERWORLD, CallbackEnum::WHITE_A_BUTTON});
@@ -201,7 +201,7 @@ void checkpoint_03(
201201
pbf_move_left_joystick(context, 0, 128, 30, 50);
202202

203203
direction.change_direction(env.program_info(), env.console, context, 4.62);
204-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 20);
204+
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 20000ms);
205205

206206
context.wait_for_all_requests();
207207
env.console.log("Entered Nemona's house");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void checkpoint_04(
8585
direction.change_direction(env.program_info(), env.console, context, 4.55);
8686
pbf_move_left_joystick(context, 128, 0, 600, 50);
8787
direction.change_direction(env.program_info(), env.console, context, 5.27);
88-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 20);
88+
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 160ms);
8989

9090
context.wait_for_all_requests();
9191
env.console.log("Starting battle...");

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ void checkpoint_05(
9292
direction.change_direction(env.program_info(), env.console, context, 1.92);
9393
pbf_move_left_joystick(context, 128, 0, 7000ms, 400ms);
9494
direction.change_direction(env.program_info(), env.console, context, 1.13);
95-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 20);
95+
walk_forward_until_dialog(
96+
env.program_info(),
97+
env.console,
98+
context,
99+
NavigationMovementMode::DIRECTIONAL_ONLY,
100+
20000ms
101+
);
96102

97103
context.wait_for_all_requests();
98104
env.console.log("Get mom's sandwich");

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ void checkpoint_08(
9292
context.wait_for_all_requests();
9393
clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 10, {});
9494
env.console.log("Go to Legendary pokemon laying on the beach.");
95-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_SPAM_A, 30);
95+
walk_forward_until_dialog(
96+
env.program_info(),
97+
env.console,
98+
context,
99+
NavigationMovementMode::DIRECTIONAL_SPAM_A,
100+
30000ms
101+
);
96102

97103
env.console.log("clear_dialog: Offer Miraidon/Koraidon a sandwich.");
98104
clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 10, {});
@@ -139,7 +145,14 @@ void checkpoint_08(
139145
realign_player(env.program_info(), stream, context, PlayerRealignMode::REALIGN_NO_MARKER, 150, 20, 20);
140146
pbf_move_left_joystick(context, 128, 0, 1000, 50);
141147
realign_player(env.program_info(), stream, context, PlayerRealignMode::REALIGN_NO_MARKER, 160, 20, 20);
142-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60, 128, 0);
148+
walk_forward_until_dialog(
149+
env.program_info(),
150+
env.console,
151+
context,
152+
NavigationMovementMode::DIRECTIONAL_ONLY,
153+
60000ms,
154+
128, 0
155+
);
143156
}
144157
);
145158

@@ -190,7 +203,14 @@ void checkpoint_08(
190203
);
191204

192205
env.console.log("overworld_navigation: Go to Houndoom.");
193-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60, 128, 0);
206+
walk_forward_until_dialog(
207+
env.program_info(),
208+
env.console,
209+
context,
210+
NavigationMovementMode::DIRECTIONAL_ONLY,
211+
60000ms,
212+
128, 0
213+
);
194214

195215
mash_button_till_overworld(env.console, context, BUTTON_A);
196216

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ void checkpoint_13(
105105
context.wait_for_all_requests();
106106
realign_player(info, env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 0, 80, 50);
107107
walk_forward_while_clear_front_path(info, env.console, context, 500);
108-
walk_forward_until_dialog(info, env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 30);
108+
walk_forward_until_dialog(
109+
info,
110+
env.console,
111+
context,
112+
NavigationMovementMode::DIRECTIONAL_ONLY,
113+
30000ms
114+
);
109115
});
110116

111117
env.console.log("clear_dialog: Talk with Nemona at Mesagoza gate. Stop when detect battle.");
@@ -151,7 +157,13 @@ void checkpoint_14(
151157
// realign going straight
152158
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_NEW_MARKER, 128, 0, 100);
153159
// walk forward until hit dialog at top of stairs
154-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60);
160+
walk_forward_until_dialog(
161+
env.program_info(),
162+
env.console,
163+
context,
164+
NavigationMovementMode::DIRECTIONAL_ONLY,
165+
60000ms
166+
);
155167
// clear dialog until battle. with prompt, battle
156168
env.console.log("clear_dialog: Talk with Team Star at the top of the stairs. Stop when detect battle.");
157169
clear_dialog(env.console, context, ClearDialogMode::STOP_BATTLE, 60, {CallbackEnum::PROMPT_DIALOG, CallbackEnum::BATTLE, CallbackEnum::DIALOG_ARROW});
@@ -194,7 +206,13 @@ void checkpoint_15(
194206
// realign going straight
195207
realign_player(env.program_info(), env.console, context, PlayerRealignMode::REALIGN_OLD_MARKER);
196208
// walk forward until hit dialog inside the school
197-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60);
209+
walk_forward_until_dialog(
210+
env.program_info(),
211+
env.console,
212+
context,
213+
NavigationMovementMode::DIRECTIONAL_ONLY,
214+
60000ms
215+
);
198216

199217
env.console.log("clear_dialog: Talk with Nemona, Clavell, and Jacq inside the school. Stop when detect overworld.");
200218
clear_dialog(env.console, context, ClearDialogMode::STOP_OVERWORLD, 60,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void checkpoint_17(
156156
context.wait_for_all_requests();
157157

158158
// walk backwards until dialog
159-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 20, 128, 255);
159+
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 20000ms, 128, 255);
160160
env.console.log("Talk with Cassiopeia.");
161161
mash_button_till_overworld(env.console, context, BUTTON_A, 360);
162162

@@ -277,7 +277,7 @@ void checkpoint_20(
277277
env.console.log("Leave dorm for schoolyard.");
278278
mash_button_till_overworld(env.console, context, BUTTON_A, 360);
279279

280-
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60, 128, 0);
280+
walk_forward_until_dialog(env.program_info(), env.console, context, NavigationMovementMode::DIRECTIONAL_ONLY, 60000ms, 128, 0);
281281

282282
env.console.log("Talk to Nemona, Arven, Cassiopeia.");
283283
clear_dialog(env.console, context, ClearDialogMode::STOP_TIMEOUT, 16,

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ void checkpoint_22(
158158
// section 1
159159
realign_player_from_landmark(
160160
env.program_info(), env.console, context,
161-
{ZoomChange::ZOOM_IN, 0, 128, 80},
162-
{ZoomChange::KEEP_ZOOM, 255, 80, 37}
161+
{ZoomChange::ZOOM_IN, 0, 128, 640ms},
162+
{ZoomChange::KEEP_ZOOM, 255, 80, 296ms}
163163
);
164164
overworld_navigation(env.program_info(), env.console, context,
165165
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
@@ -168,8 +168,8 @@ void checkpoint_22(
168168
// section 2
169169
realign_player_from_landmark(
170170
env.program_info(), env.console, context,
171-
{ZoomChange::ZOOM_IN, 0, 128, 40},
172-
{ZoomChange::KEEP_ZOOM, 255, 255, 27}
171+
{ZoomChange::ZOOM_IN, 0, 128, 320ms},
172+
{ZoomChange::KEEP_ZOOM, 255, 255, 216ms}
173173
);
174174
overworld_navigation(env.program_info(), env.console, context,
175175
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
@@ -178,8 +178,8 @@ void checkpoint_22(
178178
// section 3. set marker to pokecenter
179179
realign_player_from_landmark(
180180
env.program_info(), env.console, context,
181-
{ZoomChange::ZOOM_IN, 128, 128, 0},
182-
{ZoomChange::KEEP_ZOOM, 128, 128, 0}
181+
{ZoomChange::ZOOM_IN, 128, 128, 0ms},
182+
{ZoomChange::KEEP_ZOOM, 128, 128, 0ms}
183183
);
184184
overworld_navigation(env.program_info(), env.console, context,
185185
NavigationStopCondition::STOP_MARKER, NavigationMovementMode::DIRECTIONAL_ONLY,
@@ -225,8 +225,8 @@ void checkpoint_23(
225225
// section 2
226226
realign_player_from_landmark(
227227
env.program_info(), env.console, context,
228-
{ZoomChange::ZOOM_IN, 0, 128, 80},
229-
{ZoomChange::KEEP_ZOOM, 255, 95, 100}
228+
{ZoomChange::ZOOM_IN, 0, 128, 640ms},
229+
{ZoomChange::KEEP_ZOOM, 255, 95, 800ms}
230230
);
231231
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
232232
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
@@ -243,8 +243,8 @@ void checkpoint_23(
243243
// section 3
244244
realign_player_from_landmark(
245245
env.program_info(), env.console, context,
246-
{ZoomChange::ZOOM_IN, 0, 128, 80},
247-
{ZoomChange::KEEP_ZOOM, 255, 75, 65}
246+
{ZoomChange::ZOOM_IN, 0, 128, 640ms},
247+
{ZoomChange::KEEP_ZOOM, 255, 75, 520ms}
248248
);
249249
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
250250
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
@@ -261,8 +261,8 @@ void checkpoint_23(
261261
// section 4
262262
realign_player_from_landmark(
263263
env.program_info(), env.console, context,
264-
{ZoomChange::ZOOM_IN, 0, 128, 50},
265-
{ZoomChange::KEEP_ZOOM, 255, 180, 17}
264+
{ZoomChange::ZOOM_IN, 0, 128, 400ms},
265+
{ZoomChange::KEEP_ZOOM, 255, 180, 136ms}
266266
);
267267
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
268268
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
@@ -279,8 +279,8 @@ void checkpoint_23(
279279
// section 5. set marker to pokecenter
280280
realign_player_from_landmark(
281281
env.program_info(), env.console, context,
282-
{ZoomChange::ZOOM_IN, 128, 128, 0},
283-
{ZoomChange::KEEP_ZOOM, 128, 128, 0}
282+
{ZoomChange::ZOOM_IN, 128, 128, 0ms},
283+
{ZoomChange::KEEP_ZOOM, 128, 128, 0ms}
284284
);
285285
handle_when_stationary_in_overworld(env.program_info(), env.console, context,
286286
[&](const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){

0 commit comments

Comments
 (0)