- made some minor edits to clipmove to get rid of a few deprecated wrapper functions.

This commit is contained in:
Christoph Oelckers 2022-10-13 18:07:41 +02:00
parent 14769e9b79
commit a0f18c360a
2 changed files with 11 additions and 48 deletions

View file

@ -527,7 +527,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
{
vec2_t const vec = pos->vec2;
keepaway(&pos->X, &pos->Y, i);
if (inside_p(pos->X,pos->Y, *sectnum) != 1)
if (inside(pos->X,pos->Y, &sector[*sectnum]) != 1)
pos->vec2 = vec;
break;
}
@ -599,42 +599,44 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE)
{
DVector3 fpos(pos->X* inttoworld, pos->Y* inttoworld, pos->Z* inttoworld);
for (int j=0; j<clipsectnum; j++)
if (inside_p(pos->X, pos->Y, clipsectorlist[j]) == 1)
if (inside(fpos.X, fpos.Y, &sector[clipsectorlist[j]]) == 1)
{
*sectnum = clipsectorlist[j];
return clipReturn;
}
int32_t tempint2, tempint1 = INT32_MAX;
double tempint2, tempint1 = INT32_MAX;
*sectnum = -1;
for (int j = (int)sector.Size() - 1; j >= 0; j--)
{
auto sect = &sector[j];
if (inside(pos->X, pos->Y, sect) == 1)
if (inside(fpos.X, fpos.Y, sect) == 1)
{
tempint2 = int_getceilzofslopeptr(sect, pos->X, pos->Y) - pos->Z;
tempint2 = getceilzofslopeptr(sect, fpos.X, fpos.Y) - fpos.Z;
if (tempint2 > 0)
{
if (tempint2 < tempint1)
{
*sectnum = (int16_t)j;
*sectnum = j;
tempint1 = tempint2;
}
}
else
{
tempint2 = pos->Z - int_getflorzofslopeptr(sect, pos->X, pos->Y);
tempint2 = fpos.Z - getflorzofslopeptr(sect, fpos.X, fpos.Y);
if (tempint2 <= 0)
{
*sectnum = (int16_t)j;
*sectnum = j;
return clipReturn;
}
if (tempint2 < tempint1)
{
*sectnum = (int16_t)j;
*sectnum = j;
tempint1 = tempint2;
}
}

View file

@ -320,9 +320,6 @@ inline void PlanesAtPoint(const sectortype* sec, float dax, float day, float* pc
}
// only used by clipmove et.al.
void getcorrectzsofslope(int sectnum, int dax, int day, double* ceilz, double* florz);
//==========================================================================
//
// for the game engine
@ -541,31 +538,6 @@ inline DAngle ClampViewPitch(const DAngle pitch)
//
//==========================================================================
[[deprecated]]
inline int int_getceilzofslopeptr(const sectortype* sec, int dax, int day)
{
double z;
calcSlope(sec, dax * inttoworld, day * inttoworld, &z, nullptr);
return int(z * zworldtoint);
}
[[deprecated]]
inline int int_getflorzofslopeptr(const sectortype* sec, int dax, int day)
{
double z;
calcSlope(sec, dax * inttoworld, day * inttoworld, nullptr, &z);
return int(z * zworldtoint);
}
[[deprecated]]
inline void int_getzsofslopeptr(const sectortype* sec, int dax, int day, int* ceilz, int* florz)
{
double c, f;
calcSlope(sec, dax * inttoworld, day * inttoworld, &c, &f);
*ceilz = int(c * zworldtoint);
*florz = int(f * zworldtoint);
}
[[deprecated]]
inline int rintersect(int x1, int y1, int z1, int vx, int vy, int vz, int x3, int y3, int x4, int y4, int* intx, int* inty, int* intz)
{
@ -579,23 +551,12 @@ inline int rintersect(int x1, int y1, int z1, int vx, int vy, int vz, int x3, in
return FloatToFixed(result);
}
[[deprecated]]
inline int cansee(int x1, int y1, int z1, sectortype* sect1, int x2, int y2, int z2, sectortype* sect2)
{
return cansee(DVector3(x1 * inttoworld, y1 * inttoworld, z1 * zinttoworld), sect1, DVector3(x2 * inttoworld, y2 * inttoworld, z2 * zinttoworld), sect2);
}
[[deprecated]]
inline int inside(int x, int y, const sectortype* sect)
{
return inside(x * inttoworld, y * inttoworld, sect);
}
// still needed by some parts in the engine.
[[deprecated]]
inline int inside_p(int x, int y, int sectnum) { return (sectnum >= 0 && inside(x * inttoworld, y * inttoworld, &sector[sectnum]) == 1); }