2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
24 // =============================================================================
\r
28 _QERFuncTable_1 g_FuncTable;
\r
29 _QERScripLibTable g_ScripLibTable;
\r
30 _QERShadersTable g_ShadersTable;
\r
31 _QEREntityTable __ENTITYTABLENAME;
\r
32 _QERBrushTable g_BrushTable;
\r
33 _QERPatchTable g_PatchTable;
\r
34 _QERFileSystemTable g_FileSystemTable;
\r
36 the map version we have been initialized with: Q1/Q2/Q3
\r
37 we provide all three formats in the same module
\r
41 // =============================================================================
\r
44 CSynapseServer* g_pSynapseServer = NULL;
\r
45 CSynapseClientMap g_SynapseClient;
\r
47 static const XMLConfigEntry_t entries[] =
\r
49 { SHADERS_MAJOR, SYN_REQUIRE, sizeof(g_ShadersTable), &g_ShadersTable },
\r
50 { NULL, SYN_UNKNOWN, 0, NULL } };
\r
52 extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const char *version, CSynapseServer *pServer)
\r
54 if (strcmp(version, SYNAPSE_VERSION))
\r
56 Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);
\r
59 g_pSynapseServer = pServer;
\r
60 g_pSynapseServer->IncRef();
\r
61 Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
\r
63 g_SynapseClient.AddAPI(MAP_MAJOR, "mapq3", sizeof(_QERPlugMapTable));
\r
64 g_SynapseClient.AddAPI(MAP_MAJOR, "maphl", sizeof(_QERPlugMapTable));
\r
65 g_SynapseClient.AddAPI(MAP_MAJOR, "mapq2", sizeof(_QERPlugMapTable));
\r
66 g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable);
\r
67 g_SynapseClient.AddAPI(SCRIPLIB_MAJOR, NULL, sizeof(g_ScripLibTable), SYN_REQUIRE, &g_ScripLibTable);
\r
69 // same trick as bobtoolz, see bug #828
\r
70 g_SynapseClient.AddAPI( VFS_MAJOR, "*", sizeof(g_FileSystemTable), SYN_REQUIRE, &g_FileSystemTable );
\r
72 if ( !g_SynapseClient.ConfigXML( pServer, NULL, entries ) ) {
\r
76 g_SynapseClient.AddAPI(ENTITY_MAJOR, NULL, sizeof(__ENTITYTABLENAME), SYN_REQUIRE, &__ENTITYTABLENAME);
\r
77 g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(g_BrushTable), SYN_REQUIRE, &g_BrushTable);
\r
78 g_SynapseClient.AddAPI(PATCH_MAJOR, NULL, sizeof(g_PatchTable), SYN_REQUIRE, &g_PatchTable);
\r
80 return &g_SynapseClient;
\r
83 bool CSynapseClientMap::RequestAPI(APIDescriptor_t *pAPI)
\r
85 if (!strcmp(pAPI->major_name, MAP_MAJOR))
\r
87 _QERPlugMapTable* pTable= static_cast<_QERPlugMapTable*>(pAPI->mpTable);
\r
88 if (!strcmp(pAPI->minor_name, "mapq3"))
\r
90 pTable->m_pfnMap_Read = &Map_ReadQ3;
\r
91 pTable->m_pfnMap_Write = &Map_WriteQ3;
\r
94 if (!strcmp(pAPI->minor_name, "maphl"))
\r
96 pTable->m_pfnMap_Read = &Map_ReadHL;
\r
97 pTable->m_pfnMap_Write = &Map_WriteHL;
\r
101 if (!strcmp(pAPI->minor_name, "mapq2"))
\r
103 pTable->m_pfnMap_Read = &Map_ReadQ2;
\r
104 pTable->m_pfnMap_Write = &Map_WriteQ2;
\r
107 Syn_Printf("ERROR: RequestAPI( Major: '%s' Minor: '%s' ) not found in '%s'\n", pAPI->major_name, pAPI->minor_name, GetInfo());
\r
111 Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());
\r
115 bool CSynapseClientMap::OnActivate() {
\r
119 #include "version.h"
\r
121 const char* CSynapseClientMap::GetInfo()
\r
123 return "MAP format module built " __DATE__ " " RADIANT_VERSION;
\r
126 const char* CSynapseClientMap::GetName()
\r