codemp/game/b_local.h File Reference

#include "g_local.h"
#include "b_public.h"
#include "say.h"
#include "ai.h"

Go to the source code of this file.

Data Structures

struct  navInfo_s

Defines

#define AI_TIMERS   0
#define NAVF_DUCK   0x00000001
#define NAVF_JUMP   0x00000002
#define NAVF_HOLD   0x00000004
#define NAVF_SLOW   0x00000008
#define DEBUG_LEVEL_DETAIL   4
#define DEBUG_LEVEL_INFO   3
#define DEBUG_LEVEL_WARNING   2
#define DEBUG_LEVEL_ERROR   1
#define DEBUG_LEVEL_NONE   0
#define MAX_GOAL_REACHED_DIST_SQUARED   256
#define MIN_ANGLE_ERROR   0.01f
#define MIN_ROCKET_DIST_SQUARED   16384
#define COLLISION_RADIUS   32
#define NUM_POSITIONS   30
#define SFB_SMALLHULL   1
#define SFB_RIFLEMAN   2
#define SFB_OLDBORG   2
#define SFB_PHASER   4
#define SFB_GUN   4
#define SFB_TRICORDER   8
#define SFB_TASER   8
#define SFB_DRILL   16
#define SFB_CINEMATIC   32
#define SFB_NOTSOLID   64
#define SFB_STARTINSOLID   128
#define ALERT_CLEAR_TIME   200
#define CHECK_PVS   1
#define CHECK_360   2
#define CHECK_FOV   4
#define CHECK_SHOOT   8
#define CHECK_VISRANGE   16
#define CP_ANY   0
#define CP_COVER   0x00000001
#define CP_CLEAR   0x00000002
#define CP_FLEE   0x00000004
#define CP_DUCK   0x00000008
#define CP_NEAREST   0x00000010
#define CP_AVOID_ENEMY   0x00000020
#define CP_INVESTIGATE   0x00000040
#define CP_SQUAD   0x00000080
#define CP_AVOID   0x00000100
#define CP_APPROACH_ENEMY   0x00000200
#define CP_CLOSEST   0x00000400
#define CP_FLANK   0x00000800
#define CP_HAS_ROUTE   0x00001000
#define CP_SNIPE   0x00002000
#define CP_SAFE   0x00004000
#define CP_HORZ_DIST_COLL   0x00008000
#define CP_NO_PVS   0x00010000
#define CP_RETREAT   0x00020000
#define CPF_NONE   0
#define CPF_DUCK   0x00000001
#define CPF_FLEE   0x00000002
#define CPF_INVESTIGATE   0x00000004
#define CPF_SQUAD   0x00000008
#define CPF_LEAN   0x00000010
#define CPF_SNIPE   0x00000020
#define MAX_COMBAT_POINT_CHECK   32
#define NIF_NONE   0x00000000
#define NIF_FAILED   0x00000001
#define NIF_MACRO_NAV   0x00000002
#define NIF_COLLISION   0x00000004
#define NIF_BLOCKED   0x00000008

Typedefs

typedef navInfo_s navInfo_t

Functions

