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( CPPDEFINES = [ '_DEBUG' ] )
else:
# '-O' causes q3map2 errors on Ubuntu 10.10 32 bit.
env.Append( CFLAGS = [ ] )
env.Append( CXXFLAGS = [ ] )
env.Append( CFLAGS = [ '-O2', '-fno-strict-aliasing' ] )
env.Append( CXXFLAGS = [ '-O2', '-fno-strict-aliasing' ] )
def CheckoutOrUpdate( self, svnurl, 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_fRotate );
fprintf( pFile, buffer );
fprintf( pFile, "%s", buffer );
}
fprintf( pFile, "}\n" );

View file

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

View file

@ -487,9 +487,6 @@ void TestStringClass
i = a.length(); // i == 0
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"
delete t; // t == ?

View file

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

View file

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

View file

@ -219,7 +219,6 @@ static void on_cancel_button_clicked( GtkButton *button, gpointer user_data );
void IsFaceConflicting(){
texdef_t* tmp_texdef;
texdef_to_face_t* temp_texdef_face_list;
char buf[12];
char texture_name[128];
if ( texdef_face_list_empty() ) {
@ -328,7 +327,6 @@ static void PopulateTextureComboList(){
texdef_to_face_t* temp_texdef_face_list;
char blank[1];
GList *items = NULL;
GList *tmp_item;
int num_of_list_items = 0;
blank[0] = 0;
@ -390,7 +388,6 @@ static void GetTexdefInfo_from_Radiant(){
g_texdef_face_vector.resize( count );
if ( !texdef_face_list_empty() ) {
texdef_to_face_t* p = 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
static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
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(){
texdef_t* tmp_texdef;
texdef_to_face_t* temp_texdef_face_list;
char buf[12];
char texture_name[128];
if ( texdef_face_list_empty() ) {
@ -329,7 +328,6 @@ static void PopulateTextureComboList(){
texdef_to_face_t* temp_texdef_face_list;
char blank[1];
GList *items = NULL;
GList *tmp_item;
int num_of_list_items = 0;
blank[0] = 0;
@ -391,7 +389,6 @@ static void GetTexdefInfo_from_Radiant(){
g_texdef_face_vector.resize( count );
if ( !texdef_face_list_empty() ) {
texdef_to_face_t* p = 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
static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
if ( !texdef_face_list_empty() && g_bListenChanged ) {

View file

@ -426,42 +426,28 @@ void Input( char*& pBuffer ){
const char *fields[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 ) {
bGo = true;
if ( n < 5 ) {
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;
}
}
fields[n] = g_Variables[n].m_strInput.GetBuffer();
}
}
if ( bGo ) {
if ( DoBSInputDlg( fields, values ) == IDOK ) {
for ( int n = 0; n < g_nVariableCount; n++ )
{
if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
if ( n < 5 ) {
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;
}
}
}
}
if ( !bGo ) {
return;
}
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 ) {
g_Variables[n].m_fValue = values[n];
}
else{ g_bKeepGoing = false; }
}
}

View file

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

View file

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

View file

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

View file

@ -265,7 +265,7 @@ void FPrintf( int flag, char *buf ){
static qboolean bGotXML = qfalse;
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?
if ( flag == SYS_NOXML ) {

View file

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

View file

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

View file

@ -83,6 +83,8 @@
#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 */
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 ScaleBSPMain( int argc, char **argv );
int ConvertMain( int argc, char **argv );