UFO: Alien Invasion
|
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_t * | LM_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_t * | LM_GetByID (const char *id) |
localModel_t * | LM_AddModel (const char *model, const vec3_t origin, const vec3_t angles, int entnum, int levelflags, int renderFlags, const vec3_t scale) |
Prepares local (not known or handled by the server) models to the map, which will be added later in LM_AddToScene(). 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_t * | LE_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_t * | LE_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_t * | LE_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_t * | LE_GetFromPos (const pos3_t pos) |
Searches a local entity on a given grid field. More... | |
le_t * | LE_GetNext (le_t *lastLE) |
Iterate through the list of entities. More... | |
le_t * | LE_GetNextInUse (le_t *lastLE) |
Iterate through the entities that are in use. More... | |
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. More... | |
le_t * | LE_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_t * | LE_GetClipModel (const le_t *le) |
model_t * | LE_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_t * | cl_le_debug |
cvar_t * | cl_trace_debug |
cvar_t * | cl_map_draw_rescue_zone |
Local entity management.
Definition in file cl_localentity.cpp.
Definition at line 1239 of file cl_localentity.cpp.
References Cmd_ExecuteString(), Com_Error(), and ERR_DROP.
|
static |
Clip against solid entities.
Definition at line 1685 of file cl_localentity.cpp.
References trace_s::allsolid, cl, CL_HullForEntity(), CM_HintedTransformedBoxTrace(), MoveClip::contentmask, le_s::contents, trace_s::fraction, trace_s::le, LE_GetNextInUse(), mapTiles_s::mapTiles, clientBattleScape_s::mapTiles, MAX_MAP_NODES, MoveClip::moveLine, MoveClip::objBox, le_s::origin, MoveClipCL::passle, MoveClipCL::passle2, shift, trace_s::startsolid, MoveClipCL::trace, and VectorCopy.
Referenced by CL_Trace().
Definition at line 128 of file cl_localentity.cpp.
References cl, CL_GridRecalcRouting(), Com_Printf(), i, LE_GenerateInlineModelList(), clientBattleScape_s::LEs, and clientBattleScape_s::numLEs.
Referenced by CL_Reset().
Definition at line 103 of file cl_localentity.cpp.
References cBspModel_s::cbmBox, cl, CM_InlineModel(), Com_ServerState(), Grid_RecalcRouting(), le_s::inlineModelName, clientBattleScape_s::leInlineModelList, clientBattleScape_s::mapData, clientBattleScape_s::mapTiles, le_s::model1, cBspModel_s::origin, mapData_s::routing, and AABB::shift().
Referenced by CL_CompleteRecalcRouting(), and CL_RecalcRouting().
|
static |
Returns a headnode that can be used for testing or clipping an object of mins/maxs size. Offset is filled in to contain the adjustment that must be added to the testing object's origin to get a point to use with the returned hull.
[in] | le | The local entity to get the bmodel from |
[out] | tile | The maptile the bmodel belongs, too |
[out] | rmaShift | the shift vector in case of an RMA (needed for doors) |
[out] | angles | The rotation of the entity (in case of bmodels) |
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().
[in] | le | A 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.
[in] | traceLine | Start and end vector of the trace |
[in] | box | The box we move through the world |
[in] | passle | Ignore this local entity in the trace (might be nullptr) |
[in] | passle2 | Ignore this local entity in the trace (might be nullptr) |
[in] | contentmask | Searched content the trace should watch for |
[in] | worldLevel | The worldlevel (0-7) to calculate the levelmask for the trace from |
Definition at line 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().
Spawns particle effects for a hit actor.
[in] | le | The actor to spawn the particles for. |
[in] | impact | The impact location (where the particles are spawned). |
[in] | normal | The index of the normal vector of the particles (think: impact angle). |
Definition at line 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 | ||
) |
sqrt(2) for diagonal movement
Definition at line 570 of file cl_localentity.cpp.
References BASE_DIRECTIONS, cl, CORE_DIRECTIONS, dest, DIRECTION_FALL, le_s::fieldSize, Grid_PosToVec(), clientBattleScape_s::mapData, mapData_s::routing, and UNIT_SIZE.
Referenced by CL_ActorDoMoveTime(), and LE_DoPathMove().
Add a new local entity to the scene.
[in] | entnum | The entity number (server side) |
Definition at line 1209 of file cl_localentity.cpp.
References ACTOR_SIZE_NORMAL, cl, Com_Error(), le_s::entnum, ERR_DROP, le_s::fieldSize, le_s::init(), le_s::inuse, LE_GetNext(), clientBattleScape_s::LEs, MAX_EDICTS, and clientBattleScape_s::numLEs.
Referenced by CL_ActorAdd(), CL_ActorAppear(), CL_AddBrushModel(), CL_AddEdict(), CL_CameraAppear(), CL_EntAppear(), LE_AddAmbientSound(), LE_AddGrenade(), and LE_AddProjectile().
void LE_AddAmbientSound | ( | const char * | sound, |
const vec3_t | origin, | ||
int | levelflags, | ||
float | volume, | ||
float | attenuation | ||
) |
Adds ambient sounds from misc_sound entities.
Definition at line 1169 of file cl_localentity.cpp.
References le_s::attenuation, Com_DPrintf(), Com_Printf(), DEBUG_SOUND, ET_SOUND, f, LE_Add(), LE_SetInvisible, le_s::levelflags, le_s::origin, S_LoadSampleIdx(), le_s::sampleIdx, SND_VOLUME_DEFAULT, le_s::type, VectorCopy, and le_s::volume.
Referenced by SP_misc_sound().
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 | ||
) |
[in] | fd | The grenade fire definition |
[in] | flags | bitmask: SF_BODY, SF_IMPACT, SF_BOUNCING, SF_BOUNCED |
[in] | muzzle | starting/location vector |
[in] | v0 | velocity vector |
[in] | dt | delta seconds |
[in] | leVictim | The 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_AddProjectile | ( | const fireDef_t * | fd, |
int | flags, | ||
const vec3_t | muzzle, | ||
const vec3_t | impact, | ||
int | normal, | ||
le_t * | leVictim | ||
) |
Definition at line 784 of file cl_localentity.cpp.
References le_s::angle, ptl_s::angles, fireDef_s::bounce, fireDef_s::bounceSound, bytedirs, cl, CL_ActorPlaySound(), CL_ParticleSpawn(), csi, fireDef_s::damage, csi_s::damStunGas, objDef_s::dmgtype, le_s::endTime, le_s::fd, fireDef_s::hitBody, fireDef_s::hitBodySound, fireDef_s::impact, fireDef_s::impactAttenuation, fireDef_s::impactSound, le_s::inuse, LE_ActorBodyHit(), LE_Add(), LE_ExecuteThink(), LE_SetInvisible, LE_SetThink(), LET_Projectile(), fireDef_s::obj, le_s::origin, fireDef_s::projectile, le_s::ptl, le_s::ref1, le_s::ref2, le_s::ref3, ptl_s::s, S_LoadAndPlaySample(), SF_BODY, SF_BOUNCING, SF_IMPACT, ptl_s::size, SND_HURT, SND_VOLUME_WEAPONS, fireDef_s::speed, fireDef_s::splrad, clientBattleScape_s::time, ptl_s::v, VecToAngles(), VectorLength(), VectorMA(), VectorScale, and VectorSubtract.
Referenced by CL_ActorDoShoot().
Definition at line 1486 of file cl_localentity.cpp.
References le_s::addFunc, le_s::alpha, le_s::angles, le_s::as, le_s::bodySkin, cl, CL_ParticleSpawn(), cl_worldlevel, le_s::clientAction, le_s::contents, CONTENTS_DETAIL, CONTENTS_SOLID, ET_MAX, ET_NULL, le_s::flags, i, cvar_s::integer, le_s::inuse, LE_AddEdictHighlight(), LE_ALWAYS_VISIBLE, LE_CHECK_LEVELFLAGS, LE_IsInvisible, LE_IsOriginBrush(), LE_IsSelected, LE_REMOVE_NEXT_FRAME, clientBattleScape_s::LEs, le_s::levelflags, le_s::lighting, le_s::model1, clientBattleScape_s::numLEs, le_s::origin, le_s::pos, R_AddEntity(), R_EntitySetOrigin(), RF_NONE, le_s::type, and VectorCopy.
Referenced by CL_ViewRender().
Returns the index of the biggest item in the inventory list.
csi.ods
array Definition at line 873 of file cl_localentity.cpp.
References Item::def(), Item::getNext(), INVSH_ShapeSize(), and objDef_s::shape.
Referenced by LE_PlaceItem().
Add function for brush models.
Definition at line 986 of file cl_localentity.cpp.
References le_s::aabb, le_s::angles, cl_worldlevel, ET_BREAKABLE, ET_DOOR, ET_DOOR_SLIDING, ET_ROTATING, ET_TRIGGER_RESCUE, AABB::getMaxX(), AABB::getMaxY(), AABB::getMinX(), AABB::getMinY(), AABB::getMinZ(), cvar_s::integer, le_s::levelflags, entity_t::origin, le_s::origin, R_AddEntity(), R_FindPics(), RF_BOX, RF_PATH, AABB::set(), le_s::type, UNIT_SIZE, VectorCopy, and VectorSet.
Referenced by CL_AddBrushModel().
Center the camera on the local entity's origin.
le | The local entity which origin is used to center the camera |
Definition at line 1257 of file cl_localentity.cpp.
References clientBattleScape_s::cam, cl, cl_centerview, CL_CheckCameraRoute(), cls, Cvar_SetValue(), cvar_s::integer, camera_s::origin, le_s::origin, le_s::pos, client_static_s::team, le_s::team, UNIT_SIZE, VecToPos, Vector2Dist, and VectorCopy.
Referenced by CL_ActorAppear(), CL_ActorReactionFireAddTarget(), CL_ActorSelectList(), CL_EntPerish(), and LET_StartPathMove().
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().
Ends the move of an actor.
Definition at line 636 of file cl_localentity.cpp.
References CL_ActorConditionalMoveCalc(), Com_Error(), ERR_DROP, LE_ExecuteThink(), LE_IsSelected, LE_LinkFloorContainer(), LE_SetThink(), LE_Unlock(), LET_StartIdle(), le_s::newPos, le_s::pathLength, le_s::pathPos, le_s::pos, selActor, le_s::team, and VectorCompare.
Referenced by CL_ActorDoMove(), and LET_PathMove().
Definition at line 607 of file cl_localentity.cpp.
References le_s::angle, le_s::angles, CORE_DIRECTIONS, directionAngles, le_s::dvtab, le_s::endTime, FLYING_DIRECTIONS, getDVdir, LE_ActorGetStepTime(), LE_IsCrouched, LE_PlayFootStepSound(), le_s::oldPos, le_s::pathContents, le_s::pathPos, le_s::pos, PosAddDV, le_s::positionContents, le_s::speed, le_s::startTime, and YAW.
Referenced by LET_PathMove().
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.
[in] | type | Entity type |
[in] | pos | The 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.
[in] | from | The entity to start the search from. nullptr will start from the beginning. |
[in] | org | The origin that is the center of the circle. |
[in] | rad | radius to search an edict in. |
[in] | type | Type of local entity. ET_NULL to ignore the type. |
Definition at line 1416 of file cl_localentity.cpp.
References le_s::aabb, ET_NULL, AABB::getCenter(), LE_GetNextInUse(), le_s::origin, le_s::type, and VectorLength().
Definition at line 91 of file cl_localentity.cpp.
References cl, i, le_s::inlineModelName, LE_GetNextInUse(), clientBattleScape_s::leInlineModelList, and le_s::model1.
Referenced by CL_CompleteRecalcRouting(), and CL_RecalcRouting().
Searches all local entities for the one with the searched entnum.
[in] | entnum | The entity number (server side) |
Definition at line 1287 of file cl_localentity.cpp.
References le_s::entnum, LE_GetNextInUse(), and SKIP_LOCAL_ENTITY.
Referenced by CL_ActorAdd(), CL_ActorAppear(), CL_ActorClientAction(), CL_ActorDie(), CL_ActorDoMove(), CL_ActorDoMoveTime(), CL_ActorDoShoot(), CL_ActorDoTurn(), CL_ActorEndShoot(), CL_ActorReactionFireAbortShot(), CL_ActorReactionFireAbortShotTime(), CL_ActorReactionFireAddTarget(), CL_ActorReactionFireAddTargetTime(), CL_ActorReactionFireChange(), CL_ActorReactionFireRemoveTarget(), CL_ActorReactionFireRemoveTargetTime(), CL_ActorReactionFireTargetUpdate(), CL_ActorReactionFireTargetUpdateTime(), CL_ActorReservationChange(), CL_ActorResetClientAction(), CL_ActorRevitalised(), CL_ActorShootHidden(), CL_ActorStartShoot(), CL_ActorStateChange(), CL_ActorStats(), CL_ActorWound(), CL_AddBrushModel(), CL_AddEdict(), CL_CameraAppear(), CL_DoorClose(), CL_DoorOpen(), CL_EntAppear(), CL_EntDestroy(), CL_EntPerish(), CL_Explode(), CL_InvAdd(), CL_InvAmmo(), CL_InvDel(), CL_InvReload(), CL_ParticleAppear(), CL_SoundEvent(), CL_SoundEventTime(), and LE_IsLocked().
Get the correct animation for the given actor state and weapons.
[in] | anim | Type of animation (for example "stand", "walk") |
[in] | right | ods index to determine the weapon in the actors right hand |
[in] | left | ods index to determine the weapon in the actors left hand |
[in] | state | the actors state - e.g. STATE_CROUCHED (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 | ) |
Definition at line 1625 of file cl_localentity.cpp.
References cl, Com_Error(), ERR_DROP, index, lengthof, clientBattleScape_s::model_clip, and le_s::modelnum1.
Referenced by CL_AddBrushModel(), CL_HullForEntity(), and LE_AddEdictHighlight().
Definition at line 1637 of file cl_localentity.cpp.
References cl, Com_Error(), ERR_DROP, index, lengthof, and clientBattleScape_s::model_draw.
Referenced by CL_ActorAppear(), and CL_ViewLoadMedia().
Searches a local entity on a given grid field.
[in] | pos | The grid pos to search for an item of the given type |
Definition at line 1353 of file cl_localentity.cpp.
References LE_GetNextInUse(), le_s::pos, and VectorCompare.
Referenced by CL_GetHitProbability().
Iterate through the list of entities.
lastLE | The entity found in the previous iteration; if 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().
Iterate through the entities that are in use.
lastLE | The 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.
[in] | le | The local entity to perform the check for |
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)
[in] | le | The local entity to perform the check for |
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.
[in] | le | The local entity to perform the check for |
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.
entnum | the entnum of the le_t struct involved. |
Definition at line 1309 of file cl_localentity.cpp.
References le_s::flags, LE_Get(), and LE_LOCKED.
Referenced by CL_CheckDefault().
|
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).
le | The local entity to check |
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().
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().
Markes a le_t struct as locked. Should be called at the beginning of an event handler on this le_t, and paired with a LE_Unlock at the end.
le | The struct to be locked. |
Definition at line 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().
[in] | le | The local entity (ET_ITEM) with the floor container |
Definition at line 896 of file cl_localentity.cpp.
References le_s::angles, objDef_s::center, cl, cls, Com_Error(), ERR_DROP, ET_ACTOR, ET_ACTOR2x2, le_s::fieldSize, le_s::flags, le_s::getFloorContainer(), Grid_PosToVec(), GROUND_DELTA, objDef_s::id, objDef_s::idx, LE_BiggestItem(), LE_GetNextInUse(), LE_IsItem, LE_REMOVE_NEXT_FRAME, clientBattleScape_s::mapData, le_s::model1, client_static_s::modelPool, le_s::origin, le_s::pos, ROLL, mapData_s::routing, le_s::setFloor(), le_s::type, VectorCompare, and VectorSubtract.
Referenced by CL_InvAdd(), and CL_InvDel().
Definition at line 584 of file cl_localentity.cpp.
References CL_Trace(), cl_worldlevel, AABB::EMPTY, teamDef_s::footstepSound, cvar_s::integer, LE_PlaySoundFileAndParticleForSurface(), LE_PlaySoundFileForContents(), MASK_SOLID, cBspSurface_s::name, le_s::origin, le_s::pathContents, le_s::pathPos, le_s::pos, PosToVec, Q_strvalid, S_LoadAndPlaySample(), SND_VOLUME_FOOTSTEPS, SOUND_ATTN_NORM, trace_s::surface, le_s::teamDef, UNIT_HEIGHT, and VectorCopy.
Referenced by LE_DoPathMove().
Plays step sounds and draw particles for different terrain types.
[in] | le | The local entity to play the sound and draw the particle for |
[in] | textureName | The name of the texture the actor is standing on |
Definition at line 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().
Plays sound of content for moving actor.
[in] | le | Pointer to local entity being an actor. |
[in] | contents | The contents flag of the brush we are currently in |
Definition at line 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_SetThink | ( | le_t * | le, |
localEntityThinkFunc_t | think | ||
) |
Definition at line 310 of file cl_localentity.cpp.
References le_s::think.
Referenced by CL_ActorAppear(), CL_ActorDie(), CL_ActorDoMove(), CL_ActorEndShoot(), CL_ActorRevitalised(), CL_ActorStateChange(), CL_AddBrushModel(), CL_DoorClose(), CL_DoorOpen(), CL_InvAdd(), CL_InvDel(), LE_AddGrenade(), LE_AddProjectile(), LE_DoEndPathMove(), LET_HiddenMove(), LET_RotateDoor(), LET_SlideDoor(), LET_StartIdle(), and LET_StartPathMove().
Calls the le think function and updates the animation. The animation updated even if the particular local entity is invisible for the client. This ensures, that an animation is always lerped correctly and won't magically start again once the local entity gets visible again.
Definition at line 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().
Unlocks a previously locked le_t struct.
le | The le_t to unlock. |
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().
Definition at line 1047 of file cl_localentity.cpp.
References le_s::angle, le_s::angles, cl, ET_ROTATING, le_s::rotationSpeed, le_s::thinkDelay, clientBattleScape_s::time, and le_s::type.
Referenced by CL_AddBrushModel().
Handle move for invisible actors.
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().
Move the actor along the path to the given location.
Definition at line 677 of file cl_localentity.cpp.
References cl, dest, le_s::endTime, le_s::fieldSize, Grid_PosToVec(), LE_DoEndPathMove(), LE_DoPathMove(), clientBattleScape_s::mapData, le_s::oldPos, le_s::origin, le_s::pathLength, le_s::pathPos, le_s::pos, mapData_s::routing, le_s::startTime, clientBattleScape_s::time, VectorCopy, VectorMA(), and VectorSubtract.
Referenced by LET_StartPathMove().
Definition at line 748 of file cl_localentity.cpp.
References le_s::angle, ptl_s::angles, bytedirs, cl, CL_ActorPlaySound(), CL_OutsideMap(), CL_ParticleFree(), CL_ParticleSpawn(), csi, csi_s::damStunGas, objDef_s::dmgtype, le_s::endTime, le_s::fd, fireDef_s::impactAttenuation, le_s::inuse, LE_ActorBodyHit(), fireDef_s::obj, le_s::origin, le_s::ptl, Q_strvalid, le_s::ref1, le_s::ref2, le_s::ref3, ptl_s::s, S_LoadAndPlaySample(), SND_HURT, SND_VOLUME_WEAPONS, le_s::state, clientBattleScape_s::time, UNIT_SIZE, VecToAngles(), and VectorCopy.
Referenced by LE_AddGrenade(), and LE_AddProjectile().
Rotates a door in the given speed.
[in] | le | The local entity of the door to rotate |
[in] | speed | The speed to rotate the door with |
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().
Slides a door.
[in,out] | le | The local entity of the inline model |
[in] | speed | The speed to slide with - a negative value to close the door |
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().
Change the animation of an actor to the idle animation (which can be panic, dead or stand)
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().
Change the actors animation to walking.
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().
[in] | model | The model name. |
[in] | origin | Origin of the model (position on map). |
[in] | angles | Angles of the model (how it should be rotated after adding to map). |
[in] | scale | Scaling of the model (how it should be scaled after adding to map). |
[in] | entnum | Entity number. |
[in] | levelflags | The levels in which the entity resides/is visible. |
[in] | renderFlags | The flags for the renderer, eg. 'translucent'. |
Definition at line 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().
Add the local models to the scene.
Definition at line 218 of file cl_localentity.cpp.
References LM_AddToSceneOrder().
Referenced by CL_ViewRender().
|
static |
Definition at line 154 of file cl_localentity.cpp.
References localModel_s::angles, localModel_s::animname, localModel_s::as, cl, cl_worldlevel, cls, Com_Error(), ERR_DROP, localModel_s::frame, client_static_s::frametime, i, localModel_s::id, cvar_s::integer, localModel_s::inuse, localModel_s::levelflags, localModel_s::lighting, clientBattleScape_s::LMs, localModel_s::model, model_s::name, clientBattleScape_s::numLMs, localModel_s::origin, localModel_s::parent, R_AddEntity(), R_AnimRun(), R_EntitySetOrigin(), R_GetEntity(), localModel_s::renderEntityNum, localModel_s::renderFlags, RF_NONE, localModel_s::scale, localModel_s::skin, localModel_s::tagname, and VectorCopy.
Referenced by LM_AddToScene().
|
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 | ) |
Definition at line 315 of file cl_localentity.cpp.
References cl, i, localModel_s::id, clientBattleScape_s::LMs, clientBattleScape_s::numLMs, Q_streq, and Q_strnull().
Referenced by LMT_Init(), and SP_misc_model().
Register misc_models.
Definition at line 292 of file cl_localentity.cpp.
References localModel_s::animname, localModel_s::as, animState_s::change, cl, Com_Printf(), i, localModel_s::inuse, clientBattleScape_s::LMs, localModel_s::model, localModel_s::name, clientBattleScape_s::numLMs, R_AnimChange(), and R_FindModel().
Referenced by CL_ViewLoadMedia().
Definition at line 400 of file cl_localentity.cpp.
References cl, i, clientBattleScape_s::LMs, clientBattleScape_s::numLMs, and localModel_s::think.
Referenced by CL_SpawnParseEntitystring().
void LMT_Init | ( | localModel_t * | localModel | ) |
Definition at line 1063 of file cl_localentity.cpp.
References Com_Error(), ERR_DROP, LM_GetByID(), localModel_s::parent, localModel_s::target, and localModel_s::think.
Referenced by SP_misc_model().
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().