5 // WAD3 (Half-Life) Header and mip structs
6 // WAD2 (Quake) Header and mip structs added by LordHavoc
8 #define WADBUFSIZE 32768
10 #define WAD2_TYPE_MIP 0x44
11 #define WAD2_ID ('W' | 'A' << 8 | 'D' << 16 | '2' << 24)
12 #define WAD3_TYPE_MIP 0x43
13 #define WAD3_ID ('W' | 'A' << 8 | 'D' << 16 | '3' << 24)
14 #define GET_MIP_DATA_SIZE(WIDTH, HEIGHT) ((WIDTH * HEIGHT) + (WIDTH * HEIGHT / 4) + (WIDTH * HEIGHT / 16) + (WIDTH * HEIGHT / 64))
18 WAD3 pseudo-structure:
24 First mip (width * height)
25 Second mip (width * height / 4)
26 Third mip (width * height / 16)
27 Fourth mip (width * height / 64)
29 Palette (Palette size * 3)
39 WAD2 pseudo-structure:
45 First mip (width * height)
46 Second mip (width * height / 4)
47 Third mip (width * height / 16)
48 Fourth mip (width * height / 64)
58 #define DWORD unsigned int
59 #define BYTE unsigned char
60 #define WORD unsigned short int
66 DWORD infotableofs; // Lump table
67 } WAD3_HEADER, *LPWAD3_HEADER;
73 DWORD size; // uncompressed
77 char name[16]; // must be null terminated
78 } WAD3_LUMP, *LPWAD3_LUMP;
84 DWORD offsets[4]; // four mip maps stored
85 } WAD3_MIP, *LPWAD3_MIP;
88 typedef struct wadFile_s
91 LPWAD3_HEADER lpHeader;
96 unsigned long currentfile;
101 wadFile_t *wadOpen(const char* path);
102 wadFile_t *wadCleanup(wadFile_t *wf);
103 int wadGoToFirstFile(wadFile_t *wf);
104 int wadGetCurrentFileInfo ( wadFile_t *wf, char *szFileName, unsigned long fileNameBufferSize, unsigned long *filesize);
105 int wadGoToNextFile(wadFile_t *wf);
107 int wadOpenCurrentFileByNum (wadFile_t *wf, unsigned long filenumber);
108 void wadCloseCurrentFile (wadFile_t *wf);
109 unsigned long wadReadCurrentFile (wadFile_t *wf , char *bufferptr, unsigned long size);
111 #endif // #ifndef _WAD3_H_