mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 03:51:18 +00:00
* removed a lot of HACKs for several games by merging the enginepath_win32, enginepath_linux and enginepath_macos from 1.5
to 1.6 (default for everything is quake3) * removed the hacks for q2.game and heretic2.game (just check whether the game config value quake2 is set - TODO: game dialog needs update - quake2 option should be given) git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@297 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
5f6f117633
commit
f5b144e467
5 changed files with 141 additions and 245 deletions
|
@ -1340,7 +1340,7 @@ void GroupDlg::Create ()
|
||||||
EntWidgets[EntCheck1+i] = check;
|
EntWidgets[EntCheck1+i] = check;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pGameDescription->quake2 || ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" )) {
|
if (g_pGameDescription->quake2) {
|
||||||
GtkWidget *check = gtk_check_button_new_with_label (_("!Easy"));
|
GtkWidget *check = gtk_check_button_new_with_label (_("!Easy"));
|
||||||
gtk_widget_show (check);
|
gtk_widget_show (check);
|
||||||
gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
|
gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
|
||||||
|
|
|
@ -694,6 +694,31 @@ Games selection dialog
|
||||||
=========================================================
|
=========================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
|
#define ENGINE_ATTRIBUTE "engine_win32"
|
||||||
|
#define MP_ENGINE_ATTRIBUTE "mp_engine_win32"
|
||||||
|
#elif defined(__linux__) || defined (__FreeBSD__)
|
||||||
|
#define ENGINE_ATTRIBUTE "engine_linux"
|
||||||
|
#define MP_ENGINE_ATTRIBUTE "mp_engine_linux"
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#define ENGINE_ATTRIBUTE "engine_macos"
|
||||||
|
#define MP_ENGINE_ATTRIBUTE "mp_engine_macos"
|
||||||
|
#else
|
||||||
|
#error "unsupported platform"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
|
#define ENGINEPATH_ATTRIBUTE "enginepath_win32"
|
||||||
|
#elif defined(__linux__) || defined (__FreeBSD__)
|
||||||
|
#define ENGINEPATH_ATTRIBUTE "enginepath_linux"
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#define ENGINEPATH_ATTRIBUTE "enginepath_macos"
|
||||||
|
#else
|
||||||
|
#error "unknown platform"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
|
CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
|
||||||
{
|
{
|
||||||
char *p, *prop;
|
char *p, *prop;
|
||||||
|
@ -710,7 +735,7 @@ CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
|
||||||
// on win32, game tools path can now be specified relative to the exe's cwd
|
// on win32, game tools path can now be specified relative to the exe's cwd
|
||||||
prop = (char*)xmlGetProp( pNode, (xmlChar*)"gametools" );
|
prop = (char*)xmlGetProp( pNode, (xmlChar*)"gametools" );
|
||||||
if ( prop == NULL ) {
|
if ( prop == NULL ) {
|
||||||
Error( "Didn't find 'gametools' node in the game description file '%s'\n", pDoc->URL );
|
Error( "Didn't find 'gametools' node in the game description file '%s'\n", pDoc->URL );
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
char full[PATH_MAX];
|
char full[PATH_MAX];
|
||||||
|
@ -784,58 +809,78 @@ CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
|
||||||
xmlFree(prop);
|
xmlFree(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// on win32, engine path can now be specified relative to the exe's cwd
|
|
||||||
prop = (char*)xmlGetProp(pNode, (const xmlChar *)"enginepath");
|
|
||||||
if ( prop != NULL ) {
|
|
||||||
char full[PATH_MAX];
|
|
||||||
#ifdef _WIN32
|
|
||||||
_fullpath( full, prop, PATH_MAX );
|
|
||||||
#else
|
|
||||||
strncpy( full, prop, PATH_MAX );
|
|
||||||
#endif
|
|
||||||
xmlFree( prop );
|
|
||||||
prop = NULL;
|
|
||||||
// process seperators
|
|
||||||
for ( p = full; *p != '\0'; p++ ) {
|
|
||||||
if ( *p == '\\' ) {
|
|
||||||
*p = '/';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mEnginePath = full;
|
|
||||||
if ( p != full && *(p-1) != '/' ) {
|
|
||||||
mEnginePath += "/";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// if engine path was not specified in the .game, it implies we can guess it from the gametools path
|
|
||||||
// on win32, and for most game package, the gametools are installed with the game
|
|
||||||
char aux_path[PATH_MAX]; // aux
|
|
||||||
strcpy( aux_path, mGameToolsPath.GetBuffer() );
|
|
||||||
if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) {
|
|
||||||
aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any
|
|
||||||
}
|
|
||||||
char up_path[PATH_MAX]; // up one level
|
|
||||||
ExtractFilePath( aux_path, up_path );
|
|
||||||
mEnginePath = up_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
prop = (char*)xmlGetProp(pNode, (xmlChar*)"engine");
|
prop = (char*)xmlGetProp(pNode, (const xmlChar*)ENGINE_ATTRIBUTE);
|
||||||
if (prop == NULL)
|
if (prop == NULL)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
mEngine = "quake3.exe";
|
mEngine = "quake3.exe";
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
mEngine = "quake3";
|
mEngine = "quake3";
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
mEngine = "Quake3.app";
|
mEngine = "Quake3.app";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mEngine = prop;
|
mEngine = prop;
|
||||||
xmlFree(prop);
|
xmlFree(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prop = (char*)xmlGetProp(pNode, (const xmlChar*)MP_ENGINE_ATTRIBUTE);
|
||||||
|
if (prop == NULL)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
mMultiplayerEngine = "quake3.exe";
|
||||||
|
#elif __linux__
|
||||||
|
mMultiplayerEngine = "quake3";
|
||||||
|
#elif __APPLE__
|
||||||
|
mMultiplayerEngine = "Quake3.app";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mMultiplayerEngine = prop;
|
||||||
|
xmlFree(prop);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// on win32, engine path can now be specified relative to the exe's cwd
|
||||||
|
prop = (char*)xmlGetProp(pNode, (const xmlChar *)ENGINEPATH_ATTRIBUTE);
|
||||||
|
if ( prop != NULL ) {
|
||||||
|
char full[PATH_MAX];
|
||||||
|
#ifdef _WIN32
|
||||||
|
_fullpath( full, prop, PATH_MAX );
|
||||||
|
#else
|
||||||
|
strncpy( full, prop, PATH_MAX );
|
||||||
|
#endif
|
||||||
|
xmlFree( prop );
|
||||||
|
prop = NULL;
|
||||||
|
// process seperators
|
||||||
|
for ( p = full; *p != '\0'; p++ ) {
|
||||||
|
if ( *p == '\\' ) {
|
||||||
|
*p = '/';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mEnginePath = full;
|
||||||
|
if ( p != full && *(p-1) != '/' ) {
|
||||||
|
mEnginePath += "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if engine path was not specified in the .game, it implies we can guess it from the gametools path
|
||||||
|
// on win32, and for most game package, the gametools are installed with the game
|
||||||
|
char aux_path[PATH_MAX]; // aux
|
||||||
|
strcpy( aux_path, mGameToolsPath.GetBuffer() );
|
||||||
|
if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) {
|
||||||
|
aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any
|
||||||
|
}
|
||||||
|
char up_path[PATH_MAX]; // up one level
|
||||||
|
ExtractFilePath( aux_path, up_path );
|
||||||
|
mEnginePath = up_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined (__linux__) || defined (__APPLE__)
|
#if defined (__linux__) || defined (__APPLE__)
|
||||||
// *nix specific
|
// *nix specific
|
||||||
|
@ -2884,7 +2929,7 @@ 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->quake2 || ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ))
|
else if (g_pGameDescription->quake2)
|
||||||
{
|
{
|
||||||
// BSP monitoring is implemented in Quake2 and Heretic2 tools
|
// BSP monitoring is implemented in Quake2 and Heretic2 tools
|
||||||
mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE);
|
mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE);
|
||||||
|
@ -3327,7 +3372,7 @@ void CGameInstall::Run() {
|
||||||
}
|
}
|
||||||
fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
|
fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
|
||||||
fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
|
fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
|
||||||
fprintf( fg, " enginepath=\"%s\"\n", m_strEngine.GetBuffer() );
|
fprintf( fg, " "ENGINEPATH_ATTRIBUTE"=\"%s\"\n", m_strEngine.GetBuffer() );
|
||||||
switch ( m_availGames[ m_nComboSelect ] ) {
|
switch ( m_availGames[ m_nComboSelect ] ) {
|
||||||
case GAME_Q2: {
|
case GAME_Q2: {
|
||||||
fprintf( fg, " gametools=\"%sinstalls/Quake2Pack/game\"\n", g_strAppPath.GetBuffer() );
|
fprintf( fg, " gametools=\"%sinstalls/Quake2Pack/game\"\n", g_strAppPath.GetBuffer() );
|
||||||
|
|
|
@ -171,6 +171,7 @@ public:
|
||||||
Str mBaseGame; ///< basegame directory
|
Str mBaseGame; ///< basegame directory
|
||||||
Str mEnginePath; ///< path to the engine
|
Str mEnginePath; ///< path to the engine
|
||||||
Str mEngine; ///< engine name
|
Str mEngine; ///< engine name
|
||||||
|
Str mMultiplayerEngine; ///< engine name
|
||||||
#if defined (__linux__) || defined (__APPLE__)
|
#if defined (__linux__) || defined (__APPLE__)
|
||||||
Str mUserPathPrefix; ///< prefix for ~/.q3a ~/.wolf init, only on *nix
|
Str mUserPathPrefix; ///< prefix for ~/.q3a ~/.wolf init, only on *nix
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -168,7 +168,7 @@ void SI_SetTexdef_FaceList(texdef_to_face_t* texdef_face_list, bool b_SetUndoPoi
|
||||||
texdef_to_face_t* texdef_to_face;
|
texdef_to_face_t* texdef_to_face;
|
||||||
bool b_isQuake2;
|
bool b_isQuake2;
|
||||||
|
|
||||||
if ( ( g_pGameDescription->quake2 ) || ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ) )
|
if (g_pGameDescription->quake2)
|
||||||
b_isQuake2 = true;
|
b_isQuake2 = true;
|
||||||
else
|
else
|
||||||
b_isQuake2 = false;
|
b_isQuake2 = false;
|
||||||
|
|
|
@ -503,173 +503,23 @@ void CWatchBSP::RoutineProcessing()
|
||||||
// build the command line
|
// build the command line
|
||||||
cmd = g_pGameDescription->mEnginePath.GetBuffer();
|
cmd = g_pGameDescription->mEnginePath.GetBuffer();
|
||||||
// this is game dependant
|
// this is game dependant
|
||||||
//!\todo Read the engine binary name from a config file.
|
if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
|
||||||
if (g_pGameDescription->mGameFile == "wolf.game")
|
|
||||||
{
|
{
|
||||||
if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
|
// MP
|
||||||
{
|
cmd += g_pGameDescription->mMultiplayerEngine.GetBuffer();
|
||||||
// MP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "WolfMP.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "wolfmp";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "wolfmp.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// SP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "WolfSP.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "wolfsp";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "wolfsp.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
} else if (g_pGameDescription->mGameFile == "et.game")
|
|
||||||
{
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "et.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "et";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "et.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
// RIANT
|
|
||||||
// JK2 HACK
|
|
||||||
else if (g_pGameDescription->mGameFile == "jk2.game")
|
|
||||||
{
|
|
||||||
if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
|
|
||||||
{
|
|
||||||
// MP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "jk2MP.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "jk2mp";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "jk2mp.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// SP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "jk2SP.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "jk2sp";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "jk2sp.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// TTimo
|
|
||||||
// JA HACK
|
|
||||||
else if (g_pGameDescription->mGameFile == "ja.game")
|
|
||||||
{
|
|
||||||
if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
|
|
||||||
{
|
|
||||||
// MP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "jamp.exe";
|
|
||||||
#elif !defined(__linux__) && !defined(__APPLE__)
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// SP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "jasp.exe";
|
|
||||||
#elif !defined(__linux__) && !defined(__APPLE__)
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// RIANT
|
|
||||||
// STVEF HACK
|
|
||||||
else if (g_pGameDescription->mGameFile == "stvef.game")
|
|
||||||
{
|
|
||||||
if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
|
|
||||||
{
|
|
||||||
// MP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "stvoyHM.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "stvoyHM";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "stvoyHM.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// SP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "stvoy.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "stvoy";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "stvoy.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// RIANT
|
|
||||||
// SOF2 HACK
|
|
||||||
else if (g_pGameDescription->mGameFile == "sof2.game")
|
|
||||||
{
|
|
||||||
if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
|
|
||||||
{
|
|
||||||
// MP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "sof2MP.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "b00gus";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "sof2MP.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// SP
|
|
||||||
#if defined(WIN32)
|
|
||||||
cmd += "sof2.exe";
|
|
||||||
#elif defined(__linux__)
|
|
||||||
cmd += "b00gus";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cmd += "sof2.app";
|
|
||||||
#else
|
|
||||||
#error "WTF are you compiling on"
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// SP
|
||||||
cmd += g_pGameDescription->mEngine.GetBuffer();
|
cmd += g_pGameDescription->mEngine.GetBuffer();
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// NOTE: we are using unix pathnames and CreateProcess doesn't like / in the program path
|
// NOTE: we are using unix pathnames and CreateProcess doesn't like / in the program path
|
||||||
|
// FIXME: This isn't true anymore, doesn't it?
|
||||||
FindReplace( cmd, "/", "\\" );
|
FindReplace( cmd, "/", "\\" );
|
||||||
#endif
|
#endif
|
||||||
Str cmdline;
|
Str cmdline;
|
||||||
if ( (g_pGameDescription->mGameFile == "q2.game") || (g_pGameDescription->mGameFile == "heretic2.game") )
|
if ( g_pGameDescription->quake2 )
|
||||||
{
|
{
|
||||||
cmdline = ". +exec radiant.cfg +map ";
|
cmdline = ". +exec radiant.cfg +map ";
|
||||||
cmdline += m_sBSPName;
|
cmdline += m_sBSPName;
|
||||||
|
|
Loading…
Reference in a new issue