entity.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1997-2006 Id Software, Inc.
  4. This file is part of Quake 2 Tools source code.
  5. Quake 2 Tools source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake 2 Tools source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Quake 2 Tools source code; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. // entity.h
  19. #define MAX_FLAGS 8
  20. typedef struct eclass_s
  21. {
  22. struct eclass_s *next;
  23. char *name;
  24. qboolean fixedsize;
  25. qboolean unknown; // wasn't found in source
  26. vec3_t mins, maxs;
  27. vec3_t color;
  28. texdef_t texdef;
  29. char *comments;
  30. char flagnames[MAX_FLAGS][32];
  31. } eclass_t;
  32. extern eclass_t *eclass;
  33. void Eclass_InitForSourceDirectory (char *path);
  34. eclass_t *Eclass_ForName (char *name, qboolean has_brushes);
  35. //===================================================
  36. typedef struct epair_s
  37. {
  38. struct epair_s *next;
  39. char *key;
  40. char *value;
  41. } epair_t;
  42. typedef struct entity_s
  43. {
  44. struct entity_s *prev, *next;
  45. brush_t brushes; // head/tail of list
  46. vec3_t origin;
  47. eclass_t *eclass;
  48. epair_t *epairs;
  49. } entity_t;
  50. char *ValueForKey (entity_t *ent, char *key);
  51. void SetKeyValue (entity_t *ent, char *key, char *value);
  52. void DeleteKey (entity_t *ent, char *key);
  53. float FloatForKey (entity_t *ent, char *key);
  54. int IntForKey (entity_t *ent, char *key);
  55. void GetVectorForKey (entity_t *ent, char *key, vec3_t vec);
  56. void Entity_Free (entity_t *e);
  57. entity_t *Entity_Parse (qboolean onlypairs);
  58. void Entity_Write (entity_t *e, FILE *f, qboolean use_region);
  59. entity_t *Entity_Create (eclass_t *c);
  60. entity_t *Entity_Clone (entity_t *e);
  61. void Entity_LinkBrush (entity_t *e, brush_t *b);
  62. void Entity_UnlinkBrush (brush_t *b);
  63. entity_t *FindEntity(char *pszKey, char *pszValue);
  64. entity_t *FindEntityInt(char *pszKey, int iValue);
  65. int GetUniqueTargetId(int iHint);