Rename clipwalldist() to getwalldist() and move both it and sectoradjacent() to engine.cpp

git-svn-id: https://svn.eduke32.com/eduke32@7586 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-04-18 17:24:05 +00:00 committed by Christoph Oelckers
parent bb517b73e3
commit f9e866d32d
4 changed files with 22 additions and 22 deletions

View file

@ -1166,6 +1166,8 @@ int32_t try_facespr_intersect(uspritetype const * const spr, const vec3_t *refpo
int32_t vx, int32_t vy, int32_t vz,
vec3_t *intp, int32_t strictly_smaller_than_p);
bool sectoradjacent(int sect1, int sect2);
int32_t getwalldist(vec2_t const &p, int const w);
extern const int16_t *chsecptr_onextwall;
int32_t checksectorpointer(int16_t i, int16_t sectnum);

View file

@ -75,8 +75,6 @@ extern int16_t clipsectorlist[MAXCLIPSECTORS];
int clipinsidebox(vec2_t *vect, int wallnum, int walldist);
int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist);
int sectoradjacent(int sect1, int sect2);
extern int32_t clipmoveboxtracenum;
int32_t clipmove(vec3_t *const pos, int16_t *const sectnum, int32_t xvect, int32_t yvect, int32_t const walldist, int32_t const ceildist,

View file

@ -908,25 +908,6 @@ static int32_t get_floorspr_clipyou(int32_t x1, int32_t x2, int32_t x3, int32_t
return clipyou;
}
int sectoradjacent(int sect1, int sect2)
{
if (sector[sect1].wallnum > sector[sect2].wallnum)
swaplong(&sect1, &sect2);
for (int i = 0; i < sector[sect1].wallnum; i++)
if (wall[sector[sect1].wallptr+i].nextsector == sect2)
return 1;
return 0;
}
static inline int32_t clipwalldist(vec2_t const &p, int const w)
{
int32_t closestx, closesty;
yax_getclosestpointonwall(w, &closestx, &closesty);
return klabs(closestx - p.x) + klabs(closesty - p.y);
}
static void clipupdatesector(vec2_t const &p, int16_t * const sectnum, int const walldist)
{
if (inside_p(p.x, p.y, *sectnum))
@ -970,7 +951,7 @@ static void clipupdatesector(vec2_t const &p, int16_t * const sectnum, int const
// check floor curbs here?
for (int j = startwall; j < endwall; j++)
if (wall[j].nextsector >= 0 && clipwalldist(p, j) <= walldist)
if (wall[j].nextsector >= 0 && getwalldist(p, j) <= walldist)
bfirst_search_try(sectlist, sectbitmap, &nsecs, wall[j].nextsector);
}

View file

@ -10977,6 +10977,25 @@ 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));
}
bool sectoradjacent(int sect1, int sect2)
{
if (sector[sect1].wallnum > sector[sect2].wallnum)
swaplong(&sect1, &sect2);
for (int i = 0; i < sector[sect1].wallnum; i++)
if (wall[sector[sect1].wallptr + i].nextsector == sect2)
return 1;
return 0;
}
int32_t getwalldist(vec2_t const &p, int const w)
{
int32_t closestx, closesty;
yax_getclosestpointonwall(w, &closestx, &closesty);
return klabs(closestx - p.x) + klabs(closesty - p.y);
}
//
// updatesector[z]
//