mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 10:32:27 +00:00
- getzrange cleanup.
This commit is contained in:
parent
bcc532d36f
commit
793dd032b0
3 changed files with 16 additions and 33 deletions
|
@ -496,20 +496,6 @@ inline void getcorrectzsofslope(int sectnum, int32_t dax, int32_t day, int32_t *
|
|||
getzsofslopeptr((usectorptr_t)§or[sectnum], closest.x, closest.y, ceilz, florz);
|
||||
}
|
||||
|
||||
inline int32_t getcorrectceilzofslope(int sectnum, int32_t dax, int32_t day)
|
||||
{
|
||||
vec2_t closest = { dax, day };
|
||||
getsectordist(closest, sectnum, &closest);
|
||||
return getceilzofslopeptr((usectorptr_t)§or[sectnum], closest.x, closest.y);
|
||||
}
|
||||
|
||||
inline int32_t getcorrectflorzofslope(int sectnum, int32_t dax, int32_t day)
|
||||
{
|
||||
vec2_t closest = { dax, day };
|
||||
getsectordist(closest, sectnum, &closest);
|
||||
return getflorzofslopeptr((usectorptr_t)§or[sectnum], closest.x, closest.y);
|
||||
}
|
||||
|
||||
void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
|
||||
void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z);
|
||||
void setslope(int32_t sectnum, int32_t cf, int16_t slope);
|
||||
|
|
|
@ -983,17 +983,14 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
|
|||
////////// Walls //////////
|
||||
|
||||
auto const startsec = (usectorptr_t)§or[clipsectorlist[clipsectcnt]];
|
||||
const int startwall = startsec->wallptr;
|
||||
const int endwall = startwall + startsec->wallnum;
|
||||
|
||||
for (int j=startwall; j<endwall; j++)
|
||||
for(auto&wal : wallsofsector(startsec))
|
||||
{
|
||||
const int k = wall[j].nextsector;
|
||||
|
||||
if (k >= 0)
|
||||
if (wal.twoSided())
|
||||
{
|
||||
vec2_t const v1 = wall[j].pos;
|
||||
vec2_t const v2 = wall[j].point2Wall()->pos;
|
||||
auto nextsect = wal.nextSector();
|
||||
vec2_t const v1 = wal.pos;
|
||||
vec2_t const v2 = wal.point2Wall()->pos;
|
||||
|
||||
if ((v1.x < xmin && (v2.x < xmin)) || (v1.x > xmax && v2.x > xmax) ||
|
||||
(v1.y < ymin && (v2.y < ymin)) || (v1.y > ymax && v2.y > ymax))
|
||||
|
@ -1008,14 +1005,14 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
|
|||
if (da.x >= da.y)
|
||||
continue;
|
||||
|
||||
if (wall[j].cstat&dawalclipmask) continue; // XXX?
|
||||
auto const sec = (usectorptr_t)§or[k];
|
||||
if (wal.cstat&dawalclipmask) continue; // XXX?
|
||||
|
||||
if (((sec->ceilingstat&1) == 0) && (pos.z <= sec->ceilingz+(3<<8))) continue;
|
||||
if (((sec->floorstat&1) == 0) && (pos.z >= sec->floorz-(3<<8))) continue;
|
||||
if (((nextsect->ceilingstat&1) == 0) && (pos.z <= nextsect->ceilingz+(3<<8))) continue;
|
||||
if (((nextsect->floorstat&1) == 0) && (pos.z >= nextsect->floorz-(3<<8))) continue;
|
||||
|
||||
if (bitmap_test(clipsectormap, k) == 0)
|
||||
addclipsect(k);
|
||||
int nextsectno = ::sectnum(nextsect);
|
||||
if (bitmap_test(clipsectormap, nextsectno) == 0)
|
||||
addclipsect(nextsectno);
|
||||
|
||||
if (((v1.x < xmin + MAXCLIPDIST) && (v2.x < xmin + MAXCLIPDIST)) ||
|
||||
((v1.x > xmax - MAXCLIPDIST) && (v2.x > xmax - MAXCLIPDIST)) ||
|
||||
|
@ -1031,16 +1028,16 @@ void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBas
|
|||
int32_t daz = 0, daz2 = 0;
|
||||
closest = pos.vec2;
|
||||
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
|
||||
getsectordist(closest, k, &closest);
|
||||
getsectordist(closest, nextsectno, &closest);
|
||||
else
|
||||
getzsofslope(k, closest.x,closest.y, &daz,&daz2);
|
||||
getzsofslopeptr(nextsect, closest.x,closest.y, &daz,&daz2);
|
||||
|
||||
{
|
||||
if (daz > *ceilz)
|
||||
*ceilz = daz, ceilhit.setSector(k);
|
||||
*ceilz = daz, ceilhit.setSector(nextsect);
|
||||
|
||||
if (daz2 < *florz)
|
||||
*florz = daz2, florhit.setSector(k);
|
||||
*florz = daz2, florhit.setSector(nextsect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ inline TArrayView<walltype> walls()
|
|||
return TArrayView<walltype>(&wall[0], numwalls);
|
||||
}
|
||||
|
||||
inline TArrayView<walltype> wallsofsector(sectortype* sec)
|
||||
inline TArrayView<walltype> wallsofsector(const sectortype* sec)
|
||||
{
|
||||
return TArrayView<walltype>(sec->firstWall(), sec->wallnum);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue