UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_localentity.cpp File Reference

Local entity management. More...

#include "../client.h"
#include "cl_localentity.h"
#include "../sound/s_main.h"
#include "../sound/s_sample.h"
#include "cl_particle.h"
#include "cl_actor.h"
#include "cl_hud.h"
#include "../renderer/r_mesh_anim.h"
#include "../renderer/r_draw.h"
#include "../../common/tracing.h"
#include "../../common/grid.h"
#include "../../shared/moveclip.h"

Go to the source code of this file.

Data Structures

class  MoveClipCL
 Client side moveclip. More...
 

Functions

static void LE_GenerateInlineModelList (void)
 
static void CL_GridRecalcRouting (const le_t *le)
 
void CL_CompleteRecalcRouting (void)
 
void CL_RecalcRouting (const le_t *le)
 
static void LM_AddToSceneOrder (bool parents)
 
void LM_AddToScene (void)
 Add the local models to the scene. More...
 
static localModel_tLM_Find (int entnum)
 Checks whether a local model with the same entity number is already registered. More...
 
void LE_LinkFloorContainer (le_t *le)
 link any floor container into the actor temp floor container More...
 
bool LE_IsActor (const le_t *le)
 Checks whether the given le is a living actor. More...
 
bool LE_IsLivingActor (const le_t *le)
 Checks whether the given le is a living actor (but might be hidden) More...
 
bool LE_IsLivingAndVisibleActor (const le_t *le)
 Checks whether the given le is a living and visible actor. More...
 
void LM_Register (void)
 Register misc_models. More...
 
void LE_SetThink (le_t *le, localEntityThinkFunc_t think)
 
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(). More...
 
void LE_ExecuteThink (le_t *le)
 Call think function for the given local entity if its still in use. More...
 
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. More...
 
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. More...
 
void LET_StartIdle (le_t *le)
 Change the animation of an actor to the idle animation (which can be panic, dead or stand) More...
 
static void LE_PlaySoundFileForContents (le_t *le, int contents)
 Plays sound of content for moving actor. More...
 
static void LE_PlaySoundFileAndParticleForSurface (le_t *le, const char *textureName)
 Plays step sounds and draw particles for different terrain types. More...
 
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. More...
 
static void LE_ActorBodyHit (const le_t *le, const vec3_t impact, int normal)
 Spawns particle effects for a hit actor. More...
 
static void LET_PathMove (le_t *le)
 Move the actor along the path to the given location. More...
 
void LET_StartPathMove (le_t *le)
 Change the actors animation to walking. More...
 
void LET_HiddenMove (le_t *le)
 Handle move for invisible actors. More...
 
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 const objDef_tLE_BiggestItem (const Item *ic)
 Returns the index of the biggest item in the inventory list. More...
 
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)
 
bool LE_BrushModelAction (le_t *le, entity_t *ent)
 Add function for brush models. More...
 
void LET_BrushModel (le_t *le)
 
void LMT_Init (localModel_t *localModel)
 
void LET_RotateDoor (le_t *le, int speed)
 Rotates a door in the given speed. More...
 
void LET_SlideDoor (le_t *le, int speed)
 Slides a door. More...
 
void LE_AddAmbientSound (const char *sound, const vec3_t origin, int levelflags, float volume, float attenuation)
 Adds ambient sounds from misc_sound entities. More...
 
le_tLE_Add (int entnum)
 Add a new local entity to the scene. More...
 
void _LE_NotFoundError (int entnum, int type, const char *file, const int line)
 
void LE_CenterView (const le_t *le)
 Center the camera on the local entity's origin. More...
 
le_tLE_Get (int entnum)
 Searches all local entities for the one with the searched entnum. More...
 
bool LE_IsLocked (int entnum)
 Checks if a given le_t structure is locked, i.e., used by another event at this time. More...
 
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. More...
 
void LE_Unlock (le_t *le)
 Unlocks a previously locked le_t struct. More...
 
