mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 14:00:58 +00:00
renders: reuse CalcLumpHunkSize for Leaf and Nodes
This commit is contained in:
parent
851c72f7b4
commit
d2e5955547
7 changed files with 37 additions and 137 deletions
|
@ -1358,7 +1358,8 @@ calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *t
|
|||
}
|
||||
|
||||
int
|
||||
calcTexinfoFacesLeafsSize(const byte *mod_base, const dheader_t *header)
|
||||
calcTexinfoFacesLeafsSize(const byte *mod_base, const dheader_t *header,
|
||||
maptype_t maptype)
|
||||
{
|
||||
int hunkSize = 0;
|
||||
|
||||
|
@ -1378,6 +1379,34 @@ calcTexinfoFacesLeafsSize(const byte *mod_base, const dheader_t *header)
|
|||
sizeof(int), sizeof(msurface_t *), 0); // yes, out is indeed a pointer!
|
||||
}
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
|
||||
1, 1, 0);
|
||||
if ((header->ident == IDBSPHEADER) ||
|
||||
(header->ident == RBSPHEADER))
|
||||
{
|
||||
if ((maptype == map_daikatana) &&
|
||||
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(ddkleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dqleaf_t), sizeof(mleaf_t), 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dqnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
|
||||
hunkSize += 5000000; // and 5MB extra just in case
|
||||
|
||||
return hunkSize;
|
||||
|
|
|
@ -510,34 +510,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
|
|||
1, 1, 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_PLANES],
|
||||
sizeof(dplane_t), sizeof(cplane_t), EXTRA_LUMP_PLANES);
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
|
||||
1, 1, 0);
|
||||
if ((header->ident == IDBSPHEADER) ||
|
||||
(header->ident == RBSPHEADER))
|
||||
{
|
||||
if ((maptype == map_daikatana) &&
|
||||
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(ddkleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header, maptype);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dqleaf_t), sizeof(mleaf_t), 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dqnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(model_t), 0);
|
||||
|
||||
|
|
|
@ -511,34 +511,8 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
|
|||
1, 1, 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_PLANES],
|
||||
sizeof(dplane_t), sizeof(cplane_t), EXTRA_LUMP_PLANES);
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
|
||||
1, 1, 0);
|
||||
if ((header->ident == IDBSPHEADER) ||
|
||||
(header->ident == RBSPHEADER))
|
||||
{
|
||||
if ((maptype == map_daikatana) &&
|
||||
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(ddkleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header, maptype);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dqleaf_t), sizeof(mleaf_t), 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dqnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(gl3model_t), 0);
|
||||
|
||||
|
|
|
@ -511,34 +511,8 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
|
|||
1, 1, 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_PLANES],
|
||||
sizeof(dplane_t), sizeof(cplane_t), EXTRA_LUMP_PLANES);
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
|
||||
1, 1, 0);
|
||||
if ((header->ident == IDBSPHEADER) ||
|
||||
(header->ident == RBSPHEADER))
|
||||
{
|
||||
if ((maptype == map_daikatana) &&
|
||||
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(ddkleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header, maptype);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dqleaf_t), sizeof(mleaf_t), 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dqnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(gl4model_t), 0);
|
||||
|
||||
|
|
|
@ -369,7 +369,8 @@ 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);
|
||||
extern int calcTexinfoFacesLeafsSize(const byte *mod_base, const dheader_t *header,
|
||||
maptype_t maptype);
|
||||
|
||||
/* Surface logic */
|
||||
#define DLIGHT_CUTOFF 64
|
||||
|
|
|
@ -497,34 +497,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
|
|||
1, 1, 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_PLANES],
|
||||
sizeof(dplane_t), sizeof(cplane_t), EXTRA_LUMP_PLANES);
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
|
||||
1, 1, 0);
|
||||
if ((header->ident == IDBSPHEADER) ||
|
||||
(header->ident == RBSPHEADER))
|
||||
{
|
||||
if ((maptype == map_daikatana) &&
|
||||
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(ddkleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header, maptype);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dqleaf_t), sizeof(mleaf_t), 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dqnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(model_t), 0);
|
||||
|
||||
|
|
|
@ -485,34 +485,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
|
|||
1, 1, 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_PLANES],
|
||||
sizeof(dplane_t), sizeof(cplane_t), EXTRA_LUMP_PLANES);
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
|
||||
1, 1, 0);
|
||||
if ((header->ident == IDBSPHEADER) ||
|
||||
(header->ident == RBSPHEADER))
|
||||
{
|
||||
if ((maptype == map_daikatana) &&
|
||||
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(ddkleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dleaf_t), sizeof(mleaf_t), 0);
|
||||
}
|
||||
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header, maptype);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
else
|
||||
{
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_LEAFS],
|
||||
sizeof(dqleaf_t), sizeof(mleaf_t), 0);
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_NODES],
|
||||
sizeof(dqnode_t), sizeof(mnode_t), EXTRA_LUMP_NODES);
|
||||
}
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(model_t), 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue