Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
hammer_charge_0.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_hammer_charge_0
6
8
10
11API_CALLABLE(func_802A10C8_74F1F8) {
12 Bytecode* args = script->ptrReadPos;
13 BattleStatus* battleStatus = &gBattleStatus;
14 s32 var1 = evt_get_variable(script, *args++);
15 s32 var2 = evt_get_variable(script, *args++);
16 s32 var3 = evt_get_variable(script, *args++);
17
18 fx_stat_change(0, var1, var2, var3, 1.0f, 60);
19
20 battleStatus->hammerCharge++;
21 if (battleStatus->hammerCharge > 99) {
22 battleStatus->hammerCharge = 99;
23 }
24
25 battleStatus->jumpCharge = 0;
26 battleStatus->flags1 |= BS_FLAGS1_HAMMER_CHARGED;
27 battleStatus->flags1 &= ~BS_FLAGS1_JUMP_CHARGED;
28
29 return ApiStatus_DONE2;
30}
31
32API_CALLABLE(func_802A11CC_74F2FC) {
33 Bytecode* args = script->ptrReadPos;
34 s32 var0 = evt_get_variable(script, *args++);
35 s32 var1 = evt_get_variable(script, *args++);
36 s32 var2 = evt_get_variable(script, *args++);
37 f32 var3 = evt_get_float_variable(script, *args++);
38
39 fx_energy_in_out(6, var0 + 10, var1 + 18, var2, var3, 45);
40
41 return ApiStatus_DONE2;
42}
43
44extern EvtScript N(EVS_802A3348);
45
46EvtScript N(EVS_UseMove1) = {
47 Call(GetMenuSelection, LVar0, LVar1, LVar2)
49 CaseEq(0)
50 Set(LVarD, 65)
51 Set(LVarE, 1)
52 Set(LVarF, 2)
53 ExecWait(N(EVS_802A3348))
54 CaseEq(1)
55 Set(LVarD, 65)
56 Set(LVarE, 2)
57 Set(LVarF, 4)
58 ExecWait(N(EVS_802A3348))
59 CaseEq(2)
60 Set(LVarD, 65)
61 Set(LVarE, 4)
62 Set(LVarF, 6)
63 ExecWait(N(EVS_802A3348))
65 Return
66 End
67};
68
69EvtScript N(EVS_802A3348) = {
70 Call(GetMenuSelection, LVar0, LVar1, LVar2)
72 CaseEq(0)
73 ExecWait(N(EVS_UseBasicHammer))
74 CaseEq(1)
75 ExecWait(N(EVS_UseSuperHammer))
76 CaseEq(2)
77 ExecWait(N(EVS_UseBasicHammer))
79 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, LVar9, 16)
80 Call(GetPlayerActionSuccess, LVar0)
82 CaseGt(FALSE)
83 Call(GetMenuSelection, LVar0, LVar1, LVar2)
85 CaseEq(0)
86 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
87 Thread
88 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.3))
90 CaseEq(1)
91 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
92 Thread
93 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.6))
95 CaseEq(2)
96 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
97 Thread
98 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.9))
102 Call(GetMenuSelection, LVar0, LVar1, LVar2)
104 CaseEq(0)
105 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
106 Thread
107 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.3))
109 CaseEq(1)
110 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
111 Thread
112 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.6))
114 CaseEq(2)
115 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
116 Thread
117 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.9))
121 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE)
122 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16)
124 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
125 Return
126 EndIf
127 Set(LFlag0, FALSE)
128 Call(GetPlayerActionSuccess, LVar0)
130 CaseGt(FALSE)
131 Call(GetMenuSelection, LVar0, LVar1, LVar2)
133 CaseEq(0)
134 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
135 CaseEq(1)
136 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
137 CaseEq(2)
138 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
141 Set(LFlag0, TRUE)
143 Call(GetMenuSelection, LVar0, LVar1, LVar2)
145 CaseEq(0)
146 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
147 CaseEq(1)
148 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
149 CaseEq(2)
150 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
153 Set(LFlag0, FALSE)
158 ExecWait(N(EVS_HammerSupport_ReturnHome_Success))
162 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
165 Return
166 End
167};
168
169extern EvtScript N(EVS_802A3948);
170extern EvtScript N(EVS_802A3C90);
171extern EvtScript N(EVS_802A3FD8);
172
173EvtScript N(EVS_UseMove0) = {
174 Call(GetMenuSelection, LVar0, LVar1, LVar2)
176 CaseEq(0)
177 ExecWait(N(EVS_802A3948))
178 CaseEq(1)
179 ExecWait(N(EVS_802A3C90))
180 CaseEq(2)
181 ExecWait(N(EVS_802A3FD8))
183 Return
184 End
185};
186
187EvtScript N(EVS_802A3948) = {
188 Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP)
189 Wait(10)
190 Thread
191 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
192 Wait(8)
193 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
194 Wait(8)
196 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer1_Charging)
197 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
198 Call(func_802A11CC_74F2FC, LVar0, LVar1, LVar2, Float(1.2))
199 Wait(3)
200 Call(func_802A11CC_74F2FC, LVar0, LVar1, LVar2, Float(0.8))
201 Wait(30)
202 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
203 Call(MoveBattleCamOver, 5)
204 Call(N(IsHammerMaxCharged))
205 IfEq(LVar0, 0)
206 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
207 Add(LVar0, 15)
208 Add(LVar1, 35)
209 Call(func_802A10C8_74F1F8, LVar0, LVar1, LVar2)
210 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_CHARGE_UP)
211 Wait(4)
212 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_LONG_PLAYER_JUMP)
213 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
214 Call(SetActorSpeed, ACTOR_PLAYER, Float(1.0))
215 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
216 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer1_Charged, ANIM_MarioB3_Hammer1_Charged, ANIM_MarioB3_Hammer1_Charged)
217 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
218 Call(PlayerHopToGoal, 20, 0, 0)
219 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land)
220 Wait(4)
221 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
222 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
223 Call(ShowVariableMessageBox, BTL_MSG_CHARGE_HAMMER, 60, 1)
224 Else
225 Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60)
226 EndIf
227 Label(0)
228 Wait(1)
229 Call(IsMessageBoxDisplayed, LVar0)
230 IfEq(LVar0, TRUE)
231 Goto(0)
232 EndIf
233 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
234 Return
235 End
236};
237
238EvtScript N(EVS_802A3C90) = {
239 Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP)
240 Wait(10)
241 Thread
242 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
243 Wait(8)
244 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
245 Wait(8)
247 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer2_Charging)
248 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
249 Call(func_802A11CC_74F2FC, LVar0, LVar1, LVar2, Float(1.2))
250 Wait(3)
251 Call(func_802A11CC_74F2FC, LVar0, LVar1, LVar2, Float(0.8))
252 Wait(30)
253 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
254 Call(MoveBattleCamOver, 5)
255 Call(N(IsHammerMaxCharged))
256 IfEq(LVar0, 0)
257 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
258 Add(LVar0, 15)
259 Add(LVar1, 35)
260 Call(func_802A10C8_74F1F8, LVar0, LVar1, LVar2)
261 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_CHARGE_UP)
262 Wait(4)
263 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_LONG_PLAYER_JUMP)
264 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
265 Call(SetActorSpeed, ACTOR_PLAYER, Float(1.0))
266 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
267 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer2_Charged, ANIM_MarioB3_Hammer2_Charged, ANIM_MarioB3_Hammer2_Charged)
268 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
269 Call(PlayerHopToGoal, 20, 0, 0)
270 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land)
271 Wait(4)
272 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
273 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
274 Call(ShowVariableMessageBox, BTL_MSG_CHARGE_HAMMER, 60, 1)
275 Else
276 Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60)
277 EndIf
278 Label(0)
279 Wait(1)
280 Call(IsMessageBoxDisplayed, LVar0)
281 IfEq(LVar0, TRUE)
282 Goto(0)
283 EndIf
284 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
285 Return
286 End
287};
288
289EvtScript N(EVS_802A3FD8) = {
290 Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP)
291 Wait(10)
292 Thread
293 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
294 Wait(8)
295 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
296 Wait(8)
298 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer3_Charging)
299 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
300 Call(func_802A11CC_74F2FC, LVar0, LVar1, LVar2, Float(1.2))
301 Wait(3)
302 Call(func_802A11CC_74F2FC, LVar0, LVar1, LVar2, Float(0.8))
303 Wait(30)
304 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
305 Call(MoveBattleCamOver, 5)
306 Call(N(IsHammerMaxCharged))
307 IfEq(LVar0, 0)
308 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
309 Add(LVar0, 15)
310 Add(LVar1, 35)
311 Call(func_802A10C8_74F1F8, LVar0, LVar1, LVar2)
312 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_CHARGE_UP)
313 Wait(4)
314 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_LONG_PLAYER_JUMP)
315 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
316 Call(SetActorSpeed, ACTOR_PLAYER, Float(1.0))
317 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
318 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer3_Charged, ANIM_MarioB3_Hammer3_Charged, ANIM_MarioB3_Hammer3_Charged)
319 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
320 Call(PlayerHopToGoal, 20, 0, 0)
321 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land)
322 Wait(4)
323 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
324 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
325 Call(ShowVariableMessageBox, BTL_MSG_CHARGE_HAMMER, 60, 1)
326 Else
327 Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60)
328 EndIf
329 Label(0)
330 Wait(1)
331 Call(IsMessageBoxDisplayed, LVar0)
332 IfEq(LVar0, TRUE)
333 Goto(0)
334 EndIf
335 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
336 Return
337 End
338};
339
340
Bytecode EvtScript[]
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3575
@ BS_FLAGS1_HAMMER_CHARGED
Definition enums.h:3597
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3571
@ BTL_MSG_CANT_CHARGE
Definition enums.h:4066
@ BTL_MSG_CHARGE_HAMMER
Definition enums.h:4062
@ 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_DEFAULT
Definition enums.h:4824
@ BTL_CAM_PLAYER_HAMMER_STRIKE
Definition enums.h:4866
@ BTL_CAM_PLAYER_CHARGE_UP
Definition enums.h:4854
#define SUPPRESS_EVENTS_HAMMER
Definition enums.h:2912
@ SOUND_HIT_SILENT
Definition enums.h:747
@ SOUND_PLAYER_CHARGE
Definition enums.h:774
@ SOUND_HIT_NORMAL
Definition enums.h:724
@ SOUND_CHARGE_UP
Definition enums.h:1436
@ SOUND_LONG_PLAYER_JUMP
Definition enums.h:782
@ 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
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_SMASH
Definition enums.h:2857
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1690
f32 evt_get_float_variable(Evt *script, Bytecode var)
Definition evt.c:1930
ApiStatus ShakeCam(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 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 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 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 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 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 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 LFlag0
Definition macros.h:167
#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 Return
Kills the current EVT thread.
Definition macros.h:217
BattleStatus gBattleStatus
Definition battle.c:11