Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
dried_shroom.c
Go to the documentation of this file.
1#include "common.h"
2#include "script_api/battle.h"
3#include "effects.h"
4#include "sprite/player.h"
5
6#define NAMESPACE battle_item_dried_shroom
7
9
10API_CALLABLE(N(SpawnHeartRecoveryFX)) {
11 Bytecode* args = script->ptrReadPos;
12 s32 x = evt_get_variable(script, *args++);
13 s32 y = evt_get_variable(script, *args++);
14 s32 z = evt_get_variable(script, *args++);
15 s32 duration = evt_get_variable(script, *args++);
16
17 fx_recover(0, x, y, z, duration);
18
19 return ApiStatus_DONE2;
20}
21
22API_CALLABLE(N(func_802A12FC_71CFDC)) {
23 PlayerData* playerData = &gPlayerData;
24
25 playerData->curHP++;
26 if (playerData->curHP > playerData->curMaxHP) {
27 playerData->curHP = playerData->curMaxHP;
28 }
29 return ApiStatus_DONE2;
30}
31
33
34EvtScript N(EVS_UseItem) = {
35 SetConst(LVarA, ITEM_DRIED_SHROOM)
36 ExecWait(N(UseItemWithEffect))
37 ExecWait(N(EatItem))
38 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_StickOutTongue)
39 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
40 Add(LVar0, 0)
41 Add(LVar1, 35)
42 Call(N(SpawnHeartRecoveryFX), LVar0, LVar1, LVar2, 1)
43 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
44 Add(LVar1, 25)
45 Add(LVar2, 5)
47 Call(N(func_802A12FC_71CFDC))
48 Wait(30)
49 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
50 Add(LVar2, 5)
52 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
53 Wait(20)
54 ExecWait(N(PlayerGoHome))
55 Return
56 End
57};
Bytecode EvtScript[]
@ 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
ApiStatus ShowRecoveryShimmer(Evt *script, b32 isInitialCall)
ApiStatus ShowStartRecoveryShimmer(Evt *script, b32 isInitialCall)
#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 ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#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 Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#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
PlayerData gPlayerData
Definition 77480.c:40