void SetNPCGlobals (gentity_t *ent)
void SaveNPCGlobals (void)
void RestoreNPCGlobals (void)
void NPC_Think (gentity_t *self)
void NPC_Pain (gentity_t *self, gentity_t *attacker, int damage)
void NPC_Touch (gentity_t *self, gentity_t *other, trace_t *trace)
void NPC_Use (gentity_t *self, gentity_t *other, gentity_t *activator)
float NPC_GetPainChance (gentity_t *self, int damage)
void Debug_Printf (vmCvar_t *cv, int level, char *fmt,...)
void Debug_NPCPrintf (gentity_t *printNPC, vmCvar_t *cv, int debugLevel, char *fmt,...)
qboolean NPC_CheckInvestigate (int alertEventNum)
qboolean NPC_StandTrackAndShoot (gentity_t *NPC, qboolean canDuck)
void NPC_BSIdle (void)
void NPC_BSPointShoot (qboolean shoot)
void NPC_BSStandGuard (void)
void NPC_BSPatrol (void)
void NPC_BSHuntAndKill (void)
void NPC_BSStandAndShoot (void)
void NPC_BSRunAndShoot (void)
void NPC_BSWait (void)
void NPC_BSDefault (void)
void NPC_BSAdvanceFight (void)
void NPC_BSInvestigate (void)
void NPC_BSSleep (void)
void NPC_BSFlee (void)
void NPC_BSFollowLeader (void)
void NPC_BSJump (void)
void NPC_BSRemove (void)
void NPC_BSSearch (void)
void NPC_BSSearchStart (int homeWp, bState_t bState)
void NPC_BSWander (void)
void NPC_StartFlee (gentity_t *enemy, vec3_t dangerPoint, int dangerLevel, int fleeTimeMin, int fleeTimeMax)
void G_StartFlee (gentity_t *self, gentity_t *enemy, vec3_t dangerPoint, int dangerLevel, int fleeTimeMin, int fleeTimeMax)
int ChooseBestWeapon (void)
void NPC_ChangeWeapon (int newWeapon)
void ShootThink (void)
void WeaponThink (qboolean inCombat)
qboolean HaveWeapon (int weapon)
qboolean CanShoot (gentity_t *ent, gentity_t *shooter)
void NPC_CheckPossibleEnemy (gentity_t *other, visibility_t vis)
gentity_tNPC_PickEnemy (gentity_t *closestTo, int enemyTeam, qboolean checkVis, qboolean findPlayersFirst, qboolean findClosest)
gentity_tNPC_CheckEnemy (qboolean findNew, qboolean tooFarOk, qboolean setEnemy)
qboolean NPC_CheckAttack (float scale)
qboolean NPC_CheckDefend (float scale)
qboolean NPC_CheckCanAttack (float attack_scale, qboolean stationary)
int NPC_AttackDebounceForWeapon (void)
qboolean EntIsGlass (gentity_t *check)
qboolean ShotThroughGlass (trace_t *tr, gentity_t *target, vec3_t spot, int mask)
qboolean ValidEnemy (gentity_t *ent)
void G_ClearEnemy (gentity_t *self)
gentity_tNPC_PickAlly (qboolean facingEachOther, float range, qboolean ignoreGroup, qboolean movingOnly)
void NPC_LostEnemyDecideChase (void)
float NPC_MaxDistSquaredForWeapon (void)
qboolean NPC_EvaluateShot (int hit, qboolean glassOK)
int NPC_ShotEntity (gentity_t *ent, vec3_t impactPos)
qboolean NPC_SlideMoveToGoal (void)
float NPC_FindClosestTeammate (gentity_t *self)
void NPC_CalcClosestFormationSpot (gentity_t *self)
void G_MaintainFormations (gentity_t *self)
void NPC_BSFormation (void)
void NPC_CreateFormation (gentity_t *self)
void NPC_DropFormation (gentity_t *self)
void NPC_ReorderFormation (gentity_t *self)
void NPC_InsertIntoFormation (gentity_t *self)
void NPC_DeleteFromFormation (gentity_t *self)
void SetGoal (gentity_t *goal, float rating)
void NPC_SetGoal (gentity_t *goal, float rating)
void NPC_ClearGoal (void)
void NPC_ReachedGoal (void)
qboolean ReachedGoal (gentity_t *goal)
gentity_tUpdateGoal (void)
qboolean NPC_ClearPathToGoal (vec3_t dir, gentity_t *goal)
qboolean NPC_MoveToGoal (qboolean tryStraight)
qboolean CanSee (gentity_t *ent)
qboolean InFOV (gentity_t *ent, gentity_t *from, int hFOV, int vFOV)
qboolean InFOV2 (vec3_t origin, gentity_t *from, int hFOV, int vFOV)
qboolean InFOV3 (vec3_t spot, vec3_t from, vec3_t fromAngles, int hFOV, int vFOV)
visibility_t NPC_CheckVisibility (gentity_t *ent, int flags)
qboolean InVisrange (gentity_t *ent)
void NPC_Spawn (gentity_t *ent, gentity_t *other, gentity_t *activator)
int NPC_ReactionTime (void)
qboolean NPC_ParseParms (const char *NPCName, gentity_t *NPC)
void NPC_LoadParms (void)
void CalcEntitySpot (const gentity_t *ent, const spot_t spot, vec3_t point)
qboolean NPC_UpdateAngles (qboolean doPitch, qboolean doYaw)
void NPC_UpdateShootAngles (vec3_t angles, qboolean doPitch, qboolean doYaw)
qboolean NPC_UpdateFiringAngles (qboolean doPitch, qboolean doYaw)
void SetTeamNumbers (void)
qboolean G_ActivateBehavior (gentity_t *self, int bset)
void NPC_AimWiggle (vec3_t enemy_org)
void NPC_SetLookTarget (gentity_t *self, int entNum, int clearTime)
int NAV_FindClosestWaypointForEnt (gentity_t *ent, int targWp)
qboolean NAV_CheckAhead (gentity_t *self, vec3_t end, trace_t *trace, int clipmask)
float IdealDistance (gentity_t *self)
void NPC_SetSayState (gentity_t *self, gentity_t *to, int saying)
qboolean G_CheckInSolid (gentity_t *self, qboolean fix)
void NPC_SetAnim (gentity_t *ent, int type, int anim, int priority)
qboolean NPC_EnemyTooFar (gentity_t *enemy, float dist, qboolean toShoot)
void NPC_SetBoneAngles (gentity_t *ent, char *bone, vec3_t angles)
void NPC_SetSurfaceOnOff (gentity_t *ent, const char *surfaceName, int surfaceFlags)
qboolean NPC_ClearLOS (const vec3_t start, const vec3_t end)
qboolean NPC_ClearLOS5 (const vec3_t end)
qboolean NPC_ClearLOS4 (gentity_t *ent)
qboolean NPC_ClearLOS3 (const vec3_t start, gentity_t *ent)
qboolean NPC_ClearLOS2 (gentity_t *ent, const vec3_t end)
qboolean NPC_ClearShot (gentity_t *ent)
int NPC_FindCombatPoint (const vec3_t position, const vec3_t avoidPosition, vec3_t enemyPosition, const int flags, const float avoidDist, const int ignorePoint)
qboolean NPC_ReserveCombatPoint (int combatPointID)
qboolean NPC_FreeCombatPoint (int combatPointID, qboolean failed)
qboolean NPC_SetCombatPoint (int combatPointID)
qboolean NPC_ValidEnemy (gentity_t *ent)
qboolean NPC_CheckEnemyExt (qboolean checkAlerts)
qboolean NPC_FindPlayer (void)
qboolean NPC_CheckCanAttackExt (void)
int NPC_CheckAlertEvents (qboolean checkSight, qboolean checkSound, int ignoreAlert, qboolean mustHaveOwner, int minAlertLevel)
qboolean NPC_CheckForDanger (int alertEvent)
void G_AlertTeam (gentity_t *victim, gentity_t *attacker, float radius, float soundDist)
int NPC_FindSquadPoint (vec3_t position)
void ClearPlayerAlertEvents (void)
qboolean G_BoundsOverlap (const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2)
qboolean NAV_HitNavGoal (vec3_t point, vec3_t mins, vec3_t maxs, vec3_t dest, int radius, qboolean flying)
void NPC_SetMoveGoal (gentity_t *ent, vec3_t point, int radius, qboolean isNavGoal, int combatPoint, gentity_t *targetEnt)
qboolean NAV_ClearPathToPoint (gentity_t *self, vec3_t pmins, vec3_t pmaxs, vec3_t point, int clipmask, int okToHitEnt)
void NPC_ApplyWeaponFireDelay (void)
qboolean NPC_FacePosition (vec3_t position, qboolean doPitch)
qboolean NPC_FaceEntity (gentity_t *ent, qboolean doPitch)
qboolean NPC_FaceEnemy (qboolean doPitch)
int NAV_MoveToGoal (gentity_t *self, navInfo_t *info)
void NAV_GetLastMove (navInfo_t *info)
qboolean NAV_AvoidCollision (gentity_t *self, gentity_t *goal, navInfo_t *info)

