Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
spin_smash.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "sprite/player.h"
4
5#define NAMESPACE battle_move_spin_smash
6
7API_CALLABLE(func_802A1000_737890) {
8 BattleStatus* battleStatus = &gBattleStatus;
9 Actor* playerActor = battleStatus->playerActor;
10 f32 xPos = playerActor->curPos.x + 20.0f;
11 f32 yPos = playerActor->curPos.y + 15.0f;
12 f32 zPos = playerActor->curPos.z + 5.0f;
13
14 fx_stars_spread(0, xPos, yPos, zPos, 6, 20);
15
16 return ApiStatus_DONE2;
17}
18
19API_CALLABLE(func_802A1074_737904) {
20 BattleStatus* battleStatus = &gBattleStatus;
21 Actor* playerActor = battleStatus->playerActor;
22 f32 xPos = playerActor->curPos.x + 20.0f;
23 f32 yPos = playerActor->curPos.y + 15.0f;
24 f32 zPos = playerActor->curPos.z + 5.0f;
25
26 fx_steam_burst(0, xPos, yPos, zPos, 1.0f, 20);
27
28 return ApiStatus_DONE2;
29}
30
32
33extern EvtScript N(EVS_UseMoveBasic_Impl);
34extern EvtScript N(EVS_UseMoveSuper_Impl);
35extern EvtScript N(EVS_UseMoveUltra_Impl);
36
37EvtScript N(EVS_UseMove) = {
38 Call(ShowActionHud, TRUE)
39 Call(SetDamageSource, DMG_SRC_SPIN_SMASH)
40 Call(GetMenuSelection, LVar0, LVar1, LVar2)
42 CaseEq(0)
43 Set(LVarD, 60)
44 Set(LVarE, 1)
45 Set(LVarF, 2)
46 ExecWait(N(EVS_UseMoveBasic_Impl))
47 CaseEq(1)
48 Set(LVarD, 60)
49 Set(LVarE, 2)
50 Set(LVarF, 4)
51 ExecWait(N(EVS_UseMoveSuper_Impl))
52 CaseEq(2)
53 Set(LVarD, 60)
54 Set(LVarE, 3)
55 Set(LVarF, 6)
56 ExecWait(N(EVS_UseMoveUltra_Impl))
58 Return
59 End
60};
61
62EvtScript N(EVS_UseMoveBasic_Impl) = {
63 Call(LoadActionCommand, ACTION_COMMAND_SMASH)
64 Call(action_command_hammer_init)
65 Call(InitTargetIterator)
66 ExecWait(N(EVS_HammerSupport_SmashApproach))
67 Set(LVar1, 0)
68 Loop(10)
69 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
70 IfEq(LVar0, TRUE)
71 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
73 EndIf
74 Wait(1)
75 Add(LVar1, 1)
76 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash1_Begin)
78 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash1_Begin)
80 CaseLt(3)
81 Wait(4)
82 CaseLt(5)
83 Wait(3)
84 CaseLt(7)
85 Wait(2)
86 CaseLt(9)
87 Wait(1)
88 CaseLt(11)
89 Wait(0)
91 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, LVar9, 16)
92 Call(InitTargetIterator)
93 Call(SetGoalToTarget, ACTOR_PLAYER)
94 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
95 Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER)
96 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_WINDUP)
97 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash1_Raise)
98 Wait(8)
99 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash1_Hold1)
100 Call(N(ShouldMovesAutoSucceed))
102 Loop(45)
103 Wait(1)
104 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
105 IfNe(LVar0, FALSE)
107 EndIf
108 EndLoop
109 EndIf
110 Call(action_command_hammer_start, 0, LVarD, 3)
111 Call(SetActionQuality, 0)
112 Set(LVar1, 0)
113 Loop(30)
114 Wait(1)
115 Call(GetActionQuality, LVar0)
116 IfNe(LVar0, 0)
117 IfNe(LVar1, 1)
118 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash1_Hold2)
119 Set(LVar1, 1)
120 EndIf
121 EndIf
122 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
123 IfEq(LVar0, FALSE)
125 EndIf
126 EndLoop
127 Label(0)
128 Wait(1)
129 Call(GetActionSuccess, LVar0)
130 IfEq(LVar0, 0)
131 Goto(0)
132 EndIf
133 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash1_PreSwing)
134 Wait(3)
135 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash1_Swing)
136 Wait(3)
137 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_QUAKE)
138 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
139 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_SPIN_SMASH_1)
140 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16)
142 Wait(10)
143 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
144 Wait(25)
145 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
146 Return
147 EndIf
148 Call(GetPlayerActionSuccess, LVar0)
150 CaseGt(FALSE)
151 Call(func_802A1000_737890)
154 Call(func_802A1074_737904)
160 Wait(10)
161 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
162 ExecWait(N(EVS_Hammer_ReturnHome_B))
163 Return
169 Thread
170 Set(LVar0, 0)
171 Loop(10)
172 Add(LVar0, 18)
173 Call(SetActorYaw, ACTOR_PLAYER, LVar0)
174 Wait(1)
175 EndLoop
177 Wait(10)
178 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
179 Call(SetActorYaw, ACTOR_PLAYER, 0)
180 ExecWait(N(EVS_Hammer_ReturnHome_B))
181 Return
182 End
183};
184
185EvtScript N(EVS_UseMoveSuper_Impl) = {
186 Call(LoadActionCommand, ACTION_COMMAND_SMASH)
187 Call(action_command_hammer_init)
188 Call(InitTargetIterator)
189 ExecWait(N(EVS_HammerSupport_SmashApproach))
190 Set(LVar1, 0)
191 Loop(10)
192 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
193 IfEq(LVar0, TRUE)
194 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
196 EndIf
197 Wait(1)
198 Add(LVar1, 1)
199 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash2_Begin)
200 EndLoop
201 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash2_Begin)
203 CaseLt(3)
204 Wait(4)
205 CaseLt(5)
206 Wait(3)
207 CaseLt(7)
208 Wait(2)
209 CaseLt(9)
210 Wait(1)
211 CaseLt(11)
212 Wait(0)
214 Call(InitTargetIterator)
215 Call(SetGoalToTarget, ACTOR_PLAYER)
216 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
217 Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER)
218 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_WINDUP)
219 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash2_Raise)
220 Wait(8)
221 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash2_Hold1)
222 Call(N(ShouldMovesAutoSucceed))
223 IfEq(LVar0, FALSE)
224 Loop(45)
225 Wait(1)
226 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
227 IfNe(LVar0, FALSE)
229 EndIf
230 EndLoop
231 EndIf
232 Call(action_command_hammer_start, 0, LVarD, 3)
233 Call(SetActionQuality, 0)
234 Set(LVar1, 0)
235 Loop(30)
236 Wait(1)
237 Call(GetActionQuality, LVar0)
238 IfNe(LVar0, 0)
239 IfNe(LVar1, 1)
240 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash2_Hold2)
241 Set(LVar1, 1)
242 EndIf
243 EndIf
244 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
245 IfEq(LVar0, FALSE)
247 EndIf
248 EndLoop
249 Label(0)
250 Wait(1)
251 Call(GetActionSuccess, LVar0)
252 IfEq(LVar0, 0)
253 Goto(0)
254 EndIf
255 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash2_PreSwing)
256 Wait(3)
257 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash2_Swing)
258 Wait(3)
259 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_QUAKE)
260 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
261 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_SPIN_SMASH_2)
262 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16)
264 Wait(10)
265 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
266 Wait(25)
267 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
268 Return
269 EndIf
270 Call(GetPlayerActionSuccess, LVar0)
272 CaseGt(FALSE)
273 Call(func_802A1000_737890)
276 Call(func_802A1074_737904)
282 Wait(10)
283 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
284 ExecWait(N(EVS_Hammer_ReturnHome_B))
285 Return
291 Thread
292 Set(LVar0, 0)
293 Loop(10)
294 Add(LVar0, 18)
295 Call(SetActorYaw, ACTOR_PLAYER, LVar0)
296 Wait(1)
297 EndLoop
299 Wait(10)
300 Call(SetActorYaw, ACTOR_PLAYER, 0)
301 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
302 ExecWait(N(EVS_Hammer_ReturnHome_B))
303 Return
304 End
305};
306
307EvtScript N(EVS_UseMoveUltra_Impl) = {
308 Call(LoadActionCommand, ACTION_COMMAND_SMASH)
309 Call(action_command_hammer_init)
310 Call(InitTargetIterator)
311 ExecWait(N(EVS_HammerSupport_SmashApproach))
312 Set(LVar1, 0)
313 Loop(10)
314 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
315 IfEq(LVar0, TRUE)
316 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
318 EndIf
319 Wait(1)
320 Add(LVar1, 1)
321 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash3_Begin)
322 EndLoop
323 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash3_Begin)
325 CaseLt(3)
326 Wait(4)
327 CaseLt(5)
328 Wait(3)
329 CaseLt(7)
330 Wait(2)
331 CaseLt(9)
332 Wait(1)
333 CaseLt(11)
334 Wait(0)
336 Call(InitTargetIterator)
337 Call(UseBattleCamPreset, BTL_CAM_PLAYER_AIM_HAMMER)
338 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_WINDUP)
339 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash3_Raise)
340 Wait(8)
341 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash3_Hold1)
342 Call(N(ShouldMovesAutoSucceed))
343 IfEq(LVar0, FALSE)
344 Loop(45)
345 Wait(1)
346 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
347 IfNe(LVar0, FALSE)
349 EndIf
350 EndLoop
351 EndIf
352 Call(action_command_hammer_start, 0, LVarD, 3)
353 Call(SetActionQuality, 0)
354 Set(LVar1, 0)
355 Loop(30)
356 Wait(1)
357 Call(GetActionQuality, LVar0)
358 IfNe(LVar0, 0)
359 IfNe(LVar1, 1)
360 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash3_Hold2)
361 Set(LVar1, 1)
362 EndIf
363 EndIf
364 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
365 IfEq(LVar0, FALSE)
367 EndIf
368 EndLoop
369 Label(0)
370 Wait(1)
371 Call(GetActionSuccess, LVar0)
372 IfEq(LVar0, 0)
373 Goto(0)
374 EndIf
375 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash3_PreSwing)
376 Wait(3)
377 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_SpinSmash3_Swing)
378 Wait(3)
379 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_QUAKE)
380 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
381 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_SPIN_SMASH_3)
382 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16)
384 Wait(10)
385 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
386 Wait(25)
387 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
388 Return
389 EndIf
390 Call(GetPlayerActionSuccess, LVar0)
392 CaseGt(FALSE)
393 Call(func_802A1000_737890)
396 Call(func_802A1074_737904)
402 Wait(10)
403 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
404 ExecWait(N(EVS_Hammer_ReturnHome_B))
405 Return
411 Thread
412 Set(LVar0, 0)
413 Loop(10)
414 Add(LVar0, 18)
415 Call(SetActorYaw, ACTOR_PLAYER, LVar0)
416 Wait(1)
417 EndLoop
419 Wait(10)
420 Call(SetActorYaw, ACTOR_PLAYER, 0)
421 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
422 ExecWait(N(EVS_Hammer_ReturnHome_B))
423 Return
424 End
425};
Vec3f curPos
Bytecode EvtScript[]
@ ACTION_COMMAND_SMASH
Definition enums.h:3474
@ BUTTON_STICK_LEFT
Definition enums.h:2793
@ 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_HAMMER_QUAKE
Definition enums.h:4868
@ BTL_CAM_PLAYER_AIM_HAMMER
Definition enums.h:4865
#define SUPPRESS_EVENTS_HAMMER
Definition enums.h:2912
@ DMG_SRC_SPIN_SMASH
Definition enums.h:1990
@ SOUND_HAMMER_WINDUP
Definition enums.h:744
@ SOUND_SPIN_SMASH_1
Definition enums.h:1563
@ SOUND_SPIN_SMASH_3
Definition enums.h:1565
@ SOUND_SPIN_SMASH_2
Definition enums.h:1564
@ BTL_RUMBLE_PLAYER_MIN
Definition enums.h:4259
@ BTL_RUMBLE_PLAYER_HEAVY
Definition enums.h:4261
@ BTL_RUMBLE_PLAYER_LIGHT
Definition enums.h:4260
@ ACTOR_PLAYER
Definition enums.h:2085
@ DAMAGE_TYPE_SPIN_SMASH
Definition enums.h:2876
@ DAMAGE_TYPE_SMASH
Definition enums.h:2857
@ DAMAGE_TYPE_MULTIPLE_POPUPS
Definition enums.h:2879
#define ApiStatus_DONE2
Definition evt.h:118
#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 LVarF
Definition macros.h:163
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:272
#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 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 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 BreakLoop
Breaks out of the innermost loop.
Definition macros.h:251
#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 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 CaseLt(RVAR)
Marks the start of a switch case that executes only if LVAR < RVAR. It also marks the end of any prev...
Definition macros.h:325
#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 Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVarE
Definition macros.h:162
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217
struct Actor * playerActor
BattleStatus gBattleStatus
Definition battle.c:11