diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 31c97eea..69c927e0 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -117,6 +117,7 @@ #define CFLAGS_WAS_ILLUSIONARY (1U << 1) /* was illusionary, got changed to something else */ #define CFLAGS_DETAIL_WALL (1U << 2) /* don't clip world for func_detail_wall entities */ #define CFLAGS_BMODEL_MIRROR_INSIDE (1U << 3) /* set "_mirrorinside" "1" on a bmodel to mirror faces for when the player is inside. */ +#define CFLAGS_NO_CLIPPING_SAME_TYPE (1U << 4) /* Don't clip the same content type. mostly intended for CONTENTS_DETAIL_ILLUSIONARY */ // Texture flags. Only TEX_SPECIAL is written to the .bsp. // Extended flags are written to a .texinfo file and read by the light tool diff --git a/qbsp/brush.cc b/qbsp/brush.cc index 4f94884f..69ad9470 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -1122,6 +1122,11 @@ Brush_LoadEntity(mapentity_t *dst, const mapentity_t *src, const int hullnum) if (atoi(ValueForKey(src, "_mirrorinside"))) { cflags |= CFLAGS_BMODEL_MIRROR_INSIDE; } + + /* _noclipfaces */ + if (atoi(ValueForKey(src, "_noclipfaces"))) { + cflags |= CFLAGS_NO_CLIPPING_SAME_TYPE; + } const bool func_illusionary_visblocker = (0 == Q_strcasecmp(classname, "func_illusionary_visblocker")); diff --git a/qbsp/csg4.cc b/qbsp/csg4.cc index 8e73df37..2bc85d6e 100644 --- a/qbsp/csg4.cc +++ b/qbsp/csg4.cc @@ -624,6 +624,12 @@ CSGFaces(const mapentity_t *entity) /* CONTENTS_DETAIL_FENCE never clips anything but itself */ continue; } + + if (clipbrush->contents == brush->contents + && (clipbrush->cflags & CFLAGS_NO_CLIPPING_SAME_TYPE)) { + /* _noclipfaces key */ + continue; + } /* check bounding box first */ for (i = 0; i < 3; i++) {