Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
hammer_charge_1.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_1
6
8
10
12
13API_CALLABLE(func_802A10C8_759678) {
14 Bytecode* args = script->ptrReadPos;
15 BattleStatus* battleStatus = &gBattleStatus;
16 s32 var1 = evt_get_variable(script, *args++);
17 s32 var2 = evt_get_variable(script, *args++);
18 s32 var3 = evt_get_variable(script, *args++);
19 s32* var4;
20
21 fx_stat_change(1, var1, var2, var3, 1.0f, 60);
22 var4 = &D_802A43D0;
23 *var4 = 0;
24 if (battleStatus->hammerCharge > 0) {
25 *var4 = 1;
26 }
27
28 battleStatus->hammerCharge += 2;
29
30 if (battleStatus->hammerCharge > 99) {
31 battleStatus->hammerCharge = 99;
32 }
33
34 battleStatus->jumpCharge = 0;
35 battleStatus->flags1 |= BS_FLAGS1_HAMMER_CHARGED;
36 battleStatus->flags1 &= ~BS_FLAGS1_JUMP_CHARGED;
37
38 return ApiStatus_DONE2;
39}
40
42
43API_CALLABLE(func_802A12FC_7598AC) {
44 if (D_802A43D0 == 0) {
45 script->varTable[0] = 4;
46 } else {
47 script->varTable[0] = 5;
48 }
49
50 return ApiStatus_DONE2;
51}
52
53extern EvtScript N(EVS_UseMoveBasic_Impl);
54
55EvtScript N(EVS_UseMove1) = {
56 Call(GetMenuSelection, LVar0, LVar1, LVar2)
58 CaseEq(0)
59 Set(LVarD, 65)
60 Set(LVarE, 1)
61 Set(LVarF, 2)
62 ExecWait(N(EVS_UseMoveBasic_Impl))
63 CaseEq(1)
64 Set(LVarD, 65)
65 Set(LVarE, 2)
66 Set(LVarF, 4)
67 ExecWait(N(EVS_UseMoveBasic_Impl))
68 CaseEq(2)
69 Set(LVarD, 65)
70 Set(LVarE, 4)
71 Set(LVarF, 6)
72 ExecWait(N(EVS_UseMoveBasic_Impl))
74 Return
75 End
76};
77
78EvtScript N(EVS_UseMoveBasic_Impl) = {
79 Call(GetMenuSelection, LVar0, LVar1, LVar2)
81 CaseEq(0)
82 ExecWait(N(EVS_UseBasicHammer))
83 CaseEq(1)
84 ExecWait(N(EVS_UseSuperHammer))
85 CaseEq(2)
86 ExecWait(N(EVS_UseBasicHammer))
88 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, LVar9, 16)
89 Call(GetPlayerActionSuccess, LVar0)
91 CaseGt(FALSE)
92 Call(GetMenuSelection, LVar0, LVar1, LVar2)
94 CaseEq(0)
95 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
96 Thread
97 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.3))
99 CaseEq(1)
100 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
101 Thread
102 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.6))
104 CaseEq(2)
105 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
106 Thread
107 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.9))
111 Call(GetMenuSelection, LVar0, LVar1, LVar2)
113 CaseEq(0)
114 Call(StartRumble, BTL_RUMBLE_PLAYER_MIN)
115 Thread
116 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.3))
118 CaseEq(1)
119 Call(StartRumble, BTL_RUMBLE_PLAYER_LIGHT)
120 Thread
121 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.6))
123 CaseEq(2)
124 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
125 Thread
126 Call(ShakeCam, CAM_BATTLE, 0, 2, Float(1.9))
130 Call(UseBattleCamPreset, BTL_CAM_PLAYER_HAMMER_STRIKE)
131 Call(PlayerTestEnemy, LVar0, DAMAGE_TYPE_SMASH, 25, 0, 0, 16)
133 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
134 Return
135 EndIf
136 Set(LFlag0, FALSE)
137 Call(GetPlayerActionSuccess, LVar0)
139 CaseGt(FALSE)
140 Call(GetMenuSelection, LVar0, LVar1, LVar2)
142 CaseEq(0)
143 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
144 CaseEq(1)
145 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
146 CaseEq(2)
147 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
150 Set(LFlag0, TRUE)
152 Call(GetMenuSelection, LVar0, LVar1, LVar2)
154 CaseEq(0)
155 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_NORMAL)
156 CaseEq(1)
157 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
158 CaseEq(2)
159 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_HIT_SILENT)
162 Set(LFlag0, FALSE)
167 ExecWait(N(EVS_HammerSupport_ReturnHome_Success))
171 ExecWait(N(EVS_HammerSupport_ReturnHome_Miss))
174 Return
175 End
176};
177
178extern EvtScript N(EVS_802A39C8);
179extern EvtScript N(EVS_802A3D1C);
180extern EvtScript N(EVS_802A4070);
181
182EvtScript N(EVS_UseMove0) = {
183 Call(GetMenuSelection, LVar0, LVar1, LVar2)
185 CaseEq(0)
186 ExecWait(N(EVS_802A39C8))
187 CaseEq(1)
188 ExecWait(N(EVS_802A3D1C))
189 CaseEq(2)
190 ExecWait(N(EVS_802A4070))
192 Return
193 End
194};
195
196EvtScript N(EVS_802A39C8) = {
197 Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP)
198 Wait(10)
199 Thread
200 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
201 Wait(8)
202 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
203 Wait(8)
205 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer1_Charging)
206 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
207 Call(N(UnkMoveFunc2), LVar0, LVar1, LVar2, Float(1.2))
208 Wait(3)
209 Call(N(UnkMoveFunc2), LVar0, LVar1, LVar2, Float(0.8))
210 Wait(30)
211 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
212 Call(MoveBattleCamOver, 5)
213 Call(N(IsHammerMaxCharged))
214 IfEq(LVar0, 0)
215 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
216 Add(LVar0, 15)
217 Add(LVar1, 35)
218 Call(func_802A10C8_759678, LVar0, LVar1, LVar2)
219 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_CHARGE_UP)
220 Wait(4)
221 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_LONG_PLAYER_JUMP)
222 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
223 Call(SetActorSpeed, ACTOR_PLAYER, Float(1.0))
224 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
225 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer1_Charged, ANIM_MarioB3_Hammer1_Charged, ANIM_MarioB3_Hammer1_Charged)
226 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
227 Call(PlayerHopToGoal, 20, 0, 0)
228 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land)
229 Wait(4)
230 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
231 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
232 Call(func_802A12FC_7598AC)
233 Call(ShowVariableMessageBox, LVar0, 60, 2)
234 Else
235 Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60)
236 EndIf
237 Label(0)
238 Wait(1)
239 Call(IsMessageBoxDisplayed, LVar0)
240 IfEq(LVar0, TRUE)
241 Goto(0)
242 EndIf
243 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
244 Return
245 End
246};
247
248EvtScript N(EVS_802A3D1C) = {
249 Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP)
250 Wait(10)
251 Thread
252 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
253 Wait(8)
254 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
255 Wait(8)
257 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer2_Charging)
258 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
259 Call(N(UnkMoveFunc2), LVar0, LVar1, LVar2, Float(1.2))
260 Wait(3)
261 Call(N(UnkMoveFunc2), LVar0, LVar1, LVar2, Float(0.8))
262 Wait(30)
263 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
264 Call(MoveBattleCamOver, 5)
265 Call(N(IsHammerMaxCharged))
266 IfEq(LVar0, 0)
267 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
268 Add(LVar0, 15)
269 Add(LVar1, 35)
270 Call(func_802A10C8_759678, LVar0, LVar1, LVar2)
271 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_CHARGE_UP)
272 Wait(4)
273 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_LONG_PLAYER_JUMP)
274 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
275 Call(SetActorSpeed, ACTOR_PLAYER, Float(1.0))
276 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
277 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer2_Charged, ANIM_MarioB3_Hammer2_Charged, ANIM_MarioB3_Hammer2_Charged)
278 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
279 Call(PlayerHopToGoal, 20, 0, 0)
280 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land)
281 Wait(4)
282 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
283 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
284 Call(func_802A12FC_7598AC)
285 Call(ShowVariableMessageBox, LVar0, 60, 2)
286 Else
287 Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60)
288 EndIf
289 Label(0)
290 Wait(1)
291 Call(IsMessageBoxDisplayed, LVar0)
292 IfEq(LVar0, TRUE)
293 Goto(0)
294 EndIf
295 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
296 Return
297 End
298};
299
300EvtScript N(EVS_802A4070) = {
301 Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP)
302 Wait(10)
303 Thread
304 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
305 Wait(8)
306 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
307 Wait(8)
309 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer3_Charging)
310 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
311 Call(N(UnkMoveFunc2), LVar0, LVar1, LVar2, Float(1.2))
312 Wait(3)
313 Call(N(UnkMoveFunc2), LVar0, LVar1, LVar2, Float(0.8))
314 Wait(30)
315 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
316 Call(MoveBattleCamOver, 5)
317 Call(N(IsHammerMaxCharged))
318 IfEq(LVar0, 0)
319 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
320 Add(LVar0, 15)
321 Add(LVar1, 35)
322 Call(func_802A10C8_759678, LVar0, LVar1, LVar2)
323 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_CHARGE_UP)
324 Wait(4)
325 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_LONG_PLAYER_JUMP)
326 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
327 Call(SetActorSpeed, ACTOR_PLAYER, Float(1.0))
328 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
329 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_MarioB3_Hammer3_Charged, ANIM_MarioB3_Hammer3_Charged, ANIM_MarioB3_Hammer3_Charged)
330 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
331 Call(PlayerHopToGoal, 20, 0, 0)
332 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land)
333 Wait(4)
334 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
335 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
336 Call(func_802A12FC_7598AC)
337 Call(ShowVariableMessageBox, LVar0, 60, 2)
338 Else
339 Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60)
340 EndIf
341 Label(0)
342 Wait(1)
343 Call(IsMessageBoxDisplayed, LVar0)
344 IfEq(LVar0, TRUE)
345 Goto(0)
346 EndIf
347 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
348 Return
349 End
350};
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
@ 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
BSS s32 D_802A43D0
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 BSS
Definition macros.h:7
#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