diff --git a/radiant/main.cpp b/radiant/main.cpp index 465b0ff4..f60cd6bd 100644 --- a/radiant/main.cpp +++ b/radiant/main.cpp @@ -974,7 +974,7 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){ QE_ConvertDOSToUnixName( src, src ); // initialise the first step - out = new char[BIG_PATH_MAX]; //% PATH_MAX + out = new char[BIG_PATH_MAX]; g_ptr_array_add( out_array, out ); in = ValueForKey( g_qeglobals.d_project_entity, bspaction ); @@ -1015,7 +1015,7 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){ // start a new step *out = 0; in = in + 2; - out = new char[BIG_PATH_MAX]; //% PATH_MAX + out = new char[BIG_PATH_MAX]; g_ptr_array_add( out_array, out ); } } @@ -1110,10 +1110,10 @@ static gboolean RunBsp_CaptureOutput(void *data) { void RunBsp( char *command ){ GPtrArray *sys; - char batpath[BIG_PATH_MAX]; //% PATH_MAX - char temppath[BIG_PATH_MAX]; //% PATH_MAX - char name[BIG_PATH_MAX]; //% PATH_MAX - char cWork[BIG_PATH_MAX]; //% PATH_MAX + char batpath[BIG_PATH_MAX]; + char temppath[BIG_PATH_MAX]; + char name[BIG_PATH_MAX]; + char cWork[BIG_PATH_MAX]; FILE *hFile; unsigned int i; @@ -1131,14 +1131,11 @@ void RunBsp( char *command ){ AddSlash( strPath ); strncpy( cWork, strPath, 1024 ); strcat( cWork, strFile ); - } - else - { + } else { strcpy( cWork, name ); } // get the array ready - //++timo TODO: free the array, free the strings ourselves with delete[] sys = g_ptr_array_new(); QE_ExpandBspString( command, sys, cWork ); @@ -1149,9 +1146,7 @@ void RunBsp( char *command ){ ExtractFileName( currentmap, bspname ); StripExtension( bspname ); g_pParentWnd->GetWatchBSP()->DoMonitoringLoop( sys, bspname ); - } - else - { + } else { // write all the steps in a single BAT / .sh file and run it, don't bother monitoring it CString strSys; for ( i = 0; i < sys->len; i++ ) @@ -1239,68 +1234,10 @@ void RunBsp( char *command ){ WinExec( batpath, SW_SHOWNORMAL ); #endif } -#ifdef _DEBUG - // yeah, do it .. but not now right before 1.1-TA-beta release - Sys_Printf( "TODO: erase GPtrArray\n" ); -#endif + // free the strings and the array + for ( i = 0; i < sys->len; i++ ) { + delete[] (char *)g_ptr_array_index( sys, i ); + } + g_ptr_array_free( sys, TRUE ); + sys = NULL; } - -#if 0 - -#ifdef _WIN32 - -int WINAPI QEW_SetupPixelFormat( HDC hDC, qboolean zbuffer ){ - static PIXELFORMATDESCRIPTOR pfd = { - sizeof( PIXELFORMATDESCRIPTOR ), // size of this pfd - 1, // version number - PFD_DRAW_TO_WINDOW | // support window - PFD_SUPPORT_OPENGL | // support OpenGL - PFD_DOUBLEBUFFER, // double buffered - PFD_TYPE_RGBA, // RGBA type - 24, // 24-bit color depth - 0, 0, 0, 0, 0, 0, // color bits ignored - 0, // no alpha buffer - 0, // shift bit ignored - 0, // no accumulation buffer - 0, 0, 0, 0, // accum bits ignored - 32, // depth bits - 0, // no stencil buffer - 0, // no auxiliary buffer - PFD_MAIN_PLANE, // main layer - 0, // reserved - 0, 0, 0 // layer masks ignored - }; // - int pixelformat = 0; - - zbuffer = true; - if ( !zbuffer ) { - pfd.cDepthBits = 0; - } - - if ( ( pixelformat = ChoosePixelFormat( hDC, &pfd ) ) == 0 ) { - LPVOID lpMsgBuf; - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language - (LPTSTR) &lpMsgBuf, - 0, - NULL - ); - Sys_FPrintf( SYS_WRN, "GetLastError: %s", lpMsgBuf ); - Error( "ChoosePixelFormat failed" ); - } - - if ( !SetPixelFormat( hDC, pixelformat, &pfd ) ) { - Error( "SetPixelFormat failed" ); - } - - return pixelformat; -} - -#endif - -#endif diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 6a0b7c7d..99120152 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -215,7 +215,6 @@ #define MOUSE_DEF 1 #define WINDOW_DEF 0 #define RUNQ2_DEF 0 -#define WATCHBSP_DEF 1 #define TLOCK_DEF 1 #define LOADLAST_DEF 1 #define RUN_DEF 0 @@ -762,9 +761,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ if ( prop == NULL ) { // default quake2 = false; - } - else - { + } else { quake2 = true; xmlFree( prop ); } @@ -775,9 +772,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ if ( prop == NULL ) { // default noMapsInHome = false; - } - else - { + } else { noMapsInHome = true; xmlFree( prop ); } @@ -786,14 +781,11 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ if ( prop == NULL ) { // default mBaseGame = "baseq3"; - } - else - { + } else { mBaseGame = prop; xmlFree( prop ); } - prop = (char*)xmlGetProp( pNode, (const xmlChar*)ENGINE_ATTRIBUTE ); if ( prop == NULL ) { #ifdef _WIN32 @@ -803,9 +795,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ #elif __APPLE__ mEngine = "Quake3.app"; #endif - } - else - { + } else { mEngine = prop; xmlFree( prop ); } @@ -819,9 +809,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ #elif __APPLE__ mMultiplayerEngine = "Quake3.app"; #endif - } - else - { + } else { mMultiplayerEngine = prop; xmlFree( prop ); } @@ -887,9 +875,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){ if ( !mShaderPath.GetLength() ) { mShaderPath = "scripts/"; mShaderlist = "scripts/shaderlist.txt"; - } - else - { + } else { AddSlash( mShaderPath ); mShaderlist = mShaderPath; mShaderlist += "shaderlist.txt"; @@ -3015,24 +3001,20 @@ void PrefsDlg::LoadPrefs(){ // this will probably need to be 75 or 100 for Q1. mLocalPrefs.GetPref( TEXTURESCALE_KEY, &m_nTextureScale, 50 ); - // FIXME: Hydra - actually, this stuff is Q1,Q2 and HL specific. if ( ( g_pGameDescription->mGameFile == "hl.game" ) ) { // No BSP monitoring in the default compiler tools for Half-life (yet) mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, FALSE ); // 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 ) { + } 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 ); + } else { + mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, TRUE ); mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, FALSE ); }