le_tLE_GetFromPos (const pos3_t pos)
 Searches a local entity on a given grid field. More...
 
le_tLE_GetNext (le_t *lastLE)
 Iterate through the list of entities. More...
 
le_tLE_GetNextInUse (le_t *lastLE)
 Iterate through the entities that are in use. More...
 
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. More...
 
le_tLE_Find (entity_type_t type, const pos3_t pos)
 Searches a local entity on a given grid field. More...
 
static bool LE_IsOriginBrush (const le_t *const le)
 
static void LE_AddEdictHighlight (const le_t *le)
 Adds a box that highlights the current active door. More...
 
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. More...
 
const cBspModel_tLE_GetClipModel (const le_t *le)
 
model_tLE_GetDrawModel (unsigned int index)
 
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. More...
 
static void CL_ClipMoveToLEs (MoveClipCL *clip)
 Clip against solid entities. More...
 
trace_t CL_Trace (const Line &traceLine, const AABB &box, const le_t *passle, le_t *passle2, int contentmask, int worldLevel)
 Moves the given mins/maxs volume through the world from start to end. More...
 

Variables

cvar_tcl_le_debug
 
cvar_tcl_trace_debug
 
cvar_tcl_map_draw_rescue_zone
 

Detailed Description

Local entity management.

Definition in file cl_localentity.cpp.

Function Documentation

void _LE_NotFoundError ( int  entnum,
int  type,
const char *  file,
const int  line 
)

Definition at line 1239 of file cl_localentity.cpp.

References Cmd_ExecuteString(), Com_Error(), and ERR_DROP.

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]leThe local entity to get the bmodel from
[out]tileThe maptile the bmodel belongs, too
[out]rmaShiftthe shift vector in case of an RMA (needed for doors)
[out]anglesThe rotation of the entity (in case of bmodels)
Returns
The headnode for the local entity
See also
SV_HullForEntity

Definition at line 1659 of file cl_localentity.cpp.

References le_s::aabb, le_s::angles, cl, CM_HeadnodeForBox(), Com_Error(), le_s::contents, CONTENTS_SOLID, ERR_DROP, cBspModel_s::headnode, LE_GetClipModel(), mapTiles_s::mapTiles, clientBattleScape_s::mapTiles, 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]leA local entity of a brush model (func_breakable, func_door, ...)

Definition at line 145 of file cl_localentity.cpp.

References CL_ActorConditionalMoveCalc(), CL_GridRecalcRouting(), LE_GenerateInlineModelList(), and selActor.

Referenced by CL_AddBrushModel(), CL_Explode(), LET_RotateDoor(), and LET_SlideDoor().

trace_t CL_Trace ( const Line traceLine,
const AABB box,
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_ClipMoveToLEs
SV_Trace
Parameters
[in]traceLineStart and end vector of the trace
[in]boxThe box we move through the world
[in]passleIgnore this local entity in the trace (might be nullptr)
[in]passle2Ignore this local entity in the trace (might be nullptr)
[in]contentmaskSearched content the trace should watch for
[in]worldLevelThe worldlevel (0-7) to calculate the levelmask for the trace from

Definition at line 1739 of file cl_localentity.cpp.

References MoveClip::calcBounds(), cl, CL_ClipMoveToLEs(), CM_CompleteBoxTrace(), MoveClip::contentmask, trace_s::fraction, cvar_s::integer, trace_s::le, clientBattleScape_s::mapTiles, MoveClip::moveLine, MoveClip::objBox, MoveClipCL::passle, MoveClipCL::passle2, R_DrawBoundingBoxBatched(), Line::set(), AABB::set(), and MoveClipCL::trace.

Referenced by CL_ActorVis(), CL_TargetingGrenade(), CL_TargetingStraight(), LE_PlayFootStepSound(), PTL_Trace(), and Weather::update().

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

Spawns particle effects for a hit actor.

Parameters
[in]leThe actor to spawn the particles for.
[in]impactThe impact location (where the particles are spawned).
[in]normalThe index of the normal vector of the particles (think: impact angle).

Definition at line 663 of file cl_localentity.cpp.

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 
)
le_t* LE_Add ( int  entnum)
void LE_AddAmbientSound ( const char *  sound,
const vec3_t  origin,
int  levelflags,
float  volume,
float  attenuation 
)
static void LE_AddEdictHighlight ( const le_t le)
static

