00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef CLIENT_CL_LOCALENTITY_H
00026 #define CLIENT_CL_LOCALENTITY_H
00027
00028 #include "../renderer/r_entity.h"
00029
00030 #define MAX_LE_PATHLENGTH 32
00031
00033 typedef enum {
00034 M_MOVE,
00035 M_FIRE_R,
00036 M_FIRE_L,
00037 M_FIRE_HEADGEAR,
00038 M_PEND_MOVE,
00039 M_PEND_FIRE_R,
00040 M_PEND_FIRE_L
00041 } actorModes_t;
00042
00043 #define IS_MODE_FIRE_RIGHT(x) ((x) == M_FIRE_R || (x) == M_PEND_FIRE_R)
00044 #define IS_MODE_FIRE_LEFT(x) ((x) == M_FIRE_L || (x) == M_PEND_FIRE_L)
00045 #define IS_MODE_FIRE_HEADGEAR(x) ((x) == M_FIRE_HEADGEAR)
00046 #define IS_MODE_FIRE_PENDING(x) ((x) == M_PEND_FIRE_L || (x) == M_PEND_FIRE_R)
00047
00049 typedef struct le_s {
00050 qboolean inuse;
00051 qboolean removeNextFrame;
00052 qboolean invis;
00053 qboolean selected;
00054 entity_type_t type;
00055 int entnum;
00057 vec3_t origin, oldOrigin;
00058 pos3_t pos, oldPos, newPos;
00059 int dir;
00063 int TU, maxTU;
00064 int morale, maxMorale;
00065 int HP, maxHP;
00066 int STUN;
00067 int state;
00069 float angles[3];
00070 float alpha;
00072 int team;
00073 int pnum;
00075 fireDefIndex_t currentSelectedFiremode;
00076
00077 actorModes_t actorMode;
00079 pos3_t mousePendPos;
00085 byte actorMoveLength;
00086
00087 struct le_s *clientAction;
00089 int contents;
00090 vec3_t mins, maxs;
00091
00092 char inlineModelName[8];
00093 int modelnum1;
00094 int modelnum2;
00095 int skinnum;
00096 model_t *model1, *model2;
00101 void (*think) (struct le_s * le);
00103 int thinkDelay;
00104
00106 byte path[MAX_LE_PATHLENGTH];
00107 int pathContents[MAX_LE_PATHLENGTH];
00108 int positionContents;
00109 int pathLength, pathPos;
00110 int startTime, endTime;
00111 int speed[MAX_LE_PATHLENGTH];
00112 float rotationSpeed;
00113
00115 struct s_sample_s* sample;
00116 float attenuation;
00117 float volume;
00120 animState_t as;
00121 const char *particleID;
00122 int levelflags;
00123 ptl_t *ptl;
00124 const char *ref1, *ref2;
00125 const struct le_s *ref3;
00126 inventory_t i;
00127 int left, right, extension, headgear;
00128 actorSizeEnum_t fieldSize;
00130 teamDef_t* teamDef;
00131 int gender;
00132 const fireDef_t *fd;
00134 pathing_t *pathMap;
00138 qboolean(*addFunc) (struct le_s * le, entity_t * ent);
00139
00140 qboolean locked;
00142 } le_t;
00143
00144 #define MAX_LOCALMODELS 512
00145
00147 typedef struct localModel_s {
00148 char id[MAX_VAR];
00150 char name[MAX_QPATH];
00151 char target[MAX_VAR];
00152 char tagname[MAX_VAR];
00153 struct localModel_s *parent;
00154 qboolean inuse;
00155
00156 vec3_t origin;
00157 vec3_t angles;
00158 vec3_t scale;
00160 int entnum;
00161 int renderEntityNum;
00162 int skin;
00163 int renderFlags;
00164 int frame;
00165 char animname[MAX_QPATH];
00166 int levelflags;
00167 animState_t as;
00168
00170 void (*think) (struct localModel_s * localModel);
00171
00172 struct model_s *model;
00173 } localModel_t;
00174
00175 static const vec3_t player_mins = { -PLAYER_WIDTH, -PLAYER_WIDTH, PLAYER_MIN };
00176 static const vec3_t player_maxs = { PLAYER_WIDTH, PLAYER_WIDTH, PLAYER_STAND };
00177 static const vec3_t player_dead_maxs = { PLAYER_WIDTH, PLAYER_WIDTH, PLAYER_DEAD };
00178
00179 extern cvar_t* cl_le_debug;
00180 extern cvar_t *cl_leshowinvis;
00181
00182 const char *LE_GetAnim(const char *anim, int right, int left, int state);
00183 void LE_AddProjectile(const fireDef_t *fd, int flags, const vec3_t muzzle, const vec3_t impact, int normal, le_t *leVictim);
00184 void LE_AddGrenade(const fireDef_t *fd, int flags, const vec3_t muzzle, const vec3_t v0, int dt, le_t* leVictim);
00185 void LE_AddAmbientSound(const char *sound, const vec3_t origin, int levelflags, float volume, float attenuation);
00186 int LE_ActorGetStepTime(const le_t *le, const pos3_t pos, const pos3_t oldPos, const int dir, const int sped);
00187
00188 #define LE_IsStunned(le) (((le)->state & STATE_STUN) & ~STATE_DEAD)
00189
00190 #define LE_IsDead(le) ((le)->state & STATE_DEAD)
00191 #define LE_IsPaniced(le) ((le)->state & STATE_PANIC)
00192 #define LE_IsCrouched(le) ((le)->state & STATE_CROUCHED)
00193
00194 #define LE_IsItem(le) ((le)->type == ET_ITEM)
00195 #define LE_IsCivilian(le) ((le)->team == TEAM_CIVILIAN)
00196 #define LE_IsAlien(le) ((le)->team == TEAM_ALIEN)
00197 #define LE_IsPhalanx(le) ((le)->team == TEAM_PHALANX)
00198
00200 #define LE_GetAnimationIndexForDeath(le) ((le)->state & MAX_DEATH)
00201
00202 #ifdef DEBUG
00203 void LE_List_f(void);
00204 void LM_List_f(void);
00205 #endif
00206
00207 void LE_SetThink(le_t *le, void (*think) (le_t *le));
00208 void LE_ExecuteThink(le_t *le);
00209 void LE_Think(void);
00210
00211 void LET_StartIdle(le_t *le);
00212 void LET_Appear(le_t *le);
00213 void LET_StartPathMove(le_t *le);
00214 void LET_BrushModel(le_t *le);
00215 void LE_DoEndPathMove(le_t *le);
00216
00217
00218 void LM_Think(void);
00219 void LMT_Init(localModel_t *localModel);
00220 localModel_t *LM_AddModel(const char *model, const vec3_t origin, const vec3_t angles, int entnum, int levelflags, int flags, const vec3_t scale);
00221 void LM_Perish(struct dbuffer *msg);
00222 void LM_AddToScene(void);
00223
00224 qboolean LE_BrushModelAction(le_t *le, entity_t *ent);
00225 void CL_RecalcRouting(const le_t *le);
00226 void CL_CompleteRecalcRouting(void);
00227
00228 qboolean LE_IsLivingAndVisibleActor(const le_t *le);
00229 qboolean LE_IsLivingActor(const le_t *le);
00230 qboolean LE_IsActor(const le_t *le);
00231 le_t *LE_Add(int entnum);
00232 le_t *LE_Get(int entnum);
00233 le_t* LE_GetNextInUse(le_t* lastLE);
00234 le_t* LE_GetNext(le_t* lastLE);
00235 void LE_Lock(le_t *le);
00236 void LE_Unlock(le_t *le);
00237 qboolean LE_IsLocked(int entnum);
00238 #define LE_NotFoundError(entnum) _LE_NotFoundError(entnum, __FILE__, __LINE__)
00239 void _LE_NotFoundError(int entnum, const char *file, const int line) __attribute__((noreturn));
00240 le_t *LE_Find(int type, const pos3_t pos);
00241 le_t *LE_FindRadius(le_t *from, const vec3_t org, float rad, entity_type_t type);
00242 le_t *LE_GetFromPos(const pos3_t pos);
00243 void LE_PlaceItem(le_t *le);
00244 void LE_Cleanup(void);
00245 void LE_AddToScene(void);
00246 void LE_CenterView(const le_t *le);
00247
00248 trace_t CL_Trace(const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, const le_t * passle, le_t * passle2, int contentmask, int worldLevel);
00249
00250 void LM_Register(void);
00251 localModel_t *LM_GetByID(const char *id);
00252
00253 #endif