codemp/game/AnimalNPC.c File Reference

#include "g_headers.h"
#include "g_local.h"
#include "g_functions.h"
#include "g_vehicles.h"

Go to the source code of this file.

Defines

#define QAGAME
#define bgEntity_t   gentity_t

Functions

float DotToSpot (vec3_t spot, vec3_t from, vec3_t fromAngles)
void PM_SetAnim (pmove_t *pm, int setAnimParts, int anim, int setAnimFlags, int blendTime)
int PM_AnimLength (int index, animNumber_t anim)
void CG_ChangeWeapon (int num)
void Vehicle_SetAnim (gentity_t *ent, int setAnimParts, int anim, int setAnimFlags, int iBlend)
void G_Knockdown (gentity_t *self, gentity_t *attacker, const vec3_t pushDir, float strength, qboolean breakSaberLock)
void G_VehicleTrace (trace_t *results, const vec3_t start, const vec3_t tMins, const vec3_t tMaxs, const vec3_t end, int passEntityNum, int contentmask)
void G_SetAnimalVehicleFunctions (vehicleInfo_t *pVehInfo)
void G_AllocateVehicleObject (Vehicle_t **pVeh)
void G_CreateAnimalNPC (Vehicle_t **pVeh, const char *strAnimalType)

Variables

vmCvar_t cg_thirdPersonAlpha
vec3_t playerMins
vec3_t playerMaxs
cvar_tg_speederControlScheme


Define Documentation

#define bgEntity_t   gentity_t
 

Definition at line 68 of file AnimalNPC.c.

#define QAGAME
 

Definition at line 33 of file AnimalNPC.c.

Referenced by FighterIsLanding(), and FighterIsLaunching().


Function Documentation

void CG_ChangeWeapon int  num  ) 
 

float DotToSpot vec3_t  spot,
vec3_t  from,
vec3_t  fromAngles
 

void G_AllocateVehicleObject Vehicle_t **  pVeh  ) 
 

Definition at line 388 of file g_utils.c.

00389 {
00390         int i = 0;
00391 
00392         if (!g_vehiclePoolInit)
00393         {
00394                 g_vehiclePoolInit = qtrue;
00395                 memset(g_vehiclePoolOccupied, 0, sizeof(g_vehiclePoolOccupied));
00396         }
00397 
00398         while (i < MAX_VEHICLES_AT_A_TIME)
00399         { //iterate through and try to find a free one
00400                 if (!g_vehiclePoolOccupied[i])
00401                 {
00402                         g_vehiclePoolOccupied[i] = qtrue;
00403                         memset(&g_vehiclePool[i], 0, sizeof(Vehicle_t));
00404                         *pVeh = &g_vehiclePool[i];
00405                         return;
00406                 }
00407                 i++;
00408         }
00409         Com_Error(ERR_DROP, "Ran out of vehicle pool slots.");
00410 }

void G_CreateAnimalNPC Vehicle_t **  pVeh,
const char *  strAnimalType
 

Definition at line 904 of file AnimalNPC.c.

References BG_Alloc(), BG_VehicleGetIndex(), G_AllocateVehicleObject(), g_vehicleInfo, memset(), qtrue, and Vehicle_t.

Referenced by CG_G2AnimEntModelLoad(), and NPC_Spawn_Do().

00905 {
00906         // Allocate the Vehicle.
00907 #ifdef _JK2MP
00908 #ifdef QAGAME
00909         //these will remain on entities on the client once allocated because the pointer is
00910         //never stomped. on the server, however, when an ent is freed, the entity struct is
00911         //memset to 0, so this memory would be lost..
00912     G_AllocateVehicleObject(pVeh);
00913 #else
00914         if (!*pVeh)
00915         { //only allocate a new one if we really have to
00916                 (*pVeh) = (Vehicle_t *) BG_Alloc( sizeof(Vehicle_t) );
00917         }
00918 #endif
00919         memset(*pVeh, 0, sizeof(Vehicle_t));
00920         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strAnimalType )];
00921 #else
00922         (*pVeh) = (Vehicle_t *) gi.Malloc( sizeof(Vehicle_t), TAG_G_ALLOC, qtrue );
00923         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strAnimalType )];
00924 #endif
00925 }

void G_Knockdown gentity_t self,
gentity_t attacker,
const vec3_t  pushDir,
float  strength,
qboolean  breakSaberLock
 

void G_SetAnimalVehicleFunctions vehicleInfo_t pVehInfo  ) 
 

Definition at line 857 of file AnimalNPC.c.

References vehicleInfo_t::AnimateRiders, vehicleInfo_t::AnimateVehicle, vehicleInfo_t::AttachRiders, vehicleInfo_t::DeathUpdate, vehicleInfo_t::ProcessMoveCommands, vehicleInfo_t::ProcessOrientCommands, and vehicleInfo_t::Update.

Referenced by BG_SetSharedVehicleFunctions().