Adds a box that highlights the current active door.

Definition at line 1470 of file cl_localentity.cpp.

References le_s::angles, CalculateMinsMaxs(), cBspModel_s::cbmBox, cl, LE_GetClipModel(), le_s::origin, R_AddEntity(), RF_BOX, clientBattleScape_s::time, and VectorSet.

Referenced by LE_AddToScene().

void LE_AddGrenade ( const fireDef_t fd,
int  flags,
const vec3_t  muzzle,
const vec3_t  v0,
int  dt,
le_t leVictim 
)
Parameters
[in]fdThe grenade fire definition
[in]flagsbitmask: SF_BODY, SF_IMPACT, SF_BOUNCING, SF_BOUNCED
[in]muzzlestarting/location vector
[in]v0velocity vector
[in]dtdelta seconds
[in]leVictimThe actor the grenade is thrown at (not yet supported)

Definition at line 940 of file cl_localentity.cpp.

References le_s::angle, ptl_s::angles, fireDef_s::bounce, fireDef_s::bounceSound, cl, CL_ParticleSpawn(), crand(), le_s::endTime, le_s::fd, GRAVITY, fireDef_s::hitBody, fireDef_s::hitBodySound, fireDef_s::impact, fireDef_s::impactSound, le_s::inuse, LE_Add(), LE_ExecuteThink(), LE_SetInvisible, LE_SetThink(), LET_Projectile(), ptl_s::omega, fireDef_s::projectile, le_s::ptl, le_s::ref1, le_s::ref2, le_s::ref3, SF_BODY, SF_BOUNCING, SF_IMPACT, fireDef_s::splrad, clientBattleScape_s::time, and VectorSet.

Referenced by CL_ActorDoThrow().

static const objDef_t* LE_BiggestItem ( const Item 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 Item

Definition at line 873 of file cl_localentity.cpp.

References Item::def(), Item::getNext(), INVSH_ShapeSize(), and objDef_s::shape.

Referenced by LE_PlaceItem().

void LE_CenterView ( const le_t le)
void LE_Cleanup ( void  )

Cleanup unused LE inventories that the server sent to the client also free some unused LE memory.

Definition at line 1557 of file cl_localentity.cpp.

References CID_FLOOR, cl, CL_ActorCleanup(), cls, Com_DPrintf(), DEBUG_CLIENT, InventoryInterface::emptyContainer(), client_static_s::i, i, le_s::inuse, le_s::inv, LE_IsActor(), LE_IsItem, clientBattleScape_s::LEs, and clientBattleScape_s::numLEs.

Referenced by CL_ClearState().

void LE_ExecuteThink ( le_t le)

Call think function for the given local entity if its still in use.

Definition at line 371 of file cl_localentity.cpp.

References le_s::inuse, and le_s::think.

Referenced by LE_AddGrenade(), LE_AddProjectile(), LE_DoEndPathMove(), LE_Think(), LET_HiddenMove(), and LET_StartPathMove().

le_t* LE_Find ( entity_type_t  type,
const pos3_t  pos 
)

Searches a local entity on a given grid field.

Parameters
[in]typeEntity type
[in]posThe grid pos to search for an item of the given type

Definition at line 1441 of file cl_localentity.cpp.

References LE_GetNextInUse(), le_s::pos, le_s::type, and VectorCompare.

Referenced by CL_ActorRevitalised(), and LE_LinkFloorContainer().

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]fromThe entity to start the search from. nullptr will start from the beginning.
[in]orgThe origin that is the center of the circle.
[in]radradius to search an edict in.
[in]typeType of local entity. ET_NULL to ignore the type.

