Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
hammer_throw.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "entity.h"
4#include "sprite/player.h"
5#include "include_asset.h"
6
7#define NAMESPACE battle_move_hammer_throw
8
10
11static s32 pad_images = 0;
12
13INCLUDE_IMG("battle/move/hammer/dusty_hammer.png", battle_move_hammer_throw_dusty_hammer_png);
14INCLUDE_PAL("battle/move/hammer/dusty_hammer.pal", battle_move_hammer_throw_dusty_hammer_pal);
15
16INCLUDE_IMG("battle/move/hammer/basic_hammer.png", battle_move_hammer_throw_basic_hammer_png);
17INCLUDE_PAL("battle/move/hammer/basic_hammer.pal", battle_move_hammer_throw_basic_hammer_pal);
18
19INCLUDE_IMG("battle/move/hammer/super_hammer.png", battle_move_hammer_throw_super_hammer_png);
20INCLUDE_PAL("battle/move/hammer/super_hammer.pal", battle_move_hammer_throw_super_hammer_pal);
21
22INCLUDE_IMG("battle/move/hammer/ultra_hammer.png", battle_move_hammer_throw_ultra_hammer_png);
23INCLUDE_PAL("battle/move/hammer/ultra_hammer.pal", battle_move_hammer_throw_ultra_hammer_pal);
24
25#include "battle/move/hammer/hammer_throw.vtx.inc.c"
26
27#include "battle/move/hammer/dusty_hammer.gfx.inc.c"
28#include "battle/move/hammer/basic_hammer.gfx.inc.c"
29#include "battle/move/hammer/super_hammer.gfx.inc.c"
30#include "battle/move/hammer/ultra_hammer.gfx.inc.c"
31
32EntityModelScript N(EMS_DustyHammer) = STANDARD_ENTITY_MODEL_SCRIPT(N(dusty_hammer_gfx), RENDER_MODE_ALPHATEST);
33EntityModelScript N(EMS_BasicHammer) = STANDARD_ENTITY_MODEL_SCRIPT(N(basic_hammer_gfx), RENDER_MODE_ALPHATEST);
34EntityModelScript N(EMS_SuperHammer) = STANDARD_ENTITY_MODEL_SCRIPT(N(super_hammer_gfx), RENDER_MODE_ALPHATEST);
35EntityModelScript N(EMS_UltraHammer) = STANDARD_ENTITY_MODEL_SCRIPT(N(ultra_hammer_gfx), RENDER_MODE_ALPHATEST);
36
37extern EvtScript N(EVS_UseMove_Impl);
38
39EvtScript N(EVS_UseMove) = {
40 Call(ShowActionHud, TRUE)
41 Call(GetMenuSelection, LVar0, LVar1, LVar2)
43 CaseEq(0)
44 Set(LVarD, 50)
45 Set(LVarE, 1)
46 Set(LVarF, 2)
47 ExecWait(N(EVS_UseMove_Impl))
48 CaseEq(1)
49 Set(LVarD, 50)
50 Set(LVarE, 2)
51 Set(LVarF, 4)
52 ExecWait(N(EVS_UseMove_Impl))
53 CaseEq(2)
54 Set(LVarD, 50)
55 Set(LVarE, 3)
56 Set(LVarF, 6)
57 ExecWait(N(EVS_UseMove_Impl))
59 Return
60 End
61};
62
63EvtScript N(EVS_802A3E5C) = {
64 Call(SetGoalToTarget, ACTOR_PLAYER)
65 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
66 Set(LVar1, 0)
67 Loop(10)
68 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
69 IfEq(LVar0, TRUE)
70 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
72 EndIf
73 Wait(1)
74 Add(LVar1, 1)
75 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow1_Begin)
77 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow1_Begin)
79 CaseLt(3)
80 Wait(4)
81 CaseLt(5)
82 Wait(3)
83 CaseLt(7)
84 Wait(2)
85 CaseLt(9)
86 Wait(1)
87 CaseLt(11)
88 Wait(0)
90 Return
91 End
92};
93
94EvtScript N(EVS_802A3FE0) = {
95 Call(SetGoalToTarget, ACTOR_PLAYER)
96 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
97 Set(LVar1, 0)
98 Loop(10)
99 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
100 IfEq(LVar0, TRUE)
101 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
103 EndIf
104 Wait(1)
105 Add(LVar1, 1)
106 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow2_Begin)
107 EndLoop
108 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow2_Begin)
110 CaseLt(3)
111 Wait(4)
112 CaseLt(5)
113 Wait(3)
114 CaseLt(7)
115 Wait(2)
116 CaseLt(9)
117 Wait(1)
118 CaseLt(11)
119 Wait(0)
121 Return
122 End
123};
124
125EvtScript N(EVS_802A4164) = {
126 Call(SetGoalToTarget, ACTOR_PLAYER)
127 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
128 Set(LVar1, 0)
129 Loop(10)
130 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
131 IfEq(LVar0, TRUE)
132 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
134 EndIf
135 Wait(1)
136 Add(LVar1, 1)
137 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow3_Begin)
138 EndLoop
139 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow3_Begin)
141 CaseLt(3)
142 Wait(4)
143 CaseLt(5)
144 Wait(3)
145 CaseLt(7)
146 Wait(2)
147 CaseLt(9)
148 Wait(1)
149 CaseLt(11)
150 Wait(0)
152 Return
153 End
154};
155
156EvtScript N(EVS_UseMove_Impl) = {
157 Call(LoadActionCommand, ACTION_COMMAND_SMASH)
158 Call(action_command_hammer_init)
159 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Run)
160 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
161 Add(LVar0, 16)
162 Call(SetActorSpeed, ACTOR_PLAYER, Float(4.0))
163 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
164 Call(PlayerRunToGoal, 0)
165 Call(SetGoalToTarget, ACTOR_PLAYER)
166 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
167 Call(GetMenuSelection, LVar0, LVar1, LVar2)
169 CaseEq(0)
170 ExecWait(N(EVS_802A3E5C))
171 CaseEq(1)
172 ExecWait(N(EVS_802A3FE0))
173 CaseEq(2)
174 ExecWait(N(EVS_802A4164))
176 Call(InitTargetIterator)
177 Call(UseBattleCamPreset, BTL_CAM_PLAYER_ATTACK_APPROACH)
178 Call(AddBattleCamDist, 50)
179 Call(MoveBattleCamOver, 20)
180 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_WINDUP)
181 Call(GetMenuSelection, LVar0, LVar1, LVar2)
183 CaseEq(0)
184 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow1_Raise)
185 Wait(4)
186 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow1_Hold1)
187 CaseEq(1)
188 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow2_Raise)
189 Wait(4)
190 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow2_Hold1)
191 CaseEq(2)
192 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow3_Raise)
193 Wait(4)
194 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow3_Hold1)
196 Call(GetActionCommandMode, LVar0)
197 IfGt(LVar0, 0)
198 Call(N(ShouldMovesAutoSucceed))
199 IfEq(LVar0, 0)
200 Loop(45)
201 Wait(1)
202 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
203 IfNe(LVar0, FALSE)
205 EndIf
206 EndLoop
207 EndIf
208 Add(LVarD, 6)
209 Call(action_command_hammer_start, 0, LVarD, 3)
210 Call(SetActionQuality, 0)
211 Set(LVar1, 0)
212 Loop(30)
213 Wait(1)
214 Call(GetActionQuality, LVar0)
215 IfNe(LVar0, 0)
216 IfNe(LVar1, 1)
217 Call(GetMenuSelection, LVar3, LVar4, LVar5)
219 CaseEq(0)
220 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow1_Hold2)
221 CaseEq(1)
222 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow2_Hold2)
223 CaseEq(2)
224 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow3_Hold2)
226 Set(LVar1, 1)
227 EndIf
228 EndIf
229 Call(CheckButtonDown, BUTTON_STICK_LEFT, LVar0)
230 IfEq(LVar0, FALSE)
232 EndIf
233 EndLoop
234 Else
235 Wait(10)
236 Call(GetMenuSelection, LVar3, LVar4, LVar5)
238 CaseEq(0)
239 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow1_Hold2)
240 CaseEq(1)
241 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow2_Hold2)
242 CaseEq(2)
243 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow3_Hold2)
245 Wait(30)
246 EndIf
247 Call(GetActionCommandMode, LVar0)
248 IfGt(LVar0, 0)
249 Loop(0)
250 Wait(1)
251 Call(GetActionSuccess, LVar0)
252 IfNe(LVar0, 0)
254 EndIf
255 EndLoop
256 EndIf
257 Call(GetMenuSelection, LVar0, LVar1, LVar2)
259 CaseEq(0)
260 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow1_Throw)
261 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_SWING_1)
262 CaseEq(1)
263 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow2_Throw)
264 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_SWING_2)
265 CaseEq(2)
266 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB2_HammerThrow3_Throw)
267 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HAMMER_SWING_3)
269 Wait(3)
270 Call(GetMenuSelection, LVar0, LVar1, LVar2)
272 CaseEq(0)
273 Call(CreateVirtualEntity, LVarA, Ref(N(EMS_BasicHammer)))
274 CaseEq(1)
275 Call(CreateVirtualEntity, LVarA, Ref(N(EMS_SuperHammer)))
276 CaseEq(2)
277 Call(CreateVirtualEntity, LVarA, Ref(N(EMS_UltraHammer)))
279 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
280 Add(LVar0, 20)
281 Add(LVar1, 42)
282 Add(LVar2, 5)
284 Call(SetVirtualEntityScale, LVarA, Float(0.6), Float(0.6), Float(0.6))
285 Call(InitTargetIterator)
286 Call(SetGoalToTarget, ACTOR_SELF)
287 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
288 Call(GetPlayerActionSuccess, LVar3)
290 CaseGt(FALSE)
291 Thread
292 Set(LVar0, 0)
293 Loop(9)
294 Add(LVar0, 60)
296 Wait(1)
297 EndLoop
300 Add(LVar2, 5)
303 Thread
304 Set(LVar0, 0)
305 Loop(18)
306 Add(LVar0, 60)
308 Wait(1)
309 EndLoop
312 Add(LVar2, 5)
315 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
316 Call(PlayerTestEnemy, LVar3, DAMAGE_TYPE_SMASH | DAMAGE_TYPE_NO_CONTACT, 25, 0, 0, 16)
320 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
321 Return
322 EndIf
323 Thread
324 Call(GetPlayerActionSuccess, LVar3)
326 CaseGt(FALSE)
328 Add(LVar0, 60)
329 Add(LVar1, 0)
334 Add(LVar0, 40)
335 Add(LVar1, 0)
340 Call(GetPlayerActionSuccess, LVar0)
342 CaseGt(FALSE)
343 Call(GetMenuSelection, LVar0, LVar1, LVar2)
345 CaseEq(0)
346 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
347 Thread
348 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.3))
350 CaseEq(1)
351 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
352 Thread
353 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.6))
355 CaseEq(2)
356 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
357 Thread
358 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.9))
362 Call(GetMenuSelection, LVar0, LVar1, LVar2)
364 CaseEq(0)
365 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
366 Thread
367 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.3))
369 CaseEq(1)
370 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
371 Thread
372 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.6))
374 CaseEq(2)
375 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
376 Thread
377 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.9))
381 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE)
382 Call(MoveBattleCamOver, 10)
383 Call(GetMenuSelection, LVar0, LVar1, LVar2)
385 CaseEq(0)
386 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_1)
387 CaseEq(1)
388 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_2)
389 CaseEq(2)
390 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_D_DOWN_HIT_3)
392 Call(GetPlayerActionSuccess, LVar0)
394 CaseGt(FALSE)
395 Call(GetMenuSelection, LVar0, LVar1, LVar2)
397 CaseEq(0)
398 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
399 CaseEq(1)
400 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
401 CaseEq(2)
402 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
406 Call(GetMenuSelection, LVar0, LVar1, LVar2)
408 CaseEq(0)
409 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
410 CaseEq(1)
411 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
412 CaseEq(2)
413 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
420 ExecWait(N(EVS_HammerSupport_ReturnHome_Success))
424 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
427 Return
428 End
429};
Bytecode EvtScript[]
s32 EntityModelScript[]
Definition entity.h:7
#define STANDARD_ENTITY_MODEL_SCRIPT(gfx, renderMode)
Definition entity.h:56
@ 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_STRIKE
Definition enums.h:4866
@ BTL_CAM_PLAYER_ATTACK_APPROACH
Definition enums.h:4848
#define SUPPRESS_EVENTS_HAMMER
Definition enums.h:2912
@ SOUND_HIT_SILENT
Definition enums.h:747
@ SOUND_HAMMER_SWING_3
Definition enums.h:1556
@ SOUND_D_DOWN_HIT_1
Definition enums.h:1547
@ SOUND_D_DOWN_HIT_3
Definition enums.h:1549
@ SOUND_HAMMER_SWING_1
Definition enums.h:1554
@ SOUND_HIT_NORMAL
Definition enums.h:724
@ SOUND_HAMMER_SWING_2
Definition enums.h:1555
@ SOUND_HAMMER_WINDUP
Definition enums.h:744
@ SOUND_D_DOWN_HIT_2
Definition enums.h:1548
@ RENDER_MODE_ALPHATEST
Definition enums.h:3276
@ 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
@ ACTOR_SELF
Definition enums.h:2084
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_THROW
Definition enums.h:2869
@ DAMAGE_TYPE_SMASH
Definition enums.h:2857
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
#define INCLUDE_PAL(FILENAME, SYMBOLNAME)
#define INCLUDE_IMG(FILENAME, SYMBOLNAME)
ApiStatus CreateVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityPosition(Evt *script, b32 isInitialCall)
ApiStatus VirtualEntityLandJump(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityJumpGravity(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityScale(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(Evt *script, b32 isInitialCall)
ApiStatus DeleteVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus VirtualEntityJumpTo(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityRotation(Evt *script, b32 isInitialCall)
#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 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 IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#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 LVar5
Definition macros.h:153
#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 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 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 LVar4
Definition macros.h:152
#define LVar3
Definition macros.h:151
#define LVarE
Definition macros.h:162
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217