=========================================================
*/
+#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)
{
char *p, *prop;
// on win32, game tools path can now be specified relative to the exe's cwd
prop = (char*)xmlGetProp( pNode, (xmlChar*)"gametools" );
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];
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];
+
+ prop = (char*)xmlGetProp(pNode, (const xmlChar*)ENGINE_ATTRIBUTE);
+ if (prop == NULL)
+ {
#ifdef _WIN32
- _fullpath( full, prop, PATH_MAX );
-#else
- strncpy( full, prop, PATH_MAX );
+ mEngine = "quake3.exe";
+#elif __linux__
+ mEngine = "quake3";
+#elif __APPLE__
+ mEngine = "Quake3.app";
#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
+ {
+ mEngine = prop;
+ xmlFree(prop);
}
- }
- 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");
- if (prop == NULL)
- {
+ prop = (char*)xmlGetProp(pNode, (const xmlChar*)MP_ENGINE_ATTRIBUTE);
+ if (prop == NULL)
+ {
#ifdef _WIN32
- mEngine = "quake3.exe";
+ mMultiplayerEngine = "quake3.exe";
#elif __linux__
- mEngine = "quake3";
+ mMultiplayerEngine = "quake3";
#elif __APPLE__
- mEngine = "Quake3.app";
+ mMultiplayerEngine = "Quake3.app";
#endif
- }
- else
- {
- mEngine = prop;
- xmlFree(prop);
- }
+ }
+ 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__)
// *nix specific
// 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 || ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ))
+ else if (g_pGameDescription->quake2)
{
// BSP monitoring is implemented in Quake2 and Heretic2 tools
mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE);
}
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, " enginepath=\"%s\"\n", m_strEngine.GetBuffer() );
+ fprintf( fg, " "ENGINEPATH_ATTRIBUTE"=\"%s\"\n", m_strEngine.GetBuffer() );
switch ( m_availGames[ m_nComboSelect ] ) {
case GAME_Q2: {
fprintf( fg, " gametools=\"%sinstalls/Quake2Pack/game\"\n", g_strAppPath.GetBuffer() );
texdef_to_face_t* texdef_to_face;
bool b_isQuake2;
- if ( ( g_pGameDescription->quake2 ) || ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" ) )
+ if (g_pGameDescription->quake2)
b_isQuake2 = true;
else
b_isQuake2 = false;
if (!texdef_face_list)
return;
-
+
if (b_SetUndoPoint)
{
if(g_ptrSelectedFaces.GetSize() > 1)
SetFaceTexdef(texdef_to_face->face, &texdef_to_face->orig_texdef, NULL);
Undo_Start("set facelist texdefs");
-
+
if( selected_brushes.next != &selected_brushes )
- Undo_AddBrushList(&selected_brushes);
+ Undo_AddBrushList(&selected_brushes);
else
Undo_AddBrush(texdef_face_list->brush);
-
+
}
- }
-
+ }
+
for(texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next)
{
if (b_isQuake2)
SetFaceTexdef_Q2(texdef_to_face->face, &texdef_to_face->texdef, bFit_to_Scale);
else
SetFaceTexdef(texdef_to_face->face, &texdef_to_face->texdef, NULL , bFit_to_Scale);
- Brush_Build(texdef_to_face->brush);
+ Brush_Build(texdef_to_face->brush);
if(bFit_to_Scale)
texdef_to_face->texdef = texdef_to_face->face->texdef;
}
-
+
if ( b_SetUndoPoint )
{
if( (selected_brushes.next != &selected_brushes) || (g_ptrSelectedFaces.GetSize() == 1) )
{
if(selected_brushes.next != &selected_brushes)
- Undo_EndBrushList(&selected_brushes);
+ Undo_EndBrushList(&selected_brushes);
else
Undo_EndBrush(texdef_face_list->brush);
-
+
Undo_End();
// Over-write the orig_texdef list, cementing the change.
for(texdef_to_face = texdef_face_list; texdef_to_face; texdef_to_face = texdef_to_face->next)
texdef_to_face->orig_texdef = texdef_to_face->texdef;
}
}
-
+
Sys_UpdateWindows (W_ALL);
}
for (temp_texdef_face_list = si_texdef_face_list; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
{
Face_FitTexture(temp_texdef_face_list->face, nHeight, nWidth);
- Brush_Build(temp_texdef_face_list->brush,true,true,false,false);
+ Brush_Build(temp_texdef_face_list->brush,true,true,false,false);
// Write changes to our working Texdef list
temp_texdef_face_list->texdef = temp_texdef_face_list->face->texdef;
}
Copyright (c) 2001, Loki software, inc.
All rights reserved.
-Redistribution and use in source and binary forms, with or without modification,
+Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
-Redistributions of source code must retain the above copyright notice, this list
+Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
-Neither the name of Loki software nor the names of its contributors may be used
-to endorse or promote products derived from this software without specific prior
-written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Neither the name of Loki software nor the names of its contributors may be used
+to endorse or promote products derived from this software without specific prior
+written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//-----------------------------------------------------------------------------
#include "stream_version.h"
-static void saxStartElement(message_info_t *data, const xmlChar *name, const xmlChar **attrs)
+static void saxStartElement(message_info_t *data, const xmlChar *name, const xmlChar **attrs)
{
if (data->ignore_depth == 0)
{
}
else if (strcmp((char*)attrs[1],Q3MAP_STREAM_VERSION) != 0)
{
- Sys_FPrintf(SYS_ERR,
+ Sys_FPrintf(SYS_ERR,
"This version of Radiant reads version %s debug streams, I got an incoming connection with version %s\n"
"Please make sure your versions of Radiant and q3map are matching.\n", Q3MAP_STREAM_VERSION, (char*)attrs[1]);
abortStream(data);
{
data->msg_level = atoi ((char *)attrs[1]);
}
- else if (strcmp ((char *)name, "polyline") == 0)
+ else if (strcmp ((char *)name, "polyline") == 0)
// polyline has a particular status .. right now we only use it for leakfile ..
{
data->bGeometry = true;
{
char saxMsgBuffer[4096];
va_list args;
-
+
va_start(args, msg);
vsprintf (saxMsgBuffer, msg, args);
va_end(args);
{
char saxMsgBuffer[4096];
va_list args;
-
+
va_start(args, msg);
vsprintf (saxMsgBuffer, msg, args);
va_end(args);
static void saxFatal(void *ctx, const char *msg, ...)
{
char buffer[4096];
-
+
va_list args;
-
+
va_start(args, msg);
vsprintf (buffer, msg, args);
va_end(args);
{
Sys_Printf("Connected.\n");
// prepare the message info struct for diving in
- memset (&m_message_info, 0, sizeof(message_info_s));
+ memset (&m_message_info, 0, sizeof(message_info_s));
// a dumb flag to make sure we init the push parser context when first getting a msg
m_bNeedCtxtInit = true;
m_eState = EWatching;
// build the command line
cmd = g_pGameDescription->mEnginePath.GetBuffer();
// this is game dependant
- //!\todo Read the engine binary name from a config file.
- if (g_pGameDescription->mGameFile == "wolf.game")
+ if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
{
- if (!strcmp(ValueForKey(g_qeglobals.d_project_entity, "gamemode"),"mp"))
- {
- // 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
- }
+ // MP
+ cmd += g_pGameDescription->mMultiplayerEngine.GetBuffer();
}
else
{
+ // SP
cmd += g_pGameDescription->mEngine.GetBuffer();
}
#ifdef _WIN32
// 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, "/", "\\" );
#endif
Str cmdline;
- if ( (g_pGameDescription->mGameFile == "q2.game") || (g_pGameDescription->mGameFile == "heretic2.game") )
+ if ( g_pGameDescription->quake2 )
{
cmdline = ". +exec radiant.cfg +map ";
cmdline += m_sBSPName;
}
else
{
- // SP
+ // SP
cmdline += "+set nextmap \"spdevmap ";
cmdline += m_sBSPName;
cmdline += "\"";
{
Sys_Printf("WatchBSP got a monitoring request while not idling...\n");
// prompt the user, should we cancel the current process and go ahead?
- if (gtk_MessageBox(g_pParentWnd->m_pWidget, "I am already monitoring a BSP process.\nDo you want me to override and start a new compilation?",
+ if (gtk_MessageBox(g_pParentWnd->m_pWidget, "I am already monitoring a BSP process.\nDo you want me to override and start a new compilation?",
"BSP process monitoring", MB_YESNO ) == IDYES)
{
// disconnect and set EIdle state