3#include "sprite/npc/Lakitu.h"
6#ifndef AI_LAKITU_FIRST_SPINY_ID
7#error AI_LAKITU_FIRST_SPINY_ID must be defined for LakituAI
8#define AI_LAKITU_FIRST_SPINY_ID 0
10#ifndef AI_LAKITU_LAST_SPINY_ID
11#error AI_LAKITU_LAST_SPINY_ID must be defined for LakituAI
12#define AI_LAKITU_LAST_SPINY_ID 0
22 if (
get_enemy(npcID)->varTable[10] == 0) {
31 Enemy* enemy = script->owner1.enemy;
38 f32 var1 = enemy->varTable[4];
39 f32 var2 = enemy->varTable[3];
42 temp_f22 = var1 / 100.0;
43 temp_f24 = var2 / 100.0;
47 var3 = enemy->varTable[1];
48 temp_f20 = var3 / 100.0;
56 npc->
pos.
y = y + temp_f24 + (
sin_deg(enemy->varTable[2]) * temp_f20);
57 enemy->varTable[2] =
clamp_angle(enemy->varTable[2] + 12);
59 if (aiSettings->playerSearchInterval >= 0) {
60 if (script->functionTemp[1] <= 0) {
61 script->functionTemp[1] = aiSettings->playerSearchInterval;
71 script->functionTemp[0] = 12;
75 script->functionTemp[1]--;
87 if (enemy->varTable[0] & 1) {
97 }
else if (w < -2.0) {
102 enemy->varTable[4] = (temp_f22 * 100.0);
108 script->functionTemp[0] = 2;
109 script->functionTemp[1] = (
rand_int(1000) % 3) + 2;
110 if ((aiSettings->unk_AI_2C <= 0) || (aiSettings->moveTime <= 0) || (script->functionTemp[1] == 0)) {
111 script->functionTemp[0] = 0;
117 Enemy* enemy = script->owner1.enemy;
119 f32 posX, posY, posZ, hitDepth;
121 f32 var1 = enemy->varTable[3];
126 temp_f22 = var1 / 100.0;
130 var2 = enemy->varTable[1];
131 temp_f20 = var2 / 100.0;
139 npc->
pos.
y = posY + temp_f22 + (
sin_deg(enemy->varTable[2]) * temp_f20);
140 enemy->varTable[2] =
clamp_angle(enemy->varTable[2] + 12);
149 script->functionTemp[1]--;
150 if (script->functionTemp[1] > 0) {
159API_CALLABLE(N(LakituAI_Main)) {
160 Enemy* enemy = script->owner1.enemy;
161 Bytecode* args = script->ptrReadPos;
187 enemy->
aiFlags &= ~AI_FLAG_SUSPEND;
190 switch (script->AI_TEMP_STATE) {
208 if (enemy->varTable[4] >= 0) {
209 spinyEnemy =
get_enemy(enemy->varTable[4]);
210 spinyEnemy->varTable[10] = 1;
211 spinyEnemy->varTable[11] = enemy->
npcID;
213 npc->
curAnim = ANIM_Lakitu_Anim14;
214 script->AI_TEMP_STATE = 30;
218 switch (script->AI_TEMP_STATE) {
230 switch (script->AI_TEMP_STATE) {
236 spinyEnemy =
get_enemy(enemy->varTable[4]);
237 spinyEnemy->varTable[10] = 2;
246 npc->
curAnim = ANIM_Lakitu_Anim15;
247 spinyEnemy =
get_enemy(enemy->varTable[4]);
248 spinyEnemy->varTable[10] = 3;
279 lerpDist = playerDist - 20.0;
280 if (lerpDist < 0.0) {
283 if (lerpDist > 200.0) {
void N FlyingAI_ChaseInit(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
void N FlyingAI_LoiterInit(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
void N FlyingAI_Init(Npc *npc, Enemy *enemy, Evt *script, MobileAISettings *aiSettings)
void N FlyingAI_WanderInit(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
void N FlyingAI_Chase(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
void N FlyingAI_LosePlayer(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
#define AI_LAKITU_LAST_SPINY_ID
void N LakituAI_Loiter(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
#define AI_LAKITU_FIRST_SPINY_ID
void N LakituAI_Wander(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
s32 N LakituAI_GetAvailableSpiny(void)
#define npc_raycast_down_sides
@ AI_STATE_PROJECTILE_HITBOX_30
@ AI_STATE_PROJECTILE_HITBOX_32
@ AI_STATE_PROJECTILE_HITBOX_31
@ AI_STATE_PROJECTILE_HITBOX_33
s32 evt_get_variable(Evt *script, Bytecode var)
f32 update_lerp(s32 easing, f32 start, f32 end, s32 elapsed, s32 duration)
b32 is_point_outside_territory(s32 shape, f32 centerX, f32 centerZ, f32 pointX, f32 pointZ, f32 sizeX, f32 sizeZ)
void ai_enemy_play_sound(Npc *npc, s32 arg1, s32 arg2)
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
enum TerritoryShape shape
enum TerritoryShape detectShape
s32 basic_ai_check_player_dist(EnemyDetectVolume *arg0, Enemy *arg1, f32 arg2, f32 arg3, b8 arg4)
Enemy * get_enemy(s32 npcID)
Looks for an enemy matching the specified npcID.
Npc * get_npc_unsafe(s32 npcID)
enum TerritoryShape wanderShape
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
s32 skipPlayerDetectChance
EnemyTerritoryWander wander
EnemyTerritory * territory
s16 turnAroundYawAdjustment
PlayerStatus * gPlayerStatusPtr