2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
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
28 #include "entity_entitymodel.h"
31 // =============================================================================
35 _QERFuncTable_1 g_FuncTable;
36 _QERQglTable g_QglTable;
37 _QERBrushTable __BRUSHTABLENAME;
38 _QERUndoTable __UNDOTABLENAME;
39 _EClassManagerTable __ECLASSMANAGERTABLENAME;
41 // =============================================================================
44 class CSynapseClientEntity : public CSynapseClient
48 bool RequestAPI(APIDescriptor_t *pAPI);
49 const char* GetInfo();
51 CSynapseClientEntity() { }
52 virtual ~CSynapseClientEntity() { }
56 CSynapseServer* g_pSynapseServer = NULL;
57 CSynapseClientEntity g_SynapseClient;
59 extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces (const char *version, CSynapseServer *pServer)
61 if (strcmp(version, SYNAPSE_VERSION))
63 Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);
66 g_pSynapseServer = pServer;
67 g_pSynapseServer->IncRef();
68 Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
70 g_SynapseClient.AddAPI(ENTITY_MAJOR, NULL, sizeof(_QEREntityTable));
71 g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable);
72 g_SynapseClient.AddAPI(QGL_MAJOR, NULL, sizeof(g_QglTable), SYN_REQUIRE, &g_QglTable);
73 g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(__BRUSHTABLENAME), SYN_REQUIRE, &__BRUSHTABLENAME);
74 g_SynapseClient.AddAPI(UNDO_MAJOR, NULL, sizeof(__UNDOTABLENAME), SYN_REQUIRE, &__UNDOTABLENAME);
75 g_SynapseClient.AddAPI(ECLASSMANAGER_MAJOR, NULL, sizeof(__ECLASSMANAGERTABLENAME), SYN_REQUIRE, &__ECLASSMANAGERTABLENAME);
77 return &g_SynapseClient;
80 bool CSynapseClientEntity::RequestAPI(APIDescriptor_t *pAPI)
82 if (!strcmp(pAPI->major_name, ENTITY_MAJOR))
84 _QEREntityTable* pTable= static_cast<_QEREntityTable*>(pAPI->mpTable);
85 pTable->m_pfnEntity_Alloc = &Entity_Alloc;
86 pTable->m_pfnEntity_Free = &Entity_Free;
87 pTable->m_pfnEntity_Clone = &Entity_Clone;
88 pTable->m_pfnSetKeyValue = &SetKeyValue;
89 pTable->m_pfnDeleteKey = &DeleteKey;
90 pTable->m_pfnValueForKey = &ValueForKey;
91 pTable->m_pfnFloatForKey = &FloatForKey;
92 pTable->m_pfnIntForKey = &IntForKey;
93 pTable->m_pfnGetVectorForKey = &GetVectorForKey;
94 pTable->m_pfnEntity_AddToList = &Entity_AddToList;
95 pTable->m_pfnEntity_RemoveFromList = &Entity_RemoveFromList;
96 pTable->m_pfnEntity_LinkBrush = &Entity_LinkBrush;
97 pTable->m_pfnEntity_UnlinkBrush = &Entity_UnlinkBrush;
98 pTable->m_pfnDrawLight = &DrawLight;
99 pTable->m_pfnEntity_MemorySize = &Entity_MemorySize;
100 pTable->m_pfnAllocateEpair = &Entity_AllocateEpair;
101 pTable->m_pfnGetEntityKeyValList = &Entity_GetKeyValList;
102 pTable->m_pfnSetEntityKeyValList = &Entity_SetKeyValList;
107 Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());
113 const char* CSynapseClientEntity::GetInfo()
115 return "Entity module built " __DATE__ " " RADIANT_VERSION;