fix simple warnings

This commit is contained in:
Garux 2020-01-24 02:47:33 +03:00
parent 5848e22f0a
commit e5d040a770
55 changed files with 384 additions and 447 deletions

View File

@ -76,7 +76,7 @@ const char* getCommandTitleList(){
return ""; return "";
} }
void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){ void dispatch( const char* command, float* vMin, float* vMax, bool bSingleBrush ){
char *message = NULL; const char *message = NULL;
if ( string_equal( command, "About" ) ) { if ( string_equal( command, "About" ) ) {
GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ), GlobalRadiant().m_pfnMessageBox( GTK_WIDGET( g_mainwnd ),
"UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About", "UFO:AI Plugin (http://ufoai.sf.net)\nBuild: " __DATE__ "\nRadiant version: " RADIANT_VERSION "\nPlugin version: " PLUGIN_VERSION "\nAuthor: Martin Gerhardy (tlh2000/mattn)\n", "About",

View File

@ -130,7 +130,7 @@ void get_team_count( const char *classname, int *count, int *team ){
/** /**
* @brief Some default values to worldspawn like maxlevel and so on * @brief Some default values to worldspawn like maxlevel and so on
*/ */
void assign_default_values_to_worldspawn( bool override, char **returnMsg ){ void assign_default_values_to_worldspawn( bool override, const char **returnMsg ){
static char message[1024]; static char message[1024];
Entity* worldspawn; Entity* worldspawn;
int teams = 0; int teams = 0;
@ -190,7 +190,7 @@ int check_entity_flags( const char *classname, const char *flag ){
* @brief Will check e.g. the map entities for valid values * @brief Will check e.g. the map entities for valid values
* @todo: check for maxlevel * @todo: check for maxlevel
*/ */
void check_map_values( char **returnMsg ){ void check_map_values( const char **returnMsg ){
static char message[1024]; static char message[1024];
int count = 0; int count = 0;
int teams = 0; int teams = 0;

View File

@ -19,8 +19,8 @@
#if !defined( INCLUDED_UFOAI_LEVEL_H ) #if !defined( INCLUDED_UFOAI_LEVEL_H )
#define INCLUDED_UFOAI_LEVEL_H #define INCLUDED_UFOAI_LEVEL_H
void assign_default_values_to_worldspawn( bool override, char **returnMsg ); void assign_default_values_to_worldspawn( bool override, const char **returnMsg );
void check_map_values( char **returnMsg ); void check_map_values( const char **returnMsg );
void get_team_count( const char *classname, int *count, int *team ); void get_team_count( const char *classname, int *count, int *team );
#endif #endif

View File

@ -503,7 +503,7 @@ void PC_PrintDefineHashTable(define_t **definehash)
int PC_NameHash(char *name) int PC_NameHash(char *name)
{ {
int register hash, i; int hash, i;
hash = 0; hash = 0;
for (i = 0; name[i] != '\0'; i++) for (i = 0; name[i] != '\0'; i++)

View File

@ -115,7 +115,7 @@ punctuation_t default_punctuations[] =
#ifdef DOLLAR #ifdef DOLLAR
{"$",P_DOLLAR, NULL}, {"$",P_DOLLAR, NULL},
#endif //DOLLAR #endif //DOLLAR
{NULL, 0} {NULL, 0, NULL}
}; };
char basefolder[MAX_PATH]; char basefolder[MAX_PATH];

View File

@ -38,53 +38,53 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//bounding box definition //bounding box definition
fielddef_t bbox_fields[] = fielddef_t bbox_fields[] =
{ {
{"presencetype", BBOX_OFS(presencetype), FT_INT}, {"presencetype", BBOX_OFS(presencetype), FT_INT, 0, 0, 0, NULL},
{"flags", BBOX_OFS(flags), FT_INT}, {"flags", BBOX_OFS(flags), FT_INT, 0, 0, 0, NULL},
{"mins", BBOX_OFS(mins), FT_FLOAT|FT_ARRAY, 3}, {"mins", BBOX_OFS(mins), FT_FLOAT|FT_ARRAY, 3, 0, 0, NULL},
{"maxs", BBOX_OFS(maxs), FT_FLOAT|FT_ARRAY, 3}, {"maxs", BBOX_OFS(maxs), FT_FLOAT|FT_ARRAY, 3, 0, 0, NULL},
{NULL, 0, 0, 0} {NULL, 0, 0, 0, 0, 0, NULL}
}; };
fielddef_t cfg_fields[] = fielddef_t cfg_fields[] =
{ {
{"phys_gravitydirection", CFG_OFS(phys_gravitydirection), FT_FLOAT|FT_ARRAY, 3}, {"phys_gravitydirection", CFG_OFS(phys_gravitydirection), FT_FLOAT|FT_ARRAY, 3, 0, 0, NULL},
{"phys_friction", CFG_OFS(phys_friction), FT_FLOAT}, {"phys_friction", CFG_OFS(phys_friction), FT_FLOAT, 0, 0, 0, NULL},
{"phys_stopspeed", CFG_OFS(phys_stopspeed), FT_FLOAT}, {"phys_stopspeed", CFG_OFS(phys_stopspeed), FT_FLOAT, 0, 0, 0, NULL},
{"phys_gravity", CFG_OFS(phys_gravity), FT_FLOAT}, {"phys_gravity", CFG_OFS(phys_gravity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_waterfriction", CFG_OFS(phys_waterfriction), FT_FLOAT}, {"phys_waterfriction", CFG_OFS(phys_waterfriction), FT_FLOAT, 0, 0, 0, NULL},
{"phys_watergravity", CFG_OFS(phys_watergravity), FT_FLOAT}, {"phys_watergravity", CFG_OFS(phys_watergravity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxvelocity", CFG_OFS(phys_maxvelocity), FT_FLOAT}, {"phys_maxvelocity", CFG_OFS(phys_maxvelocity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxwalkvelocity", CFG_OFS(phys_maxwalkvelocity), FT_FLOAT}, {"phys_maxwalkvelocity", CFG_OFS(phys_maxwalkvelocity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxcrouchvelocity", CFG_OFS(phys_maxcrouchvelocity), FT_FLOAT}, {"phys_maxcrouchvelocity", CFG_OFS(phys_maxcrouchvelocity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxswimvelocity", CFG_OFS(phys_maxswimvelocity), FT_FLOAT}, {"phys_maxswimvelocity", CFG_OFS(phys_maxswimvelocity), FT_FLOAT, 0, 0, 0, NULL},
{"phys_walkaccelerate", CFG_OFS(phys_walkaccelerate), FT_FLOAT}, {"phys_walkaccelerate", CFG_OFS(phys_walkaccelerate), FT_FLOAT, 0, 0, 0, NULL},
{"phys_airaccelerate", CFG_OFS(phys_airaccelerate), FT_FLOAT}, {"phys_airaccelerate", CFG_OFS(phys_airaccelerate), FT_FLOAT, 0, 0, 0, NULL},
{"phys_swimaccelerate", CFG_OFS(phys_swimaccelerate), FT_FLOAT}, {"phys_swimaccelerate", CFG_OFS(phys_swimaccelerate), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxstep", CFG_OFS(phys_maxstep), FT_FLOAT}, {"phys_maxstep", CFG_OFS(phys_maxstep), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxsteepness", CFG_OFS(phys_maxsteepness), FT_FLOAT}, {"phys_maxsteepness", CFG_OFS(phys_maxsteepness), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxwaterjump", CFG_OFS(phys_maxwaterjump), FT_FLOAT}, {"phys_maxwaterjump", CFG_OFS(phys_maxwaterjump), FT_FLOAT, 0, 0, 0, NULL},
{"phys_maxbarrier", CFG_OFS(phys_maxbarrier), FT_FLOAT}, {"phys_maxbarrier", CFG_OFS(phys_maxbarrier), FT_FLOAT, 0, 0, 0, NULL},
{"phys_jumpvel", CFG_OFS(phys_jumpvel), FT_FLOAT}, {"phys_jumpvel", CFG_OFS(phys_jumpvel), FT_FLOAT, 0, 0, 0, NULL},
{"phys_falldelta5", CFG_OFS(phys_falldelta5), FT_FLOAT}, {"phys_falldelta5", CFG_OFS(phys_falldelta5), FT_FLOAT, 0, 0, 0, NULL},
{"phys_falldelta10", CFG_OFS(phys_falldelta10), FT_FLOAT}, {"phys_falldelta10", CFG_OFS(phys_falldelta10), FT_FLOAT, 0, 0, 0, NULL},
{"rs_waterjump", CFG_OFS(rs_waterjump), FT_FLOAT}, {"rs_waterjump", CFG_OFS(rs_waterjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_teleport", CFG_OFS(rs_teleport), FT_FLOAT}, {"rs_teleport", CFG_OFS(rs_teleport), FT_FLOAT, 0, 0, 0, NULL},
{"rs_barrierjump", CFG_OFS(rs_barrierjump), FT_FLOAT}, {"rs_barrierjump", CFG_OFS(rs_barrierjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startcrouch", CFG_OFS(rs_startcrouch), FT_FLOAT}, {"rs_startcrouch", CFG_OFS(rs_startcrouch), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startgrapple", CFG_OFS(rs_startgrapple), FT_FLOAT}, {"rs_startgrapple", CFG_OFS(rs_startgrapple), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startwalkoffledge", CFG_OFS(rs_startwalkoffledge), FT_FLOAT}, {"rs_startwalkoffledge", CFG_OFS(rs_startwalkoffledge), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startjump", CFG_OFS(rs_startjump), FT_FLOAT}, {"rs_startjump", CFG_OFS(rs_startjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_rocketjump", CFG_OFS(rs_rocketjump), FT_FLOAT}, {"rs_rocketjump", CFG_OFS(rs_rocketjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_bfgjump", CFG_OFS(rs_bfgjump), FT_FLOAT}, {"rs_bfgjump", CFG_OFS(rs_bfgjump), FT_FLOAT, 0, 0, 0, NULL},
{"rs_jumppad", CFG_OFS(rs_jumppad), FT_FLOAT}, {"rs_jumppad", CFG_OFS(rs_jumppad), FT_FLOAT, 0, 0, 0, NULL},
{"rs_aircontrolledjumppad", CFG_OFS(rs_aircontrolledjumppad), FT_FLOAT}, {"rs_aircontrolledjumppad", CFG_OFS(rs_aircontrolledjumppad), FT_FLOAT, 0, 0, 0, NULL},
{"rs_funcbob", CFG_OFS(rs_funcbob), FT_FLOAT}, {"rs_funcbob", CFG_OFS(rs_funcbob), FT_FLOAT, 0, 0, 0, NULL},
{"rs_startelevator", CFG_OFS(rs_startelevator), FT_FLOAT}, {"rs_startelevator", CFG_OFS(rs_startelevator), FT_FLOAT, 0, 0, 0, NULL},
{"rs_falldamage5", CFG_OFS(rs_falldamage5), FT_FLOAT}, {"rs_falldamage5", CFG_OFS(rs_falldamage5), FT_FLOAT, 0, 0, 0, NULL},
{"rs_falldamage10", CFG_OFS(rs_falldamage10), FT_FLOAT}, {"rs_falldamage10", CFG_OFS(rs_falldamage10), FT_FLOAT, 0, 0, 0, NULL},
{"rs_maxfallheight", CFG_OFS(rs_maxfallheight), FT_FLOAT}, {"rs_maxfallheight", CFG_OFS(rs_maxfallheight), FT_FLOAT, 0, 0, 0, NULL},
{"rs_maxjumpfallheight", CFG_OFS(rs_maxjumpfallheight), FT_FLOAT}, {"rs_maxjumpfallheight", CFG_OFS(rs_maxjumpfallheight), FT_FLOAT, 0, 0, 0, NULL},
{NULL, 0, 0, 0} {NULL, 0, 0, 0, 0, 0, NULL}
}; };
structdef_t bbox_struct = structdef_t bbox_struct =

View File

@ -467,7 +467,7 @@ void CreateAASFilesForAllBSPFiles(char *quakepath)
quakefile_t *GetArgumentFiles(int argc, char *argv[], int *i, char *ext) quakefile_t *GetArgumentFiles(int argc, char *argv[], int *i, char *ext)
{ {
quakefile_t *qfiles, *lastqf, *qf; quakefile_t *qfiles, *lastqf, *qf;
int j; size_t j;
char buf[1024]; char buf[1024];
qfiles = NULL; qfiles = NULL;

View File

@ -529,15 +529,13 @@ HL_LoadBSPFile
*/ */
void HL_LoadBSPFile (char *filename, int offset, int length) void HL_LoadBSPFile (char *filename, int offset, int length)
{ {
int i;
// //
// load the file header // load the file header
// //
hl_fileLength = LoadFile (filename, (void **)&hl_header, offset, length); hl_fileLength = LoadFile (filename, (void **)&hl_header, offset, length);
// swap the header // swap the header
for (i=0 ; i< sizeof(hl_dheader_t)/4 ; i++) for (size_t i=0 ; i< sizeof(hl_dheader_t)/4 ; i++)
((int *)hl_header)[i] = LittleLong ( ((int *)hl_header)[i]); ((int *)hl_header)[i] = LittleLong ( ((int *)hl_header)[i]);
if (hl_header->version != HL_BSPVERSION) if (hl_header->version != HL_BSPVERSION)

View File

@ -421,19 +421,17 @@ Q1_LoadBSPFile
*/ */
void Q1_LoadBSPFile(char *filename, int offset, int length) void Q1_LoadBSPFile(char *filename, int offset, int length)
{ {
int i;
// //
// load the file header // load the file header
// //
q1_fileLength = LoadFile(filename, (void **)&q1_header, offset, length); q1_fileLength = LoadFile(filename, (void **)&q1_header, offset, length);
// swap the header // swap the header
for (i=0 ; i< sizeof(q1_dheader_t)/4 ; i++) for (size_t i=0 ; i< sizeof(q1_dheader_t)/4 ; i++)
((int *)q1_header)[i] = LittleLong ( ((int *)q1_header)[i]); ((int *)q1_header)[i] = LittleLong ( ((int *)q1_header)[i]);
if (q1_header->version != Q1_BSPVERSION) if (q1_header->version != Q1_BSPVERSION)
Error ("%s is version %i, not %i", filename, i, Q1_BSPVERSION); Error ("%s is version %i, not %i", filename, q1_header->version, Q1_BSPVERSION);
q1_nummodels = Q1_CopyLump (Q1_LUMP_MODELS, q1_dmodels, sizeof(q1_dmodel_t), Q1_MAX_MAP_MODELS ); q1_nummodels = Q1_CopyLump (Q1_LUMP_MODELS, q1_dmodels, sizeof(q1_dmodel_t), Q1_MAX_MAP_MODELS );
q1_numvertexes = Q1_CopyLump (Q1_LUMP_VERTEXES, q1_dvertexes, sizeof(q1_dvertex_t), Q1_MAX_MAP_VERTS ); q1_numvertexes = Q1_CopyLump (Q1_LUMP_VERTEXES, q1_dvertexes, sizeof(q1_dvertex_t), Q1_MAX_MAP_VERTS );

View File

@ -857,15 +857,13 @@ LoadBSPFile
*/ */
void Q2_LoadBSPFile(char *filename, int offset, int length) void Q2_LoadBSPFile(char *filename, int offset, int length)
{ {
int i;
// //
// load the file header // load the file header
// //
LoadFile (filename, (void **)&header, offset, length); LoadFile (filename, (void **)&header, offset, length);
// swap the header // swap the header
for (i=0 ; i< sizeof(dheader_t)/4 ; i++) for (size_t i=0 ; i< sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]); ((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (header->ident != IDBSPHEADER) if (header->ident != IDBSPHEADER)
@ -915,7 +913,6 @@ Only loads the texinfo lump, so qdata can scan for textures
*/ */
void Q2_LoadBSPFileTexinfo (char *filename) void Q2_LoadBSPFileTexinfo (char *filename)
{ {
int i;
FILE *f; FILE *f;
int length, ofs; int length, ofs;
@ -925,7 +922,7 @@ void Q2_LoadBSPFileTexinfo (char *filename)
fread (header, sizeof(dheader_t), 1, f); fread (header, sizeof(dheader_t), 1, f);
// swap the header // swap the header
for (i=0 ; i< sizeof(dheader_t)/4 ; i++) for (size_t i=0 ; i< sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]); ((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (header->ident != IDBSPHEADER) if (header->ident != IDBSPHEADER)

View File

@ -829,15 +829,13 @@ Sin_LoadBSPFile
*/ */
void Sin_LoadBSPFile(char *filename, int offset, int length) void Sin_LoadBSPFile(char *filename, int offset, int length)
{ {
int i;
// //
// load the file header // load the file header
// //
LoadFile (filename, (void **)&header, offset, length); LoadFile (filename, (void **)&header, offset, length);
// swap the header // swap the header
for (i=0 ; i< sizeof(sin_dheader_t)/4 ; i++) for (size_t i=0 ; i< sizeof(sin_dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]); ((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (header->ident != SIN_BSPHEADER && header->ident != SINGAME_BSPHEADER) if (header->ident != SIN_BSPHEADER && header->ident != SINGAME_BSPHEADER)
@ -909,7 +907,6 @@ Only loads the sin_texinfo lump, so qdata can scan for textures
*/ */
void Sin_LoadBSPFileTexinfo (char *filename) void Sin_LoadBSPFileTexinfo (char *filename)
{ {
int i;
FILE *f; FILE *f;
int length, ofs; int length, ofs;
@ -919,7 +916,7 @@ void Sin_LoadBSPFileTexinfo (char *filename)
fread (header, sizeof(sin_dheader_t), 1, f); fread (header, sizeof(sin_dheader_t), 1, f);
// swap the header // swap the header
for (i=0 ; i< sizeof(sin_dheader_t)/4 ; i++) for (size_t i=0 ; i< sizeof(sin_dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]); ((int *)header)[i] = LittleLong ( ((int *)header)[i]);
if (header->ident != SIN_BSPHEADER && header->ident != SINGAME_BSPHEADER) if (header->ident != SIN_BSPHEADER && header->ident != SINGAME_BSPHEADER)

View File

@ -391,7 +391,9 @@ void Q_getwd (char *out)
#endif #endif
} }
#ifdef WIN32
#include <direct.h>
#endif
void Q_mkdir (char *path) void Q_mkdir (char *path)
{ {
#ifdef WIN32 #ifdef WIN32

View File

@ -246,7 +246,6 @@ quakefile_t *FindQuakeFilesInZip(char *zipfile, char *filter)
unz_global_info gi; unz_global_info gi;
char filename_inzip[MAX_PATH]; char filename_inzip[MAX_PATH];
unz_file_info file_info; unz_file_info file_info;
int i;
quakefile_t *qfiles, *lastqf, *qf; quakefile_t *qfiles, *lastqf, *qf;
uf = unzOpen(zipfile); uf = unzOpen(zipfile);
@ -258,7 +257,7 @@ quakefile_t *FindQuakeFilesInZip(char *zipfile, char *filter)
qfiles = NULL; qfiles = NULL;
lastqf = NULL; lastqf = NULL;
for (i = 0; i < gi.number_entry; i++) for (size_t i = 0; i < gi.number_entry; i++)
{ {
err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL,0,NULL,0); err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, sizeof(filename_inzip), NULL,0,NULL,0);
if (err != UNZ_OK) break; if (err != UNZ_OK) break;

View File

@ -572,7 +572,6 @@ void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
int *i; int *i;
void *v; void *v;
} buf; } buf;
int i;
dheader_t header; dheader_t header;
int length; int length;
static unsigned last_checksum; static unsigned last_checksum;
@ -623,7 +622,7 @@ void CM_LoadMap( const char *name, qboolean clientload, int *checksum ) {
*checksum = last_checksum; *checksum = last_checksum;
header = *(dheader_t *) buf.i; header = *(dheader_t *) buf.i;
for (i=0 ; i<sizeof(dheader_t)/4 ; i++) { for (size_t i=0 ; i<sizeof(dheader_t)/4 ; i++) {
((int *)&header)[i] = LittleLong ( ((int *)&header)[i]); ((int *)&header)[i] = LittleLong ( ((int *)&header)[i]);
} }

View File

@ -215,8 +215,9 @@ void SwapBSPFile( qboolean todisk ){
// //
for ( i = 0 ; i < numtexinfo ; i++ ) for ( i = 0 ; i < numtexinfo ; i++ )
{ {
for ( j = 0 ; j < 8 ; j++ ) for ( j = 0 ; j < 2 ; j++ )
texinfo[i].vecs[0][j] = LittleFloat( texinfo[i].vecs[0][j] ); for ( int k = 0 ; k < 4 ; k++ )
texinfo[i].vecs[j][k] = LittleFloat( texinfo[i].vecs[j][k] );
texinfo[i].flags = LittleLong( texinfo[i].flags ); texinfo[i].flags = LittleLong( texinfo[i].flags );
texinfo[i].value = LittleLong( texinfo[i].value ); texinfo[i].value = LittleLong( texinfo[i].value );
texinfo[i].nexttexinfo = LittleLong( texinfo[i].nexttexinfo ); texinfo[i].nexttexinfo = LittleLong( texinfo[i].nexttexinfo );
@ -377,15 +378,13 @@ int CopyLump( int lump, void *dest, int size ){
============= =============
*/ */
void LoadBSPFile( char *filename ){ void LoadBSPFile( char *filename ){
int i;
// //
// load the file header // load the file header
// //
LoadFile( filename, (void **)&header ); LoadFile( filename, (void **)&header );
// swap the header // swap the header
for ( i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ ) for ( size_t i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
( (int *)header )[i] = LittleLong( ( (int *)header )[i] ); ( (int *)header )[i] = LittleLong( ( (int *)header )[i] );
if ( header->ident != IDBSPHEADER ) { if ( header->ident != IDBSPHEADER ) {
@ -434,7 +433,6 @@ void LoadBSPFile( char *filename ){
============= =============
*/ */
void LoadBSPFileTexinfo( char *filename ){ void LoadBSPFileTexinfo( char *filename ){
int i;
FILE *f; FILE *f;
int length, ofs; int length, ofs;
@ -444,7 +442,7 @@ void LoadBSPFileTexinfo( char *filename ){
fread( header, sizeof( dheader_t ), 1, f ); fread( header, sizeof( dheader_t ), 1, f );
// swap the header // swap the header
for ( i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ ) for ( size_t i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
( (int *)header )[i] = LittleLong( ( (int *)header )[i] ); ( (int *)header )[i] = LittleLong( ( (int *)header )[i] );
if ( header->ident != IDBSPHEADER ) { if ( header->ident != IDBSPHEADER ) {

View File

@ -177,8 +177,6 @@ void SetQdirFromPath( const char *path ){
len = strlen( basedirname ); len = strlen( basedirname );
for ( c = path + strlen( path ) - 1 ; c != path ; c-- ) for ( c = path + strlen( path ) - 1 ; c != path ; c-- )
{ {
int i;
if ( !Q_strncasecmp( c, basedirname, len ) ) { if ( !Q_strncasecmp( c, basedirname, len ) ) {
// //
//strncpy (qdir, path, c+len+2-path); //strncpy (qdir, path, c+len+2-path);
@ -194,7 +192,7 @@ void SetQdirFromPath( const char *path ){
} }
strncpy( qdir, path, c + len + count - path ); strncpy( qdir, path, c + len + count - path );
Sys_FPrintf( SYS_VRB, "qdir: %s\n", qdir ); Sys_FPrintf( SYS_VRB, "qdir: %s\n", qdir );
for ( i = 0; i < strlen( qdir ); i++ ) for ( size_t i = 0; i < strlen( qdir ); i++ )
{ {
if ( qdir[i] == '\\' ) { if ( qdir[i] == '\\' ) {
qdir[i] = '/'; qdir[i] = '/';
@ -207,7 +205,7 @@ void SetQdirFromPath( const char *path ){
if ( *c == '/' || *c == '\\' ) { if ( *c == '/' || *c == '\\' ) {
strncpy( gamedir, path, c + 1 - path ); strncpy( gamedir, path, c + 1 - path );
for ( i = 0; i < strlen( gamedir ); i++ ) for ( size_t i = 0; i < strlen( gamedir ); i++ )
{ {
if ( gamedir[i] == '\\' ) { if ( gamedir[i] == '\\' ) {
gamedir[i] = '/'; gamedir[i] = '/';
@ -250,7 +248,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] == ':' ) {
@ -263,7 +261,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

@ -32,7 +32,7 @@
#include <time.h> #include <time.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef WIN32 #ifdef _MSC_VER
#ifdef NDEBUG // Don't show in a Release build #ifdef NDEBUG // Don't show in a Release build
#pragma warning(disable : 4305) // truncate from double to float #pragma warning(disable : 4305) // truncate from double to float
#pragma warning(disable : 4244) // conversion from double to float #pragma warning(disable : 4244) // conversion from double to float
@ -40,7 +40,7 @@
#endif #endif
#endif #endif
#ifdef WIN32 #ifdef _MSC_VER
#pragma intrinsic( memset, memcpy ) #pragma intrinsic( memset, memcpy )
#endif #endif

View File

@ -66,8 +66,8 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
char buf[1024]; char buf[1024];
sprintf( buf, "%f %f %f", v[0], v[1], v[2] ); sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, "point" ); ret = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( ret, buf ); xmlNodeAddContent( ret, (const xmlChar*)buf );
return ret; return ret;
} }
@ -76,8 +76,8 @@ void xml_SendNode( xmlNodePtr node ){
xmlBufferPtr xml_buf; xmlBufferPtr xml_buf;
char xmlbuf[MAX_NETMESSAGE]; // we have to copy content from the xmlBufferPtr into an aux buffer .. that sucks .. char xmlbuf[MAX_NETMESSAGE]; // we have to copy content from the xmlBufferPtr into an aux buffer .. that sucks ..
// this index loops through the node buffer // this index loops through the node buffer
int pos = 0; size_t pos = 0;
int size; size_t size;
xmlAddChild( doc->children, node ); xmlAddChild( doc->children, node );
@ -144,15 +144,15 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node // now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg ); sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, "select" ); node = xmlNewNode( NULL, (const xmlChar*)"select" );
xmlNodeAddContent( node, buf ); xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ; level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0; level[1] = 0;
xmlSetProp( node, "level", (char *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'select' information // a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum ); sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, "brush" ); select = xmlNewNode( NULL, (const xmlChar*)"brush" );
xmlNodeAddContent( select, buf ); xmlNodeAddContent( select, (const xmlChar*)buf );
xmlAddChild( node, select ); xmlAddChild( node, select );
xml_SendNode( node ); xml_SendNode( node );
@ -171,15 +171,15 @@ void xml_Point( char *msg, vec3_t pt ){
char buf[1024]; char buf[1024];
char level[2]; char level[2];
node = xmlNewNode( NULL, "pointmsg" ); node = xmlNewNode( NULL, (const xmlChar*)"pointmsg" );
xmlNodeAddContent( node, msg ); xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR; level[0] = (int)'0' + SYS_ERR;
level[1] = 0; level[1] = 0;
xmlSetProp( node, "level", (char *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'point' node // a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] ); sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, "point" ); point = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( point, buf ); xmlNodeAddContent( point, (const xmlChar*)buf );
xmlAddChild( node, point ); xmlAddChild( node, point );
xml_SendNode( node ); xml_SendNode( node );
@ -195,11 +195,11 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
char level[2]; char level[2];
int i; int i;
node = xmlNewNode( NULL, "windingmsg" ); node = xmlNewNode( NULL, (const xmlChar*)"windingmsg" );
xmlNodeAddContent( node, msg ); xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR; level[0] = (int)'0' + SYS_ERR;
level[1] = 0; level[1] = 0;
xmlSetProp( node, "level", (char *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'winding' node // a 'winding' node
sprintf( buf, "%i ", numpoints ); sprintf( buf, "%i ", numpoints );
for ( i = 0; i < numpoints; i++ ) for ( i = 0; i < numpoints; i++ )
@ -212,8 +212,8 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
strcat( buf, smlbuf ); strcat( buf, smlbuf );
} }
winding = xmlNewNode( NULL, "winding" ); winding = xmlNewNode( NULL, (const xmlChar*)"winding" );
xmlNodeAddContent( winding, buf ); xmlNodeAddContent( winding, (const xmlChar*)buf );
xmlAddChild( node, winding ); xmlAddChild( node, winding );
xml_SendNode( node ); xml_SendNode( node );
@ -235,7 +235,7 @@ void Broadcast_Setup( const char *dest ){
char sMsg[1024]; char sMsg[1024];
Net_Setup(); Net_Setup();
Net_StringToAddress( (char *)dest, &address ); Net_StringToAddress( dest, &address );
brdcst_socket = Net_Connect( &address, 0 ); brdcst_socket = Net_Connect( &address, 0 );
if ( brdcst_socket ) { if ( brdcst_socket ) {
// send in a header // send in a header
@ -277,15 +277,15 @@ void FPrintf( int flag, char *buf ){
*/ */
if ( !bGotXML ) { if ( !bGotXML ) {
// initialize // initialize
doc = xmlNewDoc( "1.0" ); doc = xmlNewDoc( (const xmlChar*)"1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, "q3map_feedback", NULL ); doc->children = xmlNewDocRawNode( doc, NULL, (const xmlChar*)"q3map_feedback", NULL );
bGotXML = true; bGotXML = true;
} }
node = xmlNewNode( NULL, "message" ); node = xmlNewNode( NULL, (const xmlChar*)"message" );
xmlNodeAddContent( node, buf ); xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + flag; level[0] = (int)'0' + flag;
level[1] = 0; level[1] = 0;
xmlSetProp( node, "level", (char *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
xml_SendNode( node ); xml_SendNode( node );
} }

View File

@ -322,7 +322,7 @@ void InitPaths( int *argc, char **argv ){
/* remove processed arguments */ /* remove processed arguments */
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ ) for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
{ {
for ( j; j < *argc && argv[ j ] == NULL; j++ ) ; for ( ; j < *argc && argv[ j ] == NULL; j++ );
argv[ i ] = argv[ j ]; argv[ i ] = argv[ j ];
if ( argv[ i ] != NULL ) { if ( argv[ i ] != NULL ) {
k++; k++;

View File

@ -160,7 +160,6 @@ void ThreadUnlock( void ){
============= =============
*/ */
void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
int threadid[MAX_THREADS];
HANDLE threadhandle[MAX_THREADS]; HANDLE threadhandle[MAX_THREADS];
int i; int i;
int start, end; int start, end;
@ -194,7 +193,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
(LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr, (LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr,
(LPVOID)i, // LPVOID lpvThreadParm, (LPVOID)i, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate, 0, // DWORD fdwCreate,
&threadid[i] ); NULL );
} }
for ( i = 0 ; i < numthreads ; i++ ) for ( i = 0 ; i < numthreads ; i++ )

View File

@ -56,9 +56,7 @@ typedef struct {
void ByteSwapTri( tf_triangle *tri ){ void ByteSwapTri( tf_triangle *tri ){
int i; for ( size_t i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
for ( i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
{ {
( (int *)tri )[i] = BigLong( ( (int *)tri )[i] ); ( (int *)tri )[i] = BigLong( ( (int *)tri )[i] );
} }

View File

@ -765,13 +765,11 @@ side_t *SelectSplitSide( bspbrush_t *brushes, node_t *node ){
int s; int s;
int front, back, both, facing, splits; int front, back, both, facing, splits;
int bsplits; int bsplits;
int bestsplits;
int epsilonbrush; int epsilonbrush;
qboolean hintsplit; qboolean hintsplit;
bestside = NULL; bestside = NULL;
bestvalue = -99999; bestvalue = -99999;
bestsplits = 0;
// the search order goes: visible-structural, visible-detail, // the search order goes: visible-structural, visible-detail,
// nonvisible-structural, nonvisible-detail. // nonvisible-structural, nonvisible-detail.
@ -879,7 +877,7 @@ side_t *SelectSplitSide( bspbrush_t *brushes, node_t *node ){
if ( value > bestvalue ) { if ( value > bestvalue ) {
bestvalue = value; bestvalue = value;
bestside = side; bestside = side;
bestsplits = splits; // bestsplits = splits;
for ( test = brushes ; test ; test = test->next ) for ( test = brushes ; test ; test = test->next )
test->side = test->testside; test->side = test->testside;
} }

View File

@ -134,7 +134,7 @@ xmlNodePtr LeakFile( tree_t *tree ){
Error( "Couldn't open %s\n", filename ); Error( "Couldn't open %s\n", filename );
} }
xml_node = xmlNewNode( NULL, "polyline" ); xml_node = xmlNewNode( NULL, (const xmlChar*)"polyline" );
count = 0; count = 0;
node = &tree->outside_node; node = &tree->outside_node;

View File

@ -326,7 +326,7 @@ void AddPointToTriangulation( patch_t *patch, triangulation_t *trian ){
void LerpTriangle( triangulation_t *trian, triangle_t *t, vec3_t point, vec3_t color ){ void LerpTriangle( triangulation_t *trian, triangle_t *t, vec3_t point, vec3_t color ){
patch_t *p1, *p2, *p3; patch_t *p1, *p2, *p3;
vec3_t base, d1, d2; vec3_t base, d1, d2;
float x, y, x1, y1, x2, y2; float x, y, y1, x2;
p1 = trian->points[t->edges[0]->p0]; p1 = trian->points[t->edges[0]->p0];
p2 = trian->points[t->edges[1]->p0]; p2 = trian->points[t->edges[1]->p0];
@ -339,11 +339,11 @@ void LerpTriangle( triangulation_t *trian, triangle_t *t, vec3_t point, vec3_
x = DotProduct( point, t->edges[0]->normal ) - t->edges[0]->dist; x = DotProduct( point, t->edges[0]->normal ) - t->edges[0]->dist;
y = DotProduct( point, t->edges[2]->normal ) - t->edges[2]->dist; y = DotProduct( point, t->edges[2]->normal ) - t->edges[2]->dist;
x1 = 0; // x1 = 0;
y1 = DotProduct( p2->origin, t->edges[2]->normal ) - t->edges[2]->dist; y1 = DotProduct( p2->origin, t->edges[2]->normal ) - t->edges[2]->dist;
x2 = DotProduct( p3->origin, t->edges[0]->normal ) - t->edges[0]->dist; x2 = DotProduct( p3->origin, t->edges[0]->normal ) - t->edges[0]->dist;
y2 = 0; // y2 = 0;
if ( fabs( y1 ) < ON_EPSILON || fabs( x2 ) < ON_EPSILON ) { if ( fabs( y1 ) < ON_EPSILON || fabs( x2 ) < ON_EPSILON ) {
VectorCopy( base, color ); VectorCopy( base, color );
@ -787,7 +787,7 @@ void CreateDirectLights( void ){
// //
// surfaces // surfaces
// //
for ( i = 0, p = patches ; i < (int) num_patches ; i++, p++ ) for ( i = 0, p = patches ; i < num_patches ; i++, p++ )
{ {
if ( p->totallight[0] < DIRECT_LIGHT if ( p->totallight[0] < DIRECT_LIGHT
&& p->totallight[1] < DIRECT_LIGHT && p->totallight[1] < DIRECT_LIGHT

View File

@ -828,7 +828,6 @@ qboolean ParseMapEntity( void ){
epair_t *e; epair_t *e;
side_t *s; side_t *s;
int i, j; int i, j;
int startbrush, startsides;
vec_t newdist; vec_t newdist;
mapbrush_t *b; mapbrush_t *b;
@ -844,9 +843,6 @@ qboolean ParseMapEntity( void ){
Error( "num_entities == MAX_MAP_ENTITIES" ); Error( "num_entities == MAX_MAP_ENTITIES" );
} }
startbrush = nummapbrushes;
startsides = nummapbrushsides;
mapent = &entities[num_entities]; mapent = &entities[num_entities];
num_entities++; num_entities++;
memset( mapent, 0, sizeof( *mapent ) ); memset( mapent, 0, sizeof( *mapent ) );

View File

@ -241,12 +241,12 @@ void ProcessWorldModel( void ){
Sys_FPrintf( SYS_NOXML, "******* leaked *******\n" ); Sys_FPrintf( SYS_NOXML, "******* leaked *******\n" );
Sys_FPrintf( SYS_NOXML, "**********************\n" ); Sys_FPrintf( SYS_NOXML, "**********************\n" );
polyline = LeakFile( tree ); polyline = LeakFile( tree );
leaknode = xmlNewNode( NULL, "message" ); leaknode = xmlNewNode( NULL, (const xmlChar*)"message" );
xmlNodeAddContent( leaknode, "MAP LEAKED\n" ); xmlNodeAddContent( leaknode, (const xmlChar*)"MAP LEAKED\n" );
xmlAddChild( leaknode, polyline ); xmlAddChild( leaknode, polyline );
level[0] = (int) '0' + SYS_ERR; level[0] = (int) '0' + SYS_ERR;
level[1] = 0; level[1] = 0;
xmlSetProp( leaknode, "level", (char*) &level ); xmlSetProp( leaknode, (const xmlChar*)"level", (const xmlChar*)level );
xml_SendNode( leaknode ); xml_SendNode( leaknode );
if ( leaktest ) { if ( leaktest ) {
Sys_Printf( "--- MAP LEAKED, ABORTING LEAKTEST ---\n" ); Sys_Printf( "--- MAP LEAKED, ABORTING LEAKTEST ---\n" );

View File

@ -36,7 +36,7 @@
patch_t *face_patches[MAX_MAP_FACES]; patch_t *face_patches[MAX_MAP_FACES];
entity_t *face_entity[MAX_MAP_FACES]; entity_t *face_entity[MAX_MAP_FACES];
patch_t patches[MAX_PATCHES]; patch_t patches[MAX_PATCHES];
unsigned num_patches; int num_patches;
vec3_t radiosity[MAX_PATCHES]; // light leaving a patch vec3_t radiosity[MAX_PATCHES]; // light leaving a patch
vec3_t illumination[MAX_PATCHES]; // light arriving at a patch vec3_t illumination[MAX_PATCHES]; // light arriving at a patch
@ -201,7 +201,7 @@ void MakeTransfers( int i ){
float total; float total;
dplane_t plane; dplane_t plane;
vec3_t origin; vec3_t origin;
float transfers[MAX_PATCHES], *all_transfers; float transfers[MAX_PATCHES];
int s; int s;
int itotal; int itotal;
byte pvs[( MAX_MAP_LEAFS + 7 ) / 8]; byte pvs[( MAX_MAP_LEAFS + 7 ) / 8];
@ -220,7 +220,6 @@ void MakeTransfers( int i ){
// find out which patch2s will collect light // find out which patch2s will collect light
// from patch // from patch
all_transfers = transfers;
patch->numtransfers = 0; patch->numtransfers = 0;
for ( j = 0, patch2 = patches ; j < num_patches ; j++, patch2++ ) for ( j = 0, patch2 = patches ; j < num_patches ; j++, patch2++ )
{ {

View File

@ -115,7 +115,7 @@ extern patch_t *face_patches[MAX_MAP_FACES];
extern entity_t *face_entity[MAX_MAP_FACES]; extern entity_t *face_entity[MAX_MAP_FACES];
extern vec3_t face_offset[MAX_MAP_FACES]; // for rotating bmodels extern vec3_t face_offset[MAX_MAP_FACES]; // for rotating bmodels
extern patch_t patches[MAX_PATCHES]; extern patch_t patches[MAX_PATCHES];
extern unsigned num_patches; extern int num_patches;
extern int leafparents[MAX_MAP_LEAFS]; extern int leafparents[MAX_MAP_LEAFS];
extern int nodeparents[MAX_MAP_NODES]; extern int nodeparents[MAX_MAP_NODES];

View File

@ -123,10 +123,10 @@ void prl( leaf_t *l ){
============= =============
*/ */
int PComp( const void *a, const void *b ){ int PComp( const void *a, const void *b ){
if ( ( *(portal_t **)a )->nummightsee == ( *(portal_t **)b )->nummightsee ) { if ( ( *(portal_t * const *)a )->nummightsee == ( *(portal_t * const *)b )->nummightsee ) {
return 0; return 0;
} }
if ( ( *(portal_t **)a )->nummightsee < ( *(portal_t **)b )->nummightsee ) { if ( ( *(portal_t * const *)a )->nummightsee < ( *(portal_t * const *)b )->nummightsee ) {
return -1; return -1;
} }
return 1; return 1;
@ -386,8 +386,8 @@ void LoadPortals( char *name ){
if ( numpoints > MAX_POINTS_ON_WINDING ) { if ( numpoints > MAX_POINTS_ON_WINDING ) {
Error( "LoadPortals: portal %i has too many points", i ); Error( "LoadPortals: portal %i has too many points", i );
} }
if ( (unsigned)leafnums[0] > portalclusters if ( leafnums[0] > portalclusters
|| (unsigned)leafnums[1] > portalclusters ) { || leafnums[1] > portalclusters ) {
Error( "LoadPortals: reading portal %i", i ); Error( "LoadPortals: reading portal %i", i );
} }

View File

@ -46,13 +46,11 @@ void EmitPlanes( void ){
int i; int i;
dplane_t *dp; dplane_t *dp;
plane_t *mp; plane_t *mp;
int planetranslate[MAX_MAP_PLANES];
mp = mapplanes; mp = mapplanes;
for ( i = 0 ; i < nummapplanes ; i++, mp++ ) for ( i = 0 ; i < nummapplanes ; i++, mp++ )
{ {
dp = &dplanes[numplanes]; dp = &dplanes[numplanes];
planetranslate[i] = numplanes;
VectorCopy( mp->normal, dp->normal ); VectorCopy( mp->normal, dp->normal );
dp->dist = mp->dist; dp->dist = mp->dist;
dp->type = mp->type; dp->type = mp->type;

View File

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

View File

@ -128,14 +128,11 @@ void H_printf( char *fmt, ... ){
============ ============
*/ */
void WriteModelFile( FILE *modelouthandle ){ void WriteModelFile( FILE *modelouthandle ){
int i;
dmdl_t modeltemp; dmdl_t modeltemp;
int j, k;
frame_t *in; frame_t *in;
daliasframe_t *out; daliasframe_t *out;
byte buffer[MAX_VERTS * 4 + 128]; byte buffer[MAX_VERTS * 4 + 128];
float v; float v;
int c_on, c_off;
model.ident = IDALIASHEADER; model.ident = IDALIASHEADER;
model.version = ALIAS_VERSION; model.version = ALIAS_VERSION;
@ -151,7 +148,7 @@ void WriteModelFile( FILE *modelouthandle ){
// //
// write out the model header // write out the model header
// //
for ( i = 0 ; i < sizeof( dmdl_t ) / 4 ; i++ ) for ( size_t i = 0 ; i < sizeof( dmdl_t ) / 4 ; i++ )
( (int *)&modeltemp )[i] = LittleLong( ( (int *)&model )[i] ); ( (int *)&modeltemp )[i] = LittleLong( ( (int *)&model )[i] );
SafeWrite( modelouthandle, &modeltemp, sizeof( modeltemp ) ); SafeWrite( modelouthandle, &modeltemp, sizeof( modeltemp ) );
@ -164,8 +161,7 @@ void WriteModelFile( FILE *modelouthandle ){
// //
// write out the texture coordinates // write out the texture coordinates
// //
c_on = c_off = 0; for ( int i = 0 ; i < model.num_st ; i++ )
for ( i = 0 ; i < model.num_st ; i++ )
{ {
base_st[i].s = LittleShort( base_st[i].s ); base_st[i].s = LittleShort( base_st[i].s );
base_st[i].t = LittleShort( base_st[i].t ); base_st[i].t = LittleShort( base_st[i].t );
@ -176,12 +172,11 @@ void WriteModelFile( FILE *modelouthandle ){
// //
// write out the triangles // write out the triangles
// //
for ( i = 0 ; i < model.num_tris ; i++ ) for ( int i = 0 ; i < model.num_tris ; i++ )
{ {
int j;
dtriangle_t tri; dtriangle_t tri;
for ( j = 0 ; j < 3 ; j++ ) for ( int j = 0 ; j < 3 ; j++ )
{ {
tri.index_xyz[j] = LittleShort( triangles[i].index_xyz[j] ); tri.index_xyz[j] = LittleShort( triangles[i].index_xyz[j] );
tri.index_st[j] = LittleShort( triangles[i].index_st[j] ); tri.index_st[j] = LittleShort( triangles[i].index_st[j] );
@ -193,24 +188,24 @@ void WriteModelFile( FILE *modelouthandle ){
// //
// write out the frames // write out the frames
// //
for ( i = 0 ; i < model.num_frames ; i++ ) for ( int i = 0 ; i < model.num_frames ; i++ )
{ {
in = &g_frames[i]; in = &g_frames[i];
out = (daliasframe_t *)buffer; out = (daliasframe_t *)buffer;
strcpy( out->name, in->name ); strcpy( out->name, in->name );
for ( j = 0 ; j < 3 ; j++ ) for ( int j = 0 ; j < 3 ; j++ )
{ {
out->scale[j] = ( in->maxs[j] - in->mins[j] ) / 255; out->scale[j] = ( in->maxs[j] - in->mins[j] ) / 255;
out->translate[j] = in->mins[j]; out->translate[j] = in->mins[j];
} }
for ( j = 0 ; j < model.num_xyz ; j++ ) for ( int j = 0 ; j < model.num_xyz ; j++ )
{ {
// all of these are byte values, so no need to deal with endianness // all of these are byte values, so no need to deal with endianness
out->verts[j].lightnormalindex = in->v[j].lightnormalindex; out->verts[j].lightnormalindex = in->v[j].lightnormalindex;
for ( k = 0 ; k < 3 ; k++ ) for ( int k = 0 ; k < 3 ; k++ )
{ {
// scale to byte values & min/max check // scale to byte values & min/max check
v = Q_rint( ( in->v[j].v[k] - out->translate[k] ) / out->scale[k] ); v = Q_rint( ( in->v[j].v[k] - out->translate[k] ) / out->scale[k] );
@ -226,7 +221,7 @@ void WriteModelFile( FILE *modelouthandle ){
} }
} }
for ( j = 0 ; j < 3 ; j++ ) for ( int j = 0 ; j < 3 ; j++ )
{ {
out->scale[j] = LittleFloat( out->scale[j] ); out->scale[j] = LittleFloat( out->scale[j] );
out->translate[j] = LittleFloat( out->translate[j] ); out->translate[j] = LittleFloat( out->translate[j] );

View File

@ -45,7 +45,7 @@ void Cmd_Spritename( void );
*/ */
void FinishSprite( void ){ void FinishSprite( void ){
FILE *spriteouthandle; FILE *spriteouthandle;
int i, curframe; int i;
dsprite_t spritetemp; dsprite_t spritetemp;
char savename[1024]; char savename[1024];
@ -87,8 +87,6 @@ void FinishSprite( void ){
// //
// write out the frames // write out the frames
// //
curframe = 0;
for ( i = 0 ; i < sprite.numframes ; i++ ) for ( i = 0 ; i < sprite.numframes ; i++ )
{ {
frames[i].width = LittleLong( frames[i].width ); frames[i].width = LittleLong( frames[i].width );
@ -136,7 +134,7 @@ void Cmd_Load( void ){
=============== ===============
*/ */
void Cmd_SpriteFrame( void ){ void Cmd_SpriteFrame( void ){
int y,xl,yl,xh,yh,w,h; int y,xl,yl,w,h;
dsprframe_t *pframe; dsprframe_t *pframe;
int ox, oy; int ox, oy;
byte *cropped; byte *cropped;
@ -172,9 +170,6 @@ void Cmd_SpriteFrame( void ){
Error( "Sprite has a dimension longer than 256" ); Error( "Sprite has a dimension longer than 256" );
} }
xh = xl + w;
yh = yl + h;
if ( sprite.numframes >= MAX_SPRFRAMES ) { if ( sprite.numframes >= MAX_SPRFRAMES ) {
Error( "Too many frames; increase MAX_SPRFRAMES\n" ); Error( "Too many frames; increase MAX_SPRFRAMES\n" );
} }

View File

@ -93,7 +93,7 @@ void FindNextChunk( char *name ){
// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len); // Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
data_p -= 8; data_p -= 8;
last_chunk = data_p + 8 + ( ( iff_chunk_len + 1 ) & ~1 ); last_chunk = data_p + 8 + ( ( iff_chunk_len + 1 ) & ~1 );
if ( !strncmp( data_p, name, 4 ) ) { if ( !strncmp( (const char*)data_p, name, 4 ) ) {
return; return;
} }
} }
@ -142,7 +142,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
// find "RIFF" chunk // find "RIFF" chunk
FindChunk( "RIFF" ); FindChunk( "RIFF" );
if ( !( data_p && !strncmp( data_p + 8, "WAVE", 4 ) ) ) { if ( !( data_p && !strncmp( (const char*)( data_p + 8 ), "WAVE", 4 ) ) ) {
printf( "Missing RIFF/WAVE chunks\n" ); printf( "Missing RIFF/WAVE chunks\n" );
return info; return info;
} }
@ -178,7 +178,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
// if the next chunk is a LIST chunk, look for a cue length marker // if the next chunk is a LIST chunk, look for a cue length marker
FindNextChunk( "LIST" ); FindNextChunk( "LIST" );
if ( data_p ) { if ( data_p ) {
if ( !strncmp( data_p + 28, "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit... if ( !strncmp( (const char*)( data_p + 28 ), "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit...
data_p += 24; data_p += 24;
i = GetLittleLong(); // samples in loop i = GetLittleLong(); // samples in loop
info.samples = info.loopstart + i; info.samples = info.loopstart + i;
@ -344,8 +344,8 @@ int bwtCompare( const void *elem1, const void *elem2 ){
int i1, i2; int i1, i2;
int b1, b2; int b1, b2;
i1 = *(int *)elem1; i1 = *(const int *)elem1;
i2 = *(int *)elem2; i2 = *(const int *)elem2;
for ( i = 0 ; i < bwt_size ; i++ ) for ( i = 0 ; i < bwt_size ; i++ )
{ {
@ -490,7 +490,7 @@ cblock_t Huffman( cblock_t in ){
unsigned bits; unsigned bits;
byte *out_p; byte *out_p;
cblock_t out; cblock_t out;
int max, maxchar; int max;
// count // count
memset( hnodes, 0, sizeof( hnodes ) ); memset( hnodes, 0, sizeof( hnodes ) );
@ -499,12 +499,10 @@ cblock_t Huffman( cblock_t in ){
// normalize counts // normalize counts
max = 0; max = 0;
maxchar = 0;
for ( i = 0 ; i < 256 ; i++ ) for ( i = 0 ; i < 256 ; i++ )
{ {
if ( hnodes[i].count > max ) { if ( hnodes[i].count > max ) {
max = hnodes[i].count; max = hnodes[i].count;
maxchar = i;
} }
} }
if ( max == 0 ) { if ( max == 0 ) {
@ -659,7 +657,7 @@ cblock_t LZSS( cblock_t in ){
int bestlength, beststart; int bestlength, beststart;
int outbits; int outbits;
if ( in.count >= sizeof( lzss_next ) / 4 ) { if ( in.count >= (int)sizeof( lzss_next ) / 4 ) {
Error( "LZSS: too big" ); Error( "LZSS: too big" );
} }
@ -1256,7 +1254,7 @@ void Cmd_Video( void ){
command = 2; command = 2;
fwrite( &command, 1, 4, output ); fwrite( &command, 1, 4, output );
printf( "Total size: %i\n", ftell( output ) ); printf( "Total size: %ld\n", ftell( output ) );
fclose( output ); fclose( output );

View File

@ -152,7 +152,7 @@ void AnimCompressDoit(){
} }
void AnimCompressToBytes( float *trans,float *scale,char *mat,char *ccomp,unsigned char *cbase,float *cscale,float *coffset,float *bmin,float *bmax ){ void AnimCompressToBytes( float *trans,float *scale,char *mat,char *ccomp,unsigned char *cbase,float *cscale,float *coffset,float *bmin,float *bmax ){
int k,l,nv,j; int k,l,j;
float maxdev; float maxdev;
float avedev; float avedev;
float tmp; float tmp;
@ -161,8 +161,6 @@ void AnimCompressToBytes( float *trans,float *scale,char *mat,char *ccomp,unsign
float *ans; float *ans;
nv = MatWidth / 3;
trans[0] = 1E30f; trans[0] = 1E30f;
scale[0] = -1E30f; scale[0] = -1E30f;
trans[1] = 1E30f; trans[1] = 1E30f;

View File

@ -216,8 +216,9 @@ void SwapBSPFile( qboolean todisk ){
// //
for ( i = 0 ; i < numtexinfo ; i++ ) for ( i = 0 ; i < numtexinfo ; i++ )
{ {
for ( j = 0 ; j < 8 ; j++ ) for ( j = 0 ; j < 2 ; j++ )
texinfo[i].vecs[0][j] = LittleFloat( texinfo[i].vecs[0][j] ); for ( int k = 0 ; k < 4 ; k++ )
texinfo[i].vecs[j][k] = LittleFloat( texinfo[i].vecs[j][k] );
texinfo[i].flags = LittleLong( texinfo[i].flags ); texinfo[i].flags = LittleLong( texinfo[i].flags );
texinfo[i].value = LittleLong( texinfo[i].value ); texinfo[i].value = LittleLong( texinfo[i].value );
texinfo[i].nexttexinfo = LittleLong( texinfo[i].nexttexinfo ); texinfo[i].nexttexinfo = LittleLong( texinfo[i].nexttexinfo );
@ -379,15 +380,13 @@ int CopyLump( int lump, void *dest, int size ){
============= =============
*/ */
void LoadBSPFile( char *filename ){ void LoadBSPFile( char *filename ){
int i;
// //
// load the file header // load the file header
// //
LoadFile( filename, (void **)&header ); LoadFile( filename, (void **)&header );
// swap the header // swap the header
for ( i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ ) for ( size_t i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
( (int *)header )[i] = LittleLong( ( (int *)header )[i] ); ( (int *)header )[i] = LittleLong( ( (int *)header )[i] );
if ( header->ident != IDBSPHEADER ) { if ( header->ident != IDBSPHEADER ) {
@ -436,7 +435,6 @@ void LoadBSPFile( char *filename ){
============= =============
*/ */
void LoadBSPFileTexinfo( char *filename ){ void LoadBSPFileTexinfo( char *filename ){
int i;
FILE *f; FILE *f;
int length, ofs; int length, ofs;
@ -446,7 +444,7 @@ void LoadBSPFileTexinfo( char *filename ){
fread( header, sizeof( dheader_t ), 1, f ); fread( header, sizeof( dheader_t ), 1, f );
// swap the header // swap the header
for ( i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ ) for ( size_t i = 0 ; i < sizeof( dheader_t ) / 4 ; i++ )
( (int *)header )[i] = LittleLong( ( (int *)header )[i] ); ( (int *)header )[i] = LittleLong( ( (int *)header )[i] );
if ( header->ident != IDBSPHEADER ) { if ( header->ident != IDBSPHEADER ) {

View File

@ -182,8 +182,6 @@ void SetQdirFromPath( const char *path ){
len = strlen( BASEDIRNAME ); len = strlen( BASEDIRNAME );
for ( c = path + strlen( path ) - 1 ; c != path ; c-- ) for ( c = path + strlen( path ) - 1 ; c != path ; c-- )
{ {
int i;
if ( !Q_strncasecmp( c, BASEDIRNAME, len ) ) { if ( !Q_strncasecmp( c, BASEDIRNAME, len ) ) {
// //
//strncpy (qdir, path, c+len+2-path); //strncpy (qdir, path, c+len+2-path);
@ -199,7 +197,7 @@ void SetQdirFromPath( const char *path ){
} }
strncpy( qdir, path, c + len + count - path ); strncpy( qdir, path, c + len + count - path );
Sys_Printf( "qdir: %s\n", qdir ); Sys_Printf( "qdir: %s\n", qdir );
for ( i = 0; i < strlen( qdir ); i++ ) for ( size_t i = 0; i < strlen( qdir ); i++ )
{ {
if ( qdir[i] == '\\' ) { if ( qdir[i] == '\\' ) {
qdir[i] = '/'; qdir[i] = '/';
@ -212,7 +210,7 @@ void SetQdirFromPath( const char *path ){
if ( *c == '/' || *c == '\\' ) { if ( *c == '/' || *c == '\\' ) {
strncpy( gamedir, path, c + 1 - path ); strncpy( gamedir, path, c + 1 - path );
for ( i = 0; i < strlen( gamedir ); i++ ) for ( size_t i = 0; i < strlen( gamedir ); i++ )
{ {
if ( gamedir[i] == '\\' ) { if ( gamedir[i] == '\\' ) {
gamedir[i] = '/'; gamedir[i] = '/';
@ -255,7 +253,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] == ':' ) {
@ -268,7 +266,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

@ -24,7 +24,7 @@
#ifndef __CMDLIB__ #ifndef __CMDLIB__
#define __CMDLIB__ #define __CMDLIB__
#ifdef _WIN32 #ifdef _MSC_VER
#pragma warning(disable : 4244) // MIPS #pragma warning(disable : 4244) // MIPS
#pragma warning(disable : 4136) // X86 #pragma warning(disable : 4136) // X86
#pragma warning(disable : 4051) // ALPHA #pragma warning(disable : 4051) // ALPHA
@ -44,7 +44,7 @@
#include <time.h> #include <time.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef _WIN32 #ifdef _MSC_VER
#pragma intrinsic( memset, memcpy ) #pragma intrinsic( memset, memcpy )

View File

@ -66,8 +66,8 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
char buf[1024]; char buf[1024];
sprintf( buf, "%f %f %f", v[0], v[1], v[2] ); sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, "point" ); ret = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( ret, buf ); xmlNodeAddContent( ret, (const xmlChar*)buf );
return ret; return ret;
} }
@ -76,8 +76,8 @@ void xml_SendNode( xmlNodePtr node ){
xmlBufferPtr xml_buf; xmlBufferPtr xml_buf;
char xmlbuf[MAX_NETMESSAGE]; // we have to copy content from the xmlBufferPtr into an aux buffer .. that sucks .. char xmlbuf[MAX_NETMESSAGE]; // we have to copy content from the xmlBufferPtr into an aux buffer .. that sucks ..
// this index loops through the node buffer // this index loops through the node buffer
int pos = 0; size_t pos = 0;
int size; size_t size;
xmlAddChild( doc->children, node ); xmlAddChild( doc->children, node );
@ -144,15 +144,15 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node // now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg ); sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, "select" ); node = xmlNewNode( NULL, (const xmlChar*)"select" );
xmlNodeAddContent( node, buf ); xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ; level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0; level[1] = 0;
xmlSetProp( node, "level", (char *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'select' information // a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum ); sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, "brush" ); select = xmlNewNode( NULL, (const xmlChar*)"brush" );
xmlNodeAddContent( select, buf ); xmlNodeAddContent( select, (const xmlChar*)buf );
xmlAddChild( node, select ); xmlAddChild( node, select );
xml_SendNode( node ); xml_SendNode( node );
@ -171,15 +171,15 @@ void xml_Point( char *msg, vec3_t pt ){
char buf[1024]; char buf[1024];
char level[2]; char level[2];
node = xmlNewNode( NULL, "pointmsg" ); node = xmlNewNode( NULL, (const xmlChar*)"pointmsg" );
xmlNodeAddContent( node, msg ); xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR; level[0] = (int)'0' + SYS_ERR;
level[1] = 0; level[1] = 0;
xmlSetProp( node, "level", (char *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'point' node // a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] ); sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, "point" ); point = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( point, buf ); xmlNodeAddContent( point, (const xmlChar*)buf );
xmlAddChild( node, point ); xmlAddChild( node, point );
xml_SendNode( node ); xml_SendNode( node );
@ -195,11 +195,11 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
char level[2]; char level[2];
int i; int i;
node = xmlNewNode( NULL, "windingmsg" ); node = xmlNewNode( NULL, (const xmlChar*)"windingmsg" );
xmlNodeAddContent( node, msg ); xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR; level[0] = (int)'0' + SYS_ERR;
level[1] = 0; level[1] = 0;
xmlSetProp( node, "level", (char *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
// a 'winding' node // a 'winding' node
sprintf( buf, "%i ", numpoints ); sprintf( buf, "%i ", numpoints );
for ( i = 0; i < numpoints; i++ ) for ( i = 0; i < numpoints; i++ )
@ -212,8 +212,8 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
strcat( buf, smlbuf ); strcat( buf, smlbuf );
} }
winding = xmlNewNode( NULL, "winding" ); winding = xmlNewNode( NULL, (const xmlChar*)"winding" );
xmlNodeAddContent( winding, buf ); xmlNodeAddContent( winding, (const xmlChar*)buf );
xmlAddChild( node, winding ); xmlAddChild( node, winding );
xml_SendNode( node ); xml_SendNode( node );
@ -235,7 +235,7 @@ void Broadcast_Setup( const char *dest ){
char sMsg[1024]; char sMsg[1024];
Net_Setup(); Net_Setup();
Net_StringToAddress( (char *)dest, &address ); Net_StringToAddress( dest, &address );
brdcst_socket = Net_Connect( &address, 0 ); brdcst_socket = Net_Connect( &address, 0 );
if ( brdcst_socket ) { if ( brdcst_socket ) {
// send in a header // send in a header
@ -277,15 +277,15 @@ void FPrintf( int flag, char *buf ){
*/ */
if ( !bGotXML ) { if ( !bGotXML ) {
// initialize // initialize
doc = xmlNewDoc( "1.0" ); doc = xmlNewDoc( (const xmlChar*)"1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, "q3map_feedback", NULL ); doc->children = xmlNewDocRawNode( doc, NULL, (const xmlChar*)"q3map_feedback", NULL );
bGotXML = true; bGotXML = true;
} }
node = xmlNewNode( NULL, "message" ); node = xmlNewNode( NULL, (const xmlChar*)"message" );
xmlNodeAddContent( node, buf ); xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + flag; level[0] = (int)'0' + flag;
level[1] = 0; level[1] = 0;
xmlSetProp( node, "level", (char *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar*)level );
xml_SendNode( node ); xml_SendNode( node );
} }

View File

@ -94,9 +94,6 @@ void _VectorScale( vec3_t v, vec_t scale, vec3_t out ){
out[2] = v[2] * scale; out[2] = v[2] * scale;
} }
#pragma optimize("g", off) // went back to turning optimization off,
// the bug_fix thing stopped working
vec_t VectorNormalize( vec3_t in, vec3_t out ){ vec_t VectorNormalize( vec3_t in, vec3_t out ){
vec_t length, ilength; vec_t length, ilength;
@ -136,8 +133,6 @@ vec_t ColorNormalize( vec3_t in, vec3_t out ){
return max; return max;
} }
#pragma optimize("", on)
void VectorInverse( vec3_t v ){ void VectorInverse( vec3_t v ){
v[0] = -v[0]; v[0] = -v[0];
v[1] = -v[1]; v[1] = -v[1];

View File

@ -323,7 +323,7 @@ void InitPaths( int *argc, char **argv ){
/* remove processed arguments */ /* remove processed arguments */
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ ) for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
{ {
for ( j; j < *argc && argv[ j ] == NULL; j++ ) ; for ( ; j < *argc && argv[ j ] == NULL; j++ );
argv[ i ] = argv[ j ]; argv[ i ] = argv[ j ];
if ( argv[ i ] != NULL ) { if ( argv[ i ] != NULL ) {
k++; k++;

View File

@ -159,7 +159,6 @@ void ThreadUnlock( void ){
============= =============
*/ */
void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
int threadid[MAX_THREADS];
HANDLE threadhandle[MAX_THREADS]; HANDLE threadhandle[MAX_THREADS];
int i; int i;
int start, end; int start, end;
@ -193,7 +192,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
(LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr, (LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr,
(LPVOID)i, // LPVOID lpvThreadParm, (LPVOID)i, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate, 0, // DWORD fdwCreate,
&threadid[i] ); NULL );
} }
for ( i = 0 ; i < numthreads ; i++ ) for ( i = 0 ; i < numthreads ; i++ )

View File

@ -71,9 +71,7 @@ typedef struct {
void ByteSwapTri( tf_triangle *tri ){ void ByteSwapTri( tf_triangle *tri ){
int i; for ( size_t i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
for ( i = 0 ; i < sizeof( tf_triangle ) / 4 ; i++ )
{ {
( (int *)tri )[i] = BigLong( ( (int *)tri )[i] ); ( (int *)tri )[i] = BigLong( ( (int *)tri )[i] );
} }

View File

@ -226,7 +226,6 @@ static void WriteModelFile( FILE *modelouthandle ){
fmaliasframe_t *out; fmaliasframe_t *out;
byte buffer[MAX_FM_VERTS * 4 + 128]; byte buffer[MAX_FM_VERTS * 4 + 128];
float v; float v;
int c_on, c_off;
IntListNode_t *current, *toFree; IntListNode_t *current, *toFree;
qboolean framesWritten = false; qboolean framesWritten = false;
size_t temp,size = 0; size_t temp,size = 0;
@ -256,7 +255,6 @@ static void WriteModelFile( FILE *modelouthandle ){
// //
// write out the texture coordinates // write out the texture coordinates
// //
c_on = c_off = 0;
for ( i = 0 ; i < fmheader.num_st ; i++ ) for ( i = 0 ; i < fmheader.num_st ; i++ )
{ {
base_st[i].s = LittleShort( base_st[i].s ); base_st[i].s = LittleShort( base_st[i].s );
@ -1322,7 +1320,7 @@ static void BuildGlCmds( void ){
int best_st[1024]; int best_st[1024];
int best_tris[1024]; int best_tris[1024];
int type; int type;
int trans_check; unsigned trans_check;
int bit,pos; int bit,pos;
// //

View File

@ -257,7 +257,7 @@ void GL_MipMap8P( byte *out, byte *in, int width, int height, palette_t *palette
miptex_t *CreateMip( byte *data, unsigned width, unsigned height, byte *palette, int *FinalSize, qboolean mip ){ miptex_t *CreateMip( byte *data, unsigned width, unsigned height, byte *palette, int *FinalSize, qboolean mip ){
int scaled_width, scaled_height; unsigned scaled_width, scaled_height;
int i,j,r,g,b; int i,j,r,g,b;
byte intensitytable[256]; byte intensitytable[256];
byte scaled[256 * 256]; byte scaled[256 * 256];
@ -265,7 +265,7 @@ miptex_t *CreateMip( byte *data, unsigned width, unsigned height, byte *palette,
int miplevel; int miplevel;
miptex_t *mp; miptex_t *mp;
byte *pos; byte *pos;
int size; unsigned size;
for ( i = 0 ; i < 256 ; i++ ) for ( i = 0 ; i < 256 ; i++ )
{ {
@ -422,13 +422,13 @@ void GL_MipMap( byte *out, byte *in, int width, int height ){
} }
miptex32_t *CreateMip32( unsigned *data, unsigned width, unsigned height, int *FinalSize, qboolean mip ){ miptex32_t *CreateMip32( unsigned *data, unsigned width, unsigned height, int *FinalSize, qboolean mip ){
int scaled_width, scaled_height; unsigned scaled_width, scaled_height;
unsigned scaled[MAX_IMAGE_SIZE * MAX_IMAGE_SIZE]; unsigned scaled[MAX_IMAGE_SIZE * MAX_IMAGE_SIZE];
unsigned out[MAX_IMAGE_SIZE * MAX_IMAGE_SIZE]; unsigned out[MAX_IMAGE_SIZE * MAX_IMAGE_SIZE];
int miplevel; int miplevel;
miptex32_t *mp; miptex32_t *mp;
byte *pos; byte *pos;
int size; unsigned size;
paletteRGBA_t *test; paletteRGBA_t *test;
for ( scaled_width = 1 ; scaled_width < width ; scaled_width <<= 1 ) for ( scaled_width = 1 ; scaled_width < width ; scaled_width <<= 1 )
@ -872,11 +872,9 @@ byte AveragePixels( int count ){
int pix; int pix;
int bestcolor; int bestcolor;
byte *pal; byte *pal;
int fullbright;
vis = 0; vis = 0;
r = g = b = 0; r = g = b = 0;
fullbright = 0;
for ( i = 0 ; i < count ; i++ ) for ( i = 0 ; i < count ; i++ )
{ {
pix = pixdata[i]; pix = pixdata[i];

View File

@ -171,7 +171,6 @@ static void LoadHRCJointList( char *fileName, QDataJoint_t *jointList, int skelT
vec3_t curTranslation[MAX_STACK], curRotation[MAX_STACK], curScale[MAX_STACK]; vec3_t curTranslation[MAX_STACK], curRotation[MAX_STACK], curScale[MAX_STACK];
int curCorrespondingJoint[MAX_STACK]; int curCorrespondingJoint[MAX_STACK];
int currentStack = 0, stackSize; int currentStack = 0, stackSize;
int baseJoint;
float cx, sx, cy, sy, cz, sz; float cx, sx, cy, sy, cz, sz;
float rx, ry, rz; float rx, ry, rz;
float x2, y2, z2; float x2, y2, z2;
@ -338,8 +337,6 @@ static void LoadHRCJointList( char *fileName, QDataJoint_t *jointList, int skelT
jointList[i].placement.up[2] += jointList[i].placement.origin[2]; jointList[i].placement.up[2] += jointList[i].placement.origin[2];
} }
baseJoint = NUM_JOINTS_RAVEN;
for ( i = stackSize /*NUM_JOINTS_RAVEN*/ - 1; i > 0; --i ) for ( i = stackSize /*NUM_JOINTS_RAVEN*/ - 1; i > 0; --i )
{ {

View File

@ -170,7 +170,6 @@ void WriteCommonModelFile( FILE *modelouthandle, PartialAliasFrame_t *outFrames
daliasframe_t *out; daliasframe_t *out;
byte buffer[MAX_VERTS * 4 + 128]; byte buffer[MAX_VERTS * 4 + 128];
float v; float v;
int c_on, c_off;
model.version = ALIAS_VERSION; model.version = ALIAS_VERSION;
model.framesize = (int)&( (daliasframe_t *)0 )->verts[model.num_xyz]; model.framesize = (int)&( (daliasframe_t *)0 )->verts[model.num_xyz];
@ -184,7 +183,7 @@ void WriteCommonModelFile( FILE *modelouthandle, PartialAliasFrame_t *outFrames
// //
// write out the model header // write out the model header
// //
for ( i = 0 ; i < sizeof( dmdl_t ) / 4 ; i++ ) for ( i = 0 ; i < (int)sizeof( dmdl_t ) / 4 ; i++ )
( (int *)&modeltemp )[i] = LittleLong( ( (int *)&model )[i] ); ( (int *)&modeltemp )[i] = LittleLong( ( (int *)&model )[i] );
SafeWrite( modelouthandle, &modeltemp, sizeof( modeltemp ) ); SafeWrite( modelouthandle, &modeltemp, sizeof( modeltemp ) );
@ -197,7 +196,6 @@ void WriteCommonModelFile( FILE *modelouthandle, PartialAliasFrame_t *outFrames
// //
// write out the texture coordinates // write out the texture coordinates
// //
c_on = c_off = 0;
for ( i = 0 ; i < model.num_st ; i++ ) for ( i = 0 ; i < model.num_st ; i++ )
{ {
base_st[i].s = LittleShort( base_st[i].s ); base_st[i].s = LittleShort( base_st[i].s );

View File

@ -72,4 +72,6 @@
#define SHORT_TO_ANGLE ( 360.0 / 65536 ) #define SHORT_TO_ANGLE ( 360.0 / 65536 )
#ifdef _MSC_VER
#pragma warning(disable : 4305) // 'initializing' : truncation from 'const double ' to 'float ' #pragma warning(disable : 4305) // 'initializing' : truncation from 'const double ' to 'float '
#endif

View File

@ -53,7 +53,7 @@ extern char *g_outputDir;
*/ */
void FinishSprite( void ){ void FinishSprite( void ){
FILE *spriteouthandle; FILE *spriteouthandle;
int i, curframe; int i;
dsprite_t spritetemp; dsprite_t spritetemp;
char savename[1024]; char savename[1024];
@ -95,8 +95,6 @@ void FinishSprite( void ){
// //
// write out the frames // write out the frames
// //
curframe = 0;
for ( i = 0 ; i < sprite.numframes ; i++ ) for ( i = 0 ; i < sprite.numframes ; i++ )
{ {
frames[i].width = LittleLong( frames[i].width ); frames[i].width = LittleLong( frames[i].width );

View File

@ -241,7 +241,7 @@ int SaveScript( char *name ){
int i, j; int i, j;
glxy_t buff; glxy_t buff;
if ( fp = fopen( name, "wb" ) ) { if ( ( fp = fopen( name, "wb" ) ) ) {
for ( j = 0; j < filenum; j++ ) for ( j = 0; j < filenum; j++ )
{ {
for ( i = 0; i < filenum; i++ ) for ( i = 0; i < filenum; i++ )
@ -281,7 +281,7 @@ int GetScriptInfo( char *name ){
printf( "Opening script file %s.\n", name ); printf( "Opening script file %s.\n", name );
if ( fp = fopen( name, "r" ) ) { if ( ( fp = fopen( name, "r" ) ) ) {
while ( fgets( buffer, 256, fp ) ) while ( fgets( buffer, 256, fp ) )
{ {
if ( strncmp( buffer, "//", 2 ) && strncmp( buffer, "\n", 1 ) ) { if ( strncmp( buffer, "//", 2 ) && strncmp( buffer, "\n", 1 ) ) {

View File

@ -63,8 +63,8 @@ xmlNodePtr xml_NodeForVec( vec3_t v ){
char buf[1024]; char buf[1024];
sprintf( buf, "%f %f %f", v[0], v[1], v[2] ); sprintf( buf, "%f %f %f", v[0], v[1], v[2] );
ret = xmlNewNode( NULL, (xmlChar*)"point" ); ret = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( ret, (xmlChar*)buf ); xmlNodeAddContent( ret, (const xmlChar*)buf );
return ret; return ret;
} }
@ -147,15 +147,15 @@ void xml_Select( char *msg, int entitynum, int brushnum, qboolean bError ){
// now build a proper "select" XML node // now build a proper "select" XML node
sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg ); sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg );
node = xmlNewNode( NULL, (xmlChar*)"select" ); node = xmlNewNode( NULL, (const xmlChar*)"select" );
xmlNodeAddContent( node, (xmlChar*)buf ); xmlNodeAddContent( node, (const xmlChar*)buf );
level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ; level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ;
level[1] = 0; level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar *)level );
// a 'select' information // a 'select' information
sprintf( buf, "%i %i", entitynum, brushnum ); sprintf( buf, "%i %i", entitynum, brushnum );
select = xmlNewNode( NULL, (xmlChar*)"brush" ); select = xmlNewNode( NULL, (const xmlChar*)"brush" );
xmlNodeAddContent( select, (xmlChar*)buf ); xmlNodeAddContent( select, (const xmlChar*)buf );
xmlAddChild( node, select ); xmlAddChild( node, select );
xml_SendNode( node ); xml_SendNode( node );
@ -173,15 +173,15 @@ void xml_Point( char *msg, vec3_t pt ){
char buf[1024]; char buf[1024];
char level[2]; char level[2];
node = xmlNewNode( NULL, (xmlChar*)"pointmsg" ); node = xmlNewNode( NULL, (const xmlChar*)"pointmsg" );
xmlNodeAddContent( node, (xmlChar*)msg ); xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR; level[0] = (int)'0' + SYS_ERR;
level[1] = 0; level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar *)level );
// a 'point' node // a 'point' node
sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] ); sprintf( buf, "%g %g %g", pt[0], pt[1], pt[2] );
point = xmlNewNode( NULL, (xmlChar*)"point" ); point = xmlNewNode( NULL, (const xmlChar*)"point" );
xmlNodeAddContent( point, (xmlChar*)buf ); xmlNodeAddContent( point, (const xmlChar*)buf );
xmlAddChild( node, point ); xmlAddChild( node, point );
xml_SendNode( node ); xml_SendNode( node );
@ -197,11 +197,11 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
char level[2]; char level[2];
int i; int i;
node = xmlNewNode( NULL, (xmlChar*)"windingmsg" ); node = xmlNewNode( NULL, (const xmlChar*)"windingmsg" );
xmlNodeAddContent( node, (xmlChar*)msg ); xmlNodeAddContent( node, (const xmlChar*)msg );
level[0] = (int)'0' + SYS_ERR; level[0] = (int)'0' + SYS_ERR;
level[1] = 0; level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level ); xmlSetProp( node, (xmlChar*)"level", (const xmlChar *)level );
// a 'winding' node // a 'winding' node
sprintf( buf, "%i ", numpoints ); sprintf( buf, "%i ", numpoints );
for ( i = 0; i < numpoints; i++ ) for ( i = 0; i < numpoints; i++ )
@ -214,8 +214,8 @@ void xml_Winding( char *msg, vec3_t p[], int numpoints, qboolean die ){
strcat( buf, smlbuf ); strcat( buf, smlbuf );
} }
winding = xmlNewNode( NULL, (xmlChar*)"winding" ); winding = xmlNewNode( NULL, (const xmlChar*)"winding" );
xmlNodeAddContent( winding, (xmlChar*)buf ); xmlNodeAddContent( winding, (const xmlChar*)buf );
xmlAddChild( node, winding ); xmlAddChild( node, winding );
xml_SendNode( node ); xml_SendNode( node );
@ -295,18 +295,18 @@ void xml_message_flush(){
if( mesege_len == 0 ) if( mesege_len == 0 )
return; return;
xmlNodePtr node; xmlNodePtr node;
node = xmlNewNode( NULL, (xmlChar*)"message" ); node = xmlNewNode( NULL, (const xmlChar*)"message" );
{ {
mesege[mesege_len] = '\0'; mesege[mesege_len] = '\0';
mesege_len = 0; mesege_len = 0;
gchar* utf8 = g_locale_to_utf8( mesege, -1, NULL, NULL, NULL ); gchar* utf8 = g_locale_to_utf8( mesege, -1, NULL, NULL, NULL );
xmlNodeAddContent( node, (xmlChar*)utf8 ); xmlNodeAddContent( node, (const xmlChar*)utf8 );
g_free( utf8 ); g_free( utf8 );
} }
char level[2]; char level[2];
level[0] = (int)'0' + mesege_flag; level[0] = (int)'0' + mesege_flag;
level[1] = 0; level[1] = 0;
xmlSetProp( node, (xmlChar*)"level", (xmlChar *)&level ); xmlSetProp( node, (const xmlChar*)"level", (const xmlChar *)level );
xml_SendNode( node ); xml_SendNode( node );
} }
@ -356,8 +356,8 @@ void FPrintf( int flag, char *buf ){
*/ */
if ( !bGotXML ) { if ( !bGotXML ) {
// initialize // initialize
doc = xmlNewDoc( (xmlChar*)"1.0" ); doc = xmlNewDoc( (const xmlChar*)"1.0" );
doc->children = xmlNewDocRawNode( doc, NULL, (xmlChar*)"q3map_feedback", NULL ); doc->children = xmlNewDocRawNode( doc, NULL, (const xmlChar*)"q3map_feedback", NULL );
bGotXML = qtrue; bGotXML = qtrue;
} }
xml_message_push( flag & ~( SYS_NOXMLflag | SYS_VRBflag ), buf, strlen( buf ) ); xml_message_push( flag & ~( SYS_NOXMLflag | SYS_VRBflag ), buf, strlen( buf ) );

View File

@ -106,7 +106,7 @@ void FindNextChunk( char *name ){
// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len); // Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
data_p -= 8; data_p -= 8;
last_chunk = data_p + 8 + ( ( iff_chunk_len + 1 ) & ~1 ); last_chunk = data_p + 8 + ( ( iff_chunk_len + 1 ) & ~1 );
if ( !memcmp( data_p, name, 4 ) ) { if ( !strncmp( (const char*)data_p, name, 4 ) ) {
return; return;
} }
} }
@ -155,7 +155,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
// find "RIFF" chunk // find "RIFF" chunk
FindChunk( "RIFF" ); FindChunk( "RIFF" );
if ( !( data_p && !memcmp( data_p + 8, "WAVE", 4 ) ) ) { if ( !( data_p && !strncmp( (const char*)( data_p + 8 ), "WAVE", 4 ) ) ) {
printf( "Missing RIFF/WAVE chunks\n" ); printf( "Missing RIFF/WAVE chunks\n" );
return info; return info;
} }
@ -191,7 +191,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
// if the next chunk is a LIST chunk, look for a cue length marker // if the next chunk is a LIST chunk, look for a cue length marker
FindNextChunk( "LIST" ); FindNextChunk( "LIST" );
if ( data_p ) { if ( data_p ) {
if ( !memcmp( data_p + 28, "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit... if ( !strncmp( (const char*)( data_p + 28 ), "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit...
data_p += 24; data_p += 24;
i = GetLittleLong(); // samples in loop i = GetLittleLong(); // samples in loop
info.samples = info.loopstart + i; info.samples = info.loopstart + i;

View File

@ -398,12 +398,12 @@ void ProcessWorldModel( void ){
Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "******* leaked *******\n" ); Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "******* leaked *******\n" );
Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" ); Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" );
polyline = LeakFile( tree ); polyline = LeakFile( tree );
leaknode = xmlNewNode( NULL, (xmlChar*)"message" ); leaknode = xmlNewNode( NULL, (const xmlChar*)"message" );
xmlNodeAddContent( leaknode, (xmlChar*)"MAP LEAKED\n" ); xmlNodeAddContent( leaknode, (const xmlChar*)"MAP LEAKED\n" );
xmlAddChild( leaknode, polyline ); xmlAddChild( leaknode, polyline );
level[0] = (int) '0' + SYS_ERR; level[0] = (int) '0' + SYS_ERR;
level[1] = 0; level[1] = 0;
xmlSetProp( leaknode, (xmlChar*)"level", (xmlChar*) &level ); xmlSetProp( leaknode, (xmlChar*)"level", (const xmlChar*)level );
xml_SendNode( leaknode ); xml_SendNode( leaknode );
if ( leaktest ) { if ( leaktest ) {
Sys_FPrintf( SYS_WRN, "--- MAP LEAKED, ABORTING LEAKTEST ---\n" ); Sys_FPrintf( SYS_WRN, "--- MAP LEAKED, ABORTING LEAKTEST ---\n" );

View File

@ -82,7 +82,7 @@ xmlNodePtr LeakFile( tree_t *tree ){
Error( "Couldn't open %s\n", filename ); Error( "Couldn't open %s\n", filename );
} }
xml_node = xmlNewNode( NULL, (xmlChar*)"polyline" ); xml_node = xmlNewNode( NULL, (const xmlChar*)"polyline" );
count = 0; count = 0;
node = &tree->outside_node; node = &tree->outside_node;