From 7d092b3417ba39be9bbb9f1a0aaf47e1d8eab738 Mon Sep 17 00:00:00 2001 From: jdolan Date: Sat, 5 Oct 2013 11:20:01 -0400 Subject: [PATCH 1/3] Cleanup to idTech2 surface inspector. --- plugins/surface_idtech2/surfdlg_plugin.cpp | 59 +++++++++------------- plugins/surface_idtech2/surfdlg_plugin.h | 3 ++ 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/plugins/surface_idtech2/surfdlg_plugin.cpp b/plugins/surface_idtech2/surfdlg_plugin.cpp index 52b1c4f2..241ccc8a 100644 --- a/plugins/surface_idtech2/surfdlg_plugin.cpp +++ b/plugins/surface_idtech2/surfdlg_plugin.cpp @@ -34,22 +34,6 @@ #include "synapse.h" -class CSynapseClient_SurfDLG : public CSynapseClient -{ -public: -// CSynapseClient API -bool RequestAPI( APIDescriptor_t *pAPI ); -const char* GetInfo(); -const char* GetName(); -bool OnActivate(); - -CSynapseClient_SurfDLG() { } -virtual ~CSynapseClient_SurfDLG() { } -}; - -// ============================================================================= -// SYNAPSE - _QERFuncTable_1 g_FuncTable; _QERUndoTable g_UndoTable; _QERAppSurfaceTable g_AppSurfaceTable; @@ -58,6 +42,17 @@ _QERShadersTable g_ShadersTable; _QERAppShadersTable g_AppShadersTable; _QERAppDataTable g_AppDataTable; +class CSynapseClient_SurfDLG : public CSynapseClient +{ +public: +// CSynapseClient API +bool RequestAPI( APIDescriptor_t *pAPI ); +const char* GetInfo(); + +CSynapseClient_SurfDLG() { } +virtual ~CSynapseClient_SurfDLG() { } +}; + CSynapseServer* g_pSynapseServer = NULL; CSynapseClient_SurfDLG g_SynapseClient; @@ -76,27 +71,29 @@ extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( cons g_pSynapseServer->IncRef(); Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() ); - g_SynapseClient.AddAPI( SURFACEDIALOG_MAJOR, "idtech2", sizeof( _QERPlugSurfaceTable ) ); + g_SynapseClient.AddAPI( SURFACEDIALOG_MAJOR, SURFACEDIALOG_MINOR, sizeof( _QERPlugSurfaceTable ) ); + g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable ); g_SynapseClient.AddAPI( UNDO_MAJOR, NULL, sizeof( _QERUndoTable ), SYN_REQUIRE, &g_UndoTable ); g_SynapseClient.AddAPI( APPSURFACEDIALOG_MAJOR, NULL, sizeof( _QERAppSurfaceTable ), SYN_REQUIRE, &g_AppSurfaceTable ); g_SynapseClient.AddAPI( SELECTEDFACE_MAJOR, NULL, sizeof( _QERSelectedFaceTable ), SYN_REQUIRE, &g_SelectedFaceTable ); - g_SynapseClient.AddAPI( SHADERS_MAJOR, "idtech2", sizeof( _QERShadersTable ), SYN_REQUIRE, &g_ShadersTable ); + g_SynapseClient.AddAPI( SHADERS_MAJOR, SHADERS_MINOR, sizeof( _QERShadersTable ), SYN_REQUIRE, &g_ShadersTable ); g_SynapseClient.AddAPI( APPSHADERS_MAJOR, NULL, sizeof( _QERAppShadersTable ), SYN_REQUIRE, &g_AppShadersTable ); g_SynapseClient.AddAPI( DATA_MAJOR, NULL, sizeof( _QERAppDataTable ), SYN_REQUIRE, &g_AppDataTable ); return &g_SynapseClient; } -bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){ +bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ) { + if ( !strcmp( pAPI->major_name, SURFACEDIALOG_MAJOR ) ) { - _QERPlugSurfaceTable* pSurfDialogTable = static_cast<_QERPlugSurfaceTable*>( pAPI->mpTable ); - if ( !strcmp( pAPI->minor_name, "idtech2" ) ) { - pSurfDialogTable->m_pfnToggleSurface = &ToggleSurface; - pSurfDialogTable->m_pfnDoSurface = &DoSurface; - pSurfDialogTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog; - pSurfDialogTable->m_pfnSurfaceDlgFitAll = &SurfaceDlgFitAll; - pSurfDialogTable->m_pfnGet_SI_Module_Widget = &Get_SI_Module_Widget; + if ( !strcmp( pAPI->minor_name, SURFACEDIALOG_MINOR ) ) { + _QERPlugSurfaceTable* pSurfaceTable = static_cast<_QERPlugSurfaceTable*>( pAPI->mpTable ); + pSurfaceTable->m_pfnToggleSurface = &ToggleSurface; + pSurfaceTable->m_pfnDoSurface = &DoSurface; + pSurfaceTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog; + pSurfaceTable->m_pfnSurfaceDlgFitAll = &SurfaceDlgFitAll; + pSurfaceTable->m_pfnGet_SI_Module_Widget = &Get_SI_Module_Widget; return true; } } @@ -107,14 +104,6 @@ bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){ #include "version.h" -const char* CSynapseClient_SurfDLG::GetInfo(){ +const char *CSynapseClient_SurfDLG::GetInfo(){ return "Surface Dialog (idTech2) module built " __DATE__ " " RADIANT_VERSION; } - -const char* CSynapseClient_SurfDLG::GetName(){ - return "surface"; -} - -bool CSynapseClient_SurfDLG::OnActivate(){ - return true; -} diff --git a/plugins/surface_idtech2/surfdlg_plugin.h b/plugins/surface_idtech2/surfdlg_plugin.h index 6f65af77..03ddc6fe 100644 --- a/plugins/surface_idtech2/surfdlg_plugin.h +++ b/plugins/surface_idtech2/surfdlg_plugin.h @@ -50,6 +50,9 @@ typedef char* LPCSTR; #include "isurfaceplugin.h" +#define SURFACEDIALOG_MINOR "idtech2" +#define SHADERS_MINOR "idtech2" + class SurfaceDialog : public IPluginTexdef { int refCount; From 7c0ca95b7bcef176a59fc960d2c4f64252b5c112 Mon Sep 17 00:00:00 2001 From: jdolan Date: Sat, 5 Oct 2013 11:20:49 -0400 Subject: [PATCH 2/3] Use executables path for launching engine. This is defaulted to engine path for most games, but adjusted for those which have their binaries in a different directory (e.g. Quake2World). --- radiant/watchbsp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radiant/watchbsp.cpp b/radiant/watchbsp.cpp index 29ce371e..be00d899 100644 --- a/radiant/watchbsp.cpp +++ b/radiant/watchbsp.cpp @@ -461,7 +461,7 @@ void CWatchBSP::RoutineProcessing(){ Sys_Printf( "Running engine...\n" ); Str cmd; // build the command line - cmd = g_pGameDescription->mEnginePath.GetBuffer(); + cmd = g_pGameDescription->mExecutablesPath.GetBuffer(); // this is game dependant if ( !strcmp( ValueForKey( g_qeglobals.d_project_entity, "gamemode" ),"mp" ) ) { // MP @@ -479,7 +479,7 @@ void CWatchBSP::RoutineProcessing(){ #endif Str cmdline; if ( g_pGameDescription->quake2 ) { - cmdline = ". +exec radiant.cfg +map "; + cmdline = "+exec radiant.cfg +map "; cmdline += m_sBSPName; } else From 5101b5b0aa0747130c01b89a38f81054d9a674a2 Mon Sep 17 00:00:00 2001 From: jdolan Date: Sat, 5 Oct 2013 11:21:44 -0400 Subject: [PATCH 3/3] Setup engine, enginepath, executablespath and prefix more thoroughly for q2w.game. --- radiant/preferences.cpp | 27 ++++++++++++++++++--------- radiant/qe3.cpp | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 6a0b7c7d..0a10eccb 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -3023,13 +3023,6 @@ void PrefsDlg::LoadPrefs(){ // Texture subset on by default (HL specific really, because of halflife.wad's size) mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, TRUE ); } - else if ( g_pGameDescription->quake2 ) { - // BSP monitoring is implemented in Quake2 and Heretic2 tools - mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, TRUE ); - - // Texture subset on by default (HL specific really, because of halflife.wad's size) - mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, TRUE ); - } else { mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, WATCHBSP_DEF ); @@ -3622,6 +3615,7 @@ void CGameInstall::Run() { switch ( m_availGames[ m_nComboSelect ] ) { case GAME_Q2: { + fprintf( fg, " quake2=\"true\"\n" ); fprintf( fg, " prefix=\".quake2\"\n" ); fprintf( fg, " basegame=\"baseq2\"\n" ); fprintf( fg, " no_patch=\"true\"\n" ); @@ -3654,8 +3648,23 @@ void CGameInstall::Run() { break; } case GAME_Q2W: { - fprintf( fg, " prefix=\".quake2world\"\n" ); - fprintf( fg, " prefix_win32=\"Quake2World\"\n"); +#ifdef __APPLE__ + fprintf( fg, " " ENGINE_ATTRIBUTE "=\"quake2world\"\n" ); + fprintf( fg, " " ENGINEPATH_ATTRIBUTE "=\"/Applications/Quake2World.app/Contents/Resources\"\n" ); + fprintf( fg, " " EXECUTABLES_ATTRIBUTE "=\"/Applications/Quake2World.app/Contents/MacOS\"\n" ); + fprintf( fg, " " PREFIX_ATTRIBUTE "=\".quake2world\"\n" ); +#elif __linux__ + fprintf( fg, " " ENGINE_ATTRIBUTE "=\"quake2world\"\n" ); + fprintf( fg, " " ENGINEPATH_ATTRIBUTE "=\"/usr/local/games/quake2world/share\"\n" ); + fprintf( fg, " " EXECUTABLES_ATTRIBUTE "=\"/usr/local/games/quake2world/bin\"\n" ); + fprintf( fg, " " PREFIX_ATTRIBUTE "=\".quake2world\"\n" ); +#elif _WIN32 + fprintf( fg, " " ENGINE_ATTRIBUTE "=\"quake2world.exe\"\n" ); + fprintf( fg, " " ENGINEPATH_ATTRIBUTE "=\"C:\\Program Files\\Quake2World\\share\"\n" ); + fprintf( fg, " " EXECUTABLES_ATTRIBUTE "=\"C:\\Program Files\\Quake2World\\bin\"\n" ); + fprintf( fg, " " PREFIX_ATTRIBUTE "=\"Quake2World\"\n" ); +#endif + fprintf( fg, " quake2=\"true\"\n" ); fprintf( fg, " basegame=\"default\"\n" ); fprintf( fg, " no_patch=\"true\"\n" ); fprintf( fg, " default_scale=\"0.25\"\n" ); diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index 1d73a05d..358d3939 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -436,7 +436,7 @@ xmlDocPtr ParseXMLFile( const char* filename, bool validate = false ){ // copy a string r to a buffer w // replace $string as appropriate -void ReplaceTemplates( char* w, const char* r ){ +static void ReplaceTemplates( char* w, const char* r ){ const char *p; const char *__ENGINEPATH = "TEMPLATEenginepath"; const char *__USERHOMEPATH = "TEMPLATEuserhomepath";