]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - plugins/entity/plugin.cpp
Merge pull request #47 from mrwonko/MapLoading
[xonotic/netradiant.git] / plugins / entity / plugin.cpp
index 5ff1c8a21d7d8599ee29c16a9cf8bb4c8f0295cf..41b7ed03a8382df76b75ccfc0b964e8584b49da0 100644 (file)
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-\r
-//\r
-// Model Plugin\r
-//\r
-\r
-#include "plugin.h"\r
-#include "entity.h"\r
-#include "entity_entitymodel.h"\r
-#include "light.h"\r
-\r
-// =============================================================================\r
-// Globals\r
-\r
-// function tables\r
-_QERFuncTable_1 g_FuncTable;\r
-_QERQglTable g_QglTable;\r
-_QERBrushTable __BRUSHTABLENAME;\r
-_QERUndoTable __UNDOTABLENAME;\r
-_EClassManagerTable __ECLASSMANAGERTABLENAME;\r
-\r
-// =============================================================================\r
-// SYNAPSE\r
-\r
-class CSynapseClientEntity : public CSynapseClient\r
-{\r
-public:\r
-  // CSynapseClient API\r
-  bool RequestAPI(APIDescriptor_t *pAPI);\r
-  const char* GetInfo();\r
-  \r
-  CSynapseClientEntity() { }\r
-  virtual ~CSynapseClientEntity() { }\r
-};\r
-\r
-\r
-CSynapseServer* g_pSynapseServer = NULL;\r
-CSynapseClientEntity g_SynapseClient;\r
-\r
-#if __GNUC__ >= 4\r
-#pragma GCC visibility push(default)\r
-#endif\r
-extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {\r
-#if __GNUC__ >= 4\r
-#pragma GCC visibility pop\r
-#endif\r
-  if (strcmp(version, SYNAPSE_VERSION))\r
-  {\r
-    Syn_Printf("ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version);\r
-    return NULL;\r
-  }\r
-  g_pSynapseServer = pServer;\r
-  g_pSynapseServer->IncRef();\r
-  Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());\r
-  \r
-  g_SynapseClient.AddAPI(ENTITY_MAJOR, NULL, sizeof(_QEREntityTable));\r
-  g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable);\r
-  g_SynapseClient.AddAPI(QGL_MAJOR, NULL, sizeof(g_QglTable), SYN_REQUIRE, &g_QglTable);\r
-  g_SynapseClient.AddAPI(BRUSH_MAJOR, NULL, sizeof(__BRUSHTABLENAME), SYN_REQUIRE, &__BRUSHTABLENAME);\r
-  g_SynapseClient.AddAPI(UNDO_MAJOR, NULL, sizeof(__UNDOTABLENAME), SYN_REQUIRE, &__UNDOTABLENAME);\r
-  g_SynapseClient.AddAPI(ECLASSMANAGER_MAJOR, NULL, sizeof(__ECLASSMANAGERTABLENAME), SYN_REQUIRE, &__ECLASSMANAGERTABLENAME);\r
-\r
-  return &g_SynapseClient;\r
-}\r
-\r
-bool CSynapseClientEntity::RequestAPI(APIDescriptor_t *pAPI)\r
-{\r
-  if (!strcmp(pAPI->major_name, ENTITY_MAJOR))\r
-  {\r
-    _QEREntityTable* pTable= static_cast<_QEREntityTable*>(pAPI->mpTable);\r
-    pTable->m_pfnEntity_Alloc = &Entity_Alloc;\r
-    pTable->m_pfnEntity_Free = &Entity_Free;\r
-    pTable->m_pfnEntity_Clone = &Entity_Clone;\r
-    pTable->m_pfnSetKeyValue = &SetKeyValue;\r
-    pTable->m_pfnDeleteKey = &DeleteKey;\r
-    pTable->m_pfnValueForKey = &ValueForKey;\r
-    pTable->m_pfnFloatForKey = &FloatForKey;\r
-    pTable->m_pfnIntForKey = &IntForKey;\r
-    pTable->m_pfnGetVectorForKey = &GetVectorForKey;\r
-    pTable->m_pfnEntity_AddToList = &Entity_AddToList;\r
-    pTable->m_pfnEntity_RemoveFromList = &Entity_RemoveFromList;\r
-    pTable->m_pfnEntity_LinkBrush = &Entity_LinkBrush;\r
-    pTable->m_pfnEntity_UnlinkBrush = &Entity_UnlinkBrush;\r
-    pTable->m_pfnDrawLight = &DrawLight;\r
-    pTable->m_pfnEntity_MemorySize = &Entity_MemorySize;\r
-    pTable->m_pfnAllocateEpair = &Entity_AllocateEpair;\r
-    pTable->m_pfnGetEntityKeyValList = &Entity_GetKeyValList;\r
-    pTable->m_pfnSetEntityKeyValList = &Entity_SetKeyValList;\r
-\r
-    return true;\r
-  }\r
-\r
-  Syn_Printf("ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo());\r
-  return false;\r
-}\r
-\r
-#include "version.h"\r
-\r
-const char* CSynapseClientEntity::GetInfo()\r
-{\r
-  return "Entity module built " __DATE__ " " RADIANT_VERSION;\r
-}\r
+/*
+   Copyright (C) 1999-2007 id Software, Inc. and contributors.
+   For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+   This file is part of GtkRadiant.
+
+   GtkRadiant is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   GtkRadiant is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GtkRadiant; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+//
+// Model Plugin
+//
+
+#include "plugin.h"
+#include "entity.h"
+#include "entity_entitymodel.h"
+#include "light.h"
+
+// =============================================================================
+// Globals
+
+// function tables
+_QERFuncTable_1 g_FuncTable;
+_QERQglTable g_QglTable;
+_QERBrushTable __BRUSHTABLENAME;
+_QERUndoTable __UNDOTABLENAME;
+_EClassManagerTable __ECLASSMANAGERTABLENAME;
+
+// =============================================================================
+// SYNAPSE
+
+class CSynapseClientEntity : public CSynapseClient
+{
+public:
+// CSynapseClient API
+bool RequestAPI( APIDescriptor_t *pAPI );
+const char* GetInfo();
+
+CSynapseClientEntity() { }
+virtual ~CSynapseClientEntity() { }
+};
+
+
+CSynapseServer* g_pSynapseServer = NULL;
+CSynapseClientEntity g_SynapseClient;
+
+#if __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) {
+#if __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+       if ( strcmp( version, SYNAPSE_VERSION ) ) {
+               Syn_Printf( "ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version );
+               return NULL;
+       }
+       g_pSynapseServer = pServer;
+       g_pSynapseServer->IncRef();
+       Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() );
+
+       g_SynapseClient.AddAPI( ENTITY_MAJOR, NULL, sizeof( _QEREntityTable ) );
+       g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( g_FuncTable ), SYN_REQUIRE, &g_FuncTable );
+       g_SynapseClient.AddAPI( QGL_MAJOR, NULL, sizeof( g_QglTable ), SYN_REQUIRE, &g_QglTable );
+       g_SynapseClient.AddAPI( BRUSH_MAJOR, NULL, sizeof( __BRUSHTABLENAME ), SYN_REQUIRE, &__BRUSHTABLENAME );
+       g_SynapseClient.AddAPI( UNDO_MAJOR, NULL, sizeof( __UNDOTABLENAME ), SYN_REQUIRE, &__UNDOTABLENAME );
+       g_SynapseClient.AddAPI( ECLASSMANAGER_MAJOR, NULL, sizeof( __ECLASSMANAGERTABLENAME ), SYN_REQUIRE, &__ECLASSMANAGERTABLENAME );
+
+       return &g_SynapseClient;
+}
+
+bool CSynapseClientEntity::RequestAPI( APIDescriptor_t *pAPI ){
+       if ( !strcmp( pAPI->major_name, ENTITY_MAJOR ) ) {
+               _QEREntityTable* pTable = static_cast<_QEREntityTable*>( pAPI->mpTable );
+               pTable->m_pfnEntity_Alloc = &Entity_Alloc;
+               pTable->m_pfnEntity_Free = &Entity_Free;
+               pTable->m_pfnEntity_Clone = &Entity_Clone;
+               pTable->m_pfnSetKeyValue = &SetKeyValue;
+               pTable->m_pfnDeleteKey = &DeleteKey;
+               pTable->m_pfnValueForKey = &ValueForKey;
+               pTable->m_pfnFloatForKey = &FloatForKey;
+               pTable->m_pfnIntForKey = &IntForKey;
+               pTable->m_pfnGetVectorForKey = &GetVectorForKey;
+               pTable->m_pfnEntity_AddToList = &Entity_AddToList;
+               pTable->m_pfnEntity_RemoveFromList = &Entity_RemoveFromList;
+               pTable->m_pfnEntity_LinkBrush = &Entity_LinkBrush;
+               pTable->m_pfnEntity_UnlinkBrush = &Entity_UnlinkBrush;
+               pTable->m_pfnDrawLight = &DrawLight;
+               pTable->m_pfnEntity_MemorySize = &Entity_MemorySize;
+               pTable->m_pfnAllocateEpair = &Entity_AllocateEpair;
+               pTable->m_pfnGetEntityKeyValList = &Entity_GetKeyValList;
+               pTable->m_pfnSetEntityKeyValList = &Entity_SetKeyValList;
+
+               return true;
+       }
+
+       Syn_Printf( "ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo() );
+       return false;
+}
+
+#include "version.h"
+
+const char* CSynapseClientEntity::GetInfo(){
+       return "Entity module built " __DATE__ " " RADIANT_VERSION;
+}