Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
bzzap.inc.c
Go to the documentation of this file.
1#include "battle/battle.h"
2#include "script_api/battle.h"
3#include "sprite/npc/Bzzap.h"
4
5#define NAMESPACE A(bzzap)
6
7extern EvtScript N(EVS_Init);
8extern EvtScript N(EVS_Idle);
9extern EvtScript N(EVS_TakeTurn);
11
12enum N(ActorPartIDs) {
13 PRT_MAIN = 1,
14 PRT_SWARM_1 = 2,
15 PRT_SWARM_2 = 3,
16 PRT_SWARM_3 = 4,
17 PRT_SWARM_4 = 5,
18 PRT_SWARM_5 = 6,
19};
20
21enum N(ActorParams) {
22 DMG_STING = 6,
23 DMG_SWARM = 1,
24};
25
26s32 N(DefaultAnims)[] = {
37};
38
39s32 N(DefenseTable)[] = {
42};
43
44s32 N(StatusTable)[] = {
67};
68
70 {
72 .index = PRT_MAIN,
73 .posOffset = { 0, 0, 0 },
74 .targetOffset = { -7, 33 },
75 .opacity = 255,
76 .idleAnimations = N(DefaultAnims),
77 .defenseTable = N(DefenseTable),
78 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
79 .elementImmunityFlags = 0,
80 .projectileTargetOffset = { 2, -10 },
81 },
82 {
84 .index = PRT_SWARM_1,
85 .posOffset = { 0, 0, 0 },
86 .targetOffset = { 0, 24 },
87 .opacity = 255,
88 .idleAnimations = N(DefaultAnims),
89 .defenseTable = N(DefenseTable),
90 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
91 .elementImmunityFlags = 0,
92 .projectileTargetOffset = { -1, -5 },
93 },
94 {
96 .index = PRT_SWARM_2,
97 .posOffset = { 0, 0, 0 },
98 .targetOffset = { 0, 24 },
99 .opacity = 255,
100 .idleAnimations = N(DefaultAnims),
101 .defenseTable = N(DefenseTable),
102 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
103 .elementImmunityFlags = 0,
104 .projectileTargetOffset = { -1, -5 },
105 },
106 {
108 .index = PRT_SWARM_3,
109 .posOffset = { 0, 0, 0 },
110 .targetOffset = { 0, 24 },
111 .opacity = 255,
112 .idleAnimations = N(DefaultAnims),
113 .defenseTable = N(DefenseTable),
114 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
115 .elementImmunityFlags = 0,
116 .projectileTargetOffset = { -1, -5 },
117 },
118 {
120 .index = PRT_SWARM_4,
121 .posOffset = { 0, 0, 0 },
122 .targetOffset = { 0, 24 },
123 .opacity = 255,
124 .idleAnimations = N(DefaultAnims),
125 .defenseTable = N(DefenseTable),
126 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
127 .elementImmunityFlags = 0,
128 .projectileTargetOffset = { -1, -5 },
129 },
130 {
132 .index = PRT_SWARM_5,
133 .posOffset = { 0, 0, 0 },
134 .targetOffset = { 0, 24 },
135 .opacity = 255,
136 .idleAnimations = N(DefaultAnims),
137 .defenseTable = N(DefenseTable),
138 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
139 .elementImmunityFlags = 0,
140 .projectileTargetOffset = { -1, -5 },
141 },
142};
143
144ActorBlueprint NAMESPACE = {
145 .flags = ACTOR_FLAG_FLYING,
146 .type = ACTOR_TYPE_BZZAP,
147 .level = ACTOR_LEVEL_BZZAP,
148 .maxHP = 3,
149 .partCount = ARRAY_COUNT(N(ActorParts)),
150 .partsData = N(ActorParts),
151 .initScript = &N(EVS_Init),
152 .statusTable = N(StatusTable),
153 .escapeChance = 40,
154 .airLiftChance = 95,
155 .hurricaneChance = 95,
156 .spookChance = 70,
157 .upAndAwayChance = 95,
158 .spinSmashReq = 0,
159 .powerBounceChance = 90,
160 .coinReward = 1,
161 .size = { 38, 38 },
162 .healthBarOffset = { 0, 0 },
163 .statusIconOffset = { -10, 20 },
164 .statusTextOffset = { 10, 20 },
165};
166
168
169API_CALLABLE(N(AddVecXZ)) {
170 Bytecode* args = script->ptrReadPos;
171 s32 prevX = evt_get_variable(script, *args++);
172 s32 prevZ = evt_get_variable(script, *args++);
173 s32 length = evt_get_variable(script, *args++);
174 s32 yaw = evt_get_variable(script, *args++);
175
176 f32 outX = prevX + (length * cos_deg(yaw));
177 f32 outZ = prevZ - (length * sin_deg(yaw));
178
181 return ApiStatus_DONE2;
182}
183
184EvtScript N(EVS_Init) = {
193 Return
194 End
195};
196
197EvtScript N(EVS_Idle) = {
198 Label(0)
203 Call(N(SetAbsoluteStatusOffsets), -20, 20, 10, 27)
204 Else
207 Call(N(SetAbsoluteStatusOffsets), -16, 22, 4, 22)
208 EndIf
209 Wait(1)
210 Goto(0)
211 Return
212 End
213};
214
221 Return
222 End
223};
224
249 Return
261 Return
277 Return
289 Wait(10)
293 Return
295 Call(SetActorPos, ACTOR_SELF, 20, 0, 0)
310 Return
320 Else
322 EndIf
323 EndIf
331 Return
332 End
333};
334
344 Call(AddGoalPos, ACTOR_SELF, 52, 10, 0)
351 Set(LVarA, LVar0)
352 Wait(10)
355 Add(LVar0, 20)
356 Add(LVar2, 1)
360 Wait(5)
363 Wait(10)
366 EndIf
367 Wait(15)
377 Return
380 Wait(10)
383 Add(LVar0, 20)
384 Add(LVar2, 1)
388 Wait(5)
391 Wait(6)
392 Wait(2)
398 Wait(20)
405 Return
406 End
407};
408
410 Set(LVar9, LVar0)
413 Add(LVarA, 200)
414 Add(LVarB, 100)
419 Add(LVarB, 50)
420 Sub(LVarC, 30)
426 Call(MakeLerp, 90, 450, 50, EASING_LINEAR)
427 Label(0)
433 Else
435 EndIf
436 Wait(1)
437 IfEq(LVar1, 1)
438 Goto(0)
439 EndIf
441 IfEq(LVar9, 2)
447 EndIf
450 Add(LVarB, 30)
451 Add(LVarC, 30)
457 Call(MakeLerp, -90, -720, 100, EASING_LINEAR)
458 Label(1)
464 Else
466 EndIf
467 Wait(1)
468 IfEq(LVar1, 1)
469 Goto(1)
470 EndIf
471 Return
472 End
473};
474
490 Wait(40)
496 Wait(11)
499 Wait(11)
502 Wait(11)
505 Wait(11)
508 Label(0)
510 Wait(1)
511 IfEq(LVar0, 1)
512 Goto(0)
513 EndIf
518 Set(LVarA, LVar0)
519 Thread
523 Call(AddGoalPos, ACTOR_SELF, -30, -20, 1)
530 Add(LVar1, 100)
531 Add(LVar2, 100)
537 Wait(11)
538 Thread
542 Call(AddGoalPos, ACTOR_SELF, -30, -20, 1)
549 Add(LVar1, 100)
550 Add(LVar2, 100)
556 Wait(11)
557 Thread
561 Call(AddGoalPos, ACTOR_SELF, -30, -20, 1)
568 Add(LVar1, 100)
569 Add(LVar2, 100)
575 Wait(11)
576 Thread
580 Call(AddGoalPos, ACTOR_SELF, -30, -20, 1)
587 Add(LVar1, 100)
588 Add(LVar2, 100)
594 Wait(11)
595 Thread
599 Call(AddGoalPos, ACTOR_SELF, -30, -20, 1)
606 Add(LVar1, 100)
607 Add(LVar2, 100)
613 Wait(11)
616 EndIf
617 Wait(30)
619 Wait(30)
624 Return
627 Thread
631 Call(AddGoalPos, ACTOR_SELF, -10, -10, 1)
635 Wait(2)
641 Add(LVar1, 100)
642 Add(LVar2, 100)
646 Wait(11)
647 Thread
651 Call(AddGoalPos, ACTOR_SELF, -10, -10, 1)
655 Wait(2)
661 Add(LVar1, 100)
662 Add(LVar2, 100)
666 Wait(11)
667 Thread
671 Call(AddGoalPos, ACTOR_SELF, -10, -10, 1)
675 Wait(2)
681 Add(LVar1, 100)
682 Add(LVar2, 100)
686 Wait(11)
687 Thread
691 Call(AddGoalPos, ACTOR_SELF, -10, -10, 1)
695 Wait(2)
701 Add(LVar1, 100)
702 Add(LVar2, 100)
706 Wait(11)
707 Wait(1)
711 Call(AddGoalPos, ACTOR_SELF, -10, -10, 1)
715 Wait(2)
725 Add(LVar1, 100)
726 Add(LVar2, 100)
735 Return
736 End
737};
738
743 Return
744 EndIf
745 Call(RandInt, 1000, LVar0)
746 IfLt(LVar0, 500)
748 Else
750 EndIf
751 Return
752 End
753};
BSS s32 PopupMenu_SelectedIndex
Bytecode EvtScript[]
#define sin_deg
#define cos_deg
#define STATUS_FLAGS_IMMOBILIZED
Definition enums.h:2834
@ BTL_CAM_XADJ_AVG
Definition enums.h:4899
@ ACTOR_SOUND_FLY
Definition enums.h:2035
@ BS_FLAGS1_NICE_HIT
Definition enums.h:3575
@ 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
@ PHASE_FIRST_STRIKE
Definition enums.h:2059
@ 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_SIMPLE
Definition enums.h:4829
@ BTL_CAM_ENEMY_APPROACH
Definition enums.h:4884
@ EASING_SIN_OUT
Definition enums.h:521
@ EASING_COS_IN
Definition enums.h:522
@ EASING_QUADRATIC_OUT
Definition enums.h:514
@ EASING_LINEAR
Definition enums.h:510
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6407
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6406
@ STATUS_FLAG_SHRINK
Definition enums.h:2819
@ STATUS_FLAG_DIZZY
Definition enums.h:2818
@ STATUS_FLAG_SLEEP
Definition enums.h:2812
@ STATUS_FLAG_POISON
Definition enums.h:2817
@ SOUND_NONE
Definition enums.h:547
@ SOUND_MINI_BZZAP_BUZZ
Definition enums.h:1162
@ SOUND_BZZAP_STING
Definition enums.h:1488
@ SOUND_MINI_BZZAP_STING
Definition enums.h:1489
@ SOUND_BZZAP_CALL_SWARM
Definition enums.h:1490
@ 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
#define ApiStatus_DONE2
Definition evt.h:118
s32 Bytecode
Definition evt.h:7
s32 evt_get_variable(Evt *script, Bytecode var)
Definition evt.c:1689
f32 evt_set_float_variable(Evt *script, Bytecode var, f32 value)
Definition evt.c:1976
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 PlaySound(Evt *script, b32 isInitialCall)
ApiStatus UpdateLerp(Evt *script, b32 isInitialCall)
ApiStatus StopSound(Evt *script, b32 isInitialCall)
ApiStatus RandInt(Evt *script, b32 isInitialCall)
ApiStatus MakeLerp(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 LVar6
Definition macros.h:154
#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 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 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 LVarC
Definition macros.h:160
#define ARRAY_COUNT(arr)
Definition macros.h:40
#define IfGt(LVAR, RVAR)
Marks the beginning of an if statement that only executes if LVAR <= RVAR.
Definition macros.h:278
#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 IsThreadRunning(TID, OUTVAR)
Sets OUTVAR to TRUE/FALSE depending on whether a thread with the given ID exists (i....
Definition macros.h:540
#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 LVar7
Definition macros.h:155
#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 LVar8
Definition macros.h:156
#define LVar2
Definition macros.h:150
#define DMG_STATUS_KEY(typeFlag, duration, chance)
Definition macros.h:228
#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 ExecGetTID(EVT_SOURCE, OUTVAR)
Identical to Exec, but the newly-launched thread ID is stored in OUTVAR.
Definition macros.h:460
#define Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define LVar9
Definition macros.h:157
#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 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