X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=wad.c;h=12978f383a6b8969343bb543c0e3df60cca91c2b;hb=5bb512fd3cff3479e4a86b8f716e7ff6409eb1cd;hp=13a7b9fdfcd6aa55c17e5d1b7261a7c76b2979ba;hpb=ea3f4513f96a21ae1bcbaae4a4997968ace1ab95;p=xonotic%2Fdarkplaces.git diff --git a/wad.c b/wad.c index 13a7b9fd..12978f38 100644 --- a/wad.c +++ b/wad.c @@ -24,9 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "wad.h" -void SwapPic (qpic_t *pic); - - /* ================== W_CleanupName @@ -58,7 +55,11 @@ static void W_CleanupName (const char *in, char *out) out[i] = 0; } -void *W_GetLumpName(const char *name) +static int wad_numlumps = 0; +static lumpinfo_t *wad_lumps = NULL; +static unsigned char *wad_base = NULL; + +unsigned char *W_GetLumpName(const char *name) { int i; fs_offset_t filesize; @@ -66,20 +67,14 @@ void *W_GetLumpName(const char *name) char clean[16]; wadinfo_t *header; int infotableofs; - void *temp; - static int wad_loaded = false; - static int wad_numlumps = 0; - static lumpinfo_t *wad_lumps = NULL; - static unsigned char *wad_base = NULL; W_CleanupName (name, clean); - if (!wad_loaded) + if (!wad_base) { - wad_loaded = true; - if ((wad_base = FS_LoadFile ("gfx.wad", cl_mempool, false, &filesize))) + if ((wad_base = FS_LoadFile ("gfx.wad", cls.permanentmempool, false, &filesize))) { - if (memcmp(temp, "WAD2", 4)) + if (memcmp(wad_base, "WAD2", 4)) { Con_Print("gfx.wad doesn't have WAD2 id\n"); Mem_Free(wad_base); @@ -97,8 +92,6 @@ void *W_GetLumpName(const char *name) lump->filepos = LittleLong(lump->filepos); lump->size = LittleLong(lump->size); W_CleanupName (lump->name, lump->name); - if (lump->type == TYP_QPIC) - SwapPic ( (qpic_t *)(wad_base + lump->filepos)); } } } @@ -106,7 +99,7 @@ void *W_GetLumpName(const char *name) for (lump = wad_lumps, i = 0;i < wad_numlumps;i++, lump++) if (!strcmp(clean, lump->name)) - return (void *)(wad_base + lump->filepos); + return (wad_base + lump->filepos); if (wad_base) Con_DPrintf("W_GetLumpByName(\"%s\"): couldn't find file in gfx.wad\n", name); @@ -123,12 +116,6 @@ automatic byte swapping ============================================================================= */ -void SwapPic (qpic_t *pic) -{ - pic->width = LittleLong(pic->width); - pic->height = LittleLong(pic->height); -} - // LordHavoc: added alternate WAD2/WAD3 system for HalfLife texture wads #define TEXWAD_MAXIMAGES 16384 typedef struct texwadlump_s