- lump_p->filepos = LittleLong(lump_p->filepos);
- lump_p->size = LittleLong(lump_p->size);
- W_CleanupName (lump_p->name, lump_p->name);
- if (lump_p->type == TYP_QPIC)
- SwapPic ( (qpic_t *)(wad_base + lump_p->filepos));
+ wad_loaded = true;
+ if ((temp = FS_LoadFile ("gfx.wad", false)))
+ {
+ if (memcmp(temp, "WAD2", 4))
+ Con_Printf("gfx.wad doesn't have WAD2 id\n");
+ else
+ {
+ wad_mempool = Mem_AllocPool("gfx.wad");
+ wad_base = Mem_Alloc(wad_mempool, fs_filesize);
+
+ memcpy(wad_base, temp, fs_filesize);
+ Mem_Free(temp);
+
+ header = (wadinfo_t *)wad_base;
+ wad_numlumps = LittleLong(header->numlumps);
+ infotableofs = LittleLong(header->infotableofs);
+ wad_lumps = (lumpinfo_t *)(wad_base + infotableofs);
+
+ for (i=0, lump = wad_lumps ; i<wad_numlumps ; i++,lump++)
+ {
+ 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));
+ }
+ }
+ }