Definition at line 1416 of file cl_localentity.cpp.

References le_s::aabb, ET_NULL, AABB::getCenter(), LE_GetNextInUse(), le_s::origin, le_s::type, and VectorLength().

static void LE_GenerateInlineModelList ( void  )
inlinestatic
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]animType of animation (for example "stand", "walk")
[in]rightods index to determine the weapon in the actors right hand
[in]leftods index to determine the weapon in the actors left hand
[in]statethe actors state - e.g. STATE_CROUCHED (crouched animations) have a 'c' in front of their animation definitions (see *.anm files for characters)

Definition at line 423 of file cl_localentity.cpp.

References objDef_s::animationIndex, Com_sprintf(), INVSH_GetItemByIDX(), length, MAX_VAR, NONE, Q_streq, Q_strstart(), STATE_CROUCHED, type, and objDef_s::type.

Referenced by CL_ActorDoShoot(), CL_ActorStartShoot(), LET_StartIdle(), and LET_StartPathMove().

const cBspModel_t* LE_GetClipModel ( const le_t le)
model_t* LE_GetDrawModel ( unsigned int  index)
le_t* LE_GetFromPos ( const pos3_t  pos)

Searches a local entity on a given grid field.

Parameters
[in]posThe grid pos to search for an item of the given type

Definition at line 1353 of file cl_localentity.cpp.

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
lastLEThe entity found in the previous iteration; if nullptr, we start at the beginning

Definition at line 1370 of file cl_localentity.cpp.

References cl, clientBattleScape_s::LEs, and clientBattleScape_s::numLEs.

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
lastLEThe entity found in the previous iteration; if nullptr, we start at the beginning

Definition at line 1398 of file cl_localentity.cpp.

References le_s::inuse, and LE_GetNext().

Referenced by CL_ActorConfirmAction_f(), CL_ActorGetClosest(), CL_BattlescapeSearchAtGridPos(), CL_BuildForbiddenList(), CL_ClipMoveToLEs(), CL_CountVisibleEnemies(), CL_EntPerish(), CL_NotifyBattlescapeEventDelay(), CL_ViewLoadMedia(), uiRadarNode::draw(), GAME_CollectAliens(), GAME_CollectItems(), LE_Find(), LE_FindRadius(), LE_GenerateInlineModelList(), LE_Get(), LE_GetFromPos(), LE_PlaceItem(), and S_Frame().

bool LE_IsActor ( const le_t le)

Checks whether the given le is a living actor.

Parameters
[in]leThe local entity to perform the check for
See also
G_IsLivingActor

Definition at line 253 of file cl_localentity.cpp.

References ET_ACTOR, ET_ACTOR2x2, ET_ACTORHIDDEN, and le_s::type.

Referenced by CL_ActorDoMove(), CL_ActorDoShoot(), CL_ActorDoTurn(), CL_ActorInvMove(), CL_ActorMouseTrace(), CL_ActorStateChange(), GAME_CollectAliens(), GAME_CollectItems(), LE_Cleanup(), and LE_IsLivingActor().

bool LE_IsLivingActor ( const le_t le)

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

Parameters
[in]leThe local entity to perform the check for
See also
G_IsLivingActor
LE_IsActor

Definition at line 265 of file cl_localentity.cpp.

References LE_IsActor(), LE_IsDead, and LE_IsStunned.

Referenced by CL_ActorAppear(), CL_ActorConfirmAction_f(), CL_ActorDie(), CL_ActorRevitalised(), CL_ActorStartShoot(), CL_ActorStateChange(), CL_NotifyBattlescapeEventDelay(), CL_SoundEvent(), and LE_IsLivingAndVisibleActor().

bool LE_IsLivingAndVisibleActor ( const le_t le)

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

Parameters
[in]leThe local entity to perform the check for
See also
G_IsLivingActor
LE_IsActor

Definition at line 277 of file cl_localentity.cpp.

References ET_ACTORHIDDEN, LE_IsInvisible, LE_IsLivingActor(), and le_s::type.

