maps: rearrange Daikatana detect code

This commit is contained in:
Denis Pauk 2024-04-05 00:19:53 +03:00
parent 5770a9ff1b
commit 7a0d1d737e
9 changed files with 34 additions and 31 deletions

View file

@ -66,7 +66,7 @@ Maps support:
| Format | Version | Game |
| ------ | ------- | ------------------------------------------ |
| IBSP | 39 | Quake 2 / Anachronox / Kingpin / Heretic 2 |
| IBSP | 41 | Daikatana |
| IBSP | 41 | Daikatana / SIN |
| QBSP | 39 | Quake 2 ReRelease |
| BSPX | 39 | Quake 2 ReRelease (Extension to IBSP) |
@ -85,6 +85,7 @@ Goals (finished):
* Daikatana/Heretic 2 map partial format support,
* md5 improve load speed,
* support Anachronox .dat format,
* suport Daikatana/SiN .pak/.sin format from pakextract,
* add debug progress loading code for maps.
Goals (none of it finished):
@ -92,7 +93,6 @@ Goals (none of it finished):
* Support effects and additional flags for ReRelease when possible.
Bonus goals:
* Port SiN/Daikatana pack support from pakextract,
* support surface flags and content types for Daikatana, Heretic 2, Anachronox,
* Use shared model cache in client code insted reimplemnet in each render,
* Check load soft colormap as 24bit color,

View file

@ -681,7 +681,7 @@ Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header, const char *lumpname,
}
const bspx_header_t *
Mod_LoadBSPX(int filesize, const byte *mod_base)
Mod_LoadBSPX(int filesize, const byte *mod_base, maptype_t maptype)
{
const bspx_header_t *xheader;
const dheader_t *header;
@ -693,7 +693,7 @@ Mod_LoadBSPX(int filesize, const byte *mod_base)
xofs = 0;
numlumps = HEADER_LUMPS;
if (header->version == BSPDKMVERSION)
if (maptype == map_daikatana)
{
numlumps = 21;
}

View file

@ -483,7 +483,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
}
/* check for BSPX extensions */
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header);
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header, maptype);
// calculate the needed hunksize from the lumps
int hunkSize = 0;

View file

@ -484,7 +484,7 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
}
/* check for BSPX extensions */
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header);
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header, maptype);
// calculate the needed hunksize from the lumps
int hunkSize = 0;

View file

@ -484,7 +484,7 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
}
/* check for BSPX extensions */
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header);
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header, maptype);
// calculate the needed hunksize from the lumps
int hunkSize = 0;

View file

@ -362,7 +362,8 @@ extern void Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedg
extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node);
extern const void *Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header,
const char *lumpname, int *plumpsize, const byte *mod_base);
extern const bspx_header_t *Mod_LoadBSPX(int filesize, const byte *mod_base);
extern const bspx_header_t *Mod_LoadBSPX(int filesize, const byte *mod_base,
maptype_t maptype);
extern int Mod_LoadBSPXDecoupledLM(const dlminfo_t* lminfos, int surfnum, msurface_t *out);
extern int Mod_LoadFile(const char *name, void **buffer);
extern int calcTexinfoFacesLeafsSize(const byte *mod_base, const dheader_t *header);

View file

@ -468,7 +468,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
}
/* check for BSPX extensions */
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header);
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header, maptype);
// calculate the needed hunksize from the lumps
int hunkSize = 0;

View file

@ -458,7 +458,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
}
/* check for BSPX extensions */
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header);
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)header, maptype);
// calculate the needed hunksize from the lumps
int hunkSize = 0;

View file

@ -594,7 +594,6 @@ typedef struct {
#define QBSPHEADER (('P' << 24) + ('S' << 16) + ('B' << 8) + 'Q') /* little-endian "QBSP" */
#define BSPXHEADER (('X' << 24) + ('P' << 16) + ('S' << 8) + 'B') /* little-endian "BSPX" */
#define BSPVERSION 38
#define BSPDKMVERSION 41
/* upper design bounds: leaffaces, leafbrushes, planes, and
* verts are still bounded by 16 bit short limits,
@ -850,26 +849,6 @@ typedef struct
unsigned short numleafbrushes;
} dleaf_t;
/* Daikatana Leafs struct */
typedef struct
{
int contents; /* OR of all brushes (not needed?) */
short cluster;
short area;
short mins[3]; /* for frustum culling */
short maxs[3];
unsigned short firstleafface;
unsigned short numleaffaces;
unsigned short firstleafbrush;
unsigned short numleafbrushes;
int unknow; /* some unused additional field */
} ddkleaf_t;
typedef struct
{
int contents; /* OR of all brushes (not needed?) */
@ -935,5 +914,28 @@ typedef struct
int firstareaportal;
} darea_t;
/* Daikatana */
#define BSPDKMVERSION 41
/* Leafs struct */
typedef struct
{
int contents; /* OR of all brushes (not needed?) */
short cluster;
short area;
short mins[3]; /* for frustum culling */
short maxs[3];
unsigned short firstleafface;
unsigned short numleaffaces;
unsigned short firstleafbrush;
unsigned short numleafbrushes;
int unknow; /* some unused additional field */
} ddkleaf_t;
#endif