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

Method SonarHoming

src/SB/Game/zNPCGoalRobo.cpp:961–1041  ·  view source on GitHub ↗

TODO: Cleanup local vars

Source from the content-addressed store, hash-verified

959
960// TODO: Cleanup local vars
961void zNPCGoalAlertFodBomb::SonarHoming(F32 dt)
962{
963 // The var length was not in dwarf. copied from other functions
964 zNPCRobot* npc = (zNPCRobot*)(this->psyche->clt_owner);
965 //xVec3 pos_plyr;
966 xVec3 dir_dest;
967 F32 spd_pursuit;
968 F32 acc_pursuit;
969
970 xVec3 xStack_60;
971 xVec3 xStack_6c;
972 xVec3 xStack_78;
973 xVec3 xStack_84;
974 xVec3 xStack_90;
975 xVec3 xStack_9c;
976 xVec3 dir;
977 //F32 length;
978 //F32 rot;
979
980 zEntPlayer_PredictPos(&xStack_60, 0.5f, 1.0f, 0);
981
982 if (npc->XZDstSqToPlayer(0, 0) < npc->XZDstSqToPos(&xStack_60, 0, 0))
983 {
984 xVec3Copy(&xStack_60, xEntGetPos(&globals.player.ent));
985 }
986
987 xVec3Sub(&xStack_6c, &xStack_60, npc->arena.Pos());
988
989 F32 fVar4 = xVec3Length(&xStack_6c);
990 if (fVar4 < 1.0f)
991 {
992 xVec3Copy(&xStack_6c, NPCC_faceDir(&globals.player.ent));
993 }
994 else
995 {
996 xVec3SMulBy(&xStack_6c, 1.0f / fVar4);
997 }
998
999 xVec3Cross(&xStack_78, &g_Y3, &xStack_6c);
1000 xVec3Sub(&xStack_84, xEntGetPos(&globals.player.ent), npc->Pos());
1001
1002 fVar4 = xVec3Length(&xStack_84);
1003 if (fVar4 < 1.0f)
1004 {
1005 xVec3Copy(&xStack_84, NPCC_rightDir(&globals.player.ent));
1006 }
1007 else
1008 {
1009 xVec3SMulBy(&xStack_84, 1.0f / fVar4);
1010 }
1011
1012 xVec3Sub(&xStack_90, npc->arena.Pos(), npc->zNPCCommon::Pos());
1013
1014 fVar4 = xVec3Length(&xStack_90);
1015 if (fVar4 < 1.0f)
1016 {
1017 xVec3Copy(&xStack_90, NPCC_rightDir(npc));
1018 }

Callers

nothing calls this directly

Calls 15

xVec3CopyFunction · 0.85
xEntGetPosFunction · 0.85
xVec3SubFunction · 0.85
xVec3LengthFunction · 0.85
NPCC_faceDirFunction · 0.85
xVec3SMulByFunction · 0.85
xVec3CrossFunction · 0.85
NPCC_rightDirFunction · 0.85
zGameExtras_CheatFlagsFunction · 0.85
NPCC_ang_toXZDirFunction · 0.85
ThrottleAdjustMethod · 0.80
TurnToFaceMethod · 0.80

Tested by

no test coverage detected