Variables

vmCvar_t debugNPCAI
vmCvar_t debugNPCFreeze
vmCvar_t debugNPCAimingBeam
vmCvar_t debugBreak
vmCvar_t debugNoRoam
vmCvar_t d_JediAI
vmCvar_t d_saberCombat
gentity_tNPC
gNPC_tNPCInfo
gclient_tclient
usercmd_t ucmd
visibility_t enemyVisibility
int teamNumbers [TEAM_NUM_TEAMS]
int teamStrength [TEAM_NUM_TEAMS]
int teamCounter [TEAM_NUM_TEAMS]
vmCvar_t g_spskill


Define Documentation

#define AI_TIMERS   0
 

Definition at line 12 of file b_local.h.

#define ALERT_CLEAR_TIME   200
 

Definition at line 164 of file b_local.h.

Referenced by ClearPlayerAlertEvents(), and CorpsePhysics().

#define CHECK_360   2
 

Definition at line 166 of file b_local.h.

Referenced by NPC_BSFollowLeader(), NPC_CheckCanAttack(), NPC_CheckPossibleEnemy(), NPC_CheckVisibility(), NPC_PickAlly(), and NPC_PickEnemy().

#define CHECK_FOV   4
 

Definition at line 167 of file b_local.h.

Referenced by NPC_BSAdvanceFight(), NPC_BSFollowLeader(), NPC_BSHuntAndKill(), NPC_CheckCanAttack(), NPC_CheckPossibleEnemy(), NPC_CheckVisibility(), and NPC_PickEnemy().

