- Get rid of useless lerp() function I added last night for lack of C++20.

* We already have a generic linear interpolator that _I_ added, so let's use it.
This commit is contained in:
Mitchell Richters 2022-11-07 17:31:17 +11:00
parent 043ebadbee
commit 274899c9db
3 changed files with 5 additions and 14 deletions

View file

@ -90,18 +90,6 @@ inline constexpr double Scale(double a, double b, double c)
return (a * b) / c;
}
template<typename T>
inline constexpr int Sgn(const T& val)
{
return (val > 0) - (val < 0);
}
template<typename T>
inline constexpr T lerp(const T min, const T max, const T input)
{
return (T(1) - input) * min + input * max;
}
class FileReader;
struct MD5Context;
@ -117,6 +105,9 @@ inline void fillshort(void* buff, size_t count, uint16_t clear)
}
}
template<typename T> inline constexpr int Sgn(const T& val) { return (val > 0) - (val < 0); }
inline int sizeToBits(int w)
{
int j = 15;

View file

@ -526,7 +526,7 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, DAngle& cH, s
{
cPos.Z += bobHeight;
}
cPos.Z -= lerp(-10., 10., (cH + DAngle90) / DAngle180);
cPos.Z -= interpolatedvalue(-10., 10., (cH + DAngle90) / DAngle180);
}
else
{

View file

@ -232,7 +232,7 @@ void displayweapon_d(int snum, double interpfrac)
plravel = getavel(snum) * (1. / 16.);
auto horiz = !SyncInput() ? p->horizon.sum() : p->horizon.interpolatedsum(interpfrac);
horiz16th = lerp(-16., 16., (horiz + DAngle90) / DAngle180);
horiz16th = interpolatedvalue(-16., 16., (horiz + DAngle90) / DAngle180);
look_anghalf = p->angle.look_anghalf(interpfrac);
looking_arc = p->angle.looking_arc(interpfrac);
hard_landing *= 8.;