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