- got rid of the two intermediate functions between clipmove_tweak_pos and InterceptLineSegments.

This commit is contained in:
Christoph Oelckers 2022-11-01 09:55:24 +01:00
parent 01c114787c
commit 93ca75e146
2 changed files with 8 additions and 32 deletions

View file

@ -107,9 +107,14 @@ static void addclipline(int32_t dax1, int32_t day1, int32_t dax2, int32_t day2,
inline void clipmove_tweak_pos(const vec3_t *pos, int32_t gx, int32_t gy, int32_t x1, int32_t y1, int32_t x2,
int32_t y2, int32_t *daxptr, int32_t *dayptr)
{
int32_t daz;
if (rintersect(pos->X, pos->Y, 0, gx, gy, 0, x1, y1, x2, y2, daxptr, dayptr, &daz) == -1)
double result = InterceptLineSegments(pos->X * inttoworld, pos->Y * inttoworld, gx * inttoworld, gy * inttoworld,
x1 * inttoworld, y1 * inttoworld, (x2 - x1) * inttoworld, (y2 - y1) * inttoworld);
if (result >= 0)
{
*daxptr = int(pos->X + result * gx);
*dayptr = int(pos->Y + result * gy);
}
else
{
*daxptr = pos->X;
*dayptr = pos->Y;

View file

@ -498,15 +498,6 @@ inline double SquareDistToWall(double px, double py, const walltype* wal, DVecto
double SquareDistToSector(double px, double py, const sectortype* sect, DVector2* point = nullptr);
inline double GetRayIntersect(const DVector3& start1, const DVector3& vect1, const DVector2& start2, const DVector2& vect2, DVector3& retv)
{
double factor2;
double factor = InterceptLineSegments(start1.X, start1.Y, vect1.X, vect1.Y, start2.X, start2.Y, vect2.X, vect2.Y, &factor2);
if (factor <= 0) return -1;
retv = start1 + factor * vect1;
return factor2;
}
inline double BobVal(int val)
{
return g_sinbam((unsigned)val << 21);
@ -532,24 +523,4 @@ inline DAngle ClampViewPitch(const DAngle pitch)
return clamp(pitch, GetMaxPitch(), GetMinPitch());
}
//==========================================================================
//
// old deprecated integer versions
//
//==========================================================================
[[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)
{
DVector3 retv;
double result = GetRayIntersect(DVector3(x1 * inttoworld, y1 * inttoworld, z1 * zinttoworld), DVector3(vx * inttoworld, vy * inttoworld, vz * zinttoworld),
DVector2(x3 * inttoworld, y3 * inttoworld), DVector2((x4 - x3) * inttoworld, (y4 - y3) * inttoworld), retv);
if (result < 0) return -1;
*intx = int(retv.X * worldtoint);
*inty = int(retv.Y * worldtoint);
*intz = int(retv.Z * zworldtoint);
return FloatToFixed(result);
}
#include "updatesector.h"