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