Merge branch 'master' of github.com:TTimo/GtkRadiant

This commit is contained in:
Timothee TTimo Besset 2012-03-22 22:59:40 -05:00
commit 6ac1b9cfd3
18 changed files with 93 additions and 92 deletions

9
.gitignore vendored
View file

@ -1,2 +1,7 @@
/install/q3map2
# / /install/radiant.bin
/.sconsign.dblite
/site.sconf
/build
*.pyc
*.so

View file

@ -247,9 +247,8 @@ class Config:
env.Append( CXXFLAGS = [ '-g' ] ) env.Append( CXXFLAGS = [ '-g' ] )
env.Append( CPPDEFINES = [ '_DEBUG' ] ) env.Append( CPPDEFINES = [ '_DEBUG' ] )
else: else:
# '-O' causes q3map2 errors on Ubuntu 10.10 32 bit. env.Append( CFLAGS = [ '-O2', '-fno-strict-aliasing' ] )
env.Append( CFLAGS = [ ] ) env.Append( CXXFLAGS = [ '-O2', '-fno-strict-aliasing' ] )
env.Append( CXXFLAGS = [ ] )
def CheckoutOrUpdate( self, svnurl, path ): def CheckoutOrUpdate( self, svnurl, path ):
if ( os.path.exists( path ) ): if ( os.path.exists( path ) ):

View file

@ -694,7 +694,7 @@ void DBrush::SaveToFile( FILE *pFile ){
( *pp )->texInfo.m_fScale[0], ( *pp )->texInfo.m_fScale[0], ( *pp )->texInfo.m_fScale[0], ( *pp )->texInfo.m_fScale[0],
( *pp )->texInfo.m_fRotate ); ( *pp )->texInfo.m_fRotate );
fprintf( pFile, buffer ); fprintf( pFile, "%s", buffer );
} }
fprintf( pFile, "}\n" ); fprintf( pFile, "}\n" );

View file

