Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
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_multibounce
7
9
10s32 N(DifficultyTable)[] = {
11 7, 6, 5, 4, 3, 2, 1, 0
12};
13
14extern EvtScript N(EVS_UseMove_Basic);
15extern EvtScript N(EVS_UseMove_Super);
16extern EvtScript N(EVS_UseMove_Ultra);
17
18EvtScript N(EVS_UseMove) = {
19 Call(ShowActionHud, TRUE)
20 Call(SetBattleFlagBits, BS_FLAGS1_EXECUTING_MOVE, TRUE)
21 Call(GetMenuSelection, LVar0, LVar1, LVar2)
23 CaseEq(0)
24 ExecWait(N(EVS_UseMove_Basic))
25 CaseEq(1)
26 ExecWait(N(EVS_UseMove_Super))
27 CaseEq(2)
28 ExecWait(N(EVS_UseMove_Ultra))
30 Return
31 End
32};
33
34EvtScript N(EVS_UseMove_Basic) = {
35 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
36 Call(action_command_jump_init)
37 Call(SetActionDifficultyTable, Ref(N(DifficultyTable)))
38 ExecWait(N(EVS_JumpSupport_Approach))
39 ExecWait(N(EVS_JumpSupport_CalcJumpTime))
40 Call(action_command_jump_start, LVarA, 1)
41 Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR)
42 Call(SetGoalToTarget, ACTOR_PLAYER)
43 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp)
44 Call(PlayerBasicJumpToGoal, LVarA, PLAYER_BASIC_JUMP_0)
45 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
47 ExecWait(N(EVS_JumpSupport_Miss))
48 Return
49 EndIf
50 Set(LFlag0, FALSE)
51 Call(GetTargetListLength, LVar0)
52 IfEq(LVar0, 1)
53 Set(LFlag0, TRUE)
54 EndIf
55 Wait(1)
56 Call(GetPlayerActionSuccess, LVar0)
58 CaseGt(0)
62 Else
65 EndIf
70 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
74 IfEq(LFlag0, TRUE)
75 ExecWait(N(EVS_JumpSupport_Rebound))
76 Return
77 EndIf
78 ExecWait(N(EVS_JumpSupport_NoFollowUp))
79 Return
83 IfEq(LFlag0, TRUE)
84 ExecWait(N(EVS_JumpSupport_Rebound))
85 Return
86 EndIf
89 Call(GetActionResult, LVarE)
90 Add(LVarF, 1)
91 Set(LFlag0, FALSE)
92 Label(10)
93 Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE)
94 Call(GetTargetListLength, LVar0)
95 Sub(LVar0, 1)
97 Set(LFlag0, TRUE)
98 EndIf
99 Call(CloseActionCommandInfo)
100 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
101 Call(action_command_jump_init)
102 IfEq(LFlag0, TRUE)
103 Call(ShowActionHud, FALSE)
104 EndIf
105 Call(ChooseNextTarget, ITER_NEXT, LVar0)
106 Call(SetGoalToTarget, ACTOR_PLAYER)
107 ExecWait(N(EVS_JumpSupport_CalcJumpTime))
108 Add(LVarA, 5)
109 Call(action_command_jump_start, LVarA, 3)
110 Call(SetGoalToTarget, ACTOR_PLAYER)
111 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall)
112 IfEq(LVarF, 1)
113 Call(PlayerBasicJumpToGoal, LVarA, PLAYER_BASIC_JUMP_3)
114 Else
115 Call(PlayerBasicJumpToGoal, LVarA, PLAYER_BASIC_JUMP_4)
116 EndIf
117 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
119 ExecWait(N(EVS_JumpSupport_Miss))
120 Return
121 EndIf
122 Wait(1)
123 Call(GetPlayerActionSuccess, LVar0)
125 CaseGt(FALSE)
126 IfEq(LFlag0, FALSE)
129 Else
132 EndIf
134 IfEq(LFlag0, FALSE)
137 Else
140 EndIf
143 CaseEq(0)
144 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
145 CaseEq(1)
146 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2)
147 CaseEq(2)
148 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3)
149 CaseEq(3)
150 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
152 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
154 Call(SetActionResult, LVarE)
155 Call(GetPlayerActionSuccess, LVar0)
157 CaseOrEq(FALSE)
158 CaseOrEq(2)
159 IfEq(LFlag0, TRUE)
160 ExecWait(N(EVS_JumpSupport_Rebound))
161 Return
162 EndIf
163 ExecWait(N(EVS_JumpSupport_NoFollowUp))
164 Return
166 CaseOrEq(TRUE)
167 CaseOrEq(3)
168 IfEq(LFlag0, TRUE)
169 ExecWait(N(EVS_JumpSupport_Rebound))
170 Return
171 EndIf
174 Add(LVarF, 1)
175 Call(GetTargetListLength, LVar0)
177 ExecWait(N(EVS_JumpSupport_WeakRebound))
178 Return
179 EndIf
180 Goto(10)
181 Return
182 End
183};
184
185EvtScript N(EVS_UseMove_Super) = {
186 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
187 Call(action_command_jump_init)
188 Call(SetActionDifficultyTable, Ref(N(DifficultyTable)))
189 ExecWait(N(EVS_JumpSupport_Approach))
190 ExecWait(N(EVS_JumpSupport_CalcJumpTime))
191 Call(action_command_jump_start, LVarA, 1)
192 Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR)
193 Call(SetGoalToTarget, ACTOR_PLAYER)
194 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp)
195 Call(PlayerBasicJumpToGoal, LVarA, PLAYER_BASIC_JUMP_0)
196 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
198 ExecWait(N(EVS_JumpSupport_Miss))
199 Return
200 EndIf
201 Set(LFlag0, FALSE)
202 Call(GetTargetListLength, LVar0)
203 IfEq(LVar0, 1)
204 Set(LFlag0, TRUE)
205 EndIf
206 Wait(1)
207 Call(GetPlayerActionSuccess, LVar0)
209 CaseGt(FALSE)
210 IfEq(LFlag0, FALSE)
213 Else
216 EndIf
221 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
225 IfEq(LFlag0, TRUE)
226 ExecWait(N(EVS_JumpSupport_Rebound))
227 Return
228 EndIf
229 ExecWait(N(EVS_JumpSupport_NoFollowUp))
230 Return
234 IfEq(LFlag0, TRUE)
235 ExecWait(N(EVS_JumpSupport_Rebound))
236 Return
237 EndIf
240 Call(GetActionResult, LVarE)
241 Set(LFlag0, FALSE)
242 Set(LVarF, 0)
243 Add(LVarF, 1)
244 Label(10)
245 Call(GetTargetListLength, LVar0)
246 Sub(LVar0, 1)
248 Set(LFlag0, TRUE)
249 EndIf
250 Call(CloseActionCommandInfo)
251 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
252 Call(action_command_jump_init)
253 IfEq(LFlag0, TRUE)
254 Call(ShowActionHud, FALSE)
255 EndIf
256 Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE)
257 Call(action_command_jump_start, 37, 3)
258 Call(ChooseNextTarget, ITER_NEXT, LVar0)
259 Call(SetGoalToTarget, ACTOR_PLAYER)
260 Call(SetGoalToTarget, ACTOR_PLAYER)
261 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump)
262 Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE)
263 IfEq(LVarF, 1)
264 Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_3)
265 Wait(7)
266 Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_6)
267 Else
268 Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_4)
269 Wait(7)
270 Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_5)
271 EndIf
272 Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE)
273 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
275 ExecWait(N(EVS_JumpSupport_Miss))
276 Return
277 EndIf
278 Wait(1)
279 Call(GetPlayerActionSuccess, LVar0)
281 CaseGt(FALSE)
282 IfEq(LFlag0, FALSE)
285 Else
288 EndIf
290 IfEq(LFlag0, FALSE)
293 Else
296 EndIf
299 CaseEq(0)
300 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
301 CaseEq(1)
302 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2)
303 CaseEq(2)
304 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3)
305 CaseEq(3)
306 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
308 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
310 Call(SetActionResult, LVarE)
311 Call(GetPlayerActionSuccess, LVar0)
313 CaseOrEq(FALSE)
314 CaseOrEq(2)
315 IfEq(LFlag0, TRUE)
316 ExecWait(N(EVS_JumpSupport_Rebound))
317 Return
318 EndIf
319 ExecWait(N(EVS_JumpSupport_NoFollowUp))
320 Return
322 CaseOrEq(TRUE)
323 CaseOrEq(3)
324 IfEq(LFlag0, TRUE)
325 ExecWait(N(EVS_JumpSupport_Rebound))
326 Return
327 EndIf
330 Add(LVarF, 1)
331 Call(GetTargetListLength, LVar0)
333 ExecWait(N(EVS_JumpSupport_NoFollowUp))
334 Return
335 EndIf
336 Goto(10)
337 Return
338 End
339};
340
341EvtScript N(EVS_UseMove_Ultra) = {
342 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
343 Call(action_command_jump_init)
344 Call(SetActionDifficultyTable, Ref(N(DifficultyTable)))
345 ExecWait(N(EVS_JumpSupport_Approach))
346 ExecWait(N(EVS_JumpSupport_CalcJumpTime))
347 Call(action_command_jump_start, LVarA, 1)
348 Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_MIDAIR)
349 Call(SetGoalToTarget, ACTOR_PLAYER)
350 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_MarioB1_Stomp)
351 Call(PlayerBasicJumpToGoal, LVarA, PLAYER_BASIC_JUMP_0)
352 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
354 ExecWait(N(EVS_JumpSupport_Miss))
355 Return
356 EndIf
357 Set(LFlag0, FALSE)
358 Call(GetTargetListLength, LVar0)
359 IfEq(LVar0, 1)
360 Set(LFlag0, TRUE)
361 EndIf
362 Wait(1)
363 Call(GetPlayerActionSuccess, LVar0)
365 CaseGt(FALSE)
366 IfEq(LFlag0, FALSE)
369 Else
372 EndIf
377 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
381 IfEq(LFlag0, TRUE)
382 ExecWait(N(EVS_JumpSupport_Rebound))
383 Return
384 EndIf
385 ExecWait(N(EVS_JumpSupport_NoFollowUp))
386 Return
390 IfEq(LFlag0, TRUE)
391 ExecWait(N(EVS_JumpSupport_Rebound))
392 Return
393 EndIf
396 Call(GetActionResult, LVarE)
397 Set(LFlag0, FALSE)
398 Set(LVarF, 0)
399 Add(LVarF, 1)
400 Label(20)
401 Call(GetTargetListLength, LVar0)
402 Sub(LVar0, 1)
404 Set(LFlag0, TRUE)
405 EndIf
406 Call(CloseActionCommandInfo)
407 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
408 Call(action_command_jump_init)
409 IfEq(LFlag0, TRUE)
410 Call(ShowActionHud, FALSE)
411 EndIf
412 Call(UseBattleCamPreset, BTL_CAM_PLAYER_MULTIBOUNCE)
413 Call(action_command_jump_start, 25, 3)
414 Call(ChooseNextTarget, ITER_NEXT, LVar0)
415 Call(SetGoalToTarget, ACTOR_PLAYER)
416 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall)
417 IfEq(LVarF, 1)
418 Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_2)
419 Else
420 Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_4)
421 EndIf
422 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
424 ExecWait(N(EVS_JumpSupport_Miss))
425 Return
426 EndIf
427 Wait(1)
428 Call(GetPlayerActionSuccess, LVar0)
430 CaseGt(FALSE)
431 IfEq(LFlag0, FALSE)
434 Else
437 EndIf
439 IfEq(LFlag0, FALSE)
442 Else
445 EndIf
448 CaseEq(0)
449 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_1)
450 CaseEq(1)
451 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_2)
452 CaseEq(2)
453 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_3)
454 CaseEq(3)
455 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
457 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_JUMP_COMBO_4)
459 Call(SetActionResult, LVarE)
460 Call(GetPlayerActionSuccess, LVar0)
462 CaseOrEq(FALSE)
463 CaseOrEq(2)
464 IfEq(LFlag0, TRUE)
465 ExecWait(N(EVS_JumpSupport_Rebound))
466 Return
467 EndIf
468 ExecWait(N(EVS_JumpSupport_NoFollowUp))
469 Return
471 CaseOrEq(TRUE)
472 CaseOrEq(3)
473 IfEq(LFlag0, TRUE)
474 ExecWait(N(EVS_JumpSupport_Rebound))
475 Return
476 EndIf
479 Add(LVarF, 1)
480 Call(GetTargetListLength, LVar0)
482 ExecWait(N(EVS_JumpSupport_NoFollowUp))
483 Return
484 EndIf
485 Goto(20)
486 Return
487 End
488};
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_INCLUDE_POWER_UPS
Definition enums.h:3571
@ BS_FLAGS1_EXECUTING_MOVE
Definition enums.h:3578
@ 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
@ BTL_CAM_PLAYER_JUMP_MIDAIR
Definition enums.h:4856
@ PLAYER_BASIC_JUMP_3
Definition enums.h:4298
@ PLAYER_BASIC_JUMP_4
Definition enums.h:4299
@ PLAYER_BASIC_JUMP_0
Definition enums.h:4295
@ 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 Ref(sym)
Address/pointer constant.
Definition macros.h:60
#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 IfFalse(b)
Definition macros.h:646
#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