From 20f5d73a3c5fdc89a042338b14461316337591ad Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 15 Aug 2022 04:53:36 -0400 Subject: [PATCH] always use inside filling for auto allow details in hulls use std::optional for an optional-esque value --- include/qbsp/map.hh | 2 +- qbsp/brush.cc | 16 +++++++--------- qbsp/outside.cc | 2 +- qbsp/qbsp.cc | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/qbsp/map.hh b/include/qbsp/map.hh index 48d6c0b9..cfe622d7 100644 --- a/include/qbsp/map.hh +++ b/include/qbsp/map.hh @@ -124,7 +124,7 @@ public: aabb3d bounds; - int firstoutputfacenumber = -1; + std::optional firstoutputfacenumber = std::nullopt; std::optional outputmodelnumber = std::nullopt; int32_t areaportalnum = 0; diff --git a/qbsp/brush.cc b/qbsp/brush.cc index 604847ee..bafc954f 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -466,15 +466,13 @@ static void Brush_LoadEntity(mapentity_t *dst, mapentity_t *src, const int hulln if ((qbsp_options.omitdetail.value() || qbsp_options.omitdetailfence.value()) && detail_fence) continue; - /* turn solid brushes into detail, if we're in hull0 */ - if (hullnum <= 0 && contents.is_solid(qbsp_options.target_game)) { - if (detail_illusionary) { - contents = qbsp_options.target_game->create_detail_illusionary_contents(contents); - } else if (detail_fence) { - contents = qbsp_options.target_game->create_detail_fence_contents(contents); - } else if (detail) { - contents = qbsp_options.target_game->create_detail_solid_contents(contents); - } + /* turn solid brushes into detail */ + if (detail_illusionary) { + contents = qbsp_options.target_game->create_detail_illusionary_contents(contents); + } else if (detail_fence) { + contents = qbsp_options.target_game->create_detail_fence_contents(contents); + } else if (detail) { + contents = qbsp_options.target_game->create_detail_solid_contents(contents); } /* func_detail_illusionary don't exist in the collision hull diff --git a/qbsp/outside.cc b/qbsp/outside.cc index 2cf92b2f..6bc62030 100644 --- a/qbsp/outside.cc +++ b/qbsp/outside.cc @@ -614,7 +614,7 @@ bool FillOutside(mapentity_t *entity, tree_t *tree, const int hullnum, bspbrush_ settings::filltype_t filltype = qbsp_options.filltype.value(); if (filltype == settings::filltype_t::AUTO) { - filltype = hullnum > 0 ? settings::filltype_t::OUTSIDE : settings::filltype_t::INSIDE; + filltype = settings::filltype_t::INSIDE; } if (filltype == settings::filltype_t::INSIDE) { diff --git a/qbsp/qbsp.cc b/qbsp/qbsp.cc index 96cad13e..12858191 100644 --- a/qbsp/qbsp.cc +++ b/qbsp/qbsp.cc @@ -562,7 +562,7 @@ static void ProcessEntity(mapentity_t *entity, const int hullnum) ExportObj_Marksurfaces("pre_makefaceedges_marksurfaces", tree->headnode); } - Q_assert(entity->firstoutputfacenumber == -1); + Q_assert(!entity->firstoutputfacenumber.has_value()); entity->firstoutputfacenumber = MakeFaceEdges(tree->headnode); @@ -570,7 +570,7 @@ static void ProcessEntity(mapentity_t *entity, const int hullnum) ExportBrushList(entity, tree->headnode); } - ExportDrawNodes(entity, tree->headnode, entity->firstoutputfacenumber); + ExportDrawNodes(entity, tree->headnode, entity->firstoutputfacenumber.value()); } }