UFO: Alien Invasion
Loading...
Searching...
No Matches
cl_localentity.h File Reference
Include dependency graph for cl_localentity.h:

Go to the source code of this file.

Data Structures

struct  leStep_t
struct  le_t
 a local entity More...
struct  localModel_t
 local models More...

Macros

#define IS_MODE_FIRE_RIGHT(x)
#define IS_MODE_FIRE_LEFT(x)
#define IS_MODE_FIRE_HEADGEAR(x)
#define IS_MODE_FIRE_PENDING(x)
#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)
#define LE_IsDead(le)
#define LE_IsPanicked(le)
#define LE_IsRaged(le)
#define LE_IsInsane(le)
#define LE_IsShaken(le)
#define LE_IsCrouched(le)
#define LE_IsDazed(le)
#define LE_IsInvisible(le)
#define LE_IsSelected(le)
#define LE_SetInvisible(le)
#define LE_IsItem(le)
#define LE_IsCamera(le)
#define LE_IsCivilian(le)
#define LE_IsAlien(le)
#define LE_IsPhalanx(le)
#define LE_IsRotating(le)
#define LE_IsDoor(le)
#define LE_IsBreakable(le)
#define LE_IsBrushModel(le)
#define LE_IsNotSolid(le)
#define LE_GetAnimationIndexForDeath(le)
 Valid indices from 1 - MAX_DEATH.
#define LE_NotFoundError(entnum)
#define LE_NotFoundWithTypeError(entnum, type)

Typedefs

typedef bool(* localEntitiyAddFunc_t) (struct le_s *le, entity_t *ent)
typedef void(* localEntityThinkFunc_t) (struct le_s *le)

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.
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.
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.
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 LET_StartIdle (le_t *le)
 Change the animation of an actor to the idle animation (which can be panic, dead or stand).
void LET_Appear (le_t *le)
void LET_StartPathMove (le_t *le)
 Change the actors animation to walking.
void LET_HiddenMove (le_t *le)
 Handle move for invisible actors.
void LET_BrushModel (le_t *le)
void LE_DoEndPathMove (le_t *le)
 Ends the move of an actor.
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().
void LM_Perish (dbuffer *msg)
void LM_AddToScene (void)
 Add the local models to the scene.
bool LE_BrushModelAction (le_t *le, entity_t *ent)
 Add function for brush models.
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
bool LE_IsLivingAndVisibleActor (const le_t *le)
 Checks whether the given le is a living and visible actor.
bool LE_IsLivingActor (const le_t *le)
 Checks whether the given le is a living actor (but might be hidden).
bool LE_IsActor (const le_t *le)
 Checks whether the given le is a living actor.
le_tLE_Add (int entnum)
 Add a new local entity to the scene.
le_tLE_Get (int entnum)
 Searches all local entities for the one with the searched entnum.
le_tLE_GetNextInUse (le_t *lastLE)
 Iterate through the entities that are in use.
le_tLE_GetNext (le_t *lastLE)
 Iterate through the list of entities.
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.
bool LE_IsLocked (int entnum)
 Checks if a given le_t structure is locked, i.e., used by another event at this time.
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.
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_GetFromPos (const pos3_t pos)
 Searches a local entity on a given grid field.
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.
void LE_AddToScene (void)
void LE_CenterView (const le_t *le)
 Center the camera on the local entity's origin.
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.
void LET_RotateDoor (le_t *le, int speed)
 Rotates a door in the given speed.
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.
void LM_Register (void)
 Register misc_models.
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

◆ IS_MODE_FIRE_HEADGEAR

#define IS_MODE_FIRE_HEADGEAR ( x)
Value:
@ M_FIRE_HEADGEAR

Definition at line 42 of file cl_localentity.h.

Referenced by CL_ActorFireModeActivated(), CL_ActorShoot(), and HUD_UpdateActorFireMode().

◆ IS_MODE_FIRE_LEFT

#define IS_MODE_FIRE_LEFT ( x)
Value:
((x) == M_FIRE_L || (x) == M_PEND_FIRE_L)
@ M_PEND_FIRE_L
@ M_FIRE_L

Definition at line 41 of file cl_localentity.h.

Referenced by CL_ActorFireModeActivated(), CL_ActorShoot(), and HUD_UpdateActorFireMode().

◆ IS_MODE_FIRE_PENDING

#define IS_MODE_FIRE_PENDING ( x)
Value:
((x) == M_PEND_FIRE_L || (x) == M_PEND_FIRE_R)
@ M_PEND_FIRE_R