Referenced by CL_ActorGetClosest(), CL_BattlescapeSearchAtGridPos(), CL_BuildForbiddenList(), CL_CountVisibleEnemies(), CL_NextAlien_f(), CL_NextAlienVisibleFromActor_f(), CL_PrevAlien_f(), and LE_PlaySoundFileAndParticleForSurface().

bool LE_IsLocked ( int  entnum)

Checks if a given le_t structure is locked, i.e., used by another event at this time.

Parameters
entnumthe 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 1309 of file cl_localentity.cpp.

References le_s::flags, LE_Get(), and LE_LOCKED.

Referenced by CL_CheckDefault().

static bool LE_IsOriginBrush ( const le_t *const  le)
inlinestatic

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
leThe local entity to check
Returns
true if the given local entity is a func_door or func_rotating

Definition at line 1462 of file cl_localentity.cpp.

References ET_DOOR, ET_ROTATING, and le_s::type.

Referenced by LE_AddToScene().

void LE_LinkFloorContainer ( le_t le)

link any floor container into the actor temp floor container

Definition at line 239 of file cl_localentity.cpp.

References ET_ITEM, LE_Find(), le_s::pos, le_s::resetFloor(), and le_s::setFloor().

Referenced by LE_DoEndPathMove().

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
leThe 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 1322 of file cl_localentity.cpp.

References Com_Error(), le_s::entnum, ERR_DROP, le_s::flags, and LE_LOCKED.

Referenced by CL_ActorAppear(), CL_ActorDie(), CL_ActorDoMove(), and CL_ActorRevitalised().

static void LE_PlaySoundFileAndParticleForSurface ( le_t le,
const char *  textureName 
)
static

Plays step sounds and draw particles for different terrain types.

Parameters
[in]leThe local entity to play the sound and draw the particle for
[in]textureNameThe 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 544 of file cl_localentity.cpp.

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_LoadAndPlaySample(), 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]lePointer to local entity being an actor.
[in]contentsThe 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 514 of file cl_localentity.cpp.

References CONTENTS_WATER, LE_IsCrouched, le_s::origin, le_s::positionContents, S_PlayStdSample(), SND_VOLUME_FOOTSTEPS, SOUND_ATTN_IDLE, SOUND_WATER_IN, SOUND_WATER_MOVE, and SOUND_WATER_OUT.

Referenced by LE_PlayFootStepSound().

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 387 of file cl_localentity.cpp.

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
leThe 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 1341 of file cl_localentity.cpp.

References Com_Error(), le_s::entnum, ERR_DROP, le_s::flags, and LE_LOCKED.

Referenced by CL_ActorAppear(), CL_ActorDie(), CL_ActorRevitalised(), LE_DoEndPathMove(), and LET_HiddenMove().

void LET_BrushModel ( le_t le)
void LET_HiddenMove ( le_t le)

Handle move for invisible actors.

Note
Think function.
Todo:
Is there something we should do here?

Definition at line 737 of file cl_localentity.cpp.

References LE_ExecuteThink(), LE_SetThink(), LE_Unlock(), LET_StartIdle(), le_s::newPos, le_s::pos, and VectorCopy.

Referenced by CL_ActorDoMove().

static void LET_PathMove ( le_t le)
static
void LET_RotateDoor ( le_t le,
int  speed 
)

Rotates a door in the given speed.

Parameters
[in]leThe local entity of the door to rotate
[in]speedThe speed to rotate the door with
Todo:
lerp the rotation

Definition at line 1081 of file cl_localentity.cpp.

References le_s::angles, cl, CL_RecalcRouting(), CM_SetInlineModelOrientation(), le_s::dir, DOOR_OPEN_REVERSE, DOOR_ROTATION_ANGLE, le_s::inlineModelName, LE_SetThink(), clientBattleScape_s::mapTiles, and le_s::origin.

Referenced by LET_DoorRotatingClose(), and LET_DoorRotatingOpen().