@ -393,7 +393,6 @@ void idSplineList::setSelectedPoint( idVec3 *p ) {
const idVec3 *idSplineList::getPosition( long t ) { const idVec3 *idSplineList::getPosition( long t ) {
static idVec3 interpolatedPos; static idVec3 interpolatedPos;
static long lastTime = -1;
int count = splineTime.Num(); int count = splineTime.Num();
if ( count == 0 ) { if ( count == 0 ) {
@ -644,7 +643,6 @@ bool idCameraDef::waitEvent( int index ) {
void idCameraDef::buildCamera() { void idCameraDef::buildCamera() {
int i; int i;
int lastSwitch = 0;
idList<float> waits; idList<float> waits;
idList<int> targets; idList<int> targets;
@ -653,7 +651,6 @@ void idCameraDef::buildCamera() {
// we have a base time layout for the path and the target path // we have a base time layout for the path and the target path
// now we need to layer on any wait or speed changes // now we need to layer on any wait or speed changes
for ( i = 0; i < events.Num(); i++ ) { for ( i = 0; i < events.Num(); i++ ) {
idCameraEvent *ev = events[i];
events[i]->setTriggered( false ); events[i]->setTriggered( false );
switch ( events[i]->getType() ) { switch ( events[i]->getType() ) {
case idCameraEvent::EVENT_TARGET: { case idCameraEvent::EVENT_TARGET: {
@ -864,7 +861,8 @@ void idCameraDef::parse( const char *( *text ) ) {
bool idCameraDef::load( const char *filename ) { bool idCameraDef::load( const char *filename ) {
char *buf; char *buf;
const char *buf_p; const char *buf_p;
int length = FS_ReadFile( filename, (void **)&buf );
FS_ReadFile( filename, (void **)&buf );
if ( !buf ) { if ( !buf ) {
return false; return false;
} }
@ -1363,7 +1361,6 @@ void idSplinePosition::write( fileHandle_t file, const char *p ) {
} }
void idCameraDef::addTarget( const char *name, idCameraPosition::positionType type ) { void idCameraDef::addTarget( const char *name, idCameraPosition::positionType type ) {
const char *text = ( name == NULL ) ? va( "target0%d", numTargets() + 1 ) : name;
idCameraPosition *pos = newFromType( type ); idCameraPosition *pos = newFromType( type );
if ( pos ) { if ( pos ) {
pos->setName( name ); pos->setName( name );

View file

@ -487,9 +487,6 @@ void TestStringClass
i = a.length(); // i == 0 i = a.length(); // i == 0
i = c.length(); // i == 4 i = c.length(); // i == 4
const char *s1 = a.c_str(); // s1 == "\0"
const char *s2 = c.c_str(); // s2 == "test\0"
t = new idStr(); // t->len == 0, t->data == "\0" t = new idStr(); // t->len == 0, t->data == "\0"
delete t; // t == ? delete t; // t == ?

View file

@ -65,7 +65,7 @@ void Syn_Printf( const char *text, ... ){
va_start( args, text ); va_start( args, text );
vsnprintf( buf, BUFFER_SIZE, text, args ); vsnprintf( buf, BUFFER_SIZE, text, args );
buf[BUFFER_SIZE - 1] = 0; buf[BUFFER_SIZE - 1] = 0;
printf( buf ); printf( "%s", buf );
va_end( args ); va_end( args );
} }
} }

View file

@ -133,8 +133,6 @@ static void LoadIDSP( const char *name, byte ** pic, int *width, int *height ){
dspriteframetype_t *pframetype; dspriteframetype_t *pframetype;
int version; int version;
int numframes; int numframes;
int size;
spriteframetype_t frametype;
dspriteframe_t *spriteframe; dspriteframe_t *spriteframe;
*pic = NULL; *pic = NULL;
@ -201,7 +199,7 @@ static void LoadIDSP( const char *name, byte ** pic, int *width, int *height ){
*pic = bmpRGBA; *pic = bmpRGBA;
#ifdef DEBUG #ifdef DEBUG
frametype = spriteframetype_t( LittleLong( pframetype->type ) ); spriteframetype_t frametype = spriteframetype_t( LittleLong( pframetype->type ) );
if ( frametype == SPR_SINGLE ) { if ( frametype == SPR_SINGLE ) {
Sys_Printf( "Single Frame\n" ); Sys_Printf( "Single Frame\n" );
} }

View file

@ -219,7 +219,6 @@ static void on_cancel_button_clicked( GtkButton *button, gpointer user_data );
void IsFaceConflicting(){ void IsFaceConflicting(){
texdef_t* tmp_texdef; texdef_t* tmp_texdef;
texdef_to_face_t* temp_texdef_face_list; texdef_to_face_t* temp_texdef_face_list;
char buf[12];
char texture_name[128]; char texture_name[128];
if ( texdef_face_list_empty() ) { if ( texdef_face_list_empty() ) {
@ -328,7 +327,6 @@ static void PopulateTextureComboList(){
texdef_to_face_t* temp_texdef_face_list; texdef_to_face_t* temp_texdef_face_list;
char blank[1]; char blank[1];
GList *items = NULL; GList *items = NULL;
GList *tmp_item;
int num_of_list_items = 0; int num_of_list_items = 0;
blank[0] = 0; blank[0] = 0;
@ -390,7 +388,6 @@ static void GetTexdefInfo_from_Radiant(){
g_texdef_face_vector.resize( count ); g_texdef_face_vector.resize( count );
if ( !texdef_face_list_empty() ) { if ( !texdef_face_list_empty() ) {
texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() ); GetSelFacesTexdef( get_texdef_face_list() );
} }
@ -1861,7 +1858,6 @@ static void on_fit_button_clicked( GtkButton *button, gpointer user_data ){
// Axial Button // Axial Button
static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){ static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
texdef_t* tmp_texdef; texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list; texdef_to_face_t* temp_texdef_face_list;
if ( !texdef_face_list_empty() && g_bListenChanged ) { if ( !texdef_face_list_empty() && g_bListenChanged ) {

View file

@ -220,7 +220,6 @@ static void on_cancel_button_clicked( GtkButton *button, gpointer user_data );
void IsFaceConflicting(){ void IsFaceConflicting(){
texdef_t* tmp_texdef; texdef_t* tmp_texdef;
texdef_to_face_t* temp_texdef_face_list; texdef_to_face_t* temp_texdef_face_list;
char buf[12];
char texture_name[128]; char texture_name[128];
if ( texdef_face_list_empty() ) { if ( texdef_face_list_empty() ) {
@ -329,7 +328,6 @@ static void PopulateTextureComboList(){
texdef_to_face_t* temp_texdef_face_list; texdef_to_face_t* temp_texdef_face_list;
char blank[1]; char blank[1];
GList *items = NULL; GList *items = NULL;
GList *tmp_item;
int num_of_list_items = 0; int num_of_list_items = 0;
blank[0] = 0; blank[0] = 0;
@ -391,7 +389,6 @@ static void GetTexdefInfo_from_Radiant(){
g_texdef_face_vector.resize( count ); g_texdef_face_vector.resize( count );
if ( !texdef_face_list_empty() ) { if ( !texdef_face_list_empty() ) {
texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() ); GetSelFacesTexdef( get_texdef_face_list() );
} }
@ -1861,7 +1858,6 @@ static void on_fit_button_clicked( GtkButton *button, gpointer user_data ){
// Axial Button // Axial Button
static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){ static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
texdef_t* tmp_texdef; texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list; texdef_to_face_t* temp_texdef_face_list;
if ( !texdef_face_list_empty() && g_bListenChanged ) { if ( !texdef_face_list_empty() && g_bListenChanged ) {

View file

@ -426,43 +426,29 @@ void Input( char*& pBuffer ){
const char *fields[5] = { "", "", "", "", "" }; const char *fields[5] = { "", "", "", "", "" };
float values[5]; float values[5];
for ( int n = 0; n < g_nVariableCount; n++ ) for ( int n = 0; n < 5 && n < g_nVariableCount; n++ )
{ {
if ( g_Variables[n].m_strInput.GetLength() > 0 ) { if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
bGo = true; bGo = true;
if ( n < 5 ) { fields[n] = g_Variables[n].m_strInput.GetBuffer();
switch ( n )
{
case 0: fields[1] = g_Variables[n].m_strInput.GetBuffer(); break;
case 1: fields[2] = g_Variables[n].m_strInput.GetBuffer(); break;
case 2: fields[3] = g_Variables[n].m_strInput.GetBuffer(); break;
case 3: fields[4] = g_Variables[n].m_strInput.GetBuffer(); break;
case 4: fields[5] = g_Variables[n].m_strInput.GetBuffer(); break;
}
}
} }
} }
if ( bGo ) { if ( !bGo ) {
if ( DoBSInputDlg( fields, values ) == IDOK ) { return;
for ( int n = 0; n < g_nVariableCount; n++ ) }
if ( DoBSInputDlg( fields, values ) != IDOK ) {
g_bKeepGoing = false;
return;
}
for ( int n = 0; n < 5 && n < g_nVariableCount; n++ )
{ {
if ( g_Variables[n].m_strInput.GetLength() > 0 ) { if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
if ( n < 5 ) { g_Variables[n].m_fValue = values[n];
switch ( n )
{
case 0: g_Variables[n].m_fValue = values[1]; break;
case 1: g_Variables[n].m_fValue = values[2]; break;
case 2: g_Variables[n].m_fValue = values[3]; break;
case 3: g_Variables[n].m_fValue = values[4]; break;
case 4: g_Variables[n].m_fValue = values[5]; break;
} }
} }
}
}
}
else{ g_bKeepGoing = false; }
}
} }
bool g_bWaiting; bool g_bWaiting;

View file

@ -1145,7 +1145,7 @@ void RunBsp( char *command ){
Error( "Can't write to %s", batpath ); Error( "Can't write to %s", batpath );
} }
fprintf( hFile, "#!/bin/sh \n\n" ); fprintf( hFile, "#!/bin/sh \n\n" );
fprintf( hFile, strSys.GetBuffer() ); fprintf( hFile, "%s", strSys.GetBuffer() );
fclose( hFile ); fclose( hFile );
chmod( batpath, 0744 ); chmod( batpath, 0744 );
#endif #endif
@ -1158,7 +1158,7 @@ void RunBsp( char *command ){
if ( !hFile ) { if ( !hFile ) {
Error( "Can't write to %s", batpath ); Error( "Can't write to %s", batpath );
} }
fprintf( hFile, strSys.GetBuffer() ); fprintf( hFile, "%s", strSys.GetBuffer() );
fclose( hFile ); fclose( hFile );
#endif #endif

View file

@ -244,7 +244,7 @@ char *ExpandArg( const char *path ){
char *ExpandPath( const char *path ){ char *ExpandPath( const char *path ){
static char full[1024]; static char full[1024];
if ( !qdir ) { if ( !qdir[0] ) {
Error( "ExpandPath called without qdir set" ); Error( "ExpandPath called without qdir set" );
} }
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) { if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
@ -257,7 +257,7 @@ char *ExpandPath( const char *path ){
char *ExpandGamePath( const char *path ){ char *ExpandGamePath( const char *path ){
static char full[1024]; static char full[1024];
if ( !qdir ) { if ( !qdir[0] ) {
Error( "ExpandGamePath called without qdir set" ); Error( "ExpandGamePath called without qdir set" );
} }
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) { if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {

View file

@ -53,7 +53,7 @@
#endif #endif
#define MAX_OS_PATH 1024 #define MAX_OS_PATH 4096
#define MEM_BLOCKSIZE 4096 #define MEM_BLOCKSIZE 4096
// the dec offsetof macro doesnt work very well... // the dec offsetof macro doesnt work very well...

View file

@ -265,7 +265,7 @@ void FPrintf( int flag, char *buf ){
static qboolean bGotXML = qfalse; static qboolean bGotXML = qfalse;
char level[2]; char level[2];
printf( buf ); printf( "%s", buf );
// the following part is XML stuff only.. but maybe we don't want that message to go down the XML pipe? // the following part is XML stuff only.. but maybe we don't want that message to go down the XML pipe?
if ( flag == SYS_NOXML ) { if ( flag == SYS_NOXML ) {

View file

@ -3179,7 +3179,7 @@ void SetupEnvelopes( qboolean forGrid, qboolean fastFlag ){
int i, x, y, z, x1, y1, z1; int i, x, y, z, x1, y1, z1;
light_t *light, *light2, **owner; light_t *light, *light2, **owner;
bspLeaf_t *leaf; bspLeaf_t *leaf;
vec3_t origin, dir, mins, maxs, nullVector = { 0, 0, 0 }; vec3_t origin, dir, mins, maxs;
float radius, intensity; float radius, intensity;
light_t *buckets[ 256 ]; light_t *buckets[ 256 ];

View file

@ -46,6 +46,38 @@ vec_t Random( void ){
} }
char *Q_strncpyz( char *dst, const char *src, size_t len ) {
if ( len == 0 ) {
abort();
}
strncpy( dst, src, len );
dst[ len - 1 ] = '\0';
return dst;
}
char *Q_strcat( char *dst, size_t dlen, const char *src ) {
size_t n = strlen( dst );
if ( n > dlen ) {
abort(); /* buffer overflow */
}
return Q_strncpyz( dst + n, src, dlen - n );
}
char *Q_strncat( char *dst, size_t dlen, const char *src, size_t slen ) {
size_t n = strlen( dst );
if ( n > dlen ) {
abort(); /* buffer overflow */
}
return Q_strncpyz( dst + n, src, MIN( slen, dlen - n ) );
}
/* /*
ExitQ3Map() ExitQ3Map()

View file

@ -66,29 +66,23 @@ char *LokiGetHomeDir( void ){
#ifndef Q_UNIX #ifndef Q_UNIX
return NULL; return NULL;
#else #else
static char buf[ 4096 ];
struct passwd pw, *pwp;
char *home; char *home;
uid_t id;
struct passwd *pwd;
/* get the home environment variable */ /* get the home environment variable */
home = getenv( "HOME" ); home = getenv( "HOME" );
if ( home == NULL ) { if ( home ) {
/* do some more digging */ return Q_strncpyz( buf, home, sizeof( buf ) );
id = getuid();
setpwent();
while ( ( pwd = getpwent() ) != NULL )
{
if ( pwd->pw_uid == id ) {
home = pwd->pw_dir;
break;
}
}
endpwent();
} }
/* return it */ /* look up home dir in password database */
return home; if ( getpwuid_r( getuid(), &pw, buf, sizeof( buf ), &pwp ) == 0 ) {
return pw.pw_dir;
}
return NULL;
#endif #endif
} }
@ -117,20 +111,16 @@ void LokiInitPaths( char *argv0 ){
home = "."; home = ".";
} }
path = getenv( "PATH" );
/* do some path divining */ /* do some path divining */
strcpy( temp, argv0 ); Q_strncpyz( temp, argv0, sizeof( temp ) );
if ( strrchr( temp, '/' ) ) { if ( strrchr( temp, '/' ) ) {
argv0 = strrchr( argv0, '/' ) + 1; argv0 = strrchr( argv0, '/' ) + 1;
} }
else else if ( path ) {
{
/* get path environment variable */
path = getenv( "PATH" );
/* minor setup */
last[ 0 ] = path[ 0 ];
last[ 1 ] = '\0';
found = qfalse; found = qfalse;
last = path;
/* go through each : segment of path */ /* go through each : segment of path */
while ( last[ 0 ] != '\0' && found == qfalse ) while ( last[ 0 ] != '\0' && found == qfalse )
@ -146,17 +136,17 @@ void LokiInitPaths( char *argv0 ){
/* found home dir candidate */ /* found home dir candidate */
if ( *path == '~' ) { if ( *path == '~' ) {
strcpy( temp, home ); Q_strncpyz( temp, home, sizeof( temp ) );
path++; path++;
} }
/* concatenate */ /* concatenate */
if ( last > ( path + 1 ) ) { if ( last > ( path + 1 ) ) {
strncat( temp, path, ( last - path ) ); Q_strncat( temp, sizeof( temp ), path, ( last - path ) );
strcat( temp, "/" ); Q_strcat( temp, sizeof( temp ), "/" );
} }
strcat( temp, "./" ); Q_strcat( temp, sizeof( temp ), "./" );
strcat( temp, argv0 ); Q_strcat( temp, sizeof( temp ), argv0 );
/* verify the path */ /* verify the path */
if ( access( temp, X_OK ) == 0 ) { if ( access( temp, X_OK ) == 0 ) {

View file

@ -83,6 +83,8 @@
#include <stdlib.h> #include <stdlib.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
/* ------------------------------------------------------------------------------- /* -------------------------------------------------------------------------------
@ -1446,6 +1448,9 @@ surfaceInfo_t;
/* main.c */ /* main.c */
vec_t Random( void ); vec_t Random( void );
char *Q_strncpyz( char *dst, const char *src, size_t len );
char *Q_strcat( char *dst, size_t dlen, const char *src );
char *Q_strncat( char *dst, size_t dlen, const char *src, size_t slen );
int BSPInfo( int count, char **fileNames ); int BSPInfo( int count, char **fileNames );
int ScaleBSPMain( int argc, char **argv ); int ScaleBSPMain( int argc, char **argv );
int ConvertMain( int argc, char **argv ); int ConvertMain( int argc, char **argv );