00001 00005 /* 00006 Copyright (C) 1997-2001 Id Software, Inc. 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 as published by the Free Software Foundation; either version 2 00011 of the License, or (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 See the GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00023 */ 00024 00025 #ifndef R_ENTITY_H 00026 #define R_ENTITY_H 00027 00028 #define MAX_ANIMLIST 8 00029 00030 #include "r_light.h" 00031 00032 typedef struct animState_s { 00033 int frame, oldframe; 00034 float backlerp; 00035 int time, dt; 00036 int mesh; 00037 00038 byte list[MAX_ANIMLIST]; 00039 byte lcur, ladd; 00040 byte change; 00041 } animState_t; 00042 00046 typedef struct { 00047 qboolean done; 00048 qboolean processing; 00049 float matrix[16]; 00050 } transform_t; 00051 00052 typedef struct entity_s { 00053 struct model_s *model; 00054 vec3_t angles; 00055 vec3_t scale; 00056 vec3_t color; 00057 vec3_t origin; 00058 vec3_t oldorigin; 00059 00060 vec3_t mins, maxs; 00061 00062 /* tag positioning */ 00063 struct entity_s *tagent; 00064 const char *tagname; 00066 /* misc */ 00067 int skinnum; 00068 float alpha; 00069 int flags; 00070 float distanceFromViewOrigin; 00071 00072 qboolean isOriginBrushModel; 00074 animState_t as; 00075 00076 transform_t transform; 00077 00078 vec4_t shell; 00080 r_light_t *lights[MAX_DYNAMIC_LIGHTS]; 00081 int numLights; 00082 00083 image_t *deathTexture; 00084 00085 struct entity_s *next; 00086 } entity_t; 00087 00088 int R_AddEntity(const entity_t *ent); 00089 entity_t *R_GetFreeEntity(void); 00090 entity_t *R_GetEntity(int id); 00091 00092 /* getters and setters for origin */ 00093 const vec3_t *R_EntityGetOrigin(const entity_t *ent); 00094 void R_EntitySetOrigin(entity_t *ent, const vec3_t ovec); 00095 void R_EntityCopyOrigin(entity_t *ent, const entity_t *other); 00096 void R_EntityAddToOrigin(entity_t *ent, const vec3_t offs); 00097 void R_EntitySubtractFromOrigin(entity_t *ent, const vec3_t offs); 00098 00099 #endif