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

Go to the source code of this file.

Data Structures

struct  leStep_s
 
struct  le_s
 a local entity More...
 
struct  localModel_s
 local models More...
 

Macros

#define IS_MODE_FIRE_RIGHT(x)   ((x) == M_FIRE_R || (x) == M_PEND_FIRE_R)
 
#define IS_MODE_FIRE_LEFT(x)   ((x) == M_FIRE_L || (x) == M_PEND_FIRE_L)
 
#define IS_MODE_FIRE_HEADGEAR(x)   ((x) == M_FIRE_HEADGEAR)
 
#define IS_MODE_FIRE_PENDING(x)   ((x) == M_PEND_FIRE_L || (x) == M_PEND_FIRE_R)
 
#define LE_CHECK_LEVELFLAGS   0x0001
 
#define LE_ALWAYS_VISIBLE   0x0002
 
#define LE_LOCKED   0x0004
 
#define LE_REMOVE_NEXT_FRAME   0x0008
 
#define LE_INVISIBLE   0x0010
 
#define LE_SELECTED   0x0020
 
#define MAX_LOCALMODELS   1024
 
#define LE_IsStunned(le)   (((le)->state & STATE_STUN) & ~STATE_DEAD)
 
#define LE_IsDead(le)   ((le)->state & STATE_DEAD)
 
#define LE_IsPanicked(le)   ((le)->state & STATE_PANIC)
 
#define LE_IsRaged(le)   ((le)->state & STATE_RAGE)
 
#define LE_IsInsane(le)   ((le)->state & STATE_INSANE)
 
#define LE_IsShaken(le)   ((le)->state & STATE_SHAKEN)
 
#define LE_IsCrouched(le)   ((le)->state & STATE_CROUCHED)
 
#define LE_IsDazed(le)   ((le)->state & STATE_DAZED)
 
#define LE_IsInvisible(le)   ((le)->flags & LE_INVISIBLE)
 
#define LE_IsSelected(le)   ((le)->flags & LE_SELECTED)
 
#define LE_SetInvisible(le)   do { if (cl_leshowinvis->integer) le->flags &= ~LE_INVISIBLE; else le->flags |= LE_INVISIBLE; } while (0)
 
#define LE_IsItem(le)   ((le)->type == ET_ITEM)
 
#define LE_IsCamera(le)   ((le)->type == ET_CAMERA)
 
#define LE_IsCivilian(le)   ((le)->team == TEAM_CIVILIAN)
 
#define LE_IsAlien(le)   ((le)->team == TEAM_ALIEN)
 
#define LE_IsPhalanx(le)   ((le)->team == TEAM_PHALANX)
 
#define LE_IsRotating(le)   ((le)->type == ET_ROTATING)
 
#define LE_IsDoor(le)   ((le)->type == ET_DOOR || (le)->type == ET_DOOR_SLIDING)
 
#define LE_IsBreakable(le)   ((le)->type == ET_BREAKABLE)
 
#define LE_IsBrushModel(le)   (LE_IsBreakable(le) || LE_IsDoor(le) || LE_IsRotating(le))
 
#define LE_IsNotSolid(le)   ((le)->type == ET_TRIGGER_RESCUE || (le)->type == ET_TRIGGER_NEXTMAP)
 
#define LE_GetAnimationIndexForDeath(le)   ((le)->state & MAX_DEATH)
 Valid indices from 1 - MAX_DEATH. More...
 
#define LE_NotFoundError(entnum)   _LE_NotFoundError(entnum, -1, __FILE__, __LINE__)
 
#define LE_NotFoundWithTypeError(entnum, type)   _LE_NotFoundError(entnum, type, __FILE__, __LINE__)
 

Typedefs

typedef bool(* localEntitiyAddFunc_t )(struct le_s *le, entity_t *ent)
 
typedef void(* localEntityThinkFunc_t )(struct le_s *le)
 
typedef struct leStep_s leStep_t
 
typedef struct le_s le_t
 a local entity More...
 
