MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / MoveToHome

Method MoveToHome

src/SB/Game/zNPCGoalRobo.cpp:2413–2449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2411}
2412
2413S32 zNPCGoalAlertTubelet::MoveToHome(F32 dt)
2414{
2415 S32 arrived;
2416 zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
2417 NPCArena* arena = &npc->arena;
2418 F32 rad;
2419 F32 dst_surplus;
2420 xVec3 dir_home;
2421
2422 rad = arena->Radius(1.0f) - 15.0f;
2423 if (rad < 0.0f)
2424 {
2425 rad = 0.0f;
2426 }
2427
2428 dst_surplus = xsqrt(npc->XZDstSqToPos(arena->Pos(), &dir_home, 0));
2429 if (dst_surplus < (rad + 1.0f))
2430 {
2431 arrived = 1;
2432 npc->VelStop();
2433 }
2434 else
2435 {
2436 if (dst_surplus > (rad + 2.0f))
2437 {
2438 npc->ThrottleAdjust(dt, 7.2f, 5.5f);
2439 }
2440 else
2441 {
2442 npc->ThrottleAdjust(dt, 0.25f, 0.5f);
2443 }
2444 dir_home *= (1.0f / dst_surplus);
2445 npc->ThrottleApply(dt, &dir_home, 0);
2446 arrived = 0;
2447 }
2448 return arrived;
2449}
2450
2451void zNPCGoalAlertTubelet::PeteAttackBegin()
2452{

Callers

nothing calls this directly

Calls 6

xsqrtFunction · 0.85
RadiusMethod · 0.80
VelStopMethod · 0.80
ThrottleAdjustMethod · 0.80
ThrottleApplyMethod · 0.80
PosMethod · 0.45

Tested by

no test coverage detected