Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
bill_blaster.inc.c
Go to the documentation of this file.
1#include "common.h"
2#include "effects.h"
3#include "battle/battle.h"
4#include "script_api/battle.h"
5#include "sprite/npc/BillBlaster.h"
6
7#define NAMESPACE A(bill_blaster)
8
9extern s32 N(DefaultAnims)[];
10extern EvtScript N(EVS_Init);
11extern EvtScript N(EVS_Idle);
12extern EvtScript N(EVS_TakeTurn);
13extern EvtScript N(EVS_HandleEvent);
14extern EvtScript N(EVS_Move_FireBullet);
15extern EvtScript N(EVS_Move_CheckForBullet);
16
17extern ActorBlueprint A(bullet_bill);
18extern Formation N(BulletFormation);
19
20enum N(ActorPartIDs) {
21 PRT_MAIN = 1,
22 PRT_TARGET = 2,
23};
24
25enum N(ActorVars) {
26 AVAR_BulletID = 0,
27 AVAR_HasBullet = 8,
28};
29
30s32 N(DefenseTable)[] = {
33};
34
35s32 N(StatusTable)[] = {
58};
59
60ActorPartBlueprint N(ActorParts)[] = {
61 {
63 .index = PRT_MAIN,
64 .posOffset = { 0, 0, 0 },
65 .targetOffset = { -6, 29 },
66 .opacity = 255,
67 .idleAnimations = N(DefaultAnims),
68 .defenseTable = N(DefenseTable),
69 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
70 .elementImmunityFlags = 0,
71 .projectileTargetOffset = { 0, -9 },
72 },
73 {
75 .index = PRT_TARGET,
76 .posOffset = { 100, 0, 0 },
77 .targetOffset = { -106, 29 },
78 .opacity = 255,
79 .idleAnimations = N(DefaultAnims),
80 .defenseTable = N(DefenseTable),
81 .eventFlags = ACTOR_EVENT_FLAGS_NONE,
82 .elementImmunityFlags = 0,
83 .projectileTargetOffset = { 0, -9 },
84 },
85};
86
87ActorBlueprint NAMESPACE = {
88 .flags = 0,
89 .type = ACTOR_TYPE_BILL_BLASTER,
90 .level = ACTOR_LEVEL_BILL_BLASTER,
91 .maxHP = 4,
92 .partCount = ARRAY_COUNT(N(ActorParts)),
93 .partsData = N(ActorParts),
94 .initScript = &N(EVS_Init),
95 .statusTable = N(StatusTable),
96 .escapeChance = 0,
97 .airLiftChance = 20,
98 .hurricaneChance = 15,
99 .spookChance = 0,
100 .upAndAwayChance = 95,
101 .spinSmashReq = 4,
102 .powerBounceChance = 100,
103 .coinReward = 1,
104 .size = { 55, 32 },
105 .healthBarOffset = { 8, 0 },
106 .statusIconOffset = { -24, 20 },
107 .statusTextOffset = { 5, 25 },
108};
109
110s32 N(DefaultAnims)[] = {
111 STATUS_KEY_NORMAL, ANIM_BillBlaster_Idle,
112 STATUS_KEY_STONE, ANIM_BillBlaster_Still,
113 STATUS_KEY_STOP, ANIM_BillBlaster_Still,
114 STATUS_KEY_PARALYZE, ANIM_BillBlaster_Still,
116};
117
118EvtScript N(EVS_Init) = {
119 Call(BindTakeTurn, ACTOR_SELF, Ref(N(EVS_TakeTurn)))
120 Call(BindIdle, ACTOR_SELF, Ref(N(EVS_Idle)))
121 Call(BindHandleEvent, ACTOR_SELF, Ref(N(EVS_HandleEvent)))
122 Call(SetActorVar, ACTOR_SELF, AVAR_HasBullet, FALSE)
123 Return
124 End
125};
126
127EvtScript N(EVS_Idle) = {
128 Return
129 End
130};
131
132EvtScript N(EVS_HandleEvent) = {
133 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
134 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
135 Call(GetLastEvent, ACTOR_SELF, LVar0)
139 SetConst(LVar0, PRT_MAIN)
140 SetConst(LVar1, ANIM_BillBlaster_Hurt)
144 SetConst(LVar0, PRT_MAIN)
145 SetConst(LVar1, ANIM_BillBlaster_Hurt)
146 SetConst(LVar2, -1)
149 SetConst(LVar0, PRT_MAIN)
150 SetConst(LVar1, ANIM_BillBlaster_Hurt)
151 SetConst(LVar2, -1)
153 SetConst(LVar0, PRT_MAIN)
154 SetConst(LVar1, ANIM_BillBlaster_Hurt)
156 Return
160 SetConst(LVar0, PRT_MAIN)
161 SetConst(LVar1, ANIM_BillBlaster_Idle)
165 SetConst(LVar0, PRT_MAIN)
166 SetConst(LVar1, ANIM_BillBlaster_Hurt)
168 Wait(10)
169 SetConst(LVar0, PRT_MAIN)
170 SetConst(LVar1, ANIM_BillBlaster_Hurt)
172 Return
174 SetConst(LVar0, PRT_MAIN)
175 SetConst(LVar1, ANIM_BillBlaster_Idle)
178 SetConst(LVar0, PRT_MAIN)
179 SetConst(LVar1, ANIM_BillBlaster_Hurt)
182 SetConst(LVar0, PRT_MAIN)
183 SetConst(LVar1, ANIM_BillBlaster_Hurt)
185 Return
188 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
189 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
190 Return
191 End
192};
193
194EvtScript N(EVS_TakeTurn) = {
195 Call(UseIdleAnimation, ACTOR_SELF, FALSE)
196 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_DISABLE)
197 Call(GetActorVar, ACTOR_SELF, AVAR_HasBullet, LVar0)
199 CaseEq(0)
200 ExecWait(N(EVS_Move_FireBullet))
201 CaseEq(1)
202 ExecWait(N(EVS_Move_CheckForBullet))
204 Call(EnableIdleScript, ACTOR_SELF, IDLE_SCRIPT_ENABLE)
205 Call(UseIdleAnimation, ACTOR_SELF, TRUE)
206 Return
207 End
208};
209
210API_CALLABLE(N(SetBulletInitVars)) {
211 N(BulletFormation)[0].var0 = TRUE;
212 N(BulletFormation)[0].var1 = script->owner1.actorID;
213
214 return ApiStatus_DONE2;
215}
216
217EvtScript N(EVS_Move_FireBullet) = {
218 Call(SetAnimation, ACTOR_SELF, PRT_MAIN, ANIM_BillBlaster_Fire)
219 Wait(13)
220 Thread
221 Call(ShakeCam, CAM_BATTLE, 0, 10, Float(1.0))
223 Call(StartRumble, BTL_RUMBLE_PLAYER_HEAVY)
224 Call(PlaySoundAtActor, ACTOR_SELF, SOUND_BULLET_BILL_FIRE)
225 Call(GetActorPos, ACTOR_SELF, LVar0, LVar1, LVar2)
226 Sub(LVar0, 33)
227 Add(LVar1, 19)
228 Add(LVar2, 3)
229 PlayEffect(EFFECT_00, LVar0, LVar1, LVar2, 2, 5, 0, 2, 0)
230 PlayEffect(EFFECT_00, LVar0, LVar1, LVar2, 2, 5, 2, 2, 0)
231 Wait(2)
232 Call(N(SetBulletInitVars))
233 Call(SummonEnemy, Ref(N(BulletFormation)), FALSE)
234 Call(SetActorVar, ACTOR_SELF, AVAR_BulletID, LVar0)
235 Call(SetActorVar, ACTOR_SELF, AVAR_HasBullet, TRUE)
236 Return
237 End
238};
239
240EvtScript N(EVS_Move_CheckForBullet) = {
241 Call(GetActorVar, ACTOR_SELF, AVAR_BulletID, LVar0)
242 Call(ActorExists, LVar0, LVar1)
243 IfEq(LVar1, FALSE)
244 Call(SetActorVar, ACTOR_SELF, AVAR_HasBullet, FALSE)
245 EndIf
246 Return
247 End
248};
249
250Vec3i N(SummonPos) = { NPC_DISPOSE_LOCATION };
251
252Formation N(BulletFormation) = {
253 ACTOR_BY_POS(A(bullet_bill), N(SummonPos), 100),
254};
Bytecode EvtScript[]
@ ELEMENT_END
Definition enums.h:2114
@ ELEMENT_NORMAL
Definition enums.h:2115
@ ACTOR_EVENT_FLAGS_NONE
Definition enums.h:3370
@ 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
@ IDLE_SCRIPT_ENABLE
Definition enums.h:6408
@ IDLE_SCRIPT_DISABLE
Definition enums.h:6407
@ SOUND_BULLET_BILL_FIRE
Definition enums.h:1034
@ BTL_RUMBLE_PLAYER_HEAVY
Definition enums.h:4261
@ ACTOR_SELF
Definition enums.h:2084
@ EVENT_HIT
Definition enums.h:2132
@ 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_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_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_SKIP_MOVEMENT_ALLOC
Definition enums.h:3366
@ 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
#define ApiStatus_DONE2
Definition evt.h:118
EvtScript EVS_Enemy_Hit
EvtScript EVS_Enemy_Death
EvtScript EVS_Enemy_AirLift
EvtScript EVS_Enemy_BlowAway
EvtScript EVS_Enemy_Recover
EvtScript EVS_Enemy_BurnHit
EvtScript EVS_Enemy_NoDamageHit
ApiStatus ShakeCam(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 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 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 EndIf
Marks the end of an if statement or an else block.
Definition macros.h:298
#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 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 Wait(NUM_FRAMES)
Blocks for the given number of frames.
Definition macros.h:254
#define NPC_DISPOSE_LOCATION
Definition macros.h:158
#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 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