100 cl.leInlineModelList[
i] =
nullptr;
130 const double start = time(
nullptr);
135 for (
const le_t* le =
cl.LEs;
i <
cl.numLEs;
i++, le++)
138 Com_Printf(
"Rerouted for %i LEs in %5.2fs\n",
i, time(
nullptr) - start);
156 for (
int i = 0;
i <
cl.numLMs;
i++) {
172 if (!parents && lm.
parent ==
nullptr)
186 if (ent.
tagent ==
nullptr)
229 for (
int i = 0;
i <
cl.numLMs;
i++)
230 if (
cl.LMs[
i].entnum == entnum)
294 for (
int i = 0;
i <
cl.numLMs;
i++) {
302 Com_Printf(
"LM_Register: Could not change anim of %s to '%s'\n",
320 for (
int i = 0;
i <
cl.numLMs;
i++) {
348 Com_Error(
ERR_DROP,
"Already a local model with the same id (%i) loaded\n", entnum);
402 for (
int i = 0;
i <
cl.numLMs;
i++) {
423const char*
LE_GetAnim (
const char* anim,
int right,
int left,
int state)
430 size_t length =
sizeof(retAnim);
442 animationIndex =
'0';
496 if (step !=
nullptr) {
580 return (start[2] -
dest[2]);
615 byte newCrouchingState = crouchingState;
640 Com_Error(
ERR_DROP,
"LE_DoEndPathMove: Actor movement is out of sync: %i:%i:%i should be %i:%i:%i (step %i of %i) (team %i)",
725 Com_Printf(
"LET_StartPathMove: Could not change anim of le: %i, team: %i, pnum: %i\n",
768 if (le->
fd->
obj->dmgtype !=
csi.damStunGas)
814 ptl_t* ptl =
nullptr;
827 if (fd->
obj->dmgtype !=
csi.damStunGas)
836 if (fd->
impact !=
nullptr)
879 for (max = ic->
def(); ic; ic = ic->
getNext()) {
881 if (
size > maxSize) {
901 le_t* actor =
nullptr;
918 Com_Error(
ERR_DROP,
"Model for item %s is not precached in the cls.model_weapons array",
1008 enum { DRAW_TEXTURE = 0x1, DRAW_CIRCLES = 0x2 };
1009 ent->
model =
nullptr;
1012 if ((drawFlags & DRAW_TEXTURE) && ent->
texture ==
nullptr) {
1019 if (!(drawFlags & DRAW_CIRCLES))
1057 le->
angles[le->
angle] = (angle >= 360.0 ? angle - 360.0 : angle);
1065 if (localModel->
target[0] !=
'\0') {
1072 localModel->
think =
nullptr;
1112 vec3_t moveAngles, moveDir;
1122 moveDir[0] = fabsf(moveDir[0]);
1123 moveDir[1] = fabsf(moveDir[1]);
1124 moveDir[2] = fabsf(moveDir[2]);
1128 bool endPos =
false;
1132 if (fabs(le->
origin[le->
dir & 3]) >= distance)
1154 VectorMul(distance, moveAngles, distanceVec);
1171 if (strstr(sound,
"sound/"))
1180 Com_Printf(
"Could not add ambient sound entity\n");
1190 if (volume < 0.0f || volume > 1.0f) {
1192 Com_Printf(
"Invalid volume for local entity given - only values between 0.0 and 1.0 are valid\n");
1227 le = &
cl.LEs[
cl.numLEs];
1244 Com_Error(
ERR_DROP,
"LE_NotFoundError: Could not get LE with entnum %i of type: %i (%s:%i)\n", entnum,
type, file, line);
1246 Com_Error(
ERR_DROP,
"LE_NotFoundError: Could not get LE with entnum %i (%s:%i)\n", entnum, file, line);
1264 const float minDistToMove = 4.0f *
UNIT_SIZE;
1266 if (dist < minDistToMove) {
1269 if (le->
pos[2] != currentCamPos[2])
1295 if (le->
entnum == entnum)
1378 le_t* endOfLEs = &
cl.LEs[
cl.numLEs];
1380 assert(lastLE >=
cl.LEs);
1381 assert(lastLE < endOfLEs);
1426 for (
int j = 0; j < 3; j++)
1427 eorg[j] = org[j] - (le->
origin[j] + leCenter[j]);
1476 ent.
alpha = (sin(
cl.time * 6.28) + 1.0) / 2.0;
1488 for (
int i = 0;
i <
cl.numLEs;
i++) {
1560 for (
int i =
cl.numLEs - 1;
i >= 0;
i--) {
1577void LE_List_f (
void)
1579 Com_Printf(
"number | entnum | type | inuse | invis | pnum | team | size | HP | state | level | model/ptl\n");
1580 for (
int i = 0;
i <
cl.numLEs;
i++) {
1582 Com_Printf(
"#%5i | #%5i | %4i | %5i | %5i | %4i | %4i | %4i | %3i | %5i | %5i | ",
1600void LM_List_f (
void)
1602 Com_Printf(
"number | entnum | skin | frame | lvlflg | renderflags | origin | name\n");
1603 for (
int i = 0;
i <
cl.numLMs;
i++) {
1605 Com_Printf(
"#%5i | #%5i | #%3i | #%4i | %6i | %11i | %5.0f:%5.0f:%3.0f | %s\n",
1667 *tile = model->
tile;
1713 clip->
trace = trace;
1718 clip->
trace = trace;
void CL_ActorPlaySound(const le_t *le, actorSound_t soundType)
Plays various sounds on actor action.
void CL_ActorConditionalMoveCalc(le_t *le)
Recalculate forbidden list, available moves and actor's move length for the current selected actor.
void CL_ActorCleanup(le_t *le)
bool CL_OutsideMap(const vec3_t position, const float delta)
Checks whether give position is still inside the map borders.
void CL_CheckCameraRoute(const pos3_t from, const pos3_t target)
Only moves the camera to the given target location if its not yet close enough.
void LET_StartPathMove(le_t *le)
Change the actors animation to walking.
static void LET_PathMove(le_t *le)
Move the actor along the path to the given location.
le_t * LE_GetNextInUse(le_t *lastLE)
Iterate through the entities that are in use.
void LE_Cleanup(void)
Cleanup unused LE inventories that the server sent to the client also free some unused LE memory.
void LE_CenterView(const le_t *le)
Center the camera on the local entity's origin.
static void CL_GridRecalcRouting(const le_t *le)
void LET_RotateDoor(le_t *le, int speed)
Rotates a door in the given speed.
void LE_AddAmbientSound(const char *sound, const vec3_t origin, int levelflags, float volume, float attenuation)
Adds ambient sounds from misc_sound entities.
static void LE_PlaySoundFileAndParticleForSurface(le_t *le, const char *textureName)
Plays step sounds and draw particles for different terrain types.
le_t * LE_GetNext(le_t *lastLE)
Iterate through the list of entities.
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 LE_AddGrenade(const fireDef_t *fd, int flags, const vec3_t muzzle, const vec3_t v0, int dt, le_t *leVictim)
void LM_AddToScene(void)
Add the local models to the scene.
void CL_RecalcRouting(const le_t *le)
void LM_Register(void)
Register misc_models.
static void CL_ClipMoveToLEs(MoveClipCL *clip)
Clip against solid entities.
localModel_t * LM_GetByID(const char *id)
void LMT_Init(localModel_t *localModel)
void LE_Unlock(le_t *le)
Unlocks a previously locked le_t struct.
static void LE_PlayFootStepSound(le_t *le)
bool LE_IsLivingAndVisibleActor(const le_t *le)
Checks whether the given le is a living and visible actor.
void _LE_NotFoundError(int entnum, int type, const char *file, const int line)
static localModel_t * LM_Find(int entnum)
Checks whether a local model with the same entity number is already registered.
static void LE_ActorBodyHit(const le_t *le, const vec3_t impact, int normal)
Spawns particle effects for a hit actor.
bool LE_BrushModelAction(le_t *le, entity_t *ent)
Add function for brush models.
static bool LE_IsOriginBrush(const le_t *const le)
void CL_CompleteRecalcRouting(void)
void LET_HiddenMove(le_t *le)
Handle move for invisible actors.
static void LE_GenerateInlineModelList(void)
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.
static const objDef_t * LE_BiggestItem(const Item *ic)
Returns the index of the biggest item in the inventory list.
bool LE_IsLivingActor(const le_t *le)
Checks whether the given le is a living actor (but might be hidden).
void LET_BrushModel(le_t *le)
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 L...
static void LE_AddEdictHighlight(const le_t *le)
Adds a box that highlights the current active door.
le_t * LE_GetFromPos(const pos3_t pos)
Searches a local entity on a given grid field.
const cBspModel_t * LE_GetClipModel(const le_t *le)
void LE_DoEndPathMove(le_t *le)
Ends the move of an actor.
model_t * LE_GetDrawModel(unsigned int index)
static void LE_DoPathMove(le_t *le)
cvar_t * cl_map_draw_rescue_zone
le_t * LE_Add(int entnum)
Add a new local entity to the scene.
int LE_ActorGetStepTime(const le_t *le, const pos3_t pos, const pos3_t oldPos, const int dir, const int speed)
void LE_SetThink(le_t *le, localEntityThinkFunc_t think)
void LET_SlideDoor(le_t *le, int speed)
Slides a door.
void LE_LinkFloorContainer(le_t *le)
link any floor container into the actor temp floor container
static void LET_Projectile(le_t *le)
static void LM_AddToSceneOrder(bool parents)
void LE_PlaceItem(le_t *le)
void LET_StartIdle(le_t *le)
Change the animation of an actor to the idle animation (which can be panic, dead or stand).
static void LE_PlaySoundFileForContents(le_t *le, int contents)
Plays sound of content for moving actor.
void LE_AddProjectile(const fireDef_t *fd, int flags, const vec3_t muzzle, const vec3_t impact, int normal, le_t *leVictim)
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,...
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....
le_t * LE_Find(entity_type_t type, const pos3_t pos)
Searches a local entity on a given grid field.
void LE_ExecuteThink(le_t *le)
Call think function for the given local entity if its still in use.
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_Think(void)
Calls the le think function and updates the animation. The animation updated even if the particular l...
le_t * LE_Get(int entnum)
Searches all local entities for the one with the searched entnum.
bool LE_IsActor(const le_t *le)
Checks whether the given le is a living actor.
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(* localEntityThinkFunc_t)(struct le_s *le)
#define LE_IsPanicked(le)
#define LE_GetAnimationIndexForDeath(le)
Valid indices from 1 - MAX_DEATH.
#define LE_IsCrouched(le)
#define LE_REMOVE_NEXT_FRAME
#define LE_IsInvisible(le)
#define LE_ALWAYS_VISIBLE
#define LE_IsSelected(le)
#define LE_SetInvisible(le)
#define LE_CHECK_LEVELFLAGS
void CL_ParticleFree(ptl_t *p)
Free a particle and all it's children.
ptl_t * CL_ParticleSpawn(const char *name, int levelFlags, const vec3_t s, const vec3_t v, const vec3_t a)
Spawn a new particle to the map.
void getCenter(vec3_t center) const
Calculates the center of the bounding box.
void set(const AABB &other)
Copies the values from the given aabb.
void shift(const vec3_t shiftVec)
shove the whole box by the given vector
item instance data, with linked list capability
const objDef_t * def(void) const
void set(const Line &other)
Copies the values from the given Line.
The bounding box of a moving object.
void calcBounds()
Create the bounding box for the entire move.
Primary header for client.
void Cmd_ExecuteString(const char *text,...)
A complete command line has been parsed, so try to execute it.
trace_t CM_HintedTransformedBoxTrace(MapTile &tile, const Line &traceLine, const AABB &traceBox, const int headnode, const int contentmask, const int brushrejects, const vec3_t origin, const vec3_t angles, const vec3_t rmaShift, const float fraction)
Handles offseting and rotation of the end points for moving and rotating entities.
trace_t CM_CompleteBoxTrace(mapTiles_t *mapTiles, const Line &trLine, const AABB &box, int levelmask, int brushmask, int brushreject)
Traces all submodels in all tiles. Used by ufo and ufo_ded.
int32_t CM_HeadnodeForBox(MapTile &tile, const AABB &box)
To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being c...
cBspModel_t * CM_SetInlineModelOrientation(mapTiles_t *mapTiles, const char *name, const vec3_t origin, const vec3_t angles)
This function updates a model's orientation.
cBspModel_t * CM_InlineModel(const mapTiles_t *mapTiles, const char *name)
Searches all inline models and return the cBspModel_t pointer for the given modelnumber or -name.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
int Com_ServerState(void)
Check whether we are the server or have a singleplayer tactical mission.
void Com_Error(int code, const char *fmt,...)
void Com_Printf(const char *const fmt,...)
#define SOUND_ATTN_STATIC
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
#define ACTOR_SIZE_NORMAL
#define ACTOR_SIZE_INVALID
void Grid_PosToVec(const Routing &routing, const actorSizeEnum_t actorSize, const pos3_t pos, vec3_t vec)
Converts a grid position to world coordinates.
void Grid_RecalcRouting(mapTiles_t *mapTiles, Routing &routing, const char *name, const GridBox &box, const char **list)
This function recalculates the routing surrounding the entity name.
Battlescape grid functions.
const objDef_t * INVSH_GetItemByIDX(int index)
Returns the item that belongs to the given index or nullptr if the index is invalid.
int INVSH_ShapeSize(const uint32_t shape)
Counts the used bits in a shape (item shape).
vec_t VectorLength(const vec3_t v)
Calculate the length of a vector.
void VectorMA(const vec3_t veca, const float scale, const vec3_t vecb, vec3_t outVector)
Sets vector_out (vc) to vevtor1 (va) + scale * vector2 (vb).
void CalculateMinsMaxs(const vec3_t angles, const AABB &relBox, const vec3_t origin, AABB &absBox)
Calculates the bounding box in absolute coordinates, also for rotating objects. WARNING: do not use t...
const float directionAngles[CORE_DIRECTIONS]
float crand(void)
Return random values between -1 and 1.
void AngleVectors(const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Create the rotation matrix in order to rotate something.
void VecToAngles(const vec3_t value1, vec3_t angles)
Converts a vector to an angle vector.
#define PosAddDV(p, crouch, dv)
#define PosToVec(p, v)
Pos boundary size is +/- 128 - to get into the positive area we add the possible max negative value a...
#define FLYING_DIRECTIONS
short dvec_t
The direction vector tells us where the actor came from (in his previous step). The pathing table hol...
#define BASE_DIRECTIONS
Number of direct connected fields for a position.
#define VecToPos(v, p)
Map boundary is +/- MAX_WORLD_WIDTH - to get into the positive area we add the possible max negative ...
#define DOOR_ROTATION_ANGLE
#define SKIP_LOCAL_ENTITY
#define DOOR_OPEN_REVERSE
#define GET_SLIDING_DOOR_SHIFT_VECTOR(dir, speed, vecout)
void R_DrawBoundingBoxBatched(const AABB &absbox)
int R_AddEntity(const entity_t *ent)
Adds a copy of the specified entity to the list of all known render entities.
entity_t * R_GetEntity(int id)
Returns a specific entity from the list.
void R_EntitySetOrigin(entity_t *ent, const vec3_t origin)
setter for entity origin
QGL_EXTERN GLenum GLuint * dest
QGL_EXTERN GLuint GLsizei GLsizei * length
QGL_EXTERN GLint GLenum type
const image_t * R_FindPics(const char *name)
Searches for an image in the image array.
void R_AnimRun(animState_t *as, const model_t *mod, int msec)
Run the animation of the given model.
void R_AnimChange(animState_t *as, const model_t *mod, const char *name)
Changes the animation for md2 models.
model_t * R_FindModel(const char *name)
Tries to load a model.
static ipos3_t shift
The shift array is used for random map assemblies (RMA) to shift the mins/maxs and stuff like that.
void S_PlayStdSample(const stdsound_t sId, const vec3_t origin, float attenuation, float volume)
plays one of the precached samples
bool S_LoadAndPlaySample(const char *s, const vec3_t origin, float attenuation, float volume)
does what the name implies in just one function to avoid exposing s_sample_t
int S_LoadSampleIdx(const char *soundFile)
Loads and registers a sound file for later use.
#define SND_VOLUME_DEFAULT
#define SND_VOLUME_WEAPONS
const terrainType_t * Com_GetTerrainType(const char *textureName)
Searches the terrain definition if given.
#define SND_VOLUME_FOOTSTEPS
#define Q_strvalid(string)
bool Q_strnull(const char *string)
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
char const * Q_strstart(char const *str, char const *start)
Matches the start of a string.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
void setScale(const vec3_t scale_)
this is a fire definition for our weapons/ammo
const struct objDef_s * obj
const char * hitBodySound
fireDefIndex_t currentSelectedFiremode
actorSizeEnum_t fieldSize
localEntitiyAddFunc_t addFunc
localEntityThinkFunc_t think
int pathContents[MAX_ROUTE]
byte actorMoveLength
The TUs that the current selected actor needs to walk to the current grid position marked by the mous...
struct le_s * clientAction
void setFloor(le_s *other)
Item * getFloorContainer() const
void(* think)(struct localModel_s *localModel)
void setScale(const vec3_t scale_)
struct localModel_s * parent
Defines all attributes of objects used in the inventory.
char hitParticle[MAX_VAR]
char footstepSound[MAX_VAR]
Different terrain definitions for footsteps and particles.
const char * footstepSound
static const vec3_t scale
#define VectorMul(scalar, b, dest)
#define VectorSubtract(a, b, dest)
#define VectorCopy(src, dest)
#define Vector2Dist(a, b)
#define VectorCompare(a, b)
#define VectorAdd(a, b, dest)
#define DotProduct(x, y)
Returns the distance between two 3-dimensional vectors.
#define VectorSet(v, x, y, z)
#define VectorScale(in, scale, out)