diff --git a/testmaps/q2_noclipfaces_nodraw.map b/testmaps/q2_noclipfaces_nodraw.map new file mode 100644 index 00000000..64600233 --- /dev/null +++ b/testmaps/q2_noclipfaces_nodraw.map @@ -0,0 +1,30 @@ +// Game: Quake 2 +// Format: Quake2 +// entity 0 +{ +"classname" "worldspawn" +"_tb_textures" "textures/e1u1" +// brush 0 +{ +( -64 -64 -32 ) ( -64 -63 -32 ) ( -64 -64 -31 ) e1u1/water1_8 0 -16 0 1 1 32 0 0 +( -64 -64 -32 ) ( -64 -64 -31 ) ( -63 -64 -32 ) e1u1/water1_8 0 -16 0 1 1 32 0 0 +( -64 -64 -32 ) ( -63 -64 -32 ) ( -64 -63 -32 ) e1u1/water1_8 0 0 0 1 1 32 0 0 +( 64 64 0 ) ( 64 65 0 ) ( 65 64 0 ) e1u1/water1_8 0 0 0 1 1 32 0 0 +( 64 64 0 ) ( 65 64 0 ) ( 64 64 1 ) e1u1/water1_8 0 -16 0 1 1 32 0 0 +( 64 64 0 ) ( 64 64 1 ) ( 64 65 0 ) e1u1/water1_8 0 -16 0 1 1 32 0 0 +} +} +// entity 1 +{ +"classname" "func_group" +"_noclipfaces" "1" +// brush 0 +{ +( -112 -64 0 ) ( -112 -63 0 ) ( -112 -64 1 ) e1u1/water8 0 16 0 1 1 32 152 0 +( -64 -112 0 ) ( -64 -112 1 ) ( -63 -112 0 ) e1u1/water8 0 16 0 1 1 32 152 0 +( -64 -64 0 ) ( -63 -64 0 ) ( -64 -63 0 ) e1u1/water8 0 0 0 1 1 32 152 0 +( 64 64 32 ) ( 64 65 32 ) ( 65 64 32 ) e1u1/water8 0 0 0 1 1 32 152 0 +( 64 128 32 ) ( 65 128 32 ) ( 64 128 33 ) e1u1/water8 0 16 0 1 1 32 152 0 +( 176 64 32 ) ( 176 64 33 ) ( 176 65 32 ) e1u1/water8 0 16 0 1 1 32 152 0 +} +} diff --git a/tests/test_qbsp_q2.cc b/tests/test_qbsp_q2.cc index 80c2dea9..f19192f8 100644 --- a/tests/test_qbsp_q2.cc +++ b/tests/test_qbsp_q2.cc @@ -1093,4 +1093,22 @@ TEST_CASE("q2_unknown_contents" * doctest::test_suite("testmaps_q2")) CHECK(texinfo->flags.native == 1024); } +} + +TEST_CASE("q2_noclipfaces_nodraw" * doctest::test_suite("testmaps_q2") * doctest::may_fail()) +{ + INFO("when _noclipfaces has a choice of faces, don't use the nodraw one"); + + const auto [bsp, bspx, prt] = LoadTestmapQ2("q2_noclipfaces_nodraw.map"); + + const qvec3d top_of_water = {0, 0, 0}; + + auto up_faces = BSP_FindFacesAtPoint(&bsp, &bsp.dmodels[0], top_of_water, {0, 0, 1}); + auto down_faces = BSP_FindFacesAtPoint(&bsp, &bsp.dmodels[0], top_of_water, {0, 0, -1}); + + REQUIRE(1 == up_faces.size()); + REQUIRE(1 == down_faces.size()); + + CHECK(Face_TextureNameView(&bsp, up_faces[0]) == "e1u1/water1_8"); + CHECK(Face_TextureNameView(&bsp, down_faces[0]) == "e1u1/water1_8"); } \ No newline at end of file