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

Method CirclePlayer

src/SB/Game/zNPCGoalRobo.cpp:1343–1375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1341}
1342
1343void zNPCGoalAlertChomper::CirclePlayer(F32 dt)
1344{
1345 zNPCRobot* npc = (zNPCRobot*)this->psyche->clt_owner;
1346 xVec3 pos_plyr;
1347 xVec3 dir_plyr;
1348
1349 zEntPlayer_PredictPos(&pos_plyr, 1.3f, 1.0f, 0);
1350
1351 if (npc->XZDstSqToPlayer(0, 0) < npc->XZDstSqToPos(&pos_plyr, 0, 0))
1352 {
1353 xVec3Copy(&pos_plyr, xEntGetPos(&globals.player.ent));
1354 }
1355
1356 F32 rot;
1357 npc->XZVecToPlayer(&dir_plyr, NULL);
1358
1359 F32 length = xVec3Length(&dir_plyr);
1360 if (length < 1.0f)
1361 {
1362 xVec3Copy(&dir_plyr, NPCC_rightDir(&globals.player.ent));
1363 }
1364 else
1365 {
1366 xVec3SMulBy(&dir_plyr, 1.0f / length);
1367 }
1368
1369 xVec3 dir_dest = dir_plyr;
1370 xVec3 dir;
1371
1372 npc->ThrottleAdjust(dt, 5.0f, 10.0f);
1373 NPCC_ang_toXZDir(npc->frame->rot.angle + (npc->TurnToFace(dt, &dir_dest, DEG2RAD(270))), &dir);
1374 npc->ThrottleApply(dt, &dir, 0);
1375}
1376
1377void zNPCGoalAlertChomper::GetInArena(F32 dt)
1378{

Callers

nothing calls this directly

Calls 11

xVec3CopyFunction · 0.85
xEntGetPosFunction · 0.85
xVec3LengthFunction · 0.85
NPCC_rightDirFunction · 0.85
xVec3SMulByFunction · 0.85
NPCC_ang_toXZDirFunction · 0.85
XZVecToPlayerMethod · 0.80
ThrottleAdjustMethod · 0.80
TurnToFaceMethod · 0.80
ThrottleApplyMethod · 0.80
zEntPlayer_PredictPosFunction · 0.70

Tested by

no test coverage detected