From 7dc88f94175aecfc828d98920d308c2a0ad69c78 Mon Sep 17 00:00:00 2001 From: Sergey Degtyar Date: Wed, 16 Jul 2025 18:17:44 +0300 Subject: [PATCH] filesystem: common: move wad structures to wadfile.h --- common/wadfile.h | 34 ++++++++++++++++++++++++++++++++++ filesystem/wad.c | 20 -------------------- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/common/wadfile.h b/common/wadfile.h index 9dafd13d..d4d24575 100644 --- a/common/wadfile.h +++ b/common/wadfile.h @@ -35,6 +35,7 @@ infotable dlumpinfo_t[dwadinfo_t->numlumps] #define IDWAD2HEADER (('2'<<24)+('D'<<16)+('A'<<8)+'W') // little-endian "WAD2" quake wads #define IDWAD3HEADER (('3'<<24)+('D'<<16)+('A'<<8)+'W') // little-endian "WAD3" half-life wads +#define WAD3_NAMELEN 16 // dlumpinfo_t->attribs #define ATTR_NONE 0 // allow to read-write @@ -83,4 +84,37 @@ typedef struct mip_s unsigned int offsets[4]; // four mip maps stored } mip_t; +/* +======================================================================== + +.WAD header format (half-Life textures) + +======================================================================== +*/ +typedef struct +{ + int ident; // should be WAD3 + int numlumps; // num files + int infotableofs; // LUT offset +} dwadinfo_t; + +/* +======================================================================== + +.WAD struct (half-Life textures) + +======================================================================== +*/ +typedef struct +{ + int filepos; // file offset in WAD + int disksize; // compressed or uncompressed + int size; // uncompressed + signed char type; // TYP_* + signed char attribs; // file attribs + signed char pad0; + signed char pad1; + char name[WAD3_NAMELEN]; // must be null terminated +} dlumpinfo_t; + #endif//WADFILE_H diff --git a/filesystem/wad.c b/filesystem/wad.c index c8bf18c6..bc2ba7a9 100644 --- a/filesystem/wad.c +++ b/filesystem/wad.c @@ -46,31 +46,11 @@ file_n: byte[dwadinfo_t[num]->disksize] infotable dlumpinfo_t[dwadinfo_t->numlumps] ======================================================================== */ -#define WAD3_NAMELEN 16 #define HINT_NAMELEN 5 // e.g. _mask, _norm #define MAX_FILES_IN_WAD 65535 // real limit as above <2Gb size not a lumpcount #include "const.h" -typedef struct -{ - int ident; // should be WAD3 - int numlumps; // num files - int infotableofs; // LUT offset -} dwadinfo_t; - -typedef struct -{ - int filepos; // file offset in WAD - int disksize; // compressed or uncompressed - int size; // uncompressed - signed char type; // TYP_* - signed char attribs; // file attribs - signed char pad0; - signed char pad1; - char name[WAD3_NAMELEN]; // must be null terminated -} dlumpinfo_t; - struct wfile_s { int infotableofs;