00858 {
00859 #ifdef QAGAME
00860         pVehInfo->AnimateVehicle                        =               AnimateVehicle;
00861         pVehInfo->AnimateRiders                         =               AnimateRiders;
00862 //      pVehInfo->ValidateBoard                         =               ValidateBoard;
00863 //      pVehInfo->SetParent                                     =               SetParent;
00864 //      pVehInfo->SetPilot                                      =               SetPilot;
00865 //      pVehInfo->AddPassenger                          =               AddPassenger;
00866 //      pVehInfo->Animate                                       =               Animate;
00867 //      pVehInfo->Board                                         =               Board;
00868 //      pVehInfo->Eject                                         =               Eject;
00869 //      pVehInfo->EjectAll                                      =               EjectAll;
00870 //      pVehInfo->StartDeathDelay                       =               StartDeathDelay;
00871         pVehInfo->DeathUpdate                           =               DeathUpdate;
00872 //      pVehInfo->RegisterAssets                        =               RegisterAssets;
00873 //      pVehInfo->Initialize                            =               Initialize;
00874         pVehInfo->Update                                        =               Update;
00875 //      pVehInfo->UpdateRider                           =               UpdateRider;
00876 #endif //QAGAME
00877         pVehInfo->ProcessMoveCommands           =               ProcessMoveCommands;
00878         pVehInfo->ProcessOrientCommands         =               ProcessOrientCommands;
00879 
00880 #ifndef QAGAME //cgame prediction attachment func
00881         pVehInfo->AttachRiders                          =               AttachRidersGeneric;
00882 #endif
00883 //      pVehInfo->AttachRiders                          =               AttachRiders;
00884 //      pVehInfo->Ghost                                         =               Ghost;
00885 //      pVehInfo->UnGhost                                       =               UnGhost;
00886 //      pVehInfo->Inhabited                                     =               Inhabited;
00887 }

void G_VehicleTrace trace_t results,
const vec3_t  start,
const vec3_t  tMins,
const vec3_t  tMaxs,
const vec3_t  end,
int  passEntityNum,
int  contentmask
 

Definition at line 99 of file g_vehicles.c.

00100 {
00101 #ifdef _JK2MP
00102         trap_Trace(results, start, tMins, tMaxs, end, passEntityNum, contentmask);
00103 #else
00104         gi.trace( results, start, tMins, tMaxs, end, passEntityNum, contentmask );
00105 #endif
00106 }

int PM_AnimLength int  index,
animNumber_t  anim
 

Definition at line 1584 of file bg_panimate.c.

01585 {
01586         if (anim >= MAX_ANIMATIONS || !pm->animations)
01587         {
01588                 return -1;
01589         }
01590         if ( anim < 0 )
01591         {
01592                 Com_Error(ERR_DROP,"ERROR: anim %d < 0\n", anim );
01593         }
01594         return pm->animations[anim].numFrames * fabs((float)(pm->animations[anim].frameLerp));
01595 }

void PM_SetAnim pmove_t pm,
int  setAnimParts,
int  anim,
int  setAnimFlags,
int  blendTime
 

void Vehicle_SetAnim gentity_t ent,
int  setAnimParts,
int  anim,
int  setAnimFlags,
int  iBlend
 

Definition at line 88 of file g_vehicles.c.

00089 {
00090 #ifdef _JK2MP
00091         assert(ent->client);
00092         BG_SetAnim(&ent->client->ps, bgAllAnims[ent->localAnimIndex].anims, setAnimParts, anim, setAnimFlags, iBlend);
00093         ent->s.legsAnim = ent->client->ps.legsAnim;
00094 #else
00095         NPC_SetAnim(ent, setAnimParts, anim, setAnimFlags, iBlend);
00096 #endif
00097 }


Variable Documentation

vmCvar_t cg_thirdPersonAlpha
 

Definition at line 74 of file AnimalNPC.c.

cvar_t* g_speederControlScheme
 

Definition at line 77 of file AnimalNPC.c.

vec3_t playerMaxs
 

Definition at line 76 of file AnimalNPC.c.

Referenced by BotTrace_Strafe(), CG_BuildSolidList(), CG_CalcEntityLerpPositions(), CG_DrawAutoMap(), CG_EntityEvent(), ClientSpawn(), G_DriveATST(), NAVNEW_TestNodeConnectionBlocked(), NPC_ParseParms(), SpotWouldTelefrag(), and TryUse().

vec3_t playerMins
 

Definition at line 75 of file AnimalNPC.c.

Referenced by BotTrace_Strafe(), CG_BuildSolidList(), CG_CalcEntityLerpPositions(), CG_DrawAutoMap(), CG_EntityEvent(), ClientSpawn(), G_DriveATST(), NAVNEW_TestNodeConnectionBlocked(), NPC_ParseParms(), SpotWouldTelefrag(), and TryUse().