#define CHECK_PVS   1
 

Definition at line 165 of file b_local.h.

Referenced by NPC_BSFollowLeader(), and NPC_CheckVisibility().

#define CHECK_SHOOT   8
 

Definition at line 168 of file b_local.h.

Referenced by NPC_BSFollowLeader(), NPC_BSHuntAndKill(), and NPC_CheckVisibility().

#define CHECK_VISRANGE   16
 

Definition at line 169 of file b_local.h.

Referenced by NPC_CheckVisibility(), NPC_PickAlly(), and NPC_PickEnemy().

#define COLLISION_RADIUS   32
 

Definition at line 133 of file b_local.h.

#define CP_ANY   0
 

Definition at line 243 of file b_local.h.

Referenced by ST_Commander().

#define CP_APPROACH_ENEMY   0x00000200
 

Definition at line 253 of file b_local.h.

Referenced by NPC_FindCombatPoint(), ST_Commander(), and ST_GetCPFlags().

#define CP_AVOID   0x00000100
 

Definition at line 252 of file b_local.h.

Referenced by NPC_FindCombatPoint(), NPC_StartFlee(), ST_Commander(), and ST_GetCPFlags().

#define CP_AVOID_ENEMY   0x00000020
 

Definition at line 249 of file b_local.h.

Referenced by NPC_FindCombatPoint(), and ST_Commander().

#define CP_CLEAR   0x00000002
 

Definition at line 245 of file b_local.h.

Referenced by NPC_FindCombatPoint(), ST_ApproachEnemy(), ST_Commander(), and ST_GetCPFlags().

#define CP_CLOSEST   0x00000400
 

Definition at line 254 of file b_local.h.

Referenced by ST_ApproachEnemy(), ST_Commander(), and ST_GetCPFlags().

#define CP_COVER   0x00000001
 

Definition at line 244 of file b_local.h.

Referenced by NPC_FindCombatPoint(), NPC_StartFlee(), ST_Commander(), and ST_GetCPFlags().

#define CP_DUCK   0x00000008
 

Definition at line 247 of file b_local.h.

Referenced by ST_Commander().

#define CP_FLANK   0x00000800
 

Definition at line 255 of file b_local.h.

Referenced by NPC_FindCombatPoint(), ST_Commander(), and ST_GetCPFlags().

#define CP_FLEE   0x00000004
 

Definition at line 246 of file b_local.h.

Referenced by ST_Commander(), and ST_GetCPFlags().

#define CP_HAS_ROUTE   0x00001000
 

Definition at line 256 of file b_local.h.

Referenced by NPC_FindCombatPoint(), NPC_StartFlee(), and ST_Commander().

#define CP_HORZ_DIST_COLL   0x00008000
 

Definition at line 259 of file b_local.h.

Referenced by NPC_FindCombatPoint().

#define CP_INVESTIGATE   0x00000040
 

Definition at line 250 of file b_local.h.

Referenced by ST_Commander().

#define CP_NEAREST   0x00000010
 

Definition at line 248 of file b_local.h.

Referenced by NPC_FindCombatPoint(), ST_Commander(), and ST_GetCPFlags().

#define CP_NO_PVS   0x00010000
 

Definition at line 260 of file b_local.h.

Referenced by NPC_FindCombatPoint(), and NPC_StartFlee().

#define CP_RETREAT   0x00020000
 

Definition at line 261 of file b_local.h.

Referenced by NPC_FindCombatPoint(), ST_Commander(), and ST_GetCPFlags().

#define CP_SAFE   0x00004000
 

Definition at line 258 of file b_local.h.

