Merge pull request #238 from jdolan/master

Restore quake2 game description flag as idTech2 flag, fix launching legacy games.
This commit is contained in:
Timothee "TTimo" Besset 2013-10-05 12:26:47 -07:00
commit 9c75082063
6 changed files with 54 additions and 44 deletions

View file

@ -34,22 +34,6 @@
#include "synapse.h" #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; _QERFuncTable_1 g_FuncTable;
_QERUndoTable g_UndoTable; _QERUndoTable g_UndoTable;
_QERAppSurfaceTable g_AppSurfaceTable; _QERAppSurfaceTable g_AppSurfaceTable;
@ -58,6 +42,17 @@ _QERShadersTable g_ShadersTable;
_QERAppShadersTable g_AppShadersTable; _QERAppShadersTable g_AppShadersTable;
_QERAppDataTable g_AppDataTable; _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; CSynapseServer* g_pSynapseServer = NULL;
CSynapseClient_SurfDLG g_SynapseClient; CSynapseClient_SurfDLG g_SynapseClient;
@ -76,27 +71,29 @@ extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( cons
g_pSynapseServer->IncRef(); g_pSynapseServer->IncRef();
Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() ); 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( 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( UNDO_MAJOR, NULL, sizeof( _QERUndoTable ), SYN_REQUIRE, &g_UndoTable );
g_SynapseClient.AddAPI( APPSURFACEDIALOG_MAJOR, NULL, sizeof( _QERAppSurfaceTable ), SYN_REQUIRE, &g_AppSurfaceTable ); 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( 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( APPSHADERS_MAJOR, NULL, sizeof( _QERAppShadersTable ), SYN_REQUIRE, &g_AppShadersTable );
g_SynapseClient.AddAPI( DATA_MAJOR, NULL, sizeof( _QERAppDataTable ), SYN_REQUIRE, &g_AppDataTable ); g_SynapseClient.AddAPI( DATA_MAJOR, NULL, sizeof( _QERAppDataTable ), SYN_REQUIRE, &g_AppDataTable );
return &g_SynapseClient; return &g_SynapseClient;
} }
bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){ bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ) {
if ( !strcmp( pAPI->major_name, SURFACEDIALOG_MAJOR ) ) { if ( !strcmp( pAPI->major_name, SURFACEDIALOG_MAJOR ) ) {
_QERPlugSurfaceTable* pSurfDialogTable = static_cast<_QERPlugSurfaceTable*>( pAPI->mpTable ); if ( !strcmp( pAPI->minor_name, SURFACEDIALOG_MINOR ) ) {
if ( !strcmp( pAPI->minor_name, "idtech2" ) ) { _QERPlugSurfaceTable* pSurfaceTable = static_cast<_QERPlugSurfaceTable*>( pAPI->mpTable );
pSurfDialogTable->m_pfnToggleSurface = &ToggleSurface; pSurfaceTable->m_pfnToggleSurface = &ToggleSurface;
pSurfDialogTable->m_pfnDoSurface = &DoSurface; pSurfaceTable->m_pfnDoSurface = &DoSurface;
pSurfDialogTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog; pSurfaceTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog;
pSurfDialogTable->m_pfnSurfaceDlgFitAll = &SurfaceDlgFitAll; pSurfaceTable->m_pfnSurfaceDlgFitAll = &SurfaceDlgFitAll;
pSurfDialogTable->m_pfnGet_SI_Module_Widget = &Get_SI_Module_Widget; pSurfaceTable->m_pfnGet_SI_Module_Widget = &Get_SI_Module_Widget;
return true; return true;
} }
} }
@ -107,14 +104,6 @@ bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){
#include "version.h" #include "version.h"
const char* CSynapseClient_SurfDLG::GetInfo(){ const char *CSynapseClient_SurfDLG::GetInfo(){
return "Surface Dialog (idTech2) module built " __DATE__ " " RADIANT_VERSION; return "Surface Dialog (idTech2) module built " __DATE__ " " RADIANT_VERSION;
} }
const char* CSynapseClient_SurfDLG::GetName(){
return "surface";
}
bool CSynapseClient_SurfDLG::OnActivate(){
return true;
}

View file

@ -50,6 +50,9 @@ typedef char* LPCSTR;
#include "isurfaceplugin.h" #include "isurfaceplugin.h"
#define SURFACEDIALOG_MINOR "idtech2"
#define SHADERS_MINOR "idtech2"
class SurfaceDialog : public IPluginTexdef class SurfaceDialog : public IPluginTexdef
{ {
int refCount; int refCount;

View file

@ -757,6 +757,15 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
mGameFile = GameFile; mGameFile = GameFile;
prop = (char*)xmlGetProp( pNode, (xmlChar*)"idtech2" );
if ( prop == NULL ) {
// default
idTech2 = false;
} else {
idTech2 = true;
xmlFree( prop );
}
// if this is set, the open maps dialoge will open the engine path not the // if this is set, the open maps dialoge will open the engine path not the
// home dir for map loading and saving // home dir for map loading and saving
prop = (char*)xmlGetProp( pNode, (xmlChar*)"no_maps_in_home" ); prop = (char*)xmlGetProp( pNode, (xmlChar*)"no_maps_in_home" );
@ -2998,10 +3007,6 @@ void PrefsDlg::LoadPrefs(){
// Texture subset on by default (HL specific really, because of halflife.wad's size) // Texture subset on by default (HL specific really, because of halflife.wad's size)
mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, TRUE ); mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, TRUE );
} else if ( g_pGameDescription->mGameFile == "q2.game" || g_pGameDescription->mGameFile == "q2w.game" ) {
// BSP monitoring is implemented in Quake2 and Heretic2 tools
mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, FALSE );
mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, TRUE );
} else { } else {
mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, TRUE ); mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, TRUE );
mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, FALSE ); mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, FALSE );
@ -3593,6 +3598,7 @@ void CGameInstall::Run() {
switch ( m_availGames[ m_nComboSelect ] ) { switch ( m_availGames[ m_nComboSelect ] ) {
case GAME_Q2: { case GAME_Q2: {
fprintf( fg, " idtech2=\"true\"\n" );
fprintf( fg, " prefix=\".quake2\"\n" ); fprintf( fg, " prefix=\".quake2\"\n" );
fprintf( fg, " basegame=\"baseq2\"\n" ); fprintf( fg, " basegame=\"baseq2\"\n" );
fprintf( fg, " no_patch=\"true\"\n" ); fprintf( fg, " no_patch=\"true\"\n" );
@ -3625,8 +3631,14 @@ void CGameInstall::Run() {
break; break;
} }
case GAME_Q2W: { case GAME_Q2W: {
fprintf( fg, " prefix=\".quake2world\"\n" ); #if defined( __APPLE__ ) || defined( __linux__ )
fprintf( fg, " prefix_win32=\"Quake2World\"\n"); fprintf( fg, " " ENGINE_ATTRIBUTE "=\"quake2world\"\n" );
fprintf( fg, " " PREFIX_ATTRIBUTE "=\".quake2world\"\n" );
#elif _WIN32
fprintf( fg, " " ENGINE_ATTRIBUTE "=\"quake2world.exe\"\n" );
fprintf( fg, " " PREFIX_ATTRIBUTE "=\"Quake2World\"\n" );
#endif
fprintf( fg, " idtech2=\"true\"\n" );
fprintf( fg, " basegame=\"default\"\n" ); fprintf( fg, " basegame=\"default\"\n" );
fprintf( fg, " no_patch=\"true\"\n" ); fprintf( fg, " no_patch=\"true\"\n" );
fprintf( fg, " default_scale=\"0.25\"\n" ); fprintf( fg, " default_scale=\"0.25\"\n" );

View file

@ -184,6 +184,7 @@ bool mEClassSingleLoad; ///< only load a single eclass definition file
bool mNoPatch; ///< this game doesn't support patch technology bool mNoPatch; ///< this game doesn't support patch technology
Str mCaulkShader; ///< the shader to use for caulking Str mCaulkShader; ///< the shader to use for caulking
bool noMapsInHome; ///< set this if you want to open the engine path/base dir/maps dir for map open/save dialoges */ bool noMapsInHome; ///< set this if you want to open the engine path/base dir/maps dir for map open/save dialoges */
bool idTech2; // set this to true for idTech2 games
CGameDescription() { mpDoc = NULL; } CGameDescription() { mpDoc = NULL; }
/*! /*!

View file

@ -436,7 +436,7 @@ xmlDocPtr ParseXMLFile( const char* filename, bool validate = false ){
// copy a string r to a buffer w // copy a string r to a buffer w
// replace $string as appropriate // replace $string as appropriate
void ReplaceTemplates( char* w, const char* r ){ static void ReplaceTemplates( char* w, const char* r ){
const char *p; const char *p;
const char *__ENGINEPATH = "TEMPLATEenginepath"; const char *__ENGINEPATH = "TEMPLATEenginepath";
const char *__USERHOMEPATH = "TEMPLATEuserhomepath"; const char *__USERHOMEPATH = "TEMPLATEuserhomepath";

View file

@ -461,7 +461,7 @@ void CWatchBSP::RoutineProcessing(){
Sys_Printf( "Running engine...\n" ); Sys_Printf( "Running engine...\n" );
Str cmd; Str cmd;
// build the command line // build the command line
cmd = g_pGameDescription->mEnginePath.GetBuffer(); cmd = g_pGameDescription->mExecutablesPath.GetBuffer();
// this is game dependant // this is game dependant
if ( !strcmp( ValueForKey( g_qeglobals.d_project_entity, "gamemode" ),"mp" ) ) { if ( !strcmp( ValueForKey( g_qeglobals.d_project_entity, "gamemode" ),"mp" ) ) {
// MP // MP
@ -478,7 +478,12 @@ void CWatchBSP::RoutineProcessing(){
FindReplace( cmd, "/", "\\" ); FindReplace( cmd, "/", "\\" );
#endif #endif
Str cmdline; Str cmdline;
// NOTE: idTech3 specific - there used to be some logic depending on engine breed here if ( g_pGameDescription->idTech2 ) {
cmdline = "+exec radiant.cfg +map ";
cmdline += m_sBSPName;
}
else
// NOTE: idTech3 specific - there used to be some logic depending on engine breed here
{ {
cmdline = "+set sv_pure 0 "; cmdline = "+set sv_pure 0 ";
// TTimo: a check for vm_* but that's all fine // TTimo: a check for vm_* but that's all fine