qbsp: experimental func_illusionary_visblocker

This commit is contained in:
Eric Wasylishen 2017-10-24 22:17:10 -07:00
parent abf2a3665b
commit 2ea0076160
6 changed files with 29 additions and 2 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -55,6 +55,9 @@ RemapContentsForExport(int content)
*/
return CONTENTS_SOLID;
}
if (content == CONTENTS_ILLUSIONARY_VISBLOCKER) {
return CONTENTS_EMPTY;
}
return content;
}