From d9e16a943a8e8aa3e032c3234d6fd3628a1e2a43 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 7 May 2023 23:56:30 -0600 Subject: [PATCH] qbsp: add -noextendedsurfflags flag to suppress .texinfo writing (for testing/debugging) --- include/qbsp/qbsp.hh | 1 + qbsp/qbsp.cc | 1 + qbsp/writebsp.cc | 2 +- testmaps/q2_minlight_inherited.map | 30 +++++++++++++++++++++++++++++- tests/test_ltface.cc | 30 ++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 2 deletions(-) diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 20faf329..8cabd6e0 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -209,6 +209,7 @@ public: setting_bool forceprt1; setting_tjunc tjunc; setting_bool objexport; + setting_bool noextendedsurfflags; setting_bool wrbrushes; setting_redirect wrbrushesonly; setting_bool bmodelcontents; diff --git a/qbsp/qbsp.cc b/qbsp/qbsp.cc index 32d994e4..f98674c1 100644 --- a/qbsp/qbsp.cc +++ b/qbsp/qbsp.cc @@ -532,6 +532,7 @@ qbsp_settings::qbsp_settings() &debugging_group, "T-junction fix level"}, objexport{ this, "objexport", false, &debugging_group, "export the map file as .OBJ models during various CSG phases"}, + noextendedsurfflags{this, "noextendedsurfflags", false, &debugging_group, "suppress writing a .texinfo file"}, wrbrushes{this, {"wrbrushes", "bspx"}, false, &common_format_group, "includes a list of brushes for brush-based collision"}, wrbrushesonly{this, {"wrbrushesonly", "bspxonly"}, {&wrbrushes, &noclip}, &common_format_group, diff --git a/qbsp/writebsp.cc b/qbsp/writebsp.cc index dbd1d763..b1a93919 100644 --- a/qbsp/writebsp.cc +++ b/qbsp/writebsp.cc @@ -338,7 +338,7 @@ static void WriteExtendedTexinfoFlags(void) } } - if (!needwrite) + if (!needwrite || qbsp_options.noextendedsurfflags.value()) return; // sort by output texinfo number diff --git a/testmaps/q2_minlight_inherited.map b/testmaps/q2_minlight_inherited.map index 9e228f92..d1861b47 100644 --- a/testmaps/q2_minlight_inherited.map +++ b/testmaps/q2_minlight_inherited.map @@ -65,7 +65,7 @@ // entity 1 { "classname" "info_player_start" -"origin" "272 -104 24" +"origin" "272 -104 72" "angle" "90" } // entity 2 @@ -94,3 +94,31 @@ ( 272 144 16 ) ( 272 144 17 ) ( 272 145 16 ) e1u1/twall2_1 -16 16 0 1 1 } } +// entity 4 +{ +"classname" "func_wall" +"_minlight" "1" +// brush 0 +{ +( 144 -160 0 ) ( 144 -159 0 ) ( 144 -160 1 ) e1u1/twall2_1 16 16 0 1 1 +( 32 -160 0 ) ( 32 -160 1 ) ( 33 -160 0 ) e1u1/twall2_1 16 16 0 1 1 +( 32 -160 0 ) ( 33 -160 0 ) ( 32 -159 0 ) e1u1/twall2_1 16 -64 0 1 1 +( 272 -16 16 ) ( 272 -15 16 ) ( 273 -16 16 ) e1u1/twall2_1 16 -64 0 1 1 +( 272 -16 16 ) ( 273 -16 16 ) ( 272 -16 17 ) e1u1/twall2_1 16 16 0 1 1 +( 272 -16 16 ) ( 272 -16 17 ) ( 272 -15 16 ) e1u1/twall2_1 16 16 0 1 1 +} +} +// entity 5 +{ +"classname" "func_group" +"_minlight" "1" +// brush 0 +{ +( 288 -160 0 ) ( 288 -159 0 ) ( 288 -160 1 ) e1u1/twall2_1 16 16 0 1 1 +( 176 -160 0 ) ( 176 -160 1 ) ( 177 -160 0 ) e1u1/twall2_1 0 16 0 1 1 +( 176 -160 0 ) ( 177 -160 0 ) ( 176 -159 0 ) e1u1/twall2_1 0 -64 0 1 1 +( 416 -16 16 ) ( 416 -15 16 ) ( 417 -16 16 ) e1u1/twall2_1 0 -64 0 1 1 +( 416 -16 16 ) ( 417 -16 16 ) ( 416 -16 17 ) e1u1/twall2_1 0 16 0 1 1 +( 416 -16 16 ) ( 416 -16 17 ) ( 416 -15 16 ) e1u1/twall2_1 16 16 0 1 1 +} +} diff --git a/tests/test_ltface.cc b/tests/test_ltface.cc index bcc38827..15c0182d 100644 --- a/tests/test_ltface.cc +++ b/tests/test_ltface.cc @@ -687,6 +687,11 @@ TEST_CASE("q2_minlight_inherited") { auto [bsp, bspx] = QbspVisLight_Q2("q2_minlight_inherited.map", {}); + { + INFO("check worldspawn minlight"); + CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[0], {64, 64, 64}, {456, 196, 0}, {0, 0, 1}, nullptr, &bspx); + } + { INFO("check that func_group inherits worldspawn minlight"); CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[0], {64, 64, 64}, {360, 72, 16}, {0, 0, 1}, nullptr, &bspx); @@ -695,4 +700,29 @@ TEST_CASE("q2_minlight_inherited") INFO("check that func_wall inherits worldspawn minlight"); CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[1], {64, 64, 64}, {208, 72, 16}, {0, 0, 1}, nullptr, &bspx); } + + { + INFO("check that func_group can override worldspawn minlight"); + CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[0], {128, 128, 128}, {360, -84, 16}, {0, 0, 1}, nullptr, &bspx); + } + { + INFO("check that func_wall can override worldspawn minlight"); + CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[2], {128, 128, 128}, {208, -84, 16}, {0, 0, 1}, nullptr, &bspx); + } } + +TEST_CASE("q2_minlight_inherited + -noextendedsurfflags") +{ + auto [bsp, bspx] = + QbspVisLight_Common("q2_minlight_inherited.map", {"-q2bsp", "-noextendedsurfflags"}, {}, runvis_t::no); + + { + INFO("check that func_wall inherits worldspawn minlight"); + CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[1], {64, 64, 64}, {208, 72, 16}, {0, 0, 1}, nullptr, &bspx); + } + + { + INFO("check that func_wall can override worldspawn minlight"); + CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[2], {128, 128, 128}, {208, -84, 16}, {0, 0, 1}, nullptr, &bspx); + } +} \ No newline at end of file