- eliminated player_int_ceiling_dist, player_int_floor_dist wrappers

This commit is contained in:
Christoph Oelckers 2022-08-31 00:39:32 +02:00
parent 8c5e52938d
commit 3ac4e7ed2d
4 changed files with 41 additions and 19 deletions

View file

@ -500,6 +500,25 @@ inline int clipmove(DVector3& pos, sectortype** const sect, int xvect, int yvect
return res; return res;
} }
inline int clipmove(DVector3& pos, sectortype** const sect, int xvect, int yvect,
int const walldist, double const ceildist, double const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3)
{
auto vect = vec3_t(pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
int res = clipmove(vect, sect, xvect, yvect, walldist, int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, result, clipmoveboxtracenum);
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
return res;
}
// this one should be the final version everything needs to migrate to
inline int clipmove(DVector3& pos, sectortype** const sect, const DVector2& mvec,
double const walldist, double const ceildist, double const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3)
{
auto vect = vec3_t(pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
int res = clipmove(vect, sect, int(mvec.X * worldtoint), int(mvec.Y * worldtoint), int(walldist * worldtoint), int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, result, clipmoveboxtracenum);
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
return res;
}
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,
uint32_t const cliptype, bool clear = true) uint32_t const cliptype, bool clear = true)
@ -521,6 +540,17 @@ inline int pushmove(DVector3& pos, sectortype** const sect, int32_t const walldi
return res; return res;
} }
inline int pushmove(DVector3& pos, sectortype** const sect, int32_t const walldist, double const ceildist, double const flordist,
uint32_t const cliptype, bool clear = true)
{
auto vect = vec3_t(pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
int sectno = *sect ? sector.IndexOf(*sect) : -1;
int res = pushmove_(&vect, &sectno, walldist, int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, clear);
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
*sect = sectno == -1 ? nullptr : &sector[sectno];
return res;
}
#if 0 #if 0
inline int pushmove(DVector3& pos, sectortype** const sect, double const walldist, double const ceildist, double const flordist, inline int pushmove(DVector3& pos, sectortype** const sect, double const walldist, double const ceildist, double const flordist,
uint32_t const cliptype, bool clear = true) uint32_t const cliptype, bool clear = true)

View file

@ -607,14 +607,6 @@ struct PLAYER
{ {
pos.XY() += { z.X * inttoworld, z.Y * inttoworld }; pos.XY() += { z.X * inttoworld, z.Y * inttoworld };
} }
int player_int_ceiling_dist() const
{
return p_ceiling_dist * 256;
}
int player_int_floor_dist() const
{
return p_floor_dist * 256;
}
int int_bob_amt() const int int_bob_amt() const
{ {
return bob_amt * zworldtoint; return bob_amt * zworldtoint;
@ -642,7 +634,7 @@ struct PLAYER
int16_t down_speed, up_speed; // diving int16_t down_speed, up_speed; // diving
int z_speed; // used for diving and flying instead of down_speed, up_speed int z_speed; // used for diving and flying instead of down_speed, up_speed
int climb_ndx; int climb_ndx;
int p_ceiling_dist,p_floor_dist; double p_ceiling_dist,p_floor_dist;
sectortype* hi_sectp, *lo_sectp; sectortype* hi_sectp, *lo_sectp;
int circle_camera_dist; int circle_camera_dist;

View file

@ -1875,7 +1875,7 @@ void DoPlayerSlide(PLAYER* pp)
if (labs(pp->slide_vect.X) < 12800 && labs(pp->slide_vect.Y) < 12800) if (labs(pp->slide_vect.X) < 12800 && labs(pp->slide_vect.Y) < 12800)
pp->slide_vect.X = pp->slide_vect.Y = 0; pp->slide_vect.X = pp->slide_vect.Y = 0;
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist(), CLIPMASK_PLAYER); push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0) if (push_ret < 0)
{ {
if (!(pp->Flags & PF_DEAD)) if (!(pp->Flags & PF_DEAD))
@ -1889,10 +1889,10 @@ void DoPlayerSlide(PLAYER* pp)
return; return;
} }
Collision coll; Collision coll;
clipmove(pp->pos, &pp->cursector, pp->slide_vect.X, pp->slide_vect.Y, ((int)actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist(), CLIPMASK_PLAYER, coll); clipmove(pp->pos, &pp->cursector, pp->slide_vect.X, pp->slide_vect.Y, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
PlayerCheckValidMove(pp); PlayerCheckValidMove(pp);
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist(), CLIPMASK_PLAYER); push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0) if (push_ret < 0)
{ {
if (!(pp->Flags & PF_DEAD)) if (!(pp->Flags & PF_DEAD))
@ -2024,7 +2024,7 @@ void DoPlayerMove(PLAYER* pp)
} }
else else
{ {
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist() - Z(16), CLIPMASK_PLAYER); push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
if (push_ret < 0) if (push_ret < 0)
{ {
@ -2047,12 +2047,12 @@ void DoPlayerMove(PLAYER* pp)
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK);
Collision coll; Collision coll;
updatesector(pp->int_ppos().X, pp->int_ppos().Y, &pp->cursector); updatesector(pp->int_ppos().X, pp->int_ppos().Y, &pp->cursector);
clipmove(pp->pos, &pp->cursector, pp->vect.X, pp->vect.Y, ((int)actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist(), CLIPMASK_PLAYER, coll); clipmove(pp->pos, &pp->cursector, pp->vect.X, pp->vect.Y, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
actor->spr.cstat = save_cstat; actor->spr.cstat = save_cstat;
PlayerCheckValidMove(pp); PlayerCheckValidMove(pp);
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist() - Z(16), CLIPMASK_PLAYER); push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist - Z(16), CLIPMASK_PLAYER);
if (push_ret < 0) if (push_ret < 0)
{ {
@ -4495,7 +4495,7 @@ void DoPlayerCurrent(PLAYER* pp)
xvect = sectu->speed * synctics * bcos(sectu->ang) >> 4; xvect = sectu->speed * synctics * bcos(sectu->ang) >> 4;
yvect = sectu->speed * synctics * bsin(sectu->ang) >> 4; yvect = sectu->speed * synctics * bsin(sectu->ang) >> 4;
push_ret = pushmove(pp->pos, &pp->cursector, ((int)pp->actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist(), CLIPMASK_PLAYER); push_ret = pushmove(pp->pos, &pp->cursector, ((int)pp->actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0) if (push_ret < 0)
{ {
if (!(pp->Flags & PF_DEAD)) if (!(pp->Flags & PF_DEAD))
@ -4511,10 +4511,10 @@ void DoPlayerCurrent(PLAYER* pp)
return; return;
} }
Collision coll; Collision coll;
clipmove(pp->pos, &pp->cursector, xvect, yvect, ((int)pp->actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist(), CLIPMASK_PLAYER, coll); clipmove(pp->pos, &pp->cursector, xvect, yvect, ((int)pp->actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
PlayerCheckValidMove(pp); PlayerCheckValidMove(pp);
pushmove(pp->pos, &pp->cursector, ((int)pp->actor->spr.clipdist<<2), pp->player_int_ceiling_dist(), pp->player_int_floor_dist(), CLIPMASK_PLAYER); pushmove(pp->pos, &pp->cursector, ((int)pp->actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
if (push_ret < 0) if (push_ret < 0)
{ {
if (!(pp->Flags & PF_DEAD)) if (!(pp->Flags & PF_DEAD))

View file

@ -192,7 +192,7 @@ struct SWPlayer native
native int z_speed; // used for diving and flying instead of down_speed, up_speed native int z_speed; // used for diving and flying instead of down_speed, up_speed
native int climb_ndx; native int climb_ndx;
native double hiz,loz; native double hiz,loz;
native int p_ceiling_dist,p_floor_dist; native double p_ceiling_dist,p_floor_dist;
native int circle_camera_dist; native int circle_camera_dist;
native double siang; native double siang;