From d9bb0be32e5e0633341f736b032e1c3ab98b8ab1 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 17 Oct 2016 17:37:28 -0600 Subject: [PATCH] light: move Face_Contents to common --- common/bsputils.cc | 22 ++++++++++++++++++++++ include/common/bsputils.h | 4 +++- light/trace.cc | 17 ----------------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/common/bsputils.cc b/common/bsputils.cc index 202c121d..8c9d2e03 100644 --- a/common/bsputils.cc +++ b/common/bsputils.cc @@ -104,3 +104,25 @@ const float *GetSurfaceVertexPoint(const bsp2_t *bsp, const bsp2_dface_t *f, int { return bsp->dvertexes[Face_VertexAtIndex(bsp, f, v)].point; } + +int +TextureName_Contents(const char *texname) +{ + if (!Q_strncasecmp(texname, "sky", 3)) + return CONTENTS_SKY; + else if (!Q_strncasecmp(texname, "*lava", 5)) + return CONTENTS_LAVA; + else if (!Q_strncasecmp(texname, "*slime", 6)) + return CONTENTS_SLIME; + else if (texname[0] == '*') + return CONTENTS_WATER; + + return CONTENTS_SOLID; +} + +int +Face_Contents(const bsp2_t *bsp, const bsp2_dface_t *face) +{ + const char *texname = Face_TextureName(bsp, face); + return TextureName_Contents(texname); +} diff --git a/include/common/bsputils.h b/include/common/bsputils.h index f560243e..4df7949d 100644 --- a/include/common/bsputils.h +++ b/include/common/bsputils.h @@ -34,7 +34,9 @@ plane_t Face_Plane(const bsp2_t *bsp, const bsp2_dface_t *f); const miptex_t *Face_Miptex(const bsp2_t *bsp, const bsp2_dface_t *face); const char *Face_TextureName(const bsp2_t *bsp, const bsp2_dface_t *face); const float *GetSurfaceVertexPoint(const bsp2_t *bsp, const bsp2_dface_t *f, int v); - +int TextureName_Contents(const char *texname); +int Face_Contents(const bsp2_t *bsp, const bsp2_dface_t *face); + #ifdef __cplusplus } #endif diff --git a/light/trace.cc b/light/trace.cc index 6d0d37ec..2fd90a47 100644 --- a/light/trace.cc +++ b/light/trace.cc @@ -197,23 +197,6 @@ static inline bool SphereCullPoint(const faceinfo_t *info, const vec3_t point) return deltaLengthSquared > info->radiusSquared; } -static int -Face_Contents(const bsp2_t *bsp, const bsp2_dface_t *face) -{ - const char *texname = Face_TextureName(bsp, face); - - if (!Q_strncasecmp(texname, "sky", 3)) - return CONTENTS_SKY; - else if (!Q_strncasecmp(texname, "*lava", 5)) - return CONTENTS_LAVA; - else if (!Q_strncasecmp(texname, "*slime", 6)) - return CONTENTS_SLIME; - else if (texname[0] == '*') - return CONTENTS_WATER; - - return CONTENTS_SOLID; -} - void Face_MakeInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face, plane_t *out) {