| 661 | } |
| 662 | |
| 663 | void zNPCGoalAlertFodder::FlankPlayer(F32 dt) |
| 664 | { |
| 665 | zNPCRobot* npc = (zNPCRobot*)this->psyche->clt_owner; |
| 666 | xVec3 dir_dest; |
| 667 | xVec3 pos_plyr; |
| 668 | xVec3 r1_0x38; |
| 669 | xVec3 r1_0x2C; |
| 670 | xVec3 r1_0x20; |
| 671 | xVec3 r1_0x14; |
| 672 | xVec3 dir; |
| 673 | F32 length; |
| 674 | |
| 675 | zEntPlayer_PredictPos(&dir_dest, 0.5f, 1.0f, 1); |
| 676 | |
| 677 | if (npc->XZDstSqToPlayer(NULL, NULL) < npc->XZDstSqToPos(&dir_dest, NULL, NULL)) |
| 678 | { |
| 679 | xVec3Copy(&dir_dest, xEntGetPos(&globals.player.ent)); |
| 680 | } |
| 681 | |
| 682 | xVec3Sub(&pos_plyr, &dir_dest, npc->arena.Pos()); |
| 683 | length = xVec3Length(&pos_plyr); |
| 684 | if (length < 1.0f) |
| 685 | { |
| 686 | xVec3Copy(&pos_plyr, NPCC_faceDir(&globals.player.ent)); |
| 687 | } |
| 688 | else |
| 689 | { |
| 690 | xVec3SMulBy(&pos_plyr, 1.0f / length); |
| 691 | } |
| 692 | |
| 693 | xVec3Cross(&r1_0x38, &g_Y3, &pos_plyr); |
| 694 | |
| 695 | xVec3Sub(&r1_0x2C, xEntGetPos(&globals.player.ent), npc->Pos()); |
| 696 | length = xVec3Length(&r1_0x2C); |
| 697 | if (length < 1.0f) |
| 698 | { |
| 699 | xVec3Copy(&r1_0x2C, NPCC_rightDir(&globals.player.ent)); |
| 700 | } |
| 701 | else |
| 702 | { |
| 703 | xVec3SMulBy(&r1_0x2C, 1.0f / length); |
| 704 | } |
| 705 | |
| 706 | xVec3Sub(&r1_0x20, npc->arena.Pos(), npc->zNPCCommon::Pos()); |
| 707 | length = xVec3Length(&r1_0x20); |
| 708 | if (length < 1.0f) |
| 709 | { |
| 710 | xVec3Copy(&r1_0x20, NPCC_rightDir(npc)); |
| 711 | } |
| 712 | else |
| 713 | { |
| 714 | xVec3SMulBy(&r1_0x20, 1.0f / length); |
| 715 | } |
| 716 | |
| 717 | xVec3Dot(&r1_0x20, &r1_0x2C); |
| 718 | xVec3Copy(&r1_0x14, &r1_0x2C); |
| 719 | |
| 720 | npc->ThrottleAdjust(dt, 6.0f, -1.0f); |
no test coverage detected