Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
attack.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "sprite/npc/WorldBombette.h"
5#include "sprite/player.h"
6
7#define NAMESPACE battle_move_hammer_attack
8
10
11extern EvtScript N(EVS_UseMove_Impl);
12
13EvtScript N(EVS_UseMove) = {
14 Call(ShowActionHud, TRUE)
15 Call(GetMenuSelection, LVar0, LVar1, LVar2)
17 CaseEq(0)
18 Set(LVarD, 45)
19 Set(LVarE, 1)
20 Set(LVarF, 2)
21 ExecWait(N(EVS_UseMove_Impl))
22 CaseEq(1)
23 Set(LVarD, 45)
24 Set(LVarE, 2)
25 Set(LVarF, 4)
26 ExecWait(N(EVS_UseMove_Impl))
27 CaseEq(2)
28 Set(LVarD, 45)
29 Set(LVarE, 3)
30 Set(LVarF, 6)
31 ExecWait(N(EVS_UseMove_Impl))
33 Return
34 End
35};
36
37EvtScript N(EVS_UseMove_Impl) = {
38 Call(GetMenuSelection, LVar0, LVar1, LVar2)
40 CaseEq(0)
41 ExecWait(N(EVS_UseBasicHammer))
42 CaseEq(1)
43 ExecWait(N(EVS_UseSuperHammer))
44 CaseEq(2)
45 ExecWait(N(EVS_UseUltraHammer))
47 Call(GetActionSuccessCopy, LVar0)
49 CaseGt(0)
50 Call(GetMenuSelection, LVar0, LVar1, LVar2)
52 CaseEq(0)
53 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
54 Thread
55 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.3))
57 CaseEq(1)
58 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
59 Thread
60 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.6))
62 CaseEq(2)
63 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
64 Thread
65 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.9))
69 Call(GetMenuSelection, LVar0, LVar1, LVar2)
71 CaseEq(0)
72 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
73 Thread
74 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.3))
76 CaseEq(1)
77 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
78 Thread
79 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.6))
81 CaseEq(2)
82 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
83 Thread
84 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.9))
88 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE)
89 Wait(1)
90 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16)
92 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
93 Return
94 EndIf
95 Call(GetPlayerActionSuccess, LVar0)
97 CaseGt(FALSE)
98 Call(GetMenuSelection, LVar0, LVar1, LVar2)
100 CaseEq(0)
101 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
102 CaseEq(1)
103 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
104 CaseEq(2)
105 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
109 Call(GetMenuSelection, LVar0, LVar1, LVar2)
111 CaseEq(0)
112 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
113 CaseEq(1)
114 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
115 CaseEq(2)
116 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
123 ExecWait(N(EVS_HammerSupport_ReturnHome_Success))
127 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
130 Return
131 End
132};
133
134EvtScript N(EVS_FirstStrike) = {
135 Call(GetMenuSelection, LVar0, LVar1, LVar2)
137 CaseEq(0)
138 Set(LVar9, 1)
139 SetConst(LVarA, ANIM_MarioB1_Smash1_Hold1)
140 SetConst(LVarB, ANIM_MarioB1_Smash1_PreSwing)
141 SetConst(LVarC, ANIM_MarioB1_Smash1_Swing)
142 CaseEq(1)
143 Set(LVar9, 2)
144 SetConst(LVarA, ANIM_MarioB1_Smash2_Hold1)
145 SetConst(LVarB, ANIM_MarioB1_Smash2_Hold2)
146 SetConst(LVarC, ANIM_MarioB1_Smash2_Swing)
147 CaseEq(2)
148 Set(LVar9, 3)
149 SetConst(LVarA, ANIM_MarioB1_Smash3_Hold1)
150 SetConst(LVarB, ANIM_MarioB1_Smash3_Hold2)
151 SetConst(LVarC, ANIM_MarioB1_Smash3_Swing)
153 Call(SetGoalToTarget, ACTOR_PLAYER)
154 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
155 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
156 Sub(LVar0, 32)
157 Set(LVar1, 0)
158 Call(SetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
159 Call(UseBattleCamPresetImmediately, BTL_CAM_PLAYER_AIM_HAMMER)
160 Call(SetAnimation, ACTOR_PLAYER, 0, LVarA)
161 Wait(8)
162 Call(SetAnimation, ACTOR_PLAYER, 0, LVarB)
163 Wait(3)
164 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE)
165 Call(SetAnimation, ACTOR_PLAYER, 0, LVarC)
166 Call(GetMenuSelection, LVar0, LVar1, LVar2)
168 CaseEq(0)
169 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_SWING_1)
170 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
171 Thread
172 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.3))
174 CaseEq(1)
175 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_SWING_2)
176 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
177 Thread
178 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.6))
180 CaseEq(2)
181 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_SWING_3)
182 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
183 Thread
184 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.9))
187 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE)
188 Wait(1)
189 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16)
191 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
192 Return
193 EndIf
194 Call(GetMenuSelection, LVar0, LVar1, LVar2)
196 CaseEq(0)
197 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
198 CaseEq(1)
199 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
200 CaseEq(2)
201 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
204 ExecWait(N(EVS_HammerSupport_ReturnHome_Success))
205 Return
206 End
207};
208
209extern EvtScript N(EVS_UseBerserker_Impl);
210
211EvtScript N(EVS_UseBerserker) = {
212 Call(ShowActionHud, TRUE)
213 Call(GetMenuSelection, LVar0, LVar1, LVar2)
215 CaseEq(0)
216 Set(LVarD, 75)
217 Set(LVarE, 1)
218 Set(LVarF, 2)
219 ExecWait(N(EVS_UseBerserker_Impl))
220 CaseEq(1)
221 Set(LVarD, 66)
222 Set(LVarE, 2)
223 Set(LVarF, 4)
224 ExecWait(N(EVS_UseBerserker_Impl))
225 CaseEq(2)
226 Set(LVarD, 57)
227 Set(LVarE, 3)
228 Set(LVarF, 6)
229 ExecWait(N(EVS_UseBerserker_Impl))
231 Return
232 End
233};
234
235EvtScript N(EVS_UseBerserker_Impl) = {
236 Call(GetMenuSelection, LVar0, LVar1, LVar2)
238 CaseEq(0)
239 ExecWait(N(EVS_UseBasicHammer))
240 CaseEq(1)
241 ExecWait(N(EVS_UseSuperHammer))
242 CaseEq(2)
243 ExecWait(N(EVS_UseUltraHammer))
245 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, LVar9, 16)
247 Call(GetMenuSelection, LVar0, LVar1, LVar2)
249 CaseEq(0)
250 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
251 Thread
252 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.3))
254 CaseEq(1)
255 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
256 Thread
257 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.6))
259 CaseEq(2)
260 Call(StartRumble, BTL_RUMBLE_PLAYER_EXTREME)
261 Thread
262 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.9))
265 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE)
266 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
267 Return
268 EndIf
269 Call(GetActionSuccessCopy, LVar0)
271 CaseGt(0)
272 Call(GetMenuSelection, LVar0, LVar1, LVar2)
274 CaseEq(0)
275 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
276 Thread
277 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.3))
279 CaseEq(1)
280 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
281 Thread
282 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.6))
284 CaseEq(2)
285 Call(StartRumble, BTL_RUMBLE_PLAYER_EXTREME)
286 Thread
287 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.9))
291 Call(GetMenuSelection, LVar0, LVar1, LVar2)
293 CaseEq(0)
294 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
295 Thread
296 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.3))
298 CaseEq(1)
299 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
300 Thread
301 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.6))
303 CaseEq(2)
304 Call(StartRumble, BTL_RUMBLE_PLAYER_EXTREME)
305 Thread
306 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.9))
310 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE)
311 Wait(1)
312 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16)
314 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
315 Return
316 EndIf
317 Call(GetPlayerActionSuccess, LVar0)
319 CaseGt(FALSE)
320 Call(GetMenuSelection, LVar0, LVar1, LVar2)
322 CaseEq(0)
323 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
324 CaseEq(1)
325 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
326 CaseEq(2)
327 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
331 Call(GetMenuSelection, LVar0, LVar1, LVar2)
333 CaseEq(0)
334 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
335 CaseEq(1)
336 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
337 CaseEq(2)
338 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
345 ExecWait(N(EVS_HammerSupport_ReturnHome_Success))
349 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
352 Return
353 End
354};
Bytecode EvtScript[]
@ 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
@ 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_AIM_HAMMER
Definition enums.h:4865
@ BTL_CAM_PLAYER_HAMMER_STRIKE
Definition enums.h:4866
#define SUPPRESS_EVENTS_HAMMER
Definition enums.h:2912
@ SOUND_HIT_SILENT
Definition enums.h:747
@ SOUND_HAMMER_SWING_3
Definition enums.h:1556
@ SOUND_HAMMER_SWING_1
Definition enums.h:1554
@ SOUND_HIT_NORMAL
Definition enums.h:724
@ SOUND_HAMMER_SWING_2
Definition enums.h:1555
@ BTL_RUMBLE_PLAYER_MIN
Definition enums.h:4259
@ BTL_RUMBLE_PLAYER_HEAVY
Definition enums.h:4261
@ BTL_RUMBLE_PLAYER_EXTREME
Definition enums.h:4262
@ BTL_RUMBLE_PLAYER_LIGHT
Definition enums.h:4260
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_SMASH
Definition enums.h:2857
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#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 EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define LVarC
Definition macros.h:160
#define Float(DOUBLE)
Definition macros.h:51
#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 LVarB
Definition macros.h:159
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#define Thread
Marks the start of a thread block.
Definition macros.h:544
#define EndThread
Marks the end of a thread block.
Definition macros.h:547
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define LVarD
Definition macros.h:161
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LVar9
Definition macros.h:157
#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 SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:370
#define Return
Kills the current EVT thread.
Definition macros.h:217