diff --git a/qbsp/globals.c b/qbsp/globals.c index 695d90a2..f7192087 100644 --- a/qbsp/globals.c +++ b/qbsp/globals.c @@ -149,4 +149,5 @@ const char *rgszWarnings[cWarnings] = { "Healing degenerate edge (%f) at (%.3f %.3f %.3f)", "No target for rotation entity \"%s\"", "line %d: Face with degenerate QuArK-style texture axes", + "Mixed face contents (%s, %s) near (%.2f %.2f %.2f)" }; diff --git a/qbsp/solidbsp.c b/qbsp/solidbsp.c index c9bf3156..cdab65da 100644 --- a/qbsp/solidbsp.c +++ b/qbsp/solidbsp.c @@ -592,6 +592,37 @@ DivideNodeBounds(node_t *node, plane_t *split) node->children[1]->mins, node->children[1]->maxs); } +/* +================== +GetContentsName +================== +*/ +const char * +GetContentsName( int Contents ) { + switch( Contents ) { + case CONTENTS_EMPTY: + return "Empty"; + + case CONTENTS_SOLID: + return "Solid"; + + case CONTENTS_WATER: + return "Water"; + + case CONTENTS_SLIME: + return "Slime"; + + case CONTENTS_LAVA: + return "Lava"; + + case CONTENTS_SKY: + return "Sky"; + + default: + return "Error"; + } +} + /* ================== LinkConvexFaces @@ -617,9 +648,15 @@ LinkConvexFaces(surface_t *planelist, node_t *leafnode) count++; if (!leafnode->contents) leafnode->contents = f->contents[0]; - else if (leafnode->contents != f->contents[0]) - Error("Mixed face contents in leafnode near (%.2f %.2f %.2f)", - f->w.points[0][0], f->w.points[0][1], f->w.points[0][2]); + else if (leafnode->contents != f->contents[0]) { + const bool OnlyWarn = leafnode->contents == CONTENTS_EMPTY || f->contents[ 0 ] == CONTENTS_EMPTY; + Message(msgWarning, warnMixedFaceContents, + GetContentsName( leafnode->contents ), GetContentsName( f->contents[ 0 ] ), + f->w.points[0][0], f->w.points[0][1], f->w.points[0][2]); + if (!OnlyWarn) { + Error("Last mixed face contents was fatal"); + } + } } } diff --git a/qbsp/warnerr.h b/qbsp/warnerr.h index 16a3077f..1517d81e 100644 --- a/qbsp/warnerr.h +++ b/qbsp/warnerr.h @@ -46,5 +46,6 @@ enum { warnDegenerateEdge, warnNoRotateTarget, warnDegenerateQuArKTX, + warnMixedFaceContents, cWarnings };