Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
UseItem.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "sprite/player.h"
3
5EvtScript N(UseItemWithEffect) = {
6 IfEq(LVar1, 0)
7 Call(UseBattleCamPreset, BTL_CAM_PLAYER_WISH)
8 Wait(10)
9 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_USE_ITEM)
10 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_UsePower)
11 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
12 Add(LVar0, 18)
13 Call(SetActorSpeed, ACTOR_PLAYER, Float(4.0))
14 Call(SetGoalPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
15 Call(PlayerRunToGoal, 0)
16 Add(LVar1, 45)
18 Add(LVar3, 10)
19 Add(LVar3, 2)
20 PlayEffect(EFFECT_RADIAL_SHIMMER, 1, LVar0, LVar3, LVar2, Float(1.0), 30, 0)
23 Call(N(GiveRefund))
24 Wait(LVar0)
25 Wait(15)
26 Call(N(GiveRefundCleanup))
28 Else
29 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
30 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_USE_ITEM)
31 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_UsePower)
32 Wait(4)
33 Add(LVar1, 45)
35 Add(LVar3, 10)
36 Add(LVar3, 2)
37 PlayEffect(EFFECT_RADIAL_SHIMMER, 1, LVar0, LVar3, LVar2, Float(1.0), 30, 0)
40 Wait(15)
42 EndIf
43 Return
44 End
45};
46
47EvtScript N(UseItem) = {
48 Call(UseBattleCamPreset, BTL_CAM_REPOSITION)
49 Call(SetBattleCamTarget, -85, 1, 0)
50 Call(SetBattleCamOffsetY, 41)
51 Call(SetBattleCamDist, 248)
52 Call(MoveBattleCamOver, 30)
53 Wait(10)
54 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_UsePower)
55 Call(GetActorPos, ACTOR_PLAYER, LVar0, LVar1, LVar2)
56 Add(LVar1, 45)
59 Call(N(GiveRefund))
60 Wait(LVar0)
61 Wait(15)
62 Call(N(GiveRefundCleanup))
64 Return
65 End
66};
67
68EvtScript N(PlayerGoHome) = {
69 Call(UseIdleAnimation, ACTOR_PLAYER, FALSE)
70 Call(SetGoalToHome, ACTOR_PLAYER)
71 Call(SetActorSpeed, ACTOR_PLAYER, Float(8.0))
72 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Run)
73 Call(PlayerRunToGoal, 0)
74 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Idle)
75 Call(UseIdleAnimation, ACTOR_PLAYER, TRUE)
76 Return
77 End
78};
79
80EvtScript N(EatItem) = {
81 Thread
82 Loop(4)
83 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_EAT_OR_DRINK)
84 Wait(10)
87 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Eat)
88 Wait(45)
89 Return
90 End
91};
92
93EvtScript N(DrinkItem) = {
94 Thread
95 Loop(4)
96 Call(PlaySoundAtActor, ACTOR_PLAYER, SOUND_EAT_OR_DRINK)
97 Wait(10)
100 Call(SetAnimation, ACTOR_PLAYER, 0, ANIM_Mario1_Drink)
101 Wait(45)
102 Return
103 End
104};
Bytecode EvtScript[]
@ ITEM_SPAWN_MODE_DECORATION
Definition enums.h:2292
@ BTL_CAM_REPOSITION
Definition enums.h:4841
@ BTL_CAM_PLAYER_WISH
Definition enums.h:4891
@ SOUND_EAT_OR_DRINK
Definition enums.h:1441
@ SOUND_USE_ITEM
Definition enums.h:1434
@ ACTOR_PLAYER
Definition enums.h:2085
ApiStatus RemoveItemEntity(Evt *script, b32 isInitialCall)
ApiStatus MakeItemEntity(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 Set(VAR, INT_VALUE)
Sets the given variable to a given value casted to an integer.
Definition macros.h:365
#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 Float(DOUBLE)
Definition macros.h:51
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#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 PlayEffect(args...)
Definition macros.h:807
#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 LVar3
Definition macros.h:151
#define LVarE
Definition macros.h:162
#define LVar0
Definition macros.h:148
#define Return
Kills the current EVT thread.
Definition macros.h:217