Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
unknown_item.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_unknown_item
7
9
10API_CALLABLE(N(SpawnHeartRecoveryFX)) {
11 Bytecode* args = script->ptrReadPos;
12 s32 a = evt_get_variable(script, *args++);
13 s32 b = evt_get_variable(script, *args++);
14 s32 c = evt_get_variable(script, *args++);
15 s32 d = evt_get_variable(script, *args++);
16
17 fx_recover(0, a, b, c, d);
18 return ApiStatus_DONE2;
19}
20
21API_CALLABLE(N(HealPlayer20)) {
22 PlayerData* playerData = &gPlayerData;
23
24 playerData->curHP += 20;
25 if (playerData->curHP > playerData->curMaxHP) {
26 playerData->curHP = playerData->curMaxHP;
27 }
28 return ApiStatus_DONE2;
29}
30
32
33EvtScript N(EVS_UseItem) = {
34 SetConst(LVarA, ITEM_ULTRA_SHROOM)
35 ExecWait(N(UseItemWithEffect))
36 ExecWait(N(EatItem))
37 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
38 Add(LVar0, 0)
39 Add(LVar1, 35)
40 Call(N(SpawnHeartRecoveryFX), LVar0, LVar1, LVar2, 20)
41 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
42 Add(LVar1, 25)
43 Add(LVar2, 5)
45 Call(N(HealPlayer20))
46 Wait(10)
47 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_ThumbsUp)
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