mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 19:20:46 +00:00
Add new findwallbetweensectors() function and change sectoradjacent() to use it
git-svn-id: https://svn.eduke32.com/eduke32@7608 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a2282def5b
commit
8d85e8d934
2 changed files with 10 additions and 6 deletions
|
@ -1174,7 +1174,8 @@ int32_t try_facespr_intersect(uspriteptr_t const spr, const vec3_t *refpos,
|
||||||
int32_t vx, int32_t vy, int32_t vz,
|
int32_t vx, int32_t vy, int32_t vz,
|
||||||
vec3_t *intp, int32_t strictly_smaller_than_p);
|
vec3_t *intp, int32_t strictly_smaller_than_p);
|
||||||
|
|
||||||
bool sectoradjacent(int sect1, int sect2);
|
int findwallbetweensectors(int sect1, int sect2);
|
||||||
|
static FORCE_INLINE bool sectoradjacent(int sect1, int sect2) { return findwallbetweensectors(sect1, sect2) != -1; }
|
||||||
int32_t getwalldist(vec2_t const &p, int const wallnum, vec2_t * const output = nullptr);
|
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);
|
int32_t getsectordist(vec2_t const &p, int const sectnum);
|
||||||
extern const int16_t *chsecptr_onextwall;
|
extern const int16_t *chsecptr_onextwall;
|
||||||
|
|
|
@ -10993,16 +10993,19 @@ int32_t getsectordist(vec2_t const &pos, int const sectnum)
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sectoradjacent(int sect1, int sect2)
|
int findwallbetweensectors(int sect1, int sect2)
|
||||||
{
|
{
|
||||||
if (sector[sect1].wallnum > sector[sect2].wallnum)
|
if (sector[sect1].wallnum > sector[sect2].wallnum)
|
||||||
swaplong(§1, §2);
|
swaplong(§1, §2);
|
||||||
|
|
||||||
for (int i = 0; i < sector[sect1].wallnum; i++)
|
auto const sec = (usectorptr_t)§or[sect1];
|
||||||
if (wall[sector[sect1].wallptr + i].nextsector == sect2)
|
int const last = sec->wallptr + sec->wallnum;
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
for (int i = sec->wallptr; i < last; i++)
|
||||||
|
if (wall[i].nextsector == sect2)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAXUPDATESECTORDIST 1536
|
#define MAXUPDATESECTORDIST 1536
|
||||||
|
|
Loading…
Reference in a new issue