Definition at line 43 of file cl_localentity.h.

Referenced by CL_GetHitProbability().

◆ IS_MODE_FIRE_RIGHT

#define IS_MODE_FIRE_RIGHT ( x)
Value:
((x) == M_FIRE_R || (x) == M_PEND_FIRE_R)
@ M_FIRE_R

Definition at line 40 of file cl_localentity.h.

Referenced by CL_ActorFireModeActivated(), and CL_ActorShoot().

◆ LE_ALWAYS_VISIBLE

#define LE_ALWAYS_VISIBLE   0x0002

Definition at line 49 of file cl_localentity.h.

Referenced by LE_AddToScene().

◆ LE_CHECK_LEVELFLAGS

#define LE_CHECK_LEVELFLAGS   0x0001

Definition at line 48 of file cl_localentity.h.

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

◆ LE_GetAnimationIndexForDeath

#define LE_GetAnimationIndexForDeath ( le)
Value:
((le)->state & MAX_DEATH)
#define MAX_DEATH
Definition q_shared.h:257

Valid indices from 1 - MAX_DEATH.

Definition at line 282 of file cl_localentity.h.

Referenced by CL_ActorDie(), and LET_StartIdle().

◆ LE_INVISIBLE

#define LE_INVISIBLE   0x0010

Definition at line 53 of file cl_localentity.h.

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

◆ LE_IsAlien

#define LE_IsAlien ( le)
Value:
((le)->team == TEAM_ALIEN)
#define TEAM_ALIEN
Definition q_shared.h:63

Definition at line 273 of file cl_localentity.h.

Referenced by CL_AddTargetingBox(), and GAME_CollectAliens().

◆ LE_IsBreakable

#define LE_IsBreakable ( le)
Value:
((le)->type == ET_BREAKABLE)
@ ET_BREAKABLE
Definition q_shared.h:150

Definition at line 277 of file cl_localentity.h.

Referenced by CL_SoundEvent().

◆ LE_IsBrushModel

#define LE_IsBrushModel ( le)
Value:
#define LE_IsRotating(le)
#define LE_IsDoor(le)
#define LE_IsBreakable(le)

Definition at line 278 of file cl_localentity.h.

◆ LE_IsCamera

#define LE_IsCamera ( le)
Value:
((le)->type == ET_CAMERA)
@ ET_CAMERA
Definition q_shared.h:171

Definition at line 271 of file cl_localentity.h.

◆ LE_IsCivilian

#define LE_IsCivilian ( le)
Value:
((le)->team == TEAM_CIVILIAN)
#define TEAM_CIVILIAN
Definition q_shared.h:61

Definition at line 272 of file cl_localentity.h.

Referenced by CL_DrawLineOfSight(), CL_NextAlienVisibleFromActor_f(), CL_TargetingStraight(), and UI_RadarNodeGetActorColor().

◆ LE_IsCrouched

◆ LE_IsDazed

#define LE_IsDazed ( le)
Value:
((le)->state & STATE_DAZED)
#define STATE_DAZED
Definition q_shared.h:269

Definition at line 263 of file cl_localentity.h.

Referenced by CL_ActorStateChange().

◆ LE_IsDead

◆ LE_IsDoor

#define LE_IsDoor ( le)
Value:
((le)->type == ET_DOOR || (le)->type == ET_DOOR_SLIDING)
@ ET_DOOR
Definition q_shared.h:156
@ ET_DOOR_SLIDING
Definition q_shared.h:157

Definition at line 276 of file cl_localentity.h.

Referenced by CL_ActorUse_f(), and CL_SoundEvent().

◆ LE_IsInsane

#define LE_IsInsane ( le)
Value:
((le)->state & STATE_INSANE)
#define STATE_INSANE
Definition q_shared.h:267

Definition at line 260 of file cl_localentity.h.

◆ LE_IsInvisible

◆ LE_IsItem

#define LE_IsItem ( le)
Value:
((le)->type == ET_ITEM)
@ ET_ITEM
Definition q_shared.h:149

Definition at line 270 of file cl_localentity.h.

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

◆ LE_IsNotSolid

#define LE_IsNotSolid ( le)
Value:
((le)->type == ET_TRIGGER_RESCUE || (le)->type == ET_TRIGGER_NEXTMAP)
@ ET_TRIGGER_NEXTMAP
Definition q_shared.h:155
@ ET_TRIGGER_RESCUE
Definition q_shared.h:154

Definition at line 279 of file cl_localentity.h.

Referenced by CL_AddBrushModel().

