qbsp: remove mapentity_t::lumps

This commit is contained in:
Eric Wasylishen 2021-08-23 23:25:31 -06:00
parent c55112b47f
commit e0710859fb
3 changed files with 3 additions and 50 deletions

View File

@ -101,7 +101,6 @@ public:
vec3_t mins, maxs;
brush_t *brushes; /* NULL terminated list */
int numbrushes;
struct lumpdata lumps[BSPX_LUMPS];
int firstoutputfacenumber;
int outputmodelnumber;
@ -125,7 +124,6 @@ public:
VectorSet(origin,0,0,0);
VectorSet(mins,0,0,0);
VectorSet(maxs,0,0,0);
memset(lumps, 0, sizeof(lumps));
}
};

View File

@ -76,52 +76,8 @@ AddLumpFromBuffer(FILE *f, int Type, void* src, size_t srcbytes)
}
}
static void
GenLump(const char *bspxlump, int Type, size_t sz)
{
int cLen = 0;
int i;
const struct lumpdata *entities;
const mapentity_t *entity;
char *out;
for (i = 0; i < map.numentities(); i++) {
entity = &map.entities.at(i);
entities = &entity->lumps[Type];
cLen += entities->count*sz;
}
if (!cLen)
return;
out = (char *)malloc(cLen);
cLen = 0;
for (i = 0; i < map.numentities(); i++) {
entity = &map.entities.at(i);
entities = &entity->lumps[Type];
memcpy(out+cLen, entities->data, entities->count*sz);
cLen += entities->count*sz;
}
BSPX_AddLump(bspxlump, out, cLen);
}
void BSPX_AddLump(const char *xname, const void *xdata, size_t xsize)
{
bspxentry_t *e;
for (e = bspxentries; e; e = e->next)
{
if (!strcmp(e->lumpname, xname))
break;
}
if (!e)
{
e = (bspxentry_t *)malloc(sizeof(*e));
memset(e, 0, sizeof(*e));
strncpy(e->lumpname, xname, sizeof(e->lumpname));
e->next = bspxentries;
bspxentries = e;
}
e->lumpdata = xdata;
e->lumpsize = xsize;
}
/*
@ -165,12 +121,12 @@ WriteBSPFile(void)
AddLumpFromBuffer(f, LUMP_LIGHTING, nullptr, 0);
AddLumpFromBuffer(f, LUMP_VISIBILITY, nullptr, 0);
AddLumpFromBuffer(f, LUMP_ENTITIES, map.exported_entities.data(), map.exported_entities.size() + 1); // +1 to write the terminating null (safe in C++11)
AddLumpFromBuffer(f, LUMP_TEXTURES, map.exported_texdata.data(), map.exported_texdata.size());
GenLump("LMSHIFT", BSPX_LMSHIFT, 1);
AddLumpFromBuffer(f, LUMP_TEXTURES, map.exported_texdata.data(), map.exported_texdata.size());
// TODO: pass bspx lumps to generic bsp code so they are written
//GenLump("LMSHIFT", BSPX_LMSHIFT, 1);
fseek(f, 0, SEEK_SET);
ret = fwrite(header, sizeof(dheader_t), 1, f);
if (ret != 1)

View File

@ -491,7 +491,6 @@ int
MakeFaceEdges(mapentity_t *entity, node_t *headnode)
{
int i, firstface;
struct lumpdata *lmshifts = &entity->lumps[BSPX_LMSHIFT];
Message(msgProgress, "MakeFaceEdges");