qbsp: fix func_illusionary_visblocker behaviour

- support liquid brushes (they are converted to mist - so empty contents for Q1)
- force _mirrorinside 1

Fixes #441
This commit is contained in:
Eric Wasylishen 2024-11-20 20:19:34 -07:00
parent 9f4cfb0c3d
commit 9d6ce6d83c
3 changed files with 14 additions and 12 deletions

View File

@ -1493,10 +1493,12 @@ static contentflags_t Brush_GetContents(const mapentity_t &entity, const mapbrus
}
if (string_iequals(entity.epairs.get("classname"), "func_illusionary_visblocker")) {
// unset solid + detail, set mist
// - unset existing visible contents + detail
// - set mist, mirrorinside, mirrorinside set
// note this overrides the logic in face_get_contents() that normally forces mist to be detail
base_contents = contentflags_t::make(
(base_contents.flags & ~(EWT_VISCONTENTS_SOLID | EWT_CFLAG_DETAIL)) | EWT_VISCONTENTS_MIST);
(base_contents.flags & ~(EWT_ALL_VISIBLE_CONTENTS | EWT_CFLAG_DETAIL))
| (EWT_VISCONTENTS_MIST | EWT_CFLAG_MIRROR_INSIDE | EWT_CFLAG_MIRROR_INSIDE_SET));
}
// non-Q2: -transwater implies liquids are detail

View File

@ -92,14 +92,13 @@
// entity 3
{
"classname" "func_illusionary_visblocker"
"_mirrorinside" "1"
// brush 0
{
( -64 80 16 ) ( -64 81 16 ) ( -64 80 17 ) {trigger 0 0 0 1 1
( -64 -16 16 ) ( -64 -16 17 ) ( -63 -16 16 ) {trigger 0 0 0 1 1
( -64 80 16 ) ( -63 80 16 ) ( -64 81 16 ) {trigger 0 0 0 1 1
( 176 128 240 ) ( 176 129 240 ) ( 177 128 240 ) {trigger 0 0 0 1 1
( 176 16 32 ) ( 177 16 32 ) ( 176 16 33 ) {trigger 0 0 0 1 1
( 176 128 32 ) ( 176 128 33 ) ( 176 129 32 ) {trigger 0 0 0 1 1
( -64 80 16 ) ( -64 81 16 ) ( -64 80 17 ) *zwater1 0 0 0 1 1
( -64 -16 16 ) ( -64 -16 17 ) ( -63 -16 16 ) *zwater1 0 0 0 1 1
( -64 80 16 ) ( -63 80 16 ) ( -64 81 16 ) *zwater1 0 0 0 1 1
( 176 128 240 ) ( 176 129 240 ) ( 177 128 240 ) *zwater1 0 0 0 1 1
( 176 16 32 ) ( 177 16 32 ) ( 176 16 33 ) *zwater1 0 0 0 1 1
( 176 128 32 ) ( 176 128 33 ) ( 176 129 32 ) *zwater1 0 0 0 1 1
}
}

View File

@ -106,9 +106,9 @@ TEST(vis, q1FuncIllusionaryVisblocker)
{
auto [bsp, bspx, lit] = QbspVisLight_Q1("q1_func_illusionary_visblocker.map", {}, runvis_t::yes);
// should export a face
auto *face = BSP_FindFaceAtPoint(&bsp, &bsp.dmodels[0], {80, 16, 96}, {0, 1, 0});
ASSERT_TRUE(face);
// func_illusionary_visblocker is 2 sided by default
EXPECT_TRUE(BSP_FindFaceAtPoint(&bsp, &bsp.dmodels[0], {80, 16, 96}, {0, 1, 0}));
EXPECT_TRUE(BSP_FindFaceAtPoint(&bsp, &bsp.dmodels[0], {80, 16, 96}, {0, -1, 0}));
const auto vis = DecompressAllVis(&bsp);
@ -126,6 +126,7 @@ TEST(vis, q1FuncIllusionaryVisblocker)
EXPECT_EQ(item_enviro_leaf->contents, CONTENTS_EMPTY);
EXPECT_EQ(player_start_leaf->contents, CONTENTS_EMPTY);
// water brush inside func_illusionary_visblocker gets converted to empty
EXPECT_EQ(in_visblocker_leaf->contents, CONTENTS_EMPTY);
// check visdata