Merge pull request #591 from illwieckz/diffnoise

tools: reduce diff noise with NetRadiant
This commit is contained in:
Timothee "TTimo" Besset 2018-01-27 16:29:58 -06:00 committed by GitHub
commit e3bf363a63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 442 additions and 410 deletions

View file

@ -173,16 +173,16 @@ enum
/* convenience (makes it easy to add new params to the callbacks) */
#define PM_PARAMS_CANLOAD \
char *fileName, const void *buffer, int bufSize
const char *fileName, const void *buffer, int bufSize
#define PM_PARAMS_LOAD \
char *fileName, int frameNum, const void *buffer, int bufSize
const char *fileName, int frameNum, const void *buffer, int bufSize
#define PM_PARAMS_CANSAVE \
void
#define PM_PARAMS_SAVE \
char *fileName, picoModel_t * model
const char *fileName, picoModel_t * model
/* pico file format module structure */
struct picoModule_s
@ -209,13 +209,13 @@ int PicoError( void );
void PicoSetMallocFunc( void *( *func )( size_t ) );
void PicoSetFreeFunc( void ( *func )( void* ) );
void PicoSetLoadFileFunc( void ( *func )( char*, unsigned char**, int* ) );
void PicoSetLoadFileFunc( void ( *func )( const char*, unsigned char**, int* ) );
void PicoSetFreeFileFunc( void ( *func )( void* ) );
void PicoSetPrintFunc( void ( *func )( int, const char* ) );
const picoModule_t **PicoModuleList( int *numModules );
picoModel_t *PicoLoadModel( char *name, int frameNum );
picoModel_t *PicoLoadModel( const char *name, int frameNum );
typedef size_t(*PicoInputStreamReadFunc)(void* inputStream, unsigned char* buffer, size_t length);
picoModel_t* PicoModuleLoadModelStream(const picoModule_t* module, void* inputStream, PicoInputStreamReadFunc inputStreamRead, size_t streamLength, int frameNum);
@ -241,8 +241,8 @@ int PicoAdjustSurface( picoSurface_t *surface, int numVe
/* setter functions */
void PicoSetModelName( picoModel_t *model, char *name );
void PicoSetModelFileName( picoModel_t *model, char *fileName );
void PicoSetModelName( picoModel_t *model, const char *name );
void PicoSetModelFileName( picoModel_t *model, const char *fileName );
void PicoSetModelFrameNum( picoModel_t *model, int frameNum );
void PicoSetModelNumFrames( picoModel_t *model, int numFrames );
void PicoSetModelData( picoModel_t *model, void *data );

View file

@ -43,7 +43,7 @@ static int compare_keys( lwKey *k1, lwKey *k2 ){
lwEnvelope *lwGetEnvelope( picoMemStream_t *fp, int cksize ){
lwEnvelope *env;
lwKey *key;
lwKey *key = NULL;
lwPlugin *plug;
unsigned int id;
unsigned short sz;

View file

@ -450,7 +450,7 @@ char *sgetS0( unsigned char **bp ){
return NULL;
}
len = strlen( (char *) buf ) + 1;
len = strlen( (const char *) buf ) + 1;
if ( len == 1 ) {
flen += 2;
*bp += 2;

View file

@ -76,12 +76,12 @@ void lwFreeObject( lwObject *object ){
If you don't need this information, failID and failpos can be NULL.
====================================================================== */
lwObject *lwGetObject( char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos ){
lwObject *lwGetObject( const char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos ){
lwObject *object;
lwLayer *layer;
lwNode *node;
unsigned int id, formsize, type, cksize;
int i, rlen;
unsigned int id, formsize, type;
int i, rlen, cksize;
/* open the file */
@ -266,7 +266,7 @@ lwObject *lwGetObject( char *filename, picoMemStream_t *fp, unsigned int *failID
/* end of the file? */
if ( formsize <= _pico_memstream_tell( fp ) - 8 ) {
if ( formsize <= (unsigned int) ( _pico_memstream_tell( fp ) - 8 ) ) {
break;
}
@ -320,8 +320,8 @@ Fail:
return NULL;
}
int lwValidateObject( char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos ){
unsigned int id, formsize, type;
int lwValidateObject( const char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos ){
unsigned int id, type;
/* open the file */
@ -333,7 +333,7 @@ int lwValidateObject( char *filename, picoMemStream_t *fp, unsigned int *failID,
set_flen( 0 );
id = getU4( fp );
formsize = getU4( fp );
/* formsize = */ getU4( fp );
type = getU4( fp );
if ( 12 != get_flen() ) {
return PICO_PMV_ERROR_SIZE;

View file

@ -539,8 +539,8 @@ typedef struct st_lwObject {
void lwFreeLayer( lwLayer *layer );
void lwFreeObject( lwObject *object );
lwObject *lwGetObject( char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos );
int lwValidateObject( char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos );
lwObject *lwGetObject( const char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos );
int lwValidateObject( const char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos );
/* pntspols.c */
@ -600,8 +600,8 @@ lwSurface *lwDefaultSurface( void );
lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj );
int lwGetPolygons5( picoMemStream_t *fp, int cksize, lwPolygonList *plist, int ptoffset );
lwObject *lwGetObject5( char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos );
int lwValidateObject5( char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos );
lwObject *lwGetObject5( const char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos );
int lwValidateObject5( const char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos );
/* list.c */

View file

@ -202,8 +202,8 @@ static lwTexture *get_texture( char *s ){
lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
lwSurface *surf;
lwTexture *tex;
lwPlugin *shdr;
lwTexture *tex = NULL;
lwPlugin *shdr = NULL;
char *s;
float v[ 3 ];
unsigned int id, flags;
@ -246,9 +246,6 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
goto Fail;
}
tex = NULL;
shdr = NULL;
/* process subchunks as they're encountered */
while ( 1 ) {
@ -385,11 +382,14 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
break;
case ID_TFLG:
if( tex == NULL ) {
goto Fail;
}
flags = getU2( fp );
if( tex == NULL ) {
break;
}
i = -1;
//only one of the three axis bits should be set
if ( flags & 1 ) {
tex->axis = 0;
@ -401,6 +401,9 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
assert( flags & 4 );
tex->axis = 2;
}
if ( !tex ) {
goto Fail;
}
if ( tex->type == ID_IMAP ) {
tex->param.imap.axis = i;
@ -425,32 +428,32 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
break;
case ID_TSIZ:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
for ( i = 0; i < 3; i++ )
tex->tmap.size.val[ i ] = getF4( fp );
break;
case ID_TCTR:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
for ( i = 0; i < 3; i++ )
tex->tmap.center.val[ i ] = getF4( fp );
break;
case ID_TFAL:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
for ( i = 0; i < 3; i++ )
tex->tmap.falloff.val[ i ] = getF4( fp );
break;
case ID_TVEL:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
for ( i = 0; i < 3; i++ )
v[ i ] = getF4( fp );
@ -459,8 +462,8 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
break;
case ID_TCLR:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
if ( tex->type == ID_PROC ) {
for ( i = 0; i < 3; i++ )
@ -469,15 +472,15 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
break;
case ID_TVAL:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
tex->param.proc.value[ 0 ] = getI2( fp ) / 256.0f;
break;
case ID_TAMP:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
if ( tex->type == ID_IMAP ) {
tex->param.imap.amplitude.val = getF4( fp );
@ -485,38 +488,38 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
break;
case ID_TIMG:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
s = getS0( fp );
tex->param.imap.cindex = add_clip( s, &obj->clip, &obj->nclips );
break;
case ID_TAAS:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
tex->param.imap.aa_strength = getF4( fp );
tex->param.imap.aas_flags = 1;
break;
case ID_TREF:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
tex->tmap.ref_object = getbytes( fp, sz );
break;
case ID_TOPC:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
tex->opacity.val = getF4( fp );
break;
case ID_TFP0:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
if ( tex->type == ID_IMAP ) {
tex->param.imap.wrapw.val = getF4( fp );
@ -524,8 +527,8 @@ lwSurface *lwGetSurface5( picoMemStream_t *fp, int cksize, lwObject *obj ){
break;
case ID_TFP1:
if( tex == NULL ) {
break;
if ( !tex ) {
goto Fail;
}
if ( tex->type == ID_IMAP ) {
tex->param.imap.wraph.val = getF4( fp );
@ -701,7 +704,7 @@ Fail:
If you don't need this information, failID and failpos can be NULL.
====================================================================== */
lwObject *lwGetObject5( char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos ){
lwObject *lwGetObject5( const char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos ){
lwObject *object;
lwLayer *layer;
lwNode *node;
@ -837,7 +840,7 @@ Fail:
return NULL;
}
int lwValidateObject5( char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos ){
int lwValidateObject5( const char *filename, picoMemStream_t *fp, unsigned int *failID, int *failpos ){
unsigned int id, formsize, type;

View file

@ -52,7 +52,7 @@
/* function pointers */
void *( *_pico_ptr_malloc )( size_t ) = malloc;
void ( *_pico_ptr_free )( void* ) = free;
void ( *_pico_ptr_load_file )( char*, unsigned char**, int* ) = NULL;
void ( *_pico_ptr_load_file )( const char*, unsigned char**, int* ) = NULL;
void ( *_pico_ptr_free_file )( void* ) = NULL;
void ( *_pico_ptr_print )( int, const char* ) = NULL;
@ -201,7 +201,7 @@ void _pico_free( void *ptr ){
/* _pico_load_file:
* wrapper around the loadfile function pointer
*/
void _pico_load_file( char *name, unsigned char **buffer, int *bufSize ){
void _pico_load_file( const char *name, unsigned char **buffer, int *bufSize ){
/* sanity checks */
if ( name == NULL ) {
*bufSize = -1;
@ -542,7 +542,7 @@ float _pico_big_float( float src ){
/* _pico_stristr:
* case-insensitive strstr. -sea
*/
char *_pico_stristr( char *str, const char *substr ){
const char *_pico_stristr( const char *str, const char *substr ){
const size_t sublen = strlen( substr );
while ( *str )
{
@ -738,7 +738,7 @@ void _pico_parse_skip_white( picoParser_t *p, int *hasLFs ){
/* _pico_new_parser:
* allocates a new ascii parser object.
*/
picoParser_t *_pico_new_parser( picoByte_t *buffer, int bufSize ){
picoParser_t *_pico_new_parser( const picoByte_t *buffer, int bufSize ){
picoParser_t *p;
/* sanity check */
@ -762,7 +762,7 @@ picoParser_t *_pico_new_parser( picoByte_t *buffer, int bufSize ){
return NULL;
}
/* setup */
p->buffer = (char *)buffer;
p->buffer = (const char *)buffer;
p->cursor = p->buffer;
p->bufSize = bufSize;
p->max = p->buffer + bufSize;
@ -798,7 +798,7 @@ void _pico_free_parser( picoParser_t *p ){
*/
int _pico_parse_ex( picoParser_t *p, int allowLFs, int handleQuoted ){
int hasLFs = 0;
char *old;
const char *old;
/* sanity checks */
if ( p == NULL || p->buffer == NULL ||
@ -1220,7 +1220,7 @@ int _pico_parse_vec4_def( picoParser_t *p, picoVec4_t out, picoVec4_t def ){
/* _pico_new_memstream:
* allocates a new memorystream object.
*/
picoMemStream_t *_pico_new_memstream( picoByte_t *buffer, int bufSize ){
picoMemStream_t *_pico_new_memstream( const picoByte_t *buffer, int bufSize ){
picoMemStream_t *s;
/* sanity check */

View file

@ -79,22 +79,22 @@ extern "C"
/* types */
typedef struct picoParser_s
{
char *buffer;
const char *buffer;
int bufSize;
char *token;
char *token;
int tokenSize;
int tokenMax;
char *cursor;
char *max;
const char *cursor;
const char *max;
int curLine;
}
picoParser_t;
typedef struct picoMemStream_s
{
picoByte_t *buffer;
const picoByte_t *buffer;
int bufSize;
picoByte_t *curPos;
picoByte_t *curPos;
int flag;
}
picoMemStream_t;
@ -105,7 +105,7 @@ extern const picoModule_t *picoModules[];
extern void *( *_pico_ptr_malloc )( size_t );
extern void ( *_pico_ptr_free )( void* );
extern void ( *_pico_ptr_load_file )( char*, unsigned char**, int* );
extern void ( *_pico_ptr_load_file )( const char*, unsigned char**, int* );
extern void ( *_pico_ptr_free_file )( void* );
extern void ( *_pico_ptr_print )( int, const char* );
@ -121,7 +121,7 @@ char *_pico_clone_alloc( const char *str );
void _pico_free( void *ptr );
/* files */
void _pico_load_file( char *name, unsigned char **buffer, int *bufSize );
void _pico_load_file( const char *name, unsigned char **buffer, int *bufSize );
void _pico_free_file( void *buffer );
/* strings */
@ -130,7 +130,7 @@ char *_pico_strltrim( char *str );
char *_pico_strrtrim( char *str );
int _pico_strchcount( char *str, int ch );
void _pico_printf( int level, const char *format, ... );
char *_pico_stristr( char *str, const char *substr );
const char *_pico_stristr( const char *str, const char *substr );
void _pico_unixify( char *path );
int _pico_nofname( const char *path, char *dest, int destSize );
const char *_pico_nopath( const char *path );
@ -169,7 +169,7 @@ short _pico_little_short( short src );
float _pico_little_float( float src );
/* pico ascii parser */
picoParser_t *_pico_new_parser( picoByte_t *buffer, int bufSize );
picoParser_t *_pico_new_parser( const picoByte_t *buffer, int bufSize );
void _pico_free_parser( picoParser_t *p );
int _pico_parse_ex( picoParser_t *p, int allowLFs, int handleQuoted );
char *_pico_parse_first( picoParser_t *p );
@ -190,7 +190,7 @@ int _pico_parse_vec4( picoParser_t *p, picoVec4_t out );
int _pico_parse_vec4_def( picoParser_t *p, picoVec4_t out, picoVec4_t def );
/* pico memory stream */
picoMemStream_t *_pico_new_memstream( picoByte_t *buffer, int bufSize );
picoMemStream_t *_pico_new_memstream( const picoByte_t *buffer, int bufSize );
void _pico_free_memstream( picoMemStream_t *s );
int _pico_memstream_read( picoMemStream_t *s, void *buffer, int len );
int _pico_memstream_getc( picoMemStream_t *s );

View file

@ -111,7 +111,7 @@ void PicoSetFreeFunc( void ( *func )( void* ) ){
sets the ptr to the file load function
*/
void PicoSetLoadFileFunc( void ( *func )( char*, unsigned char**, int* ) ){
void PicoSetLoadFileFunc( void ( *func )( const char*, unsigned char**, int* ) ){
if ( func != NULL ) {
_pico_ptr_load_file = func;
}
@ -143,7 +143,7 @@ void PicoSetPrintFunc( void ( *func )( int, const char* ) ){
}
}
picoModel_t *PicoModuleLoadModel( const picoModule_t* pm, char* fileName, picoByte_t* buffer, int bufSize, int frameNum ){
picoModel_t *PicoModuleLoadModel( const picoModule_t* pm, const char* fileName, picoByte_t* buffer, int bufSize, int frameNum ){
char *modelFileName, *remapFileName;
/* see whether this module can load the model file or not */
@ -188,7 +188,7 @@ picoModel_t *PicoModuleLoadModel( const picoModule_t* pm, char* fileName, picoBy
the meat and potatoes function
*/
picoModel_t *PicoLoadModel( char *fileName, int frameNum ){
picoModel_t *PicoLoadModel( const char *fileName, int frameNum ){
const picoModule_t **modules, *pm;
picoModel_t *model;
picoByte_t *buffer;
@ -761,7 +761,7 @@ picoSurface_t *PicoFindSurface(
PicoSet*() Setter Functions
----------------------------------------------------------------------------*/
void PicoSetModelName( picoModel_t *model, char *name ){
void PicoSetModelName( picoModel_t *model, const char *name ){
if ( model == NULL || name == NULL ) {
return;
}
@ -774,7 +774,7 @@ void PicoSetModelName( picoModel_t *model, char *name ){
void PicoSetModelFileName( picoModel_t *model, char *fileName ){
void PicoSetModelFileName( picoModel_t *model, const char *fileName ){
if ( model == NULL || fileName == NULL ) {
return;
}

View file

@ -163,21 +163,18 @@ T3dsChunk;
* validates an autodesk 3ds model file.
*/
static int _3ds_canload( PM_PARAMS_CANLOAD ){
T3dsChunk *chunk;
/* to keep the compiler happy */
*fileName = *fileName;
const T3dsChunk *chunk;
/* sanity check */
if ( bufSize < sizeof( T3dsChunk ) ) {
if ( bufSize < (int) sizeof( T3dsChunk ) ) {
return PICO_PMV_ERROR_SIZE;
}
/* get pointer to 3ds header chunk */
chunk = (T3dsChunk *)buffer;
chunk = (const T3dsChunk *)buffer;
/* check data length */
if ( bufSize < _pico_little_long( chunk->len ) ) {
if ( bufSize < (int) _pico_little_long( chunk->len ) ) {
return PICO_PMV_ERROR_SIZE;
}
@ -741,7 +738,8 @@ static picoModel_t *_3ds_load( PM_PARAMS_LOAD ){
/* initialize persistant vars (formerly static) */
pers.model = model;
pers.bufptr = (picoByte_t *)buffer;
pers.bufptr = (picoByte_t *)_pico_alloc( bufSize );
memcpy( pers.bufptr, buffer, bufSize );
pers.basename = (char *)basename;
pers.maxofs = bufSize;
pers.cofs = 0L;

View file

@ -208,11 +208,8 @@ static int _ase_canload( PM_PARAMS_CANLOAD ){
return PICO_PMV_ERROR_SIZE;
}
/* keep the friggin compiler happy */
*fileName = *fileName;
/* create pico parser */
p = _pico_new_parser( (picoByte_t*) buffer, bufSize );
p = _pico_new_parser( (const picoByte_t*) buffer, bufSize );
if ( p == NULL ) {
return PICO_PMV_ERROR_MEMORY;
}
@ -515,7 +512,7 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
return NULL; \
}
/* create a new pico parser */
p = _pico_new_parser( (picoByte_t *)buffer,bufSize );
p = _pico_new_parser( (const picoByte_t *)buffer,bufSize );
if ( p == NULL ) {
return NULL;
}
@ -851,7 +848,7 @@ static picoModel_t *_ase_load( PM_PARAMS_LOAD ){
/* model material */
else if ( !_pico_stricmp( p->token, "*material" ) ) {
aseSubMaterial_t* subMaterial = NULL;
picoShader_t *shader;
picoShader_t *shader = NULL;
int level = 1, index;
char materialName[ 1024 ];
float transValue = 0.0f, shineValue = 1.0f;

View file

@ -65,10 +65,11 @@ typedef struct index_DUP_LUT_s
// _fm_canload()
static int _fm_canload( PM_PARAMS_CANLOAD ){
fm_t fm;
unsigned char *bb;
unsigned char *bb, *bb0;
int fm_file_pos;
bb = (unsigned char *) buffer;
bb0 = bb = (picoByte_t*) _pico_alloc( bufSize );
memcpy( bb, buffer, bufSize );
// Header
fm.fm_header_hdr = (fm_chunk_header_t *) bb;
@ -80,6 +81,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM Header Ident incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_IDENT;
}
@ -88,6 +90,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM Header Version incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_VERSION;
}
@ -101,6 +104,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM Skin Ident incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_IDENT;
}
@ -109,6 +113,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM Skin Version incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_VERSION;
}
@ -122,6 +127,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM ST Ident incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_IDENT;
}
@ -130,6 +136,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM ST Version incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_VERSION;
}
@ -143,6 +150,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM Tri Ident incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_IDENT;
}
@ -151,6 +159,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM Tri Version incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_VERSION;
}
@ -164,6 +173,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM Frame Ident incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_IDENT;
}
@ -172,6 +182,7 @@ static int _fm_canload( PM_PARAMS_CANLOAD ){
#ifdef FM_DBG
_pico_printf( PICO_WARNING, "FM Frame Version incorrect\n" );
#endif
_pico_free( bb0 );
return PICO_PMV_ERROR_VERSION;
}
@ -199,7 +210,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
fm_xyz_st_t *triangle;
fm_frame_t *frame;
picoByte_t *bb;
picoByte_t *bb, bb0;
picoModel_t *picoModel;
picoSurface_t *picoSurface;
picoShader_t *picoShader;
@ -211,18 +222,22 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
// fm loading
_pico_printf( PICO_NORMAL, "Loading \"%s\"", fileName );
bb = (picoByte_t*) buffer;
bb0 = bb = (picoByte_t*) _pico_alloc( bufSize );
memcpy( bb, buffer, bufSize );
// Header Header
fm.fm_header_hdr = (fm_chunk_header_t *) bb;
fm_file_pos = sizeof( fm_chunk_header_t ) + fm.fm_header_hdr->size;
if ( ( strcmp( fm.fm_header_hdr->ident, FM_HEADERCHUNKNAME ) ) ) {
_pico_printf( PICO_WARNING, "FM Header Ident incorrect\n" );
_pico_free(bb0);
return NULL;
}
if ( _pico_little_long( fm.fm_header_hdr->version ) != FM_HEADERCHUNKVER ) {
_pico_printf( PICO_WARNING, "FM Header Version incorrect\n" );
_pico_free(bb0);
return NULL;
}
@ -231,11 +246,13 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
fm_file_pos += sizeof( fm_chunk_header_t ) + fm.fm_skin_hdr->size;
if ( ( strcmp( fm.fm_skin_hdr->ident, FM_SKINCHUNKNAME ) ) ) {
_pico_printf( PICO_WARNING, "FM Skin Ident incorrect\n" );
_pico_free(bb0);
return NULL;
}
if ( _pico_little_long( fm.fm_skin_hdr->version ) != FM_SKINCHUNKVER ) {
_pico_printf( PICO_WARNING, "FM Skin Version incorrect\n" );
_pico_free(bb0);
return NULL;
}
@ -244,11 +261,13 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
fm_file_pos += sizeof( fm_chunk_header_t ) + fm.fm_st_hdr->size;
if ( ( strcmp( fm.fm_st_hdr->ident, FM_STCOORDCHUNKNAME ) ) ) {
_pico_printf( PICO_WARNING, "FM ST Ident incorrect\n" );
_pico_free(bb0);
return NULL;
}
if ( _pico_little_long( fm.fm_st_hdr->version ) != FM_STCOORDCHUNKVER ) {
_pico_printf( PICO_WARNING, "FM ST Version incorrect\n" );
_pico_free(bb0);
return NULL;
}
@ -258,10 +277,12 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
if ( ( strcmp( fm.fm_tri_hdr->ident, FM_TRISCHUNKNAME ) ) ) {
_pico_printf( PICO_WARNING, "FM Tri Ident incorrect\n" );
return NULL;
_pico_free(bb0);
}
if ( _pico_little_long( fm.fm_tri_hdr->version ) != FM_TRISCHUNKVER ) {
_pico_printf( PICO_WARNING, "FM Tri Version incorrect\n" );
_pico_free(bb0);
return NULL;
}
@ -270,11 +291,13 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
fm_file_pos += sizeof( fm_chunk_header_t );
if ( ( strcmp( fm.fm_frame_hdr->ident, FM_FRAMESCHUNKNAME ) ) ) {
_pico_printf( PICO_WARNING, "FM Frame Ident incorrect\n" );
_pico_free(bb0);
return NULL;
}
if ( _pico_little_long( fm.fm_frame_hdr->version ) != FM_FRAMESCHUNKVER ) {
_pico_printf( PICO_WARNING, "FM Frame Version incorrect\n" );
_pico_free(bb0);
return NULL;
}
@ -305,11 +328,13 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
// do frame check
if ( fm_head->numFrames < 1 ) {
_pico_printf( PICO_ERROR, "%s has 0 frames!", fileName );
_pico_free(bb0);
return NULL;
}
if ( frameNum < 0 || frameNum >= fm_head->numFrames ) {
_pico_printf( PICO_ERROR, "Invalid or out-of-range FM frame specified" );
_pico_free(bb0);
return NULL;
}
@ -365,6 +390,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
picoModel = PicoNewModel();
if ( picoModel == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model" );
_pico_free(bb0);
return NULL;
}
@ -379,6 +405,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
if ( picoSurface == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model surface" );
PicoFreeModel( picoModel );
_pico_free(bb0);
return NULL;
}
@ -389,6 +416,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
if ( picoShader == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model shader" );
PicoFreeModel( picoModel );
_pico_free(bb0);
return NULL;
}
@ -619,6 +647,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
_pico_free( p_index_LUT_DUPS );
/* return the new pico model */
_pico_free(bb0);
return picoModel;
}

View file

@ -76,7 +76,7 @@ static int _lwo_canload( PM_PARAMS_CANLOAD ){
int ret;
/* create a new pico memorystream */
s = _pico_new_memstream( (picoByte_t *)buffer, bufSize );
s = _pico_new_memstream( (const picoByte_t *)buffer, bufSize );
if ( s == NULL ) {
return PICO_PMV_ERROR_MEMORY;
}
@ -133,7 +133,7 @@ static picoModel_t *_lwo_load( PM_PARAMS_LOAD ){
}
/* create a new pico memorystream */
s = _pico_new_memstream( (picoByte_t *)buffer, bufSize );
s = _pico_new_memstream( (const picoByte_t *)buffer, bufSize );
if ( s == NULL ) {
return NULL;
}

View file

@ -299,21 +299,18 @@ float md2_normals[ MD2_NUMVERTEXNORMALS ][ 3 ] =
// _md2_canload()
static int _md2_canload( PM_PARAMS_CANLOAD ){
md2_t *md2;
/* to keep the compiler happy */
*fileName = *fileName;
const md2_t *md2;
/* sanity check */
if ( bufSize < ( sizeof( *md2 ) * 2 ) ) {
if ( (size_t) bufSize < ( sizeof( *md2 ) * 2 ) ) {
return PICO_PMV_ERROR_SIZE;
}
/* set as md2 */
md2 = (md2_t*) buffer;
md2 = (const md2_t*) buffer;
/* check md2 magic */
if ( *( (int*) md2->magic ) != *( (int*) MD2_MAGIC ) ) {
if ( *( (const int*) md2->magic ) != *( (const int*) MD2_MAGIC ) ) {
return PICO_PMV_ERROR_IDENT;
}
@ -346,7 +343,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
md2Triangle_t *triangle;
md2XyzNormal_t *vertex;
picoByte_t *bb;
picoByte_t *bb, *bb0;
picoModel_t *picoModel;
picoSurface_t *picoSurface;
picoShader_t *picoShader;
@ -359,13 +356,15 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
_pico_printf( PICO_NORMAL, "Loading \"%s\"", fileName );
/* set as md2 */
bb = (picoByte_t*) buffer;
md2 = (md2_t*) buffer;
bb0 = bb = (picoByte_t*) _pico_alloc( bufSize );
memcpy( bb, buffer, bufSize );
md2 = (md2_t*) bb;
/* check ident and version */
if ( *( (int*) md2->magic ) != *( (int*) MD2_MAGIC ) || _pico_little_long( md2->version ) != MD2_VERSION ) {
if( *((const int*) md2->magic) != *((const int*) MD2_MAGIC) || _pico_little_long( md2->version ) != MD2_VERSION ) {
/* not an md2 file (todo: set error) */
_pico_printf( PICO_ERROR, "%s is not an MD2 File!", fileName );
_pico_free(bb0);
return NULL;
}
@ -393,11 +392,13 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
// do frame check
if ( md2->numFrames < 1 ) {
_pico_printf( PICO_ERROR, "%s has 0 frames!", fileName );
_pico_free(bb0);
return NULL;
}
if ( frameNum < 0 || frameNum >= md2->numFrames ) {
_pico_printf( PICO_ERROR, "Invalid or out-of-range MD2 frame specified" );
_pico_free(bb0);
return NULL;
}
@ -431,7 +432,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
}
// set Skin Name
strncpy( skinname, (char *) ( bb + md2->ofsSkins ), MD2_MAX_SKINNAME );
strncpy( skinname, (const char *) ( bb + md2->ofsSkins ), MD2_MAX_SKINNAME );
// Print out md2 values
_pico_printf( PICO_VERBOSE,"Skins: %d Verts: %d STs: %d Triangles: %d Frames: %d\nSkin Name \"%s\"\n", md2->numSkins, md2->numXYZ, md2->numST, md2->numTris, md2->numFrames, skinname );
@ -462,6 +463,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
picoModel = PicoNewModel();
if ( picoModel == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model" );
_pico_free(bb0);
return NULL;
}
@ -476,6 +478,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
if ( picoSurface == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model surface" );
PicoFreeModel( picoModel );
_pico_free(bb0);
return NULL;
}
@ -486,6 +489,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
if ( picoShader == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model shader" );
PicoFreeModel( picoModel );
_pico_free(bb0);
return NULL;
}
@ -663,6 +667,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
_pico_free( p_index_LUT_DUPS );
/* return the new pico model */
_pico_free(bb0);
return picoModel;
}

View file

@ -144,22 +144,18 @@ md3_t;
*/
static int _md3_canload( PM_PARAMS_CANLOAD ){
md3_t *md3;
/* to keep the compiler happy */
*fileName = *fileName;
const md3_t *md3;
/* sanity check */
if ( bufSize < ( sizeof( *md3 ) * 2 ) ) {
if ( (size_t) bufSize < ( sizeof( *md3 ) * 2 ) ) {
return PICO_PMV_ERROR_SIZE;
}
/* set as md3 */
md3 = (md3_t*) buffer;
md3 = (const md3_t*) buffer;
/* check md3 magic */
if ( *( (int*) md3->magic ) != *( (int*) MD3_MAGIC ) ) {
if ( *( (const int*) md3->magic ) != *( (const int*) MD3_MAGIC ) ) {
return PICO_PMV_ERROR_IDENT;
}
@ -181,7 +177,7 @@ static int _md3_canload( PM_PARAMS_CANLOAD ){
static picoModel_t *_md3_load( PM_PARAMS_LOAD ){
int i, j;
picoByte_t *bb;
picoByte_t *bb, *bb0;
md3_t *md3;
md3Surface_t *surface;
md3Shader_t *shader;
@ -205,12 +201,14 @@ static picoModel_t *_md3_load( PM_PARAMS_LOAD ){
/* set as md3 */
bb = (picoByte_t*) buffer;
md3 = (md3_t*) buffer;
bb0 = bb = (picoByte_t*) _pico_alloc( bufSize );
memcpy( bb, buffer, bufSize );
md3 = (md3_t*) bb;
/* check ident and version */
if ( *( (int*) md3->magic ) != *( (int*) MD3_MAGIC ) || _pico_little_long( md3->version ) != MD3_VERSION ) {
/* not an md3 file (todo: set error) */
_pico_free(bb0);
return NULL;
}
@ -228,11 +226,13 @@ static picoModel_t *_md3_load( PM_PARAMS_LOAD ){
/* do frame check */
if ( md3->numFrames < 1 ) {
_pico_printf( PICO_ERROR, "MD3 with 0 frames" );
_pico_free(bb0);
return NULL;
}
if ( frameNum < 0 || frameNum >= md3->numFrames ) {
_pico_printf( PICO_ERROR, "Invalid or out-of-range MD3 frame specified" );
_pico_free(bb0);
return NULL;
}
@ -305,6 +305,7 @@ static picoModel_t *_md3_load( PM_PARAMS_LOAD ){
picoModel = PicoNewModel();
if ( picoModel == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model" );
_pico_free(bb0);
return NULL;
}
@ -325,6 +326,7 @@ static picoModel_t *_md3_load( PM_PARAMS_LOAD ){
if ( picoSurface == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model surface" );
PicoFreeModel( picoModel ); /* sea */
_pico_free(bb0);
return NULL;
}
@ -340,6 +342,7 @@ static picoModel_t *_md3_load( PM_PARAMS_LOAD ){
_pico_printf( PICO_ERROR, "Unable to allocate a new model shader" );
PicoFreeModel( picoModel );
return NULL;
_pico_free(bb0);
}
/* detox and set shader name */
@ -398,6 +401,7 @@ static picoModel_t *_md3_load( PM_PARAMS_LOAD ){
}
/* return the new pico model */
_pico_free(bb0);
return picoModel;
}

View file

@ -416,22 +416,19 @@ mdc_t;
*/
static int _mdc_canload( PM_PARAMS_CANLOAD ){
mdc_t *mdc;
const mdc_t *mdc;
/* to keep the compiler happy */
*fileName = *fileName;
/* sanity check */
if ( bufSize < ( sizeof( *mdc ) * 2 ) ) {
if ( (size_t) bufSize < ( sizeof( *mdc ) * 2 ) ) {
return PICO_PMV_ERROR_SIZE;
}
/* set as mdc */
mdc = (mdc_t*) buffer;
mdc = (const mdc_t*) buffer;
/* check mdc magic */
if ( *( (int*) mdc->magic ) != *( (int*) MDC_MAGIC ) ) {
if ( *( (const int*) mdc->magic ) != *( (const int*) MDC_MAGIC ) ) {
return PICO_PMV_ERROR_IDENT;
}
@ -453,7 +450,7 @@ static int _mdc_canload( PM_PARAMS_CANLOAD ){
static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
int i, j;
picoByte_t *bb;
picoByte_t *bb, *bb0;
mdc_t *mdc;
mdcSurface_t *surface;
mdcShader_t *shader;
@ -461,8 +458,8 @@ static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
mdcFrame_t *frame;
mdcTriangle_t *triangle;
mdcVertex_t *vertex;
mdcXyzCompressed_t *vertexComp;
short *mdcShort, *mdcCompVert;
mdcXyzCompressed_t *vertexComp = NULL;
short *mdcShort, *mdcCompVert = NULL;
double lat, lng;
picoModel_t *picoModel;
@ -479,12 +476,14 @@ static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
/* set as mdc */
bb = (picoByte_t*) buffer;
mdc = (mdc_t*) buffer;
bb0 = bb = (picoByte_t*) _pico_alloc( bufSize );
memcpy( bb, buffer, bufSize );
mdc = (mdc_t*) bb;
/* check ident and version */
if ( *( (int*) mdc->magic ) != *( (int*) MDC_MAGIC ) || _pico_little_long( mdc->version ) != MDC_VERSION ) {
/* not an mdc file (todo: set error) */
_pico_free( bb0 );
return NULL;
}
@ -503,11 +502,13 @@ static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
/* do frame check */
if ( mdc->numFrames < 1 ) {
_pico_printf( PICO_ERROR, "MDC with 0 frames" );
_pico_free( bb0 );
return NULL;
}
if ( frameNum < 0 || frameNum >= mdc->numFrames ) {
_pico_printf( PICO_ERROR, "Invalid or out-of-range MDC frame specified" );
_pico_free( bb0 );
return NULL;
}
@ -605,6 +606,7 @@ static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
picoModel = PicoNewModel();
if ( picoModel == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model" );
_pico_free( bb0 );
return NULL;
}
@ -625,6 +627,7 @@ static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
if ( picoSurface == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model surface" );
PicoFreeModel( picoModel ); /* sea */
_pico_free( bb0 );
return NULL;
}
@ -639,6 +642,7 @@ static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
if ( picoShader == NULL ) {
_pico_printf( PICO_ERROR, "Unable to allocate a new model shader" );
PicoFreeModel( picoModel );
_pico_free( bb0 );
return NULL;
}
@ -722,6 +726,7 @@ static picoModel_t *_mdc_load( PM_PARAMS_LOAD ){
}
/* return the new pico model */
_pico_free( bb0 );
return picoModel;
}

View file

@ -164,19 +164,16 @@ TMsKeyframe;
* validates a milkshape3d model file.
*/
static int _ms3d_canload( PM_PARAMS_CANLOAD ){
TMsHeader *hdr;
const TMsHeader *hdr;
/* to keep the compiler happy */
*fileName = *fileName;
/* sanity check */
if ( bufSize < sizeof( TMsHeader ) ) {
if ( (size_t) bufSize < sizeof( TMsHeader ) ) {
return PICO_PMV_ERROR_SIZE;
}
/* get ms3d header */
hdr = (TMsHeader *)buffer;
hdr = (const TMsHeader *)buffer;
/* check ms3d magic */
if ( strncmp( hdr->magic,"MS3D000000",10 ) != 0 ) {
@ -206,7 +203,7 @@ static unsigned char *GetWord( unsigned char *bufptr, int *out ){
*/
static picoModel_t *_ms3d_load( PM_PARAMS_LOAD ){
picoModel_t *model;
unsigned char *bufptr;
unsigned char *bufptr, *bufptr0;
int shaderRefs[ MS3D_MAX_GROUPS ];
int numGroups;
int numMaterials;
@ -228,8 +225,10 @@ static picoModel_t *_ms3d_load( PM_PARAMS_LOAD ){
PicoSetModelName( model, fileName );
PicoSetModelFileName( model, fileName );
bufptr0 = bufptr = (picoByte_t*) _pico_alloc( bufSize );
memcpy( bufptr, buffer, bufSize );
/* skip header */
bufptr = (unsigned char *)buffer + sizeof( TMsHeader );
bufptr += sizeof( TMsHeader );
/* get number of vertices */
bufptr = GetWord( bufptr,&numVerts );
@ -289,6 +288,7 @@ static picoModel_t *_ms3d_load( PM_PARAMS_LOAD ){
if ( triangle->vertexIndices[ k ] >= numVerts ) {
_pico_printf( PICO_ERROR,"Vertex %d index %d out of range (%d, max %d)",i,k,triangle->vertexIndices[k],numVerts - 1 );
PicoFreeModel( model );
_pico_free( bufptr0 );
return NULL; /* yuck */
}
}
@ -321,6 +321,7 @@ static picoModel_t *_ms3d_load( PM_PARAMS_LOAD ){
surface = PicoNewSurface( model );
if ( surface == NULL ) {
PicoFreeModel( model );
_pico_free( bufptr0 );
return NULL;
}
/* do surface setup */
@ -413,6 +414,7 @@ static picoModel_t *_ms3d_load( PM_PARAMS_LOAD ){
shader = PicoNewShader( model );
if ( shader == NULL ) {
PicoFreeModel( model );
_pico_free( bufptr0 );
return NULL;
}
/* scale shader colors */
@ -476,6 +478,7 @@ static picoModel_t *_ms3d_load( PM_PARAMS_LOAD ){
#endif
}
/* return allocated pico model */
_pico_free( bufptr0 );
return model;
// return NULL;
}

View file

@ -85,7 +85,7 @@ static int _obj_canload( PM_PARAMS_CANLOAD ){
/* appearing at the beginning of wavefront objects */
/* alllocate a new pico parser */
p = _pico_new_parser( (picoByte_t *)buffer,bufSize );
p = _pico_new_parser( (const picoByte_t *)buffer,bufSize );
if ( p == NULL ) {
return PICO_PMV_ERROR_MEMORY;
}
@ -521,7 +521,7 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
return NULL; \
}
/* alllocate a new pico parser */
p = _pico_new_parser( (picoByte_t *)buffer,bufSize );
p = _pico_new_parser( (const picoByte_t *)buffer,bufSize );
if ( p == NULL ) {
return NULL;
}
@ -685,8 +685,8 @@ static picoModel_t *_obj_load( PM_PARAMS_LOAD ){
int ivt[ 4 ], has_vt = 0;
int ivn[ 4 ], has_vn = 0;
int have_quad = 0;
int slashcount;
int doubleslash;
int slashcount = 0;
int doubleslash = 0;
int i;
/* group defs *must* come before faces */

View file

@ -302,11 +302,8 @@ static int _terrain_canload( PM_PARAMS_CANLOAD ) {
picoParser_t *p;
/* keep the friggin compiler happy */
/**fileName = *fileName*/;
/* create pico parser */
p = _pico_new_parser( (picoByte_t*) buffer, bufSize );
p = _pico_new_parser( (const picoByte_t*) buffer, bufSize );
if ( p == NULL ) {
return PICO_PMV_ERROR_MEMORY;
}
@ -355,11 +352,8 @@ static picoModel_t *_terrain_load( PM_PARAMS_LOAD ) {
picoColor_t color;
/* keep the friggin compiler happy */
/**fileName = *fileName*/;
/* create pico parser */
p = _pico_new_parser( (picoByte_t*) buffer, bufSize );
p = _pico_new_parser( (const picoByte_t*) buffer, bufSize );
if ( p == NULL ) {
return NULL;
}
@ -596,7 +590,7 @@ const picoModule_t picoModuleTerrain =
"1.3", /* module version string */
"PicoTerrain", /* module display name */
"Randy Reddig", /* author's name */
"2003 Randy Reddig", /* module copyright */
"2003 Randy Reddig", /* module copyright */
{
"picoterrain", NULL, NULL, NULL /* default extensions to use */
},

View file

@ -19,7 +19,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "aselib.h"
#include "inout.h"

View file

@ -294,10 +294,7 @@ void SwapBSPFile( void ) {
=============
*/
int GetLumpElements( dheader_t *header, int lump, int size ) {
int length, ofs;
length = header->lumps[lump].filelen;
ofs = header->lumps[lump].fileofs;
int length = header->lumps[lump].filelen;
if ( length % size ) {
Error( "LoadBSPFile: odd lump size" );

View file

@ -188,7 +188,7 @@ void SetQdirFromPath( const char *path ){
}
strncpy( qdir, path, c + len + count - path );
Sys_Printf( "qdir: %s\n", qdir );
for ( i = 0; i < strlen( qdir ); i++ )
for ( i = 0; i < (int) strlen( qdir ); i++ )
{
if ( qdir[i] == '\\' ) {
qdir[i] = '/';
@ -201,7 +201,7 @@ void SetQdirFromPath( const char *path ){
if ( *c == '/' || *c == '\\' ) {
strncpy( gamedir, path, c + 1 - path );
for ( i = 0; i < strlen( gamedir ); i++ )
for ( i = 0; i < (int) strlen( gamedir ); i++ )
{
if ( gamedir[i] == '\\' ) {
gamedir[i] = '/';
@ -297,7 +297,9 @@ void Q_getwd( char *out ){
strcat( out, "\\" );
#else
// Gef: Changed from getwd() to getcwd() to avoid potential buffer overflow
getcwd( out, 256 );
if ( !getcwd( out, 256 ) ) {
*out = 0;
}
strcat( out, "/" );
#endif
while ( out[i] != 0 )

View file

@ -532,6 +532,7 @@ void LoadPCX( const char *filename, byte **pic, byte **palette, int *width, int
for ( y = 0; y <= pcx->ymax; y++, pix += pcx->xmax + 1 )
{
/* do a scanline */
runLength = 0;
for ( x = 0; x <= pcx->xmax; )
{
/* RR2DO2 */
@ -682,7 +683,6 @@ void WritePCXfile( const char *filename, byte *data,
void LoadBMP( const char *filename, byte **pic, byte **palette, int *width, int *height ){
byte *out;
int i;
int bfSize;
int bfOffBits;
int structSize;
int bcWidth;
@ -704,7 +704,7 @@ void LoadBMP( const char *filename, byte **pic, byte **palette, int *width, int
Error( "%s is not a bmp file", filename );
}
bfSize = bufLittleLong( in, len, &pos );
/* bfSize = */ bufLittleLong( in, len, &pos );
bufLittleShort( in, len, &pos );
bufLittleShort( in, len, &pos );
bfOffBits = bufLittleLong( in, len, &pos );
@ -755,7 +755,6 @@ void LoadBMP( const char *filename, byte **pic, byte **palette, int *width, int
}
else {
Error( "%s had strange struct size", filename );
return;
}
if ( bcPlanes != 1 ) {
@ -1123,7 +1122,7 @@ void LoadTGA( const char *name, byte **pixels, int *width, int *height ){
//
// load the file
//
nLen = vfsLoadFile( ( char * ) name, (void **)&buffer, 0 );
nLen = vfsLoadFile( name, (void **)&buffer, 0 );
if ( nLen == -1 ) {
Error( "Couldn't read %s", name );
}

View file

@ -73,8 +73,8 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
char buf[1024];
sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, BAD_CAST "point" );
xmlNodeSetContent( ret, BAD_CAST buf );
ret = xmlNewNode( NULL, (xmlChar*)"point" );
xmlNodeSetContent( ret, (xmlChar*)buf );
return ret;
}
@ -96,7 +96,7 @@ void xml_SendNode( xmlNodePtr node ){
// l_net library defines an upper limit of MAX_NETMESSAGE
// there are some size check errors, so we use MAX_NETMESSAGE-10 to be safe
// if the size of the buffer exceeds MAX_NETMESSAGE-10 we'll send in several network messages
while ( pos < xml_buf->use )
while ( pos < (int)xml_buf->use )
{
// what size are we gonna send now?
( xml_buf->use - pos < MAX_NETMESSAGE - 10 ) ? ( size = xml_buf->use - pos ) : ( size = MAX_NETMESSAGE - 10 );
@ -151,15 +151,15 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, BAD_CAST "select" );
xmlNodeSetContent( node, BAD_CAST buf );
node = xmlNewNode( NULL, (xmlChar*)"select" );
xmlNodeSetContent( node, (xmlChar*)buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0;
xmlSetProp( node, BAD_CAST "level", BAD_CAST (char *)&level );
xmlSetProp( node, (xmlChar*)"level", (xmlChar*)&level );
// a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, BAD_CAST "brush" );
xmlNodeSetContent( select, BAD_CAST buf );
select = xmlNewNode( NULL, (xmlChar*)"brush" );
xmlNodeSetContent( select, (xmlChar*)buf );
xmlAddChild( node, select );
xml_SendNode( node );
@ -178,15 +178,15 @@ void xml_Point( char *msg, vec3_t pt ){
char buf[1024];
char level[2];
node = xmlNewNode( NULL, BAD_CAST "pointmsg" );
xmlNodeSetContent( node, BAD_CAST msg );
node = xmlNewNode( NULL, (xmlChar*)"pointmsg" );
xmlNodeSetContent( node, (xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, BAD_CAST "level", BAD_CAST (char *)&level );
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
// a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, BAD_CAST "point" );
xmlNodeSetContent( point, BAD_CAST buf );
point = xmlNewNode( NULL, (xmlChar*)"point" );
xmlNodeSetContent( point, (xmlChar*)buf );
xmlAddChild( node, point );
xml_SendNode( node );
@ -202,11 +202,11 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
char level[2];
int i;
node = xmlNewNode( NULL, BAD_CAST "windingmsg" );
xmlNodeSetContent( node, BAD_CAST msg );
node = xmlNewNode( NULL, (xmlChar*)"windingmsg" );
xmlNodeSetContent( node, (xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR;
level[1] = 0;
xmlSetProp( node, BAD_CAST "level", BAD_CAST (char *)&level );
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
// a 'winding' node
sprintf( buf, "%i ", numpoints );
for ( i = 0; i < numpoints; i++ )
@ -219,8 +219,8 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
strcat( buf, smlbuf );
}
winding = xmlNewNode( NULL, BAD_CAST "winding" );
xmlNodeSetContent( winding, BAD_CAST buf );
winding = xmlNewNode( NULL, (xmlChar*)"winding" );
xmlNodeSetContent( winding, (xmlChar*)buf );
xmlAddChild( node, winding );
xml_SendNode( node );
@ -242,7 +242,7 @@ void Broadcast_Setup( const char *dest ){
char sMsg[1024];
Net_Setup();
Net_StringToAddress( (char *)dest, &address );
Net_StringToAddress( dest, &address );
brdcst_socket = Net_Connect( &address, 0 );
if ( brdcst_socket ) {
// send in a header
@ -284,19 +284,19 @@ void FPrintf( int flag, char *buf ){
*/
if ( !bGotXML ) {
// initialize
doc = xmlNewDoc( BAD_CAST "1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, BAD_CAST "q3map_feedback", NULL );
doc = xmlNewDoc( (xmlChar*)"1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, (xmlChar*)"q3map_feedback", NULL );
bGotXML = qtrue;
}
node = xmlNewNode( NULL, BAD_CAST "message" );
node = xmlNewNode( NULL, (xmlChar*)"message" );
{
gchar* utf8 = g_locale_to_utf8( buf, -1, NULL, NULL, NULL );
xmlNodeSetContent( node, BAD_CAST utf8 );
xmlNodeSetContent( node, (xmlChar*)utf8 );
g_free( utf8 );
}
level[0] = (int)'0' + flag;
level[1] = 0;
xmlSetProp( node, BAD_CAST "level", BAD_CAST (char *)&level );
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level );
xml_SendNode( node );
}

View file

@ -287,13 +287,13 @@ static void j_putRGBAScanline( unsigned char* jpegline, int widthPix, unsigned c
for ( count = 0; count < widthPix; count++ )
{
unsigned char iRed, iBlu, iGrn, iAlp;
unsigned char iRed, iBlu, iGrn /* , iAlp */;
unsigned char *oRed, *oBlu, *oGrn, *oAlp;
iRed = *( jpegline + count * 4 + 0 );
iGrn = *( jpegline + count * 4 + 1 );
iBlu = *( jpegline + count * 4 + 2 );
iAlp = *( jpegline + count * 4 + 3 );
/* iAlp = *( jpegline + count * 4 + 3 ); */
oRed = outBuf + offset + count * 4 + 0;
oGrn = outBuf + offset + count * 4 + 1;

View file

@ -19,7 +19,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "cmdlib.h"
#include "qthreads.h"
#include "mutex.h"

View file

@ -19,7 +19,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stddef.h>
#include "cmdlib.h"
@ -461,7 +460,7 @@ winding_t *BaseWindingForPlane( vec3_t normal, vec_t dist ){
==================
*/
winding_t *CopyWinding( winding_t *w ){
int size;
size_t size;
winding_t *c;
if ( !w ) {
@ -469,7 +468,7 @@ winding_t *CopyWinding( winding_t *w ){
}
c = AllocWinding( w->numpoints );
size = sizeof( *w ) + sizeof( *w->p ) * w->numpoints;
size = (size_t)sizeof( *w ) + sizeof( *w->p ) * w->numpoints;
memcpy( c, w, size );
return c;
}

View file

@ -306,12 +306,11 @@ skipspace:
==============
*/
qboolean TokenAvailable( void ) {
int oldLine, oldScriptLine;
int oldLine;
qboolean r;
/* save */
oldLine = scriptline;
oldScriptLine = script->line;
/* test */
r = GetToken( qtrue );

View file

@ -424,6 +424,7 @@ void ThreadSetDefault( void ){
/* default to one thread, only multi-thread when specifically told to */
numthreads = 1;
}
if ( numthreads > 1 ) {
Sys_Printf( "threads: %d\n", numthreads );
}
@ -551,7 +552,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
for ( i = 0 ; i < numthreads ; i++ )
{
/* Default pthread attributes: joinable & non-realtime scheduling */
if ( pthread_create( &work_threads[i], NULL, (void*)func, (void*)i ) != 0 ) {
if ( pthread_create( &work_threads[i], NULL, (void*)func, (void*)(size_t)i ) != 0 ) {
Error( "pthread_create failed" );
}
}

View file

@ -146,7 +146,8 @@ static void vfsInitPakFile( const char *filename ){
g_pakFiles = g_slist_append( g_pakFiles, file );
vfsFixDOSName( filename_inzip );
filename_lower = g_ascii_strdown( filename_inzip, -1 );//-1 null terminated string
//-1 null terminated string
filename_lower = g_ascii_strdown( filename_inzip, -1 );
file->name = strdup( filename_lower );
file->size = file_info.uncompressed_size;
@ -197,7 +198,6 @@ void vfsInitDirectory( const char *path ){
dirlist = g_strdup( name );
{
char *ext = strrchr( dirlist, '.' );
if ( ext != NULL && ( !Q_stricmp( ext, ".pk3dir" ) || !Q_stricmp( ext, ".dpkdir" ) ) ) {
@ -289,6 +289,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
f = fopen( filename, "rb" );
if ( f == NULL ) {
fclose( f );
return -1;
}
@ -298,10 +299,14 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
*bufferptr = safe_malloc( len + 1 );
if ( *bufferptr == NULL ) {
fclose( f );
return -1;
}
fread( *bufferptr, 1, len, f );
if ( fread( *bufferptr, 1, len, f ) != (size_t) len ) {
fclose( f );
return -1;
}
fclose( f );
// we need to end the buffer with a 0
@ -335,10 +340,14 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
*bufferptr = safe_malloc( len + 1 );
if ( *bufferptr == NULL ) {
fclose( f );
return -1;
}
fread( *bufferptr, 1, len, f );
if ( fread( *bufferptr, 1, len, f ) != (size_t) len ) {
fclose( f );
return -1;
}
fclose( f );
// we need to end the buffer with a 0

View file

@ -381,11 +381,9 @@ byte AveragePixels( int count ){
int pix;
int bestcolor;
byte *pal;
int fullbright;
vis = 0;
r = g = b = 0;
fullbright = 0;
for ( i = 0 ; i < count ; i++ )
{
pix = pixdata[i];

View file

@ -559,7 +559,6 @@ static void CopyTrianglesToBaseTriangles( triangle_t *ptri, int numtri, baseTria
// float s_scale, t_scale;
// float scale;
// vec3_t mins, maxs;
float *pbasevert;
/*
//
@ -618,8 +617,6 @@ static void CopyTrianglesToBaseTriangles( triangle_t *ptri, int numtri, baseTria
for ( j = 0 ; j < 3 ; j++ )
{
pbasevert = ptri->verts[j];
VectorCopy( ptri->verts[j], bTri->v[j].xyz );
VectorCopy( ptri->normals[j], bTri->v[j].normal );
@ -1905,8 +1902,9 @@ static void ConvertASE( const char *filename, int type, qboolean grabAnims ){
}
}
if ( !tagWeapon ) {
Error( "Missing tag_weapon!" );
if ( !tagHead ) {
// todo: was never being checked; should we error now that it is?
// Error( "Missing tag_head!" );
}
if ( !tagTorso ) {
Error( "Missing tag_torso!" );

View file

@ -277,6 +277,8 @@ void SnapWeldVector( vec3_t a, vec3_t b, vec3_t out ){
}
}
/*
==================
SnapWeldVectorAccu

View file

@ -270,7 +270,6 @@ void ProcessWorldModel( void ){
char level[ 2 ], shader[ 1024 ];
const char *value;
/* sets integer blockSize from worldspawn "_blocksize" key if it exists */
value = ValueForKey( &entities[ 0 ], "_blocksize" );
if ( value[ 0 ] == '\0' ) {
@ -347,12 +346,12 @@ void ProcessWorldModel( void ){
Sys_FPrintf( SYS_NOXML, "******* leaked *******\n" );
Sys_FPrintf( SYS_NOXML, "**********************\n" );
polyline = LeakFile( tree );
leaknode = xmlNewNode( NULL, BAD_CAST "message" );
xmlNodeSetContent( leaknode, BAD_CAST "MAP LEAKED\n" );
leaknode = xmlNewNode( NULL, (xmlChar*)"message" );
xmlNodeSetContent( leaknode, (xmlChar*)"MAP LEAKED\n" );
xmlAddChild( leaknode, polyline );
level[0] = (int) '0' + SYS_ERR;
level[1] = 0;
xmlSetProp( leaknode, BAD_CAST "level", BAD_CAST (char*) &level );
xmlSetProp( leaknode, (xmlChar*)"level", (xmlChar*)(char*) &level );
xml_SendNode( leaknode );
if ( leaktest ) {
Sys_Printf( "--- MAP LEAKED, ABORTING LEAKTEST ---\n" );
@ -466,7 +465,7 @@ void ProcessWorldModel( void ){
}
/* create the flare surface (note shader defaults automatically) */
DrawSurfaceForFlare( mapEntityNum, origin, normal, color, (char*) flareShader, lightStyle );
DrawSurfaceForFlare( mapEntityNum, origin, normal, color, flareShader, lightStyle );
}
}
}

View file

@ -821,7 +821,6 @@ entity_t *FindTargetEntity( const char *target ){
void GetEntityShadowFlags( const entity_t *ent, const entity_t *ent2, int *castShadows, int *recvShadows ){
const char *value;
/* get cast shadows */
if ( castShadows != NULL ) {
value = ValueForKey( ent, "_castShadows" );

View file

@ -64,8 +64,8 @@ void ExportEntities( void ){
/* sanity check */
if ( bspEntDataSize == 0 ) {
Sys_FPrintf( SYS_WRN, "WARNING: No BSP entity data. aborting...\n" );
return;
Sys_FPrintf( SYS_WRN, "WARNING: No BSP entity data. aborting...\n" );
return;
}
/* write it */

View file

@ -0,0 +1,81 @@
/* -------------------------------------------------------------------------------
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
----------------------------------------------------------------------------------
This code has been altered significantly from its original form, to support
several games based on the Quake III Arena engine, in the form of "Q3Map2."
------------------------------------------------------------------------------- */
/* marker */
#ifndef GAME__NULL_H
#define GAME__NULL_H
/* -------------------------------------------------------------------------------
content and surface flags
are in game_quake3.h
------------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------------
game_t struct
------------------------------------------------------------------------------- */
{
NULL, /* -game x */
NULL, /* default base game data dir */
NULL, /* unix home sub-dir */
NULL, /* magic path word */
NULL, /* shader directory */
0, /* max lightmapped surface verts */
0, /* max surface verts */
0, /* max surface indexes */
qfalse, /* flares */
NULL, /* default flare shader */
qfalse, /* wolf lighting model? */
0, /* lightmap width/height */
0, /* lightmap gamma */
0, /* lightmap compensate */
NULL, /* bsp file prefix */
0, /* bsp file version */
qfalse, /* cod-style lump len/ofs order */
NULL, /* bsp load function */
NULL, /* bsp write function */
{
{ NULL, 0, 0, 0, 0, 0, 0 }
}
}
/* end marker */
#endif

View file

@ -97,7 +97,7 @@ static void LoadDDSBuffer( byte *buffer, int size, byte **pixels, int *width, in
typedef struct pngBuffer_s
{
byte *buffer;
int size, offset;
png_size_t size, offset;
} pngBuffer_t;
void PNGReadData( png_struct *png, png_byte *buffer, png_size_t size ){
@ -122,9 +122,9 @@ void PNGReadData( png_struct *png, png_byte *buffer, png_size_t size ){
static void LoadPNGBuffer( byte *buffer, int size, byte **pixels, int *width, int *height ){
png_struct *png;
png_info *info, *end;
pngBuffer_t pb;
int i, bitDepth, colorType, channels;
png_uint_32 w, h;
pngBuffer_t pb;
int bitDepth, colorType, channels;
png_uint_32 w, h, i;
byte **rowPointers;
/* dummy check */
@ -165,9 +165,9 @@ static void LoadPNGBuffer( byte *buffer, int size, byte **pixels, int *width, in
}
/* set read callback */
pb.buffer = buffer;
pb.size = size;
pb.offset = 0;
pb.buffer = buffer;
pb.size = size;
pb.offset = 0;
png_set_read_fn( png, (void*)&pb, PNGReadData );
/* set error longjmp */

View file

@ -43,7 +43,7 @@
LEAK FILE GENERATION
Save out name.line for qe3 to read
Save out name.lin for qe3 to read
==============================================================================
*/
@ -82,15 +82,15 @@ xmlNodePtr LeakFile( tree_t *tree ){
Error( "Couldn't open %s\n", filename );
}
xml_node = xmlNewNode( NULL, BAD_CAST "polyline" );
xml_node = xmlNewNode( NULL, (xmlChar*)"polyline" );
count = 0;
node = &tree->outside_node;
while ( node->occupied > 1 )
{
int next;
portal_t *p, *nextportal;
node_t *nextnode;
portal_t *p, *nextportal = NULL;
node_t *nextnode = NULL;
int s;
// find the best portal exit

View file

@ -794,7 +794,6 @@ int LightContributionToSample( trace_t *trace ){
float d;
vec3_t pushedOrigin;
/* project sample point into light plane */
d = DotProduct( trace->origin, light->normal ) - light->dist;
if ( d < 3.0f ) {
@ -919,7 +918,6 @@ int LightContributionToSample( trace_t *trace ){
float distByNormal, radiusAtDist, sampleRadius;
vec3_t pointAtDist, distToSample;
/* do cone calculation */
distByNormal = -DotProduct( trace->displacement, light->normal );
if ( distByNormal < 0.0f ) {
@ -981,10 +979,8 @@ int LightContributionToSample( trace_t *trace ){
/* return to sender */
return 1;
}
/* unknown light type */
else {
return -1;
Error( "Light of undefined type!" );
}
/* ydnar: changed to a variable number */
@ -1318,7 +1314,6 @@ void TraceGrid( int num ){
contribution_t contributions[ MAX_CONTRIBUTIONS ];
trace_t trace;
/* get grid points */
gp = &rawGridPoints[ num ];
bgp = &bspGridPoints[ num ];
@ -1509,6 +1504,7 @@ void TraceGrid( int num ){
if ( color[ j ] < minGridLight[ j ] ) {
color[ j ] = minGridLight[ j ];
}
ColorToBytes( color, bgp->ambient[ i ], 1.0f );
ColorToBytes( gp->directed[ i ], bgp->directed[ i ], 1.0f );
}
@ -1726,10 +1722,6 @@ void LightWorld( void ){
/* dirty them up */
if ( dirty ) {
Sys_Printf( "--- DirtyRawLightmap ---\n" );
RunThreadsOnIndividual( numRawLightmaps, qtrue, DirtyRawLightmap );
}
@ -1956,12 +1948,6 @@ int LightMain( int argc, char **argv ){
Sys_Printf( "Dark lightmap seams enabled\n" );
}
else if ( !strcmp( argv[ i ], "-shadeangle" ) ) {
shadeAngleDegrees = atof( argv[ i + 1 ] );
if ( shadeAngleDegrees < 0.0f ) {

View file

@ -257,7 +257,6 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
float st[ 2 ], lightmap[ 2 ], *radLuxel;
radVert_t *rv[ 3 ];
/* initial setup */
ClearBounds( mins, maxs );
VectorClear( average );
@ -417,7 +416,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm, shaderInfo_t *si,
float scale, float subdivide, qboolean original, radWinding_t *rw, clipWork_t *cw ){
int i, style;
int i, style = 0;
float dist, area, value;
vec3_t mins, maxs, normal, d1, d2, cross, color, gradient;
light_t *light, *splash;
@ -543,7 +542,10 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw
light->falloffTolerance = falloffTolerance;
/* bouncing light? */
if ( bouncing == qfalse ) {
if ( !bouncing ) {
/* This is weird. This actually handles surfacelight and not
* bounces. */
/* handle first-pass lights in normal q3a style */
value = si->value;
light->photons = value * area * areaScale;

View file

@ -514,13 +514,10 @@ void ClipTraceWinding( traceWinding_t *tw, vec4_t plane, traceWinding_t *front,
mid.xyz[ k ] = a->xyz[ k ] + frac * ( b->xyz[ k ] - a->xyz[ k ] );
}
/* set texture coordinates */
if ( k > 1 ) {
continue;
}
mid.st[ 0 ] = a->st[ 0 ] + frac * ( b->st[ 0 ] - a->st[ 0 ] );
mid.st[ 1 ] = a->st[ 1 ] + frac * ( b->st[ 1 ] - a->st[ 1 ] );
}
/* set texture coordinates */
mid.st[ 0 ] = a->st[ 0 ] + frac * ( b->st[ 0 ] - a->st[ 0 ] );
mid.st[ 1 ] = a->st[ 1 ] + frac * ( b->st[ 1 ] - a->st[ 1 ] );
/* copy midpoint to front and back polygons */
front->v[ front->numVerts++ ] = mid;
@ -531,40 +528,6 @@ void ClipTraceWinding( traceWinding_t *tw, vec4_t plane, traceWinding_t *front,
/*
FilterPointToTraceNodes_r() - ydnar
debugging tool
*/
static int FilterPointToTraceNodes_r( vec3_t pt, int nodeNum ){
float dot;
traceNode_t *node;
if ( nodeNum < 0 || nodeNum >= numTraceNodes ) {
return -1;
}
node = &traceNodes[ nodeNum ];
if ( node->type >= 0 ) {
dot = DotProduct( pt, node->plane ) - node->plane[ 3 ];
if ( dot > -0.001f ) {
FilterPointToTraceNodes_r( pt, node->children[ 0 ] );
}
if ( dot < 0.001f ) {
FilterPointToTraceNodes_r( pt, node->children[ 1 ] );
}
return -1;
}
Sys_Printf( "%d ", nodeNum );
return nodeNum;
}
/*
FilterTraceWindingIntoNodes_r() - ydnar
filters a trace winding into the raytracing tree
@ -1264,7 +1227,7 @@ static void PopulateTraceNodes( void ){
/* external model */
default:
frame = IntForKey( e, "_frame" );
model = LoadModel( (char*) value, frame );
model = LoadModel( value, frame );
if ( model == NULL ) {
continue;
}
@ -1294,7 +1257,7 @@ static void PopulateTraceNodes( void ){
/* external model */
default:
frame = IntForKey( e, "_frame2" );
model = LoadModel( (char*) value, frame );
model = LoadModel( value, frame );
if ( model == NULL ) {
continue;
}

View file

@ -1063,13 +1063,18 @@ void MapRawLightmap( int rawLightmapNum ){
continue;
}
/* get drawverts and map first triangle */
MapTriangle( lm, info, dv, mapNonAxial );
for ( mapNonAxial = 0; mapNonAxial < 2; mapNonAxial++ )
{
/* get drawverts and map first triangle */
dv[ 1 ] = &verts[ pw[ r + 1 ] ];
dv[ 2 ] = &verts[ pw[ r + 2 ] ];
MapTriangle( lm, info, dv, mapNonAxial );
/* get drawverts and map second triangle */
dv[ 1 ] = &verts[ pw[ r + 2 ] ];
dv[ 2 ] = &verts[ pw[ r + 3 ] ];
MapTriangle( lm, info, dv, mapNonAxial );
/* get drawverts and map second triangle */
dv[ 1 ] = &verts[ pw[ r + 2 ] ];
dv[ 2 ] = &verts[ pw[ r + 3 ] ];
MapTriangle( lm, info, dv, mapNonAxial );
}
}
}
@ -1765,8 +1770,9 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, vec3_t sampl
#define LIGHT_LUXEL( x, y ) ( lightLuxels + ( ( ( ( y ) * lm->sw ) + ( x ) ) * SUPER_LUXEL_SIZE ) )
void IlluminateRawLightmap( int rawLightmapNum ){
int i, t, x, y, sx, sy, size, llSize, luxelFilterRadius, lightmapNum;
int i, t, x, y, sx, sy, size, luxelFilterRadius, lightmapNum;
int *cluster, *cluster2, mapped, lighted, totalLighted;
size_t llSize;
rawLightmap_t *lm;
surfaceInfo_t *info;
qboolean filterColor, filterDir;
@ -2268,8 +2274,6 @@ void IlluminateRawLightmap( int rawLightmapNum ){
{
/* get cluster */
cluster = SUPER_CLUSTER( x, y );
//% if( *cluster < 0 )
//% continue;
/* get particulars */
luxel = SUPER_LUXEL( lightmapNum, x, y );
@ -2317,6 +2321,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){
( lm->splotchFix && ( luxel[ 0 ] <= ambientColor[ 0 ] || luxel[ 1 ] <= ambientColor[ 1 ] || luxel[ 2 ] <= ambientColor[ 2 ] ) ) ) {
filterColor = qtrue;
}
if ( deluxemap && lightmapNum == 0 && ( *cluster < 0 || filter ) ) {
filterDir = qtrue;
}

View file

@ -38,7 +38,6 @@
/* -------------------------------------------------------------------------------
this file contains code that doe lightmap allocation and projection that
@ -284,8 +283,8 @@ static int CompareLightSurface( const void *a, const void *b ){
/* get shaders */
asi = surfaceInfos[ *( (int*) a ) ].si;
bsi = surfaceInfos[ *( (int*) b ) ].si;
asi = surfaceInfos[ *( (const int*) a ) ].si;
bsi = surfaceInfos[ *( (const int*) b ) ].si;
/* dummy check */
if ( asi == NULL ) {
@ -847,8 +846,8 @@ static int CompareSurfaceInfo( const void *a, const void *b ){
/* get surface info */
aInfo = &surfaceInfos[ *( (int*) a ) ];
bInfo = &surfaceInfos[ *( (int*) b ) ];
aInfo = &surfaceInfos[ *( (const int*) a ) ];
bInfo = &surfaceInfos[ *( (const int*) b ) ];
/* model first */
if ( aInfo->model < bInfo->model ) {
@ -2262,8 +2261,8 @@ static int CompareRawLightmap( const void *a, const void *b ){
/* get lightmaps */
alm = &rawLightmaps[ *( (int*) a ) ];
blm = &rawLightmaps[ *( (int*) b ) ];
alm = &rawLightmaps[ *( (const int*) a ) ];
blm = &rawLightmaps[ *( (const int*) b ) ];
/* get min number of surfaces */
min = ( alm->numLightSurfaces < blm->numLightSurfaces ? alm->numLightSurfaces : blm->numLightSurfaces );
@ -2325,8 +2324,8 @@ void StoreSurfaceLightmaps( void ){
char dirname[ 1024 ], filename[ 1024 ];
shaderInfo_t *csi;
char lightmapName[ 128 ];
char *rgbGenValues[ 256 ];
char *alphaGenValues[ 256 ];
const char *rgbGenValues[ 256 ];
const char *alphaGenValues[ 256 ];
/* note it */
@ -3080,7 +3079,7 @@ void StoreSurfaceLightmaps( void ){
/* get rgbgen string */
if ( rgbGenValues[ style ] == NULL ) {
sprintf( key, "_style%drgbgen", style );
rgbGenValues[ style ] = (char*) ValueForKey( &entities[ 0 ], key );
rgbGenValues[ style ] = ValueForKey( &entities[ 0 ], key );
if ( rgbGenValues[ style ][ 0 ] == '\0' ) {
rgbGenValues[ style ] = "wave noise 0.5 1 0 5.37";
}
@ -3096,7 +3095,7 @@ void StoreSurfaceLightmaps( void ){
/* get alphagen string */
if ( alphaGenValues[ style ] == NULL ) {
sprintf( key, "_style%dalphagen", style );
alphaGenValues[ style ] = (char*) ValueForKey( &entities[ 0 ], key );
alphaGenValues[ style ] = ValueForKey( &entities[ 0 ], key );
}
if ( alphaGenValues[ style ][ 0 ] != '\0' ) {
sprintf( alphaGen, "\t\talphaGen %s // style %d\n", alphaGenValues[ style ], style );

View file

@ -44,7 +44,7 @@
#define USE_HASHING
#define PLANE_HASHES 8192
plane_t *planehash[ PLANE_HASHES ];
plane_t *planehash[ PLANE_HASHES ];
int c_boxbevels;
int c_edgebevels;
@ -308,6 +308,7 @@ void SnapPlaneImproved( vec3_t normal, vec_t *dist, int numPoints, const vec3_t
}
/*
FindFloatPlane()
ydnar: changed to allow a number of test points to be supplied that
@ -956,7 +957,7 @@ static void ParseRawBrush( qboolean onlyLights ){
int planenum;
shaderInfo_t *si;
vec_t shift[ 2 ];
vec_t rotate;
vec_t rotate = 0;
vec_t scale[ 2 ];
char name[ MAX_QPATH ];
char shader[ MAX_QPATH ];
@ -1278,7 +1279,6 @@ void AdjustBrushesForOrigin( entity_t *ent ){
brush_t *b;
parseMesh_t *p;
/* walk brush list */
for ( b = ent->brushes; b != NULL; b = b->next )
{
@ -1770,7 +1770,7 @@ static qboolean ParseMapEntity( qboolean onlyLights ){
void LoadMapFile( char *filename, qboolean onlyLights ){
FILE *file;
brush_t *b;
int oldNumEntities, numMapBrushes;
int oldNumEntities = 0, numMapBrushes;
/* note it */

View file

@ -78,8 +78,8 @@ void PicoPrintFunc( int level, const char *str ){
callback for picomodel.lib
*/
void PicoLoadFileFunc( char *name, byte **buffer, int *bufSize ){
*bufSize = vfsLoadFile( (const char*) name, (void**) buffer, 0 );
void PicoLoadFileFunc( const char *name, byte **buffer, int *bufSize ){
*bufSize = vfsLoadFile( name, (void**) buffer, 0 );
}
@ -161,7 +161,7 @@ picoModel_t *LoadModel( char *name, int frame ){
}
/* attempt to parse model */
*pm = PicoLoadModel( (char*) name, frame );
*pm = PicoLoadModel( name, frame );
/* if loading failed, make a bogus model to silence the rest of the warnings */
if ( *pm == NULL ) {

View file

@ -231,7 +231,6 @@ void ParsePatch( qboolean onlyLights ){
float longestCurve;
int maxIterations;
MatchToken( "{" );
/* get texture */
@ -271,8 +270,10 @@ void ParsePatch( qboolean onlyLights ){
// if brush primitives format, we may have some epairs to ignore here
GetToken( qtrue );
if ( g_bBrushPrimit != BPRIMIT_OLDBRUSHES && strcmp( token,"}" ) ) {
// NOTE: we leak that!
ep = ParseEPair();
free( ep->key );
free( ep->value );
free( ep );
}
else{
UnGetToken();

View file

@ -98,10 +98,11 @@ void LokiInitPaths( char *argv0 ){
/* this is kinda crap, but hey */
strcpy( installPath, "../" );
#else
char temp[ MAX_OS_PATH ];
char *home;
char *path;
char *last;
char *home;
char *path;
char *last;
qboolean found;

View file

@ -102,6 +102,7 @@ void WritePortalFile_r( node_t *node ){
// plane the same way vis will, and flip the side orders if needed
// FIXME: is this still relevent?
WindingPlane( w, normal, &dist );
if ( DotProduct( p->plane.normal, normal ) < 0.99 ) { // backwards...
fprintf( pf,"%i %i %i ",w->numpoints, p->nodes[1]->cluster, p->nodes[0]->cluster );
}

View file

@ -531,7 +531,7 @@ typedef struct {
------------------------------------------------------------------------------- */
/* ydnar: for smaller structs */
typedef char qb_t;
typedef unsigned char qb_t;
/* ydnar: for q3map_tcMod */
@ -1618,7 +1618,7 @@ tree_t *FaceBSP( face_t *list );
/* model.c */
void PicoPrintFunc( int level, const char *str );
void PicoLoadFileFunc( char *name, byte **buffer, int *bufSize );
void PicoLoadFileFunc( const char *name, byte **buffer, int *bufSize );
picoModel_t *FindModel( char *name, int frame );
picoModel_t *LoadModel( char *name, int frame );
void InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale );
@ -1641,7 +1641,7 @@ void ClearSurface( mapDrawSurface_t *ds );
void AddEntitySurfaceModels( entity_t *e );
mapDrawSurface_t *DrawSurfaceForSide( entity_t *e, brush_t *b, side_t *s, winding_t *w );
mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh );
mapDrawSurface_t *DrawSurfaceForFlare( int entNum, vec3_t origin, vec3_t normal, vec3_t color, char *flareShader, int lightStyle );
mapDrawSurface_t *DrawSurfaceForFlare( int entNum, vec3_t origin, vec3_t normal, vec3_t color, const char *flareShader, int lightStyle );
mapDrawSurface_t *DrawSurfaceForShader( char *shader );
void ClipSidesIntoTree( entity_t *e, tree_t *tree );
void MakeDebugPortalSurfs( tree_t *tree );
@ -1898,7 +1898,7 @@ Q_EXTERN game_t games[]
,
#include "game_reaction.h" /* must be after game_quake3.h */
,
{ NULL } /* null game */
#include "game__null.h" /* null game (must be last item) */
};
#endif
Q_EXTERN game_t *game Q_ASSIGN( &games[ 0 ] );

View file

@ -806,7 +806,6 @@ shaderInfo_t *ShaderInfoForShader( const char *shaderName ){
shaderInfo_t *si;
char shader[ MAX_QPATH ];
/* dummy check */
if ( shaderName == NULL || shaderName[ 0 ] == '\0' ) {
Sys_FPrintf( SYS_WRN, "WARNING: Null or empty shader name\n" );
@ -1332,7 +1331,6 @@ static void ParseShaderFile( const char *filename ){
else if ( !Q_stricmp( token, "q3map_surfacemodel" ) ) {
surfaceModel_t *model;
/* allocate new model and attach it */
model = safe_malloc( sizeof( *model ) );
memset( model, 0, sizeof( *model ) );

View file

@ -297,7 +297,7 @@ void ClearSurface( mapDrawSurface_t *ds ){
void TidyEntitySurfaces( entity_t *e ){
int i, j, deleted;
mapDrawSurface_t *out, *in;
mapDrawSurface_t *out, *in = NULL;
/* note it */
@ -1228,7 +1228,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh
creates a flare draw surface
*/
mapDrawSurface_t *DrawSurfaceForFlare( int entNum, vec3_t origin, vec3_t normal, vec3_t color, char *flareShader, int lightStyle ){
mapDrawSurface_t *DrawSurfaceForFlare( int entNum, vec3_t origin, vec3_t normal, vec3_t color, const char *flareShader, int lightStyle ){
mapDrawSurface_t *ds;
@ -2538,7 +2538,6 @@ void EmitPatchSurface( mapDrawSurface_t *ds ){
if ( ds->backSide || ds->shaderInfo->invert ) {
bspDrawVert_t *dv1, *dv2, temp;
/* walk the verts, flip the normal */
for ( i = 0; i < ds->numVerts; i++ )
VectorScale( ds->verts[ i ].normal, -1.0f, ds->verts[ i ].normal );
@ -2755,7 +2754,6 @@ static void EmitTriangleSurface( mapDrawSurface_t *ds ){
int i, temp;
bspDrawSurface_t *out;
/* invert the surface if necessary */
if ( ds->backSide || ds->shaderInfo->invert ) {
/* walk the indexes, reverse the triangle order */

View file

@ -345,7 +345,7 @@ void LoadSurfaceExtraFile( const char *path ){
}
/* parse the file */
ParseFromMemory( buffer, size );
ParseFromMemory( (char*) buffer, size );
/* tokenize it */
while ( 1 )

View file

@ -316,7 +316,6 @@ void TriangulatePatchSurface( mapDrawSurface_t *ds ){
mapDrawSurface_t *dsNew;
mesh_t src, *subdivided, *mesh;
/* try to early out */
if ( ds->numVerts == 0 || ds->type != SURFACE_PATCH || patchMeta == qfalse ) {
return;
@ -535,6 +534,7 @@ void StripFaceSurface( mapDrawSurface_t *ds ){
}
/* try all possible orderings of the points looking for a non-degenerate strip order */
ni = 0;
for ( r = 0; r < ds->numVerts; r++ )
{
/* set rotation */
@ -688,51 +688,6 @@ void MakeEntityMetaTriangles( entity_t *e ){
/*
PointTriangleIntersect()
assuming that all points lie in plane, determine if pt
is inside the triangle abc
code originally (c) 2001 softSurfer (www.softsurfer.com)
*/
#define MIN_OUTSIDE_EPSILON -0.01f
#define MAX_OUTSIDE_EPSILON 1.01f
static qboolean PointTriangleIntersect( vec3_t pt, vec4_t plane, vec3_t a, vec3_t b, vec3_t c, vec3_t bary ){
vec3_t u, v, w;
float uu, uv, vv, wu, wv, d;
/* make vectors */
VectorSubtract( b, a, u );
VectorSubtract( c, a, v );
VectorSubtract( pt, a, w );
/* more setup */
uu = DotProduct( u, u );
uv = DotProduct( u, v );
vv = DotProduct( v, v );
wu = DotProduct( w, u );
wv = DotProduct( w, v );
d = uv * uv - uu * vv;
/* calculate barycentric coordinates */
bary[ 1 ] = ( uv * wv - vv * wu ) / d;
if ( bary[ 1 ] < MIN_OUTSIDE_EPSILON || bary[ 1 ] > MAX_OUTSIDE_EPSILON ) {
return qfalse;
}
bary[ 2 ] = ( uv * wv - uu * wv ) / d;
if ( bary[ 2 ] < MIN_OUTSIDE_EPSILON || bary[ 2 ] > MAX_OUTSIDE_EPSILON ) {
return qfalse;
}
bary[ 0 ] = 1.0f - ( bary[ 1 ] + bary[ 2 ] );
/* point is in triangle */
return qtrue;
}
/*
CreateEdge()
sets up an edge structure from a plane and 2 points that the edge ab falls lies in
@ -898,7 +853,6 @@ void FixMetaTJunctions( void ){
VectorSet( metaVerts[ tri->indexes[ k ] ].color[ 0 ], 255, 204, 0 );
VectorSet( metaVerts[ tri->indexes[ ( k + 1 ) % 3 ] ].color[ 0 ], 255, 204, 0 );
/* the edge opposite the zero-weighted vertex was hit, so use that as an amount */
a = &metaVerts[ tri->indexes[ k % 3 ] ];
b = &metaVerts[ tri->indexes[ ( k + 1 ) % 3 ] ];
@ -989,7 +943,6 @@ void SmoothMetaTriangles( void ){
int indexes[ MAX_SAMPLES ];
vec3_t votes[ MAX_SAMPLES ];
/* note it */
Sys_FPrintf( SYS_VRB, "--- SmoothMetaTriangles ---\n" );
@ -1017,6 +970,7 @@ void SmoothMetaTriangles( void ){
else{
shadeAngle = defaultShadeAngle;
}
if ( shadeAngle > maxShadeAngle ) {
maxShadeAngle = shadeAngle;
}
@ -1565,47 +1519,47 @@ static int CompareMetaTriangles( const void *a, const void *b ){
/* shader first */
if ( ( (metaTriangle_t*) a )->si < ( (metaTriangle_t*) b )->si ) {
if ( ( (metaTriangle_t*) a )->si < ( (const metaTriangle_t*) b )->si ) {
return 1;
}
else if ( ( (metaTriangle_t*) a )->si > ( (metaTriangle_t*) b )->si ) {
else if ( ( (metaTriangle_t*) a )->si > ( (const metaTriangle_t*) b )->si ) {
return -1;
}
/* then fog */
else if ( ( (metaTriangle_t*) a )->fogNum < ( (metaTriangle_t*) b )->fogNum ) {
else if ( ( (metaTriangle_t*) a )->fogNum < ( (const metaTriangle_t*) b )->fogNum ) {
return 1;
}
else if ( ( (metaTriangle_t*) a )->fogNum > ( (metaTriangle_t*) b )->fogNum ) {
else if ( ( (metaTriangle_t*) a )->fogNum > ( (const metaTriangle_t*) b )->fogNum ) {
return -1;
}
/* then plane */
#if 0
else if ( npDegrees == 0.0f && ( (metaTriangle_t*) a )->si->nonplanar == qfalse &&
( (metaTriangle_t*) a )->planeNum >= 0 && ( (metaTriangle_t*) a )->planeNum >= 0 ) {
if ( ( (metaTriangle_t*) a )->plane[ 3 ] < ( (metaTriangle_t*) b )->plane[ 3 ] ) {
else if ( npDegrees == 0.0f && ( (const metaTriangle_t*) a )->si->nonplanar == qfalse &&
( (const metaTriangle_t*) a )->planeNum >= 0 && ( (const metaTriangle_t*) a )->planeNum >= 0 ) {
if ( ( (const metaTriangle_t*) a )->plane[ 3 ] < ( (const metaTriangle_t*) b )->plane[ 3 ] ) {
return 1;
}
else if ( ( (metaTriangle_t*) a )->plane[ 3 ] > ( (metaTriangle_t*) b )->plane[ 3 ] ) {
else if ( ( (const metaTriangle_t*) a )->plane[ 3 ] > ( (const metaTriangle_t*) b )->plane[ 3 ] ) {
return -1;
}
else if ( ( (metaTriangle_t*) a )->plane[ 0 ] < ( (metaTriangle_t*) b )->plane[ 0 ] ) {
else if ( ( (const metaTriangle_t*) a )->plane[ 0 ] < ( (const metaTriangle_t*) b )->plane[ 0 ] ) {
return 1;
}
else if ( ( (metaTriangle_t*) a )->plane[ 0 ] > ( (metaTriangle_t*) b )->plane[ 0 ] ) {
else if ( ( (const metaTriangle_t*) a )->plane[ 0 ] > ( (const metaTriangle_t*) b )->plane[ 0 ] ) {
return -1;
}
else if ( ( (metaTriangle_t*) a )->plane[ 1 ] < ( (metaTriangle_t*) b )->plane[ 1 ] ) {
else if ( ( (const metaTriangle_t*) a )->plane[ 1 ] < ( (const metaTriangle_t*) b )->plane[ 1 ] ) {
return 1;
}
else if ( ( (metaTriangle_t*) a )->plane[ 1 ] > ( (metaTriangle_t*) b )->plane[ 1 ] ) {
else if ( ( (const metaTriangle_t*) a )->plane[ 1 ] > ( (const metaTriangle_t*) b )->plane[ 1 ] ) {
return -1;
}
else if ( ( (metaTriangle_t*) a )->plane[ 2 ] < ( (metaTriangle_t*) b )->plane[ 2 ] ) {
else if ( ( (const metaTriangle_t*) a )->plane[ 2 ] < ( (const metaTriangle_t*) b )->plane[ 2 ] ) {
return 1;
}
else if ( ( (metaTriangle_t*) a )->plane[ 2 ] > ( (metaTriangle_t*) b )->plane[ 2 ] ) {
else if ( ( (const metaTriangle_t*) a )->plane[ 2 ] > ( (const metaTriangle_t*) b )->plane[ 2 ] ) {
return -1;
}
}
@ -1618,8 +1572,8 @@ static int CompareMetaTriangles( const void *a, const void *b ){
VectorSet( bMins, 999999, 999999, 999999 );
for ( i = 0; i < 3; i++ )
{
av = ( (metaTriangle_t*) a )->indexes[ i ];
bv = ( (metaTriangle_t*) b )->indexes[ i ];
av = ( (const metaTriangle_t*) a )->indexes[ i ];
bv = ( (const metaTriangle_t*) b )->indexes[ i ];
for ( j = 0; j < 3; j++ )
{
if ( metaVerts[ av ].xyz[ j ] < aMins[ j ] ) {

View file

@ -55,7 +55,8 @@ typedef struct edgeLine_s {
vec3_t origin;
vec3_t dir;
edgePoint_t chain; // unused element of doubly linked list
// unused element of doubly linked list
edgePoint_t chain;
} edgeLine_t;
typedef struct {
@ -67,7 +68,6 @@ typedef struct {
originalEdge_t originalEdges[MAX_ORIGINAL_EDGES];
int numOriginalEdges;
#define MAX_EDGE_LINES 0x10000
edgeLine_t edgeLines[MAX_EDGE_LINES];
int numEdgeLines;
@ -381,7 +381,7 @@ void FixSurfaceJunctions( mapDrawSurface_t *ds ) {
p = e->chain.prev;
}
for ( ; p != &e->chain ; ) {
for ( ; p != &e->chain ; ) {
if ( start < end ) {
if ( p->intercept > end - ON_EPSILON ) {
break;
@ -610,8 +610,8 @@ qboolean FixBrokenSurface( mapDrawSurface_t *ds ){
int EdgeCompare( const void *elem1, const void *elem2 ) {
float d1, d2;
d1 = ( (originalEdge_t *)elem1 )->length;
d2 = ( (originalEdge_t *)elem2 )->length;
d1 = ( (const originalEdge_t *)elem1 )->length;
d2 = ( (const originalEdge_t *)elem2 )->length;
if ( d1 < d2 ) {
return -1;
@ -636,7 +636,6 @@ void FixTJunctions( entity_t *ent ){
int axialEdgeLines;
originalEdge_t *e;
/* meta mode has its own t-junction code (currently not as good as this code) */
//% if( meta )
//% return;

View file

@ -99,10 +99,10 @@ void prl( leaf_t *l ){
=============
*/
int PComp( const void *a, const void *b ){
if ( ( *(vportal_t **)a )->nummightsee == ( *(vportal_t **)b )->nummightsee ) {
if ( ( *(const vportal_t **)a )->nummightsee == ( *(const vportal_t **)b )->nummightsee ) {
return 0;
}
if ( ( *(vportal_t **)a )->nummightsee < ( *(vportal_t **)b )->nummightsee ) {
if ( ( *(const vportal_t **)a )->nummightsee < ( *(const vportal_t **)b )->nummightsee ) {
return -1;
}
return 1;
@ -929,8 +929,8 @@ void LoadPortals( char *name ){
if ( numpoints > MAX_POINTS_ON_WINDING ) {
Error( "LoadPortals: portal %i has too many points", i );
}
if ( (unsigned)leafnums[0] > portalclusters
|| (unsigned)leafnums[1] > portalclusters ) {
if ( leafnums[0] > portalclusters
|| leafnums[1] > portalclusters ) {
Error( "LoadPortals: reading portal %i", i );
}
if ( fscanf( f, "%i ", &hint ) != 1 ) {
@ -954,7 +954,10 @@ void LoadPortals( char *name ){
for ( k = 0 ; k < 3 ; k++ )
w->points[j][k] = v[k];
}
fscanf( f, "\n" );
if ( fscanf( f, "\n" ) != 0)
{
// silence gcc warning
}
// calc plane
PlaneFromWinding( w, &plane );
@ -1029,7 +1032,10 @@ void LoadPortals( char *name ){
for ( k = 0 ; k < 3 ; k++ )
w->points[j][k] = v[k];
}
fscanf( f, "\n" );
if ( fscanf( f, "\n" ) != 0)
{
// silence gcc warning
}
// calc plane
PlaneFromWinding( w, &plane );