Referenced by ST_Commander(), and ST_GetCPFlags().

#define CP_SNIPE   0x00002000
 

Definition at line 257 of file b_local.h.

#define CP_SQUAD   0x00000080
 

Definition at line 251 of file b_local.h.

Referenced by ST_Commander().

#define CPF_DUCK   0x00000001
 

Definition at line 264 of file b_local.h.

Referenced by ST_Commander().

#define CPF_FLEE   0x00000002
 

Definition at line 265 of file b_local.h.

#define CPF_INVESTIGATE   0x00000004
 

Definition at line 266 of file b_local.h.

#define CPF_LEAN   0x00000010
 

Definition at line 268 of file b_local.h.

#define CPF_NONE   0
 

Definition at line 263 of file b_local.h.

#define CPF_SNIPE   0x00000020
 

Definition at line 269 of file b_local.h.

#define CPF_SQUAD   0x00000008
 

Definition at line 267 of file b_local.h.

Referenced by NPC_FindSquadPoint().

#define DEBUG_LEVEL_DETAIL   4
 

Definition at line 22 of file b_local.h.

Referenced by Debug_NPCPrintf(), and Debug_Printf().

#define DEBUG_LEVEL_ERROR   1
 

Definition at line 25 of file b_local.h.

Referenced by Debug_NPCPrintf(), and Debug_Printf().

#define DEBUG_LEVEL_INFO   3
 

Definition at line 23 of file b_local.h.

Referenced by Debug_NPCPrintf(), Debug_Printf(), and NPC_PickEnemy().

#define DEBUG_LEVEL_NONE   0
 

Definition at line 26 of file b_local.h.

#define DEBUG_LEVEL_WARNING   2
 

Definition at line 24 of file b_local.h.

Referenced by Debug_NPCPrintf(), and Debug_Printf().

#define MAX_COMBAT_POINT_CHECK   32
 

Definition at line 271 of file b_local.h.

#define MAX_GOAL_REACHED_DIST_SQUARED   256
 

Definition at line 28 of file b_local.h.

#define MIN_ANGLE_ERROR   0.01f
 

Definition at line 29 of file b_local.h.

Referenced by NPC_BSJump(), and NPC_UpdateAngles().

#define MIN_ROCKET_DIST_SQUARED   16384
 

Definition at line 31 of file b_local.h.

Referenced by Boba_FireDecide(), NPC_BSST_Attack(), and ST_Commander().

#define NAVF_DUCK   0x00000001
 

Definition at line 17 of file b_local.h.

#define NAVF_HOLD   0x00000004
 

Definition at line 19 of file b_local.h.

#define NAVF_JUMP   0x00000002
 

Definition at line 18 of file b_local.h.

#define NAVF_SLOW   0x00000008
 

Definition at line 20 of file b_local.h.

#define NIF_BLOCKED   0x00000008
 

Definition at line 306 of file b_local.h.

Referenced by NAV_AvoidCollision(), and NAV_TestForBlocked().

#define NIF_COLLISION   0x00000004
 

Definition at line 305 of file b_local.h.

Referenced by NAV_AvoidCollision(), and NAVNEW_AvoidCollision().

#define NIF_FAILED   0x00000001
 

Definition at line 303 of file b_local.h.

#define NIF_MACRO_NAV   0x00000002
 

Definition at line 304 of file b_local.h.

Referenced by NPC_GetMoveDirection(), and NPC_GetMoveDirectionAltRoute().

#define NIF_NONE   0x00000000
 

Definition at line 302 of file b_local.h.

#define NUM_POSITIONS   30
 

Definition at line 134 of file b_local.h.

#define SFB_CINEMATIC   32
 

Definition at line 147 of file b_local.h.

Referenced by NPC_Begin(), and NPC_SetMiscDefaultData().

#define SFB_DRILL   16
 

Definition at line 145 of file b_local.h.

#define SFB_GUN   4
 

Definition at line 142 of file b_local.h.

#define SFB_NOTSOLID   64
 

Definition at line 148 of file b_local.h.

Referenced by NPC_Begin().

#define SFB_OLDBORG   2
 

Definition at line 140 of file b_local.h.

#define SFB_PHASER   4
 

Definition at line 141 of file b_local.h.

Referenced by NPC_WeaponsForTeam().

#define SFB_RIFLEMAN   2
 

Definition at line 139 of file b_local.h.

