From c0e3a86f30fa5b1b5ddac354e7dccb67c98aa37a Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sun, 14 Apr 2024 13:36:54 +0300 Subject: [PATCH] collision: use RBSP to QBSP converted maps --- src/common/cmodels.c | 214 +++++++++++++++++++++++++++++- src/common/collision.c | 289 +++-------------------------------------- 2 files changed, 227 insertions(+), 276 deletions(-) diff --git a/src/common/cmodels.c b/src/common/cmodels.c index 6ffe7749..caeacaf9 100644 --- a/src/common/cmodels.c +++ b/src/common/cmodels.c @@ -487,6 +487,41 @@ Mod_Load2QBSP_IBSP_NODES(byte *outbuf, dheader_t *outheader, const byte *inbuf, } } +static void +Mod_Load2QBSP_QBSP_NODES(byte *outbuf, dheader_t *outheader, const byte *inbuf, + const dheader_t *inheader, const size_t *rules) +{ + dqnode_t *in, *out; + int i, count; + + count = inheader->lumps[LUMP_NODES].filelen / rules[LUMP_NODES]; + in = (dqnode_t *)(inbuf + inheader->lumps[LUMP_NODES].fileofs); + out = (dqnode_t *)(outbuf + outheader->lumps[LUMP_NODES].fileofs); + + for (i = 0; i < count; i++) + { + int j; + + for (j = 0; j < 3; j++) + { + out->mins[j] = LittleFloat(in->mins[j]); + out->maxs[j] = LittleFloat(in->maxs[j]); + } + + out->planenum = LittleLong(in->planenum); + out->firstface = LittleLong(in->firstface) & 0xFFFFFFFF; + out->numfaces = LittleLong(in->numfaces) & 0xFFFFFFFF; + + for (j = 0; j < 2; j++) + { + out->children[j] = LittleLong(in->children[j]); + } + + out++; + in++; + } +} + static void Mod_Load2QBSP_IBSP_TEXINFO(byte *outbuf, dheader_t *outheader, const byte *inbuf, const dheader_t *inheader, const size_t *rules) @@ -518,6 +553,38 @@ Mod_Load2QBSP_IBSP_TEXINFO(byte *outbuf, dheader_t *outheader, const byte *inbuf } } +static void +Mod_Load2QBSP_RBSP_TEXINFO(byte *outbuf, dheader_t *outheader, const byte *inbuf, + const dheader_t *inheader, const size_t *rules) +{ + texrinfo_t *in; + texinfo_t *out; + int i, count; + + count = inheader->lumps[LUMP_TEXINFO].filelen / rules[LUMP_TEXINFO]; + in = (texrinfo_t *)(inbuf + inheader->lumps[LUMP_TEXINFO].fileofs); + out = (texinfo_t *)(outbuf + outheader->lumps[LUMP_TEXINFO].fileofs); + + for (i = 0; i < count; i++) + { + int j; + + for (j = 0; j < 4; j++) + { + out->vecs[0][j] = LittleFloat(in->vecs[0][j]); + out->vecs[1][j] = LittleFloat(in->vecs[1][j]); + } + + out->flags = LittleLong(in->flags); + out->nexttexinfo = LittleLong(in->nexttexinfo); + strncpy(out->texture, in->texture, + Q_min(sizeof(out->texture), sizeof(in->texture))); + + out++; + in++; + } +} + static void Mod_Load2QBSP_IBSP_FACES(byte *outbuf, dheader_t *outheader, const byte *inbuf, const dheader_t *inheader, const size_t *rules) @@ -545,6 +612,60 @@ Mod_Load2QBSP_IBSP_FACES(byte *outbuf, dheader_t *outheader, const byte *inbuf, } } +static void +Mod_Load2QBSP_RBSP_FACES(byte *outbuf, dheader_t *outheader, const byte *inbuf, + const dheader_t *inheader, const size_t *rules) +{ + int i, count; + drface_t *in; + dqface_t *out; + + count = inheader->lumps[LUMP_FACES].filelen / rules[LUMP_FACES]; + in = (drface_t *)(inbuf + inheader->lumps[LUMP_FACES].fileofs); + out = (dqface_t *)(outbuf + outheader->lumps[LUMP_FACES].fileofs); + + for (i = 0; i < count; i++) + { + out->planenum = LittleShort(in->planenum); + out->side = LittleShort(in->side); + out->firstedge = LittleLong(in->firstedge); + out->numedges = LittleShort(in->numedges); + out->texinfo = LittleShort(in->texinfo); + memcpy(out->styles, in->styles, Q_min(sizeof(out->styles), sizeof(in->styles))); + out->lightofs = LittleLong(in->lightofs); + + out++; + in++; + } +} + +static void +Mod_Load2QBSP_QBSP_FACES(byte *outbuf, dheader_t *outheader, const byte *inbuf, + const dheader_t *inheader, const size_t *rules) +{ + int i, count; + dqface_t *in; + dqface_t *out; + + count = inheader->lumps[LUMP_FACES].filelen / rules[LUMP_FACES]; + in = (dqface_t *)(inbuf + inheader->lumps[LUMP_FACES].fileofs); + out = (dqface_t *)(outbuf + outheader->lumps[LUMP_FACES].fileofs); + + for (i = 0; i < count; i++) + { + out->planenum = LittleLong(in->planenum); + out->side = LittleLong(in->side); + out->firstedge = LittleLong(in->firstedge); + out->numedges = LittleLong(in->numedges); + out->texinfo = LittleLong(in->texinfo); + memcpy(out->styles, in->styles, Q_min(sizeof(out->styles), sizeof(in->styles))); + out->lightofs = LittleLong(in->lightofs); + + out++; + in++; + } +} + static void Mod_Load2QBSP_IBSP_LIGHTING(byte *outbuf, dheader_t *outheader, const byte *inbuf, const dheader_t *inheader) @@ -750,6 +871,49 @@ Mod_Load2QBSP_IBSP_BRUSHSIDES(byte *outbuf, dheader_t *outheader, const byte *in } } +static void +Mod_Load2QBSP_RBSP_BRUSHSIDES(byte *outbuf, dheader_t *outheader, const byte *inbuf, + const dheader_t *inheader, const size_t *rules) +{ + drbrushside_t *in; + dqbrushside_t *out; + int i, count; + + count = inheader->lumps[LUMP_BRUSHSIDES].filelen / rules[LUMP_BRUSHSIDES]; + in = (drbrushside_t *)(inbuf + inheader->lumps[LUMP_BRUSHSIDES].fileofs); + out = (dqbrushside_t *)(outbuf + outheader->lumps[LUMP_BRUSHSIDES].fileofs); + + for (i = 0; i < count; i++) + { + out->planenum = LittleShort(in->planenum); + out->texinfo = LittleShort(in->texinfo); + + out++; + in++; + } +} + +static void +Mod_Load2QBSP_QBSP_BRUSHSIDES(byte *outbuf, dheader_t *outheader, const byte *inbuf, + const dheader_t *inheader, const size_t *rules) +{ + dqbrushside_t *in, *out; + int i, count; + + count = inheader->lumps[LUMP_BRUSHSIDES].filelen / rules[LUMP_BRUSHSIDES]; + in = (dqbrushside_t *)(inbuf + inheader->lumps[LUMP_BRUSHSIDES].fileofs); + out = (dqbrushside_t *)(outbuf + outheader->lumps[LUMP_BRUSHSIDES].fileofs); + + for (i = 0; i < count; i++) + { + out->planenum = LittleLong(in->planenum); + out->texinfo = LittleLong(in->texinfo); + + out++; + in++; + } +} + static void Mod_Load2QBSP_IBSP_AREAS(byte *outbuf, dheader_t *outheader, const byte *inbuf, const dheader_t *inheader, const size_t *rules) @@ -910,9 +1074,39 @@ Mod_Load2QBSP(const char *name, byte *inbuf, size_t filesize, size_t *out_len, Mod_Load2QBSP_IBSP_PLANES(outbuf, outheader, inbuf, &header, rules); Mod_Load2QBSP_IBSP_VERTEXES(outbuf, outheader, inbuf, &header, rules); Mod_Load2QBSP_IBSP_VISIBILITY(outbuf, outheader, inbuf, &header); - Mod_Load2QBSP_IBSP_NODES(outbuf, outheader, inbuf, &header, rules); - Mod_Load2QBSP_IBSP_TEXINFO(outbuf, outheader, inbuf, &header, rules); - Mod_Load2QBSP_IBSP_FACES(outbuf, outheader, inbuf, &header, rules); + if ((rules == idbsplumps) || + (rules == dkbsplumps) || + (rules == rbsplumps)) + { + Mod_Load2QBSP_IBSP_NODES(outbuf, outheader, inbuf, &header, rules); + } + else if (rules == qbsplumps) + { + Mod_Load2QBSP_QBSP_NODES(outbuf, outheader, inbuf, &header, rules); + } + if ((rules == idbsplumps) || + (rules == dkbsplumps) || + (rules == qbsplumps)) + { + Mod_Load2QBSP_IBSP_TEXINFO(outbuf, outheader, inbuf, &header, rules); + } + else if (rules == rbsplumps) + { + Mod_Load2QBSP_RBSP_TEXINFO(outbuf, outheader, inbuf, &header, rules); + } + if ((rules == idbsplumps) || + (rules == dkbsplumps)) + { + Mod_Load2QBSP_IBSP_FACES(outbuf, outheader, inbuf, &header, rules); + } + else if (rules == rbsplumps) + { + Mod_Load2QBSP_RBSP_FACES(outbuf, outheader, inbuf, &header, rules); + } + else if (rules == qbsplumps) + { + Mod_Load2QBSP_QBSP_FACES(outbuf, outheader, inbuf, &header, rules); + } Mod_Load2QBSP_IBSP_LIGHTING(outbuf, outheader, inbuf, &header); Mod_Load2QBSP_IBSP_LEAFS(outbuf, outheader, inbuf, &header, rules); Mod_Load2QBSP_IBSP_LEAFFACES(outbuf, outheader, inbuf, &header, rules); @@ -921,7 +1115,19 @@ Mod_Load2QBSP(const char *name, byte *inbuf, size_t filesize, size_t *out_len, Mod_Load2QBSP_IBSP_SURFEDGES(outbuf, outheader, inbuf, &header, rules); Mod_Load2QBSP_IBSP_MODELS(outbuf, outheader, inbuf, &header, rules); Mod_Load2QBSP_IBSP_BRUSHES(outbuf, outheader, inbuf, &header, rules); - Mod_Load2QBSP_IBSP_BRUSHSIDES(outbuf, outheader, inbuf, &header, rules); + if ((rules == idbsplumps) || + (rules == dkbsplumps)) + { + Mod_Load2QBSP_IBSP_BRUSHSIDES(outbuf, outheader, inbuf, &header, rules); + } + else if (rules == rbsplumps) + { + Mod_Load2QBSP_RBSP_BRUSHSIDES(outbuf, outheader, inbuf, &header, rules); + } + else if (rules == qbsplumps) + { + Mod_Load2QBSP_QBSP_BRUSHSIDES(outbuf, outheader, inbuf, &header, rules); + } Mod_Load2QBSP_IBSP_AREAS(outbuf, outheader, inbuf, &header, rules); Mod_Load2QBSP_IBSP_AREAPORTALS(outbuf, outheader, inbuf, &header, rules); diff --git a/src/common/collision.c b/src/common/collision.c index 52ab2e6a..3a02ec3b 100644 --- a/src/common/collision.c +++ b/src/common/collision.c @@ -1372,78 +1372,6 @@ CMod_LoadSurfaces(const char *name, mapsurface_t **map_surfaces, int *numtexinfo } } -static void -CMod_LoadRSurfaces(const char *name, mapsurface_t **map_surfaces, int *numtexinfo, - const byte *cmod_base, const lump_t *l, maptype_t maptype) -{ - texrinfo_t *in; - mapsurface_t *out; - int i, count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - Com_Error(ERR_DROP, "%s: funny lump size", __func__); - } - - count = l->filelen / sizeof(*in); - - if (count < 1) - { - Com_Error(ERR_DROP, "%s: Map with no surfaces", __func__); - } - - *numtexinfo = count; - out = *map_surfaces = Hunk_Alloc(count * sizeof(*out)); - - for (i = 0; i < count; i++, in++, out++) - { - Q_strlcpy(out->c.name, in->texture, sizeof(out->c.name)); - Q_strlcpy(out->rname, in->texture, sizeof(out->rname)); - out->c.flags = Mod_LoadSurfConvertFlags(LittleLong(in->flags), maptype); - } -} - -static void -CMod_LoadNodes(const char *name, cnode_t **map_nodes, int *numnodes, - cplane_t *map_planes, const byte *cmod_base, const lump_t *l) -{ - dnode_t *in; - int child; - cnode_t *out; - int i, j, count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - Com_Error(ERR_DROP, "%s: Map %s has funny lump size " YQ2_COM_PRIdS, - __func__, name, sizeof(*in)); - } - - count = l->filelen / sizeof(*in); - - if (count < 1) - { - Com_Error(ERR_DROP, "%s: Map %s has no nodes", __func__, name); - } - - out = *map_nodes = Hunk_Alloc((count + EXTRA_LUMP_NODES) * sizeof(*out)); - *numnodes = count; - - for (i = 0; i < count; i++, out++, in++) - { - out->plane = map_planes + LittleLong(in->planenum); - - for (j = 0; j < 2; j++) - { - child = LittleLong(in->children[j]); - out->children[j] = child; - } - } -} - static void CMod_LoadQNodes(const char *name, cnode_t **map_nodes, int *numnodes, cplane_t *map_planes, const byte *cmod_base, const lump_t *l) @@ -1771,96 +1699,6 @@ CMod_LoadQLeafBrushes(const char *name, unsigned int **map_leafbrushes, } } -static void -CMod_LoadRBrushSides(const char *name, cbrushside_t **map_brushsides, int *numbrushsides, - cplane_t *map_planes, int numplanes, mapsurface_t *map_surfaces, int numtexinfo, - const byte *cmod_base, const lump_t *l) -{ - int i; - cbrushside_t *out; - drbrushside_t *in; - int count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - Com_Error(ERR_DROP, "%s: Map %s funny lump size", __func__, name); - } - - count = l->filelen / sizeof(*in); - - /* need to save space for box planes */ - if (count < 1) - { - Com_Error(ERR_DROP, "%s: Map %s with no planes", __func__, name); - } - - out = *map_brushsides = Hunk_Alloc((count + EXTRA_LUMP_BRUSHSIDES) * sizeof(*out)); - *numbrushsides = count; - - for (i = 0; i < count; i++, in++, out++) - { - int j, num; - - num = LittleShort(in->planenum); - j = LittleShort(in->texinfo); - - if (j >= numtexinfo || num > numplanes) - { - Com_Error(ERR_DROP, "%s: Bad brushside texinfo", __func__); - } - - out->plane = map_planes + num; - out->surface = (j >= 0) ? &map_surfaces[j] : &nullsurface; - } -} - -static void -CMod_LoadBrushSides(const char *name, cbrushside_t **map_brushsides, int *numbrushsides, - cplane_t *map_planes, int numplanes, mapsurface_t *map_surfaces, int numtexinfo, - const byte *cmod_base, const lump_t *l) -{ - int i; - cbrushside_t *out; - dbrushside_t *in; - int count; - - in = (void *)(cmod_base + l->fileofs); - - if (l->filelen % sizeof(*in)) - { - Com_Error(ERR_DROP, "%s: Map %s funny lump size", __func__, name); - } - - count = l->filelen / sizeof(*in); - - /* need to save space for box planes */ - if (count < 1) - { - Com_Error(ERR_DROP, "%s: Map %s with no planes", __func__, name); - } - - out = *map_brushsides = Hunk_Alloc((count + EXTRA_LUMP_BRUSHSIDES) * sizeof(*out)); - *numbrushsides = count; - - for (i = 0; i < count; i++, in++, out++) - { - int j, num; - - num = LittleShort(in->planenum); - j = LittleShort(in->texinfo); - - if (j >= numtexinfo || num > numplanes) - { - Com_Error(ERR_DROP, "%s: Bad brushside texinfo", __func__); - } - - out->plane = map_planes + num; - out->surface = (j >= 0) ? &map_surfaces[j] : &nullsurface; - } -} - static void CMod_LoadQBrushSides(const char *name, cbrushside_t **map_brushsides, int *numbrushsides, cplane_t *map_planes, int numplanes, mapsurface_t *map_surfaces, int numtexinf, @@ -2126,72 +1964,20 @@ CM_LoadCachedMap(const char *name, model_t *mod) /* load into heap */ strcpy(mod->name, name); - if (maptype == map_sin) - { - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_TEXINFO], - sizeof(texrinfo_t), sizeof(mapsurface_t), EXTRA_LUMP_TEXINFO); - } - else - { - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_TEXINFO], - sizeof(texinfo_t), sizeof(mapsurface_t), EXTRA_LUMP_TEXINFO); - } - - 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(cleaf_t), 0); - } - else - { - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_LEAFS], - sizeof(dleaf_t), sizeof(cleaf_t), 0); - } - - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_LEAFBRUSHES], - sizeof(short), sizeof(int), EXTRA_LUMP_LEAFBRUSHES); - } - else - { - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_LEAFS], - sizeof(dqleaf_t), sizeof(cleaf_t), 0); - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_LEAFBRUSHES], - sizeof(int), sizeof(int), EXTRA_LUMP_LEAFBRUSHES); - } - + hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_TEXINFO], + sizeof(texinfo_t), sizeof(mapsurface_t), EXTRA_LUMP_TEXINFO); + hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_LEAFS], + sizeof(dqleaf_t), sizeof(cleaf_t), 0); + hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_LEAFBRUSHES], + sizeof(int), sizeof(int), EXTRA_LUMP_LEAFBRUSHES); hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_PLANES], sizeof(dplane_t), sizeof(cplane_t), EXTRA_LUMP_PLANES); hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHES], sizeof(dbrush_t), sizeof(cbrush_t), EXTRA_LUMP_BRUSHES); - - if ((header.ident == IDBSPHEADER) || - (header.ident == RBSPHEADER)) - { - if (maptype == map_sin) - { - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHSIDES], - sizeof(drbrushside_t), sizeof(cbrushside_t), EXTRA_LUMP_BRUSHSIDES); - } - else - { - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHSIDES], - sizeof(dbrushside_t), sizeof(cbrushside_t), EXTRA_LUMP_BRUSHSIDES); - } - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_NODES], - sizeof(dnode_t), sizeof(cnode_t), EXTRA_LUMP_NODES); - } - else - { - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHSIDES], - sizeof(dqbrushside_t), sizeof(cbrushside_t), EXTRA_LUMP_BRUSHSIDES); - hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_NODES], - sizeof(dqnode_t), sizeof(cnode_t), EXTRA_LUMP_NODES); - } - + hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHSIDES], + sizeof(dqbrushside_t), sizeof(cbrushside_t), EXTRA_LUMP_BRUSHSIDES); + hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_NODES], + sizeof(dqnode_t), sizeof(cnode_t), EXTRA_LUMP_NODES); hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_AREAS], sizeof(darea_t), sizeof(carea_t), 0); hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_AREAPORTALS], @@ -2205,16 +1991,8 @@ CM_LoadCachedMap(const char *name, model_t *mod) mod->extradata = Hunk_Begin(hunkSize); - if (maptype == map_sin) - { - CMod_LoadRSurfaces(mod->name, &mod->map_surfaces, &mod->numtexinfo, - cmod_base, &header.lumps[LUMP_TEXINFO], maptype); - } - else - { - CMod_LoadSurfaces(mod->name, &mod->map_surfaces, &mod->numtexinfo, - cmod_base, &header.lumps[LUMP_TEXINFO], maptype); - } + CMod_LoadSurfaces(mod->name, &mod->map_surfaces, &mod->numtexinfo, + cmod_base, &header.lumps[LUMP_TEXINFO], maptype); if ((header.ident == IDBSPHEADER) || (header.ident == RBSPHEADER)) @@ -2240,50 +2018,17 @@ CM_LoadCachedMap(const char *name, model_t *mod) CMod_LoadQLeafBrushes(mod->name, &mod->map_leafbrushes, &mod->numleafbrushes, cmod_base, &header.lumps[LUMP_LEAFBRUSHES]); } - Mod_LoadPlanes(mod->name, &mod->map_planes, &mod->numplanes, cmod_base, &header.lumps[LUMP_PLANES]); CMod_LoadBrushes(mod->name, &mod->map_brushes, &mod->numbrushes, cmod_base, &header.lumps[LUMP_BRUSHES]); - - if ((header.ident == IDBSPHEADER) || - (header.ident == RBSPHEADER)) - { - if (maptype == map_sin) - { - CMod_LoadRBrushSides(mod->name, &mod->map_brushsides, &mod->numbrushsides, - mod->map_planes, mod->numplanes, mod->map_surfaces, mod->numtexinfo, - cmod_base, &header.lumps[LUMP_BRUSHSIDES]); - } - else - { - CMod_LoadBrushSides(mod->name, &mod->map_brushsides, &mod->numbrushsides, - mod->map_planes, mod->numplanes, mod->map_surfaces, mod->numtexinfo, - cmod_base, &header.lumps[LUMP_BRUSHSIDES]); - } - } - else - { - CMod_LoadQBrushSides(mod->name, &mod->map_brushsides, &mod->numbrushsides, - mod->map_planes, mod->numplanes, mod->map_surfaces, mod->numtexinfo, - cmod_base, &header.lumps[LUMP_BRUSHSIDES]); - } - + CMod_LoadQBrushSides(mod->name, &mod->map_brushsides, &mod->numbrushsides, + mod->map_planes, mod->numplanes, mod->map_surfaces, mod->numtexinfo, + cmod_base, &header.lumps[LUMP_BRUSHSIDES]); CMod_LoadSubmodels(mod->name, mod->map_cmodels, &mod->numcmodels, cmod_base, &header.lumps[LUMP_MODELS]); - - if ((header.ident == IDBSPHEADER) || - (header.ident == RBSPHEADER)) - { - CMod_LoadNodes(mod->name, &mod->map_nodes, &mod->numnodes, - mod->map_planes, cmod_base, &header.lumps[LUMP_NODES]); - } - else - { - CMod_LoadQNodes(mod->name, &mod->map_nodes, &mod->numnodes, - mod->map_planes, cmod_base, &header.lumps[LUMP_NODES]); - } - + CMod_LoadQNodes(mod->name, &mod->map_nodes, &mod->numnodes, + mod->map_planes, cmod_base, &header.lumps[LUMP_NODES]); CMod_LoadAreas(mod->name, &mod->map_areas, &mod->numareas, cmod_base, &header.lumps[LUMP_AREAS]); CMod_LoadAreaPortals(mod->name, &mod->map_areaportals, &mod->portalopen, &mod->numareaportals,