#include "version.h"
CRadiantImageManager g_ImageManager;
-CRadiantPluginManager g_PluginsManager;
+CRadiantPluginManager g_PluginsManager;
_QERPlugSurfaceTable g_SurfaceTable;
_QERFileSystemTable g_FileSystemTable;
GetFileTypeRegistry()->addType(MAP_MAJOR, g_pattern_mapq3);
GetFileTypeRegistry()->addType(MAP_MAJOR, g_pattern_mapxml);
-
+
GetFileTypeRegistry()->addType("region", g_pattern_regq3);
/*
GetFileTypeRegistry()->addType(MODEL_MAJOR, g_pattern_modelmd3);
return &elem->m_model;
}
}
-
+
elem = new CModelWrapper(id, version);
g_ptr_array_add(m_ptrs, elem);
}
mAPIs.clear();
}
-
+
// CSynapseAPIManager interface -------------------
APIDescriptor_t* BuildRequireAPI(APIDescriptor_t* pAPI)
{
for(i=mAPIs.begin(); i!=mAPIs.end(); i++)
AddItem((_QERPlugToolbarTable*)(*i)->mpTable);
}
-
+
private:
void AddItem(_QERPlugToolbarTable* pTable)
}
return;
}
-
+
// start walking the interfaces
list<CImageTableSlot *>::iterator iSlot;
for(iSlot = mSlots.begin(); iSlot != mSlots.end(); iSlot++)
/* plugin manager --------------------------------------- */
APIDescriptor_t* CRadiantPluginManager::BuildRequireAPI(APIDescriptor_t *pAPI)
-{
+{
CPluginSlot *pSlot = new CPluginSlot(pAPI);
mSlots.push_front(pSlot);
return pSlot->GetDescriptor();
}
else if (strcmp(type,"xmap")==0)
{
- g_MapTable2.m_pfnMap_Read(in, ents);
+ g_MapTable2.m_pfnMap_Read(in, ents);
}
else
Sys_FPrintf(SYS_WRN, "WARNING: no module found for map interface type '%s'\n", type);
}
CPluginSlot::~CPluginSlot()
-{
+{
delete mpAPI;
delete mpTable;
while (m_CommandStrings)
{
if (!m_bReady)
Init();
- return g_slist_length (m_CommandStrings);
+ return g_slist_length (m_CommandStrings);
}
-
+
const char* CPluginSlot::getCommand(int n)
{
if (!m_bReady)
Init();
- return (char*)g_slist_nth_data (m_CommandStrings, n);
+ return (char*)g_slist_nth_data (m_CommandStrings, n);
}
void CPluginSlot::addMenuID(int n)
path += g_strModulesDir;
// SYNAPSE
g_pParentWnd->GetSynapseServer().AddSearchPath(path);
- }
+ }
}
-static const XMLConfigEntry_t manager_entries[] =
- {
+static const XMLConfigEntry_t manager_entries[] =
+ {
{ VFS_MAJOR, SYN_REQUIRE, sizeof(g_FileSystemTable), &g_FileSystemTable },
{ SHADERS_MAJOR, SYN_REQUIRE, sizeof(g_ShadersTable), &g_ShadersTable },
{ MAP_MAJOR, SYN_REQUIRE, sizeof(g_MapTable), &g_MapTable },
void CPlugInManager::Init()
{
Str synapse_config;
-
+
Cleanup();
-
+
// set some globals
g_qeglobals.bBSPFrontendPlugin = false;
synapse_config += "synapse.config";
if (!g_pParentWnd->GetSynapseServer().Initialize(synapse_config.GetBuffer(), &Sys_Printf_VA))
Error("Synpase server initialization failed (see console)\n");
-
+
// builtin modules
g_pParentWnd->GetSynapseServer().EnumerateBuiltinModule(&eclass_def);
-
+
// APIs we provide
g_pParentWnd->GetSynapseClient().AddAPI(RADIANT_MAJOR, NULL, sizeof(_QERFuncTable_1));
g_pParentWnd->GetSynapseClient().AddAPI(SCRIPLIB_MAJOR, NULL, sizeof(_QERScripLibTable));
g_pParentWnd->GetSynapseClient().AddAPI(SELECTEDFACE_MAJOR, NULL, sizeof(_QERSelectedFaceTable));
g_pParentWnd->GetSynapseClient().AddAPI(APPSURFACEDIALOG_MAJOR, NULL, sizeof(_QERAppSurfaceTable));
g_pParentWnd->GetSynapseClient().AddAPI(UNDO_MAJOR, NULL, sizeof(_QERUndoTable));
- g_pParentWnd->GetSynapseClient().AddAPI(UI_MAJOR, NULL, sizeof(_QERUITable));
- g_pParentWnd->GetSynapseClient().AddAPI(UIGTK_MAJOR, NULL, sizeof(_QERUIGtkTable));
- g_pParentWnd->GetSynapseClient().AddAPI(CAMERA_MAJOR, NULL, sizeof(_QERCameraTable));
-
+ g_pParentWnd->GetSynapseClient().AddAPI(UI_MAJOR, NULL, sizeof(_QERUITable));
+ g_pParentWnd->GetSynapseClient().AddAPI(UIGTK_MAJOR, NULL, sizeof(_QERUIGtkTable));
+ g_pParentWnd->GetSynapseClient().AddAPI(CAMERA_MAJOR, NULL, sizeof(_QERCameraTable));
+
// modules configured by XML
if ( !g_pParentWnd->GetSynapseClient().ConfigXML( &g_pParentWnd->GetSynapseServer(), "core", manager_entries ) ) {
Error("Synapse server initialization failed (see console)\n");
}
-
+
// adding a manager is a special case that ConfigXML doesn't take care of
g_pParentWnd->GetSynapseServer().SelectClientConfig( "core" );
char *minor;
}
g_ImageManager.SetMatchAPI( IMAGE_MAJOR, minor );
g_pParentWnd->GetSynapseClient().AddManager( &g_ImageManager );
-
+
// SYN_REQUIRE entries which are still hardcoded
g_pParentWnd->GetSynapseClient().AddAPI(MAP_MAJOR, "mapxml", sizeof(g_MapTable2), SYN_REQUIRE, &g_MapTable2);
g_pParentWnd->GetSynapseClient().AddAPI(ENTITY_MAJOR, NULL, sizeof(g_EntityTable), SYN_REQUIRE, &g_EntityTable);
-
+
// plugins: load anything that claims to be a plugin
// minor becomes some kind of matching pattern
// g_PluginsManager is an API any class, it receives several function tables as needed
void CPlugInManager::CommitBrushHandleToMap(void * vp)
{
- g_bScreenUpdates = false;
+ g_bScreenUpdates = false;
for (int i = 0; i < m_BrushHandles.GetSize(); i++)
{
brush_t *pb = reinterpret_cast<brush_t*>(m_BrushHandles.GetAt(i));
Select_Brush(pb);
}
}
- g_bScreenUpdates = true;
+ g_bScreenUpdates = true;
Sys_UpdateWindows(W_ALL);
}
VectorCopy( origin, g_pParentWnd->GetCamWnd()->Camera()->origin );
VectorCopy( angles, g_pParentWnd->GetCamWnd()->Camera()->angles );
- Sys_UpdateWindows( W_ALL ); // specify
+ Sys_UpdateWindows( W_ALL ); // specify
g_pParentWnd->OnTimer();
}
return static_cast<void*>(pe);
}
-epair_t* WINAPI QERApp_AllocateEpair( char *key, char *val )
+epair_t* WINAPI QERApp_AllocateEpair( const char *key, const char *val )
{
epair_t *e = (epair_t*)qmalloc (sizeof(*e));
e->key = (char*)qmalloc(strlen(key)+1);
return pEp;
}
-IEpair* WINAPI QERApp_IEpairForProjectKeys()
+IEpair* WINAPI QERApp_IEpairForProjectKeys()
{
CEpairsWrapper *pEp = new CEpairsWrapper(g_qeglobals.d_project_entity);
pEp->IncRef();
void WINAPI QERApp_SetScreenUpdate(int bScreenUpdates)
{
- g_bScreenUpdates = bScreenUpdates;
+ g_bScreenUpdates = bScreenUpdates;
}
texturewin_t* QERApp_QeglobalsTexturewin()
gettimeofday(&tp, &tzp);
if (!basetime)
basetime = tp.tv_sec;
- return (tp.tv_sec-basetime) + tp.tv_usec/1000;
+ return (tp.tv_sec-basetime) + tp.tv_usec/1000;
#endif
}
pShadersTable->m_pfnTexture_ShowInuse = Texture_ShowInuse;
pShadersTable->m_pfnBuildShaderList = &BuildShaderList;
pShadersTable->m_pfnPreloadShaders = &PreloadShaders;
-
+
return true;
}
if (!strcmp(pAPI->major_name, QGL_MAJOR))
pQglTable->m_pfn_qglDeleteTextures = qglDeleteTextures;
pQglTable->m_pfn_qglDrawElements = qglDrawElements;
pQglTable->m_pfn_qglEnable = qglEnable;
- pQglTable->m_pfn_qglEnableClientState = qglEnableClientState;
+ pQglTable->m_pfn_qglEnableClientState = qglEnableClientState;
pQglTable->m_pfn_qglEnd = qglEnd;
pQglTable->m_pfn_qglEndList = qglEndList;
pQglTable->m_pfn_qglFogf = qglFogf;
pDataTable->m_pfnSelectedBrushes = QERApp_SelectedBrushes;
pDataTable->m_pfnFilteredBrushes = QERApp_FilteredBrushes;
pDataTable->m_pfnLstSkinCache = QERApp_LstSkinCache;
-
+
return true;
}
if (!strcmp(pAPI->major_name, PATCH_MAJOR))
pPatchTable->m_pfnPatch_Alloc = &Patch_Alloc;
pPatchTable->m_pfnAddBrushForPatch = &AddBrushForPatch;
pPatchTable->m_pfnMakeNewPatch = &MakeNewPatch;
-
+
return true;
}
if (!strcmp(pAPI->major_name, ECLASSMANAGER_MAJOR))
{
_EClassManagerTable *pEClassManTable = static_cast<_EClassManagerTable *>(pAPI->mpTable);
-
+
pEClassManTable->m_pfnEclass_InsertAlphabetized = &Eclass_InsertAlphabetized;
pEClassManTable->m_pfnGet_Eclass_E = &Get_EClass_E;
pEClassManTable->m_pfnSet_Eclass_Found = &Set_Eclass_Found;
pEClassManTable->m_pfnGet_Parsing_Single = &Get_Parsing_Single;
pEClassManTable->m_pfnEClass_Create = &EClass_Create;
pEClassManTable->m_pfnEclass_ForName = &Eclass_ForName;
-
+
return true;
}
if (!strcmp(pAPI->major_name, SELECTEDFACE_MAJOR))
- {
+ {
_QERSelectedFaceTable *pSelectedFaceTable = static_cast<_QERSelectedFaceTable *>(pAPI->mpTable);
pSelectedFaceTable->m_pfnGetSelectedFaceCount = &QERApp_GetSelectedFaceCount;
return true;
}
if (!strcmp(pAPI->major_name, UNDO_MAJOR))
- {
+ {
_QERUndoTable *pUndoTable = static_cast<_QERUndoTable *>(pAPI->mpTable);
pUndoTable->m_pfnUndo_Start = &Undo_Start;
return true;
}
if (!strcmp(pAPI->major_name, UI_MAJOR))
- {
+ {
_QERUITable *pUITable = static_cast<_QERUITable *>(pAPI->mpTable);
pUITable->m_pfnCreateGLWindow = QERApp_CreateGLWindow;
return true;
}
if (!strcmp(pAPI->major_name, UIGTK_MAJOR))
- {
+ {
_QERUIGtkTable *pUIGtkTable = static_cast<_QERUIGtkTable *>(pAPI->mpTable);
pUIGtkTable->m_pfn_GetQeglobalsGLWidget = &QERApp_GetQeGlobalsGLWidget;