From 72a5885437df1973fd26502c0eefadf055c47541 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 9 Aug 2015 12:27:55 -0600 Subject: [PATCH] light: fix crash in "Bad texture axes on face:" error. Print more detailed face info. --- light/ltface.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/light/ltface.c b/light/ltface.c index 809a2b1a..7cfb989f 100644 --- a/light/ltface.c +++ b/light/ltface.c @@ -264,6 +264,9 @@ FaceCentroid(const bsp2_dface_t *face, const bsp2_t *bsp, vec3_t out) VectorScale(poly_centroid, 1.0 / poly_area, out); } +static void +PrintFaceInfo(const bsp2_dface_t *face, const bsp2_t *bsp); + /* * ================ * CreateFaceTransform @@ -292,10 +295,9 @@ CreateFaceTransform(const bsp2_dface_t *face, const bsp2_t *bsp, /* Decompose the matrix. If we can't, texture axes are invalid. */ if (!PMatrix3_LU_Decompose(transform)) { - const vec_t *p = bsp->dvertexes[bsp->dedges[face->firstedge].v[0]].point; - Error("Bad texture axes on face:\n" - " face point at (%s)\n" - " face area = %5.3f\n", VecStr(p), FaceArea(face, bsp)); + logprint("Bad texture axes on face:\n"); + PrintFaceInfo(face, bsp); + Error(""); } } @@ -339,7 +341,6 @@ WorldToTexCoord(const vec3_t world, const texinfo_t *tex, vec_t coord[2]) tex->vecs[i][3]; } -#if 0 /* Debug helper - move elsewhere? */ static void PrintFaceInfo(const bsp2_dface_t *face, const bsp2_t *bsp) @@ -366,7 +367,6 @@ PrintFaceInfo(const bsp2_dface_t *face, const bsp2_t *bsp) point[0], point[1], point[2], edge); } } -#endif /* * ================