◆ LE_IsPanicked

#define LE_IsPanicked ( le)
Value:
((le)->state & STATE_PANIC)
#define STATE_PANIC
Definition q_shared.h:264

Definition at line 258 of file cl_localentity.h.

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

◆ LE_IsPhalanx

#define LE_IsPhalanx ( le)
Value:
((le)->team == TEAM_PHALANX)
#define TEAM_PHALANX
Definition q_shared.h:62

Definition at line 274 of file cl_localentity.h.

◆ LE_IsRaged

#define LE_IsRaged ( le)
Value:
((le)->state & STATE_RAGE)
#define STATE_RAGE
Definition q_shared.h:266

Definition at line 259 of file cl_localentity.h.

Referenced by CL_ActorStateChange().

◆ LE_IsRotating

#define LE_IsRotating ( le)
Value:
((le)->type == ET_ROTATING)
@ ET_ROTATING
Definition q_shared.h:158

Definition at line 275 of file cl_localentity.h.

◆ LE_IsSelected

◆ LE_IsShaken

#define LE_IsShaken ( le)
Value:
((le)->state & STATE_SHAKEN)
#define STATE_SHAKEN
Definition q_shared.h:273

Definition at line 261 of file cl_localentity.h.

Referenced by CL_ActorStateChange().

◆ LE_IsStunned

◆ LE_LOCKED

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

◆ LE_NotFoundError

◆ LE_NotFoundWithTypeError

#define LE_NotFoundWithTypeError ( entnum,
type )
Value:
_LE_NotFoundError(entnum, type, __FILE__, __LINE__)
QGL_EXTERN GLint GLenum type
Definition r_gl.h:94

Definition at line 323 of file cl_localentity.h.

Referenced by CL_EntPerish().

◆ LE_REMOVE_NEXT_FRAME

#define LE_REMOVE_NEXT_FRAME   0x0008

will set the inuse value to false in the next frame

Definition at line 52 of file cl_localentity.h.

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

◆ LE_SELECTED

#define LE_SELECTED   0x0020

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

Definition at line 54 of file cl_localentity.h.

Referenced by CL_ActorSelect().

◆ LE_SetInvisible

#define LE_SetInvisible ( le)
Value:
do { if (cl_leshowinvis->integer) le->flags &= ~LE_INVISIBLE; else le->flags |= LE_INVISIBLE; } while (0)
cvar_t * cl_leshowinvis
Definition cl_main.cpp:72

Definition at line 268 of file cl_localentity.h.

Referenced by CL_EntAppear(), CL_ParticleAppear(), LE_AddAmbientSound(), LE_AddGrenade(), and LE_AddProjectile().

◆ MAX_LOCALMODELS

#define MAX_LOCALMODELS   1024

Definition at line 203 of file cl_localentity.h.

Referenced by clientBattleScape_t::clientBattleScape_s(), and LM_AddModel().

Typedef Documentation

◆ localEntitiyAddFunc_t

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

Definition at line 45 of file cl_localentity.h.

◆ localEntityThinkFunc_t

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

Definition at line 46 of file cl_localentity.h.

Enumeration Type Documentation

◆ actorModes_t

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

◆ _LE_NotFoundError()

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(), ERR_DROP, and type.

◆ CL_CompleteRecalcRouting()

void CL_CompleteRecalcRouting ( void )
See also
G_CompleteRecalcRouting

Definition at line 128 of file cl_localentity.cpp.

References cl, CL_GridRecalcRouting(), Com_Printf(), i, and LE_GenerateInlineModelList().

Referenced by CL_Reset().

◆ CL_RecalcRouting()

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

◆ CL_Trace()

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(), cl_trace_debug, CM_CompleteBoxTrace(), MoveClip::contentmask, trace_t::fraction, trace_t::le, MoveClip::moveLine, MoveClip::objBox, MoveClipCL::passle, MoveClipCL::passle2, R_DrawBoundingBoxBatched(), AABB::set(), Line::set(), and MoveClipCL::trace.

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

◆ LE_ActorGetStepTime()

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

References BASE_DIRECTIONS, cl, CORE_DIRECTIONS, dest, DIRECTION_FALL, le_t::fieldSize, Grid_PosToVec(), oldPos, and UNIT_SIZE.

Referenced by CL_ActorDoMoveTime(), and LE_DoPathMove().

◆ LE_Add()

le_t * LE_Add ( int entnum)

Add a new local entity to the scene.

Parameters
[in]entnumThe entity number (server side)
See also
LE_Get

