]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/ientity.h
transfer from internal tree r5311 branches/1.4-gpl
[xonotic/netradiant.git] / include / ientity.h
1 /*\r
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.\r
4 \r
5 This file is part of GtkRadiant.\r
6 \r
7 GtkRadiant is free software; you can redistribute it and/or modify\r
8 it under the terms of the GNU General Public License as published by\r
9 the Free Software Foundation; either version 2 of the License, or\r
10 (at your option) any later version.\r
11 \r
12 GtkRadiant is distributed in the hope that it will be useful,\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 GNU General Public License for more details.\r
16 \r
17 You should have received a copy of the GNU General Public License\r
18 along with GtkRadiant; if not, write to the Free Software\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
20 */\r
21 \r
22 #ifndef _IENTITY_H_\r
23 #define _IENTITY_H_\r
24 \r
25 //\r
26 // API for entity manip stuff\r
27 //\r
28 \r
29 // FIXME TTimo this prolly needs to merge with iepairs.h?\r
30 \r
31 /*!\r
32 SPoG\r
33 generic "entity" module... \r
34 at first, there will only be one implementation for all entities, \r
35 perhaps later there will be one for each entity type? \r
36 it would probably make more sense to have a single implementation, \r
37 a generic one that is very flexible and can adapt the visualisation of \r
38 itself depending on an xml config specified in the entity definitions file\r
39 */\r
40 #define ENTITY_MAJOR "entity"\r
41 // {A1C9F9FD-75D5-4e4d-9D65-235D6D3F254C}\r
42 static const GUID QEREntityTable_GUID = \r
43 { 0xa1c9f9fd, 0x75d5, 0x4e4d, { 0x9d, 0x65, 0x23, 0x5d, 0x6d, 0x3f, 0x25, 0x4c } };\r
44 \r
45 typedef entity_t* (* PFN_ENTITYALLOC) ();\r
46 typedef void (* PFN_ENTITYFREE) (entity_t *e);\r
47 typedef entity_t* (* PFN_ENTITYCREATE) (eclass_t *c);\r
48 typedef entity_t* (* PFN_ENTITYCLONE) (entity_t *e);\r
49 typedef void  (* PFN_ENTITYSETKEYVALUE) (entity_t *ent, const char *key, const char *value);\r
50 typedef void  (* PFN_ENTITYDELETEKEY) (entity_t *ent, const char *key);\r
51 typedef const char* (* PFN_ENTITYVALUEFORKEY) (entity_t *ent, const char *key);\r
52 typedef float (* PFN_ENTITYFLOATFORKEY) (entity_t *ent, const char *key);\r
53 typedef int   (* PFN_ENTITYINTFORKEY) (entity_t *ent, const char *key);\r
54 typedef void  (* PFN_ENTITYVECTORFORKEY) (entity_t *ent, const char *key, vec3_t vec);\r
55 typedef void (* PFN_ENTITYADDTOLIST) (entity_t *e, entity_t *lst);\r
56 typedef void (* PFN_ENTITYREMOVEFROMLIST) (entity_t *e);\r
57 typedef void (* PFN_ENTITYLINKBRUSH) (entity_t *e, brush_t *b);\r
58 typedef void (* PFN_ENTITYUNLINKBRUSH) (brush_t *b);\r
59 typedef void (* PFN_ENTITYDRAWLIGHT) (entity_t* e, int nGLState, int pref, int nViewType);\r
60 typedef int (* PFN_ENTITYMEMORYSIZE) (entity_t *e);\r
61 typedef void (* PFN_ENTITYUPDATEMODEL) (entity_t *e);\r
62 typedef epair_t* (* PFN_ALLOCATEEPAIR) (const char *key, const char *value);\r
63 typedef epair_t** (* PFN_GETENTITYKEYVALLIST) (entity_t *e);\r
64 typedef void (* PFN_SETENTITYKEYVALLIST) (entity_t *e, epair_t* ep);\r
65 \r
66 \r
67 struct _QEREntityTable\r
68 {\r
69   int m_nSize;\r
70   PFN_ENTITYALLOC m_pfnEntity_Alloc;\r
71   PFN_ENTITYFREE m_pfnEntity_Free;\r
72   PFN_ENTITYCREATE m_pfnEntity_Create;\r
73   PFN_ENTITYCLONE m_pfnEntity_Clone;\r
74   PFN_ENTITYSETKEYVALUE m_pfnSetKeyValue;\r
75   PFN_ENTITYDELETEKEY m_pfnDeleteKey;\r
76   PFN_ENTITYVALUEFORKEY m_pfnValueForKey;\r
77   PFN_ENTITYFLOATFORKEY m_pfnFloatForKey;\r
78   PFN_ENTITYINTFORKEY m_pfnIntForKey;\r
79   PFN_ENTITYVECTORFORKEY m_pfnGetVectorForKey;\r
80   PFN_ENTITYADDTOLIST m_pfnEntity_AddToList;\r
81   PFN_ENTITYREMOVEFROMLIST m_pfnEntity_RemoveFromList;\r
82   PFN_ENTITYLINKBRUSH m_pfnEntity_LinkBrush;\r
83   PFN_ENTITYUNLINKBRUSH m_pfnEntity_UnlinkBrush;\r
84   PFN_ENTITYDRAWLIGHT m_pfnDrawLight;\r
85   PFN_ENTITYMEMORYSIZE m_pfnEntity_MemorySize;\r
86   PFN_ALLOCATEEPAIR m_pfnAllocateEpair;\r
87   PFN_GETENTITYKEYVALLIST m_pfnGetEntityKeyValList;\r
88   PFN_SETENTITYKEYVALLIST m_pfnSetEntityKeyValList;\r
89 };\r
90 \r
91 #ifdef USE_ENTITYTABLE_DEFINE\r
92 #ifndef __ENTITYTABLENAME\r
93 #define __ENTITYTABLENAME g_EntityTable\r
94 #endif\r
95 #define Entity_Alloc __ENTITYTABLENAME.m_pfnEntity_Alloc\r
96 #define Entity_Free __ENTITYTABLENAME.m_pfnEntity_Free\r
97 #define Entity_Clone __ENTITYTABLENAME.m_pfnEntity_Clone\r
98 #define SetKeyValue __ENTITYTABLENAME.m_pfnSetKeyValue\r
99 #define DeleteKey __ENTITYTABLENAME.m_pfnDeleteKey\r
100 #define ValueForKey __ENTITYTABLENAME.m_pfnValueForKey\r
101 #define FloatForKey __ENTITYTABLENAME.m_pfnFloatForKey\r
102 #define IntForKey __ENTITYTABLENAME.m_pfnIntForKey\r
103 #define GetVectorForKey __ENTITYTABLENAME.m_pfnGetVectorForKey\r
104 #define Entity_AddToList __ENTITYTABLENAME.m_pfnEntity_AddToList\r
105 #define Entity_RemoveFromList __ENTITYTABLENAME.m_pfnEntity_RemoveFromList\r
106 #define Entity_LinkBrush __ENTITYTABLENAME.m_pfnEntity_LinkBrush\r
107 #define Entity_UnlinkBrush __ENTITYTABLENAME.m_pfnEntity_UnlinkBrush\r
108 #define DrawLight __ENTITYTABLENAME.m_pfnDrawLight\r
109 #define Entity_MemorySize __ENTITYTABLENAME.m_pfnEntity_MemorySize\r
110 #define Entity_AllocateEpair __ENTITYTABLENAME.m_pfnAllocateEpair\r
111 #define Entity_GetKeyValList __ENTITYTABLENAME.m_pfnGetEntityKeyValList\r
112 #define Entity_SetKeyValList __ENTITYTABLENAME.m_pfnSetEntityKeyValList\r
113 #endif\r
114 \r
115 #endif\r
116 \r