6 Enemy* enemy = script->owner1.enemy;
27 npc->
duration = npcAISettings->chaseUpdateInterval / 2 +
rand_int(npcAISettings->chaseUpdateInterval / 2 + 1);
29 npc->
moveSpeed = npcAISettings->chaseSpeed;
30 detectedPlayer = FALSE;
35 if (npcAISettings->chaseTurnRate <
fabsf(deltaYaw)) {
37 if (deltaYaw < 0.0f) {
38 yawFwd += -npcAISettings->chaseTurnRate;
40 yawFwd += npcAISettings->chaseTurnRate;
56 &posXFwd, &posYFwd, &posZFwd, npc->
moveSpeed * 4.5,
65 &posXCW, &posYCW, &posZCW, npc->
moveSpeed * 4.5,
75 &posXCCW, &posYCCW, &posZCCW, npc->
moveSpeed * 4.5,
83 if ((distFwd < npc->moveSpeed * 1.5) && (distCW < npc->moveSpeed * 1.5) && (distCCW < npc->moveSpeed * 1.5) &&
85 detectedPlayer = TRUE;
88 if (!detectedPlayer) {
89 if ((distCW < distFwd) && (distCCW < distCW)) {
91 }
else if ((distCW < distFwd) && (distCW < distCCW)) {
93 }
else if ((distFwd < distCW) && (distCCW < distFwd)) {
95 }
else if ((distCCW < distCW) && (distFwd < distCCW)) {
97 }
else if ((distFwd < distCCW) && (distCW < distFwd)) {
99 }
else if ((distCW < distCCW) && (distFwd < distCW)) {
104 if (npcAISettings->chaseTurnRate <
fabsf(deltaYaw)) {
106 if (deltaYaw < 0.0f) {
107 yawFwd += -npcAISettings->chaseTurnRate;
109 yawFwd += npcAISettings->chaseTurnRate;
115 if (detectedPlayer) {
123 Enemy* enemy = script->owner1.enemy;
150 Enemy* enemy = script->owner1.enemy;
159API_CALLABLE(N(AvoidPlayerAI_Main)) {
160 Enemy* enemy = script->owner1.enemy;
162 Bytecode* args = script->ptrReadPos;
180 npc->
flags &= ~NPC_FLAG_JUMPING;
183 npc->
flags &= ~NPC_FLAG_FLYING;
185 npc->
flags &= ~NPC_FLAG_GRAVITY;
191 enemy->
aiFlags &= ~AI_FLAG_SUSPEND;
195 switch (script->functionTemp[0]) {
void N AvoidPlayerAI_ChaseInit(Evt *script, MobileAISettings *npcAISettings, EnemyDetectVolume *territory)
void N AvoidPlayerAI_Chase(Evt *script, MobileAISettings *npcAISettings, EnemyDetectVolume *territory)
void N AvoidPlayerAI_LosePlayer(Evt *script, MobileAISettings *npcAISettings, EnemyDetectVolume *territory)
@ ENEMY_ANIM_INDEX_MELEE_PRE
s32 evt_get_variable(Evt *script, Bytecode var)
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
void basic_ai_wander(Evt *script, MobileAISettings *npcAISettings, EnemyDetectVolume *territory)
void basic_ai_found_player_jump_init(Evt *script, MobileAISettings *npcAISettings, EnemyDetectVolume *territory)
void basic_ai_wander_init(Evt *script, MobileAISettings *npcAISettings, EnemyDetectVolume *territory)
void basic_ai_found_player_jump(Evt *script, MobileAISettings *npcAISettings, EnemyDetectVolume *territory)
b32 npc_test_move_simple_without_slipping(s32, f32 *, f32 *, f32 *, f32, f32, f32, f32)
f32 get_clamped_angle_diff(f32, f32)
void basic_ai_loiter_init(Evt *script, MobileAISettings *aiSettings, EnemyDetectVolume *territory)
void basic_ai_suspend(Evt *script)
void basic_ai_loiter(Evt *script, MobileAISettings *npcAISettings, EnemyDetectVolume *territory)
enum TerritoryShape shape
enum TerritoryShape detectShape
s32 basic_ai_check_player_dist(EnemyDetectVolume *arg0, Enemy *arg1, f32 arg2, f32 arg3, b8 arg4)
void npc_surface_spawn_fx(Npc *npc, SurfaceInteractMode mode)
Npc * get_npc_unsafe(s32 npcID)
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
s32 skipPlayerDetectChance
EnemyTerritoryWander wander
EnemyTerritory * territory
PlayerStatus * gPlayerStatusPtr