- Duke: Pitch-adjusted velocity for shootrpg() when free-aiming.

This commit is contained in:
Mitchell Richters 2022-11-06 21:34:07 +11:00
parent 8ec475aec8
commit 33e2de70a2
2 changed files with 7 additions and 1 deletions

View file

@ -523,4 +523,10 @@ inline DAngle ClampViewPitch(const DAngle pitch)
return clamp(pitch, GetMaxPitch(), GetMinPitch());
}
inline void setFreeAimVelocity(double& vel, double& zvel, const DAngle pitch, const double zvspeed)
{
vel *= pitch.Cos();
zvel = pitch.Sin() * zvspeed;
}
#include "updatesector.h"

View file

@ -683,7 +683,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
ang = (aimed->spr.pos.XY() - pos.XY()).Angle();
}
else
zvel = ps[p].horizon.sum().Tan() * 40.5;
setFreeAimVelocity(vel, zvel, ps[p].horizon.sum(), 40.5);
if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, actor);