diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 76e5592d..4b85f751 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -110,6 +110,7 @@ #define CONTENTS_DETAIL -10 /* compiler internal use only */ #define CONTENTS_DETAIL_ILLUSIONARY -11 /* compiler internal use only */ #define CONTENTS_DETAIL_FENCE -12 /* compiler internal use only */ +#define CONTENTS_ILLUSIONARY_VISBLOCKER -13 // Special contents flags for the compiler only #define CFLAGS_STRUCTURAL_COVERED_BY_DETAIL (1U << 0) diff --git a/qbsp/brush.cc b/qbsp/brush.cc index 06fbf2d9..d22ea921 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -1122,11 +1122,18 @@ Brush_LoadEntity(mapentity_t *dst, const mapentity_t *src, const int hullnum) if (atoi(ValueForKey(src, "_mirrorinside"))) { cflags |= CFLAGS_BMODEL_MIRROR_INSIDE; } - + + const bool func_illusionary_visblocker = + (0 == Q_strcasecmp(classname, "func_illusionary_visblocker")); + for (i = 0; i < src->nummapbrushes; i++, mapbrush++) { mapbrush = &src->mapbrush(i); contents = Brush_GetContents(mapbrush); + /* FIXME: move into Brush_GetContents? */ + if (func_illusionary_visblocker) + contents = CONTENTS_ILLUSIONARY_VISBLOCKER; + /* "origin" brushes always discarded */ if (contents == CONTENTS_ORIGIN) continue; diff --git a/qbsp/map.cc b/qbsp/map.cc index 3772316c..0070b6eb 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -1730,6 +1730,8 @@ IsWorldBrushEntity(const mapentity_t *entity) return true; if (!Q_strcasecmp(classname, "func_detail_fence")) return true; + if (!Q_strcasecmp(classname, "func_illusionary_visblocker")) + return true; return false; } diff --git a/qbsp/portals.cc b/qbsp/portals.cc index ec85c9e7..50a2c0ce 100644 --- a/qbsp/portals.cc +++ b/qbsp/portals.cc @@ -97,6 +97,10 @@ PortalThru(const portal_t *p) if (contents0 == CONTENTS_SOLID || contents1 == CONTENTS_SOLID) return false; + /* Can't see through func_illisionary_visblocker */ + if (contents0 == CONTENTS_ILLUSIONARY_VISBLOCKER || contents1 == CONTENTS_ILLUSIONARY_VISBLOCKER) + return false; + /* If contents values are the same and not solid, can see through */ if (contents0 == contents1) return true; diff --git a/qbsp/solidbsp.cc b/qbsp/solidbsp.cc index 82b8038d..2f3f3ddc 100644 --- a/qbsp/solidbsp.cc +++ b/qbsp/solidbsp.cc @@ -28,6 +28,7 @@ int splitnodes; static int leaffaces; static int nodefaces; static int c_solid, c_empty, c_water, c_detail, c_detail_illusionary, c_detail_fence; +static int c_illusionary_visblocker; static bool usemidsplit; //============================================================================ @@ -746,6 +747,9 @@ GetContentsName( int Contents ) { case CONTENTS_DETAIL_FENCE: return "DetailFence"; + case CONTENTS_ILLUSIONARY_VISBLOCKER: + return "IllusionaryVisblocker"; + default: return "Error"; } @@ -767,7 +771,8 @@ int Contents_Priority(int contents) case CONTENTS_WATER: return 2; case CONTENTS_SLIME: return 2; case CONTENTS_LAVA: return 2; - + case CONTENTS_ILLUSIONARY_VISBLOCKER: return 2; + case CONTENTS_EMPTY: return 1; case 0: return 0; @@ -846,6 +851,9 @@ LinkConvexFaces(surface_t *planelist, node_t *leafnode) case CONTENTS_DETAIL_FENCE: c_detail_fence++; break; + case CONTENTS_ILLUSIONARY_VISBLOCKER: + c_illusionary_visblocker++; + break; default: Error("Bad contents in face (%s)", __func__); } @@ -1035,6 +1043,7 @@ SolidBSP(const mapentity_t *entity, surface_t *surfhead, bool midsplit) c_detail = 0; c_detail_illusionary = 0; c_detail_fence = 0; + c_illusionary_visblocker = 0; PartitionSurfaces(surfhead, headnode); @@ -1045,6 +1054,7 @@ SolidBSP(const mapentity_t *entity, surface_t *surfhead, bool midsplit) Message(msgStat, "%8d detail leafs", c_detail); Message(msgStat, "%8d detail illusionary leafs", c_detail_illusionary); Message(msgStat, "%8d detail fence leafs", c_detail_fence); + Message(msgStat, "%8d illusionary visblocker leafs", c_illusionary_visblocker); Message(msgStat, "%8d leaffaces", leaffaces); Message(msgStat, "%8d nodefaces", nodefaces); diff --git a/qbsp/writebsp.cc b/qbsp/writebsp.cc index 153b57f1..801b3fde 100644 --- a/qbsp/writebsp.cc +++ b/qbsp/writebsp.cc @@ -55,6 +55,9 @@ RemapContentsForExport(int content) */ return CONTENTS_SOLID; } + if (content == CONTENTS_ILLUSIONARY_VISBLOCKER) { + return CONTENTS_EMPTY; + } return content; }