typedef struct localModel_s localModel_t
 local models More...
 

Enumerations

enum  actorModes_t {
  M_MOVE, M_FIRE_R, M_FIRE_L, M_FIRE_HEADGEAR,
  M_PEND_MOVE, M_PEND_FIRE_R, M_PEND_FIRE_L
}
 Actor actions. More...
 

Functions

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 LE_AddProjectile (const fireDef_t *fd, int flags, const vec3_t muzzle, const vec3_t impact, int normal, le_t *leVictim)
 
void LE_AddGrenade (const fireDef_t *fd, int flags, const vec3_t muzzle, const vec3_t v0, int dt, le_t *leVictim)
 
void LE_AddAmbientSound (const char *sound, const vec3_t origin, int levelflags, float volume, float attenuation)
 Adds ambient sounds from misc_sound entities. More...
 
int LE_ActorGetStepTime (const le_t *le, const pos3_t pos, const pos3_t oldPos, const int dir, const int sped)
 
void LE_SetThink (le_t *le, localEntityThinkFunc_t think)
 
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 LET_StartIdle (le_t *le)
 Change the animation of an actor to the idle animation (which can be panic, dead or stand) More...
 
void LET_Appear (le_t *le)
 
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...
 
void LET_BrushModel (le_t *le)
 
void LE_DoEndPathMove (le_t *le)
 Ends the move of an actor. More...
 
void LM_Think (void)
 
void LMT_Init (localModel_t *localModel)
 
