Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
auto_multibounce.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
4#include "sprite/player.h"
5
6#define NAMESPACE battle_move_auto_multibounce
7
9
10extern EvtScript N(EVS_UseMove_Normal);
11extern EvtScript N(EVS_UseMove_Super);
12extern EvtScript N(EVS_UseMove_Ultra);
13
14EvtScript N(EVS_UseMove) = {
15 Call(ShowActionHud, TRUE)
16 Call(SetBattleFlagBits, BS_FLAGS1_AUTO_SUCCEED_ACTION, TRUE)
17 Call(GetMenuSelection, LVar0, LVar1, LVar2)
19 CaseEq(0)
20 ExecWait(N(EVS_UseMove_Normal))
21 CaseEq(1)
22 ExecWait(N(EVS_UseMove_Super))
23 CaseEq(2)
24 ExecWait(N(EVS_UseMove_Ultra))
26 Return
27 End
28};
29
30EvtScript N(EVS_UseMove_Normal) = {
31 ExecWait(N(EVS_JumpSupport_ApproachAndJump))
32 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
34 ExecWait(N(EVS_JumpSupport_Miss))
35 Return
36 EndIf
37 Set(LFlag0, FALSE)
38 Call(GetTargetListLength, LVar0)
39 IfEq(LVar0, 1)
40 Set(LFlag0, TRUE)
41 EndIf
42 Wait(1)
43 Call(GetPlayerActionSuccess, LVar0)
45 CaseGt(FALSE)
46 IfEq(LFlag0, FALSE)
49 Else
52 EndIf
57 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
61 IfEq(LFlag0, TRUE)
62 ExecWait(N(EVS_JumpSupport_Rebound))
63 Return
64 EndIf
65 ExecWait(N(EVS_JumpSupport_NoFollowUp))
66 Return
70 IfEq(LFlag0, TRUE)
71 ExecWait(N(EVS_JumpSupport_Rebound))
72 Return
73 EndIf
76 Call(GetActionResult, LVarE)
77 Add(LVarF, 1)
78 Set(LFlag0, FALSE)
79 Label(10)
80 Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE)
81 Call(GetTargetListLength, LVar0)
82 Sub(LVar0, 1)
84 Set(LFlag0, TRUE)
85 EndIf
86 Call(CloseActionCommandInfo)
87 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
88 Call(action_command_jump_init)
89 IfEq(LFlag0, TRUE)
90 Call(ShowActionHud, FALSE)
91 EndIf
92 Call(ChooseNextTarget, ITER_NEXT, LVar0)
93 Call(SetGoalToTarget, ACTOR_PLAYER)
94 ExecWait(N(EVS_JumpSupport_CalcJumpTime))
95 Add(LVarA, 5)
96 Call(action_command_jump_start, LVarA, 3)
97 Call(SetGoalToTarget, ACTOR_PLAYER)
98 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall)
99 IfEq(LVarF, 1)
100 Call(PlayerBasicJumpToGoal, LVarA, PLAYER_BASIC_JUMP_3)
101 Else
102 Call(PlayerBasicJumpToGoal, LVarA, PLAYER_BASIC_JUMP_4)
103 EndIf
104 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
106 ExecWait(N(EVS_JumpSupport_Miss))
107 Return
108 EndIf
109 Wait(1)
110 Call(GetPlayerActionSuccess, LVar0)
112 CaseGt(FALSE)
113 IfEq(LFlag0, FALSE)
116 Else
119 EndIf
121 IfEq(LFlag0, FALSE)
124 Else
127 EndIf
130 CaseEq(0)
131 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
132 CaseEq(1)
133 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2)
134 CaseEq(2)
135 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3)
136 CaseEq(3)
137 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
139 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
141 Call(SetActionResult, LVarE)
142 Call(GetPlayerActionSuccess, LVar0)
144 CaseOrEq(FALSE)
145 CaseOrEq(2)
146 IfEq(LFlag0, TRUE)
147 ExecWait(N(EVS_JumpSupport_Rebound))
148 Return
149 EndIf
150 ExecWait(N(EVS_JumpSupport_NoFollowUp))
151 Return
153 CaseOrEq(TRUE)
154 CaseOrEq(3)
155 IfEq(LFlag0, TRUE)
156 ExecWait(N(EVS_JumpSupport_Rebound))
157 Return
158 EndIf
161 Add(LVarF, 1)
162 Call(GetTargetListLength, LVar0)
164 ExecWait(N(EVS_JumpSupport_WeakRebound))
165 Return
166 EndIf
167 Goto(10)
168 Return
169 End
170};
171
172EvtScript N(EVS_UseMove_Super) = {
173 ExecWait(N(EVS_JumpSupport_ApproachAndJump))
174 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
176 ExecWait(N(EVS_JumpSupport_Miss))
177 Return
178 EndIf
179 Set(LFlag0, FALSE)
180 Call(GetTargetListLength, LVar0)
181 IfEq(LVar0, 1)
182 Set(LFlag0, TRUE)
183 EndIf
184 Wait(1)
185 Call(GetPlayerActionSuccess, LVar0)
187 CaseGt(FALSE)
188 IfEq(LFlag0, FALSE)
191 Else
194 EndIf
199 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
203 IfEq(LFlag0, TRUE)
204 ExecWait(N(EVS_JumpSupport_Rebound))
205 Return
206 EndIf
207 ExecWait(N(EVS_JumpSupport_NoFollowUp))
208 Return
212 IfEq(LFlag0, TRUE)
213 ExecWait(N(EVS_JumpSupport_Rebound))
214 Return
215 EndIf
218 Call(GetActionResult, LVarE)
219 Set(LFlag0, FALSE)
220 Set(LVarF, 0)
221 Add(LVarF, 1)
222 Label(10)
223 Call(GetTargetListLength, LVar0)
224 Sub(LVar0, 1)
226 Set(LFlag0, TRUE)
227 EndIf
228 Call(CloseActionCommandInfo)
229 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
230 Call(action_command_jump_init)
231 IfEq(LFlag0, TRUE)
232 Call(ShowActionHud, FALSE)
233 EndIf
234 Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE)
235 Call(action_command_jump_start, 37, 3)
236 Call(ChooseNextTarget, ITER_NEXT, LVar0)
237 Call(SetGoalToTarget, ACTOR_PLAYER)
238 Call(SetGoalToTarget, ACTOR_PLAYER)
239 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump)
240 Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE)
241 IfEq(LVarF, 1)
242 Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_3)
243 Wait(7)
244 Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_6)
245 Else
246 Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_4)
247 Wait(7)
248 Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_5)
249 EndIf
250 Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE)
251 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
253 ExecWait(N(EVS_JumpSupport_Miss))
254 Return
255 EndIf
256 Wait(1)
257 Call(GetPlayerActionSuccess, LVar0)
259 CaseGt(FALSE)
260 IfEq(LFlag0, FALSE)
263 Else
266 EndIf
268 IfEq(LFlag0, FALSE)
271 Else
274 EndIf
277 CaseEq(0)
278 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
279 CaseEq(1)
280 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2)
281 CaseEq(2)
282 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3)
283 CaseEq(3)
284 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
286 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
288 Call(SetActionResult, LVarE)
289 Call(GetPlayerActionSuccess, LVar0)
291 CaseOrEq(FALSE)
292 CaseOrEq(2)
293 IfEq(LFlag0, TRUE)
294 ExecWait(N(EVS_JumpSupport_Rebound))
295 Return
296 EndIf
297 ExecWait(N(EVS_JumpSupport_NoFollowUp))
298 Return
300 CaseOrEq(TRUE)
301 CaseOrEq(3)
302 IfEq(LFlag0, TRUE)
303 ExecWait(N(EVS_JumpSupport_Rebound))
304 Return
305 EndIf
308 Add(LVarF, 1)
309 Call(GetTargetListLength, LVar0)
311 ExecWait(N(EVS_JumpSupport_NoFollowUp))
312 Return
313 EndIf
314 Goto(10)
315 Return
316 End
317};
318
319EvtScript N(EVS_UseMove_Ultra) = {
320 ExecWait(N(EVS_JumpSupport_ApproachAndJump))
321 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
323 ExecWait(N(EVS_JumpSupport_Miss))
324 Return
325 EndIf
326 Set(LFlag0, FALSE)
327 Call(GetTargetListLength, LVar0)
328 IfEq(LVar0, 1)
329 Set(LFlag0, TRUE)
330 EndIf
331 Wait(1)
332 Call(GetPlayerActionSuccess, LVar0)
334 CaseGt(FALSE)
335 IfEq(LFlag0, FALSE)
338 Else
341 EndIf
346 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
350 IfEq(LFlag0, TRUE)
351 ExecWait(N(EVS_JumpSupport_Rebound))
352 Return
353 EndIf
354 ExecWait(N(EVS_JumpSupport_NoFollowUp))
355 Return
359 IfEq(LFlag0, TRUE)
360 ExecWait(N(EVS_JumpSupport_Rebound))
361 Return
362 EndIf
365 Call(GetActionResult, LVarE)
366 Set(LFlag0, FALSE)
367 Set(LVarF, 0)
368 Add(LVarF, 1)
369 Label(20)
370 Call(GetTargetListLength, LVar0)
371 Sub(LVar0, 1)
373 Set(LFlag0, TRUE)
374 EndIf
375 Call(CloseActionCommandInfo)
376 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
377 Call(action_command_jump_init)
378 IfEq(LFlag0, TRUE)
379 Call(ShowActionHud, FALSE)
380 EndIf
381 Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE)
382 Call(action_command_jump_start, 25, 3)
383 Call(ChooseNextTarget, ITER_NEXT, LVar0)
384 Call(SetGoalToTarget, ACTOR_PLAYER)
385 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall)
386 IfEq(LVarF, 1)
387 Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_2)
388 Else
389 Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_4)
390 EndIf
391 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
393 ExecWait(N(EVS_JumpSupport_Miss))
394 Return
395 EndIf
396 Wait(1)
397 Call(GetPlayerActionSuccess, LVar0)
399 CaseGt(FALSE)
400 IfEq(LFlag0, FALSE)
403 Else
406 EndIf
408 IfEq(LFlag0, FALSE)
411 Else
414 EndIf
417 CaseEq(0)
418 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
419 CaseEq(1)
420 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2)
421 CaseEq(2)
422 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3)
423 CaseEq(3)
424 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
426 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
428 Call(SetActionResult, LVarE)
429 Call(GetPlayerActionSuccess, LVar0)
431 CaseOrEq(FALSE)
432 CaseOrEq(2)
433 IfEq(LFlag0, TRUE)
434 ExecWait(N(EVS_JumpSupport_Rebound))
435 Return
436 EndIf
437 ExecWait(N(EVS_JumpSupport_NoFollowUp))
438 Return
440 CaseOrEq(TRUE)
441 CaseOrEq(3)
442 IfEq(LFlag0, TRUE)
443 ExecWait(N(EVS_JumpSupport_Rebound))
444 Return
445 EndIf
448 Add(LVarF, 1)
449 Call(GetTargetListLength, LVar0)
451 ExecWait(N(EVS_JumpSupport_NoFollowUp))
452 Return
453 EndIf
454 Goto(20)
455 Return
456 End
457};
Bytecode EvtScript[]
@ ACTION_COMMAND_JUMP
Definition enums.h:3473
@ ACTOR_SOUND_HURT
Definition enums.h:2037
@ BS_FLAGS1_NO_RATING
Definition enums.h:3577
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3576
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_AUTO_SUCCEED_ACTION
Definition enums.h:3581
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ PLAYER_ULTRA_JUMP_2
Definition enums.h:4315
@ PLAYER_ULTRA_JUMP_4
Definition enums.h:4317
@ ITER_NEXT
Definition enums.h:2025
@ PLAYER_SUPER_JUMP_3
Definition enums.h:4306
@ PLAYER_SUPER_JUMP_4
Definition enums.h:4307
@ PLAYER_SUPER_JUMP_5
Definition enums.h:4308
@ PLAYER_SUPER_JUMP_6
Definition enums.h:4309
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_NICE_NO_DAMAGE
Definition enums.h:1953
@ HIT_RESULT_NICE
Definition enums.h:1951
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_PLAYER_MULTIBOUNCE
Definition enums.h:4862
@ PLAYER_BASIC_JUMP_3
Definition enums.h:4298
@ PLAYER_BASIC_JUMP_4
Definition enums.h:4299
@ SOUND_ACTOR_JUMPED_2
Definition enums.h:778
@ SOUND_JUMP_COMBO_1
Definition enums.h:954
@ SOUND_ACTOR_JUMPED_1
Definition enums.h:777
@ SOUND_NONE
Definition enums.h:547
@ SOUND_JUMP_COMBO_4
Definition enums.h:957
@ SOUND_JUMP_COMBO_3
Definition enums.h:956
@ SOUND_ACTOR_JUMPED_3
Definition enums.h:779
@ SOUND_JUMP_COMBO_2
Definition enums.h:955
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_BLUR_ENABLE
Definition enums.h:6414
@ ACTOR_BLUR_DISABLE
Definition enums.h:6413
@ DAMAGE_TYPE_MULTI_BOUNCE
Definition enums.h:2874
@ DAMAGE_TYPE_JUMP
Definition enums.h:2858
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define IfGe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR >= RVAR.
Definition macros.h:284
#define Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
Definition macros.h:319
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#define LVarF
Definition macros.h:163
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define Add(VAR, INT_VALUE)
Definition macros.h:376
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:341
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LFlag0
Definition macros.h:167
#define LVarA
Definition macros.h:158
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define IfEq(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR == RVAR.
Definition macros.h:269
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define CaseGt(RVAR)
Marks the start of a switch case that executes only if LVAR <= RVAR. It also marks the end of any pre...
Definition macros.h:328
#define LVarE
Definition macros.h:162
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217