| 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 | |
| 60 | class EntityQ3API : public TypeSystemRef |
| 61 | { |
| 62 | EntityCreator* m_entityq3; |
| 63 | public: |
| 64 | typedef EntityCreator Type; |
| 65 | STRING_CONSTANT( Name, "quake3" ); |
| 66 | |
| 67 | EntityQ3API(){ |
| 68 | Entity_Construct(); |
| 69 | |
| 70 | m_entityq3 = &GetEntityCreator(); |
| 71 | |
| 72 | GlobalReferenceCache().setEntityCreator( *m_entityq3 ); |
| 73 | } |
| 74 | ~EntityQ3API(){ |
| 75 | Entity_Destroy(); |
| 76 | } |
| 77 | EntityCreator* getTable(){ |
| 78 | return m_entityq3; |
| 79 | } |
| 80 | }; |
| 81 | |
| 82 | typedef SingletonModule<EntityQ3API, EntityDependencies> EntityQ3Module; |
| 83 | |
| 84 | EntityQ3Module g_EntityQ3Module; |
| 85 | |
| 86 | |
| 87 | class EntityWolfAPI : public TypeSystemRef |
| 88 | { |
| 89 | EntityCreator* m_entitywolf; |
| 90 | public: |
| 91 | typedef EntityCreator Type; |
| 92 | STRING_CONSTANT( Name, "wolf" ); |
| 93 | |
| 94 | EntityWolfAPI(){ |
| 95 | Entity_Construct( eGameTypeRTCW ); |
| 96 | |
| 97 | m_entitywolf = &GetEntityCreator(); |
| 98 | |
| 99 | GlobalReferenceCache().setEntityCreator( *m_entitywolf ); |
| 100 | } |
| 101 | ~EntityWolfAPI(){ |
| 102 | Entity_Destroy(); |
| 103 | } |
| 104 | EntityCreator* getTable(){ |
| 105 | return m_entitywolf; |
| 106 | } |
| 107 | }; |
| 108 | |
| 109 | typedef SingletonModule<EntityWolfAPI, EntityDependencies> EntityWolfModule; |
| 110 | |
| 111 | EntityWolfModule g_EntityWolfModule; |
| 112 | |
| 113 | |
| 114 | class EntityDoom3API : public TypeSystemRef |
| 115 | { |
| 116 | EntityCreator* m_entitydoom3; |
| 117 | public: |
| 118 | typedef EntityCreator Type; |
| 119 | STRING_CONSTANT( Name, "doom3" ); |
| 120 | |
| 121 | EntityDoom3API(){ |
| 122 | Entity_Construct( eGameTypeDoom3 ); |
| 123 | |
| 124 | m_entitydoom3 = &GetEntityCreator(); |
| 125 | |
| 126 | GlobalReferenceCache().setEntityCreator( *m_entitydoom3 ); |
| 127 | } |
| 128 | ~EntityDoom3API(){ |
| 129 | Entity_Destroy(); |
| 130 | } |
| 131 | EntityCreator* getTable(){ |
| 132 | return m_entitydoom3; |
| 133 | } |
| 134 | }; |
| 135 | |
| 136 | typedef SingletonModule<EntityDoom3API, EntityDependencies> EntityDoom3Module; |
| 137 | |
| 138 | EntityDoom3Module g_EntityDoom3Module; |
| 139 | |
| 140 | |
| 141 | extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){ |
| 142 | initialiseModule( server ); |
| 143 | |
| 144 | g_EntityQ3Module.selfRegister(); |
| 145 | g_EntityWolfModule.selfRegister(); |
| 146 | g_EntityDoom3Module.selfRegister(); |
| 147 | Doom3ModelSkinCacheModule_selfRegister( server ); |
| 148 | } |