Referenced by NPC_WeaponsForTeam().

#define SFB_SMALLHULL   1
 

Definition at line 137 of file b_local.h.

#define SFB_STARTINSOLID   128
 

Definition at line 149 of file b_local.h.

Referenced by NPC_Begin().

#define SFB_TASER   8
 

Definition at line 144 of file b_local.h.

#define SFB_TRICORDER   8
 

Definition at line 143 of file b_local.h.


Typedef Documentation

typedef struct navInfo_s navInfo_t
 

Referenced by AI_CheckEnemyCollision(), NAV_AvoidCollision(), NAV_GetLastMove(), NAV_MoveToGoal(), NAVNEW_AvoidCollision(), NAVNEW_MoveToGoal(), and NPC_GetMoveDirectionAltRoute().


Function Documentation

void CalcEntitySpot const gentity_t ent,
const spot_t  spot,
vec3_t  point
 

Definition at line 20 of file NPC_utils.c.

References entityShared_t::absmax, entityShared_t::absmin, AngleVectors(), CalcMuzzlePoint(), CLASS_ATST, gentity_s::client, entityShared_t::currentOrigin, trace_t::endpos, renderInfo_s::eyePoint, trace_t::fraction, gentity_t, entityState_s::groundEntityNum, MASK_PLAYERSOLID, entityShared_t::maxs, entityShared_t::mins, gentity_s::NPC, gclient_s::NPC_class, entityState_s::number, gclient_s::ps, gentity_s::r, gclient_s::renderInfo, gentity_s::s, gNPC_t::shootAngles, SPOT_CHEST, SPOT_GROUND, SPOT_HEAD, SPOT_HEAD_LEAN, SPOT_LEGS, SPOT_ORIGIN, SPOT_WEAPON, trap_Trace(), vec3_origin, vec3_t, VectorCopy, VectorMA, VectorSubtract, playerState_s::viewangles, and playerState_s::viewheight.

Referenced by Boba_FireDecide(), CanSee(), CanShoot(), G_CheckAlertEvents(), G_ClearLOS2(), G_ClearLOS3(), G_ClearLOS4(), G_ClearLOS5(), G_FindLocalInterestPoint(), ImperialProbe_FireBlaster(), InFOV(), InFOV2(), InVisrange(), Mark1_FireBlaster(), Mark1_FireRocket(), Mark2_FireBlaster(), NPC_BSAdvanceFight(), NPC_BSCinematic(), NPC_BSFollowLeader(), NPC_BSGM_Attack(), NPC_BSPointShoot(), NPC_CheckCanAttack(), NPC_ClearShot(), NPC_FaceEntity(), NPC_FacePosition(), NPC_ShotEntity(), Remote_Fire(), Seeker_Fire(), Sniper_FaceEnemy(), and Sniper_UpdateEnemyPos().

