Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
mushroom.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "effects.h"
4#include "entity.h"
5#include "sprite/player.h"
6
7#define NAMESPACE battle_item_mushroom
8
10
12
13API_CALLABLE(N(func_802A123C_715A8C)) {
14 Bytecode* args = script->ptrReadPos;
15 s32 a = evt_get_variable(script, *args++);
16 s32 b = evt_get_variable(script, *args++);
17 s32 c = evt_get_variable(script, *args++);
18 ItemEntity* item = get_item_entity(script->varTable[14]);
19
20 item->pos.x = a;
21 item->pos.y = b;
22 item->pos.z = c;
23
24 return ApiStatus_DONE2;
25}
26
27API_CALLABLE(N(func_802A12EC_715B3C)) {
29 Actor* partner = battleStatus->partnerActor;
30 Bytecode* args = script->ptrReadPos;
31
32 if (partner->koDuration == 0) {
33 return ApiStatus_DONE2;
34 }
35
37 if (partner->koDuration < 0) {
38 partner->koDuration = 0;
39 }
40 if (partner->koDuration > 0) {
41 partner->disableEffect->data.disableX->koDuration = partner->koDuration;
42 } else {
43 partner->koStatus = 0;
45 partner->disableEffect->data.disableX->koDuration = 0;
46 }
47
48 return ApiStatus_DONE2;
49}
50
51API_CALLABLE(N(SpawnHeartRecoveryFX)) {
52 Bytecode* args = script->ptrReadPos;
53 s32 a = evt_get_variable(script, *args++);
54 s32 b = evt_get_variable(script, *args++);
55 s32 c = evt_get_variable(script, *args++);
56 s32 d = evt_get_variable(script, *args++);
57
58 fx_recover(0, a, b, c, d);
59
60 return ApiStatus_DONE2;
61}
62
63API_CALLABLE(N(SpawnFlowerRecoveryFX)) {
64 Bytecode* args = script->ptrReadPos;
65 s32 a = evt_get_variable(script, *args++);
66 s32 b = evt_get_variable(script, *args++);
67 s32 c = evt_get_variable(script, *args++);
68 s32 d = evt_get_variable(script, *args++);
69
70 fx_recover(1, a, b, c, d);
71
72 return ApiStatus_DONE2;
73}
74
75#include "common/AddHP.inc.c"
76
77#include "common/AddFP.inc.c"
78
79API_CALLABLE(N(func_802A15A0_715DF0)) {
80 Bytecode* args = script->ptrReadPos;
82 ItemData* item = &itemTable[evt_get_variable(script, *args++)];
83
84 script->varTable[11] = item->potencyA;
85 script->varTable[12] = item->potencyB;
86 script->varTable[15] = item->potencyA == 1;
87
88 return ApiStatus_DONE2;
89}
90
92
95 Wait(1)
97 Wait(1)
99 Wait(1)
101 Wait(1)
103 Wait(1)
105 Wait(10)
106 Set(LVar1, LVarF)
107 ExecWait(N(UseItem))
108 Set(LVarE, LVarA)
110 Thread
111 Wait(20)
116 Add(LVar0, 0)
117 Add(LVar1, 30)
118 Add(LVar2, 5)
121 Thread
123 Add(LVar1, 45)
125 Set(LVarE, LVar0)
126 Loop(25)
129 Wait(1)
130 EndLoop
136 Call(SetBattleCamTarget, -125, 1, 0)
141 Add(LVar2, 5)
146 Add(LVar1, 25)
148 IfGt(LVarB, 0)
150 EndIf
151 Wait(30)
154 Wait(20)
156 Wait(1)
158 Wait(1)
160 Wait(1)
162 Wait(1)
164 Wait(1)
166 Wait(10)
167 Return
168 End
169};
170
172 Set(LVarE, LVar1)
174 Set(LVarA, LVar1)
180 Return
181 EndIf
182 Set(LVar1, LVarE)
184 ExecWait(N(EatItem))
185 IfEq(LVarF, 1)
187 EndIf
188 IfGt(LVarB, 0)
190 Add(LVar0, 0)
191 Add(LVar1, 35)
193 EndIf
194 IfGt(LVarC, 0)
196 Add(LVar0, 20)
197 Add(LVar1, 25)
199 EndIf
201 Add(LVar1, 25)
203 IfNe(LVarB, 0)
204 Call(N(AddHP), LVarB)
205 EndIf
206 IfNe(LVarC, 0)
207 Call(N(AddFP), LVarC)
208 EndIf
209 IfEq(LVarF, 0)
210 Wait(10)
212 Wait(30)
213 Else
214 Wait(30)
215 EndIf
219 Wait(20)
221 Return
222 End
223};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
s32 EntityModelScript[]
Definition entity.h:7
@ ITEM_SPAWN_MODE_DECORATION
Definition enums.h:2292
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_PARTNER
Definition enums.h:2086
@ ACTOR_SELF
Definition enums.h:2084
@ EVENT_RECOVER_FROM_KO
Definition enums.h:2170
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1689
ItemEntity * get_item_entity(s32 itemEntityIndex)
void dispatch_event_partner(s32)
Definition dmg_partner.c:7
EntityModelScript EMS_StarIcon
ApiStatus RemoveItemEntity(Evt *script, b32 isInitialCall)
ApiStatus ShowRecoveryShimmer(Evt *script, b32 isInitialCall)
ApiStatus CreateVirtualEntity(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityFlags(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityPosition(Evt *script, b32 isInitialCall)
ApiStatus MakeItemEntity(Evt *script, b32 isInitialCall)
ApiStatus GetVirtualEntityPosition(Evt *script, b32 isInitialCall)
ApiStatus ShowStartRecoveryShimmer(Evt *script, b32 isInitialCall)
ApiStatus SetVirtualEntityJumpGravity(Evt *script, b32 isInitialCall)
ApiStatus VirtualEntityJumpTo(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 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 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 LVarC
Definition macros.h:160
#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 EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVarB
Definition macros.h:159
#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 LVarA
Definition macros.h:158
#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 Loop(TIMES)
Marks the beginning of a loop.
Definition macros.h:245
#define LVarE
Definition macros.h:162
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217
ItemData gItemTable[]
BattleStatus gBattleStatus
Definition battle.c:11