This commit is contained in:
Timothee "TTimo" Besset 2013-09-22 15:53:34 -05:00
parent 99e8ea8cf2
commit 69db7ec003
2 changed files with 23 additions and 104 deletions

View file

@ -974,7 +974,7 @@ void QE_ExpandBspString( char *bspaction, GPtrArray *out_array, char *mapname ){
QE_ConvertDOSToUnixName( src, src ); QE_ConvertDOSToUnixName( src, src );
// initialise the first step // 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 ); g_ptr_array_add( out_array, out );
in = ValueForKey( g_qeglobals.d_project_entity, bspaction ); 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 // start a new step
*out = 0; *out = 0;
in = in + 2; in = in + 2;
out = new char[BIG_PATH_MAX]; //% PATH_MAX out = new char[BIG_PATH_MAX];
g_ptr_array_add( out_array, out ); g_ptr_array_add( out_array, out );
} }
} }
@ -1110,10 +1110,10 @@ static gboolean RunBsp_CaptureOutput(void *data) {
void RunBsp( char *command ){ void RunBsp( char *command ){
GPtrArray *sys; GPtrArray *sys;
char batpath[BIG_PATH_MAX]; //% PATH_MAX char batpath[BIG_PATH_MAX];
char temppath[BIG_PATH_MAX]; //% PATH_MAX char temppath[BIG_PATH_MAX];
char name[BIG_PATH_MAX]; //% PATH_MAX char name[BIG_PATH_MAX];
char cWork[BIG_PATH_MAX]; //% PATH_MAX char cWork[BIG_PATH_MAX];
FILE *hFile; FILE *hFile;
unsigned int i; unsigned int i;
@ -1131,14 +1131,11 @@ void RunBsp( char *command ){
AddSlash( strPath ); AddSlash( strPath );
strncpy( cWork, strPath, 1024 ); strncpy( cWork, strPath, 1024 );
strcat( cWork, strFile ); strcat( cWork, strFile );
} } else {
else
{
strcpy( cWork, name ); strcpy( cWork, name );
} }
// get the array ready // get the array ready
//++timo TODO: free the array, free the strings ourselves with delete[]
sys = g_ptr_array_new(); sys = g_ptr_array_new();
QE_ExpandBspString( command, sys, cWork ); QE_ExpandBspString( command, sys, cWork );
@ -1149,9 +1146,7 @@ void RunBsp( char *command ){
ExtractFileName( currentmap, bspname ); ExtractFileName( currentmap, bspname );
StripExtension( bspname ); StripExtension( bspname );
g_pParentWnd->GetWatchBSP()->DoMonitoringLoop( sys, 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 // write all the steps in a single BAT / .sh file and run it, don't bother monitoring it
CString strSys; CString strSys;
for ( i = 0; i < sys->len; i++ ) for ( i = 0; i < sys->len; i++ )
@ -1239,68 +1234,10 @@ void RunBsp( char *command ){
WinExec( batpath, SW_SHOWNORMAL ); WinExec( batpath, SW_SHOWNORMAL );
#endif #endif
} }
#ifdef _DEBUG // free the strings and the array
// yeah, do it .. but not now right before 1.1-TA-beta release for ( i = 0; i < sys->len; i++ ) {
Sys_Printf( "TODO: erase GPtrArray\n" ); delete[] (char *)g_ptr_array_index( sys, i );
#endif }
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

View file

@ -215,7 +215,6 @@
#define MOUSE_DEF 1 #define MOUSE_DEF 1
#define WINDOW_DEF 0 #define WINDOW_DEF 0
#define RUNQ2_DEF 0 #define RUNQ2_DEF 0
#define WATCHBSP_DEF 1
#define TLOCK_DEF 1 #define TLOCK_DEF 1
#define LOADLAST_DEF 1 #define LOADLAST_DEF 1
#define RUN_DEF 0 #define RUN_DEF 0
@ -762,9 +761,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
if ( prop == NULL ) { if ( prop == NULL ) {
// default // default
quake2 = false; quake2 = false;
} } else {
else
{
quake2 = true; quake2 = true;
xmlFree( prop ); xmlFree( prop );
} }
@ -775,9 +772,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
if ( prop == NULL ) { if ( prop == NULL ) {
// default // default
noMapsInHome = false; noMapsInHome = false;
} } else {
else
{
noMapsInHome = true; noMapsInHome = true;
xmlFree( prop ); xmlFree( prop );
} }
@ -786,14 +781,11 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
if ( prop == NULL ) { if ( prop == NULL ) {
// default // default
mBaseGame = "baseq3"; mBaseGame = "baseq3";
} } else {
else
{
mBaseGame = prop; mBaseGame = prop;
xmlFree( prop ); xmlFree( prop );
} }
prop = (char*)xmlGetProp( pNode, (const xmlChar*)ENGINE_ATTRIBUTE ); prop = (char*)xmlGetProp( pNode, (const xmlChar*)ENGINE_ATTRIBUTE );
if ( prop == NULL ) { if ( prop == NULL ) {
#ifdef _WIN32 #ifdef _WIN32
@ -803,9 +795,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
#elif __APPLE__ #elif __APPLE__
mEngine = "Quake3.app"; mEngine = "Quake3.app";
#endif #endif
} } else {
else
{
mEngine = prop; mEngine = prop;
xmlFree( prop ); xmlFree( prop );
} }
@ -819,9 +809,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
#elif __APPLE__ #elif __APPLE__
mMultiplayerEngine = "Quake3.app"; mMultiplayerEngine = "Quake3.app";
#endif #endif
} } else {
else
{
mMultiplayerEngine = prop; mMultiplayerEngine = prop;
xmlFree( prop ); xmlFree( prop );
} }
@ -887,9 +875,7 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const Str &GameFile ){
if ( !mShaderPath.GetLength() ) { if ( !mShaderPath.GetLength() ) {
mShaderPath = "scripts/"; mShaderPath = "scripts/";
mShaderlist = "scripts/shaderlist.txt"; mShaderlist = "scripts/shaderlist.txt";
} } else {
else
{
AddSlash( mShaderPath ); AddSlash( mShaderPath );
mShaderlist = mShaderPath; mShaderlist = mShaderPath;
mShaderlist += "shaderlist.txt"; mShaderlist += "shaderlist.txt";
@ -3015,24 +3001,20 @@ void PrefsDlg::LoadPrefs(){
// this will probably need to be 75 or 100 for Q1. // this will probably need to be 75 or 100 for Q1.
mLocalPrefs.GetPref( TEXTURESCALE_KEY, &m_nTextureScale, 50 ); mLocalPrefs.GetPref( TEXTURESCALE_KEY, &m_nTextureScale, 50 );
// FIXME: Hydra - actually, this stuff is Q1,Q2 and HL specific.
if ( ( g_pGameDescription->mGameFile == "hl.game" ) ) { if ( ( g_pGameDescription->mGameFile == "hl.game" ) ) {
// No BSP monitoring in the default compiler tools for Half-life (yet) // No BSP monitoring in the default compiler tools for Half-life (yet)
mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, FALSE ); mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, FALSE );
// 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 ) {
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 );
// 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 {
else mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, TRUE );
{
mLocalPrefs.GetPref( WATCHBSP_KEY, &m_bWatchBSP, WATCHBSP_DEF );
mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, FALSE ); mLocalPrefs.GetPref( TEXTURE_KEY, &m_bTextureWindow, FALSE );
} }