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
28 #include "entity_entitymodel.h"
\r
31 // =============================================================================
\r
35 _QERFuncTable_1 g_FuncTable;
\r
36 _QERQglTable g_QglTable;
\r
37 _QERBrushTable __BRUSHTABLENAME;
\r
38 _QERUndoTable __UNDOTABLENAME;
\r
39 _EClassManagerTable __ECLASSMANAGERTABLENAME;
\r
41 // =============================================================================
\r
44 class CSynapseClientEntity : public CSynapseClient
\r
47 // CSynapseClient API
\r
48 bool RequestAPI(APIDescriptor_t *pAPI);
\r
49 const char* GetInfo();
\r
51 CSynapseClientEntity() { }
\r
52 virtual ~CSynapseClientEntity() { }
\r
56 CSynapseServer* g_pSynapseServer = NULL;
\r
57 CSynapseClientEntity g_SynapseClient;
\r
60 #pragma GCC visibility push(default)
\r
62 extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
\r
64 #pragma GCC visibility pop
\r
66 if (strcmp(version, SYNAPSE_VERSION))
\r
68 Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);
\r
71 g_pSynapseServer = pServer;
\r
72 g_pSynapseServer->IncRef();
\r
73 Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
\r
75 g_SynapseClient.AddAPI(ENTITY_MAJOR, NULL, sizeof(_QEREntityTable));
\r
76 g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable);
\r
77 g_SynapseClient.AddAPI(QGL_MAJOR, NULL, sizeof(g_QglTable), SYN_REQUIRE, &g_QglTable);
\r
78 g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(__BRUSHTABLENAME), SYN_REQUIRE, &__BRUSHTABLENAME);
\r
79 g_SynapseClient.AddAPI(UNDO_MAJOR, NULL, sizeof(__UNDOTABLENAME), SYN_REQUIRE, &__UNDOTABLENAME);
\r
80 g_SynapseClient.AddAPI(ECLASSMANAGER_MAJOR, NULL, sizeof(__ECLASSMANAGERTABLENAME), SYN_REQUIRE, &__ECLASSMANAGERTABLENAME);
\r
82 return &g_SynapseClient;
\r
85 bool CSynapseClientEntity::RequestAPI(APIDescriptor_t *pAPI)
\r
87 if (!strcmp(pAPI->major_name, ENTITY_MAJOR))
\r
89 _QEREntityTable* pTable= static_cast<_QEREntityTable*>(pAPI->mpTable);
\r
90 pTable->m_pfnEntity_Alloc = &Entity_Alloc;
\r
91 pTable->m_pfnEntity_Free = &Entity_Free;
\r
92 pTable->m_pfnEntity_Clone = &Entity_Clone;
\r
93 pTable->m_pfnSetKeyValue = &SetKeyValue;
\r
94 pTable->m_pfnDeleteKey = &DeleteKey;
\r
95 pTable->m_pfnValueForKey = &ValueForKey;
\r
96 pTable->m_pfnFloatForKey = &FloatForKey;
\r
97 pTable->m_pfnIntForKey = &IntForKey;
\r
98 pTable->m_pfnGetVectorForKey = &GetVectorForKey;
\r
99 pTable->m_pfnEntity_AddToList = &Entity_AddToList;
\r
100 pTable->m_pfnEntity_RemoveFromList = &Entity_RemoveFromList;
\r
101 pTable->m_pfnEntity_LinkBrush = &Entity_LinkBrush;
\r
102 pTable->m_pfnEntity_UnlinkBrush = &Entity_UnlinkBrush;
\r
103 pTable->m_pfnDrawLight = &DrawLight;
\r
104 pTable->m_pfnEntity_MemorySize = &Entity_MemorySize;
\r
105 pTable->m_pfnAllocateEpair = &Entity_AllocateEpair;
\r
106 pTable->m_pfnGetEntityKeyValList = &Entity_GetKeyValList;
\r
107 pTable->m_pfnSetEntityKeyValList = &Entity_SetKeyValList;
\r
112 Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());
\r
116 #include "version.h"
\r
118 const char* CSynapseClientEntity::GetInfo()
\r
120 return "Entity module built " __DATE__ " " RADIANT_VERSION;
\r