42 {
45 s32 cond = FALSE;
46 f32 vt7 = (f32)enemy->varTable[7] / 100.0;
47 f32 vt3 = (f32)enemy->varTable[3] / 100.0;
48 f32 vt4 = (f32)enemy->varTable[4] / 100.0;
49 f32 vt1 = (f32)enemy->varTable[1] / 100.0;
50 f32 posX, posY, posZ, posW;
51 f32 temp_f24;
52
53 enemy->varTable[4] = npc->pos.y * 100.0;
54
55 temp_f24 = vt3 + vt7;
56
57 if ((enemy->varTable[0] & 0x11) == 1) {
59 if (vt1 < temp_f24 - npc->
pos.
y) {
60 enemy->varTable[0] |= 0x10;
61 }
62 } else {
63 posX = npc->pos.x;
64 posY = npc->pos.y;
65 posZ = npc->pos.z;
66 posW = 1000.0f;
68 if (vt1 < (vt3 - posW)) {
69 enemy->varTable[0] |= 0x10;
70 }
71 }
72 }
73
74 if ((enemy->varTable[0] & 0x11) == 0x11) {
75 f64 test;
76 f32 yTemp;
77
79 yTemp = temp_f24;
80 test = vt4 + ((temp_f24 - vt4) * 0.09);
81 npc->pos.y = test;
82 } else {
83 posX = npc->pos.x;
84 posY = vt4;
85 posZ = npc->pos.z;
86 posW = 1000.0f;
88
89 yTemp = posY;
90 yTemp += vt3;
91 test = vt4 + ((yTemp - vt4) * 0.09);
92 npc->pos.y = test;
93 }
94
95 if (
fabsf(yTemp - npc->pos.y) < 1.0) {
96 npc->pos.y = yTemp;
97 enemy->varTable[0] &= ~0x10;
98 }
99 } else {
100 if (enemy->varTable[1] > 0) {
101 f32 sinTemp =
sin_deg(enemy->varTable[2]);
102 s32 hit;
103
105 hit = FALSE;
106 } else {
107 posX = npc->pos.x;
108 posY = npc->pos.y;
109 posZ = npc->pos.z;
110 posW = 1000.0f;
112 }
113
114 if (hit) {
115 npc->pos.y = posY + vt3 + (sinTemp * vt1);
116 } else {
117 npc->pos.y = temp_f24 + (sinTemp * vt1);
118 }
119
120 enemy->varTable[2] =
clamp_angle(enemy->varTable[2] + 10);
121 }
122 }
123
124 if (enemy->varTable[9] <= 0) {
126 if (script->functionTemp[1] <= 0) {
130 {
132 fx_emote(
EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xC, &emoteTemp);
133 npc->moveToPos.y = npc->pos.y;
135
138 } else {
140 }
141 return;
142 }
143 }
144 script->functionTemp[1]--;
145 }
146 } else {
147 enemy->varTable[9]--;
148 }
149
151 enemy->territory->wander.centerPos.x,
152 enemy->territory->wander.centerPos.z,
153 npc->pos.x, npc->pos.z,
154 enemy->territory->wander.wanderSize.x, enemy->territory->wander.wanderSize.z)) {
155 posW =
dist2D(enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z, npc->pos.x, npc->pos.z);
156 if (npc->moveSpeed < posW) {
157 npc->yaw =
atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z);
158 cond = TRUE;
159 }
160 }
161
162 if (enemy->territory->wander.wanderSize.x | enemy->territory->wander.wanderSize.z | cond) {
163 if (npc->turnAroundYawAdjustment != 0) {
164 return;
165 }
167 }
168
169 enemy->varTable[4] = npc->pos.y * 100.0;
171 if ((npc->duration <= 0) || (--npc->duration <= 0)) {
173 script->functionTemp[1] = (
rand_int(1000) % 3) + 2;
174 if (aiSettings->
unk_AI_2C <= 0 || aiSettings->
waitTime <= 0 || script->functionTemp[1] < 3) {
176 }
177 }
178 }
179}
#define npc_raycast_down_sides
@ AI_ACTION_JUMP_WHEN_SEE_PLAYER
void ai_enemy_play_sound(Npc *npc, s32 arg1, s32 arg2)
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by)
s32 basic_ai_check_player_dist(EnemyDetectVolume *arg0, Enemy *arg1, f32 arg2, f32 arg3, b8 arg4)
void npc_move_heading(Npc *npc, f32 speed, f32 yaw)
PlayerStatus * gPlayerStatusPtr