void LET_SlideDoor ( le_t le,
int  speed 
)

Slides a door.

Note
Though doors, sliding doors need a very different handling: because it's movement is animated (unlike the rotating door), the final position that is used to calculate the routing data is set once the animation finished (because this recalculation might be very expensive).
Parameters
[in,out]leThe local entity of the inline model
[in]speedThe speed to slide with - a negative value to close the door
See also
Door_SlidingUse

Definition at line 1110 of file cl_localentity.cpp.

References AngleVectors(), cBspModel_s::cbmBox, cl, CL_RecalcRouting(), CM_InlineModel(), le_s::dir, DotProduct, GET_SLIDING_DOOR_SHIFT_VECTOR, le_s::inlineModelName, LE_SetThink(), clientBattleScape_s::mapTiles, le_s::origin, AABB::shift(), le_s::size, le_s::thinkDelay, VectorAdd, VectorEmpty, and VectorMul.

Referenced by LET_DoorSlidingClose(), and LET_DoorSlidingOpen().

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 478 of file cl_localentity.cpp.

References le_s::as, Com_Error(), le_s::entnum, ERR_DROP, LE_GetAnim(), LE_GetAnimationIndexForDeath, LE_IsDead, LE_IsInvisible, LE_IsPanicked, LE_SetThink(), le_s::left, Mem_Free, le_s::model1, leStep_s::next, le_s::pathLength, le_s::pathPos, R_AnimChange(), le_s::right, le_s::state, le_s::stepIndex, le_s::stepList, and va().

Referenced by CL_ActorAppear(), CL_ActorEndShoot(), CL_ActorRevitalised(), CL_ActorStateChange(), CL_InvAdd(), CL_InvDel(), LE_DoEndPathMove(), and LET_HiddenMove().

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 716 of file cl_localentity.cpp.

References le_s::as, animState_s::change, cls, Com_Printf(), le_s::entnum, client_static_s::isOurRound(), LE_CenterView(), 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, le_s::team, and TEAM_CIVILIAN.

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]modelThe model name.
[in]originOrigin of the model (position on map).
[in]anglesAngles of the model (how it should be rotated after adding to map).
[in]scaleScaling of the model (how it should be scaled after adding to map).
[in]entnumEntity number.
[in]levelflagsThe levels in which the entity resides/is visible.
[in]renderFlagsThe flags for the renderer, eg. 'translucent'.
Note
misc_model
See also
CL_SpawnParseEntitystring
LM_AddToScene

Definition at line 341 of file cl_localentity.cpp.

References localModel_s::angles, cl, Com_Error(), localModel_s::entnum, ERR_DROP, localModel_s::inuse, localModel_s::levelflags, LM_Find(), clientBattleScape_s::LMs, MAX_LOCALMODELS, localModel_s::name, clientBattleScape_s::numLMs, OBJZERO, localModel_s::origin, Q_strncpyz(), localModel_s::renderFlags, localModel_s::setScale(), 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 218 of file cl_localentity.cpp.

References LM_AddToSceneOrder().

Referenced by CL_ViewRender().

static localModel_t* LM_Find ( int  entnum)
inlinestatic

Checks whether a local model with the same entity number is already registered.

Definition at line 227 of file cl_localentity.cpp.

References cl, localModel_s::entnum, i, clientBattleScape_s::LMs, and clientBattleScape_s::numLMs.

Referenced by LM_AddModel().

localModel_t* LM_GetByID ( const char *  id)
void LM_Think ( void  )
void LMT_Init ( localModel_t localModel)

Variable Documentation

cvar_t* cl_le_debug

Definition at line 39 of file cl_localentity.cpp.

Referenced by CL_InitLocal().

cvar_t* cl_map_draw_rescue_zone

Definition at line 41 of file cl_localentity.cpp.

Referenced by CL_ViewInit().

cvar_t* cl_trace_debug

Definition at line 40 of file cl_localentity.cpp.

Referenced by CL_InitLocal().