mirror of
https://github.com/UberGames/GtkRadiant.git
synced 2024-11-25 21:31:12 +00:00
9998050654
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@183 8a3a26a2-13c4-0310-b231-cf6edde360e5
111 lines
2.4 KiB
C
111 lines
2.4 KiB
C
|
|
#ifndef _WAD3_H_
|
|
#define _WAD3_H_
|
|
|
|
// WAD3 (Half-Life) Header and mip structs
|
|
// WAD2 (Quake) Header and mip structs added by LordHavoc
|
|
|
|
#define WADBUFSIZE 32768
|
|
|
|
#define WAD2_TYPE_MIP 0x44
|
|
#define WAD2_ID ('W' | 'A' << 8 | 'D' << 16 | '2' << 24)
|
|
#define WAD3_TYPE_MIP 0x43
|
|
#define WAD3_ID ('W' | 'A' << 8 | 'D' << 16 | '3' << 24)
|
|
#define GET_MIP_DATA_SIZE(WIDTH, HEIGHT) ((WIDTH * HEIGHT) + (WIDTH * HEIGHT / 4) + (WIDTH * HEIGHT / 16) + (WIDTH * HEIGHT / 64))
|
|
|
|
/*
|
|
|
|
WAD3 pseudo-structure:
|
|
|
|
WAD3 Header
|
|
Mip section
|
|
First mip
|
|
Mip header
|
|
First mip (width * height)
|
|
Second mip (width * height / 4)
|
|
Third mip (width * height / 16)
|
|
Fourth mip (width * height / 64)
|
|
Palette size (WORD)
|
|
Palette (Palette size * 3)
|
|
Padding (WORD)
|
|
[...]
|
|
Last mip
|
|
Lump table
|
|
First lump entry
|
|
Lump header
|
|
[...]
|
|
Last lump entry
|
|
|
|
WAD2 pseudo-structure:
|
|
|
|
WAD2 Header
|
|
Mip section
|
|
First mip
|
|
Mip header
|
|
First mip (width * height)
|
|
Second mip (width * height / 4)
|
|
Third mip (width * height / 16)
|
|
Fourth mip (width * height / 64)
|
|
[...]
|
|
Last mip
|
|
Lump table
|
|
First lump entry
|
|
Lump header
|
|
[...]
|
|
Last lump entry
|
|
*/
|
|
|
|
#define DWORD unsigned int
|
|
#define BYTE unsigned char
|
|
#define WORD unsigned short int
|
|
|
|
typedef struct
|
|
{
|
|
DWORD identification;
|
|
DWORD numlumps;
|
|
DWORD infotableofs; // Lump table
|
|
} WAD3_HEADER, *LPWAD3_HEADER;
|
|
|
|
typedef struct
|
|
{
|
|
DWORD filepos;
|
|
DWORD disksize;
|
|
DWORD size; // uncompressed
|
|
BYTE type;
|
|
BYTE compression;
|
|
BYTE pad1, pad2;
|
|
char name[16]; // must be null terminated
|
|
} WAD3_LUMP, *LPWAD3_LUMP;
|
|
|
|
typedef struct
|
|
{
|
|
char name[16];
|
|
DWORD width, height;
|
|
DWORD offsets[4]; // four mip maps stored
|
|
} WAD3_MIP, *LPWAD3_MIP;
|
|
|
|
|
|
typedef struct wadFile_s
|
|
{
|
|
FILE * fin;
|
|
LPWAD3_HEADER lpHeader;
|
|
LPWAD3_LUMP lpLump;
|
|
LPWAD3_MIP lpMip;
|
|
|
|
DWORD FileSize;
|
|
unsigned long currentfile;
|
|
char *wadfilename;
|
|
} wadFile_t;
|
|
|
|
|
|
wadFile_t *wadOpen(const char* path);
|
|
wadFile_t *wadCleanup(wadFile_t *wf);
|
|
int wadGoToFirstFile(wadFile_t *wf);
|
|
int wadGetCurrentFileInfo ( wadFile_t *wf, char *szFileName, unsigned long fileNameBufferSize, unsigned long *filesize);
|
|
int wadGoToNextFile(wadFile_t *wf);
|
|
|
|
int wadOpenCurrentFileByNum (wadFile_t *wf, unsigned long filenumber);
|
|
void wadCloseCurrentFile (wadFile_t *wf);
|
|
unsigned long wadReadCurrentFile (wadFile_t *wf , char *bufferptr, unsigned long size);
|
|
|
|
#endif // #ifndef _WAD3_H_
|