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;
60 #pragma GCC visibility push(default)
62 extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
64 #pragma GCC visibility pop
66 if ( strcmp( version, SYNAPSE_VERSION ) ) {
67 Syn_Printf( "ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version );
70 g_pSynapseServer = pServer;
71 g_pSynapseServer->IncRef();
72 Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() );
74 g_SynapseClient.AddAPI( ENTITY_MAJOR, NULL, sizeof( _QEREntityTable ) );
75 g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( g_FuncTable ), SYN_REQUIRE, &g_FuncTable );
76 g_SynapseClient.AddAPI( QGL_MAJOR, NULL, sizeof( g_QglTable ), SYN_REQUIRE, &g_QglTable );
77 g_SynapseClient.AddAPI( BRUSH_MAJOR, NULL, sizeof( __BRUSHTABLENAME ), SYN_REQUIRE, &__BRUSHTABLENAME );
78 g_SynapseClient.AddAPI( UNDO_MAJOR, NULL, sizeof( __UNDOTABLENAME ), SYN_REQUIRE, &__UNDOTABLENAME );
79 g_SynapseClient.AddAPI( ECLASSMANAGER_MAJOR, NULL, sizeof( __ECLASSMANAGERTABLENAME ), SYN_REQUIRE, &__ECLASSMANAGERTABLENAME );
81 return &g_SynapseClient;
84 bool CSynapseClientEntity::RequestAPI( APIDescriptor_t *pAPI ){
85 if ( !strcmp( pAPI->major_name, ENTITY_MAJOR ) ) {
86 _QEREntityTable* pTable = static_cast<_QEREntityTable*>( pAPI->mpTable );
87 pTable->m_pfnEntity_Alloc = &Entity_Alloc;
88 pTable->m_pfnEntity_Free = &Entity_Free;
89 pTable->m_pfnEntity_Clone = &Entity_Clone;
90 pTable->m_pfnSetKeyValue = &SetKeyValue;
91 pTable->m_pfnDeleteKey = &DeleteKey;
92 pTable->m_pfnValueForKey = &ValueForKey;
93 pTable->m_pfnFloatForKey = &FloatForKey;
94 pTable->m_pfnIntForKey = &IntForKey;
95 pTable->m_pfnGetVectorForKey = &GetVectorForKey;
96 pTable->m_pfnEntity_AddToList = &Entity_AddToList;
97 pTable->m_pfnEntity_RemoveFromList = &Entity_RemoveFromList;
98 pTable->m_pfnEntity_LinkBrush = &Entity_LinkBrush;
99 pTable->m_pfnEntity_UnlinkBrush = &Entity_UnlinkBrush;
100 pTable->m_pfnDrawLight = &DrawLight;
101 pTable->m_pfnEntity_MemorySize = &Entity_MemorySize;
102 pTable->m_pfnAllocateEpair = &Entity_AllocateEpair;
103 pTable->m_pfnGetEntityKeyValList = &Entity_GetKeyValList;
104 pTable->m_pfnSetEntityKeyValList = &Entity_SetKeyValList;
109 Syn_Printf( "ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo() );
115 const char* CSynapseClientEntity::GetInfo(){
116 return "Entity module built " __DATE__ " " RADIANT_VERSION;