codemp/game/WalkerNPC.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 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_SetWalkerVehicleFunctions (vehicleInfo_t *pVehInfo)
void G_AllocateVehicleObject (Vehicle_t **pVeh)
void G_CreateWalkerNPC (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 WalkerNPC.c.

#define QAGAME
 

Definition at line 33 of file WalkerNPC.c.


Function Documentation

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.

References Com_Error(), ERR_DROP, MAX_VEHICLES_AT_A_TIME, memset(), qtrue, and Vehicle_t.

Referenced by G_CreateAnimalNPC(), G_CreateFighterNPC(), G_CreateSpeederNPC(), and G_CreateWalkerNPC().

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_CreateWalkerNPC Vehicle_t **  pVeh,
const char *  strAnimalType
 

Definition at line 594 of file WalkerNPC.c.

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

Referenced by CG_G2AnimEntModelLoad(), and NPC_Spawn_Do().

00595 {
00596         // Allocate the Vehicle.
00597 #ifdef _JK2MP
00598 #ifdef QAGAME
00599         //these will remain on entities on the client once allocated because the pointer is
00600         //never stomped. on the server, however, when an ent is freed, the entity struct is
00601         //memset to 0, so this memory would be lost..
00602     G_AllocateVehicleObject(pVeh);
00603 #else
00604         if (!*pVeh)
00605         { //only allocate a new one if we really have to
00606                 (*pVeh) = (Vehicle_t *) BG_Alloc( sizeof(Vehicle_t) );
00607         }
00608 #endif
00609         memset(*pVeh, 0, sizeof(Vehicle_t));
00610         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strAnimalType )];
00611 #else
00612         (*pVeh) = (Vehicle_t *) gi.Malloc( sizeof(Vehicle_t), TAG_G_ALLOC, qtrue );
00613         (*pVeh)->m_pVehicleInfo = &g_vehicleInfo[BG_VehicleGetIndex( strAnimalType )];
00614 #endif
00615 }

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

Referenced by Rancor_Smash(), Rancor_Swing(), Wampa_Slash(), and WP_SaberRadiusDamage().

void G_SetWalkerVehicleFunctions vehicleInfo_t pVehInfo  ) 
 

Definition at line 547 of file WalkerNPC.c.

References AnimateVehicle(), vehicleInfo_t::AnimateVehicle, vehicleInfo_t::AttachRiders, Board(), vehicleInfo_t::Board, vehicleInfo_t::ProcessMoveCommands, ProcessOrientCommands(), vehicleInfo_t::ProcessOrientCommands, RegisterAssets(), and vehicleInfo_t::RegisterAssets.

Referenced by BG_SetSharedVehicleFunctions().

00548 {
00549 #ifdef QAGAME
00550         pVehInfo->AnimateVehicle                        =               AnimateVehicle;
00551 //      pVehInfo->AnimateRiders                         =               AnimateRiders;
00552 //      pVehInfo->ValidateBoard                         =               ValidateBoard;
00553 //      pVehInfo->SetParent                                     =               SetParent;
00554 //      pVehInfo->SetPilot                                      =               SetPilot;
00555 //      pVehInfo->AddPassenger                          =               AddPassenger;
00556 //      pVehInfo->Animate                                       =               Animate;
00557         pVehInfo->Board                                         =               Board;
00558 //      pVehInfo->Eject                                         =               Eject;
00559 //      pVehInfo->EjectAll                                      =               EjectAll;
00560 //      pVehInfo->StartDeathDelay                       =               StartDeathDelay;
00561 //      pVehInfo->DeathUpdate                           =               DeathUpdate;
00562         pVehInfo->RegisterAssets                        =               RegisterAssets;
00563 //      pVehInfo->Initialize                            =               Initialize;
00564 //      pVehInfo->Update                                        =               Update;
00565 //      pVehInfo->UpdateRider                           =               UpdateRider;
00566 #endif //QAGAME
00567         pVehInfo->ProcessMoveCommands           =               ProcessMoveCommands;
00568         pVehInfo->ProcessOrientCommands         =               ProcessOrientCommands;
00569 
00570 #ifndef QAGAME //cgame prediction attachment func
00571         pVehInfo->AttachRiders                          =               AttachRidersGeneric;
00572 #endif
00573 //      pVehInfo->AttachRiders                          =               AttachRiders;
00574 //      pVehInfo->Ghost                                         =               Ghost;
00575 //      pVehInfo->UnGhost                                       =               UnGhost;
00576 //      pVehInfo->Inhabited                                     =               Inhabited;
00577 }

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.

References trap_Trace(), and vec3_t.

Referenced by VEH_TryEject().

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.

References pmove_t::animations, Com_Error(), ERR_DROP, fabs(), animation_s::frameLerp, MAX_ANIMATIONS, animation_s::numFrames, and pm.

Referenced by AnimateRiders(), BG_CmdForRoll(), and PM_CheckDualForwardJumpDuck().

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
 

Referenced by G_SetAnim(), PM_AdjustAngleForWallJump(), PM_AdjustAngleForWallRun(), PM_AdjustAngleForWallRunUp(), PM_BeginWeaponChange(), PM_FinishWeaponChange(), PM_GrabWallForJump(), PM_SaberLockResultAnim(), PM_SaberLockWinAnim(), PM_SetSaberMove(), PM_VehicleWeaponAnimate(), PM_WeaponLightsaber(), and PmoveSingle().

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

Definition at line 88 of file g_vehicles.c.

References BG_SetAnim(), bgAllAnims, gentity_s::client, gentity_t, playerState_s::legsAnim, entityState_s::legsAnim, gentity_s::localAnimIndex, NPC_SetAnim(), gclient_s::ps, and gentity_s::s.

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 WalkerNPC.c.

cvar_t* g_speederControlScheme
 

Definition at line 77 of file WalkerNPC.c.

vec3_t playerMaxs
 

Definition at line 76 of file WalkerNPC.c.

vec3_t playerMins
 

Definition at line 75 of file WalkerNPC.c.