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