Skip to content

Commit

Permalink
Weapon will continue bobbing when player_bobbing is disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesLove committed Jul 23, 2021
1 parent 8818c20 commit f4d1c6a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions prboom2/src/p_pspr.c
Expand Up @@ -616,9 +616,15 @@ void A_WeaponReady(player_t *player, pspdef_t *psp)
if (!player->morphTics)
{
int angle = (128 * leveltime) & FINEMASK;
// Continue bobbing the player's weapon, but at a reduced rate to prevent hyper bobbing
// when player_bobbing is off
if(!player_bobbing)
player->bob = (FixedMul(player->momx, player->momx) + FixedMul(player->momy, player->momy)) >> 4;
psp->sx = FRACUNIT + FixedMul(player->bob, finecosine[angle]);
angle &= FINEANGLES / 2 - 1;
psp->sy = WEAPONTOP + FixedMul(player->bob, finesine[angle]);
if(!player_bobbing)
player->bob = 0; // reset player bob to 0 like normal
}
}

Expand Down

0 comments on commit f4d1c6a

Please sign in to comment.