Skip to content

Commit

Permalink
Fix "hides previous local/global declaration" warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Mar 16, 2022
1 parent 63c1293 commit 84f0dcc
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 56 deletions.
2 changes: 1 addition & 1 deletion utils/common/wadlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
lumpinfo_t *lumpinfo; // location of each lump on disk
int numlumps;

wadinfo_t header;
FILE *wadhandle;


Expand All @@ -49,6 +48,7 @@ W_OpenWad
*/
void W_OpenWad (char *filename)
{
wadinfo_t header;
lumpinfo_t *lump_p;
int length;

Expand Down
1 change: 0 additions & 1 deletion utils/common/wadlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ typedef struct

extern lumpinfo_t *lumpinfo; // location of each lump on disk
extern int numlumps;
extern wadinfo_t header;

void W_OpenWad (char *filename);
int W_CheckNumForName (char *name);
Expand Down
8 changes: 4 additions & 4 deletions utils/makefont/makefont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@

#define FONT_TAG 6 // Font's are the 6th tag after the TYP_LUMPY base ( 64 )...i.e., type == 70

BOOL bItalic = FALSE;
BOOL bBold = FALSE;
BOOL bUnderline = FALSE;

char fontname[ 256 ];
int pointsize[3] = { 9, 11, 15 };

Expand Down Expand Up @@ -395,6 +391,10 @@ int main(int argc, char* argv[])

qfont_t *fonts[ 3 ];

BOOL bItalic = FALSE;
BOOL bBold = FALSE;
BOOL bUnderline = FALSE;

strcpy( fontname, DEFAULT_FONT );

printf("makefont.exe Version 1.0 by valve (%s)\n", __DATE__ );
Expand Down
2 changes: 1 addition & 1 deletion utils/qbsp2/bsp5.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void qprintf (char *fmt, ...); // only prints if verbose
extern int valid;

extern char portfilename[1024];
extern char bspfilename[1024];
extern char g_bspfilename[1024];
extern char pointfilename[1024];

extern qboolean worldmodel;
Expand Down
18 changes: 9 additions & 9 deletions utils/qbsp2/qbsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ qboolean watervis;

int subdivide_size = 240;

char bspfilename[1024];
char g_bspfilename[1024];
char pointfilename[1024];
char portfilename[1024];

Expand Down Expand Up @@ -770,15 +770,15 @@ ReadSurfs
surfchain_t *ReadSurfs (FILE *file)
{
int r;
int planenum, texinfo, contents, numpoints;
int planenum, texturenum, contents, numpoints;
face_t *f;
int i;
double v[3];

// read in the polygons
while (1)
{
r = fscanf (file, "%i %i %i %i\n", &planenum, &texinfo, &contents, &numpoints);
r = fscanf(file, "%i %i %i %i\n", &planenum, &texturenum, &contents, &numpoints);
if (r == 0 || r == -1)
return NULL;
if (planenum == -1) // end of model
Expand All @@ -789,13 +789,13 @@ surfchain_t *ReadSurfs (FILE *file)
Error ("ReadSurfs: %i > MAXPOINTS", numpoints);
if (planenum > numplanes)
Error ("ReadSurfs: %i > numplanes", planenum);
if (texinfo > numtexinfo)
Error ("ReadSurfs: %i > numtexinfo", texinfo);
if (texturenum > numtexinfo)
Error("ReadSurfs: %i > numtexinfo", texturenum);


f = AllocFace ();
f->planenum = planenum;
f->texturenum = texinfo;
f->texturenum = texturenum;
f->contents = contents;
f->numpoints = numpoints;
f->next = validfaces[planenum];
Expand Down Expand Up @@ -1002,15 +1002,15 @@ int main (int argc, char **argv)
ThreadSetDefault ();

SetQdirFromPath ();
strcpy (bspfilename, ExpandArg(argv[i]));
StripExtension (bspfilename);
strcpy(g_bspfilename, ExpandArg(argv[i]));
StripExtension(g_bspfilename);

//
// do it!
//
start = I_FloatTime ();

ProcessFile (bspfilename);
ProcessFile(g_bspfilename);

end = I_FloatTime ();
printf ("%5.0f seconds elapsed\n", end-start);
Expand Down
2 changes: 1 addition & 1 deletion utils/qbsp2/writebsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,6 @@ void FinishBSPFile (void)

if (verbose)
PrintBSPFileSizes ();
WriteBSPFile (bspfilename);
WriteBSPFile (g_bspfilename);
}

16 changes: 8 additions & 8 deletions utils/qcsg/qcsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,9 +812,9 @@ int main (int argc, char **argv)
//
if (onlyents && !glview)
{
char out[1024];
sprintf (out, "%s.bsp", source);
LoadBSPFile (out);
char outFileName[1024];
sprintf(outFileName, "%s.bsp", source);
LoadBSPFile(outFileName);

// Get the new entity data from the map file
LoadMapFile (name);
Expand All @@ -840,15 +840,15 @@ int main (int argc, char **argv)

for (i=0 ; i<NUM_HULLS ; i++)
{
char name[1024];
char hullName[1024];

if (glview)
sprintf (name, "%s.gl%i",source, i);
sprintf(hullName, "%s.gl%i", source, i);
else
sprintf (name, "%s.p%i",source, i);
out[i] = fopen (name, "w");
sprintf(hullName, "%s.p%i", source, i);
out[i] = fopen(hullName, "w");
if (!out[i])
Error ("Couldn't open %s",name);
Error("Couldn't open %s", hullName);
}

ProcessModels ();
Expand Down
13 changes: 6 additions & 7 deletions utils/qcsg/textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ int LoadLump (lumpinfo_t *source, byte *dest, int *texsize)
// Just read the miptex header and zero out the data offsets.
// We will load the entire texture from the WAD at engine runtime
int i;
miptex_t *miptex = (miptex_t *)dest;
miptex_t *newMiptex = (miptex_t *)dest;
SafeRead (texfiles[source->iTexFile], dest, sizeof(miptex_t) );
for( i=0; i<MIPLEVELS; i++ )
miptex->offsets[i] = 0;
newMiptex->offsets[i] = 0;
return sizeof(miptex_t);
}
else
Expand Down Expand Up @@ -282,7 +282,7 @@ void WriteMiptex(void)
{
using clock = std::chrono::high_resolution_clock;

int i, len, texsize, totaltexsize = 0;
int len, texsize, totaltexsize = 0;
byte *data;
dmiptexlump_t *l;
char *path;
Expand Down Expand Up @@ -314,7 +314,7 @@ void WriteMiptex(void)

start = clock::now();
{
for (i=0; i<nummiptex; i++ )
for (int i=0; i<nummiptex; i++ )
{
lumpinfo_t *found;
if ( found = FindTexture( miptex + i ); found != nullptr )
Expand All @@ -329,14 +329,13 @@ void WriteMiptex(void)

start = clock::now();
{
int i;
texinfo_t *tx = texinfo;

// Sort them FIRST by wadfile and THEN by name for most efficient loading in the engine.
qsort( (void *)miptex, (size_t)nummiptex, sizeof(miptex[0]), lump_sorter_by_wad_and_name );

// Sleazy Hack 104 Pt 2 - After sorting the miptex array, reset the texinfos to point to the right miptexs
for(i=0; i<numtexinfo; i++, tx++)
for(int i=0; i<numtexinfo; i++, tx++)
{
char *miptex_name = (char *)tx->miptex;
tx->miptex = FindMiptex( miptex_name );
Expand All @@ -353,7 +352,7 @@ void WriteMiptex(void)
l = (dmiptexlump_t *)dtexdata;
data = (byte *)&l->dataofs[nummiptex];
l->nummiptex = nummiptex;
for (i=0 ; i<nummiptex ; i++)
for (int i=0 ; i<nummiptex ; i++)
{
l->dataofs[i] = data - (byte *)l;
len = LoadLump (miptex+i, data, &texsize);
Expand Down
5 changes: 2 additions & 3 deletions utils/qrad/lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,6 @@ void BuildFacelights (int facenum)
vec3_t sampled[MAXLIGHTMAPS];
lightinfo_t l;
int i, j, k;
sample_t *s;
float *spot;
patch_t *patch;
byte pvs[(MAX_MAP_LEAFS+7)/8];
Expand Down Expand Up @@ -1518,7 +1517,7 @@ void BuildFacelights (int facenum)
{
if ( f->styles[j] == 0 )
{
s = facelight[facenum].samples[j];
auto s = facelight[facenum].samples[j];
for (i=0 ; i<l.numsurfpt ; i++, s++)
VectorAdd(s->light, ambient, s->light);
break;
Expand All @@ -1536,7 +1535,7 @@ void BuildFacelights (int facenum)
{
if ( f->styles[j] == 0 )
{
s = facelight[facenum].samples[j];
auto s = facelight[facenum].samples[j];
for (i=0 ; i<l.numsurfpt ; i++, s++)
VectorAdd( s->light, face_patches[facenum]->baselight, s->light );
break;
Expand Down
14 changes: 7 additions & 7 deletions utils/qrad/qrad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ char global_lights[MAX_PATH] = "";
char designer_lights[MAX_PATH] = "";
char level_lights[MAX_PATH] = "";

char transferfile[MAX_PATH] = "";
char g_transferfile[MAX_PATH] = "";
char vismatfile[_MAX_PATH] = "";
char incrementfile[_MAX_PATH] = "";
qboolean incremental = 0;
Expand Down Expand Up @@ -1161,22 +1161,22 @@ readtransfers(char *transferfile, long numpatches)

void MakeAllScales (void)
{
strcpy(transferfile, source);
StripExtension( transferfile );
DefaultExtension( transferfile, ".r2" );
strcpy(g_transferfile, source);
StripExtension(g_transferfile);
DefaultExtension(g_transferfile, ".r2");

if ( !incremental
|| !IsIncremental(incrementfile)
|| (unsigned)readtransfers(transferfile, num_patches) != num_patches )
|| (unsigned)readtransfers(g_transferfile, num_patches) != num_patches )
{
// determine visibility between patches
BuildVisMatrix ();

RunThreadsOn (num_patches, true, MakeScales);
if ( incremental )
writetransfers(transferfile, num_patches);
writetransfers(g_transferfile, num_patches);
else
unlink(transferfile);
unlink(g_transferfile);

// release visibility matrix
FreeVisMatrix ();
Expand Down
6 changes: 3 additions & 3 deletions utils/studiomdl/studiomdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ int Grab_Nodes( s_node_t *pnodes )
int index;
char name[1024];
int parent;
int numbones = 0;
int numnodebones = 0;
int i;

while (fgets( line, sizeof( line ), input ) != NULL)
Expand All @@ -2036,7 +2036,7 @@ int Grab_Nodes( s_node_t *pnodes )

strcpyn( pnodes[index].name, name );
pnodes[index].parent = parent;
numbones = index;
numnodebones = index;
// check for mirrored bones;
for (i = 0; i < nummirrored; i++)
{
Expand All @@ -2050,7 +2050,7 @@ int Grab_Nodes( s_node_t *pnodes )
}
else
{
return numbones + 1;
return numnodebones + 1;
}
}
Error( "Unexpected EOF at line %d\n", linecount );
Expand Down
22 changes: 11 additions & 11 deletions utils/studiomdl/write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ void WriteSequenceInfo( )
}


byte *WriteAnimations( byte *pData, byte *pStart, int group )
byte *WriteAnimations( byte *pAnimData, byte *pAnimStart, int group )
{
int i, j, k;
int q, n;
Expand All @@ -285,19 +285,19 @@ byte *WriteAnimations( byte *pData, byte *pStart, int group )
mstudioanimvalue_t *panimvalue;

// hack for seqgroup 0
// pseqgroup->data = (pData - pStart);
// pseqgroup->data = (pAnimData - pAnimStart);

for (i = 0; i < numseq; i++)
{
if (sequence[i].seqgroup == group)
{
// save animations
panim = (mstudioanim_t *)pData;
sequence[i].animindex = (pData - pStart);
pData += sequence[i].numblends * numbones * sizeof( mstudioanim_t );
ALIGN( pData );
panim = (mstudioanim_t*)pAnimData;
sequence[i].animindex = (pAnimData - pAnimStart);
pAnimData += sequence[i].numblends * numbones * sizeof(mstudioanim_t);
ALIGN(pAnimData);

panimvalue = (mstudioanimvalue_t *)pData;
panimvalue = (mstudioanimvalue_t*)pAnimData;
for (q = 0; q < sequence[i].numblends; q++)
{
// save animation value info
Expand Down Expand Up @@ -325,12 +325,12 @@ byte *WriteAnimations( byte *pData, byte *pStart, int group )
}
}

// printf("raw bone data %d : %s\n", (byte *)panimvalue - pData, sequence[i].name);
pData = (byte *)panimvalue;
ALIGN( pData );
// printf("raw bone data %d : %s\n", (byte *)panimvalue - pAnimData, sequence[i].name);
pAnimData = (byte*)panimvalue;
ALIGN(pAnimData);
}
}
return pData;
return pAnimData;
}

void WriteTextures( )
Expand Down

0 comments on commit 84f0dcc

Please sign in to comment.