localModel_tLM_AddModel (const char *model, const vec3_t origin, const vec3_t angles, int entnum, int levelflags, int flags, 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 LM_Perish (dbuffer *msg)
 
void LM_AddToScene (void)
 Add the local models to the scene. More...
 
bool LE_BrushModelAction (le_t *le, entity_t *ent)
 Add function for brush models. More...
 
void CL_RecalcRouting (const le_t *le)
 
void CL_CompleteRecalcRouting (void)
 
void LE_LinkFloorContainer (le_t *le)
 link any floor container into the actor temp floor container More...
 
bool LE_IsLivingAndVisibleActor (const le_t *le)
 Checks whether the given le is a living and visible 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_IsActor (const le_t *le)
 Checks whether the given le is a living actor. More...
 
le_tLE_Add (int entnum)
 Add a new local entity to the scene. More...
 
le_tLE_Get (int entnum)
 Searches all local entities for the one with the searched entnum. More...
 
le_tLE_GetNextInUse (le_t *lastLE)
 Iterate through the entities that are in use. More...
 
le_tLE_GetNext (le_t *lastLE)
 Iterate through the list of entities. 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...
 
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_NotFoundError (int entnum, int type, const char *file, const int line) __attribute__((noreturn))
 
le_tLE_Find (entity_type_t type, const pos3_t pos)
 Searches a local entity on a given grid field. 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_GetFromPos (const pos3_t pos)
 Searches a local entity on a given grid field. More...
 
void LE_PlaceItem (le_t *le)
 
void LE_Cleanup (void)
 Cleanup unused LE inventories that the server sent to the client also free some unused LE memory. More...
 
void LE_AddToScene (void)
 
void LE_CenterView (const le_t *le)
 Center the camera on the local entity's origin. More...
 
const cBspModel_tLE_GetClipModel (const le_t *le)
 
model_tLE_GetDrawModel (unsigned int modelIndex)
 
void LET_SlideDoor (le_t *le, int speed)
 Slides a door. More...
 
void LET_RotateDoor (le_t *le, int speed)
 Rotates a door in the given speed. 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...
 
void LM_Register (void)
 Register misc_models. More...
 
localModel_tLM_GetByID (const char *id)
 

Variables

static const vec3_t player_mins = { -PLAYER_WIDTH, -PLAYER_WIDTH, PLAYER_MIN }
 
static const vec3_t player_maxs = { PLAYER_WIDTH, PLAYER_WIDTH, PLAYER_STAND }
 
static const vec3_t player_dead_maxs = { PLAYER_WIDTH, PLAYER_WIDTH, PLAYER_DEAD }
 
cvar_tcl_le_debug
 
cvar_tcl_trace_debug
 
cvar_tcl_leshowinvis
 
cvar_tcl_map_draw_rescue_zone
 

Macro Definition Documentation

#define IS_MODE_FIRE_HEADGEAR (   x)    ((x) == M_FIRE_HEADGEAR)
#define IS_MODE_FIRE_LEFT (   x)    ((x) == M_FIRE_L || (x) == M_PEND_FIRE_L)
#define IS_MODE_FIRE_PENDING (   x)    ((x) == M_PEND_FIRE_L || (x) == M_PEND_FIRE_R)

Definition at line 43 of file cl_localentity.h.

Referenced by CL_GetHitProbability().

#define IS_MODE_FIRE_RIGHT (   x)    ((x) == M_FIRE_R || (x) == M_PEND_FIRE_R)

Definition at line 40 of file cl_localentity.h.

Referenced by CL_ActorFireModeActivated(), and CL_ActorShoot().

#define LE_ALWAYS_VISIBLE   0x0002

Definition at line 49 of file cl_localentity.h.

Referenced by LE_AddToScene().

#define LE_CHECK_LEVELFLAGS   0x0001

Definition at line 48 of file cl_localentity.h.

Referenced by CL_AddBrushModel(), CL_CameraAppear(), and LE_AddToScene().

#define LE_GetAnimationIndexForDeath (   le)    ((le)->state & MAX_DEATH)

Valid indices from 1 - MAX_DEATH.

Definition at line 283 of file cl_localentity.h.

Referenced by CL_ActorDie(), and LET_StartIdle().

#define LE_INVISIBLE   0x0010

Definition at line 54 of file cl_localentity.h.

Referenced by CL_ActorAdd(), CL_ActorAppear(), and CL_EntPerish().

#define LE_IsAlien (   le)    ((le)->team == TEAM_ALIEN)

Definition at line 274 of file cl_localentity.h.

Referenced by CL_AddTargetingBox(), and GAME_CollectAliens().

#define LE_IsBreakable (   le)    ((le)->type == ET_BREAKABLE)

Definition at line 278 of file cl_localentity.h.

Referenced by CL_SoundEvent().

#define LE_IsBrushModel (   le)    (LE_IsBreakable(le) || LE_IsDoor(le) || LE_IsRotating(le))

Definition at line 279 of file cl_localentity.h.

#define LE_IsCamera (   le)    ((le)->type == ET_CAMERA)

Definition at line 272 of file cl_localentity.h.

#define LE_IsCivilian (   le)    ((le)->team == TEAM_CIVILIAN)
#define LE_IsDazed (   le)    ((le)->state & STATE_DAZED)

Definition at line 264 of file cl_localentity.h.

Referenced by CL_ActorStateChange().

#define LE_IsDoor (   le)    ((le)->type == ET_DOOR || (le)->type == ET_DOOR_SLIDING)

Definition at line 277 of file cl_localentity.h.

Referenced by CL_ActorUse_f(), and CL_SoundEvent().

#define LE_IsInsane (   le)    ((le)->state & STATE_INSANE)

Definition at line 261 of file cl_localentity.h.

#define LE_IsItem (   le)    ((le)->type == ET_ITEM)

Definition at line 271 of file cl_localentity.h.

Referenced by CL_InvAdd(), CL_InvDel(), GAME_CollectItems(), LE_Cleanup(), and LE_PlaceItem().

#define LE_IsNotSolid (   le)    ((le)->type == ET_TRIGGER_RESCUE || (le)->type == ET_TRIGGER_NEXTMAP)

Definition at line 280 of file cl_localentity.h.

Referenced by CL_AddBrushModel().

#define LE_IsPanicked (   le)    ((le)->state & STATE_PANIC)

Definition at line 259 of file cl_localentity.h.

Referenced by CL_ActorStateChange(), HUD_UpdateActor(), and LET_StartIdle().

#define LE_IsPhalanx (   le)    ((le)->team == TEAM_PHALANX)

Definition at line 275 of file cl_localentity.h.

#define LE_IsRaged (   le)    ((le)->state & STATE_RAGE)

Definition at line 260 of file cl_localentity.h.

Referenced by CL_ActorStateChange().

#define LE_IsRotating (   le)    ((le)->type == ET_ROTATING)

Definition at line 276 of file cl_localentity.h.

#define LE_IsShaken (   le)    ((le)->state & STATE_SHAKEN)

Definition at line 262 of file cl_localentity.h.

Referenced by CL_ActorStateChange().

#define LE_LOCKED   0x0004

if there is an event going on involving this le_t. Used to limit to one event per le_t struct at any time.

Definition at line 50 of file cl_localentity.h.

Referenced by LE_IsLocked(), LE_Lock(), and LE_Unlock().

#define LE_NotFoundWithTypeError (   entnum,
  type 
)    _LE_NotFoundError(entnum, type, __FILE__, __LINE__)

