- use a sector pointer in FAFgetzrange.

This commit is contained in:
Christoph Oelckers 2021-11-26 20:07:42 +01:00
parent 70d7e81f4f
commit 53be5d1622
5 changed files with 10 additions and 10 deletions

View file

@ -1854,6 +1854,7 @@ int AnimSet(int animtype, sectortype* animindex, int thegoal, int thevel)
{
return AnimSet(animtype, sectnum(animindex), nullptr, thegoal, thevel);
}
short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECTp data);
short AnimSetVelAdj(short anim_ndx, short vel_adj);
@ -1902,7 +1903,7 @@ void FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect,
bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, int32_t xe, int32_t ye, int32_t ze, sectortype* secte);
void FAFgetzrange(vec3_t pos, int16_t sectnum,
void FAFgetzrange(vec3_t pos, sectortype* sect,
int32_t* hiz, Collision* ceilhit,
int32_t* loz, Collision* florhit,
int32_t clipdist, int32_t clipmask);

View file

@ -1872,7 +1872,7 @@ void DoPlayerZrange(PLAYERp pp)
RESET(sp->cstat, CSTAT_SPRITE_BLOCK);
vec3_t pos = pp->pos;
pos.z += Z(8);
FAFgetzrange(pos, sectnum(pp->cursector), &pp->hiz, &ceilhit, &pp->loz, &florhit, ((int)sp->clipdist<<2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
FAFgetzrange(pos, pp->cursector, &pp->hiz, &ceilhit, &pp->loz, &florhit, ((int)sp->clipdist<<2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
sp->cstat = bakcstat;
Collision ceilColl(ceilhit);

View file

@ -468,9 +468,8 @@ void WaterAdjust(const Collision& florhit, int32_t* loz)
}
}
void FAFgetzrange(vec3_t pos, int16_t sectnum, int32_t* hiz, Collision* ceilhit, int32_t* loz, Collision* florhit, int32_t clipdist, int32_t clipmask)
void FAFgetzrange(vec3_t pos, sectortype* sect, int32_t* hiz, Collision* ceilhit, int32_t* loz, Collision* florhit, int32_t clipdist, int32_t clipmask)
{
sectortype* sect = &sector[sectnum];
int foo1;
Collision foo2;
bool SkipFAFcheck;
@ -481,7 +480,7 @@ void FAFgetzrange(vec3_t pos, int16_t sectnum, int32_t* hiz, Collision* ceilhit,
// because the ceiling and floors get moved out of the way for drawing.
// early out to regular routine
if (sectnum < 0 || !FAF_ConnectArea(sect))
if (sect == nullptr || !FAF_ConnectArea(sect))
{
getzrange(pos, sect, hiz, *ceilhit, loz, *florhit, clipdist, clipmask);
SectorZadjust(*ceilhit, hiz, *florhit, loz);
@ -568,7 +567,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* const sect,
updatesectorz(x, y, newz, &uppersect);
if (uppersect < 0)
return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d, sectnum %d", x, y, newz, sectnum);
return;
getzrangepoint(x, y, newz, uppersect, hiz, ceilhit, &foo1, &foo2);
SectorZadjust(*ceilhit, hiz, trash, nullptr);
}
@ -580,7 +579,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, sectortype* const sect,
return;
updatesectorz(x, y, newz, &lowersect);
if (lowersect < 0)
return; // _ErrMsg(ERR_STD_ARG, "Did not find a sector at %d, %d, %d, sectnum %d", x, y, newz, sectnum);
return;
getzrangepoint(x, y, newz, lowersect, &foo1, &foo2, loz, florhit);
SectorZadjust(trash, nullptr, *florhit, loz);
WaterAdjust(*florhit, loz);

View file

@ -4603,7 +4603,7 @@ void DoActorZrange(DSWActor* actor)
RESET(sp->cstat, CSTAT_SPRITE_BLOCK);
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);
FAFgetzrange(pos, sp->sector(), &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;
@ -6502,7 +6502,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in
// player. Seems to work ok!
vec3_t pos = spr->pos;
pos.z -= zh + 1;
FAFgetzrange(pos, spr->sectnum,
FAFgetzrange(pos, spr->sector(),
&globhiz, &globhihit, &globloz, &globlohit,
(((int) spr->clipdist) << 2) - GETZRANGE_CLIP_ADJ, cliptype);

View file

@ -11184,7 +11184,7 @@ int DoFindGround(DSWActor* actor)
save_cstat = sp->cstat;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
FAFgetzrange(sp->pos, sp->sectnum, &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
FAFgetzrange(sp->pos, sp->sector(), &u->hiz, &ceilhit, &u->loz, &florhit, (((int) sp->clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_PLAYER);
sp->cstat = save_cstat;
switch (florhit.type)