Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
stone_chomp.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/StoneChomp.h"
4
5#define NAMESPACE A(stone_chomp)
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_Idle);
9extern EvtScript N(EVS_TakeTurn);
13
14enum N(ActorPartIDs) {
15 PRT_MAIN = 1,
16 PRT_TARGET = 2,
17 PRT_CHAIN_1 = 3,
18 PRT_CHAIN_2 = 4,
19 PRT_CHAIN_3 = 5,
20 PRT_CHAIN_4 = 6,
21 PRT_CHAIN_5 = 7,
22 PRT_CHAIN_6 = 8,
23 PRT_CHAIN_7 = 9,
24 PRT_CHAIN_8 = 10,
25};
26
27enum N(ActorVars) {
29};
30
31enum N(ActorParams) {
33};
34
35s32 N(BasicAnims)[] = {
44};
45
46s32 N(QuickBiteAnims)[] = {
55};
56
57s32 N(BiteAnims)[] = {
66};
67
68s32 N(SlowBiteAnims)[] = {
77};
78
79s32 N(ChainAnims)[] = {
82};
83
84s32 N(DefenseTable)[] = {
87};
88
89s32 N(StatusTable)[] = {
100 STATUS_KEY_STOP, 75,
112};
113
115 {
117 .index = PRT_MAIN,
118 .posOffset = { 0, 0, 0 },
119 .targetOffset = { 0, 24 },
120 .opacity = 255,
121 .idleAnimations = N(BasicAnims),
122 .defenseTable = N(DefenseTable),
123 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
124 .elementImmunityFlags = 0,
125 .projectileTargetOffset = { 0, 0 },
126 },
127 {
129 .index = PRT_TARGET,
130 .posOffset = { 0, 0, 0 },
131 .targetOffset = { -13, 40 },
132 .opacity = 255,
133 .idleAnimations = N(BasicAnims),
134 .defenseTable = N(DefenseTable),
135 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
136 .elementImmunityFlags = 0,
137 .projectileTargetOffset = { 0, -14 },
138 },
139 {
141 .index = PRT_CHAIN_1,
142 .posOffset = { 0, 0, 0 },
143 .targetOffset = { 0, 12 },
144 .opacity = 255,
145 .idleAnimations = N(ChainAnims),
146 .defenseTable = N(DefenseTable),
147 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
148 .elementImmunityFlags = 0,
149 .projectileTargetOffset = { 0, 0 },
150 },
151 {
153 .index = PRT_CHAIN_2,
154 .posOffset = { 0, 0, 0 },
155 .targetOffset = { 0, 12 },
156 .opacity = 255,
157 .idleAnimations = N(ChainAnims),
158 .defenseTable = N(DefenseTable),
159 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
160 .elementImmunityFlags = 0,
161 .projectileTargetOffset = { 0, 0 },
162 },
163 {
165 .index = PRT_CHAIN_3,
166 .posOffset = { 0, 0, 0 },
167 .targetOffset = { 0, 12 },
168 .opacity = 255,
169 .idleAnimations = N(ChainAnims),
170 .defenseTable = N(DefenseTable),
171 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
172 .elementImmunityFlags = 0,
173 .projectileTargetOffset = { 0, 0 },
174 },
175 {
177 .index = PRT_CHAIN_4,
178 .posOffset = { 0, 0, 0 },
179 .targetOffset = { 0, 12 },
180 .opacity = 255,
181 .idleAnimations = N(ChainAnims),
182 .defenseTable = N(DefenseTable),
183 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
184 .elementImmunityFlags = 0,
185 .projectileTargetOffset = { 0, 0 },
186 },
187 {
189 .index = PRT_CHAIN_5,
190 .posOffset = { 0, 0, 0 },
191 .targetOffset = { 0, 12 },
192 .opacity = 255,
193 .idleAnimations = N(ChainAnims),
194 .defenseTable = N(DefenseTable),
195 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
196 .elementImmunityFlags = 0,
197 .projectileTargetOffset = { 0, 0 },
198 },
199 {
201 .index = PRT_CHAIN_6,
202 .posOffset = { 0, 0, 0 },
203 .targetOffset = { 0, 12 },
204 .opacity = 255,
205 .idleAnimations = N(ChainAnims),
206 .defenseTable = N(DefenseTable),
207 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
208 .elementImmunityFlags = 0,
209 .projectileTargetOffset = { 0, 0 },
210 },
211 {
213 .index = PRT_CHAIN_7,
214 .posOffset = { 0, 0, 0 },
215 .targetOffset = { 0, 12 },
216 .opacity = 255,
217 .idleAnimations = N(ChainAnims),
218 .defenseTable = N(DefenseTable),
219 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
220 .elementImmunityFlags = 0,
221 .projectileTargetOffset = { 0, 0 },
222 },
223 {
225 .index = PRT_CHAIN_8,
226 .posOffset = { 0, 0, 0 },
227 .targetOffset = { 0, 12 },
228 .opacity = 255,
229 .idleAnimations = N(ChainAnims),
230 .defenseTable = N(DefenseTable),
231 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
232 .elementImmunityFlags = 0,
233 .projectileTargetOffset = { 0, 0 },
234 },
235};
236
237ActorBlueprint NAMESPACE = {
238 .flags = 0,
241 .maxHP = 4,
242 .partCount = ARRAY_COUNT(N(ActorParts)),
243 .partsData = N(ActorParts),
244 .initScript = &N(EVS_Init),
245 .statusTable = N(StatusTable),
246 .escapeChance = 0,
247 .airLiftChance = 25,
248 .hurricaneChance = 25,
249 .spookChance = 0,
250 .upAndAwayChance = 95,
251 .spinSmashReq = 0,
252 .powerBounceChance = 85,
253 .coinReward = 5,
254 .size = { 56, 40 },
255 .healthBarOffset = { 0, 0 },
256 .statusIconOffset = { -10, 20 },
257 .statusTextOffset = { 10, 20 },
258};
259
260#define CHOMP_CHAIN_FIRST_PART_IDX PRT_CHAIN_1
261#define CHOMP_CHAIN_LAST_PART_IDX PRT_CHAIN_8
262#define CHOMP_CHAIN_AVAR_SOUNDS AVAR_EnableChainSounds
264
265// Custom version of EVS_Enemy_HopHome
266// (in) LVar0: part idx
267// (in) LVar1: hopping animID
275 Return
276 End
277};
278
279// Custom version of EVS_Enemy_HopToPos
280// (in) LVar0: target posX
281// (in) LVar1: target posY
282// (in) LVar2: target posZ
285 Label(0)
288 Goto(10)
289 EndIf
291 Set(LVar4, LVar0)
292 Sub(LVar4, LVar3)
293 IfLt(LVar4, 30)
297 Else
298 Set(LVar4, LVar3)
299 Add(LVar3, 30)
303 EndIf
304 Else
305 Set(LVar4, LVar3)
306 Sub(LVar4, LVar0)
307 IfLt(LVar4, 30)
311 Else
312 Sub(LVar3, 30)
316 EndIf
317 EndIf
318 Goto(0)
319 Label(10)
320 Return
321 End
322};
323
324EvtScript N(EVS_Init) = {
334 Add(LVar0, 1)
335 EndLoop
338 Return
339 End
340};
341
349 Else
355 EndIf
356 Return
357 End
358};
359
360EvtScript N(EVS_Idle) = {
361 Label(0)
362 Loop(0)
367 EndIf
368 Wait(1)
369 EndLoop
374 Add(LVar0, 10)
378 Loop(0)
383 EndIf
384 Wait(1)
385 EndLoop
391 Call(RandInt, 10, LVar0)
392 Add(LVar0, 1)
393 Wait(LVar0)
394 Loop(0)
399 EndIf
400 Wait(1)
401 EndLoop
408 Loop(0)
413 EndIf
414 Wait(1)
415 EndLoop
420 Sub(LVar0, 20)
423 Loop(0)
428 EndIf
429 Wait(1)
430 EndLoop
434 Sub(LVar0, 10)
437 Loop(0)
442 EndIf
443 Wait(1)
444 EndLoop
451 Call(RandInt, 10, LVar0)
452 Add(LVar0, 10)
453 Wait(LVar0)
454 Goto(0)
455 Return
456 End
457};
458
460 Label(0)
461 Wait(1)
463 Goto(0)
464 Return
465 End
466};
467
471 Call(SetActorScale, ACTOR_SELF, Float(1.0), Float(1.0), Float(1.0))
509 Return
516 Return
526 Set(LVar1, 0)
529 Call(AddGoalPos, ACTOR_SELF, 30, 0, 0)
532 Call(AddGoalPos, ACTOR_SELF, 15, 0, 0)
535 Call(AddGoalPos, ACTOR_SELF, 5, 0, 0)
546 Thread
547 Call(ShakeCam, CAM_BATTLE, 0, 1, Float(0.5))
567 Return
572 Wait(10)
576 Return
584 Return
594 Return
601 Sub(LVar1, 10)
602 Add(LVar2, 4)
603 Else
604 Sub(LVar1, 5)
605 Add(LVar2, 11)
606 EndIf
608 EndIf
614 Return
619 Return
626 Wait(1000)
632 IfNe(LVar1, 0)
636 EndIf
637 EndIf
640 Return
641 End
642};
643
654 Set(LVar1, 0)
655 Add(LVar0, 45)
660 Wait(15)
666 Set(LVarA, LVar0)
670 Sub(LVar0, 20)
671 Set(LVar1, 0)
678 EndIf
681 Sub(LVar0, 25)
685 Sub(LVar0, 15)
690 Wait(20)
706 Return
714 Add(LVar0, 4)
715 Else
716 Add(LVar0, 10)
717 EndIf
718 Set(LVar1, 27)
724 Wait(2)
732 Add(LVar0, 40)
733 Set(LVar1, 0)
738 Add(LVar0, 30)
742 Add(LVar0, 20)
746 Sub(LVar0, 10)
750 Wait(8)
767 Return
768 End
769};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4899
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ ACTOR_DECORATION_SWEAT
Definition enums.h:2045
@ 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_STONE
Definition enums.h:2208
@ 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
@ HIT_RESULT_NO_DAMAGE
Definition enums.h:1952
@ HIT_RESULT_HIT
Definition enums.h:1950
@ HIT_RESULT_LUCKY
Definition enums.h:1955
@ HIT_RESULT_MISS
Definition enums.h:1956
@ BTL_CAM_DEFAULT
Definition enums.h:4823
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4884
@ IDLE_SCRIPT_RESTART
Definition enums.h:6408
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_PARALYZE
Definition enums.h:2816
@ STATUS_FLAG_STONE
Definition enums.h:2820
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ SOUND_ACTOR_HURT
Definition enums.h:748
@ STONE_STONE_CHOMP_STEP
Definition enums.h:1310
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4904
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_UP_AND_AWAY
Definition enums.h:2176
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_IMMUNE
Definition enums.h:2146
@ EVENT_BURN_DEATH
Definition enums.h:2157
@ EVENT_ZERO_DAMAGE
Definition enums.h:2144
@ EVENT_SHOCK_DEATH
Definition enums.h:2159
@ EVENT_SPIN_SMASH_HIT
Definition enums.h:2133
@ EVENT_SPIN_SMASH_DEATH
Definition enums.h:2154
@ EVENT_HIT_COMBO
Definition enums.h:2131
@ EVENT_AIR_LIFT_FAILED
Definition enums.h:2152
@ EVENT_BEGIN_AIR_LIFT
Definition enums.h:2175
@ EVENT_DEATH
Definition enums.h:2153
@ EVENT_SHOCK_HIT
Definition enums.h:2165
@ EVENT_RECOVER_STATUS
Definition enums.h:2167
@ EVENT_BLOW_AWAY
Definition enums.h:2143
@ ACTOR_PART_FLAG_TARGET_ONLY
Definition enums.h:3359
@ ACTOR_PART_FLAG_PRIMARY_TARGET
Definition enums.h:3362
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_NO_DECORATIONS
Definition enums.h:3351
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ CAM_BATTLE
Definition enums.h:1801
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
EvtScript EVS_Enemy_ScareAway
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_SpinSmashHit
EvtScript EVS_Enemy_ShockHit
EvtScript EVS_Enemy_AirLift
EvtScript EVS_Enemy_BlowAway
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
ApiStatus RandInt(Evt *script, b32 isInitialCall)
ApiStatus ShakeCam(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 Switch(LVAR)
Marks the start of a switch statement.
Definition macros.h:311
#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 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 Sub(VAR, INT_VALUE)
Definition macros.h:377
#define IfNe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR != RVAR.
Definition macros.h:272
#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 EndCaseGroup
Marks the end of a switch case group (CaseOrEq and/or CaseAndEq), stopping fallthrough.
Definition macros.h:352
#define Goto(LABEL_ID)
Moves execution to the given label.
Definition macros.h:232
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define IfLt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR < RVAR.
Definition macros.h:275
#define Float(DOUBLE)
Definition macros.h:51
#define Label(LABEL_ID)
Marks this point in the script as a Goto target.
Definition macros.h:227
#define CaseOrEq(RVAR)
Marks the start of a switch case that executes only if LVAR == RVAR.
Definition macros.h:341
#define EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#define LVar5
Definition macros.h:153
#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 BreakLoop
Breaks out of the innermost loop.
Definition macros.h:251
#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 IfFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is set on LVAR,...
Definition macros.h:288
#define LVar2
Definition macros.h:150
#define LVar1
Definition macros.h:149
#define LVarA
Definition macros.h:158
#define IfNotFlag(LVAR, RVAR)
Marks the beginning of an if statement that only executes if the RVAR flag is unset on LVAR,...
Definition macros.h:292
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define EndSwitch
Marks the end of a switch statement and any case.
Definition macros.h:362
#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 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 Exec(EVT_SOURCE)
Launches a new thread.
Definition macros.h:455
#define Return
Kills the current EVT thread.
Definition macros.h:217