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