- SW: Interpolate player's pbob_amt.

This commit is contained in:
Mitchell Richters 2022-09-08 20:37:35 +10:00 committed by Christoph Oelckers
parent baa6516e8c
commit 8fec35b278
3 changed files with 3 additions and 2 deletions

View file

@ -1183,7 +1183,7 @@ void drawscreen(PLAYER* pp, double interpfrac, bool sceneonly)
{
if (cl_viewbob)
{
tpos.Z += camerapp->pbob_amt + interpolatedvalue(pp->obob_z, pp->bob_z, interpfrac);
tpos.Z += interpolatedvalue(pp->obob_z + pp->opbob_amt, pp->bob_z + pp->pbob_amt, interpfrac);
}
// recoil only when not in camera

View file

@ -588,7 +588,7 @@ struct PLAYER
SECTOR_OBJECT* sop; // will either be sop_remote or sop_control
double hiz, loz;
double pbob_amt;
double opbob_amt, pbob_amt;
int jump_count, jump_speed; // jumping
double z_speed;

View file

@ -1774,6 +1774,7 @@ void DoPlayerRecoil(PLAYER* pp)
void DoPlayerSpriteBob(PLAYER* pp, double player_height, double bobamt, short bob_speed)
{
pp->bob_ndx = (pp->bob_ndx + (synctics << bob_speed)) & 2047;
pp->opbob_amt = pp->pbob_amt;
pp->pbob_amt = bobamt * BobVal(pp->bob_ndx);
pp->actor->spr.pos.Z = pp->pos.Z + player_height + pp->pbob_amt;
}