From d4f3e5de659b43b8a18dc1569538243bb606fc7f Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 16 Sep 2017 11:18:04 -0600 Subject: [PATCH] qbsp: partially revert "csg: mirror faces, even for solid, to help leaf content assignment" and turn it into a flag (comit a910dd861ae7ba7ddb7eb38ebf0028729ac178c9) fixes https://github.com/ericwa/tyrutils-ericw/issues/175 (swtest2.map) --- include/qbsp/qbsp.hh | 1 + qbsp/csg4.cc | 4 ++-- qbsp/qbsp.cc | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index c4820576..76e5592d 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -368,6 +368,7 @@ public: bool fForcePRT1; bool fTestExpand; bool fLeakTest; + bool fContentHack; options_t() { memset(this, 0, sizeof(options_t)); diff --git a/qbsp/csg4.cc b/qbsp/csg4.cc index e648339d..d3faf858 100644 --- a/qbsp/csg4.cc +++ b/qbsp/csg4.cc @@ -375,7 +375,7 @@ SaveFacesToPlaneList(face_t *facelist, bool mirror, std::map &pla || face->contents[1] == CONTENTS_DETAIL_ILLUSIONARY || face->contents[1] == CONTENTS_DETAIL_FENCE || (face->cflags[1] & CFLAGS_WAS_ILLUSIONARY) - || face->contents[1] == CONTENTS_SOLID) { + || (options.fContentHack && face->contents[1] == CONTENTS_SOLID)) { // if CFLAGS_BMODEL_MIRROR_INSIDE is set, never change to skip if (!(face->cflags[1] & CFLAGS_BMODEL_MIRROR_INSIDE)) { @@ -678,7 +678,7 @@ CSGFaces(const mapentity_t *entity) * All of the faces left on the outside list are real surface faces * If the brush is non-solid, mirror faces for the inside view */ - mirror = true;//brush->contents != CONTENTS_SOLID); + mirror = options.fContentHack ? true : (brush->contents != CONTENTS_SOLID); SaveFacesToPlaneList(outside, mirror, planefaces); progress++; diff --git a/qbsp/qbsp.cc b/qbsp/qbsp.cc index 28b24d40..48aba7c2 100644 --- a/qbsp/qbsp.cc +++ b/qbsp/qbsp.cc @@ -689,6 +689,7 @@ PrintOptions(void) " -convert Convert a .MAP to a different .MAP format. fmt can be: quake, quake2, valve, bp (brush primitives).\n" " -expand Write hull 1 expanded brushes to expanded.map for debugging\n" " -leaktest Make compilation fail if the map leaks\n" + " -contenthack Hack to fix leaks through solids. Causes missing faces in some cases so disabled by default.\n" " sourcefile .MAP file to process\n" " destfile .BSP file to output\n"); @@ -891,6 +892,8 @@ ParseOptions(char *szOptions) options.fTestExpand = true; } else if (!Q_strcasecmp(szTok, "leaktest")) { options.fLeakTest = true; + } else if (!Q_strcasecmp(szTok, "contenthack")) { + options.fContentHack = true; } else if (!Q_strcasecmp(szTok, "?") || !Q_strcasecmp(szTok, "help")) PrintOptions(); else