diff --git a/source/build/include/build.h b/source/build/include/build.h index 66be2f341..ed4297483 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1169,7 +1169,7 @@ int32_t try_facespr_intersect(uspritetype const * const spr, const vec3_t *refpo vec3_t *intp, int32_t strictly_smaller_than_p); bool sectoradjacent(int sect1, int sect2); -int32_t getwalldist(vec2_t const &p, int const wallnum); +int32_t getwalldist(vec2_t const &p, int const wallnum, vec2_t * const output = nullptr); int32_t getsectordist(vec2_t const &p, int const sectnum); extern const int16_t *chsecptr_onextwall; int32_t checksectorpointer(int16_t i, int16_t sectnum); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 25e7e955a..8a9b1e109 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -10971,10 +10971,11 @@ static inline bool inside_z_p(int32_t const x, int32_t const y, int32_t const z, return (z >= cz && z <= fz && inside_p(x, y, sectnum)); } -int32_t getwalldist(vec2_t const &p, int const wallnum) +int32_t getwalldist(vec2_t const &p, int const wallnum, vec2_t * const output) { vec2_t closest; getclosestpointonwall_internal(p, wallnum, &closest); + if (output) *output = closest; return klabs(closest.x - p.x) + klabs(closest.y - p.y); }