Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
npc.h
Go to the documentation of this file.
1#ifndef _NPC_H_
2#define _NPC_H_
3
4#include "common_structs.h"
5#include "enums.h"
6#include "script_api/map.h"
7
8#ifdef _LANGUAGE_C_PLUS_PLUS
9extern "C" {
10#endif
11
12// battle and stage are optional in overloaded NPC_GROUP macros
13#define NPC_GROUP(args...) VFUNC(NPC_GROUP, args)
14#define NPC_GROUP1(npcs) { sizeof(npcs) / sizeof(NpcData), (NpcData*) &npcs, 0, 0 }
15#define NPC_GROUP2(npcs, battle) { sizeof(npcs) / sizeof(NpcData), (NpcData*) &npcs, battle, 0 }
16#define NPC_GROUP3(npcs, battle, stage) { sizeof(npcs) / sizeof(NpcData), (NpcData*) &npcs, battle, stage + 1 }
17
18#define NPC_GROUP_EXPLICIT_SIZE(args...) VFUNC(NPC_GROUP_EXPLICIT_SIZE, args)
19#define NPC_GROUP_EXPLICIT_SIZE3(npcs, start, count) { count, (NpcData*) &npcs[start], 0, 0 }
20#define NPC_GROUP_EXPLICIT_SIZE4(npcs, start, count, battle) { count, (NpcData*) &npcs[start], battle, 0 }
21#define NPC_GROUP_EXPLICIT_SIZE5(npcs, start, count, battle, stage) { count, (NpcData*) &npcs[start], battle, stage + 1 }
22
23#define NO_DROPS { \
24 .dropFlags = NPC_DROP_FLAG_80, \
25 .heartDrops = { { F16(100), F16(0), 0, F16(0) } }, \
26 .flowerDrops = { { F16(100), F16(0), 0, F16(0) } }, \
27}
28
29#define STANDARD_HEART_DROPS(attempts) { \
30 { F16(20), F16(70), attempts, F16(50) }, \
31 { F16(30), F16(60), attempts, F16(50) }, \
32 { F16(50), F16(50), attempts, F16(40) }, \
33 { F16(80), F16(40), attempts, F16(40) }, \
34 { F16(100), F16(30), attempts, F16(30) }, \
35}
36
37#define GENEROUS_HEART_DROPS(attempts) { \
38 { F16(20), F16(80), attempts, F16(50) }, \
39 { F16(30), F16(70), attempts, F16(50) }, \
40 { F16(50), F16(60), attempts, F16(40) }, \
41 { F16(80), F16(50), attempts, F16(40) }, \
42 { F16(100), F16(40), attempts, F16(30) }, \
43}
44
45#define GENEROUS_WHEN_LOW_HEART_DROPS(attempts) { \
46 { F16(20), F16(80), attempts, F16(60) }, \
47 { F16(30), F16(70), attempts, F16(50) }, \
48 { F16(50), F16(60), attempts, F16(50) }, \
49 { F16(80), F16(50), attempts, F16(40) }, \
50 { F16(100), F16(30), attempts, F16(30) }, \
51}
52
53#define STANDARD_FLOWER_DROPS(attempts) { \
54 { F16(20), F16(50), attempts, F16(40) }, \
55 { F16(30), F16(40), attempts, F16(40) }, \
56 { F16(50), F16(40), attempts, F16(40) }, \
57 { F16(80), F16(40), attempts, F16(40) }, \
58 { F16(100), F16(30), attempts, F16(40) }, \
59}
60
61#define GENEROUS_WHEN_LOW_FLOWER_DROPS(attempts) { \
62 { F16(20), F16(70), attempts, F16(50) }, \
63 { F16(30), F16(60), attempts, F16(50) }, \
64 { F16(50), F16(50), attempts, F16(40) }, \
65 { F16(80), F16(40), attempts, F16(40) }, \
66 { F16(100), F16(30), attempts, F16(40) }, \
67}
68
69#define REDUCED_FLOWER_DROPS(attempts) { \
70 { F16(20), F16(40), attempts, F16(40) }, \
71 { F16(30), F16(40), attempts, F16(40) }, \
72 { F16(50), F16(40), attempts, F16(40) }, \
73 { F16(80), F16(40), attempts, F16(40) }, \
74 { F16(100), F16(30), attempts, F16(40) }, \
75}
76
77#define OVERRIDE_MOVEMENT_SPEED(speed) ((s32)(speed * 32767))
78#define NO_OVERRIDE_MOVEMENT_SPEED OVERRIDE_MOVEMENT_SPEED(-1.0f)
79
84
85typedef struct NpcBlueprint {
86 /* 0x00 */ s32 flags;
87 /* 0x04 */ s32 initialAnim;
88 /* 0x08 */ void (*onUpdate)(struct Npc*);
89 /* 0x0C */ void (*onRender)(struct Npc*);
90} NpcBlueprint; // size = 0x10
91
92typedef struct MobileAISettings {
93 /* 0x00 */ f32 moveSpeed;
94 /* 0x04 */ s32 moveTime;
95 /* 0x08 */ s32 waitTime;
96 /* 0x0C */ f32 alertRadius;
97 /* 0x10 */ f32 alertOffsetDist; // offset along npc->yaw of the test point for alert volume overlap, creates directionality to enemy 'sight'
98 /* 0x14 */ s32 playerSearchInterval; // how often to search for player (frames)
99 /* 0x18 */ f32 chaseSpeed;
100 /* 0x1C */ s32 chaseTurnRate; // how many degrees this NPC can turn per frame while chasing
101 /* 0x20 */ s32 chaseUpdateInterval; // how often to re-run chase init and re-acquire player position (frames)
102 /* 0x24 */ f32 chaseRadius;
103 /* 0x28 */ f32 chaseOffsetDist; // offset along npc->yaw of the test point for chase volume overlap, creates directionality to enemy 'sight'
104 /* 0x2C */ s32 unk_AI_2C; // probably a boolean for enable loitering after a wander movement
105} MobileAISettings; // size = 0x30
106
107typedef struct GuardAISettings {
108 /* 0x00 */ f32 alertRadius;
109 /* 0x04 */ f32 alertOffsetDist; // offset along npc->yaw of the test point for alert volume overlap, creates directionality to enemy 'sight'
110 /* 0x08 */ s32 playerSearchInterval; // how often to search for player (frames)
111 /* 0x0C */ f32 chaseSpeed;
112 /* 0x10 */ s32 chaseTurnRate; // how many degrees this NPC can turn per frame while chasing
113 /* 0x14 */ s32 chaseUpdateInterval; // how often to re-run chase init and re-acquire player position (frames)
114 /* 0x18 */ f32 chaseRadius;
115 /* 0x1C */ f32 chaseOffsetDist; // offset along npc->yaw of the test point for alert volume overlap, creates directionality to enemy 'sight'
116 /* 0x20 */ s32 unk_AI_20; // probably equivalent to unk_AI_2C in MobileAISettings
117} GuardAISettings; // size = 0x24
118
119struct FireBarData;
120typedef void (*FireBarCallback)(struct FireBarData*, s32);
121
122typedef struct FireBarAISettings {
123 /* 0x00 */ Vec3i centerPos;
124 /* 0x0C */ s32 rotRate;
125 /* 0x10 */ s32 firstNpc;
126 /* 0x14 */ s32 npcCount;
128} FireBarAISettings; // size = 0x1C
129
130typedef struct FireBarData {
131 /* 0x00 */ s32 flags;
132 /* 0x04 */ Vec3f centerPos;
133 /* 0x10 */ f32 rotRate;
134 /* 0x14 */ s32 firstNpc;
135 /* 0x18 */ s32 npcCount;
137 /* 0x20 */ s32 soundIndex;
138 /* 0x24 */ f32 lastDeltaYaw;
139 /* 0x28 */ f32 yaw;
141} FireBarData; // size = 0x30
142
143typedef struct NpcSettings {
144 /* 0x00 */ AnimID defaultAnim;
145 /* 0x04 */ s16 height;
146 /* 0x06 */ s16 radius;
147 /* 0x08 */ UNK_PTR otherAI;
149 /* 0x10 */ EvtScript* ai;
150 /* 0x14 */ EvtScript* onHit;
151 /* 0x18 */ EvtScript* aux;
152 /* 0x1C */ EvtScript* onDefeat;
153 /* 0x20 */ s32 flags;
154 /* 0x24 */ s32 unk_24;
155 /* 0x28 */ s16 level;
156 /* 0x2A */ s16 actionFlags; // action flags: 1 = jump on seeing player
157} NpcSettings; // size = 0x2C
158
159typedef struct ItemDrop {
160 /* 0x00 */ s16 item;
161 /* 0x02 */ s16 weight;
162 /* 0x04 */ s16 flagIdx;
163} ItemDrop; // size = 0x06
164
179typedef struct StatDrop {
180 /* 0x00 */ s16 cutoff;
181 /* 0x02 */ s16 generalChance;
182 /* 0x04 */ s16 attempts;
183 /* 0x06 */ s16 chancePerAttempt;
184} StatDrop; // size = 0x08
185
186typedef struct EnemyDrops {
187 /* 0x00 */ u8 dropFlags;
188 /* 0x01 */ u8 itemDropChance; // %
189 /* 0x02 */ ItemDrop itemDrops[8];
190 /* 0x32 */ StatDrop heartDrops[8];
191 /* 0x72 */ StatDrop flowerDrops[8];
192 /* 0xB2 */ s16 minCoinBonus;
193 /* 0xB4 */ s16 maxCoinBonus;
194 /* 0xB6 */ char unk_DE[2];
195} EnemyDrops; // size = 0xB8
196
198
199typedef struct {
201 /* 0x04 */ enum TerritoryShape shape;
202 /* 0x08 */ s32 pointX;
203 /* 0x0C */ s32 pointZ;
204 /* 0x10 */ s32 sizeX;
205 /* 0x14 */ s32 sizeZ;
206 /* 0x18 */ f32 halfHeight;
207 /* 0x1C */ s16 detectFlags; // 1 = ignore partner hiding (bow/sushie dont work) | 2 = ignore elevation
208} EnemyDetectVolume; // size = 0x20
209
210typedef struct {
211 /* 0x00 */ Vec3i centerPos;
212 /* 0x0C */ VecXZi wanderSize;
213 /* 0x14 */ s32 moveSpeedOverride;
215 /* 0x1C */ Vec3i detectPos;
216 /* 0x28 */ VecXZi detectSize;
218 /* 0x34 */ b32 isFlying;
219} EnemyTerritoryWander; // size = 0x38
220
221typedef struct {
222 /* 0x00 */ s32 numPoints;
223 /* 0x04 */ Vec3i points[10];
224 /* 0x7C */ s32 moveSpeedOverride;
225 /* 0x80 */ Vec3i detectPos;
226 /* 0x8C */ VecXZi detectSize;
228 /* 0x98 */ b32 isFlying;
229} EnemyTerritoryPatrol; // size = 0x9C
230
231typedef union {
234 char PADDING[0xC0];
235} EnemyTerritory; // size = 0xC0
236
237typedef union NpcInitialVars {
238 /* 0x0 */ s32 value;
239 /* 0x0 */ s8 bytes[4];
240 /* 0x0 */ s32* array;
242
243typedef struct NpcData {
244 /* 0x000 */ s32 id;
245 /* 0x004 */ NpcSettings* settings;
246 /* 0x008 */ Vec3f pos;
247 /* 0x014 */ s32 flags;
248 /* 0x018 */ EvtScript* init;
249 /* 0x01C */ s32 initVarCount;
251 /* 0x024 */ s32 yaw;
252 /* 0x028 */ EnemyDrops drops;
254 /* 0x1A0 */ struct {
255 /* 0x00 */ s32 idle;
256 /* 0x04 */ s32 walk;
257 /* 0x08 */ s32 run;
258 /* 0x0C */ s32 chase;
259 /* 0x10 */ s32 anim_4;
260 /* 0x14 */ s32 anim_5;
261 /* 0x18 */ s32 death;
262 /* 0x1C */ s32 hit;
263 /* 0x20 */ s32 anim_8;
264 /* 0x24 */ s32 anim_9;
265 /* 0x28 */ s32 anim_A;
266 /* 0x2C */ s32 anim_B;
267 /* 0x30 */ s32 anim_C;
268 /* 0x34 */ s32 anim_D;
269 /* 0x38 */ s32 anim_E;
270 /* 0x3C */ s32 anim_F;
272 /* 0x1E0 */ s8 unk__1E0;
273 /* 0x1E1 */ s8 unk__1E1;
274 /* 0x1E2 */ s8 unk__1E2;
275 /* 0x1E3 */ u8 aiDetectFlags;
276 /* 0x1E4 */ u32 aiFlags;
278 /* 0x1EC */ s32 tattle;
279} NpcData; // size = 0x1F0
280
282typedef struct NpcGroup {
283 /* 0x00 */ s32 npcCount;
284 /* 0x04 */ NpcData* npcs;
285 /* 0x08 */ s16 battle;
286 /* 0x0A */ s16 stage;
287} NpcGroup; // size = 0x0C
288
290
291// function signature used for state handlers in AI main functions
292typedef void AIStateHandler(Evt* script, MobileAISettings* settings, EnemyDetectVolume* territory);
293
294typedef struct Enemy {
295 /* 0x00 */ s32 flags;
296 /* 0x04 */ s8 encounterIndex;
297 /* 0x05 */ s8 encountered;
298 /* 0x06 */ u8 scriptGroup; /* scripts launched for this npc controller will be assigned this group */
299 /* 0x07 */ s8 hitboxIsActive; // when set, contact will trigger a first strike
300 /* 0x08 */ s16 npcID;
301 /* 0x0A */ s16 spawnPos[3];
302 /* 0x10 */ Vec3s unk_10; //TODO hitbox pos?
303 /* 0x16 */ char unk_16[2];
311 /* 0x34 */ struct Evt* initScript;
312 /* 0x38 */ struct Evt* interactScript;
313 /* 0x3C */ struct Evt* aiScript;
314 /* 0x40 */ struct Evt* hitScript;
315 /* 0x44 */ struct Evt* auxScript;
316 /* 0x48 */ struct Evt* defeatScript;
317 /* 0x4C */ s32 initScriptID;
318 /* 0x50 */ s32 interactScriptID;
319 /* 0x54 */ s32 aiScriptID;
320 /* 0x58 */ s32 hitScriptID;
321 /* 0x5C */ s32 auxScriptID;
322 /* 0x60 */ s32 defeatScriptID;
323 /* 0x64 */ UNK_PTR unk_64;
324 /* 0x68 */ char unk_68[4];
325 /* 0x6C */ union {
326 /* */ s32 varTable[16];
327 /* */ f32 varTableF[16];
328 /* */ void* varTablePtr[16];
329 /* */ };
330 /* 0xAC */ u8 aiDetectFlags; // detect player flags: 1 = require line of sight | 2 = adjust hitbox for moving player
331 /* 0xAD */ char unk_AD[3];
332 /* 0xB0 */ u32 aiFlags;
333 /* 0xB4 */ s8 aiSuspendTime;
334 /* 0xB5 */ s8 instigatorValue; // value is passed to first actor in formation if a battle is triggered with this enemy
335 /* 0xB6 */ char unk_B6[2];
336 /* 0xB8 */ EvtScript* unk_B8; // some bytecode
337 /* 0xBC */ struct Evt* unk_BC; // some script
338 /* 0xC0 */ s32 unk_C0; // some script ID
339 /* 0xC4 */ s32 unk_C4;
340 /* 0xC8 */ s32 unk_C8;
341 /* 0xCC */ s32* animList;
343 /* 0xD4 */ EnemyDrops* drops;
344 /* 0xD8 */ u32 tattleMsg;
345 /* 0xDC */ s32 unk_DC;
346 /* 0xE0 */ s16 savedNpcYaw;
347 /* 0xE2 */ char unk_E2[6];
348} Enemy; // size = 0xE8
349
350typedef struct Encounter {
351 /* 0x00 */ s32 count;
352 /* 0x04 */ Enemy* enemy[16];
353 /* 0x44 */ s16 battle;
354 /* 0x46 */ s16 stage;
355 /* 0x48 */ s16 encounterID;
356 /* 0x4A */ char unk_4C[2];
357} Encounter; // size = 0x4C
358
359typedef struct FieldStatus {
360 /* 0x00 */ s8 status;
361 /* 0x01 */ char pad_01;
362 /* 0x02 */ s16 duration;
364
365typedef struct EncounterStatus {
366 /* 0x000 */ s32 flags; // see enum: EncounterFlags
367 /* 0x004 */ s8 firstStrikeType; // see enum: FirstStrikeType
368 /* 0x005 */ s8 hitType; // see enum: EncounterTriggers
369 /* 0x006 */ s8 hitTier; // 0 = normal, 1 = super, 2 = ultra
370 /* 0x007 */ char unk_07;
371 /* 0x008 */ s8 unk_08;
372 /* 0x009 */ s8 battleOutcome; // see enum: EncounterOutcomes
373 /* 0x00A */ s8 battleTriggerCooldown;
374 /* 0x00B */ b8 hasMerleeCoinBonus; /* triple coins when TRUE */
375 /* 0x00C */ u8 damageTaken; /* valid after battle */
376 /* 0x00D */ char unk_0D;
377 /* 0x00E */ s16 coinsEarned; /* valid after battle */
378 /* 0x010 */ s8 instigatorValue;
379 /* 0x011 */ s8 forbidFleeing;
380 /* 0x012 */ s8 scriptedBattle;
381 /* 0x013 */ s8 dropWhackaBump;
382 /* 0x014 */ s32 songID;
383 /* 0x018 */ s32 unk_18; // unused, related to songID. perhaps was meant for variation, but not implemented.
384 /* 0x01C */ s8 numEncounters; /* number of encounters for current map (in list) */
385 /* 0x01D */ s8 curAreaIndex;
386 /* 0x01E */ u8 curMapIndex;
387 /* 0x01F */ u8 curEntryIndex;
388 /* 0x020 */ s8 mapID;
390 /* 0x022 */ char unk_22[2];
391 /* 0x024 */ s32* npcGroupList;
392 /* 0x028 */ Encounter* encounterList[24];
394 /* 0x08C */ Enemy* curEnemy;
395 /* 0x090 */ s32 fadeOutAmount;
396 /* 0x094 */ s32 substateDelay;
397 /* 0x098 */ s32 fadeOutAccel;
398 /* 0x09C */ s32 battleStartCountdown;
403 /* 0x0B0 */ s32 defeatFlags[60][12];
404 /* 0xBF0 */ s16 recentMaps[2];
405} EncounterStatus; // size = 0xBF4
406
408
409s32 basic_ai_check_player_dist(EnemyDetectVolume* arg0, Enemy* arg1, f32 arg2, f32 arg3, b8 arg4);
410
413
415
416void clear_npcs(void);
417
419void init_npc_list(void);
420
421s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 skipLoadingAnims);
422
423s32 create_basic_npc(NpcBlueprint* blueprint);
424
425s32 create_standard_npc(NpcBlueprint* blueprint, AnimID* animList);
426
427s32 create_peach_npc(NpcBlueprint* blueprint);
428
429void free_npc_by_index(s32 listIndex);
430
431void free_npc(Npc* npc);
432
433Npc* get_npc_by_index(s32 listIndex);
434
435void npc_do_world_collision(Npc* npc);
436
438
441
442void npc_try_apply_gravity(Npc* npc);
443
444s32 npc_try_snap_to_ground(Npc* npc, f32 velocity);
445
447void update_npcs(void);
448
449f32 npc_get_render_yaw(Npc* npc);
450
451void appendGfx_npc(void* data);
452
454void render_npcs(void);
455
456void npc_move_heading(Npc* npc, f32 speed, f32 yaw);
457
458Npc* get_npc_unsafe(s32 npcID);
459
461Npc* get_npc_safe(s32 npcID);
462
463void enable_npc_shadow(Npc* npc);
464
465void disable_npc_shadow(Npc* npc);
466
467void update_npc_blur(Npc* npc);
468
469void appendGfx_npc_blur(void* npc);
470
471void npc_enable_collisions(void);
472
473void npc_disable_collisions(void);
474
475void func_8003B1A8(void);
476
477void npc_reload_all(void);
478
479void set_npc_yaw(Npc* npc, f32 yaw);
480
481void npc_set_palswap_mode_A(Npc* npc, s32 arg1);
482
483void npc_set_palswap_mode_B(Npc* npc, s32 arg1);
484
486
487void npc_set_palswap_1(Npc* npc, s32 palIndexA, s32 palIndexB, s32 timeHoldA, s32 timeAB);
488
489void npc_set_palswap_2(Npc* npc, s32 timeHoldB, s32 timeBA, s32 palIndexC, s32 palIndexD);
490
491void npc_draw_with_palswap(Npc* npc, s32 arg1, Matrix4f mtx);
492
493void npc_render_without_adjusted_palettes(Npc* npc, s32 arg1, Matrix4f mtx);
494
496
497u16 npc_blend_palette_colors(u16 colorA, u16 colorB, s32 lerpAlpha);
498
500
502
503void npc_set_decoration(Npc* npc, s32 idx, s32 decorationType);
504
505void npc_remove_decoration(Npc* npc, s32 idx);
506
508
509void npc_reset_current_decoration(Npc* npc, s32 idx);
510
511void npc_update_decoration_none(Npc* npc, s32 idx);
512
513void npc_remove_decoration_none(Npc* npc, s32 idx);
514
515void npc_update_decoration_bowser_aura(Npc* npc, s32 idx);
516
517void npc_remove_decoration_bowser_aura(Npc* npc, s32 idx);
518
519void npc_update_decoration_sweat(Npc* npc, s32 idx);
520
521void npc_remove_decoration_sweat(Npc* npc, s32 idx);
522
523void npc_update_decoration_seeing_stars(Npc* npc, s32 idx);
524
525void npc_remove_decoration_seeing_stars(Npc* npc, s32 idx);
526
527void npc_update_decoration_glow_in_front(Npc* npc, s32 idx);
528
529void npc_remove_decoration_glow_in_front(Npc* npc, s32 idx);
530
531void npc_update_decoration_glow_behind(Npc* npc, s32 idx);
532
533void npc_remove_decoration_glow_behind(Npc* npc, s32 idx);
534
535void npc_update_decoration_charged(Npc* npc, s32 idx);
536
537void npc_remove_decoration_charged(Npc* npc, s32 idx);
538
550Npc* npc_find_closest(f32 x, f32 y, f32 z, f32 radius);
551
563Npc* npc_find_closest_simple(f32 x, f32 y, f32 z, f32 radius);
564
565//s32 npc_find_standing_on_entity();
566
568
569void npc_imgfx_update(Npc* npc);
570
571void npc_set_imgfx_params(Npc* npc, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6);
572
574
576
578
580
582
584
586
588void COPY_set_defeated(s32 mapID, s32 encounterID);
589
590void init_encounter_status(void);
591
592void clear_encounter_status(void);
593
594void func_8003E50C(void);
595
596void func_8003E514(s8 arg0);
597
598void update_encounters(void);
599
600void draw_encounter_ui(void);
601
602void draw_first_strike_ui(void);
603
605
606void make_npcs(s32 flags, s32 mapID, s32* npcGroupList);
607
608s32 kill_encounter(Enemy* enemy);
609
610void kill_enemy(Enemy* enemy);
611
616s32 bind_enemy_ai(Enemy* enemy, EvtScript* aiScriptBytecode);
617
622s32 bind_enemy_aux(Enemy* enemy, EvtScript* auxScriptBytecode);
623
628s32 bind_enemy_interact(Enemy* enemy, EvtScript* interactScriptBytecode);
629
634void bind_npc_ai(s32 npcID, EvtScript* npcAiBytecode);
635
640void bind_npc_aux(s32 npcID, EvtScript* npcAuxBytecode);
641
646void bind_npc_interact(s32 npcID, EvtScript* npcInteractBytecode);
647
653Enemy* get_enemy(s32 npcID);
654
660Enemy* get_enemy_safe(s32 npcID);
661
662void set_npc_sprite(Npc* npc, s32 anim, AnimID* extraAnimList);
663
664#ifdef _LANGUAGE_C_PLUS_PLUS
665}
666#endif
667
668#endif
s32 b32
f32 Matrix4f[4][4]
Bytecode EvtScript[]
s8 b8
u32 AnimID
s8 flags
Definition demo_api.c:15
SurfaceInteractMode
Definition enums.h:4683
StatDrop heartDrops[8]
Definition npc.h:190
f32 chaseSpeed
Definition npc.h:99
void npc_render_without_adjusted_palettes(Npc *npc, s32 arg1, Matrix4f mtx)
Definition npc.c:1321
char unk_AD[3]
Definition npc.h:331
s32 waitTime
Definition npc.h:95
s8 resetMapEncounterFlags
Definition npc.h:389
s32 npc_try_snap_to_ground(Npc *npc, f32 velocity)
Definition npc.c:581
void npc_update_decoration_charged(Npc *npc, s32 idx)
Definition npc.c:1932
EvtScript * ai
Definition npc.h:149
void free_npc(Npc *npc)
Definition npc.c:237
void appendGfx_npc_blur(void *npc)
Definition npc.c:1113
s32 create_basic_npc(NpcBlueprint *blueprint)
Definition npc.c:190
EvtScript * onDefeat
Definition npc.h:152
void npc_update_decoration_seeing_stars(Npc *npc, s32 idx)
Definition npc.c:1867
s16 height
Definition npc.h:145
void npc_remove_decoration_glow_in_front(Npc *npc, s32 idx)
Definition npc.c:1906
char unk_0D
Definition npc.h:376
enum TerritoryShape shape
Definition npc.h:201
f32 lastDeltaYaw
Definition npc.h:138
struct Evt * interactScript
Definition npc.h:312
f32 chaseOffsetDist
Definition npc.h:115
s32 unk_C0
Definition npc.h:338
char unk_07
Definition npc.h:370
s16 coinsEarned
Definition npc.h:377
void npc_imgfx_update(Npc *npc)
Definition npc.c:2093
s8 scriptedBattle
battle started by StartBattle but not by encounter
Definition npc.h:380
void spawn_flower_surface_effects(Npc *npc, SurfaceInteractMode mode)
s32 chaseTurnRate
Definition npc.h:100
s32 chaseUpdateInterval
Definition npc.h:101
f32 chaseRadius
Definition npc.h:114
NpcInitialVars initVar
Definition npc.h:250
u8 aiDetectFlags
Definition npc.h:275
s32 flags
Definition npc.h:295
VecXZi detectSize
Definition npc.h:216
enum TerritoryShape detectShape
Definition npc.h:217
s16 battle
Definition npc.h:285
TerritoryShape
Definition npc.h:197
@ SHAPE_CYLINDER
Definition npc.h:197
@ SHAPE_RECT
Definition npc.h:197
EnemyDrops drops
Definition npc.h:252
EvtScript * aux
Definition npc.h:151
EnemyTerritory territory
Definition npc.h:253
s32 basic_ai_check_player_dist(EnemyDetectVolume *arg0, Enemy *arg1, f32 arg2, f32 arg3, b8 arg4)
Definition 23680.c:429
s32 moveTime
Definition npc.h:94
s16 item
Definition npc.h:160
s16 savedNpcYaw
Definition npc.h:346
s16 radius
Definition npc.h:146
u8 curMapIndex
Definition npc.h:386
s16 npcID
Definition npc.h:300
s8 bytes[4]
Definition npc.h:239
EnemyDrops * drops
Definition npc.h:343
void npc_set_palswap_mode_B(Npc *npc, s32 arg1)
Definition npc.c:1267
s32 bind_enemy_ai(Enemy *enemy, EvtScript *aiScriptBytecode)
Binds the specified ai script to the specified enemy.
Definition npc.c:2441
struct NpcData::@52 animations
s32 npcCount
Definition npc.h:135
s32 * array
Definition npc.h:240
s32 interactScriptID
Definition npc.h:318
void npc_reload_all(void)
Definition npc.c:1208
s32 bind_enemy_aux(Enemy *enemy, EvtScript *auxScriptBytecode)
Binds the specified auxillary script to the specified enemy.
Definition npc.c:2455
Enemy * get_enemy_safe(s32 npcID)
Same as get_enemy(), with the exception of always returning a value if an enemy is not found.
Definition npc.c:2559
f32 alertOffsetDist
Definition npc.h:109
s8 unk__1E1
Definition npc.h:273
s16 encounterID
Definition npc.h:355
u32 aiFlags
Definition npc.h:276
struct Evt * hitScript
Definition npc.h:314
FieldStatus unusedAttack3
Definition npc.h:402
void npc_surface_spawn_fx(Npc *npc, SurfaceInteractMode mode)
Definition surfaces.c:394
void npc_remove_decoration_sweat(Npc *npc, s32 idx)
Definition npc.c:1864
FieldStatus unusedAttack1
Definition npc.h:400
f32 alertRadius
Definition npc.h:108
FireBarCallback callback
Definition npc.h:127
s16 recentMaps[2]
Definition npc.h:404
void kill_enemy(Enemy *enemy)
Definition npc.c:2374
EvtScript * hitBytecode
Definition npc.h:308
void spawn_snow_surface_effects(Npc *npc, SurfaceInteractMode mode)
Enemy * get_enemy(s32 npcID)
Looks for an enemy matching the specified npcID.
Definition npc.c:2540
void npc_do_other_npc_collision(Npc *npc)
Definition npc.c:381
void func_8003E50C(void)
Definition npc.c:2263
s8 encounterIndex
Definition npc.h:296
s32 yaw
Definition npc.h:251
void bind_npc_ai(s32 npcID, EvtScript *npcAiBytecode)
Binds the specified ai script to the npc matching the specified npcId.
Definition npc.c:2483
s32 firstNpc
Definition npc.h:134
s32 requiredStoryProgress
Definition npc.h:81
s8 instigatorValue
Definition npc.h:334
s32 npc_render_with_double_pal_blending(Npc *, s32, Matrix4f mtx)
Definition npc.c:1584
u8 scriptGroup
Definition npc.h:298
void npc_disable_collisions(void)
Definition npc.c:1201
void npc_set_palswap_1(Npc *npc, s32 palIndexA, s32 palIndexB, s32 timeHoldA, s32 timeAB)
Definition npc.c:1287
StatDrop flowerDrops[8]
Definition npc.h:191
s32 auxScriptID
Definition npc.h:321
void spawn_default_surface_effects(Npc *npc, SurfaceInteractMode mode)
void enable_npc_shadow(Npc *npc)
Definition npc.c:1027
s32 initScriptID
Definition npc.h:317
void npc_remove_decoration_bowser_aura(Npc *npc, s32 idx)
Definition npc.c:1839
Encounter * encounterList[24]
Definition npc.h:392
s32 create_peach_npc(NpcBlueprint *blueprint)
Definition npc.c:198
void npc_try_apply_gravity(Npc *npc)
Definition npc.c:541
s32 initVarCount
Definition npc.h:249
s32 id
Definition npc.h:244
s8 battleTriggerCooldown
set to 15 after victory, 45 after fleeing
Definition npc.h:373
s32 * npcGroupList
Definition npc.h:391
s32 chaseUpdateInterval
Definition npc.h:113
void update_encounters(void)
Definition npc.c:2270
EvtScript * onInteract
Definition npc.h:148
void * otherAI
Definition npc.h:147
char unk_68[4]
Definition npc.h:324
s32 * animList
Definition npc.h:341
void npc_draw_with_palswap(Npc *npc, s32 arg1, Matrix4f mtx)
Definition npc.c:1301
Npc * npc_find_closest_simple(f32 x, f32 y, f32 z, f32 radius)
Finds the closest simple-hitbox NPC to a given point within a radius.
Definition npc.c:1995
f32 moveSpeed
Definition npc.h:93
FireBarAISettings * settings
Definition npc.h:140
s32 create_standard_npc(NpcBlueprint *blueprint, AnimID *animList)
Definition npc.c:194
s16 flagIdx
Definition npc.h:162
u8 damageTaken
Definition npc.h:375
s16 stage
Definition npc.h:286
Enemy * curEnemy
Definition npc.h:394
void init_npc_list(void)
Points the current NPC list to the world or battle lists depending on game state.
Definition npc.c:77
void spawn_cloud_surface_effects(Npc *npc, SurfaceInteractMode mode)
s8 unk__1E2
Definition npc.h:274
void disable_npc_shadow(Npc *npc)
Definition npc.c:1037
s32 unk_24
Definition npc.h:154
VecXZi wanderSize
Definition npc.h:212
void free_npc_by_index(s32 listIndex)
Definition npc.c:202
void func_8003E514(s8 arg0)
Definition npc.c:2266
void npc_set_imgfx_params(Npc *npc, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6)
Definition npc.c:2162
char unk_E2[6]
Definition npc.h:347
void clear_npcs(void)
Definition npc.c:60
void npc_revert_palswap_mode(Npc *npc)
Definition npc.c:1276
struct Evt * defeatScript
Definition npc.h:316
EvtScript * initBytecode
Definition npc.h:305
s16 chancePerAttempt
% chance for a single heart/flower to be dropped from each attempt.
Definition npc.h:183
void make_npcs(s32 flags, s32 mapID, s32 *npcGroupList)
Definition npc.c:2331
ItemDrop itemDrops[8]
Definition npc.h:189
b8 hasMerleeCoinBonus
Definition npc.h:374
s8 numEncounters
Definition npc.h:384
Enemy * enemy[16]
Definition npc.h:352
u8 itemDropChance
Definition npc.h:188
void npc_set_decoration(Npc *npc, s32 idx, s32 decorationType)
Definition npc.c:1734
s16 spawnPos[3]
Definition npc.h:301
s8 aiSuspendTime
Definition npc.h:333
s32 unk_DC
Definition npc.h:345
void render_npcs(void)
Renders all NPCs.
Definition npc.c:933
NpcData * npcs
Definition npc.h:284
Npc * get_npc_unsafe(s32 npcID)
Definition npc.c:995
void spawn_water_surface_effects(Npc *npc, SurfaceInteractMode mode)
void npc_set_palswap_2(Npc *npc, s32 timeHoldB, s32 timeBA, s32 palIndexC, s32 palIndexD)
Definition npc.c:1294
s32 unk_C4
Definition npc.h:339
u8 curEntryIndex
Definition npc.h:387
NpcGroup NpcGroupList[]
Definition npc.h:289
Vec3s unk_10
Definition npc.h:302
VecXZi detectSize
Definition npc.h:226
void npc_enable_collisions(void)
Definition npc.c:1197
FieldStatus dizzyAttack
Definition npc.h:399
void npc_render_worker_do_nothing(void)
Definition npc.c:2328
s32 count
Definition npc.h:351
s8 forbidFleeing
Definition npc.h:379
char unk_4C[2]
Definition npc.h:356
s8 hitboxIsActive
Definition npc.h:299
void npc_remove_decoration_none(Npc *npc, s32 idx)
Definition npc.c:1816
Vec3f centerPos
Definition npc.h:132
void(* FireBarCallback)(struct FireBarData *, s32)
Definition npc.h:120
void npc_update_decoration_glow_in_front(Npc *npc, s32 idx)
Definition npc.c:1888
char pad_01
Definition npc.h:361
AnimID * extraAnimations
Definition npc.h:277
Npc * npc_find_closest(f32 x, f32 y, f32 z, f32 radius)
Finds the closest NPC to a given point within a radius.
Definition npc.c:1969
s32 flags
Definition npc.h:247
s32 numQuestionsUnlocked
Definition npc.h:82
f32 yaw
Definition npc.h:139
s16 actionFlags
Definition npc.h:156
s32 fadeOutAccel
Definition npc.h:397
void npc_reset_current_decoration(Npc *npc, s32 idx)
Definition npc.c:1798
s32 npc_update_decorations(Npc *npc)
Definition npc.c:1768
void mtx_ident_mirror_y(Matrix4f mtx)
Definition npc.c:52
u8 dropFlags
Definition npc.h:187
s32 value
Definition npc.h:238
s16 generalChance
% chance for any hearts/flowers to be dropped at all from this StatDrop.
Definition npc.h:181
s16 detectFlags
Definition npc.h:207
void npc_do_world_collision(Npc *npc)
Definition npc.c:278
f32 rotRate
Definition npc.h:133
f32 alertOffsetDist
Definition npc.h:97
void bind_npc_aux(s32 npcID, EvtScript *npcAuxBytecode)
Binds the specified auxillary script to the npc matching the specified npcId.
Definition npc.c:2502
s16 weight
Definition npc.h:161
EnemyTerritoryPatrol patrol
Definition npc.h:233
EvtScript * interactBytecode
Definition npc.h:306
void update_npcs(void)
Updates all NPCs.
Definition npc.c:617
s32 kill_encounter(Enemy *enemy)
Definition npc.c:2361
s32 aiScriptID
Definition npc.h:319
void bind_npc_interact(s32 npcID, EvtScript *npcInteractBytecode)
Binds the specified interact script to the npc matching the specified npcId.
Definition npc.c:2521
s16 attempts
Maximum number of hearts/flowers that can be dropped from this StatDrop.
Definition npc.h:182
s32 moveSpeedOverride
Definition npc.h:213
s32 playerSearchInterval
Definition npc.h:98
void npc_set_palswap_mode_A(Npc *npc, s32 arg1)
Definition npc.c:1258
s32 unk_AI_20
Definition npc.h:116
char unk_DE[2]
Definition npc.h:194
struct Evt * initScript
Definition npc.h:311
f32 chaseRadius
Definition npc.h:102
s32 fadeOutAmount
Definition npc.h:395
s16 maxCoinBonus
Definition npc.h:193
Npc * get_npc_by_index(s32 listIndex)
Definition npc.c:271
s32 playerSearchInterval
Definition npc.h:110
s16 duration
Definition npc.h:362
u8 aiDetectFlags
Definition npc.h:330
s8 status
Definition npc.h:360
void clear_encounter_status(void)
Definition npc.c:2224
s32 defeatScriptID
Definition npc.h:322
void draw_first_strike_ui(void)
Definition npc.c:2318
NpcSettings * npcSettings
Definition npc.h:304
void npc_remove_decoration(Npc *npc, s32 idx)
Definition npc.c:1741
f32 chaseSpeed
Definition npc.h:111
EncounterStatus gCurrentEncounter
Definition encounter.c:176
void npc_update_decoration_bowser_aura(Npc *npc, s32 idx)
Definition npc.c:1819
s32 npc_render_with_watt_idle_palettes(Npc *, s32, Matrix4f mtx)
Definition npc.c:1343
f32 alertRadius
Definition npc.h:96
void AIStateHandler(Evt *script, MobileAISettings *settings, EnemyDetectVolume *territory)
Definition npc.h:292
enum TerritoryShape wanderShape
Definition npc.h:214
s32 npc_render_with_single_pal_blending(Npc *, s32, s32, Matrix4f mtx)
Definition npc.c:1448
void npc_remove_decoration_glow_behind(Npc *npc, s32 idx)
Definition npc.c:1928
FieldStatus unusedAttack2
Definition npc.h:401
s8 instigatorValue
Definition npc.h:378
s16 cutoff
% of max HP/FP. If current HP/FP > cutoff, no hearts/flowers can be dropped.
Definition npc.h:180
f32 npc_get_render_yaw(Npc *npc)
Definition npc.c:745
s8 battleOutcome
Definition npc.h:372
char unk_22[2]
Definition npc.h:390
EvtScript * init
Definition npc.h:248
s8 curAreaIndex
Definition npc.h:385
s32 npc_do_player_collision(Npc *npc)
Definition npc.c:443
void npc_remove_decoration_charged(Npc *npc, s32 idx)
Definition npc.c:1966
s16 stage
Definition npc.h:354
Vec3f pos
Definition npc.h:246
u32 aiFlags
Definition npc.h:332
s16 minCoinBonus
Definition npc.h:192
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
Definition npc.c:986
void update_npc_blur(Npc *npc)
Definition npc.c:1097
s32 unk_AI_2C
Definition npc.h:104
s8 dropWhackaBump
Definition npc.h:381
s16 level
Definition npc.h:155
s32 create_npc_impl(NpcBlueprint *blueprint, AnimID *animList, s32 skipLoadingAnims)
Definition npc.c:88
void appendGfx_npc(void *data)
Definition npc.c:809
struct Evt * auxScript
Definition npc.h:315
void spawn_hedge_surface_effects(Npc *npc, SurfaceInteractMode mode)
s32 moveSpeedOverride
Definition npc.h:224
void COPY_set_defeated(s32 mapID, s32 encounterID)
Duplicate of set_defeated().
Definition npc.c:2172
void func_8003B1A8(void)
Definition npc.c:1205
EvtScript * unk_B8
Definition npc.h:336
u16 npc_blend_palette_colors(u16 colorA, u16 colorB, s32 lerpAlpha)
Definition npc.c:1439
NpcSettings * settings
Definition npc.h:245
void draw_encounter_ui(void)
Definition npc.c:2294
s32 defeatFlags[60][12]
Definition npc.h:403
s32 chaseTurnRate
Definition npc.h:112
s32 unk_C8
Definition npc.h:340
s32 npcCount
Definition npc.h:283
s32 battleStartCountdown
Definition npc.h:398
s32 flags
Definition npc.h:131
char unk_16[2]
Definition npc.h:303
u32 tattleMsg
Definition npc.h:344
s32 tattle
Definition npc.h:278
void set_npc_yaw(Npc *npc, f32 yaw)
Definition npc.c:1246
s8 encountered
Definition npc.h:297
s16 battle
Definition npc.h:353
s32 npc_get_collider_below(Npc *npc)
Definition npc.c:2069
void set_npc_sprite(Npc *npc, s32 anim, AnimID *extraAnimList)
Definition npc.c:1048
s32 skipPlayerDetectChance
Definition npc.h:200
s8 unk__1E0
Definition npc.h:272
void * unk_64
Definition npc.h:323
void init_encounter_status(void)
Definition npc.c:2191
EvtScript * onHit
Definition npc.h:150
void STUB_npc_callback(Npc *)
The default Npc::onUpdate and Npc::onRender callback.
Definition npc.c:49
s8 firstStrikeType
Definition npc.h:367
EvtScript * defeatBytecode
Definition npc.h:310
FireBarCallback callback
Definition npc.h:136
EvtScript * aiBytecode
Definition npc.h:307
void npc_update_decoration_glow_behind(Npc *npc, s32 idx)
Definition npc.c:1910
struct Evt * unk_BC
Definition npc.h:337
char unk_B6[2]
Definition npc.h:335
s32 flags
Definition npc.h:153
Vec3i centerPos
Definition npc.h:123
AnimID defaultAnim
Definition npc.h:144
s32 soundIndex
Definition npc.h:137
EnemyTerritoryWander wander
Definition npc.h:232
s32 substateDelay
Definition npc.h:396
void npc_update_decoration_sweat(Npc *npc, s32 idx)
Definition npc.c:1843
Encounter * curEncounter
Definition npc.h:393
struct Evt * aiScript
Definition npc.h:313
EvtScript * auxBytecode
Definition npc.h:309
void npc_remove_decoration_seeing_stars(Npc *npc, s32 idx)
Definition npc.c:1884
s32 bind_enemy_interact(Enemy *enemy, EvtScript *interactScriptBytecode)
Binds the specified interact script to the specified enemy.
Definition npc.c:2469
enum TerritoryShape detectShape
Definition npc.h:227
void npc_update_decoration_none(Npc *npc, s32 idx)
Definition npc.c:1813
f32 chaseOffsetDist
Definition npc.h:103
EnemyTerritory * territory
Definition npc.h:342
Npc * get_npc_safe(s32 npcID)
Definition npc.c:1010
s32 hitScriptID
Definition npc.h:320
Definition npc.h:294
Definition npc.h:243
Zero-terminated.
Definition npc.h:282
Describes heart/flower drop chances after defeating an Npc in the overworld.
Definition npc.h:179
void(* onRender)(struct Npc *)
Definition npc.h:89
void(* onUpdate)(struct Npc *)
Definition npc.h:88
s32 initialAnim
Definition npc.h:87
s32 flags
Definition npc.h:86
#define UNK_PTR
Definition types.h:7