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

Method MoveEvade

src/SB/Game/zNPCGoalRobo.cpp:776–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774}
775
776void zNPCGoalAlertFodder::MoveEvade(F32 dt)
777{
778 // TODO: Variable names.
779 zNPCRobot* npc = (zNPCRobot*)this->psyche->clt_owner;
780 xVec3 r1_0x2C;
781 xVec3 r1_0x20;
782 xVec3 dir_dest;
783 xVec3 dir;
784 F32 length;
785
786 xVec3Sub(&r1_0x2C, npc->arena.Pos(), npc->Pos());
787 length = xVec3Length(&r1_0x2C);
788 if (length < 1.0f)
789 {
790 xVec3Copy(&r1_0x2C, NPCC_rightDir(npc));
791 }
792 else
793 {
794 xVec3SMulBy(&r1_0x2C, 1.0f / length);
795 }
796
797 xVec3Sub(&r1_0x20, xEntGetPos(&globals.player.ent), npc->Pos());
798 length = xVec3Length(&r1_0x20);
799 if (length < 1.0f)
800 {
801 xVec3Copy(&r1_0x20, NPCC_rightDir(&globals.player.ent));
802 }
803 else
804 {
805 xVec3SMulBy(&r1_0x20, 1.0f / length);
806 }
807
808 xVec3SMul(&dir_dest, &r1_0x20, -1.0f);
809 npc->ThrottleAdjust(dt, 6.0f, -1.0f);
810 NPCC_ang_toXZDir(npc->frame->rot.angle + (npc->TurnToFace(dt, &dir_dest, PI * 4)), &dir);
811 npc->ThrottleApply(dt, &dir, 0);
812}
813
814S32 zNPCGoalAlertFodBomb::Enter(F32 dt, void* updCtxt)
815{

Callers 1

ProcessMethod · 0.95

Calls 12

xVec3SubFunction · 0.85
xVec3LengthFunction · 0.85
xVec3CopyFunction · 0.85
NPCC_rightDirFunction · 0.85
xVec3SMulByFunction · 0.85
xEntGetPosFunction · 0.85
xVec3SMulFunction · 0.85
NPCC_ang_toXZDirFunction · 0.85
ThrottleAdjustMethod · 0.80
TurnToFaceMethod · 0.80
ThrottleApplyMethod · 0.80
PosMethod · 0.45

Tested by

no test coverage detected