Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
auto_jump.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_jump
7
9
10extern EvtScript N(EVS_UseMove_Basic);
11extern EvtScript N(EVS_UseMove_Super);
12extern EvtScript N(EVS_UseMove_Ultra);
13
14EvtScript N(EVS_UseMove) = {
15 Call(SetBattleFlagBits, BS_FLAGS1_AUTO_SUCCEED_ACTION, TRUE)
16 Call(ShowActionHud, FALSE)
17 Call(SetBattleFlagBits, BS_FLAGS1_EXECUTING_MOVE, TRUE)
18 Call(GetMenuSelection, LVar0, LVar1, LVar2)
20 CaseEq(0)
21 ExecWait(N(EVS_UseMove_Basic))
22 CaseEq(1)
23 ExecWait(N(EVS_UseMove_Super))
24 CaseEq(2)
25 ExecWait(N(EVS_UseMove_Ultra))
27 Return
28 End
29};
30
31EvtScript N(EVS_UseMove_Basic) = {
32 ExecWait(N(EVS_JumpSupport_ApproachAndJump))
33 Call(GetActionCommandMode, LVar0)
35 Call(SetActionCommandMode, AC_MODE_TUTORIAL_WAIT_INPUT)
36 Loop(0)
37 Call(GetActionCommandMode, LVar0)
40 EndIf
41 Wait(1)
43 EndIf
44 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
46 ExecWait(N(EVS_JumpSupport_Miss))
47 Return
48 EndIf
49 Wait(1)
50 Call(GetPlayerActionQuality, LVar0)
52 CaseGt(FALSE)
62 ExecWait(N(EVS_JumpSupport_NoFollowUp))
63 Return
70 Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH)
71 Wait(5)
72 Call(SetGoalToTarget, ACTOR_PLAYER)
73 Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH)
75 Call(GetJumpActionQuality, LVarF)
76 Call(InterruptActionCommand)
77 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
78 Call(action_command_jump_init)
79 Call(ShowActionHud, FALSE)
80 Call(action_command_jump_start, 24, AC_DIFFICULTY_3)
81 Call(SetGoalToTarget, ACTOR_PLAYER)
82 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_SpinFall)
83 Call(PlayerBasicJumpToGoal, 24, PLAYER_BASIC_JUMP_3)
84 Wait(1)
87 Call(SetActionResult, LVarF)
88 ExecWait(N(EVS_JumpSupport_Rebound))
89 Return
90 End
91};
92
93EvtScript N(EVS_UseMove_Super) = {
94 ExecWait(N(EVS_JumpSupport_ApproachAndJump))
95 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
97 ExecWait(N(EVS_JumpSupport_Miss))
98 Return
99 EndIf
100 Wait(1)
101 Call(GetPlayerActionQuality, LVar0)
103 CaseGt(FALSE)
113 ExecWait(N(EVS_JumpSupport_NoFollowUp))
114 Return
120 Call(GetJumpActionQuality, LVarF)
122 Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_JUMP_FINISH)
123 Wait(5)
124 Call(SetGoalToTarget, ACTOR_PLAYER)
125 Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH)
127 Call(InterruptActionCommand)
128 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
129 Call(action_command_jump_init)
130 Call(ShowActionHud, FALSE)
131 Call(action_command_jump_start, 37, AC_DIFFICULTY_3)
132 Call(SetGoalToTarget, ACTOR_PLAYER)
133 Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE)
134 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Sit, ANIM_Mario1_SpinJump)
135 Call(PlayerSuperJumpToGoal, 20, PLAYER_SUPER_JUMP_4)
136 Wait(7)
137 Call(PlayerSuperJumpToGoal, 3, PLAYER_SUPER_JUMP_5)
138 Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE)
139 Wait(1)
142 Call(SetActionResult, LVarF)
143 ExecWait(N(EVS_JumpSupport_Rebound))
144 Return
145 End
146};
147
148EvtScript N(EVS_UseMove_Ultra) = {
149 ExecWait(N(EVS_JumpSupport_ApproachAndJump))
150 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_JUMP, 0, 0, 1, 0)
152 ExecWait(N(EVS_JumpSupport_Miss))
153 Return
154 EndIf
155 Wait(1)
156 Call(GetPlayerActionQuality, LVar0)
158 CaseGt(FALSE)
168 ExecWait(N(EVS_JumpSupport_NoFollowUp))
169 Return
175 Call(GetJumpActionQuality, LVarF)
177 Call(UseBattleCamPreset, BTL_CAM_PLAYER_PRE_ULTRA_JUMP_FINISH)
178 Wait(5)
179 Call(SetGoalToTarget, ACTOR_PLAYER)
180 Call(UseBattleCamPreset, BTL_CAM_PLAYER_JUMP_FINISH)
182 Call(InterruptActionCommand)
183 Call(LoadActionCommand, ACTION_COMMAND_JUMP)
184 Call(action_command_jump_init)
185 Call(ShowActionHud, FALSE)
186 Call(action_command_jump_start, 25, AC_DIFFICULTY_3)
187 Call(SetGoalToTarget, ACTOR_PLAYER)
188 Call(EnablePlayerBlur, ACTOR_BLUR_ENABLE)
189 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Jump, ANIM_Mario1_SpinFall)
190 Call(PlayerUltraJumpToGoal, 25, PLAYER_ULTRA_JUMP_4)
191 Call(EnablePlayerBlur, ACTOR_BLUR_DISABLE)
192 Wait(1)
195 Call(SetActionResult, LVarF)
196 ExecWait(N(EVS_JumpSupport_Rebound))
197 Return
198 End
199};
@ AC_DIFFICULTY_3
Definition action_cmd.h:45
@ AC_MODE_TUTORIAL_WAIT_INPUT
Definition action_cmd.h:63
@ AC_MODE_TUTORIAL
Definition action_cmd.h:62
Bytecode EvtScript[]
@ ACTION_COMMAND_JUMP
Definition enums.h:3473
@ ACTOR_SOUND_HURT
Definition enums.h:2037
@ BS_FLAGS1_NO_RATING
Definition enums.h:3576
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3575
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ BS_FLAGS1_AUTO_SUCCEED_ACTION
Definition enums.h:3580
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ BS_FLAGS1_EXECUTING_MOVE
Definition enums.h:3577
@ PLAYER_ULTRA_JUMP_4
Definition enums.h:4316
@ PLAYER_SUPER_JUMP_4
Definition enums.h:4306
@ PLAYER_SUPER_JUMP_5
Definition enums.h:4307
@ 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_PRE_ULTRA_JUMP_FINISH
Definition enums.h:4849
@ BTL_CAM_PLAYER_PRE_JUMP_FINISH
Definition enums.h:4848
@ BTL_CAM_PLAYER_JUMP_FINISH
Definition enums.h:4856
@ PLAYER_BASIC_JUMP_3
Definition enums.h:4297
@ SOUND_ACTOR_JUMPED_2
Definition enums.h:778
@ SOUND_ACTOR_JUMPED_1
Definition enums.h:777
@ SOUND_NONE
Definition enums.h:547
@ SOUND_ACTOR_JUMPED_3
Definition enums.h:779
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_BLUR_ENABLE
Definition enums.h:6413
@ ACTOR_BLUR_DISABLE
Definition enums.h:6412
@ DAMAGE_TYPE_JUMP
Definition enums.h:2858
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#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 EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#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 EndLoop
Marks the end of a loop.
Definition macros.h:248
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
Definition macros.h:275
#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 BreakLoop
Breaks out of the innermost loop.
Definition macros.h:251
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#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 ChildThread
Marks the start of a child thread block.
Definition macros.h:560
#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 Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217