mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 07:31:03 +00:00
- Replace clamped off tangent values with a linear interpolation of the player's pitch.
* Gives a tangent-like ramping where it's noticeable without having to use the tangent at all. * Had to do homegrown lerper since we're not C++20 yet.
This commit is contained in:
parent
7f124eef58
commit
8ec475aec8
5 changed files with 17 additions and 7 deletions
|
@ -90,6 +90,18 @@ 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;
|
||||
|
||||
|
@ -105,9 +117,6 @@ 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;
|
||||
|
|
|
@ -1364,7 +1364,7 @@ public:
|
|||
return Degrees_ / other;
|
||||
}
|
||||
|
||||
constexpr double operator/ (TAngle other) const
|
||||
constexpr TAngle operator/ (TAngle other) const
|
||||
{
|
||||
return Degrees_ / other.Degrees_;
|
||||
}
|
||||
|
|
|
@ -526,7 +526,7 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, DAngle& cH, s
|
|||
{
|
||||
cPos.Z += bobHeight;
|
||||
}
|
||||
cPos.Z -= clamp(cH.Tan(), -1.171875, 1.171875) * 5.;
|
||||
cPos.Z -= lerp(-10., 10., ((cH.Normalized180() + DAngle90) / DAngle180).Degrees());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -231,7 +231,8 @@ void displayweapon_d(int snum, double interpfrac)
|
|||
}
|
||||
|
||||
plravel = getavel(snum) * (1. / 16.);
|
||||
horiz16th = clamp((!SyncInput() ? p->horizon.sum() : p->horizon.interpolatedsum(interpfrac)).Tan(), -2., 2.) * 8.;
|
||||
auto horiz = !SyncInput() ? p->horizon.sum() : p->horizon.interpolatedsum(interpfrac);
|
||||
horiz16th = lerp(-16., 16., ((horiz.Normalized180() + DAngle90) / DAngle180).Degrees());
|
||||
look_anghalf = p->angle.look_anghalf(interpfrac);
|
||||
looking_arc = p->angle.looking_arc(interpfrac);
|
||||
hard_landing *= 8.;
|
||||
|
|
|
@ -180,7 +180,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, DVector3 spos, DAng
|
|||
// WTF???
|
||||
DAngle myang = DAngle90 - (DAngle180 - abs(abs((spos.XY() - ps[p].pos.XY()).Angle() - sang) - DAngle180));
|
||||
if (ps[p].GetActor()->vel.X != 0)
|
||||
vel = ((myang / DAngle90) * ps[p].GetActor()->vel.X) + 25;
|
||||
vel = ((myang / DAngle90).Degrees() * ps[p].GetActor()->vel.X) + 25;
|
||||
if (actor->sector()->lotag == 2 && (krand() % 5) == 0)
|
||||
spawned = spawn(actor, WATERBUBBLE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue