Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
super_soda.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_super_soda
8
10
12
13API_CALLABLE(N(func_802A123C_724F1C)) {
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_724FCC)) {
28 BattleStatus* battleStatus = &gBattleStatus;
29 Actor* partner = battleStatus->partnerActor;
30 Bytecode* args = script->ptrReadPos;
31
32 if (partner->koDuration == 0) {
33 return ApiStatus_DONE2;
34 }
35
36 partner->koDuration -= evt_get_variable(script, *args++);
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;
46 }
47
48 return ApiStatus_DONE2;
49}
50
51API_CALLABLE(N(func_802A1378_725058)) {
52 s32 actorId = evt_get_variable(script, *script->ptrReadPos);
53 Actor* actor = get_actor(actorId);
54 s32 actorClass = actor->actorID & ACTOR_CLASS_MASK;
55
56 if (actor->debuff != 0) {
57 actor->debuffDuration = 0;
58 actor->debuff = 0;
60 }
61
62 if (actor->koStatus != 0) {
63 actor->koDuration = 0;
64 actor->koStatus = 0;
65
66 switch (actorClass) {
68 break;
71 break;
72 }
73
75 }
76
78
79 return ApiStatus_DONE2;
80}
81
82API_CALLABLE(N(SpawnFlowerRecoveryFX)) {
83 Bytecode* args = script->ptrReadPos;
84 s32 a = evt_get_variable(script, *args++);
85 s32 b = evt_get_variable(script, *args++);
86 s32 c = evt_get_variable(script, *args++);
87 s32 d = evt_get_variable(script, *args++);
88
89 fx_recover(1, a, b, c, d);
90 return ApiStatus_DONE2;
91}
92
93#include "common/AddFP.inc.c"
94
96
97EvtScript N(EVS_UseOnPartner) = {
98 Call(SetActorYaw, ACTOR_PLAYER, 30)
99 Wait(1)
100 Call(SetActorYaw, ACTOR_PLAYER, 60)
101 Wait(1)
102 Call(SetActorYaw, ACTOR_PLAYER, 90)
103 Wait(1)
104 Call(SetActorYaw, ACTOR_PLAYER, 120)
105 Wait(1)
106 Call(SetActorYaw, ACTOR_PLAYER, 150)
107 Wait(1)
108 Call(SetActorYaw, ACTOR_PLAYER, 180)
109 Wait(10)
110 Set(LVar1, LVarF)
111 ExecWait(N(UseItem))
112 Set(LVarE, LVarA)
113 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Throw)
114 Thread
115 Wait(20)
116 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
119 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
120 Add(LVar0, 0)
121 Add(LVar1, 30)
122 Add(LVar2, 5)
125 Thread
126 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
127 Add(LVar1, 45)
129 Set(LVarE, LVar0)
130 Loop(25)
132 Call(N(func_802A123C_724F1C), LVar0, LVar1, LVar2)
133 Wait(1)
134 EndLoop
137 Call(InitTargetIterator)
138 Call(SetGoalToTarget, ACTOR_SELF)
139 Call(GetGoalPos, ACTOR_SELF, LVar0, LVar1, LVar2)
140 Call(SetBattleCamTarget, -125, 1, 0)
141 Call(SetBattleCamOffsetY, 41)
142 Call(SetBattleCamDist, 248)
143 Call(MoveBattleCamOver, 25)
145 Add(LVar2, 5)
147 Call(AddBattleCamDist, 100)
148 Call(MoveBattleCamOver, 30)
149 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
150 Add(LVar1, 25)
152 IfGt(LVarB, 0)
153 Call(N(func_802A12EC_724FCC), LVarB)
154 EndIf
155 Wait(30)
156 Call(GetActorPos, ACTOR_PARTNER, LVar0, LVar1, LVar2)
158 Wait(20)
159 Call(SetActorYaw, ACTOR_PLAYER, 150)
160 Wait(1)
161 Call(SetActorYaw, ACTOR_PLAYER, 120)
162 Wait(1)
163 Call(SetActorYaw, ACTOR_PLAYER, 90)
164 Wait(1)
165 Call(SetActorYaw, ACTOR_PLAYER, 60)
166 Wait(1)
167 Call(SetActorYaw, ACTOR_PLAYER, 30)
168 Wait(1)
169 Call(SetActorYaw, ACTOR_PLAYER, 0)
170 Wait(10)
171 Return
172 End
173};
174
175EvtScript N(EVS_UseItem) = {
176 SetConst(LVarA, ITEM_SUPER_SODA)
177 ExecWait(N(UseItemWithEffect))
178 Call(InitTargetIterator)
179 Call(GetOwnerTarget, LVar0, LVar1)
181 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_EAT_OR_DRINK)
182 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Drink)
183 Wait(45)
184 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
185 Add(LVar0, 0)
186 Add(LVar1, 35)
187 Call(N(SpawnFlowerRecoveryFX), LVar0, LVar1, LVar2, 5)
188 Call(N(AddFP), 5)
189 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
190 Add(LVar1, 25)
192 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
193 Add(LVar1, 20)
194 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_ThumbsUp)
195 Wait(30)
196 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
197 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
199 Call(InitTargetIterator)
200 Call(GetOwnerTarget, LVar0, LVar1)
201 Call(N(func_802A1378_725058), 0)
202 Wait(20)
203 Else
204 Set(LVarB, 0)
205 Set(LVarC, 0)
206 Set(LVarF, 0)
207 ExecWait(N(EVS_UseOnPartner))
208 EndIf
209 ExecWait(N(PlayerGoHome))
210 Return
211 End
212};
struct EffectInstance * disableEffect
s16 hudElementDataIndex
Bytecode EvtScript[]
s8 debuffDuration
struct DisableXFXData * disableX
Definition effects.h:2529
EffectData data
Definition effects.h:2605
s32 EntityModelScript[]
Definition entity.h:7
@ ACTOR_CLASS_PLAYER
Definition enums.h:2077
@ ACTOR_CLASS_PARTNER
Definition enums.h:2078
@ ACTOR_CLASS_MASK
Definition enums.h:2080
@ ITEM_SPAWN_MODE_DECORATION
Definition enums.h:2292
@ SOUND_EAT_OR_DRINK
Definition enums.h:1441
@ 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
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
#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
void remove_status_debuff(s32)
ItemEntity * get_item_entity(s32 itemEntityIndex)
void btl_update_ko_status(void)
Definition 190B20.c:2869
Actor * get_actor(s32 actorID)
Definition actor_api.c:155
void dispatch_event_partner(s32)
Definition dmg_partner.c:7
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 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 SetConst(VAR, CONST)
Sets the given variable to a given value, skipping the evt_get_variable call.
Definition macros.h:370
#define Return
Kills the current EVT thread.
Definition macros.h:217
struct Actor * partnerActor
EntityModelScript EMS_StarIcon
BattleStatus gBattleStatus
Definition battle.c:11