- got rid of the getzrange wrapper.

This commit is contained in:
Christoph Oelckers 2022-09-29 15:26:36 +02:00
parent 55b055e654
commit d11f6819db
2 changed files with 18 additions and 29 deletions

View file

@ -111,20 +111,7 @@ void setVideoMode();
class F2DDrawer;
void getzrange_(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBase& ceilhit, int32_t* florz,
CollisionBase& florhit, int32_t walldist, uint32_t cliptype);
inline void getzrange(const DVector3& pos, sectortype* sect, double* ceilz, CollisionBase& ceilhit, double* florz,
CollisionBase& florhit, int32_t walldist, uint32_t cliptype)
{
vec3_t ipos(int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) );
int c = int(*ceilz * zworldtoint);
int f = int(*florz * zworldtoint);
getzrange_(ipos, sect, &c, ceilhit, &f, florhit, walldist, cliptype);
*ceilz = c * zinttoworld;
*florz = f * zinttoworld;
}
void getzrange(const DVector3& pos, sectortype* sect, double* ceilz, CollisionBase& ceilhit, double* florz, CollisionBase& florhit, int32_t walldist, uint32_t cliptype);
struct HitInfoBase;

View file

@ -887,12 +887,15 @@ int pushmove_(vec3_t *const vect, int *const sectnum,
// getzrange
//
void getzrange_(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBase& ceilhit, int32_t* florz, CollisionBase& florhit, int32_t walldist, uint32_t cliptype)
void getzrange(const DVector3& pos_, sectortype* sect, double* ceilz_, CollisionBase& ceilhit, double* florz_, CollisionBase& florhit, int32_t walldist, uint32_t cliptype)
{
vec3_t pos(int(pos_.X * worldtoint), int(pos_.Y * worldtoint), int(pos_.Z * zworldtoint) );
if (sect == nullptr)
{
*ceilz = INT32_MIN; ceilhit.setVoid();
*florz = INT32_MAX; florhit.setVoid();
*ceilz_ = -FLT_MAX; ceilhit.setVoid();
*florz_ = FLT_MAX; florhit.setVoid();
return;
}
@ -917,7 +920,7 @@ void getzrange_(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBa
closest = { int(v.X * worldtoint), int(v.Y * worldtoint) };
}
int_getzsofslopeptr(sect,closest.X,closest.Y,ceilz,florz);
getzsofslopeptr(sect, closest.X * inttoworld, closest.Y * inttoworld, ceilz_, florz_);
ceilhit.setSector(sect);
florhit.setSector(sect);
@ -974,7 +977,7 @@ void getzrange_(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBa
if (da.X >= da.Y)
continue;
//It actually got here, through all the continue's!!!
int32_t daz = 0, daz2 = 0;
double daz = 0, daz2 = 0;
closest = pos.vec2;
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
{
@ -983,14 +986,14 @@ void getzrange_(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBa
closest = { int(v.X * worldtoint), int(v.Y * worldtoint) };
}
int_getzsofslopeptr(nextsect, closest.X,closest.Y, &daz,&daz2);
getzsofslopeptr(nextsect, closest.X * inttoworld,closest.Y * inttoworld, &daz,&daz2);
{
if (daz > *ceilz)
*ceilz = daz, ceilhit.setSector(nextsect);
if (daz > *ceilz_)
*ceilz_ = daz, ceilhit.setSector(nextsect);
if (daz2 < *florz)
*florz = daz2, florhit.setSector(nextsect);
if (daz2 < *florz_)
*florz_ = daz2, florhit.setSector(nextsect);
}
}
}
@ -1072,20 +1075,19 @@ void getzrange_(const vec3_t& pos, sectortype* sect, int32_t* ceilz, CollisionBa
if (clipyou != 0)
{
if ((pos.Z > daz) && (daz > *ceilz))
if ((pos.Z > daz) && (daz * zinttoworld > *ceilz_))
{
*ceilz = daz;
*ceilz_ = daz * zinttoworld;
ceilhit.setSprite(actor);
}
if ((pos.Z < daz2) && (daz2 < *florz))
if ((pos.Z < daz2) && (daz2 * zinttoworld < *florz_))
{
*florz = daz2;
*florz_ = daz2 * zinttoworld;
florhit.setSprite(actor);
}
}
}
}
}
}