Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
HammerSupport.inc.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 BASIC_HAMMER_DMG_BAD 1
7#define BASIC_HAMMER_DMG_GOOD 2
8#define SUPER_HAMMER_DMG_BAD 2
9#define SUPER_HAMMER_DMG_GOOD 4
10#define ULTRA_HAMMER_DMG_BAD 3
11#define ULTRA_HAMMER_DMG_GOOD 6
12
13API_CALLABLE(N(IsBerserkerEquipped)) {
15 script->varTable[1] = 15;
16
18 script->varTable[0] = AC_MODE_NOT_LEARNED;
19 script->varTable[1] = 40;
20 }
21
22 return ApiStatus_DONE2;
23}
24
26
27// Move the player into position 32 units to the left of the target enemy
33 Sub(LVar0, 32)
39 Return
40 End
41};
42
43// Move the player into a fixed position ideal for quakin'
45 Call(SetGoalPos, ACTOR_PLAYER, -33, 0, 0)
50 Return
51 End
52};
53
54// delay while player holds hammer on the ground before raising it
55// can be sped up by pre-emptively holding left
59 Set(LVar1, 0)
60 Loop(10)
65 EndIf
66 Wait(1)
67 Add(LVar1, 1)
72 CaseLt(3)
73 Wait(4)
74 CaseLt(5)
75 Wait(3)
76 CaseLt(7)
77 Wait(2)
78 CaseLt(9)
79 Wait(1)
80 CaseLt(11)
81 Wait(0)
83 Return
84 End
85};
86
87// delay while player holds hammer on the ground before raising it
88// can be sped up by pre-emptively holding left
92 Set(LVar1, 0)
93 Loop(10)
98 EndIf
99 Wait(1)
100 Add(LVar1, 1)
102 EndLoop
105 CaseLt(3)
106 Wait(4)
107 CaseLt(5)
108 Wait(3)
109 CaseLt(7)
110 Wait(2)
111 CaseLt(9)
112 Wait(1)
113 CaseLt(11)
114 Wait(0)
116 Return
117 End
118};
119
120// delay while player holds hammer on the ground before raising it
121// can be sped up by pre-emptively holding left
124 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
125 Set(LVar1, 0)
126 Loop(10)
128 IfEq(LVar0, TRUE)
131 EndIf
132 Wait(1)
133 Add(LVar1, 1)
135 EndLoop
138 CaseLt(3)
139 Wait(4)
140 CaseLt(5)
141 Wait(3)
142 CaseLt(7)
143 Wait(2)
144 CaseLt(9)
145 Wait(1)
146 CaseLt(11)
147 Wait(0)
149 Return
150 End
151};
152
159 Wait(4)
163 Set(LVar1, 0)
164 Loop(30)
165 Wait(1)
167 IfNe(LVar0, 0)
168 IfNe(LVar1, 1)
170 Set(LVar1, 1)
171 EndIf
172 EndIf
176 EndIf
177 EndLoop
178 Label(0)
179 Wait(1)
181 IfEq(LVar0, TRUE)
182 Goto(0)
183 EndIf
185 Wait(3)
188 Return
189 End
190};
191
197 Wait(20)
200 Wait(5)
206 Return
207 End
208};
209
213 Wait(20)
216 Wait(5)
222 Return
223 End
224};
225
230 Wait(20)
233 Wait(5)
239 Return
240 End
241};
242
248 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
256 Wait(4)
263 IfEq(LVar0, 0)
264 Loop(45)
265 Wait(1)
269 EndIf
270 EndLoop
271 EndIf
272 EndIf
273 Add(LVarD, 6)
276 Set(LVar1, 0)
277 Loop(30)
278 Wait(1)
280 IfNe(LVar0, 0)
281 IfNe(LVar1, 1)
283 Set(LVar1, 1)
284 EndIf
285 EndIf
289 EndIf
290 EndLoop
291 Label(0)
294 Wait(1)
296 IfEq(LVar0, 0)
297 Goto(0)
298 EndIf
299 EndIf
300 Else
304 Sub(LVar1, 10)
305 Wait(LVar1)
307 Wait(5)
308 EndIf
312 Loop(0)
316 EndIf
317 Wait(1)
318 EndLoop
319 EndIf
322 Wait(3)
325 Return
326 End
327};
328
334 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
342 Wait(4)
344 IfEq(LVar0, TRUE)
348 Loop(45)
349 Wait(1)
353 EndIf
354 EndLoop
355 EndIf
356 Add(LVarD, 6)
359 Set(LVar1, 0)
360 Loop(30)
361 Wait(1)
363 IfNe(LVar0, 0)
364 IfNe(LVar1, 1)
366 Set(LVar1, 1)
367 EndIf
368 EndIf
372 EndIf
373 EndLoop
374 Label(0)
375 Wait(1)
377 IfEq(LVar0, 0)
378 Goto(0)
379 EndIf
380 Else
384 Sub(LVar1, 10)
385 Wait(LVar1)
387 Wait(5)
388 EndIf
391 Wait(3)
394 Return
395 End
396};
397
403 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
411 Wait(4)
413 IfEq(LVar0, TRUE)
417 Loop(45)
418 Wait(1)
422 EndIf
423 EndLoop
424 EndIf
425 Add(LVarD, 6)
428 Set(LVar1, 0)
429 Loop(30)
430 Wait(1)
432 IfNe(LVar0, 0)
433 IfNe(LVar1, 1)
435 Set(LVar1, 1)
436 EndIf
437 EndIf
441 EndIf
442 EndLoop
443 Label(0)
444 Wait(1)
446 IfEq(LVar0, 0)
447 Goto(0)
448 EndIf
449 Else
453 Sub(LVar1, 10)
454 Wait(LVar1)
456 Wait(5)
457 EndIf
460 Wait(3)
463 Return
464 End
465};
466
473 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
480 Wait(8)
483 IfEq(LVar0, 0)
484 Loop(45)
485 Wait(1)
489 EndIf
490 EndLoop
491 EndIf
492 Add(LVarD, 6)
495 Set(LVar1, 0)
496 Loop(30)
497 Wait(1)
499 IfNe(LVar0, 0)
500 IfNe(LVar1, 1)
502 Set(LVar1, 1)
503 EndIf
504 EndIf
508 EndIf
509 EndLoop
510 Label(0)
511 Wait(1)
513 IfEq(LVar0, 0)
514 Goto(0)
515 EndIf
518 Wait(3)
521 Return
522 End
523};
524
531 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
538 Wait(8)
541 IfEq(LVar0, 0)
542 Loop(45)
543 Wait(1)
547 EndIf
548 EndLoop
549 EndIf
550 Add(LVarD, 6)
552 Loop(60)
553 Wait(1)
557 EndIf
558 EndLoop
559 Label(0)
560 Wait(1)
562 IfEq(LVar0, 0)
563 Goto(0)
564 EndIf
567 Wait(3)
570 Return
571 End
572};
573
580 Call(AddGoalPos, ACTOR_PLAYER, 0, 0, 0)
587 Wait(8)
590 IfEq(LVar0, 0)
591 Loop(45)
592 Wait(1)
596 EndIf
597 EndLoop
598 EndIf
599 Add(LVarD, 6)
601 Loop(60)
602 Wait(1)
606 EndIf
607 EndLoop
608 Label(0)
609 Wait(1)
611 IfEq(LVar0, 0)
612 Goto(0)
613 EndIf
616 Wait(3)
619 Return
620 End
621};
BSS s32 PopupMenu_SelectedIndex
@ 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
@ AC_MODE_NOT_LEARNED
Definition action_cmd.h:60
Bytecode EvtScript[]
@ ACTION_COMMAND_SMASH
Definition enums.h:3474
@ BUTTON_STICK_LEFT
Definition enums.h:2793
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ ITER_LAST
Definition enums.h:2027
@ HIT_RESULT_HIT
Definition enums.h:1950
@ BTL_CAM_RETURN_HOME
Definition enums.h:4825
@ BTL_CAM_PLAYER_MISTAKE
Definition enums.h:4850
@ BTL_CAM_PLAYER_AIM_HAMMER
Definition enums.h:4864
@ BTL_CAM_PLAYER_HAMMER_STRIKE
Definition enums.h:4865
@ BTL_CAM_PLAYER_ATTACK_APPROACH
Definition enums.h:4847
@ ABILITY_BERSERKER
Definition enums.h:457
@ SOUND_HAMMER_STRIKE_3
Definition enums.h:1559
@ SOUND_HAMMER_SWING_3
Definition enums.h:1556
@ SOUND_HAMMER_STRIKE_1
Definition enums.h:1557
@ SOUND_HAMMER_SWING_1
Definition enums.h:1554
@ SOUND_HAMMER_SWING_2
Definition enums.h:1555
@ SOUND_HAMMER_WINDUP
Definition enums.h:744
@ SOUND_HAMMER_STRIKE_2
Definition enums.h:1558
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_BLUR_RESET
Definition enums.h:6414
@ DAMAGE_TYPE_SMASH
Definition enums.h:2857
#define ApiStatus_DONE2
Definition evt.h:118
s32 is_ability_active(s32 arg0)
Definition inventory.c:1736
#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 Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#define Sub(VAR, INT_VALUE)
Definition macros.h:377
#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 Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
Definition macros.h:275
#define Float(DOUBLE)
Definition macros.h:51
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#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 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 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
BattleStatus gBattleStatus
Definition battle.c:11