34typedef struct wadstate_s
60 for (i=0 ; i<16 ; i++ )
66 if (c >=
'A' && c <=
'Z')
78 for (i = 0;i < numlumps;i++)
111 memset(&
wad, 0,
sizeof(
wad));
127 if ((
wad.gfx_base =
FS_LoadFile (
"gfx.wad",
cls.permanentmempool,
false, &filesize)))
129 if (memcmp(
wad.gfx_base,
"WAD2", 4))
131 Con_Print(
"gfx.wad doesn't have WAD2 id\n");
148 for (lump =
wad.gfx.lumps, i = 0;i <
wad.gfx.numlumps;i++, lump++)
150 if (!strcmp(clean, lump->
name))
153 *returnfilesize = lump->
size;
188 if (numlumps < 1 || numlumps > 65536)
191 if (
FS_Seek (file, infotableofs, SEEK_SET))
194 if (!
wad.hlwads.mempool)
198 w->numlumps = numlumps;
203 Con_Print(
CON_ERROR "W_LoadTextureWadFile: unable to allocate temporary memory for lump table\n");
228 unsigned char *in, *
data, *out, *pal;
230 unsigned char name[16];
231 unsigned int mipoffset[4];
248 || mipoffset[0] != 40
255 in = (
unsigned char *)sb->
data + mipoffset[0];
262 if (
name[0] ==
'{' && p == 255)
263 out[0] = out[1] = out[2] = out[3] = 0;
288 if (!
wad.hlwads.mempool)
291 for (k = 0;k < range;k++)
296 for (i = 0;i < (
unsigned int)
w->numlumps;i++)
298 if (!strcmp(texname,
w->lumps[i].name))
300 if (
FS_Seek(
w->file,
w->lumps[i].filepos, SEEK_SET))
301 {
Con_Print(
"W_GetTexture: corrupt WAD3 file\n");
return NULL;}
306 if (
FS_Read(
w->file, sb.
data,
w->lumps[i].size) <
w->lumps[i].disksize)
307 {
Con_Print(
"W_GetTexture: corrupt WAD3 file\n");
return NULL;}
void MSG_BeginReading(sizebuf_t *sb)
size_t MSG_ReadBytes(sizebuf_t *sb, size_t numbytes, unsigned char *out)
void MSG_InitReadBuffer(sizebuf_t *buf, unsigned char *data, int size)
int MSG_ReadLittleLong(sizebuf_t *sb)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
fs_offset_t FS_Read(qfile_t *file, void *buffer, size_t buffersize)
qfile_t * FS_OpenVirtualFile(const char *filepath, qbool quiet)
unsigned char * FS_LoadFile(const char *path, mempool_t *pool, qbool quiet, fs_offset_t *filesizepointer)
int FS_Seek(qfile_t *file, fs_offset_t offset, int whence)
static int(ZEXPORT *qz_inflate)(z_stream *strm
int FS_Close(qfile_t *file)
GLubyte GLubyte GLubyte GLubyte w
GLsizeiptr const GLvoid * data
memexpandablearray_t hlwads
unsigned char * W_GetLumpName(const char *name, fs_offset_t *returnfilesize)
void W_LoadTextureWadFile(char *filename, int complain)
unsigned char * W_GetTextureBGRA(char *name)
static void W_SwapLumps(int numlumps, lumpinfo_t *lumps)
unsigned char * W_ConvertWAD3TextureBGRA(sizebuf_t *sb)
static void W_CleanupName(const char *in, char *out)
size_t Mem_ExpandableArray_IndexRange(const memexpandablearray_t *l)
void Mem_ExpandableArray_NewArray(memexpandablearray_t *l, mempool_t *mempool, size_t recordsize, int numrecordsperarray)
void * Mem_ExpandableArray_AllocRecord(memexpandablearray_t *l)
void * Mem_ExpandableArray_RecordAtIndex(const memexpandablearray_t *l, size_t index)
void Mem_ExpandableArray_FreeArray(memexpandablearray_t *l)
#define Mem_Alloc(pool, size)