- getzrange is free of hack values, too.

This commit is contained in:
Christoph Oelckers 2021-12-04 01:14:57 +01:00
parent 9d85859a80
commit 2541425b9d
3 changed files with 15 additions and 18 deletions

View file

@ -371,8 +371,8 @@ void setVideoMode();
class F2DDrawer; class F2DDrawer;
void getzrange_(const vec3_t *pos, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, void getzrange_(const vec3_t *pos, int16_t sectnum, int32_t *ceilz, CollisionBase& ceilhit, int32_t *florz,
int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6))); CollisionBase& florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6)));
extern vec2_t hitscangoal; extern vec2_t hitscangoal;

View file

@ -942,13 +942,13 @@ int pushmove_(vec3_t *const vect, int *const sectnum,
// getzrange // getzrange
// //
void getzrange_(const vec3_t *pos, int16_t sectnum, void getzrange_(const vec3_t *pos, int16_t sectnum,
int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t *ceilz, CollisionBase& ceilhit, int32_t *florz, CollisionBase& florhit,
int32_t walldist, uint32_t cliptype) int32_t walldist, uint32_t cliptype)
{ {
if (sectnum < 0) if (sectnum < 0)
{ {
*ceilz = INT32_MIN; *ceilhit = -1; *ceilz = INT32_MIN; ceilhit.setVoid();
*florz = INT32_MAX; *florhit = -1; *florz = INT32_MAX; florhit.setVoid();
return; return;
} }
@ -969,7 +969,8 @@ void getzrange_(const vec3_t *pos, int16_t sectnum,
getsectordist(closest, sectnum, &closest); getsectordist(closest, sectnum, &closest);
else else
getzsofslope(sectnum,closest.x,closest.y,ceilz,florz); getzsofslope(sectnum,closest.x,closest.y,ceilz,florz);
*ceilhit = sectnum+16384; *florhit = sectnum+16384; ceilhit.setSector(sectnum);
florhit.setSector(sectnum);
clipsectorlist[0] = sectnum; clipsectorlist[0] = sectnum;
clipsectnum = 1; clipsectnum = 1;
@ -1036,10 +1037,10 @@ void getzrange_(const vec3_t *pos, int16_t sectnum,
{ {
if (daz > *ceilz) if (daz > *ceilz)
*ceilz = daz, *ceilhit = k+16384; *ceilz = daz, ceilhit.setSector(k);
if (daz2 < *florz) if (daz2 < *florz)
*florz = daz2, *florhit = k+16384; *florz = daz2, florhit.setSector(k);
} }
} }
} }
@ -1052,12 +1053,11 @@ void getzrange_(const vec3_t *pos, int16_t sectnum,
if (dasprclipmask) if (dasprclipmask)
for (int i=0; i<clipsectnum; i++) for (int i=0; i<clipsectnum; i++)
{ {
int j;
if (!validSectorIndex(clipsectorlist[i])) continue; // we got a deleted sprite in here somewhere. Skip this entry. if (!validSectorIndex(clipsectorlist[i])) continue; // we got a deleted sprite in here somewhere. Skip this entry.
SectIterator it(clipsectorlist[i]); TSectIterator<DCoreActor> it(clipsectorlist[i]);
while ((j = it.NextIndex()) >= 0) while (auto actor = it.Next())
{ {
auto spr = &sprite[j]; auto spr = &actor->s();
const int32_t cstat = spr->cstat; const int32_t cstat = spr->cstat;
int32_t daz = 0, daz2 = 0; int32_t daz = 0, daz2 = 0;
@ -1124,13 +1124,13 @@ void getzrange_(const vec3_t *pos, int16_t sectnum,
if ((pos->z > daz) && (daz > *ceilz)) if ((pos->z > daz) && (daz > *ceilz))
{ {
*ceilz = daz; *ceilz = daz;
*ceilhit = j+49152; ceilhit.setSprite(actor);
} }
if ((pos->z < daz2) && (daz2 < *florz)) if ((pos->z < daz2) && (daz2 < *florz))
{ {
*florz = daz2; *florz = daz2;
*florhit = j+49152; florhit.setSprite(actor);
} }
} }
} }

View file

@ -322,10 +322,7 @@ inline int clipmove(vec3_t& pos, sectortype** const sect, int xvect, int yvect,
inline void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBase& ceilhit, int32_t* florz, inline void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBase& ceilhit, int32_t* florz,
CollisionBase& florhit, int32_t walldist, uint32_t cliptype) CollisionBase& florhit, int32_t walldist, uint32_t cliptype)
{ {
int fh, ch; getzrange_(&pos, sector.IndexOf(sect), ceilz, ceilhit, florz, florhit, walldist, cliptype);
getzrange_(&pos, sector.IndexOf(sect), ceilz, &ch, florz, &fh, walldist, cliptype);
ceilhit.setFromEngine(ch);
florhit.setFromEngine(fh);
} }
inline int pushmove(vec3_t* const vect, sectortype** const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist, inline int pushmove(vec3_t* const vect, sectortype** const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist,