From 1121407e39d2349f13422e9ae9446728691b33b3 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sat, 7 Oct 2023 15:11:42 +0300 Subject: [PATCH] Share Mod_LoadQBSPLeafs between renders --- src/client/refresh/files/models.c | 117 +++++++++++++++++++++++++++++ src/client/refresh/gl1/gl1_model.c | 101 +------------------------ src/client/refresh/gl3/gl3_model.c | 101 +------------------------ src/client/refresh/ref_shared.h | 7 +- src/client/refresh/soft/sw_model.c | 101 +------------------------ src/client/refresh/vk/vk_model.c | 101 +------------------------ 6 files changed, 134 insertions(+), 394 deletions(-) diff --git a/src/client/refresh/files/models.c b/src/client/refresh/files/models.c index eff83e4a..5a502a86 100644 --- a/src/client/refresh/files/models.c +++ b/src/client/refresh/files/models.c @@ -2189,6 +2189,123 @@ Mod_LoadBSPXDecoupledLM(const dlminfo_t* lminfos, int surfnum, msurface_t *out) return LittleLong(lminfo->lightofs); } +static void +Mod_LoadLeafs(const char *name, mleaf_t **leafs, int *numleafs, + msurface_t **marksurfaces, int nummarksurfaces, + const byte *mod_base, const lump_t *l) +{ + dleaf_t *in; + mleaf_t *out; + int i, j, count; + + in = (void *)(mod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", + __func__, name); + } + + count = l->filelen / sizeof(*in); + out = Hunk_Alloc(count * sizeof(*out)); + + *leafs = out; + *numleafs = count; + + for (i = 0; i < count; i++, in++, out++) + { + unsigned firstleafface; + + for (j = 0; j < 3; j++) + { + out->minmaxs[j] = LittleShort(in->mins[j]); + out->minmaxs[3 + j] = LittleShort(in->maxs[j]); + } + + out->contents = LittleLong(in->contents); + out->cluster = LittleShort(in->cluster); + out->area = LittleShort(in->area); + + // make unsigned long from signed short + firstleafface = LittleShort(in->firstleafface) & 0xFFFF; + out->nummarksurfaces = LittleShort(in->numleaffaces) & 0xFFFF; + + out->firstmarksurface = marksurfaces + firstleafface; + if ((firstleafface + out->nummarksurfaces) > nummarksurfaces) + { + ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", + __func__, name); + } + } +} + +static void +Mod_LoadQLeafs(const char *name, mleaf_t **leafs, int *numleafs, + msurface_t **marksurfaces, int nummarksurfaces, + const byte *mod_base, const lump_t *l) +{ + dqleaf_t *in; + mleaf_t *out; + int i, j, count; + + in = (void *)(mod_base + l->fileofs); + + if (l->filelen % sizeof(*in)) + { + ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", + __func__, name); + } + + count = l->filelen / sizeof(*in); + out = Hunk_Alloc(count * sizeof(*out)); + + *leafs = out; + *numleafs = count; + + for (i = 0; i < count; i++, in++, out++) + { + unsigned firstleafface; + + for (j = 0; j < 3; j++) + { + out->minmaxs[j] = LittleFloat(in->mins[j]); + out->minmaxs[3 + j] = LittleFloat(in->maxs[j]); + } + + out->contents = LittleLong(in->contents); + out->cluster = LittleLong(in->cluster); + out->area = LittleLong(in->area); + + // make unsigned long from signed short + firstleafface = LittleLong(in->firstleafface) & 0xFFFFFFFF; + out->nummarksurfaces = LittleLong(in->numleaffaces) & 0xFFFFFFFF; + + out->firstmarksurface = marksurfaces + firstleafface; + if ((firstleafface + out->nummarksurfaces) > nummarksurfaces) + { + ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", + __func__, name); + } + } +} + +void +Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs, + msurface_t **marksurfaces, int nummarksurfaces, + const byte *mod_base, const lump_t *l, int ident) +{ + if (ident == IDBSPHEADER) + { + Mod_LoadLeafs(name, leafs, numleafs, marksurfaces, nummarksurfaces, + mod_base, l); + } + else + { + Mod_LoadQLeafs(name, leafs, numleafs, marksurfaces, nummarksurfaces, + mod_base, l); + } +} + /* Need to clean */ struct rctx_s { const byte *data; diff --git a/src/client/refresh/gl1/gl1_model.c b/src/client/refresh/gl1/gl1_model.c index c7ee9d0a..dfb578c5 100644 --- a/src/client/refresh/gl1/gl1_model.c +++ b/src/client/refresh/gl1/gl1_model.c @@ -587,102 +587,6 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l, LM_EndBuildingLightmaps(); } -static void -Mod_LoadLeafs(model_t *loadmodel, const byte *mod_base, const lump_t *l) -{ - dleaf_t *in; - mleaf_t *out; - int i, j, count; - - in = (void *)(mod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", - __func__, loadmodel->name); - } - - count = l->filelen / sizeof(*in); - out = Hunk_Alloc(count * sizeof(*out)); - - loadmodel->leafs = out; - loadmodel->numleafs = count; - - for (i = 0; i < count; i++, in++, out++) - { - unsigned firstleafface; - - for (j = 0; j < 3; j++) - { - out->minmaxs[j] = LittleShort(in->mins[j]); - out->minmaxs[3 + j] = LittleShort(in->maxs[j]); - } - - out->contents = LittleLong(in->contents); - out->cluster = LittleShort(in->cluster); - out->area = LittleShort(in->area); - - // make unsigned long from signed short - firstleafface = LittleShort(in->firstleafface) & 0xFFFF; - out->nummarksurfaces = LittleShort(in->numleaffaces) & 0xFFFF; - - out->firstmarksurface = loadmodel->marksurfaces + firstleafface; - if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces) - { - ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", - __func__, loadmodel->name); - } - } -} - -static void -Mod_LoadQLeafs(model_t *loadmodel, const byte *mod_base, const lump_t *l) -{ - dqleaf_t *in; - mleaf_t *out; - int i, j, count; - - in = (void *)(mod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", - __func__, loadmodel->name); - } - - count = l->filelen / sizeof(*in); - out = Hunk_Alloc(count * sizeof(*out)); - - loadmodel->leafs = out; - loadmodel->numleafs = count; - - for (i = 0; i < count; i++, in++, out++) - { - unsigned firstleafface; - - for (j = 0; j < 3; j++) - { - out->minmaxs[j] = LittleFloat(in->mins[j]); - out->minmaxs[3 + j] = LittleFloat(in->maxs[j]); - } - - out->contents = LittleLong(in->contents); - out->cluster = LittleLong(in->cluster); - out->area = LittleLong(in->area); - - // make unsigned long from signed short - firstleafface = LittleLong(in->firstleafface) & 0xFFFFFFFF; - out->nummarksurfaces = LittleLong(in->numleaffaces) & 0xFFFFFFFF; - - out->firstmarksurface = loadmodel->marksurfaces + firstleafface; - if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces) - { - ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", - __func__, loadmodel->name); - } - } -} - static void Mod_LoadMarksurfaces(model_t *loadmodel, const byte *mod_base, const lump_t *l) { @@ -893,16 +797,17 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) Mod_LoadQMarksurfaces(mod, mod_base, &header->lumps[LUMP_LEAFFACES]); } Mod_LoadVisibility(&mod->vis, mod_base, &header->lumps[LUMP_VISIBILITY]); + Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs, + mod->marksurfaces, mod->nummarksurfaces, mod_base, + &header->lumps[LUMP_LEAFS], header->ident); if (header->ident == IDBSPHEADER) { - Mod_LoadLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]); Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs, mod->numleafs, &mod->nodes, &mod->numnodes, mod_base, &header->lumps[LUMP_NODES]); } else { - Mod_LoadQLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]); Mod_LoadQNodes(mod->name, mod->planes, mod->numplanes, mod->leafs, mod->numleafs, &mod->nodes, &mod->numnodes, mod_base, &header->lumps[LUMP_NODES]); diff --git a/src/client/refresh/gl3/gl3_model.c b/src/client/refresh/gl3/gl3_model.c index e80bbeef..ea14a6f8 100644 --- a/src/client/refresh/gl3/gl3_model.c +++ b/src/client/refresh/gl3/gl3_model.c @@ -553,102 +553,6 @@ Mod_LoadQFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l, GL3_LM_EndBuildingLightmaps(); } -static void -Mod_LoadLeafs(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l) -{ - dleaf_t *in; - mleaf_t *out; - int i, j, count; - - in = (void *)(mod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", - __func__, loadmodel->name); - } - - count = l->filelen / sizeof(*in); - out = Hunk_Alloc(count * sizeof(*out)); - - loadmodel->leafs = out; - loadmodel->numleafs = count; - - for (i = 0; i < count; i++, in++, out++) - { - unsigned firstleafface; - - for (j = 0; j < 3; j++) - { - out->minmaxs[j] = LittleShort(in->mins[j]); - out->minmaxs[3 + j] = LittleShort(in->maxs[j]); - } - - out->contents = LittleLong(in->contents); - out->cluster = LittleShort(in->cluster); - out->area = LittleShort(in->area); - - // make unsigned long from signed short - firstleafface = LittleShort(in->firstleafface) & 0xFFFF; - out->nummarksurfaces = LittleShort(in->numleaffaces) & 0xFFFF; - - out->firstmarksurface = loadmodel->marksurfaces + firstleafface; - if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces) - { - ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", - __func__, loadmodel->name); - } - } -} - -static void -Mod_LoadQLeafs(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l) -{ - dqleaf_t *in; - mleaf_t *out; - int i, j, count; - - in = (void *)(mod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", - __func__, loadmodel->name); - } - - count = l->filelen / sizeof(*in); - out = Hunk_Alloc(count * sizeof(*out)); - - loadmodel->leafs = out; - loadmodel->numleafs = count; - - for (i = 0; i < count; i++, in++, out++) - { - unsigned firstleafface; - - for (j = 0; j < 3; j++) - { - out->minmaxs[j] = LittleFloat(in->mins[j]); - out->minmaxs[3 + j] = LittleFloat(in->maxs[j]); - } - - out->contents = LittleLong(in->contents); - out->cluster = LittleLong(in->cluster); - out->area = LittleLong(in->area); - - // make unsigned long from signed short - firstleafface = LittleLong(in->firstleafface) & 0xFFFFFFFF; - out->nummarksurfaces = LittleLong(in->numleaffaces) & 0xFFFFFFFF; - - out->firstmarksurface = loadmodel->marksurfaces + firstleafface; - if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces) - { - ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", - __func__, loadmodel->name); - } - } -} - static void Mod_LoadMarksurfaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l) { @@ -859,16 +763,17 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen) Mod_LoadQMarksurfaces(mod, mod_base, &header->lumps[LUMP_LEAFFACES]); } Mod_LoadVisibility(&mod->vis, mod_base, &header->lumps[LUMP_VISIBILITY]); + Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs, + mod->marksurfaces, mod->nummarksurfaces, mod_base, + &header->lumps[LUMP_LEAFS], header->ident); if (header->ident == IDBSPHEADER) { - Mod_LoadLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]); Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs, mod->numleafs, &mod->nodes, &mod->numnodes, mod_base, &header->lumps[LUMP_NODES]); } else { - Mod_LoadQLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]); Mod_LoadQNodes(mod->name, mod->planes, mod->numplanes, mod->leafs, mod->numleafs, &mod->nodes, &mod->numnodes, mod_base, &header->lumps[LUMP_NODES]); diff --git a/src/client/refresh/ref_shared.h b/src/client/refresh/ref_shared.h index 281021ee..96391793 100644 --- a/src/client/refresh/ref_shared.h +++ b/src/client/refresh/ref_shared.h @@ -348,10 +348,13 @@ extern void Mod_LoadEdges(const char *name, medge_t **edges, int *numedges, const byte *mod_base, const lump_t *l, int extra); extern void Mod_LoadQEdges(const char *name, medge_t **edges, int *numedges, const byte *mod_base, const lump_t *l, int extra); -extern void Mod_LoadPlanes (const char *name, cplane_t **planes, int *numplanes, +extern void Mod_LoadPlanes(const char *name, cplane_t **planes, int *numplanes, const byte *mod_base, const lump_t *l, int extra); -extern void Mod_LoadSurfedges (const char *name, int **surfedges, int *numsurfedges, +extern void Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedges, const byte *mod_base, const lump_t *l, int extra); +extern void Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs, + msurface_t **marksurfaces, int nummarksurfaces, + const byte *mod_base, const lump_t *l, int ident); extern int Mod_CalcLumpHunkSize(const lump_t *l, int inSize, int outSize, int extra); extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node); extern const void *Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header, diff --git a/src/client/refresh/soft/sw_model.c b/src/client/refresh/soft/sw_model.c index 55bca95c..a7dd80be 100644 --- a/src/client/refresh/soft/sw_model.c +++ b/src/client/refresh/soft/sw_model.c @@ -402,102 +402,6 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l, } } -static void -Mod_LoadLeafs(model_t *loadmodel, const byte *mod_base, const lump_t *l) -{ - dleaf_t *in; - mleaf_t *out; - int i, j, count; - - in = (void *)(mod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", - __func__, loadmodel->name); - } - - count = l->filelen / sizeof(*in); - out = Hunk_Alloc(count * sizeof(*out)); - - loadmodel->leafs = out; - loadmodel->numleafs = count; - - for (i = 0; i < count; i++, in++, out++) - { - unsigned firstleafface; - - for (j = 0; j < 3; j++) - { - out->minmaxs[j] = LittleShort(in->mins[j]); - out->minmaxs[3 + j] = LittleShort(in->maxs[j]); - } - - out->contents = LittleLong(in->contents); - out->cluster = LittleShort(in->cluster); - out->area = LittleShort(in->area); - - // make unsigned long from signed short - firstleafface = LittleShort(in->firstleafface) & 0xFFFF; - out->nummarksurfaces = LittleShort(in->numleaffaces) & 0xFFFF; - - out->firstmarksurface = loadmodel->marksurfaces + firstleafface; - if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces) - { - ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", - __func__, loadmodel->name); - } - } -} - -static void -Mod_LoadQLeafs(model_t *loadmodel, const byte *mod_base, const lump_t *l) -{ - dqleaf_t *in; - mleaf_t *out; - int i, j, count; - - in = (void *)(mod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", - __func__, loadmodel->name); - } - - count = l->filelen / sizeof(*in); - out = Hunk_Alloc(count * sizeof(*out)); - - loadmodel->leafs = out; - loadmodel->numleafs = count; - - for (i = 0; i < count; i++, in++, out++) - { - unsigned firstleafface; - - for (j = 0; j < 3; j++) - { - out->minmaxs[j] = LittleFloat(in->mins[j]); - out->minmaxs[3 + j] = LittleFloat(in->maxs[j]); - } - - out->contents = LittleLong(in->contents); - out->cluster = LittleLong(in->cluster); - out->area = LittleLong(in->area); - - // make unsigned long from signed short - firstleafface = LittleLong(in->firstleafface) & 0xFFFFFFFF; - out->nummarksurfaces = LittleLong(in->numleaffaces) & 0xFFFFFFFF; - - out->firstmarksurface = loadmodel->marksurfaces + firstleafface; - if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces) - { - ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", - __func__, loadmodel->name); - } - } -} - static void Mod_LoadMarksurfaces(model_t *loadmodel, const byte *mod_base, const lump_t *l) { @@ -711,16 +615,17 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) Mod_LoadQMarksurfaces(mod, mod_base, &header->lumps[LUMP_LEAFFACES]); } Mod_LoadVisibility(&mod->vis, mod_base, &header->lumps[LUMP_VISIBILITY]); + Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs, + mod->marksurfaces, mod->nummarksurfaces, mod_base, + &header->lumps[LUMP_LEAFS], header->ident); if (header->ident == IDBSPHEADER) { - Mod_LoadLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]); Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs, mod->numleafs, &mod->nodes, &mod->numnodes, mod_base, &header->lumps[LUMP_NODES]); } else { - Mod_LoadQLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]); Mod_LoadQNodes(mod->name, mod->planes, mod->numplanes, mod->leafs, mod->numleafs, &mod->nodes, &mod->numnodes, mod_base, &header->lumps[LUMP_NODES]); diff --git a/src/client/refresh/vk/vk_model.c b/src/client/refresh/vk/vk_model.c index 78f5464d..7397598e 100644 --- a/src/client/refresh/vk/vk_model.c +++ b/src/client/refresh/vk/vk_model.c @@ -557,102 +557,6 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l, Vk_EndBuildingLightmaps(); } -static void -Mod_LoadLeafs(model_t *loadmodel, const byte *mod_base, const lump_t *l) -{ - dleaf_t *in; - mleaf_t *out; - int i, j, count; - - in = (void *)(mod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", - __func__, loadmodel->name); - } - - count = l->filelen / sizeof(*in); - out = Hunk_Alloc(count * sizeof(*out)); - - loadmodel->leafs = out; - loadmodel->numleafs = count; - - for (i = 0; i < count; i++, in++, out++) - { - unsigned firstleafface; - - for (j = 0; j < 3; j++) - { - out->minmaxs[j] = LittleShort(in->mins[j]); - out->minmaxs[3 + j] = LittleShort(in->maxs[j]); - } - - out->contents = LittleLong(in->contents); - out->cluster = LittleShort(in->cluster); - out->area = LittleShort(in->area); - - // make unsigned long from signed short - firstleafface = LittleShort(in->firstleafface) & 0xFFFF; - out->nummarksurfaces = LittleShort(in->numleaffaces) & 0xFFFF; - - out->firstmarksurface = loadmodel->marksurfaces + firstleafface; - if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces) - { - ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", - __func__, loadmodel->name); - } - } -} - -static void -Mod_LoadQLeafs(model_t *loadmodel, const byte *mod_base, const lump_t *l) -{ - dqleaf_t *in; - mleaf_t *out; - int i, j, count; - - in = (void *)(mod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - ri.Sys_Error(ERR_DROP, "%s: funny lump size in %s", - __func__, loadmodel->name); - } - - count = l->filelen / sizeof(*in); - out = Hunk_Alloc(count * sizeof(*out)); - - loadmodel->leafs = out; - loadmodel->numleafs = count; - - for (i = 0; i < count; i++, in++, out++) - { - unsigned firstleafface; - - for (j = 0; j < 3; j++) - { - out->minmaxs[j] = LittleFloat(in->mins[j]); - out->minmaxs[3 + j] = LittleFloat(in->maxs[j]); - } - - out->contents = LittleLong(in->contents); - out->cluster = LittleLong(in->cluster); - out->area = LittleLong(in->area); - - // make unsigned long from signed short - firstleafface = LittleLong(in->firstleafface) & 0xFFFFFFFF; - out->nummarksurfaces = LittleLong(in->numleaffaces) & 0xFFFFFFFF; - - out->firstmarksurface = loadmodel->marksurfaces + firstleafface; - if ((firstleafface + out->nummarksurfaces) > loadmodel->nummarksurfaces) - { - ri.Sys_Error(ERR_DROP, "%s: wrong marksurfaces position in %s", - __func__, loadmodel->name); - } - } -} - static void Mod_LoadMarksurfaces(model_t *loadmodel, const byte *mod_base, const lump_t *l) { @@ -863,16 +767,17 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) Mod_LoadQMarksurfaces(mod, mod_base, &header->lumps[LUMP_LEAFFACES]); } Mod_LoadVisibility(&mod->vis, mod_base, &header->lumps[LUMP_VISIBILITY]); + Mod_LoadQBSPLeafs(mod->name, &mod->leafs, &mod->numleafs, + mod->marksurfaces, mod->nummarksurfaces, mod_base, + &header->lumps[LUMP_LEAFS], header->ident); if (header->ident == IDBSPHEADER) { - Mod_LoadLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]); Mod_LoadNodes(mod->name, mod->planes, mod->numplanes, mod->leafs, mod->numleafs, &mod->nodes, &mod->numnodes, mod_base, &header->lumps[LUMP_NODES]); } else { - Mod_LoadQLeafs(mod, mod_base, &header->lumps[LUMP_LEAFS]); Mod_LoadQNodes(mod->name, mod->planes, mod->numplanes, mod->leafs, mod->numleafs, &mod->nodes, &mod->numnodes, mod_base, &header->lumps[LUMP_NODES]);