From c7830d711891af18af53d929d3937eb877a2bca3 Mon Sep 17 00:00:00 2001 From: Marcus Sundberg Date: Sun, 19 Mar 2000 15:20:09 +0000 Subject: [PATCH] Removed lame debug code which didn't even check return codes. --- common/wad.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/common/wad.c b/common/wad.c index 7135477..dfecac0 100644 --- a/common/wad.c +++ b/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 ; ifilepos = 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); }