mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Add optional output parameter to getwalldist(), to return the coordinates of the closest point on the wall
git-svn-id: https://svn.eduke32.com/eduke32@7600 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0dcceb9147
commit
a89c260592
2 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue