mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-22 03:41:27 +00:00
Removed lame debug code which didn't even check return codes.
This commit is contained in:
parent
289fb16e4e
commit
c7830d7118
1 changed files with 14 additions and 20 deletions
34
common/wad.c
34
common/wad.c
|
@ -50,18 +50,18 @@ void W_CleanupName (char *in, char *out)
|
|||
{
|
||||
int i;
|
||||
int c;
|
||||
|
||||
|
||||
for (i=0 ; i<16 ; i++ )
|
||||
{
|
||||
c = in[i];
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
c += ('a' - 'A');
|
||||
out[i] = c;
|
||||
}
|
||||
|
||||
|
||||
for ( ; i< 16 ; i++ )
|
||||
out[i] = 0;
|
||||
}
|
||||
|
@ -92,13 +92,13 @@ wadfile_t * W_OpenWadFile (char *filename)
|
|||
|
||||
Sys_FileRead(wadhandle, (void *)&header, sizeof(header));
|
||||
|
||||
|
||||
|
||||
if (header.identification[0] != 'W'
|
||||
|| header.identification[1] != 'A'
|
||||
|| header.identification[2] != 'D'
|
||||
|| header.identification[3] != '2')
|
||||
Sys_Error ("Wad file %s doesn't have WAD2 id\n",filename);
|
||||
|
||||
|
||||
wadfile->wad_numlumps = LittleLong(header.numlumps);
|
||||
infotableofs = LittleLong(header.infotableofs);
|
||||
wadfile->wad_lumps = (lumpinfo_t *)Hunk_Alloc(sizeof(lumpinfo_t) * wadfile->wad_numlumps);
|
||||
|
@ -131,38 +131,32 @@ void W_LoadWadFile (char *filename)
|
|||
wadinfo_t *header;
|
||||
unsigned i;
|
||||
int infotableofs;
|
||||
|
||||
FILE *f = fopen("debug.log", "w");
|
||||
|
||||
wad_base = COM_LoadHunkFile (filename);
|
||||
if (!wad_base)
|
||||
Sys_Error ("W_LoadWadFile: couldn't load %s", filename);
|
||||
|
||||
header = (wadinfo_t *)wad_base;
|
||||
|
||||
|
||||
if (header->identification[0] != 'W'
|
||||
|| header->identification[1] != 'A'
|
||||
|| header->identification[2] != 'D'
|
||||
|| header->identification[3] != '2')
|
||||
Sys_Error ("Wad file %s doesn't have WAD2 id\n",filename);
|
||||
|
||||
|
||||
wad_numlumps = LittleLong(header->numlumps);
|
||||
infotableofs = LittleLong(header->infotableofs);
|
||||
wad_lumps = (lumpinfo_t *)(wad_base + infotableofs);
|
||||
|
||||
|
||||
|
||||
for (i=0, lump_p = wad_lumps ; i<wad_numlumps ; i++,lump_p++)
|
||||
{
|
||||
lump_p->filepos = LittleLong(lump_p->filepos);
|
||||
lump_p->size = LittleLong(lump_p->size);
|
||||
W_CleanupName (lump_p->name, lump_p->name);
|
||||
fprintf(f, "%i: %s\n", i, lump_p->name);
|
||||
if (lump_p->type == TYP_QPIC)
|
||||
SwapPic ( (qpic_t *)(wad_base + lump_p->filepos));
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -184,7 +178,7 @@ lumpinfo_t *W_GetLumpinfo (char *name)
|
|||
if (!strcmp(clean, lump_p->name))
|
||||
return lump_p;
|
||||
}
|
||||
|
||||
|
||||
Sys_Error ("W_GetLumpinfo: %s not found", name);
|
||||
|
||||
return NULL;
|
||||
|
@ -193,21 +187,21 @@ lumpinfo_t *W_GetLumpinfo (char *name)
|
|||
void *W_GetLumpName (char *name)
|
||||
{
|
||||
lumpinfo_t *lump;
|
||||
|
||||
|
||||
lump = W_GetLumpinfo (name);
|
||||
|
||||
|
||||
return (void *)(wad_base + lump->filepos);
|
||||
}
|
||||
|
||||
void *W_GetLumpNum (int num)
|
||||
{
|
||||
lumpinfo_t *lump;
|
||||
|
||||
|
||||
if (num < 0 || num > wad_numlumps)
|
||||
Sys_Error ("W_GetLumpNum: bad number: %i", num);
|
||||
|
||||
|
||||
lump = wad_lumps + num;
|
||||
|
||||
|
||||
return (void *)(wad_base + lump->filepos);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue