cl_localentity.c File Reference

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"
Include dependency graph for cl_localentity.c:

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_tLM_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_tLM_GetByID (const char *id)
localModel_tLM_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_tLE_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_tLE_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_tLE_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_tLE_GetFromPos (const pos3_t pos)
 Searches a local entity on a given grid field.
le_tLE_GetNext (le_t *lastLE)
 Iterate through the list of entities.
le_tLE_GetNextInUse (le_t *lastLE)
 Iterate through the entities that are in use.
le_tLE_FindRadius (le_t *from, const vec3_t org, float rad, entity_type_t type)
 Returns entities that have origins within a spherical area.
le_tLE_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_tcl_le_debug
static char retAnim [MAX_VAR]

Detailed Description

Local entity management.

Definition in file cl_localentity.c.


Define Documentation

#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)
See also:
BoxOffset in cl_actor.c

Definition at line 1233 of file cl_localentity.c.

Referenced by LE_AddToScene().


Function Documentation

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]
void CL_CompleteRecalcRouting ( void   ) 
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.

Parameters:
[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)
Returns:
The headnode for the local entity
See also:
SV_HullForEntity

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  ) 
See also:
CL_Explode
Parameters:
[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.

Note:
Passedict and edicts owned by passedict are explicitly not checked.
See also:
CL_TraceBounds
CL_ClipMoveToLEs
SV_Trace
Parameters:
[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.

Parameters:
[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
See also:
CL_Trace
Note:
Box is expanded by 1

Definition at line 1507 of file cl_localentity.c.

Referenced by CL_Trace().

static void LE_ActorBodyHit ( const le_t le,
const vec3_t  impact,
int  normal 
) [static]

Spawns particle effects for a hit actor.

Parameters:
[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.

Parameters:
[in] entnum The entity number (server side)
See also:
LE_Get

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 
)
void LE_AddGrenade ( const fireDef_t fd,
int  flags,
const vec3_t  muzzle,
const vec3_t  v0,
int  dt,
le_t leVictim 
)
Parameters:
[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 
)
void LE_AddToScene ( void   ) 
static objDef_t* LE_BiggestItem ( const invList_t ic  )  [static]

Returns the index of the biggest item in the inventory list.

Note:
This item is the only one that will be drawn when lying at the floor
See also:
LE_PlaceItem
Returns:
the item index in the csi.ods array
Note:
Only call this for none empty invList_t - see FLOOR, LEFT, RIGHT and so on macros

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().

qboolean LE_BrushModelAction ( le_t le,
entity_t ent 
)

Add function for brush models.

See also:
LE_AddToScene

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.

Parameters:
le The local entity which origin is used to center the camera
See also:
CL_CenterView
CL_ViewCenterAtGridPosition
CL_CameraRoute

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  ) 
static void LE_DoPathMove ( le_t le  )  [static]
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().

le_t* LE_Find ( int  type,
const pos3_t  pos 
)

Searches a local entity on a given grid field.

Parameters:
[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.

Parameters:
[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  ) 
const char* LE_GetAnim ( const char *  anim,
int  right,
int  left,
int  state 
)

Get the correct animation for the given actor state and weapons.

Parameters:
[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().

le_t* LE_GetFromPos ( const pos3_t  pos  ) 

Searches a local entity on a given grid field.

Parameters:
[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().

le_t* LE_GetNext ( le_t lastLE  ) 

Iterate through the list of entities.

Parameters:
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().

le_t* LE_GetNextInUse ( le_t lastLE  ) 

Iterate through the entities that are in use.

Note:
we can hopefully get rid of this function once we know when it makes sense to iterate through entities that are NOT in use
Parameters:
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().

qboolean LE_IsActor ( const le_t le  ) 

Checks whether the given le is a living actor.

Parameters:
[in] le The local entity to perform the check for
See also:
G_IsLivingActor

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().

qboolean LE_IsLivingActor ( const le_t le  ) 

Checks whether the given le is a living actor (but might be hidden).

Parameters:
[in] le The local entity to perform the check for
See also:
G_IsLivingActor
LE_IsActor

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().

qboolean LE_IsLivingAndVisibleActor ( const le_t le  ) 

Checks whether the given le is a living and visible actor.

Parameters:
[in] le The local entity to perform the check for
See also:
G_IsLivingActor
LE_IsActor

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.

Parameters:
entnum the entnum of the le_t struct involved.
Returns:
true if the le_t is locked (used by another event), false if it's not or if it doesn't exist.

Definition at line 1086 of file cl_localentity.c.

References LE_Get(), and le_s::locked.

Referenced by CL_CheckDefault().

static qboolean LE_IsOriginBrush ( const le_t *const   le  )  [inline, static]

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).

Parameters:
le The local entity to check
Returns:
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.

Parameters:
le The struct to be locked.
Note:
Always make sure you call LE_Unlock at the end of the event (might be in a different function), to allow other events on this le_t.

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  ) 
static void LE_PlayFootStepSound ( le_t le  )  [static]
static void LE_PlaySoundFileAndParticleForSurface ( le_t le,
const char *  textureName 
) [static]

Plays step sounds and draw particles for different terrain types.

Parameters:
[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
See also:
LET_PathMove

Todo:
use the Grid_Fall method (ACTOR_SIZE_NORMAL) to ensure, that the particle is drawn at the ground (if needed - maybe the origin is already ground aligned)

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.

Parameters:
[in] le Pointer to local entity being an actor.
[in] contents The contents flag of the brush we are currently in
Note:
Currently it supports only CONTENTS_WATER, any other special contents can be added here anytime.

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().

void LE_SetThink ( le_t le,
void(*)(le_t *le)  think 
)
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.

See also:
LET_StartIdle
LET_PathMove
LET_StartPathMove
LET_Projectile

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.

Parameters:
le The le_t to unlock.
Note:
Make sure that this is always paired with the corresponding LE_Lock around the conceptual beginning and ending of a le_t event. Should never be called by the handler(s) of a different event than the one that locked le. The owner of the lock is currently not checked.
Todo:
If the event loop ever becomes multithreaded, this should be a real mutex lock.

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  ) 
static void LET_PathMove ( le_t le  )  [static]

Move the actor along the path to the given location.

Note:
Think function
See also:
CL_ActorDoMove

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]
void LET_StartIdle ( le_t le  ) 

Change the animation of an actor to the idle animation (which can be panic, dead or stand).

Note:
We have more than one animation for dead - the index is given by the state of the local entity
Think function
See the *.anm files in the models dir

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.

Note:
Think function
See the *.anm files in the models dir

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().

Parameters:
[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'.
Note:
misc_model
See also:
CL_SpawnParseEntitystring
LM_AddToScene

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.

See also:
CL_ViewRender
LE_AddToScene
LM_AddModel

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]
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.

References cl, and i.

Referenced by LM_AddModel().

localModel_t* LM_GetByID ( const char *  id  ) 

Definition at line 246 of file cl_localentity.c.

References cl, and i.

Referenced by LMT_Init(), and SP_misc_model().

void LM_Register ( void   ) 
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  ) 

Variable Documentation

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.


Generated by  doxygen 1.6.2