Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
jump_charge_2.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
4#include "effects.h"
5#include "sprite/player.h"
6
7#define NAMESPACE battle_move_jump_charge_2
8
10
12
14
15API_CALLABLE(N(func_802A1108_74D678)) {
16 Bytecode* args = script->ptrReadPos;
17 BattleStatus* battleStatus = &gBattleStatus;
18 s32 var1 = evt_get_variable(script, *args++);
19 s32 var2 = evt_get_variable(script, *args++);
20 s32 var3 = evt_get_variable(script, *args++);
21 s32* var4;
22
23 fx_stat_change(2, var1, var2, var3, 1.0f, 60);
24 var4 = &D_802A2C20;
25 *var4 = 0;
26 if (battleStatus->jumpCharge > 0) {
27 *var4 = 1;
28 }
29
30 battleStatus->jumpCharge += 3;
31
32 if (battleStatus->jumpCharge > 99) {
33 battleStatus->jumpCharge = 99;
34 }
35
36 battleStatus->hammerCharge = 0;
37 battleStatus->flags1 |= BS_FLAGS1_JUMP_CHARGED;
38 battleStatus->flags1 &= ~BS_FLAGS1_HAMMER_CHARGED;
39
40 return ApiStatus_DONE2;
41}
42
44
45API_CALLABLE(N(func_802A133C_761C5C)) {
46 if (D_802A2C20 == 0) {
47 script->varTable[0] = 6;
48 } else {
49 script->varTable[0] = 7;
50 }
51
52 return ApiStatus_DONE2;
53}
54
55EvtScript N(EVS_UseMove1) = {
56 Return
57 End
58};
59
60EvtScript N(EVS_UseMove0) = {
61 Call(UseBattleCamPreset, BTL_CAM_PLAYER_CHARGE_UP)
62 Wait(10)
64 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
65 Wait(8)
66 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_PLAYER_CHARGE)
67 Wait(8)
69 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_FightingStance)
70 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
71 Call(N(UnkMoveFunc3), LVar0, LVar1, LVar2, Float(1.2))
72 Wait(3)
73 Call(N(UnkMoveFunc3), LVar0, LVar1, LVar2, Float(0.8))
74 Wait(30)
75 Call(UseBattleCamPreset, BTL_CAM_DEFAULT)
76 Call(MoveBattleCamOver, 5)
77 Call(N(IsJumpMaxCharged))
78 IfEq(LVar0, 0)
79 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
80 Add(LVar0, 10)
81 Add(LVar1, 25)
82 Add(LVar2, 5)
83 Call(N(func_802A1108_74D678), LVar0, LVar1, LVar2)
84 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_CHARGE_UP)
85 Wait(4)
86 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_LONG_PLAYER_JUMP)
87 Call(SetActorJumpGravity, ACTOR_PLAYER, Float(1.0))
88 Call(SetActorSpeed, ACTOR_PLAYER, Float(1.0))
89 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
90 Call(SetJumpAnimations, ACTOR_PLAYER, 0, ANIM_Mario1_Jump, ANIM_Mario1_Fall, ANIM_Mario1_Land)
91 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
92 Call(PlayerHopToGoal, 20, 0, 0)
93 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Land)
94 Wait(4)
95 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
96 Call(N(func_802A133C_761C5C))
97 Call(ShowVariableMessageBox, LVar0, 60, 3)
98 Else
99 Call(ShowMessageBox, BTL_MSG_CANT_CHARGE, 60)
100 EndIf
101 Label(0)
102 Wait(1)
103 Call(IsMessageBoxDisplayed, LVar0)
104 IfEq(LVar0, TRUE)
105 Goto(0)
106 EndIf
107 Call(SetGoalToHome, ACTOR_PLAYER)
108 Call(SetActorSpeed, ACTOR_PLAYER, Float(8.0))
109 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Run)
110 Call(PlayerRunToGoal, 0)
111 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
112 Return
113 End
114};
115
Bytecode EvtScript[]
@ BS_FLAGS1_JUMP_CHARGED
Definition enums.h:3598
@ BTL_MSG_CANT_CHARGE
Definition enums.h:4066
@ BTL_CAM_DEFAULT
Definition enums.h:4824
@ BTL_CAM_PLAYER_CHARGE_UP
Definition enums.h:4854
@ SOUND_PLAYER_CHARGE
Definition enums.h:774
@ SOUND_CHARGE_UP
Definition enums.h:1436
@ SOUND_LONG_PLAYER_JUMP
Definition enums.h:782
@ ACTOR_PLAYER
Definition enums.h:2085
#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_802A2C20
#define Else
Marks the end of an if statement and the start of the else block.
Definition macros.h:295
#define EndChildThread
Marks the end of a child thread block.
Definition macros.h:563
#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 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 EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#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 ChildThread
Marks the start of a child thread block.
Definition macros.h:560
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217
BattleStatus gBattleStatus
Definition battle.c:11