MCPcopy Create free account
hub / github.com/JACoders/OpenJK / NPC_FindCombatPointRetry

Function NPC_FindCombatPointRetry

code/game/NPC_combat.cpp:2901–3007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2899}
2900
2901int NPC_FindCombatPointRetry( const vec3_t position,
2902 const vec3_t avoidPosition,
2903 vec3_t destPosition,
2904 int *cpFlags,
2905 float avoidDist,
2906 const int ignorePoint )
2907{
2908 int cp = -1;
2909 cp = NPC_FindCombatPoint( position,
2910 avoidPosition,
2911 destPosition,
2912 *cpFlags,
2913 avoidDist,
2914 ignorePoint );
2915 while ( cp == -1 && (*cpFlags&~CP_HAS_ROUTE) != CP_ANY )
2916 {//start "OR"ing out certain flags to see if we can find *any* point
2917 if ( *cpFlags & CP_INVESTIGATE )
2918 {//don't need to investigate
2919 *cpFlags &= ~CP_INVESTIGATE;
2920 }
2921 else if ( *cpFlags & CP_SQUAD )
2922 {//don't need to stick to squads
2923 *cpFlags &= ~CP_SQUAD;
2924 }
2925 else if ( *cpFlags & CP_DUCK )
2926 {//don't need to duck
2927 *cpFlags &= ~CP_DUCK;
2928 }
2929 else if ( *cpFlags & CP_NEAREST )
2930 {//don't need closest one to me
2931 *cpFlags &= ~CP_NEAREST;
2932 }
2933 else if ( *cpFlags & CP_FLANK )
2934 {//don't need to flank enemy
2935 *cpFlags &= ~CP_FLANK;
2936 }
2937 else if ( *cpFlags & CP_SAFE )
2938 {//don't need one that hasn't been shot at recently
2939 *cpFlags &= ~CP_SAFE;
2940 }
2941 else if ( *cpFlags & CP_CLOSEST )
2942 {//don't need to get closest to enemy
2943 *cpFlags &= ~CP_CLOSEST;
2944 //but let's try to approach at least
2945 *cpFlags |= CP_APPROACH_ENEMY;
2946 }
2947 else if ( *cpFlags & CP_APPROACH_ENEMY )
2948 {//don't need to approach enemy
2949 *cpFlags &= ~CP_APPROACH_ENEMY;
2950 }
2951 else if ( *cpFlags & CP_COVER )
2952 {//don't need cover
2953 *cpFlags &= ~CP_COVER;
2954 //but let's pick one that makes us duck
2955 //*cpFlags |= CP_DUCK;
2956 }
2957 // else if ( *cpFlags & CP_CLEAR )
2958 // {//don't need a clear shot to enemy

Callers 3

RT_CheckJumpFunction · 0.85
ST_CommanderFunction · 0.85

Calls 1

NPC_FindCombatPointFunction · 0.70

Tested by

no test coverage detected