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

Method TurnToFace

src/SB/Game/zNPCTypeCommon.cpp:1451–1482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1449}
1450
1451F32 zNPCCommon::TurnToFace(F32 dt, const xVec3* dir_want, F32 useTurnRate)
1452{
1453 F32 f29 = (useTurnRate < 0.0f) ? (dt * this->cfg_npc->spd_turnMax) : (dt * useTurnRate);
1454 F32 f30 = NPCC_dir_toXZAng(dir_want);
1455 F32 f31 = NPCC_dir_toXZAng(NPCC_faceDir(this));
1456
1457 F32 f28 = this->frame->rot.angle;
1458 if (this->frame->mode & 0x20)
1459 {
1460 f28 += this->frame->drot.angle;
1461 }
1462
1463 F32 f1_ = xDangleClamp(f30 - f28);
1464 F32 f2_ = CLAMP(f1_, -f29, f29);
1465 F32 f3 = f28 + f2_;
1466 F32 f2 = CLAMP(f3, f31 - f29, f31 + f29);
1467 F32 f1 = f2 - f28;
1468
1469 this->frame->drot.angle = f1;
1470 this->frame->mode |= 0x20;
1471
1472 return f1;
1473
1474 /*
1475 F32 ang_caller;
1476 F32 ang_wouldbe;
1477 F32 rot_lim;
1478 F32 ang_true;
1479 F32 ang_past;
1480 F32 ang_diff;
1481 */
1482}
1483
1484void zNPCCommon::ParseLinks()
1485{

Callers 9

ProcessMethod · 0.80
FlankPlayerMethod · 0.80
GetInArenaMethod · 0.80
MoveEvadePosMethod · 0.80
MoveEvadeMethod · 0.80
SonarHomingMethod · 0.80
CirclePlayerMethod · 0.80
ProcessMethod · 0.80
ProcessMethod · 0.80

Calls 3

NPCC_dir_toXZAngFunction · 0.85
NPCC_faceDirFunction · 0.85
xDangleClampFunction · 0.50

Tested by

no test coverage detected