00021 {
00022         vec3_t  forward, up, right;
00023         vec3_t  start, end;
00024         trace_t tr;
00025 
00026         if ( !ent )
00027         {
00028                 return;
00029         }
00030         switch ( spot ) 
00031         {
00032         case SPOT_ORIGIN:
00033                 if(VectorCompare(ent->r.currentOrigin, vec3_origin))
00034                 {//brush
00035                         VectorSubtract(ent->r.absmax, ent->r.absmin, point);//size
00036                         VectorMA(ent->r.absmin, 0.5, point, point);
00037                 }
00038                 else
00039                 {
00040                         VectorCopy ( ent->r.currentOrigin, point );
00041                 }
00042                 break;
00043 
00044         case SPOT_CHEST:
00045         case SPOT_HEAD:
00046                 if ( ent->client && VectorLengthSquared( ent->client->renderInfo.eyePoint ) /*&& (ent->client->ps.viewEntity <= 0 || ent->client->ps.viewEntity >= ENTITYNUM_WORLD)*/ )
00047                 {//Actual tag_head eyespot!
00048                         //FIXME: Stasis aliens may have a problem here...
00049                         VectorCopy( ent->client->renderInfo.eyePoint, point );
00050                         if ( ent->client->NPC_class == CLASS_ATST )
00051                         {//adjust up some
00052                                 point[2] += 28;//magic number :)
00053                         }
00054                         if ( ent->NPC )
00055                         {//always aim from the center of my bbox, so we don't wiggle when we lean forward or backwards
00056                                 point[0] = ent->r.currentOrigin[0];
00057                                 point[1] = ent->r.currentOrigin[1];
00058                         }
00059                         /*
00060                         else if (ent->s.eType == ET_PLAYER )
00061                         {
00062                                 SubtractLeanOfs( ent, point );
00063                         }
00064                         */
00065                 }
00066                 else
00067                 {
00068                         VectorCopy ( ent->r.currentOrigin, point );
00069                         if ( ent->client ) 
00070                         {
00071                                 point[2] += ent->client->ps.viewheight;
00072                         }
00073                 }
00074                 if ( spot == SPOT_CHEST && ent->client )
00075                 {
00076                         if ( ent->client->NPC_class != CLASS_ATST )
00077                         {//adjust up some
00078                                 point[2] -= ent->r.maxs[2]*0.2f;
00079                         }
00080                 }
00081                 break;
00082 
00083         case SPOT_HEAD_LEAN:
00084                 if ( ent->client && VectorLengthSquared( ent->client->renderInfo.eyePoint ) /*&& (ent->client->ps.viewEntity <= 0 || ent->client->ps.viewEntity >= ENTITYNUM_WORLD*/ )
00085                 {//Actual tag_head eyespot!
00086                         //FIXME: Stasis aliens may have a problem here...
00087                         VectorCopy( ent->client->renderInfo.eyePoint, point );
00088                         if ( ent->client->NPC_class == CLASS_ATST )
00089                         {//adjust up some
00090                                 point[2] += 28;//magic number :)
00091                         }
00092                         if ( ent->NPC )
00093                         {//always aim from the center of my bbox, so we don't wiggle when we lean forward or backwards
00094                                 point[0] = ent->r.currentOrigin[0];
00095                                 point[1] = ent->r.currentOrigin[1];
00096                         }
00097                         /*
00098                         else if ( ent->s.eType == ET_PLAYER )
00099                         {
00100                                 SubtractLeanOfs( ent, point );
00101                         }
00102                         */
00103                         //NOTE: automatically takes leaning into account!
00104                 }
00105                 else
00106                 {
00107                         VectorCopy ( ent->r.currentOrigin, point );
00108                         if ( ent->client ) 
00109                         {
00110                                 point[2] += ent->client->ps.viewheight;
00111                         }
00112                         //AddLeanOfs ( ent, point );
00113                 }
00114                 break;
00115 
00116         //FIXME: implement...
00117         //case SPOT_CHEST:
00118                 //Returns point 3/4 from tag_torso to tag_head?
00119                 //break;
00120 
00121         case SPOT_LEGS:
00122                 VectorCopy ( ent->r.currentOrigin, point );
00123                 point[2] += (ent->r.mins[2] * 0.5);
00124                 break;
00125 
00126         case SPOT_WEAPON:
00127                 if( ent->NPC && !VectorCompare( ent->NPC->shootAngles, vec3_origin ) && !VectorCompare( ent->NPC->shootAngles, ent->client->ps.viewangles ))
00128                 {
00129                         AngleVectors( ent->NPC->shootAngles, forward, right, up );
00130                 }
00131                 else
00132                 {
00133                         AngleVectors( ent->client->ps.viewangles, forward, right, up );
00134                 }
00135                 CalcMuzzlePoint( (gentity_t*)ent, forward, right, up, point );
00136                 //NOTE: automatically takes leaning into account!
00137                 break;
00138 
00139         case SPOT_GROUND:
00140                 // if entity is on the ground, just use it's absmin
00141                 if ( ent->s.groundEntityNum != -1 ) 
00142                 {
00143                         VectorCopy( ent->r.currentOrigin, point );
00144                         point[2] = ent->r.absmin[2];
00145                         break;
00146                 }
00147 
00148                 // if it is reasonably close to the ground, give the point underneath of it
00149                 VectorCopy( ent->r.currentOrigin, start );
00150                 start[2] = ent->r.absmin[2];
00151                 VectorCopy( start, end );
00152                 end[2] -= 64;
00153                 trap_Trace( &tr, start, ent->r.mins, ent->r.maxs, end, ent->s.number, MASK_PLAYERSOLID );
00154                 if ( tr.fraction < 1.0 ) 
00155                 {
00156                         VectorCopy( tr.endpos, point);
00157                         break;
00158                 }
00159 
00160                 // otherwise just use the origin
00161                 VectorCopy( ent->r<