Definition at line 1209 of file cl_localentity.cpp.

References ACTOR_SIZE_NORMAL, cl, Com_Error(), le_t::entnum, ERR_DROP, le_t::fieldSize, le_t::init(), le_t::inuse, LE_GetNext(), and MAX_EDICTS.

Referenced by CL_ActorAdd(), CL_ActorAppear(), CL_AddBrushModel(), CL_AddEdict(), CL_CameraAppear(), CL_EntAppear(), LE_AddAmbientSound(), LE_AddGrenade(), and LE_AddProjectile().

◆ LE_AddAmbientSound()

void LE_AddAmbientSound ( const char * sound,
const vec3_t origin,
int levelflags,
float volume,
float attenuation )

◆ LE_AddGrenade()

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_t::angle, ptl_t::angles, fireDef_t::bounce, fireDef_t::bounceSound, cl, CL_ParticleSpawn(), crand(), le_t::endTime, le_t::fd, GRAVITY, fireDef_t::hitBody, fireDef_t::hitBodySound, fireDef_t::impact, fireDef_t::impactSound, le_t::inuse, LE_Add(), LE_ExecuteThink(), LE_SetInvisible, LE_SetThink(), LET_Projectile(), ptl_t::omega, fireDef_t::projectile, le_t::ptl, le_t::ref1, le_t::ref2, le_t::ref3, SF_BODY, SF_BOUNCING, SF_IMPACT, fireDef_t::splrad, and VectorSet.

Referenced by CL_ActorDoThrow().

◆ LE_AddProjectile()

◆ LE_AddToScene()

◆ LE_BrushModelAction()

◆ LE_CenterView()

void LE_CenterView ( const le_t * le)

Center the camera on the local entity's origin.

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

Definition at line 1257 of file cl_localentity.cpp.

References cl, cl_centerview, CL_CheckCameraRoute(), cls, Cvar_SetValue(), le_t::origin, le_t::pos, le_t::team, UNIT_SIZE, VecToPos, Vector2Dist, and VectorCopy.

Referenced by CL_ActorAppear(), CL_ActorReactionFireAddTarget(), CL_ActorSelectList(), CL_EntPerish(), and LET_StartPathMove().

◆ LE_Cleanup()

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, i, le_t::inuse, le_t::inv, LE_IsActor(), and LE_IsItem.

Referenced by CL_ClearState().

◆ LE_DoEndPathMove()

◆ LE_ExecuteThink()

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_t::inuse, and le_t::think.

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

◆ LE_Find()

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_t::pos, le_t::type, type, and VectorCompare.

Referenced by CL_ActorRevitalised(), and LE_LinkFloorContainer().

◆ LE_FindRadius()

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_t::aabb, ET_NULL, AABB::getCenter(), LE_GetNextInUse(), le_t::origin, le_t::type, type, and VectorLength().

◆ LE_Get()

◆ LE_GetAnim()

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_t::animationIndex, Com_sprintf(), INVSH_GetItemByIDX(), length, MAX_VAR, NONE, Q_streq, Q_strstart(), STATE_CROUCHED, objDef_t::type, and type.

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

◆ LE_GetClipModel()

const cBspModel_t * LE_GetClipModel ( const le_t * le)

◆ LE_GetDrawModel()

model_t * LE_GetDrawModel ( unsigned int modelIndex)

Definition at line 1637 of file cl_localentity.cpp.

References cl, Com_Error(), ERR_DROP, index, and lengthof.

Referenced by CL_ActorAppear(), and CL_ViewLoadMedia().

◆ LE_GetFromPos()

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_t::pos, and VectorCompare.

Referenced by CL_GetHitProbability().

◆ LE_GetNext()

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.

Referenced by LE_Add(), LE_GetNextInUse(), and LE_Think().

◆ LE_GetNextInUse()

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

◆ LE_IsActor()

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_t::type.

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

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

◆ 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_t::type.

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

◆ LE_IsLocked()

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_t::flags, LE_Get(), and LE_LOCKED.

Referenced by CL_CheckDefault().

◆ LE_LinkFloorContainer()

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_t::pos, le_t::resetFloor(), and le_t::setFloor().

Referenced by LE_DoEndPathMove().

◆ LE_Lock()

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_t::entnum, ERR_DROP, le_t::flags, and LE_LOCKED.

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

◆ LE_PlaceItem()

◆ LE_SetThink()

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

References le_t::as, ca_active, cls, LE_ExecuteThink(), LE_GetNext(), le_t::model1, and R_AnimRun().

Referenced by CL_Frame().

