- SW: Replace use of getzrange_old() inline wrapper with getzrange() and remove inline wrappers.

This commit is contained in:
Mitch Richters 2021-10-30 22:47:03 +11:00 committed by Christoph Oelckers
parent 1d39bb371e
commit f0a347263a
6 changed files with 22 additions and 22 deletions

View file

@ -627,16 +627,6 @@ static inline int64_t compat_maybe_truncate_to_int32(int64_t val)
return enginecompatibility_mode != ENGINECOMPATIBILITY_NONE ? (int32_t)val : val;
}
static inline void getzrange_old(int32_t x, int32_t y, int32_t z, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz,
int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(5,6,7,8)));
static inline void getzrange_old(int32_t x, int32_t y, int32_t z, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz,
int32_t *florhit, int32_t walldist, uint32_t cliptype)
{
const vec3_t vector = { x, y, z };
getzrange(&vector, sectnum, ceilz, ceilhit, florz, florhit, walldist, cliptype);
}
static inline int32_t setspritez_old(int16_t spritenum, int32_t x, int32_t y, int32_t z)
{
const vec3_t vector = { x, y, z };

View file

@ -1955,7 +1955,7 @@ void FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, int16_t sects, int32_t xe, int32_t ye, int32_t ze, int16_t secte);
void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
void FAFgetzrange(vec3_t pos, int16_t sectnum,
int32_t* hiz, int32_t* ceilhit,
int32_t* loz, int32_t* florhit,
int32_t clipdist, int32_t clipmask);

View file

@ -1936,7 +1936,9 @@ DoPlayerZrange(PLAYERp pp)
// for an entire box, NOT just a point. -Useful for clipping
bakcstat = pp->SpriteP->cstat;
RESET(pp->SpriteP->cstat, CSTAT_SPRITE_BLOCK);
FAFgetzrange(pp->posx, pp->posy, pp->posz + Z(8), pp->cursectnum, &pp->hiz, &ceilhit, &pp->loz, &florhit, ((int)pp->SpriteP->clipdist<<2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
vec3_t pos = pp->pos;
pos.z += Z(8);
FAFgetzrange(pos, pp->cursectnum, &pp->hiz, &ceilhit, &pp->loz, &florhit, ((int)pp->SpriteP->clipdist<<2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
pp->SpriteP->cstat = bakcstat;
// 16384+sector (sector first touched) or

View file

@ -501,7 +501,7 @@ void WaterAdjust(short florhit, int32_t* loz)
}
}
void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
void FAFgetzrange(vec3_t pos, int16_t sectnum,
int32_t* hiz, int32_t* ceilhit,
int32_t* loz, int32_t* florhit,
int32_t clipdist, int32_t clipmask)
@ -517,13 +517,13 @@ void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
// early out to regular routine
if (sectnum < 0 || !FAF_ConnectArea(sectnum))
{
getzrange_old(x, y, z, sectnum, hiz, ceilhit, loz, florhit, clipdist, clipmask);
getzrange(&pos, sectnum, hiz, ceilhit, loz, florhit, clipdist, clipmask);
SectorZadjust(*ceilhit, hiz, *florhit, loz);
WaterAdjust(*florhit, loz);
return;
}
getzrange_old(x, y, z, sectnum, hiz, ceilhit, loz, florhit, clipdist, clipmask);
getzrange(&pos, sectnum, hiz, ceilhit, loz, florhit, clipdist, clipmask);
SkipFAFcheck = SectorZadjust(*ceilhit, hiz, *florhit, loz);
WaterAdjust(*florhit, loz);
@ -541,10 +541,12 @@ void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
return;
}
updatesectorz(x, y, newz, &uppersect);
updatesectorz(pos.x, pos.y, newz, &uppersect);
if (uppersect < 0)
return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d", x, y, newz);
getzrange_old(x, y, newz, uppersect, hiz, ceilhit, &foo1, &foo2, clipdist, clipmask);
vec3_t npos = pos;
npos.z = newz;
getzrange(&npos, uppersect, hiz, ceilhit, &foo1, &foo2, clipdist, clipmask);
SectorZadjust(*ceilhit, hiz, -1, nullptr);
}
else if (FAF_ConnectFloor(sectnum) && !TEST(sector[sectnum].floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN))
@ -563,10 +565,12 @@ void FAFgetzrange(int32_t x, int32_t y, int32_t z, int16_t sectnum,
return;
}
updatesectorz(x, y, newz, &lowersect);
updatesectorz(pos.x, pos.y, newz, &lowersect);
if (lowersect < 0)
return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d", x, y, newz);
getzrange_old(x, y, newz, lowersect, &foo1, &foo2, loz, florhit, clipdist, clipmask);
vec3_t npos = pos;
npos.z = newz;
getzrange(&npos, lowersect, &foo1, &foo2, loz, florhit, clipdist, clipmask);
SectorZadjust(-1, nullptr, *florhit, loz);
WaterAdjust(*florhit, loz);
}

View file

@ -4885,7 +4885,9 @@ DoActorZrange(short SpriteNum)
save_cstat = TEST(sp->cstat, CSTAT_SPRITE_BLOCK);
RESET(sp->cstat, CSTAT_SPRITE_BLOCK);
FAFgetzrange(sp->x, sp->y, sp->z - DIV2(SPRITEp_SIZE_Z(sp)), sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_ACTOR);
vec3_t pos = sp->pos;
pos.z -= DIV2(SPRITEp_SIZE_Z(sp));
FAFgetzrange(pos, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_ACTOR);
SET(sp->cstat, save_cstat);
u->lo_sectp = u->hi_sectp = nullptr;
@ -6893,7 +6895,9 @@ move_sprite(int spritenum, int xchange, int ychange, int zchange, int ceildist,
// I subtracted 8 from the clipdist because actors kept going up on
// ledges they were not supposed to go up on. Did the same for the
// player. Seems to work ok!
FAFgetzrange(spr->x, spr->y, spr->z - zh - 1, spr->sectnum,
vec3_t pos = spr->pos;
pos.z -= zh + 1;
FAFgetzrange(pos, spr->sectnum,
&globhiz, &globhihit, &globloz, &globlohit,
(((int) spr->clipdist) << 2) - GETZRANGE_CLIP_ADJ, cliptype);

View file

@ -11978,7 +11978,7 @@ DoFindGround(int16_t SpriteNum)
save_cstat = sp->cstat;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
FAFgetzrange(sp->x, sp->y, sp->z, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
FAFgetzrange(sp->pos, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
sp->cstat = save_cstat;
ASSERT(TEST(florhit, HIT_SPRITE | HIT_SECTOR));