]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - plugins/entity/plugin.cpp
reformat code! now the code is only ugly on the *inside*
[xonotic/netradiant.git] / plugins / entity / plugin.cpp
1 /*
2    Copyright (C) 2001-2006, William Joseph.
3    All Rights Reserved.
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 #include "debugging/debugging.h"
23
24 #include "iscenegraph.h"
25 #include "irender.h"
26 #include "iselection.h"
27 #include "ientity.h"
28 #include "iundo.h"
29 #include "ieclass.h"
30 #include "igl.h"
31 #include "ireference.h"
32 #include "ifilter.h"
33 #include "preferencesystem.h"
34 #include "qerplugin.h"
35 #include "namespace.h"
36 #include "modelskin.h"
37
38 #include "typesystem.h"
39
40 #include "entity.h"
41 #include "skincache.h"
42
43 #include "modulesystem/singletonmodule.h"
44
45 class EntityDependencies :
46         public GlobalRadiantModuleRef,
47         public GlobalOpenGLModuleRef,
48         public GlobalUndoModuleRef,
49         public GlobalSceneGraphModuleRef,
50         public GlobalShaderCacheModuleRef,
51         public GlobalSelectionModuleRef,
52         public GlobalReferenceModuleRef,
53         public GlobalFilterModuleRef,
54         public GlobalPreferenceSystemModuleRef,
55         public GlobalNamespaceModuleRef,
56         public GlobalModelSkinCacheModuleRef {
57 };
58
59 class EntityQ3API : public TypeSystemRef {
60     EntityCreator *m_entityq3;
61 public:
62     typedef EntityCreator Type;
63
64     STRING_CONSTANT(Name, "quake3");
65
66     EntityQ3API()
67     {
68         Entity_Construct();
69
70         m_entityq3 = &GetEntityCreator();
71
72         GlobalReferenceCache().setEntityCreator(*m_entityq3);
73     }
74
75     ~EntityQ3API()
76     {
77         Entity_Destroy();
78     }
79
80     EntityCreator *getTable()
81     {
82         return m_entityq3;
83     }
84 };
85
86 typedef SingletonModule<EntityQ3API, EntityDependencies> EntityQ3Module;
87
88 EntityQ3Module g_EntityQ3Module;
89
90
91 class EntityWolfAPI : public TypeSystemRef {
92     EntityCreator *m_entitywolf;
93 public:
94     typedef EntityCreator Type;
95
96     STRING_CONSTANT(Name, "wolf");
97
98     EntityWolfAPI()
99     {
100         Entity_Construct(eGameTypeRTCW);
101
102         m_entitywolf = &GetEntityCreator();
103
104         GlobalReferenceCache().setEntityCreator(*m_entitywolf);
105     }
106
107     ~EntityWolfAPI()
108     {
109         Entity_Destroy();
110     }
111
112     EntityCreator *getTable()
113     {
114         return m_entitywolf;
115     }
116 };
117
118 typedef SingletonModule<EntityWolfAPI, EntityDependencies> EntityWolfModule;
119
120 EntityWolfModule g_EntityWolfModule;
121
122
123 class EntityDoom3API : public TypeSystemRef {
124     EntityCreator *m_entitydoom3;
125 public:
126     typedef EntityCreator Type;
127
128     STRING_CONSTANT(Name, "doom3");
129
130     EntityDoom3API()
131     {
132         Entity_Construct(eGameTypeDoom3);
133
134         m_entitydoom3 = &GetEntityCreator();
135
136         GlobalReferenceCache().setEntityCreator(*m_entitydoom3);
137     }
138
139     ~EntityDoom3API()
140     {
141         Entity_Destroy();
142     }
143
144     EntityCreator *getTable()
145     {
146         return m_entitydoom3;
147     }
148 };
149
150 typedef SingletonModule<EntityDoom3API, EntityDependencies> EntityDoom3Module;
151
152 EntityDoom3Module g_EntityDoom3Module;
153
154
155 extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer &server)
156 {
157     initialiseModule(server);
158
159     g_EntityQ3Module.selfRegister();
160     g_EntityWolfModule.selfRegister();
161     g_EntityDoom3Module.selfRegister();
162     Doom3ModelSkinCacheModule_selfRegister(server);
163 }