Local entity management. More...
#include "../client.h"
#include "cl_localentity.h"
#include "../sound/s_main.h"
#include "../sound/s_mix.h"
#include "cl_particle.h"
#include "cl_actor.h"
#include "cl_parse.h"
#include "cl_hud.h"
#include "../renderer/r_mesh_anim.h"
#include "../../common/tracing.h"
#include "../../common/grid.h"
Go to the source code of this file.
Data Structures | |
struct | moveclip_t |
Client side moveclip. More... | |
Defines | |
#define | ModelOffset(i, target) (target[0]=(i-1)*(UNIT_SIZE+BOX_DELTA_WIDTH)/2, target[1]=(i-1)*(UNIT_SIZE+BOX_DELTA_LENGTH)/2, target[2]=0) |
Functions | |
static void | LE_GenerateInlineModelList (void) |
void | CL_CompleteRecalcRouting (void) |
void | CL_RecalcRouting (const le_t *le) |
static void | LM_AddToSceneOrder (qboolean parents) |
void | LM_AddToScene (void) |
Add the local models to the scene. | |
static localModel_t * | LM_Find (int entnum) |
Checks whether a local model with the same entity number is already registered. | |
qboolean | LE_IsActor (const le_t *le) |
Checks whether the given le is a living actor. | |
qboolean | LE_IsLivingActor (const le_t *le) |
Checks whether the given le is a living actor (but might be hidden). | |
qboolean | LE_IsLivingAndVisibleActor (const le_t *le) |
Checks whether the given le is a living and visible actor. | |
void | LM_Register (void) |
Register misc_models. | |
void | LE_SetThink (le_t *le, void(*think)(le_t *le)) |
localModel_t * | LM_GetByID (const char *id) |
localModel_t * | LM_AddModel (const char *model, const vec3_t origin, const vec3_t angles, int entnum, int levelflags, int renderFlags, const vec3_t scale) |
Prepares local (not known or handled by the server) models to the map, which will be added later in LM_AddToScene(). | |
void | LE_ExecuteThink (le_t *le) |
Call think function for the given local entity if its still in use. | |
void | LE_Think (void) |
Calls the le think function and updates the animation. The animation updated even if the particular local entity is invisible for the client. This ensures, that an animation is always lerped correctly and won't magically start again once the local entity gets visible again. | |
void | LM_Think (void) |
const char * | LE_GetAnim (const char *anim, int right, int left, int state) |
Get the correct animation for the given actor state and weapons. | |
void | LET_StartIdle (le_t *le) |
Change the animation of an actor to the idle animation (which can be panic, dead or stand). | |
static void | LE_PlaySoundFileForContents (le_t *le, int contents) |
Plays sound of content for moving actor. | |
static void | LE_PlaySoundFileAndParticleForSurface (le_t *le, const char *textureName) |
Plays step sounds and draw particles for different terrain types. | |
int | LE_ActorGetStepTime (const le_t *le, const pos3_t pos, const pos3_t oldPos, const int dir, const int speed) |
static void | LE_PlayFootStepSound (le_t *le) |
static void | LE_DoPathMove (le_t *le) |
void | LE_DoEndPathMove (le_t *le) |
Ends the move of an actor. | |
static void | LE_ActorBodyHit (const le_t *le, const vec3_t impact, int normal) |
Spawns particle effects for a hit actor. | |
static void | LET_PathMove (le_t *le) |
Move the actor along the path to the given location. | |
void | LET_StartPathMove (le_t *le) |
Change the actors animation to walking. | |
static void | LET_Projectile (le_t *le) |
void | LE_AddProjectile (const fireDef_t *fd, int flags, const vec3_t muzzle, const vec3_t impact, int normal, le_t *leVictim) |
static objDef_t * | LE_BiggestItem (const invList_t *ic) |
Returns the index of the biggest item in the inventory list. | |
void | LE_PlaceItem (le_t *le) |
void | LE_AddGrenade (const fireDef_t *fd, int flags, const vec3_t muzzle, const vec3_t v0, int dt, le_t *leVictim) |
qboolean | LE_BrushModelAction (le_t *le, entity_t *ent) |
Add function for brush models. | |
void | LET_BrushModel (le_t *le) |
void | LMT_Init (localModel_t *localModel) |
void | LE_AddAmbientSound (const char *sound, const vec3_t origin, int levelflags, float volume, float attenuation) |
Adds ambient sounds from misc_sound entities. | |
le_t * | LE_Add (int entnum) |
Add a new local entity to the scene. | |
void | _LE_NotFoundError (const int entnum, const char *file, const int line) |
void | LE_CenterView (const le_t *le) |
Center the camera on the local entity's origin. | |
le_t * | LE_Get (int entnum) |
Searches all local entities for the one with the searched entnum. | |
qboolean | LE_IsLocked (int entnum) |
Checks if a given le_t structure is locked, i.e., used by another event at this time. | |
void | LE_Lock (le_t *le) |
Markes a le_t struct as locked. Should be called at the beginning of an event handler on this le_t, and paired with a LE_Unlock at the end. | |
void | LE_Unlock (le_t *le) |
Unlocks a previously locked le_t struct. | |
le_t * | LE_GetFromPos (const pos3_t pos) |
Searches a local entity on a given grid field. | |
le_t * | LE_GetNext (le_t *lastLE) |
Iterate through the list of entities. | |
le_t * | LE_GetNextInUse (le_t *lastLE) |
Iterate through the entities that are in use. | |
le_t * | LE_FindRadius (le_t *from, const vec3_t org, float rad, entity_type_t type) |
Returns entities that have origins within a spherical area. | |
le_t * | LE_Find (int type, const pos3_t pos) |
Searches a local entity on a given grid field. | |
static qboolean | LE_IsOriginBrush (const le_t *const le) |
void | LE_AddToScene (void) |
void | LE_Cleanup (void) |
Cleanup unused LE inventories that the server sent to the client also free some unused LE memory. | |
static int32_t | CL_HullForEntity (const le_t *le, int *tile, vec3_t rmaShift, vec3_t angles) |
Returns a headnode that can be used for testing or clipping an object of mins/maxs size. Offset is filled in to contain the adjustment that must be added to the testing object's origin to get a point to use with the returned hull. | |
static void | CL_ClipMoveToLEs (moveclip_t *clip) |
Clip against solid entities. | |
static void | CL_TraceBounds (const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs) |
Create the bounding box for the entire move. | |
trace_t | CL_Trace (const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, const le_t *passle, le_t *passle2, int contentmask, int worldLevel) |
Moves the given mins/maxs volume through the world from start to end. | |
Variables | |
cvar_t * | cl_le_debug |
static char | retAnim [MAX_VAR] |
Local entity management.
Definition in file cl_localentity.c.
#define ModelOffset | ( | i, | |||
target | ) | (target[0]=(i-1)*(UNIT_SIZE+BOX_DELTA_WIDTH)/2, target[1]=(i-1)*(UNIT_SIZE+BOX_DELTA_LENGTH)/2, target[2]=0) |
Definition at line 1233 of file cl_localentity.c.
Referenced by LE_AddToScene().
void _LE_NotFoundError | ( | const int | entnum, | |
const char * | file, | |||
const int | line | |||
) |
Definition at line 1035 of file cl_localentity.c.
References Cmd_ExecuteString(), Com_Error(), and ERR_DROP.
static void CL_ClipMoveToLEs | ( | moveclip_t * | clip | ) | [static] |
Clip against solid entities.
Definition at line 1448 of file cl_localentity.c.
References trace_s::allsolid, cl, CL_HullForEntity(), CM_HintedTransformedBoxTrace(), moveclip_t::contentmask, le_s::contents, moveclip_t::end, trace_s::fraction, trace_s::le, LE_GetNextInUse(), MAX_MAP_NODES, moveclip_t::maxs, moveclip_t::mins, le_s::origin, moveclip_t::passle, moveclip_t::passle2, qtrue, shift, moveclip_t::start, trace_s::startsolid, moveclip_t::trace, and VectorCopy.
Referenced by CL_Trace().
void CL_CompleteRecalcRouting | ( | void | ) |
Definition at line 59 of file cl_localentity.c.
References cl, Grid_RecalcRouting(), i, le_s::inlineModelName, LE_GenerateInlineModelList(), and le_s::model1.
Referenced by CL_Reset().
static int32_t CL_HullForEntity | ( | const le_t * | le, | |
int * | tile, | |||
vec3_t | rmaShift, | |||
vec3_t | angles | |||
) | [static] |
Returns a headnode that can be used for testing or clipping an object of mins/maxs size. Offset is filled in to contain the adjustment that must be added to the testing object's origin to get a point to use with the returned hull.
[in] | le | The local entity to get the bmodel from |
[out] | tile | The maptile the bmodel belongs, too |
[out] | rmaShift | the shift vector in case of an RMA (needed for doors) |
Definition at line 1421 of file cl_localentity.c.
References le_s::angles, cl, CM_HeadnodeForBox(), Com_Error(), le_s::contents, CONTENTS_SOLID, ERR_DROP, cBspModel_s::headnode, MAX_MODELS, le_s::maxs, le_s::mins, le_s::modelnum1, cBspModel_s::shift, cBspModel_s::tile, le_s::type, vec3_origin, and VectorCopy.
Referenced by CL_ClipMoveToLEs().
void CL_RecalcRouting | ( | const le_t * | le | ) |
[in] | le | A local entity of a brush model (func_breakable, func_door, ...) |
Definition at line 78 of file cl_localentity.c.
References cl, CL_ActorConditionalMoveCalc(), Grid_RecalcRouting(), le_s::inlineModelName, LE_GenerateInlineModelList(), le_s::model1, and selActor.
Referenced by CL_AddBrushModel(), CL_DoorClose(), CL_DoorOpen(), and CL_Explode().
trace_t CL_Trace | ( | const vec3_t | start, | |
const vec3_t | end, | |||
const vec3_t | mins, | |||
const vec3_t | maxs, | |||
const le_t * | passle, | |||
le_t * | passle2, | |||
int | contentmask, | |||
int | worldLevel | |||
) |
Moves the given mins/maxs volume through the world from start to end.
[in] | start | Start vector to start the trace from |
[in] | end | End vector to stop the trace at |
[in] | mins | Bounding box used for tracing |
[in] | maxs | Bounding box used for tracing |
[in] | passle | Ignore this local entity in the trace (might be NULL) |
[in] | passle2 | Ignore this local entity in the trace (might be NULL) |
[in] | contentmask | Searched content the trace should watch for |
[in] | worldLevel | The worldlevel (0-7) to calculate the levelmask for the trace from |
Definition at line 1537 of file cl_localentity.c.
References moveclip_t::boxmaxs, moveclip_t::boxmins, cl, CL_ClipMoveToLEs(), CL_TraceBounds(), CM_CompleteBoxTrace(), moveclip_t::contentmask, moveclip_t::end, trace_s::fraction, trace_s::le, moveclip_t::maxs, moveclip_t::mins, moveclip_t::passle, moveclip_t::passle2, moveclip_t::start, and moveclip_t::trace.
Referenced by CL_ActorVis(), CL_ParticleRun2(), CL_TargetingGrenade(), CL_TargetingStraight(), and LE_PlayFootStepSound().
static void CL_TraceBounds | ( | const vec3_t | start, | |
const vec3_t | mins, | |||
const vec3_t | maxs, | |||
const vec3_t | end, | |||
vec3_t | boxmins, | |||
vec3_t | boxmaxs | |||
) | [inline, static] |
Create the bounding box for the entire move.
[in] | start | Start vector to start the trace from |
[in] | mins | Bounding box used for tracing |
[in] | maxs | Bounding box used for tracing |
[in] | end | End vector to stop the trace at |
[out] | boxmins | The resulting box mins |
[out] | boxmaxs | The resulting box maxs |
Definition at line 1507 of file cl_localentity.c.
Referenced by CL_Trace().
Spawns particle effects for a hit actor.
[in] | le | The actor to spawn the particles for. |
[in] | impact | The impact location (where the particles are spawned). |
[in] | normal | The index of the normal vector of the particles (think: impact angle). |
Definition at line 598 of file cl_localentity.c.
References bytedirs, CL_ParticleSpawn(), teamDef_s::hitParticle, and le_s::teamDef.
Referenced by LE_AddProjectile(), and LET_Projectile().
int LE_ActorGetStepTime | ( | const le_t * | le, | |
const pos3_t | pos, | |||
const pos3_t | oldPos, | |||
const int | dir, | |||
const int | speed | |||
) |
sqrt(2) for diagonal movement
Definition at line 508 of file cl_localentity.c.
References BASE_DIRECTIONS, cl, CORE_DIRECTIONS, dest, DIRECTION_FALL, le_s::fieldSize, Grid_PosToVec(), and UNIT_SIZE.
Referenced by CL_ActorDoMoveTime(), CL_GetEventTime(), and LE_DoPathMove().
le_t* LE_Add | ( | int | entnum | ) |
Add a new local entity to the scene.
[in] | entnum | The entity number (server side) |
Definition at line 1005 of file cl_localentity.c.
References ACTOR_SIZE_NORMAL, cl, Com_Error(), le_s::entnum, ERR_DROP, le_s::fieldSize, le_s::inuse, LE_GetNext(), MAX_EDICTS, and qtrue.
Referenced by CL_ActorAdd(), CL_ActorAppear(), CL_AddBrushModel(), CL_AddEdict(), CL_EntAppear(), LE_AddAmbientSound(), LE_AddGrenade(), and LE_AddProjectile().
void LE_AddAmbientSound | ( | const char * | sound, | |
const vec3_t | origin, | |||
int | levelflags, | |||
float | volume, | |||
float | attenuation | |||
) |
Adds ambient sounds from misc_sound entities.
Definition at line 962 of file cl_localentity.c.
References le_s::attenuation, cl_leshowinvis, Com_DPrintf(), Com_Printf(), DEBUG_SOUND, ET_SOUND, f, cvar_s::integer, le_s::invis, LE_Add(), le_s::levelflags, le_s::origin, S_LoadSample(), le_s::sample, SND_VOLUME_DEFAULT, le_s::type, VectorCopy, and le_s::volume.
Referenced by SP_misc_sound().
void LE_AddGrenade | ( | const fireDef_t * | fd, | |
int | flags, | |||
const vec3_t | muzzle, | |||
const vec3_t | v0, | |||
int | dt, | |||
le_t * | leVictim | |||
) |
[in] | fd | The grenade fire definition |
[in] | flags | bitmask: SF_BODY, SF_IMPACT, SF_BOUNCING, SF_BOUNCED |
[in] | muzzle | starting/location vector |
[in] | v0 | velocity vector |
[in] | dt | delta seconds |
Definition at line 863 of file cl_localentity.c.
References ptl_s::angles, fireDef_s::bounce, fireDef_s::bounceSound, cl, cl_leshowinvis, CL_ParticleSpawn(), crand(), le_s::dir, le_s::endTime, le_s::fd, GRAVITY, fireDef_s::hitBody, fireDef_s::hitBodySound, fireDef_s::impact, fireDef_s::impactSound, cvar_s::integer, le_s::inuse, le_s::invis, LE_Add(), LE_ExecuteThink(), LE_SetThink(), LET_Projectile(), ptl_s::omega, fireDef_s::projectile, le_s::ptl, qfalse, le_s::ref1, le_s::ref2, le_s::ref3, SF_BODY, SF_BOUNCING, SF_IMPACT, fireDef_s::splrad, and VectorSet.
Referenced by CL_ActorDoThrow().
void LE_AddProjectile | ( | const fireDef_t * | fd, | |
int | flags, | |||
const vec3_t | muzzle, | |||
const vec3_t | impact, | |||
int | normal, | |||
le_t * | leVictim | |||
) |
Definition at line 705 of file cl_localentity.c.
References ptl_s::angles, fireDef_s::bounce, fireDef_s::bounceSound, bytedirs, cl, CL_ActorPlaySound(), cl_leshowinvis, CL_ParticleSpawn(), csi, csi_s::damStunGas, le_s::dir, objDef_s::dmgtype, le_s::endTime, le_s::fd, fireDef_s::hitBody, fireDef_s::hitBodySound, fireDef_s::impact, fireDef_s::impactAttenuation, fireDef_s::impactSound, cvar_s::integer, le_s::inuse, le_s::invis, LE_ActorBodyHit(), LE_Add(), LE_ExecuteThink(), LE_SetThink(), LET_Projectile(), fireDef_s::obj, le_s::origin, fireDef_s::projectile, le_s::ptl, qfalse, le_s::ref1, le_s::ref2, le_s::ref3, ptl_s::s, S_LoadSample(), S_PlaySample(), SF_BODY, SF_BOUNCING, SF_IMPACT, ptl_s::size, SND_HURT, SND_VOLUME_WEAPONS, fireDef_s::speed, fireDef_s::splrad, ptl_s::v, VecToAngles(), VectorLength(), VectorMA(), VectorScale, and VectorSubtract.
Referenced by CL_ActorDoShoot().
void LE_AddToScene | ( | void | ) |
Definition at line 1252 of file cl_localentity.c.
References ACTOR_SIZE_2x2, ACTOR_SIZE_NORMAL, le_s::addFunc, le_s::alpha, le_s::angles, le_s::as, cl, CL_ParticleSpawn(), cl_worldlevel, le_s::contents, CONTENTS_DETAIL, CONTENTS_SOLID, le_s::fieldSize, i, cvar_s::integer, le_s::inuse, le_s::invis, LE_IsOriginBrush(), le_s::levelflags, le_s::model1, ModelOffset, le_s::origin, le_s::pos, qfalse, qtrue, R_AddEntity(), R_EntityAddToOrigin(), R_EntitySetOrigin(), le_s::removeNextFrame, le_s::skinnum, VectorAdd, and VectorCopy.
Referenced by CL_ViewRender().
Returns the index of the biggest item in the inventory list.
csi.ods
array Definition at line 798 of file cl_localentity.c.
References INVSH_ShapeSize(), invList_s::item, invList_s::next, objDef_s::shape, and item_s::t.
Referenced by LE_PlaceItem().
Add function for brush models.
Definition at line 912 of file cl_localentity.c.
References le_s::angles, ET_BREAKABLE, ET_DOOR, ET_ROTATING, le_s::maxs, le_s::mins, le_s::origin, qtrue, R_EntityGetOrigin(), le_s::type, and VectorCopy.
Referenced by CL_AddBrushModel().
void LE_CenterView | ( | const le_t * | le | ) |
Center the camera on the local entity's origin.
le | The local entity which origin is used to center the camera |
Definition at line 1048 of file cl_localentity.c.
References cl, cl_centerview, Cvar_SetValue(), cvar_s::integer, le_s::origin, le_s::pos, and VectorCopy.
Referenced by CL_ActorAppear(), and CL_ActorSelectList().
void LE_Cleanup | ( | void | ) |
Cleanup unused LE inventories that the server sent to the client also free some unused LE memory.
Definition at line 1334 of file cl_localentity.c.
References cl, CL_ActorCleanup(), cls, Com_DPrintf(), csi, DEBUG_CLIENT, inventoryInterface_s::EmptyContainer, le_s::i, client_static_s::i, i, csi_s::idFloor, le_s::inuse, INVDEF, LE_IsActor(), LE_IsItem, and qfalse.
Referenced by CL_ClearState().
void LE_DoEndPathMove | ( | le_t * | le | ) |
Ends the move of an actor.
Definition at line 571 of file cl_localentity.c.
References CL_ActorConditionalMoveCalc(), Com_Error(), ERR_DROP, ET_ITEM, FLOOR, LE_ExecuteThink(), LE_Find(), LE_SetThink(), LE_Unlock(), LET_StartIdle(), le_s::newPos, le_s::pathLength, le_s::pathPos, le_s::pos, le_s::team, and VectorCompare.
Referenced by CL_ActorDoMove(), and LET_PathMove().
static void LE_DoPathMove | ( | le_t * | le | ) | [static] |
Definition at line 542 of file cl_localentity.c.
References le_s::angles, byte, CORE_DIRECTIONS, le_s::dir, directionAngles, le_s::endTime, FLYING_DIRECTIONS, getDVdir, LE_ActorGetStepTime(), LE_IsCrouched, LE_PlayFootStepSound(), le_s::oldPos, le_s::path, le_s::pathContents, le_s::pathPos, le_s::pos, PosAddDV, le_s::positionContents, le_s::speed, le_s::startTime, and YAW.
Referenced by LET_PathMove().
void LE_ExecuteThink | ( | le_t * | le | ) |
Call think function for the given local entity if its still in use.
Definition at line 305 of file cl_localentity.c.
References Com_DPrintf(), DEBUG_EVENTSYS, le_s::entnum, le_s::inuse, and le_s::think.
Referenced by LE_AddGrenade(), LE_AddProjectile(), LE_DoEndPathMove(), LE_Think(), and LET_StartPathMove().
Searches a local entity on a given grid field.
[in] | type | Entity type |
[in] | pos | The grid pos to search for an item of the given type |
Definition at line 1218 of file cl_localentity.c.
References LE_GetNextInUse(), le_s::pos, le_s::type, and VectorCompare.
Referenced by CL_ActorRevitalised(), and LE_DoEndPathMove().
le_t* LE_FindRadius | ( | le_t * | from, | |
const vec3_t | org, | |||
float | rad, | |||
entity_type_t | type | |||
) |
Returns entities that have origins within a spherical area.
[in] | from | The entity to start the search from. NULL will start from the beginning. |
[in] | org | The origin that is the center of the circle. |
[in] | rad | radius to search an edict in. |
[in] | type | Type of local entity. ET_NULL to ignore the type. |
Definition at line 1194 of file cl_localentity.c.
References ET_NULL, LE_GetNextInUse(), le_s::maxs, le_s::mins, le_s::origin, le_s::type, and VectorLength().
static void LE_GenerateInlineModelList | ( | void | ) | [inline, static] |
Definition at line 44 of file cl_localentity.c.
References cl, i, le_s::inlineModelName, LE_GetNextInUse(), and le_s::model1.
Referenced by CL_CompleteRecalcRouting(), and CL_RecalcRouting().
le_t* LE_Get | ( | int | entnum | ) |
Searches all local entities for the one with the searched entnum.
[in] | entnum | The entity number (server side) |
Definition at line 1064 of file cl_localentity.c.
References le_s::entnum, LE_GetNextInUse(), and SKIP_LOCAL_ENTITY.
Referenced by CL_ActorAdd(), CL_ActorAppear(), CL_ActorDie(), CL_ActorDoMove(), CL_ActorDoMoveTime(), CL_ActorDoorAction(), CL_ActorDoShoot(), CL_ActorDoTurn(), CL_ActorReactionFireChange(), CL_ActorReservationChange(), CL_ActorResetClientAction(), CL_ActorRevitalised(), CL_ActorStartShoot(), CL_ActorStateChange(), CL_ActorStats(), CL_AddBrushModel(), CL_AddEdict(), CL_DoorClose(), CL_DoorOpen(), CL_EntAppear(), CL_EntDestroy(), CL_EntPerish(), CL_Explode(), CL_GetEventTime(), CL_InvAdd(), CL_InvAmmo(), CL_InvDel(), CL_InvReload(), CL_ParticleAppear(), and LE_IsLocked().
const char* LE_GetAnim | ( | const char * | anim, | |
int | right, | |||
int | left, | |||
int | state | |||
) |
Get the correct animation for the given actor state and weapons.
[in] | anim | Type of animation (for example "stand", "walk") |
[in] | right | ods index to determine the weapon in the actors right hand |
[in] | left | ods index to determine the weapon in the actors left hand |
[in] | state | the actors state - e.g. STATE_CROUCHED (crounched animations) have a 'c' in front of their animation definitions (see *.anm files for characters) |
Definition at line 364 of file cl_localentity.c.
References objDef_s::animationIndex, Com_sprintf(), INVSH_GetItemByIDX(), NONE, Q_strncpyz(), qfalse, qtrue, STATE_CROUCHED, objDef_s::type, and type.
Referenced by CL_ActorDoShoot(), CL_ActorStartShoot(), LET_StartIdle(), and LET_StartPathMove().
Searches a local entity on a given grid field.
[in] | pos | The grid pos to search for an item of the given type |
Definition at line 1130 of file cl_localentity.c.
References LE_GetNextInUse(), le_s::pos, and VectorCompare.
Referenced by CL_GetHitProbability().
Iterate through the list of entities.
lastLE | The entity found in the previous iteration; if NULL, we start at the beginning |
Definition at line 1147 of file cl_localentity.c.
References cl.
Referenced by LE_Add(), LE_GetNextInUse(), and LE_Think().
Iterate through the entities that are in use.
lastLE | The entity found in the previous iteration; if NULL, we start at the beginning |
Definition at line 1176 of file cl_localentity.c.
References le_s::inuse, and LE_GetNext().
Referenced by AII_CollectingItems(), AL_CollectingAliens(), CL_ActorConfirmAction_f(), CL_ActorSearchAtGridPos(), CL_BuildForbiddenList(), CL_ClipMoveToLEs(), CL_EntPerish(), CL_ViewLoadMedia(), LE_Find(), LE_FindRadius(), LE_GenerateInlineModelList(), LE_Get(), LE_GetFromPos(), LE_PlaceItem(), S_Frame(), and UI_RadarNodeDraw().
Checks whether the given le is a living actor.
[in] | le | The local entity to perform the check for |
Definition at line 181 of file cl_localentity.c.
References ET_ACTOR, ET_ACTOR2x2, ET_ACTORHIDDEN, and le_s::type.
Referenced by AII_CollectingItems(), AL_CollectingAliens(), CL_ActorDoMove(), CL_ActorDoShoot(), CL_ActorDoTurn(), CL_ActorInvMove(), CL_ActorStateChange(), LE_Cleanup(), and LE_IsLivingActor().
Checks whether the given le is a living actor (but might be hidden).
[in] | le | The local entity to perform the check for |
Definition at line 193 of file cl_localentity.c.
References LE_IsActor(), LE_IsDead, and LE_IsStunned.
Referenced by CL_ActorAppear(), CL_ActorConfirmAction_f(), CL_ActorDie(), CL_ActorRevitalised(), CL_ActorStartShoot(), CL_ActorStateChange(), and LE_IsLivingAndVisibleActor().
Checks whether the given le is a living and visible actor.
[in] | le | The local entity to perform the check for |
Definition at line 205 of file cl_localentity.c.
References ET_ACTORHIDDEN, le_s::invis, LE_IsLivingActor(), qfalse, and le_s::type.
Referenced by CL_ActorSearchAtGridPos(), CL_BuildForbiddenList(), CL_EntPerish(), CL_NextAlien_f(), CL_NextAlienVisibleFromActor_f(), and LE_PlaySoundFileAndParticleForSurface().
qboolean LE_IsLocked | ( | int | entnum | ) |
Checks if a given le_t structure is locked, i.e., used by another event at this time.
entnum | the entnum of the le_t struct involved. |
Definition at line 1086 of file cl_localentity.c.
References LE_Get(), and le_s::locked.
Referenced by CL_CheckDefault().
Origin brush entities are bmodel entities that have their mins/maxs relative to the world origin. The origin vector of the entity will be used to calculate e.g. the culling (and not the mins/maxs like for other entities).
le | The local entity to check |
true
if the given local entity is a func_door or func_rotating Definition at line 1242 of file cl_localentity.c.
References ET_DOOR, ET_ROTATING, and le_s::type.
Referenced by LE_AddToScene().
void LE_Lock | ( | le_t * | le | ) |
Markes a le_t struct as locked. Should be called at the beginning of an event handler on this le_t, and paired with a LE_Unlock at the end.
le | The struct to be locked. |
Definition at line 1099 of file cl_localentity.c.
References Com_Error(), le_s::entnum, ERR_DROP, le_s::locked, and qtrue.
Referenced by CL_ActorAppear(), CL_ActorDie(), CL_ActorDoMove(), and CL_ActorRevitalised().
void LE_PlaceItem | ( | le_t * | le | ) |
[in] | le | The local entity (ET_ITEM) with the floor container |
Definition at line 820 of file cl_localentity.c.
References le_s::angles, objDef_s::center, cl, cls, Com_Error(), ERR_DROP, ET_ACTOR, ET_ACTOR2x2, le_s::fieldSize, FLOOR, Grid_PosToVec(), GROUND_DELTA, objDef_s::id, objDef_s::idx, LE_BiggestItem(), LE_GetNextInUse(), LE_IsItem, le_s::model1, client_static_s::modelPool, le_s::origin, le_s::pos, qtrue, le_s::removeNextFrame, ROLL, le_s::type, VectorCompare, and VectorSubtract.
Referenced by CL_InvAdd(), and CL_InvDel().
static void LE_PlayFootStepSound | ( | le_t * | le | ) | [static] |
Definition at line 522 of file cl_localentity.c.
References CL_Trace(), cl_worldlevel, cvar_s::integer, LE_PlaySoundFileAndParticleForSurface(), LE_PlaySoundFileForContents(), MASK_SOLID, cBspSurface_s::name, le_s::pathContents, le_s::pathPos, le_s::pos, PosToVec, trace_s::surface, UNIT_HEIGHT, vec3_origin, and VectorCopy.
Referenced by LE_DoPathMove().
static void LE_PlaySoundFileAndParticleForSurface | ( | le_t * | le, | |
const char * | textureName | |||
) | [static] |
Plays step sounds and draw particles for different terrain types.
[in] | le | The local entity to play the sound and draw the particle for |
[in] | textureName | The name of the texture the actor is standing on |
Definition at line 479 of file cl_localentity.c.
References CL_ParticleSpawn(), Com_DPrintf(), Com_GetTerrainType(), DEBUG_SOUND, terrainType_s::footStepSound, terrainType_s::footStepVolume, LE_IsLivingAndVisibleActor(), LE_IsStunned, terrainType_s::particle, le_s::pos, PosToVec, S_LoadSample(), S_PlaySample(), and SOUND_ATTN_STATIC.
Referenced by LE_PlayFootStepSound().
static void LE_PlaySoundFileForContents | ( | le_t * | le, | |
int | contents | |||
) | [static] |
Plays sound of content for moving actor.
[in] | le | Pointer to local entity being an actor. |
[in] | contents | The contents flag of the brush we are currently in |
Definition at line 449 of file cl_localentity.c.
References cls, CONTENTS_WATER, le_s::origin, le_s::positionContents, S_PlaySample(), SND_VOLUME_FOOTSTEPS, SOUND_ATTN_IDLE, SOUND_WATER_IN, SOUND_WATER_MOVE, SOUND_WATER_OUT, client_static_s::soundPool, le_s::state, and STATE_CROUCHED.
Referenced by LE_PlayFootStepSound().
Definition at line 239 of file cl_localentity.c.
References Com_DPrintf(), DEBUG_EVENTSYS, le_s::entnum, and le_s::think.
Referenced by CL_ActorAppear(), CL_ActorDie(), CL_ActorDoMove(), CL_ActorRevitalised(), CL_ActorStateChange(), CL_AddBrushModel(), CL_InvAdd(), CL_InvDel(), LE_AddGrenade(), LE_AddProjectile(), LE_DoEndPathMove(), LET_StartIdle(), and LET_StartPathMove().
void LE_Think | ( | void | ) |
Calls the le think function and updates the animation. The animation updated even if the particular local entity is invisible for the client. This ensures, that an animation is always lerped correctly and won't magically start again once the local entity gets visible again.
Definition at line 323 of file cl_localentity.c.
References le_s::as, ca_active, cls, client_static_s::frametime, LE_ExecuteThink(), LE_GetNext(), le_s::model1, R_AnimRun(), and client_static_s::state.
Referenced by CL_Frame().
void LE_Unlock | ( | le_t * | le | ) |
Unlocks a previously locked le_t struct.
le | The le_t to unlock. |
Definition at line 1118 of file cl_localentity.c.
References Com_Error(), le_s::entnum, ERR_DROP, le_s::locked, and qfalse.
Referenced by CL_ActorAppear(), CL_ActorDie(), CL_ActorRevitalised(), and LE_DoEndPathMove().
void LET_BrushModel | ( | le_t * | le | ) |
Definition at line 932 of file cl_localentity.c.
References le_s::angles, cl, le_s::dir, ET_ROTATING, le_s::rotationSpeed, le_s::speed, le_s::thinkDelay, and le_s::type.
Referenced by CL_AddBrushModel().
static void LET_PathMove | ( | le_t * | le | ) | [static] |
Move the actor along the path to the given location.
Definition at line 612 of file cl_localentity.c.
References cl, dest, le_s::endTime, le_s::fieldSize, Grid_PosToVec(), LE_DoEndPathMove(), LE_DoPathMove(), le_s::oldPos, le_s::origin, le_s::pathLength, le_s::pathPos, le_s::pos, le_s::startTime, VectorCopy, VectorMA(), and VectorSubtract.
Referenced by LET_StartPathMove().
static void LET_Projectile | ( | le_t * | le | ) | [static] |
Definition at line 668 of file cl_localentity.c.
References ptl_s::angles, bytedirs, cl, CL_ActorPlaySound(), CL_OutsideMap(), CL_ParticleFree(), CL_ParticleSpawn(), csi, csi_s::damStunGas, le_s::dir, objDef_s::dmgtype, le_s::endTime, le_s::fd, fireDef_s::impactAttenuation, le_s::inuse, LE_ActorBodyHit(), fireDef_s::obj, le_s::origin, le_s::ptl, qfalse, le_s::ref1, le_s::ref2, le_s::ref3, ptl_s::s, S_LoadSample(), S_PlaySample(), SND_HURT, SND_VOLUME_WEAPONS, le_s::state, UNIT_SIZE, VecToAngles(), and VectorCopy.
Referenced by LE_AddGrenade(), and LE_AddProjectile().
void LET_StartIdle | ( | le_t * | le | ) |
Change the animation of an actor to the idle animation (which can be panic, dead or stand).
Definition at line 423 of file cl_localentity.c.
References le_s::as, ET_ACTORHIDDEN, LE_GetAnim(), LE_GetAnimationIndexForDeath, LE_IsDead, LE_IsPaniced, LE_SetThink(), le_s::left, le_s::model1, le_s::pathLength, le_s::pathPos, R_AnimChange(), le_s::right, le_s::state, le_s::type, and va().
Referenced by CL_ActorAppear(), CL_ActorRevitalised(), CL_ActorStateChange(), CL_InvAdd(), CL_InvDel(), and LE_DoEndPathMove().
void LET_StartPathMove | ( | le_t * | le | ) |
Change the actors animation to walking.
Definition at line 653 of file cl_localentity.c.
References le_s::as, animState_s::change, Com_Printf(), le_s::entnum, LE_ExecuteThink(), LE_GetAnim(), LE_SetThink(), le_s::left, LET_PathMove(), le_s::model1, le_s::pnum, R_AnimChange(), le_s::right, le_s::state, and le_s::team.
Referenced by CL_ActorDoMove().
localModel_t* LM_AddModel | ( | const char * | model, | |
const vec3_t | origin, | |||
const vec3_t | angles, | |||
int | entnum, | |||
int | levelflags, | |||
int | renderFlags, | |||
const vec3_t | scale | |||
) |
Prepares local (not known or handled by the server) models to the map, which will be added later in LM_AddToScene().
[in] | model | The model name. |
[in] | origin | Origin of the model (position on map). |
[in] | angles | Angles of the model (how it should be rotated after adding to map). |
[in] | scale | Scaling of the model (how it should be scaled after adding to map). |
[in] | entnum | Entity number. |
[in] | levelflags | The levels in which the entity resides/is visible. |
[in] | renderFlags | The flags for the renderer, eg. 'translucent'. |
Definition at line 273 of file cl_localentity.c.
References localModel_s::angles, cl, Com_Error(), localModel_s::entnum, ERR_DROP, localModel_s::inuse, localModel_s::levelflags, LM_Find(), MAX_LOCALMODELS, localModel_s::name, localModel_s::origin, Q_strncpyz(), qtrue, localModel_s::renderFlags, localModel_s::scale, and VectorCopy.
Referenced by SP_misc_model().
void LM_AddToScene | ( | void | ) |
Add the local models to the scene.
Definition at line 156 of file cl_localentity.c.
References LM_AddToSceneOrder(), qfalse, and qtrue.
Referenced by CL_ViewRender().
static void LM_AddToSceneOrder | ( | qboolean | parents | ) | [static] |
Definition at line 90 of file cl_localentity.c.
References localModel_s::angles, localModel_s::animname, localModel_s::as, cl, cl_worldlevel, cls, Com_Error(), ERR_DROP, localModel_s::frame, client_static_s::frametime, i, localModel_s::id, cvar_s::integer, localModel_s::inuse, localModel_s::levelflags, localModel_s::model, model_s::name, localModel_s::origin, localModel_s::parent, R_AddEntity(), R_AnimRun(), R_EntitySetOrigin(), R_GetEntity(), localModel_s::renderEntityNum, localModel_s::renderFlags, localModel_s::scale, localModel_s::skin, localModel_s::tagname, and VectorCopy.
Referenced by LM_AddToScene().
static localModel_t* LM_Find | ( | int | entnum | ) | [inline, static] |
Checks whether a local model with the same entity number is already registered.
Definition at line 165 of file cl_localentity.c.
Referenced by LM_AddModel().
localModel_t* LM_GetByID | ( | const char * | id | ) |
Definition at line 246 of file cl_localentity.c.
Referenced by LMT_Init(), and SP_misc_model().
void LM_Register | ( | void | ) |
Register misc_models.
Definition at line 220 of file cl_localentity.c.
References localModel_s::animname, localModel_s::as, animState_s::change, cl, Com_Printf(), i, localModel_s::inuse, localModel_s::model, localModel_s::name, qfalse, R_AnimChange(), and R_RegisterModelShort().
Referenced by CL_ViewLoadMedia().
void LM_Think | ( | void | ) |
Definition at line 337 of file cl_localentity.c.
References cl, i, and localModel_s::think.
Referenced by CL_SpawnParseEntitystring().
void LMT_Init | ( | localModel_t * | localModel | ) |
Definition at line 946 of file cl_localentity.c.
References Com_Error(), ERR_DROP, LM_GetByID(), localModel_s::parent, localModel_s::target, and localModel_s::think.
Referenced by SP_misc_model().
Definition at line 38 of file cl_localentity.c.
Referenced by CL_InitLocal().
char retAnim[MAX_VAR] [static] |
Definition at line 353 of file cl_localentity.c.