]> icculus.org git repositories - divverent/netradiant.git/blob - plugins/mapq3/plugin.cpp
remove some stupid debug prints
[divverent/netradiant.git] / plugins / mapq3 / 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 "iscriplib.h"
25 #include "ibrush.h"
26 #include "ipatch.h"
27 #include "ifiletypes.h"
28 #include "ieclass.h"
29 #include "qerplugin.h"
30
31 #include "scenelib.h"
32 #include "string/string.h"
33 #include "stringio.h"
34 #include "generic/constant.h"
35
36 #include "modulesystem/singletonmodule.h"
37
38 #include "parse.h"
39 #include "write.h"
40
41
42 class MapDoom3Dependencies :
43   public GlobalRadiantModuleRef,
44   public GlobalFiletypesModuleRef,
45   public GlobalScripLibModuleRef,
46   public GlobalEntityClassManagerModuleRef,
47   public GlobalSceneGraphModuleRef,
48   public GlobalBrushModuleRef
49 {
50   PatchModuleRef m_patchDef2Doom3Module;
51   PatchModuleRef m_patchDoom3Module;
52 public:
53   MapDoom3Dependencies() :
54     GlobalEntityClassManagerModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entityclass")),
55     GlobalBrushModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("brushtypes")),
56     m_patchDef2Doom3Module("def2doom3"),
57     m_patchDoom3Module("doom3")
58   {
59   }
60   BrushCreator& getBrushDoom3()
61   {
62     return GlobalBrushModule::getTable();
63   }
64   PatchCreator& getPatchDoom3()
65   {
66     return *m_patchDoom3Module.getTable();
67   }
68   PatchCreator& getPatchDef2Doom3()
69   {
70     return *m_patchDef2Doom3Module.getTable();
71   }
72 };
73
74 class MapDoom3API : public TypeSystemRef, public MapFormat, public PrimitiveParser
75 {
76   MapDoom3Dependencies& m_dependencies;
77 public:
78   typedef MapFormat Type;
79   STRING_CONSTANT(Name, "mapdoom3");
80   INTEGER_CONSTANT(MapVersion, 2);
81
82   MapDoom3API(MapDoom3Dependencies& dependencies) : m_dependencies(dependencies)
83   {
84     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("doom3 maps", "*.map"));
85     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("doom3 region", "*.reg"));
86   }
87   MapFormat* getTable()
88   {
89     return this;
90   }
91
92   scene::Node& parsePrimitive(Tokeniser& tokeniser) const
93   {
94     const char* primitive = tokeniser.getToken();
95     if(primitive != 0)
96     {
97       if(string_equal(primitive, "patchDef3"))
98       {
99         return m_dependencies.getPatchDoom3().createPatch();
100       }
101       else if(string_equal(primitive, "patchDef2"))
102       {
103         return m_dependencies.getPatchDef2Doom3().createPatch();
104       }
105       else if(string_equal(primitive, "brushDef3"))
106       {
107         return m_dependencies.getBrushDoom3().createBrush();
108       }
109     }
110
111     Tokeniser_unexpectedError(tokeniser, primitive, "#doom3-primitive");
112     return g_nullNode;
113   }
114   void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
115   {
116     Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
117     tokeniser.nextLine();
118     if(!Tokeniser_parseToken(tokeniser, "Version"))
119     {
120       return;
121     }
122     std::size_t version;
123     if(!Tokeniser_getSize(tokeniser, version))
124     {
125       return;
126     }
127     if(version != MapVersion())
128     {
129       globalErrorStream() << "Doom 3 map version " << MapVersion() << " supported, version is " << Unsigned(version) << "\n";
130       return;
131     }
132     tokeniser.nextLine();
133     Map_Read(root, tokeniser, entityTable, *this);
134     tokeniser.release();
135   }
136   void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
137   {
138     TokenWriter& writer = GlobalScripLibModule::getTable().m_pfnNewSimpleTokenWriter(outputStream);
139     writer.writeToken("Version");
140     writer.writeInteger(MapVersion());
141     writer.nextLine();
142     Map_Write(root, traverse, writer, false);
143     writer.release();
144   }
145 };
146
147 typedef SingletonModule<
148   MapDoom3API,
149   MapDoom3Dependencies,
150   DependenciesAPIConstructor<MapDoom3API, MapDoom3Dependencies>
151 >
152 MapDoom3Module;
153
154 MapDoom3Module g_MapDoom3Module;
155
156
157 class MapQuake4API : public TypeSystemRef, public MapFormat, public PrimitiveParser
158 {
159   MapDoom3Dependencies& m_dependencies;
160 public:
161   typedef MapFormat Type;
162   STRING_CONSTANT(Name, "mapquake4");
163   INTEGER_CONSTANT(MapVersion, 3);
164
165   MapQuake4API(MapDoom3Dependencies& dependencies) : m_dependencies(dependencies)
166   {
167     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("quake4 maps", "*.map"));
168     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("quake4 region", "*.reg"));
169   }
170   MapFormat* getTable()
171   {
172     return this;
173   }
174
175   scene::Node& parsePrimitive(Tokeniser& tokeniser) const
176   {
177     const char* primitive = tokeniser.getToken();
178     if(primitive != 0)
179     {
180       if(string_equal(primitive, "patchDef3"))
181       {
182         return m_dependencies.getPatchDoom3().createPatch();
183       }
184       else if(string_equal(primitive, "patchDef2"))
185       {
186         return m_dependencies.getPatchDef2Doom3().createPatch();
187       }
188       else if(string_equal(primitive, "brushDef3"))
189       {
190         return m_dependencies.getBrushDoom3().createBrush();
191       }
192     }
193
194     Tokeniser_unexpectedError(tokeniser, primitive, "#quake4-primitive");
195     return g_nullNode;
196   }
197   void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
198   {
199     Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
200     tokeniser.nextLine();
201     if(!Tokeniser_parseToken(tokeniser, "Version"))
202     {
203       return;
204     }
205     std::size_t version;
206     if(!Tokeniser_getSize(tokeniser, version))
207     {
208       return;
209     }
210     if(version != MapVersion())
211     {
212       globalErrorStream() << "Quake 4 map version " << MapVersion() << " supported, version is " << Unsigned(version) << "\n";
213       return;
214     }
215     tokeniser.nextLine();
216     Map_Read(root, tokeniser, entityTable, *this);
217     tokeniser.release();
218   }
219   void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
220   {
221     TokenWriter& writer = GlobalScripLibModule::getTable().m_pfnNewSimpleTokenWriter(outputStream);
222     writer.writeToken("Version");
223     writer.writeInteger(MapVersion());
224     writer.nextLine();
225     Map_Write(root, traverse, writer, false);
226     writer.release();
227   }
228 };
229
230 typedef SingletonModule<
231   MapQuake4API,
232   MapDoom3Dependencies,
233   DependenciesAPIConstructor<MapQuake4API, MapDoom3Dependencies>
234 >
235 MapQuake4Module;
236
237 MapQuake4Module g_MapQuake4Module;
238
239
240 class MapDependencies : 
241   public GlobalRadiantModuleRef,
242   public GlobalBrushModuleRef,
243   public GlobalPatchModuleRef,
244   public GlobalFiletypesModuleRef,
245   public GlobalScripLibModuleRef,
246   public GlobalEntityClassManagerModuleRef,
247   public GlobalSceneGraphModuleRef
248 {
249 public:
250   MapDependencies() :
251     GlobalBrushModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("brushtypes")),
252     GlobalPatchModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("patchtypes")),
253     GlobalEntityClassManagerModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entityclass"))
254   {
255   }
256 };
257
258 class MapQ3API : public TypeSystemRef, public MapFormat, public PrimitiveParser
259 {
260 public:
261   typedef MapFormat Type;
262   STRING_CONSTANT(Name, "mapq3");
263
264   MapQ3API()
265   {
266     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("quake3 maps", "*.map"));
267     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("quake3 region", "*.reg"));
268   }
269   MapFormat* getTable()
270   {
271     return this;
272   }
273
274   scene::Node& parsePrimitive(Tokeniser& tokeniser) const
275   {
276     const char* primitive = tokeniser.getToken();
277     if(primitive != 0)
278     {
279       if(string_equal(primitive, "patchDef2"))
280       {
281         return GlobalPatchModule::getTable().createPatch();
282       }
283       if(GlobalBrushModule::getTable().useAlternativeTextureProjection())
284       {
285         if(string_equal(primitive, "brushDef"))
286         {
287           return GlobalBrushModule::getTable().createBrush();
288         }
289       }
290       else
291       {
292         if(string_equal(primitive, "("))
293         {
294           tokeniser.ungetToken(); // (
295           return GlobalBrushModule::getTable().createBrush();
296         }
297       }
298     }
299
300     Tokeniser_unexpectedError(tokeniser, primitive, "#quake3-primitive");
301     return g_nullNode;
302   }
303
304   void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
305   {
306     Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
307     Map_Read(root, tokeniser, entityTable, *this);
308     tokeniser.release();
309   }
310   void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
311   {
312     TokenWriter& writer = GlobalScripLibModule::getTable().m_pfnNewSimpleTokenWriter(outputStream);
313     Map_Write(root, traverse, writer, false);
314     writer.release();
315   }
316 };
317
318 typedef SingletonModule<MapQ3API, MapDependencies> MapQ3Module;
319
320 MapQ3Module g_MapQ3Module;
321
322
323 class MapQ1API : public TypeSystemRef, public MapFormat, public PrimitiveParser
324 {
325 public:
326   typedef MapFormat Type;
327   STRING_CONSTANT(Name, "mapq1");
328
329   MapQ1API()
330   {
331     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("quake maps", "*.map"));
332     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("quake region", "*.reg"));
333   }
334   MapFormat* getTable()
335   {
336     return this;
337   }
338
339   scene::Node& parsePrimitive(Tokeniser& tokeniser) const
340   {
341     const char* primitive = tokeniser.getToken();
342     if(primitive != 0)
343     {
344       if(string_equal(primitive, "("))
345       {
346         tokeniser.ungetToken(); // (
347         return GlobalBrushModule::getTable().createBrush();
348       }
349     }
350
351     Tokeniser_unexpectedError(tokeniser, primitive, "#quake-primitive");
352     return g_nullNode;
353   }
354   void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
355   {
356     Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
357     Map_Read(root, tokeniser, entityTable, *this);
358     tokeniser.release();
359   }
360   void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
361   {
362     TokenWriter& writer = GlobalScripLibModule::getTable().m_pfnNewSimpleTokenWriter(outputStream);
363     Map_Write(root, traverse, writer, true);
364     writer.release();
365   }
366 };
367
368 typedef SingletonModule<MapQ1API, MapDependencies> MapQ1Module;
369
370 MapQ1Module g_MapQ1Module;
371
372
373 class MapHalfLifeAPI : public TypeSystemRef, public MapFormat, public PrimitiveParser
374 {
375 public:
376   typedef MapFormat Type;
377   STRING_CONSTANT(Name, "maphl");
378
379   MapHalfLifeAPI()
380   {
381     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("half-life maps", "*.map"));
382     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("half-life region", "*.reg"));
383   }
384   MapFormat* getTable()
385   {
386     return this;
387   }
388
389   scene::Node& parsePrimitive(Tokeniser& tokeniser) const
390   {
391     const char* primitive = tokeniser.getToken();
392     if(primitive != 0)
393     {
394       if(string_equal(primitive, "("))
395       {
396         tokeniser.ungetToken(); // (
397         return GlobalBrushModule::getTable().createBrush();
398       }
399     }
400
401     Tokeniser_unexpectedError(tokeniser, primitive, "#halflife-primitive");
402     return g_nullNode;
403   }
404   void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
405   {
406     Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
407     Map_Read(root, tokeniser, entityTable, *this);
408     tokeniser.release();
409   }
410   void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
411   {
412     TokenWriter& writer = GlobalScripLibModule::getTable().m_pfnNewSimpleTokenWriter(outputStream);
413     Map_Write(root, traverse, writer, true);
414     writer.release();
415   }
416 };
417
418 typedef SingletonModule<MapHalfLifeAPI, MapDependencies> MapHalfLifeModule;
419
420 MapHalfLifeModule g_MapHalfLifeModule;
421
422
423 class MapQ2API : public TypeSystemRef, public MapFormat, public PrimitiveParser
424 {
425 public:
426   typedef MapFormat Type;
427   STRING_CONSTANT(Name, "mapq2");
428
429   MapQ2API()
430   {
431     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("quake2 maps", "*.map"));
432     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("quake2 region", "*.reg"));
433   }
434   MapFormat* getTable()
435   {
436     return this;
437   }
438   scene::Node& parsePrimitive(Tokeniser& tokeniser) const
439   {
440     const char* primitive = tokeniser.getToken();
441     if(primitive != 0)
442     {
443       if(string_equal(primitive, "("))
444       {
445         tokeniser.ungetToken(); // (
446         return GlobalBrushModule::getTable().createBrush();
447       }
448     }
449
450     Tokeniser_unexpectedError(tokeniser, primitive, "#quake2-primitive");
451     return g_nullNode;
452   }
453   void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
454   {
455     Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
456     Map_Read(root, tokeniser, entityTable, *this);
457     tokeniser.release();
458   }
459   void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
460   {
461     TokenWriter& writer = GlobalScripLibModule::getTable().m_pfnNewSimpleTokenWriter(outputStream);
462     Map_Write(root, traverse, writer, true);
463     writer.release();
464   }
465 };
466
467 typedef SingletonModule<MapQ2API, MapDependencies> MapQ2Module;
468
469 MapQ2Module g_MapQ2Module;
470
471
472
473 #define PARSE_ERROR "error parsing VMF"
474
475 inline void parseToken(Tokeniser& tokeniser, const char* token)
476 {
477   ASSERT_MESSAGE(Tokeniser_parseToken(tokeniser, token), "error parsing vmf: token not found: " << makeQuoted(token));
478 }
479
480 #include "generic/arrayrange.h"
481
482 class VMFBlock;
483 typedef ArrayConstRange<VMFBlock> VMFBlockArrayRange;
484
485
486 class VMFBlock
487 {
488 public:
489   const char* m_name;
490   VMFBlockArrayRange m_children;
491   typedef const VMFBlock Value;
492
493   VMFBlock(const char* name, VMFBlockArrayRange children = VMFBlockArrayRange(0, 0)) : m_name(name), m_children(children)
494   {
495   }
496   const char* name() const
497   {
498     return m_name;
499   }
500   typedef Value* const_iterator;
501   const_iterator begin() const
502   {
503     return m_children.first;
504   }
505   const_iterator end() const
506   {
507     return m_children.last;
508   }
509 };
510
511 const VMFBlock c_vmfNormals("normals");
512 const VMFBlock c_vmfDistances("distances");
513 const VMFBlock c_vmfOffsets("offsets");
514 const VMFBlock c_vmfOffsetNormals("offset_normals");
515 const VMFBlock c_vmfAlphas("alphas");
516 const VMFBlock c_vmfTriangleTags("triangle_tags");
517 const VMFBlock c_vmfAllowedVerts("allowed_verts");
518 const VMFBlock c_vmfDispInfoChildren[] = { c_vmfNormals, c_vmfDistances, c_vmfOffsets, c_vmfOffsetNormals, c_vmfAlphas, c_vmfTriangleTags, c_vmfAllowedVerts };
519 const VMFBlock c_vmfDispInfo("dispinfo", ARRAY_RANGE(c_vmfDispInfoChildren));
520 const VMFBlock c_vmfSideChildren[] = { c_vmfDispInfo };
521 const VMFBlock c_vmfSide("side", ARRAY_RANGE(c_vmfSideChildren));
522 const VMFBlock c_vmfEditor("editor");
523 const VMFBlock c_vmfVersionInfo("versioninfo");
524 const VMFBlock c_vmfViewSettings("viewsettings");
525 const VMFBlock c_vmfCordon("cordon");
526 const VMFBlock c_vmfGroupChildren[] = { c_vmfEditor };
527 const VMFBlock c_vmfGroup("group", ARRAY_RANGE(c_vmfGroupChildren));
528 const VMFBlock c_vmfCamera("camera");
529 const VMFBlock c_vmfCamerasChildren[] = { c_vmfCamera };
530 const VMFBlock c_vmfCameras("cameras", ARRAY_RANGE(c_vmfCamerasChildren));
531 VMFBlock c_vmfVisGroup("visgroup");
532 VMFBlock c_vmfVisGroups("visgroups", VMFBlockArrayRange(&c_vmfVisGroup, &c_vmfVisGroup+1));
533 const VMFBlock c_vmfSolidChildren[] = { c_vmfSide, c_vmfEditor };
534 const VMFBlock c_vmfSolid("solid", ARRAY_RANGE(c_vmfSolidChildren));
535 const VMFBlock c_vmfConnections("connections");
536 const VMFBlock c_vmfEntityChildren[] = { c_vmfEditor, c_vmfSolid, c_vmfGroup, c_vmfConnections };
537 const VMFBlock c_vmfEntity("entity", ARRAY_RANGE(c_vmfEntityChildren));
538 const VMFBlock c_vmfWorldChildren[] = { c_vmfEditor, c_vmfSolid, c_vmfGroup };
539 const VMFBlock c_vmfWorld("world", ARRAY_RANGE(c_vmfWorldChildren));
540 const VMFBlock c_vmfRootChildren[] = { c_vmfVersionInfo, c_vmfViewSettings, c_vmfVisGroups, c_vmfWorld, c_vmfEntity, c_vmfCameras, c_vmfCordon };
541 const VMFBlock c_vmfRoot("", ARRAY_RANGE(c_vmfRootChildren));
542
543 class VMFInit
544 {
545 public:
546   VMFInit()
547   {
548     c_vmfVisGroup.m_children = VMFBlockArrayRange(&c_vmfVisGroup, &c_vmfVisGroup+1);
549   }
550 };
551
552 VMFInit g_VMFInit;
553
554 int g_vmf_entities;
555 int g_vmf_brushes;
556
557 inline VMFBlock::const_iterator VMFBlock_find(const VMFBlock& block, const char* name)
558 {
559   for(VMFBlock::const_iterator i = block.begin(); i != block.end(); ++i)
560   {
561     if(string_equal(name, (*i).name()))
562     {
563       return i;
564     }
565   }
566   return block.end();
567 }
568
569 void VMF_parseBlock(Tokeniser& tokeniser, const VMFBlock& block)
570 {
571   for(;;)
572   {
573     const char* key = tokeniser.getToken();
574     if(key == 0 || string_equal(key, "}"))
575     {
576       tokeniser.ungetToken();
577       break;
578     }
579     CopiedString tmp(key);
580     tokeniser.nextLine();
581     const char* value = tokeniser.getToken();
582     tokeniser.nextLine();
583     if(string_equal(value, "{"))
584     {
585       VMFBlock::const_iterator i = VMFBlock_find(block, tmp.c_str());
586       ASSERT_MESSAGE(i != block.end(), "error parsing vmf block " << makeQuoted(block.name()) << ": unknown block: " << makeQuoted(tmp.c_str()));
587       if(string_equal(tmp.c_str(), "solid"))
588       {
589         ++g_vmf_brushes;
590       }
591       else if(string_equal(tmp.c_str(), "entity") || string_equal(tmp.c_str(), "world"))
592       {
593         ++g_vmf_entities;
594       }
595       VMF_parseBlock(tokeniser, *i);
596       parseToken(tokeniser, "}");
597       tokeniser.nextLine();
598     }
599     else
600     {
601       // was a pair
602     }
603   }
604 }
605
606 void VMF_Read(scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable)
607 {
608   g_vmf_entities = g_vmf_brushes = 0;
609   VMF_parseBlock(tokeniser, c_vmfRoot);
610   globalOutputStream() << g_vmf_entities << " entities\n";
611   globalOutputStream() << g_vmf_brushes << " brushes\n";
612 }
613
614 class MapVMFAPI : public TypeSystemRef, public MapFormat
615 {
616 public:
617   typedef MapFormat Type;
618   STRING_CONSTANT(Name, "mapvmf");
619
620   MapVMFAPI()
621   {
622     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("vmf maps", "*.vmf"));
623     GlobalFiletypesModule::getTable().addType(Type::Name(), Name(), filetype_t("vmf region", "*.reg"));
624   }
625   MapFormat* getTable()
626   {
627     return this;
628   }
629
630   void readGraph(scene::Node& root, TextInputStream& inputStream, EntityCreator& entityTable) const
631   {
632     Tokeniser& tokeniser = GlobalScripLibModule::getTable().m_pfnNewSimpleTokeniser(inputStream);
633     VMF_Read(root, tokeniser, entityTable);
634     tokeniser.release();
635   }
636   void writeGraph(scene::Node& root, GraphTraversalFunc traverse, TextOutputStream& outputStream) const
637   {
638   }
639 };
640
641 typedef SingletonModule<MapVMFAPI, MapDependencies> MapVMFModule;
642
643 MapVMFModule g_MapVMFModule;
644
645
646
647 extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
648 {
649   initialiseModule(server);
650
651   g_MapDoom3Module.selfRegister();
652   g_MapQuake4Module.selfRegister();
653   g_MapQ3Module.selfRegister();
654   g_MapQ1Module.selfRegister();
655   g_MapQ2Module.selfRegister();
656   g_MapHalfLifeModule.selfRegister();
657   g_MapVMFModule.selfRegister();
658 }