2 Copyright (C) 2001-2006, William Joseph.
5 This file is part of GtkRadiant.
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.
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.
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
22 #include "patchmodule.h"
24 #include "qerplugin.h"
28 #include "patchmanip.h"
32 std::size_t g_patchModuleCount = 0;
35 void Patch_Construct(EPatchType type)
37 if(++g_patchModuleCount != 1)
42 PatchFilters_construct();
44 PatchPreferences_construct();
46 Patch_registerPreferencesPage();
48 Patch::constructStatic(type);
49 PatchInstance::constructStatic();
51 if(type == ePatchTypeDoom3)
53 MAX_PATCH_WIDTH = MAX_PATCH_HEIGHT = 99;
57 MAX_PATCH_WIDTH = MAX_PATCH_HEIGHT = 15;
63 if(--g_patchModuleCount != 0)
68 Patch::destroyStatic();
69 PatchInstance::destroyStatic();
72 class Quake3PatchCreator : public PatchCreator
75 scene::Node& createPatch()
77 return (new PatchNodeQuake3())->node();
81 Quake3PatchCreator g_Quake3PatchCreator;
83 PatchCreator& GetQuake3PatchCreator()
85 return g_Quake3PatchCreator;
88 class Doom3PatchCreator : public PatchCreator
91 scene::Node& createPatch()
93 return (new PatchNodeDoom3(true))->node();
97 Doom3PatchCreator g_Doom3PatchCreator;
99 PatchCreator& GetDoom3PatchCreator()
101 return g_Doom3PatchCreator;
104 class Doom3PatchDef2Creator : public PatchCreator
107 scene::Node& createPatch()
109 return (new PatchNodeDoom3())->node();
113 Doom3PatchDef2Creator g_Doom3PatchDef2Creator;
115 PatchCreator& GetDoom3PatchDef2Creator()
117 return g_Doom3PatchDef2Creator;
120 #include "modulesystem/singletonmodule.h"
121 #include "modulesystem/moduleregistry.h"
123 class PatchDependencies :
124 public GlobalRadiantModuleRef,
125 public GlobalSceneGraphModuleRef,
126 public GlobalShaderCacheModuleRef,
127 public GlobalSelectionModuleRef,
128 public GlobalOpenGLModuleRef,
129 public GlobalUndoModuleRef,
130 public GlobalFilterModuleRef
134 class PatchQuake3API : public TypeSystemRef
136 PatchCreator* m_patchquake3;
138 typedef PatchCreator Type;
139 STRING_CONSTANT(Name, "quake3");
143 Patch_Construct(ePatchTypeQuake3);
145 m_patchquake3 = &GetQuake3PatchCreator();
146 g_patchCreator = m_patchquake3;
152 PatchCreator* getTable()
154 return m_patchquake3;
158 typedef SingletonModule<PatchQuake3API, PatchDependencies> PatchQuake3Module;
159 typedef Static<PatchQuake3Module> StaticPatchQuake3Module;
160 StaticRegisterModule staticRegisterPatchQuake3(StaticPatchQuake3Module::instance());
164 class PatchDoom3API : public TypeSystemRef
166 PatchCreator* m_patchdoom3;
168 typedef PatchCreator Type;
169 STRING_CONSTANT(Name, "doom3");
173 Patch_Construct(ePatchTypeDoom3);
175 m_patchdoom3 = &GetDoom3PatchCreator();
181 PatchCreator* getTable()
187 typedef SingletonModule<PatchDoom3API, PatchDependencies> PatchDoom3Module;
188 typedef Static<PatchDoom3Module> StaticPatchDoom3Module;
189 StaticRegisterModule staticRegisterPatchDoom3(StaticPatchDoom3Module::instance());
192 class PatchDef2Doom3API : public TypeSystemRef
194 PatchCreator* m_patchdef2doom3;
196 typedef PatchCreator Type;
197 STRING_CONSTANT(Name, "def2doom3");
201 Patch_Construct(ePatchTypeDoom3);
203 m_patchdef2doom3 = &GetDoom3PatchDef2Creator();
204 g_patchCreator = m_patchdef2doom3;
210 PatchCreator* getTable()
212 return m_patchdef2doom3;
216 typedef SingletonModule<PatchDef2Doom3API, PatchDependencies> PatchDef2Doom3Module;
217 typedef Static<PatchDef2Doom3Module> StaticPatchDef2Doom3Module;
218 StaticRegisterModule staticRegisterPatchDef2Doom3(StaticPatchDef2Doom3Module::instance());