Definition at line 324 of file cl_localentity.h.

Referenced by CL_EntPerish().

#define LE_REMOVE_NEXT_FRAME   0x0008

will set the inuse value to false in the next frame

Definition at line 53 of file cl_localentity.h.

Referenced by CL_InvAdd(), LE_AddToScene(), and LE_PlaceItem().

#define LE_SELECTED   0x0020

used for actors - for the current selected actor this is true

Definition at line 55 of file cl_localentity.h.

Referenced by CL_ActorSelect().

#define LE_SetInvisible (   le)    do { if (cl_leshowinvis->integer) le->flags &= ~LE_INVISIBLE; else le->flags |= LE_INVISIBLE; } while (0)
#define MAX_LOCALMODELS   1024

Definition at line 204 of file cl_localentity.h.

Referenced by LM_AddModel().

Typedef Documentation

typedef struct le_s le_t

a local entity

typedef struct leStep_s leStep_t
typedef bool(* localEntitiyAddFunc_t)(struct le_s *le, entity_t *ent)

Definition at line 45 of file cl_localentity.h.

typedef void(* localEntityThinkFunc_t)(struct le_s *le)

Definition at line 46 of file cl_localentity.h.

typedef struct localModel_s localModel_t

local models

Enumeration Type Documentation

Actor actions.

Enumerator
M_MOVE 

We are currently in move-mode (destination selection).

M_FIRE_R 

We are currently in fire-mode for the right weapon (target selection).

M_FIRE_L 

We are currently in fire-mode for the left weapon (target selection).

M_FIRE_HEADGEAR 

We'll fire headgear item shortly.

M_PEND_MOVE 

A move target has been selected, we are waiting for player-confirmation.

M_PEND_FIRE_R 

A fire target (right weapon) has been selected, we are waiting for player-confirmation.

M_PEND_FIRE_L 

A fire target (left weapon) has been selected, we are waiting for player-confirmation.

Definition at line 30 of file cl_localentity.h.

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.

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

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

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

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

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

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_Appear ( le_t le)
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().

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

localModel_t* LM_GetByID ( const char *  id)
void LM_Perish ( dbuffer msg)
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_leshowinvis

Definition at line 72 of file cl_main.cpp.

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

const vec3_t player_dead_maxs = { PLAYER_WIDTH, PLAYER_WIDTH, PLAYER_DEAD }
static

Definition at line 243 of file cl_localentity.h.

Referenced by CL_ActorAppear(), CL_ActorDie(), and CL_ActorStateChange().

const vec3_t player_maxs = { PLAYER_WIDTH, PLAYER_WIDTH, PLAYER_STAND }
static

Definition at line 242 of file cl_localentity.h.

Referenced by CL_ActorAppear(), and CL_ActorRevitalised().

const vec3_t player_mins = { -PLAYER_WIDTH, -PLAYER_WIDTH, PLAYER_MIN }
static

Definition at line 241 of file cl_localentity.h.

Referenced by CL_ActorAppear().