Fixed weapon bob jittering.

This commit is contained in:
Chronos Ouroboros 2020-11-14 14:34:09 -03:00
parent 38d29c235b
commit 0aefc61f86
3 changed files with 6 additions and 3 deletions

View file

@ -310,6 +310,7 @@ public:
double viewz = 0; // focal origin above r.z
double viewheight = 0; // base height above floor for viewz
double deltaviewheight = 0; // squat speed.
float prevbob = 0; // Previous value of "bob"
double bob = 0; // bounded/scaled total velocity
// killough 10/98: used for realistic bobbing (i.e. not simply overall speed)

View file

@ -275,6 +275,7 @@ void player_t::CopyFrom(player_t &p, bool copyPSP)
viewz = p.viewz;
viewheight = p.viewheight;
deltaviewheight = p.deltaviewheight;
prevbob = p.prevbob;
bob = p.bob;
Vel = p.Vel;
centering = p.centering;
@ -1264,6 +1265,7 @@ void P_PlayerThink (player_t *player)
player->original_cmd = cmd->ucmd;
// Don't interpolate the view for more than one tic
player->cheats &= ~CF_INTERPVIEW;
player->prevbob = player->bob;
IFVIRTUALPTRNAME(player->mo, NAME_PlayerPawn, PlayerThink)
{
@ -1734,6 +1736,7 @@ DEFINE_FIELD_X(PlayerInfo, player_t, FOV)
DEFINE_FIELD_X(PlayerInfo, player_t, viewz)
DEFINE_FIELD_X(PlayerInfo, player_t, viewheight)
DEFINE_FIELD_X(PlayerInfo, player_t, deltaviewheight)
DEFINE_FIELD_X(PlayerInfo, player_t, prevbob)
DEFINE_FIELD_X(PlayerInfo, player_t, bob)
DEFINE_FIELD_X(PlayerInfo, player_t, Vel)
DEFINE_FIELD_X(PlayerInfo, player_t, centering)

View file

@ -49,7 +49,6 @@ class PlayerPawn : Actor
double ViewBob; // [SP] ViewBob Multiplier
double FullHeight;
double curBob;
float prevBob;
meta Name HealingRadiusType;
meta Name InvulMode;
@ -1573,7 +1572,6 @@ class PlayerPawn : Actor
virtual void PlayerThink()
{
let player = self.player;
prevBob = player.bob;
UserCmd cmd = player.cmd;
CheckFOV();
@ -2360,7 +2358,7 @@ class PlayerPawn : Actor
double bobVal = player.bob;
if (i == 0)
{
bobVal = prevBob;
bobVal = player.prevBob;
}
//[SP] Added in decorate player.viewbob checks
double bobx = (bobVal * BobIntensity * Rangex * ViewBob);
@ -2648,6 +2646,7 @@ struct PlayerInfo native play // self is what internally is known as player_t
native double viewz;
native double viewheight;
native double deltaviewheight;
native float prevbob;
native double bob;
native vector2 vel;
native bool centering;