diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 6b659a4bb..b1d531905 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -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" diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index b4ea750c7..0a6fc550f 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -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);