diff --git a/qbsp/qbsp.cc b/qbsp/qbsp.cc index c14f71c4..6f66d0d5 100644 --- a/qbsp/qbsp.cc +++ b/qbsp/qbsp.cc @@ -570,12 +570,6 @@ static void ProcessEntity(mapentity_t *entity, const int hullnum) MakeVisibleFaces(entity, nodes); - // fixme-brushbsp: only here for testing, was inside FillOutside if() - MergeAll(nodes); - - // needs to come after any face creation - MakeMarkFaces(entity, nodes); - // build all the portals in the bsp tree // some portals are solid polygons, and some are paths to other leafs if (entity == pWorldEnt()) { @@ -624,6 +618,9 @@ static void ProcessEntity(mapentity_t *entity, const int hullnum) // convert detail leafs to solid (in case we didn't make the call above) DetailToSolid(nodes); + // needs to come after any face creation + MakeMarkFaces(entity, nodes); + if (options.fObjExport && entity == pWorldEnt()) { ExportObj_Nodes("pre_makefaceedges_plane_faces", nodes); ExportObj_Marksurfaces("pre_makefaceedges_marksurfaces", nodes); diff --git a/qbsp/solidbsp.cc b/qbsp/solidbsp.cc index e1e6ffda..ecfc20d4 100644 --- a/qbsp/solidbsp.cc +++ b/qbsp/solidbsp.cc @@ -45,16 +45,17 @@ static int mapbrushes; void ConvertNodeToLeaf(node_t *node, const contentflags_t &contents) { - // backup the mins/maxs - aabb3d bounds = node->bounds; - - // zero it - memset(node, 0, sizeof(*node)); - - // restore relevant fields - node->bounds = bounds; - node->planenum = PLANENUM_LEAF; + + for (int i = 0; i < 2; ++i) { + delete node->children[i]; + node->children[i] = nullptr; + } + for (auto *face : node->facelist) { + delete face; + } + node->facelist = {}; + node->contents = contents; Q_assert(node->markfaces.empty());