◆ LE_Unlock()

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_t::entnum, ERR_DROP, le_t::flags, and LE_LOCKED.

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

◆ LET_Appear()

void LET_Appear ( le_t * le)

References scale.

◆ LET_BrushModel()

void LET_BrushModel ( le_t * le)

◆ LET_HiddenMove()

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_t::newPos, le_t::pos, and VectorCopy.

Referenced by CL_ActorDoMove().

◆ LET_RotateDoor()

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_t::angles, cl, CL_RecalcRouting(), CM_SetInlineModelOrientation(), le_t::dir, DOOR_OPEN_REVERSE, DOOR_ROTATION_ANGLE, le_t::inlineModelName, LE_SetThink(), and le_t::origin.

Referenced by LET_DoorRotatingClose(), and LET_DoorRotatingOpen().

◆ LET_SlideDoor()

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_t::cbmBox, cl, CL_RecalcRouting(), CM_InlineModel(), le_t::dir, DotProduct, GET_SLIDING_DOOR_SHIFT_VECTOR, le_t::inlineModelName, LE_SetThink(), le_t::origin, AABB::shift(), le_t::size, le_t::thinkDelay, VectorAdd, VectorEmpty, and VectorMul.

Referenced by LET_DoorSlidingClose(), and LET_DoorSlidingOpen().

◆ LET_StartIdle()

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_t::as, Com_Error(), le_t::entnum, ERR_DROP, LE_GetAnim(), LE_GetAnimationIndexForDeath, LE_IsDead, LE_IsInvisible, LE_IsPanicked, LE_SetThink(), le_t::left, Mem_Free, le_t::model1, leStep_t::next, le_t::pathLength, le_t::pathPos, R_AnimChange(), le_t::right, le_t::state, le_t::stepIndex, le_t::stepList, and va().

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

◆ LET_StartPathMove()

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_t::as, animState_t::change, cls, Com_Printf(), le_t::entnum, LE_CenterView(), LE_ExecuteThink(), LE_GetAnim(), LE_SetThink(), le_t::left, LET_PathMove(), le_t::model1, le_t::pnum, R_AnimChange(), le_t::right, le_t::state, le_t::team, and TEAM_CIVILIAN.

Referenced by CL_ActorDoMove().

◆ LM_AddModel()

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_t::angles, cl, Com_Error(), localModel_t::entnum, ERR_DROP, localModel_t::inuse, localModel_t::levelflags, LM_Find(), MAX_LOCALMODELS, localModel_t::name, OBJZERO, localModel_t::origin, Q_strncpyz(), localModel_t::renderFlags, scale, localModel_t::setScale(), and VectorCopy.

Referenced by SP_misc_model().

◆ LM_AddToScene()

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

◆ LM_GetByID()

localModel_t * LM_GetByID ( const char * id)

Definition at line 315 of file cl_localentity.cpp.

References cl, i, localModel_t::id, Q_streq, and Q_strnull().

Referenced by LMT_Init(), and SP_misc_model().

◆ LM_Perish()

void LM_Perish ( dbuffer * msg)

◆ LM_Register()

◆ LM_Think()

void LM_Think ( void )

Definition at line 400 of file cl_localentity.cpp.

References cl, i, and localModel_t::think.

Referenced by CL_SpawnParseEntitystring().

◆ LMT_Init()

void LMT_Init ( localModel_t * localModel)

Variable Documentation

◆ cl_le_debug

cvar_t* cl_le_debug
extern

Definition at line 39 of file cl_localentity.cpp.

Referenced by CL_InitLocal(), and LE_AddToScene().

◆ cl_leshowinvis

cvar_t* cl_leshowinvis
extern

Definition at line 72 of file cl_main.cpp.

Referenced by CL_InitLocal().

◆ cl_map_draw_rescue_zone

cvar_t* cl_map_draw_rescue_zone
extern

Definition at line 41 of file cl_localentity.cpp.

Referenced by CL_ViewInit(), and LE_BrushModelAction().

◆ cl_trace_debug

cvar_t* cl_trace_debug
extern

Definition at line 40 of file cl_localentity.cpp.

Referenced by CL_InitLocal(), and CL_Trace().

◆ player_dead_maxs

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

Definition at line 242 of file cl_localentity.h.

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

◆ player_maxs

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

Definition at line 241 of file cl_localentity.h.

Referenced by CL_ActorAppear(), and CL_ActorRevitalised().

◆ player_mins

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

Definition at line 240 of file cl_localentity.h.

Referenced by CL_ActorAppear().