diff --git a/qbsp/brush.cc b/qbsp/brush.cc index f5f383db..75cc2fe5 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -732,6 +732,8 @@ static void Brush_LoadEntity(mapentity_t &dst, mapentity_t &src, hull_index_t hu continue; if ((qbsp_options.omitdetail.value() || qbsp_options.omitdetailwall.value()) && detail_wall) continue; + if (qbsp_options.omitdetail.value() && contents.is_any_detail(qbsp_options.target_game)) + continue; /* turn solid brushes into detail, if we're in hull0 */ if (hullnum <= 0 && contents.is_solid(qbsp_options.target_game)) { diff --git a/tests/test_qbsp_q2.cc b/tests/test_qbsp_q2.cc index 4949f2a3..6ff1e397 100644 --- a/tests/test_qbsp_q2.cc +++ b/tests/test_qbsp_q2.cc @@ -99,6 +99,21 @@ TEST_CASE("detail" * doctest::test_suite("testmaps_q2")) { CHECK(prt->portalleafs == 4); } +TEST_CASE("q2 detail with -omitdetail" * doctest::test_suite("testmaps_q2")) { + const auto [bsp, bspx, prt] = LoadTestmapQ2("qbsp_q2_detail.map", {"-omitdetail"}); + + CHECK(GAME_QUAKE_II == bsp.loadversion->game->id); + + const qvec3d inside_button{246, 436, 98}; + const qvec3d above_button{246, 436, 120}; + + auto *inside_button_leaf = BSP_FindLeafAtPoint(&bsp, &bsp.dmodels[0], inside_button); + CHECK(Q2_CONTENTS_EMPTY == inside_button_leaf->contents); + + auto *above_button_leaf = BSP_FindLeafAtPoint(&bsp, &bsp.dmodels[0], above_button); + CHECK(inside_button_leaf == above_button_leaf); +} + TEST_CASE("playerclip" * doctest::test_suite("testmaps_q2")) { const auto [bsp, bspx, prt] = LoadTestmapQ2("qbsp_q2_playerclip.map");