107 f32 currentX, currentY, currentZ;
110 f32 targetX, targetY, targetZ;
119 targetX = historyPoint->
pos.
x;
120 targetY = historyPoint->
pos.
y;
121 targetZ = historyPoint->
pos.
z;
122 currentX = npc->
pos.
x;
123 currentY = npc->
pos.
y;
124 currentZ = npc->
pos.
z;
138 dist =
dist2D(currentX, currentZ, targetX, targetZ);
139 yaw =
atan2(currentX, currentZ, targetX, targetZ);
141 dist =
dist2D(currentX, currentZ, x, z);
165 if (dist <= followData->idleRadius) {
178 targetX = historyPoint->
pos.
x;
179 targetZ = historyPoint->
pos.
z;
204 targetX = historyPoint->
pos.
x;
205 targetY = historyPoint->
pos.
y;
206 targetZ = historyPoint->
pos.
z;
220 if (dist < followData->idleRadius) {
234 npc->
flags &= ~NPC_FLAG_GRAVITY;
246 currentX = npc->
pos.
x;
248 currentY = npc->
pos.
y + dist;
249 currentZ = npc->
pos.
z;
255 npc->
pos.
y = currentY;
257 npc->
yaw =
atan2(currentX, currentZ, x, z);
264 targetX = historyPoint->
pos.
x;
265 targetY = historyPoint->
pos.
y;
266 targetZ = historyPoint->
pos.
z;
267 currentX = npc->
pos.
x;
268 currentY = npc->
pos.
y;
269 currentZ = npc->
pos.
z;
271 if (dist <= followData->idleRadius) {
294 targetX = historyPoint->
pos.
x;
295 targetZ = historyPoint->
pos.
z;
323 targetX = historyPoint->
pos.
x;
324 targetZ = historyPoint->
pos.
z;
void npc_follow_init(Npc *npc, s32 targetNpcID, FollowAnims *anims, f32 walkSpeed, f32 runSpeed, s32 idleRadius, s32 walkRadius)