Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
goompa.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/Goompa.h"
4
5#define NAMESPACE battle_partner_goompa
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_TakeTurn);
9extern EvtScript N(EVS_Idle);
10extern EvtScript N(EVS_HandleEvent);
11extern EvtScript N(EVS_Celebrate);
12extern EvtScript N(runAway);
13extern EvtScript N(runAwayFail);
14extern EvtScript N(EVS_ExecuteAction);
15
16enum N(ActorPartIDs) {
17 PRT_MAIN = 1,
18};
19
20enum N(ActorVars) {
21 AVAR_Unk_0 = 0,
22 AVAR_Unk_1 = 1,
23};
24
25enum N(ActorParams) {
26 DMG_UNK = 0,
27};
28
29s32 N(DefaultAnims)[] = {
30 STATUS_KEY_NORMAL, ANIM_Goompa_Walk,
32};
33
34s32 N(DefenseTable)[] = {
37};
38
39s32 N(StatusTable)[] = {
46 STATUS_KEY_FEAR, 100,
50 STATUS_KEY_STOP, 100,
62};
63
64ActorPartBlueprint N(ActorParts)[] = {
65 {
66 .index = PRT_MAIN,
67 .opacity = 255,
68 .idleAnimations = N(DefaultAnims),
69 .defenseTable = N(DefenseTable),
70 },
71};
72
73ActorBlueprint NAMESPACE = {
74 .flags = ACTOR_FLAG_NO_ATTACK,
75 .type = ACTOR_TYPE_GOOMBARIO,
76 .maxHP = 99,
77 .partCount = ARRAY_COUNT(N(ActorParts)),
78 .partsData = N(ActorParts),
79 .initScript = &N(EVS_Init),
80 .statusTable = N(StatusTable),
81 .spinSmashReq = 4,
82 .powerBounceChance = 80,
83 .size = { 29, 26 },
84 .statusIconOffset = { -10, 20 },
85 .statusTextOffset = { 10, 20 },
86};
87
88EvtScript N(EVS_Init) = {
89 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
90 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
91 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
92 Call(SetActorVar, ACTOR_SELF, AVAR_Unk_0, 0)
93 Call(SetActorVar, ACTOR_SELF, AVAR_Unk_1, 0)
94 Return
95 End
96};
97
98EvtScript N(EVS_Idle) = {
99 Return
100 End
101};
102
103EvtScript N(EVS_HandleEvent) = {
104 Call(UseIdleAnimation, ACTOR_PARTNER, FALSE)
105 Call(CloseActionCommandInfo)
106 Call(GetLastEvent, ACTOR_PARTNER, LVar0)
110 SetConst(LVar0, PRT_MAIN)
111 SetConst(LVar1, ANIM_Goompa_Injured)
117 SetConst(LVar0, PRT_MAIN)
118 SetConst(LVar1, ANIM_Goompa_Injured)
122 SetConst(LVar1, ANIM_Goompa_Injured)
123 SetConst(LVar2, ANIM_Goompa_Run)
124 SetConst(LVar3, ANIM_Goompa_Idle)
127 SetConst(LVar0, ANIM_Goompa_Injured)
128 SetConst(LVar1, ANIM_Goompa_Injured)
129 SetConst(LVar2, ANIM_Goompa_Injured)
130 SetConst(LVar3, ANIM_Goompa_Run)
131 SetConst(LVar4, ANIM_Goompa_Idle)
134 SetConst(LVar0, 0)
135 SetConst(LVar1, ANIM_Goompa_Injured)
139 SetConst(LVar0, PRT_MAIN)
140 SetConst(LVar1, ANIM_Goompa_Idle)
141 SetConst(LVar2, ANIM_Goompa_Run)
145 Call(UseIdleAnimation, ACTOR_PARTNER, TRUE)
146 Return
147 End
148};
149
150EvtScript N(EVS_TakeTurn) = {
151 Call(GetBattlePhase, LVar0)
154 ExecWait(N(EVS_ExecuteAction))
156 ExecWait(N(EVS_Celebrate))
158 ExecWait(N(runAway))
160 ExecWait(N(runAwayFail))
162 Return
163 End
164};
165
166EvtScript N(EVS_Celebrate) = {
167 SetConst(LVar0, PRT_MAIN)
168 SetConst(LVar1, ANIM_Goompa_Celebrate)
169 SetConst(LVar2, ANIM_Goompa_Walk)
171 Return
172 End
173};
174
175EvtScript N(runAway) = {
176 SetConst(LVar0, PRT_MAIN)
177 SetConst(LVar1, ANIM_Goompa_Run)
179 Return
180 End
181};
182
183EvtScript N(runAwayFail) = {
184 Call(SetGoalToHome, ACTOR_PARTNER)
185 Call(SetActorSpeed, ACTOR_PARTNER, Float(6.0))
186 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_Goompa_Run)
187 Call(SetActorYaw, ACTOR_PARTNER, 0)
188 Call(RunToGoal, ACTOR_PARTNER, 0)
189 Call(SetAnimation, ACTOR_PARTNER, -1, ANIM_Goompa_Idle)
190 Return
191 End
192};
193
194EvtScript N(EVS_ExecuteAction) = {
195 Return
196 End
197};
Bytecode EvtScript[]
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115
@ PHASE_RUN_AWAY_START
Definition enums.h:2060
@ PHASE_EXECUTE_ACTION
Definition enums.h:2058
@ PHASE_CELEBRATE
Definition enums.h:2062
@ PHASE_RUN_AWAY_FAIL
Definition enums.h:2064
@ STATUS_KEY_PARALYZE
Definition enums.h:2201
@ STATUS_TURN_MOD_DEFAULT
Definition enums.h:2227
@ STATUS_TURN_MOD_PARALYZE
Definition enums.h:2234
@ STATUS_KEY_FROZEN
Definition enums.h:2203
@ STATUS_TURN_MOD_SLEEP
Definition enums.h:2228
@ STATUS_TURN_MOD_DIZZY
Definition enums.h:2232
@ STATUS_KEY_STATIC
Definition enums.h:2207
@ STATUS_END
Definition enums.h:2196
@ STATUS_TURN_MOD_POISON
Definition enums.h:2233
@ STATUS_KEY_FEAR
Definition enums.h:2199
@ STATUS_TURN_MOD_STOP
Definition enums.h:2237
@ STATUS_KEY_SLEEP
Definition enums.h:2202
@ STATUS_KEY_STOP
Definition enums.h:2204
@ STATUS_TURN_MOD_FROZEN
Definition enums.h:2230
@ STATUS_KEY_SHRINK
Definition enums.h:2206
@ STATUS_KEY_DIZZY
Definition enums.h:2200
@ STATUS_KEY_POISON
Definition enums.h:2205
@ STATUS_TURN_MOD_STATIC
Definition enums.h:2229
@ STATUS_TURN_MOD_FEAR
Definition enums.h:2231
@ STATUS_KEY_NORMAL
Definition enums.h:2197
@ STATUS_TURN_MOD_SHRINK
Definition enums.h:2235
@ STATUS_KEY_DEFAULT
Definition enums.h:2198
@ SOUND_NO_DAMGE
Definition enums.h:1433
@ ACTOR_PARTNER
Definition enums.h:2086
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_NO_ATTACK
Skip attack turn.
Definition enums.h:3339
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_33
Definition enums.h:2169
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_SPIKE_CONTACT
Definition enums.h:2163
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_RECOVER_FROM_KO
Definition enums.h:2170
@ EVENT_BURN_CONTACT
Definition enums.h:2164
EvtScript EVS_Partner_Recover
EvtScript EVS_Partner_BurnContact
EvtScript EVS_Enemy_Hit
EvtScript EVS_Partner_Celebrate
EvtScript EVS_Partner_SpikeContact
EvtScript EVS_Partner_RunAway
EvtScript EVS_Enemy_NoDamageHit
ApiStatus PlaySound(Evt *script, b32 isInitialCall)
#define Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#define Ref(sym)
Address/pointer constant.
Definition macros.h:60
#define CaseEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR. It also marks the end of any pre...
Definition macros.h:319
#define End
Signals the end of EVT script data. A script missing this will likely crash on load.
Definition macros.h:213
#define EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define Float(DOUBLE)
Definition macros.h:51
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:341
#define CaseDefault
Marks the start of a switch case that executes unconditionally. It also marks the end of any previous...
Definition macros.h:337
#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 EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#define Call(FUNC, ARGS...)
Calls a given C EVT API function with any number of arguments.
Definition macros.h:576
#define LVar4
Definition macros.h:152
#define LVar3
Definition macros.h:151
#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