Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
lakitu.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/Spiny.h"
4#include "sprite/npc/Lakitu.h"
5#include "effects.h"
6
7#define NAMESPACE A(lakitu)
8
10
11extern EvtScript N(EVS_Init);
12extern EvtScript N(EVS_Idle);
13extern EvtScript N(EVS_TakeTurn);
14extern EvtScript N(EVS_HandleEvent);
15
16enum N(ActorPartIDs) {
17 PRT_MAIN = 1,
19 PRT_SPINY = 3,
20};
21
22enum N(ActorVars) {
24};
25
26enum N(ActorParams) {
28};
29
30s32 N(DefaultAnims)[] = {
41};
42
43s32 N(SpinyBallAnims)[] = {
46};
47
48s32 N(SpinyAnims)[] = {
51};
52
53s32 N(DefenseTable)[] = {
57};
58
59s32 N(StatusTable)[] = {
82};
83
84ActorPartBlueprint N(ActorParts)[] = {
85 {
87 .index = PRT_MAIN,
88 .posOffset = { 0, 0, 0 },
89 .targetOffset = { -5, 35 },
90 .opacity = 255,
91 .idleAnimations = N(DefaultAnims),
92 .defenseTable = N(DefenseTable),
93 .eventFlags = 0,
94 .elementImmunityFlags = 0,
95 .projectileTargetOffset = { 0, -13 },
96 },
97 {
99 .index = PRT_SPINY_BALL,
100 .posOffset = { 0, 0, 0 },
101 .targetOffset = { 0, 0 },
102 .opacity = 255,
103 .idleAnimations = N(SpinyBallAnims),
104 .defenseTable = N(DefenseTable),
105 .eventFlags = 0,
106 .elementImmunityFlags = 0,
107 .projectileTargetOffset = { 0, 0 },
108 },
109 {
111 .index = PRT_SPINY,
112 .posOffset = { 0, 0, 0 },
113 .targetOffset = { 0, 0 },
114 .opacity = 255,
115 .idleAnimations = N(SpinyAnims),
116 .defenseTable = N(DefenseTable),
117 .eventFlags = 0,
118 .elementImmunityFlags = 0,
119 .projectileTargetOffset = { 0, 0 },
120 },
121};
122
123ActorBlueprint NAMESPACE = {
124 .flags = ACTOR_FLAG_FLYING,
125 .type = ACTOR_TYPE_LAKITU,
126 .level = ACTOR_LEVEL_LAKITU,
127 .maxHP = 12,
128 .partCount = ARRAY_COUNT(N(ActorParts)),
129 .partsData = N(ActorParts),
130 .initScript = &N(EVS_Init),
131 .statusTable = N(StatusTable),
132 .escapeChance = 40,
133 .airLiftChance = 90,
134 .hurricaneChance = 90,
135 .spookChance = 50,
136 .upAndAwayChance = 95,
137 .spinSmashReq = 0,
138 .powerBounceChance = 85,
139 .coinReward = 2,
140 .size = { 32, 38 },
141 .healthBarOffset = { 0, 0 },
142 .statusIconOffset = { -11, 20 },
143 .statusTextOffset = { 10, 34 },
144};
145
146EvtScript N(EVS_Init) = {
147 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
148 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
149 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
151 Return
152 End
153};
154
155EvtScript N(EVS_Idle) = {
156 Return
157 End
158};
159
166 Return
167 End
168};
169
170EvtScript N(EVS_HandleEvent) = {
177 SetConst(LVar0, PRT_MAIN)
182 SetConst(LVar0, PRT_MAIN)
187 SetConst(LVar0, PRT_MAIN)
191 SetConst(LVar0, PRT_MAIN)
194 Return
196 SetConst(LVar0, PRT_MAIN)
200 SetConst(LVar0, PRT_MAIN)
203 SetConst(LVar0, PRT_MAIN)
206 Return
208 SetConst(LVar0, PRT_MAIN)
211 SetConst(LVar0, PRT_MAIN)
216 SetConst(LVar0, PRT_MAIN)
219 SetConst(LVar0, PRT_MAIN)
222 Return
226 SetConst(LVar0, PRT_MAIN)
231 SetConst(LVar0, PRT_MAIN)
234 Wait(10)
235 SetConst(LVar0, PRT_MAIN)
238 Return
240 Call(SetActorPos, ACTOR_SELF, 20, 0, 0)
246 SetConst(LVar0, PRT_MAIN)
250 SetConst(LVar0, PRT_MAIN)
254 Return
256 SetConst(LVar0, PRT_MAIN)
260 SetConst(LVar0, PRT_MAIN)
263 Return
268 Return
269 End
270};
271
287 Wait(20)
292 Add(LVar0, -3)
293 Add(LVar1, 16)
294 Add(LVar2, 2)
297 Add(LVar1, 12)
298 Add(LVar2, 0)
301 Else
303 Add(LVar0, -8)
304 Add(LVar1, 40)
305 Add(LVar2, 5)
308 Add(LVar1, 30)
309 Add(LVar2, 2)
312 EndIf
314 Wait(10)
315 Thread
317 Wait(20)
327 Set(LVarA, LVar0)
331 Sub(LVar0, 40)
332 Set(LVar1, 0)
334 Sub(LVar0, 30)
337 EndIf
340 Sub(LVar0, 20)
343 Wait(20)
353 Return
361 Wait(2)
367 Thread
371 Sub(LVar0, 40)
373 Sub(LVar0, 30)
375 Sub(LVar0, 20)
379 Wait(20)
386 Return
387 End
388};
389
391
393 ACTOR_BY_POS(A(spiny), N(SummonPos), 100, 1),
394};
395
404 Set(LVarB, LVar0)
407 Wait(20)
412 Add(LVar0, -3)
413 Add(LVar1, 16)
414 Add(LVar2, 2)
417 Add(LVar1, 12)
418 Add(LVar2, 0)
422 Else
424 Add(LVar0, -8)
425 Add(LVar1, 40)
426 Add(LVar2, 5)
429 Add(LVar1, 30)
430 Add(LVar2, 2)
434 EndIf
436 Wait(10)
437 Thread
439 Wait(20)
448 Sub(LVar0, 40)
451 Sub(LVar0, 30)
452 Thread
454 Set(LVar0, 0)
455 Set(LVar1, 0)
457 Loop(12)
458 Add(LVar0, 30)
460 Add(LVar1, 1)
461 IfGe(LVar1, 6)
466 Else
469 Set(LFlag0, TRUE)
470 EndIf
471 EndIf
472 Wait(1)
473 EndLoop
475 Thread
479 Wait(1)
489 Wait(20)
496 Else
497 Call(SetActorYaw, LVarB, 180)
498 EndIf
507 Add(LVar0, 1)
511 Return
512 End
513};
514
518 Label(0)
521 Mod(LVar5, 4)
523 CaseEq(0)
524 Set(LFlag1, TRUE)
525 CaseEq(1)
526 Set(LFlag2, TRUE)
527 CaseEq(2)
528 Set(LFlag3, TRUE)
529 CaseEq(3)
530 Set(LFlag4, TRUE)
534 Goto(0)
535 EndIf
537 Set(LVarA, 0)
538 Return
539 EndIf
541 Set(LVarA, 1)
542 Return
543 EndIf
545 Set(LVarA, 2)
546 Return
547 EndIf
549 Set(LVarA, 3)
550 Return
551 EndIf
552 Set(LVarA, -1)
553 Return
554 End
555};
556
558 Set(LVar9, 0)
561 Label(0)
569 IfLt(LVar3, 3)
570 Add(LVar9, 1)
571 EndIf
572 EndIf
576 Goto(0)
577 EndIf
578 Return
579 End
580};
581
582EvtScript N(EVS_TakeTurn) = {
584 IfGe(LVar0, 3)
586 Return
587 EndIf
589 IfEq(LVarA, -1)
591 Return
592 EndIf
595 CaseEq(1)
596 Call(RandInt, 1000, LVar0)
597 IfLt(LVar0, 500)
599 Return
600 EndIf
601 CaseEq(2)
602 Call(RandInt, 1000, LVar0)
603 IfLt(LVar0, 250)
605 Return
606 EndIf
607 CaseEq(3)
608 Call(RandInt, 1000, LVar0)
609 IfLt(LVar0, 150)
611 Return
612 EndIf
615 Return
616 End
617};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4899
@ ACTOR_SOUND_JUMP
Definition enums.h:2036
@ BS_FLAGS1_TRIGGER_EVENTS
Definition enums.h:3574
@ BS_FLAGS1_INCLUDE_POWER_UPS
Definition enums.h:3570
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_MYSTERY
Definition enums.h:2119
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ITER_NO_MORE
Definition enums.h:2030
@ ITER_NEXT
Definition enums.h:2025
@ 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_ACTOR
Definition enums.h:4835
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4884
@ TARGET_FLAG_PRIMARY_ONLY
Definition enums.h:1863
@ TARGET_FLAG_2
Definition enums.h:1850
@ EASING_SIN_OUT
Definition enums.h:521
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ SOUND_LAKITU_THROW_SPINY
Definition enums.h:1496
@ SOUND_NONE
Definition enums.h:547
@ ACTOR_PLAYER
Definition enums.h:2085
@ ACTOR_SELF
Definition enums.h:2084
@ ACTOR_FLAG_FLYING
Quake Hammer can't hit.
Definition enums.h:3329
@ BTL_CAM_YADJ_TARGET
Definition enums.h:4904
@ EVENT_HIT
Definition enums.h:2132
@ EVENT_SCARE_AWAY
Definition enums.h:2174
@ EVENT_BURN_HIT
Definition enums.h:2136
@ EVENT_BEGIN_FIRST_STRIKE
Definition enums.h:2173
@ EVENT_END_FIRST_STRIKE
Definition enums.h:2171
@ 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_PRIMARY_TARGET
Definition enums.h:3362
@ ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION
Definition enums.h:3361
@ ACTOR_PART_FLAG_NO_TARGET
Cannot be targeted.
Definition enums.h:3360
@ ACTOR_PART_FLAG_INVISIBLE
Definition enums.h:3350
@ DAMAGE_TYPE_TRIGGER_LUCKY
Definition enums.h:2881
@ DAMAGE_TYPE_NO_CONTACT
Definition enums.h:2878
EvtScript EVS_Enemy_Knockback
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)
#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 IfGe(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR >= RVAR.
Definition macros.h:284
#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 LFlag4
Definition macros.h:171
#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 Mod(VAR, INT_VALUE)
Definition macros.h:380
#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 LFlag1
Definition macros.h:168
#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 LVarB
Definition macros.h:159
#define ExecWait(EVT_SOURCE)
Launches a new child thread.
Definition macros.h:475
#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 LFlag0
Definition macros.h:167
#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 LFlag2
Definition macros.h:169
#define LVar9
Definition macros.h:157
#define NPC_DISPOSE_LOCATION
Definition macros.h:162
#define A(sym)
Definition macros.h:36
#define PlayEffect(args...)
Definition macros.h:807
#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 LFlag3
Definition macros.h:170
#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 Return
Kills the current EVT thread.
Definition macros.h:217
#define ACTOR_BY_POS(_name, _pos, _priority, args...)
Definition battle.h:230
FormationRow Formation[]
Definition battle.h:167