Fixed: Player.ViewBob should be multiplying the bobbing height in P_CalcHeight, not the velocity of the bobbing.

This mimics the act of the user altering their movebob CVar to compensate for non-standard player movement speeds.
This commit is contained in:
nashmuhandes 2016-10-20 17:52:32 +08:00 committed by Christoph Oelckers
parent e0efdd97b3
commit 21b690a3c7

View file

@ -1845,12 +1845,11 @@ void P_CalcHeight (player_t *player)
return; return;
} }
//[SP] Added (x*player->mo->ViewBob) to allow DECORATE changes to view bobbing speed.
if (still) if (still)
{ {
if (player->health > 0) if (player->health > 0)
{ {
angle = level.time / (120 * TICRATE / 35.) * 360. * player->mo->ViewBob; angle = level.time / (120 * TICRATE / 35.) * 360.;
bob = player->userinfo.GetStillBob() * angle.Sin(); bob = player->userinfo.GetStillBob() * angle.Sin();
} }
else else
@ -1860,7 +1859,7 @@ void P_CalcHeight (player_t *player)
} }
else else
{ {
angle = level.time / (20 * TICRATE / 35.) * 360. * player->mo->ViewBob; angle = level.time / (20 * TICRATE / 35.) * 360.;
bob = player->bob * angle.Sin() * (player->mo->waterlevel > 1 ? 0.25f : 0.5f); bob = player->bob * angle.Sin() * (player->mo->waterlevel > 1 ? 0.25f : 0.5f);
} }
@ -1893,7 +1892,7 @@ void P_CalcHeight (player_t *player)
{ {
bob = 0; bob = 0;
} }
player->viewz = player->mo->Z() + player->viewheight + bob; player->viewz = player->mo->Z() + player->viewheight + (bob * player->mo->ViewBob); // [SP] Allow DECORATE changes to view bobbing speed.
if (player->mo->Floorclip && player->playerstate != PST_DEAD if (player->mo->Floorclip && player->playerstate != PST_DEAD
&& player->mo->Z() <= player->mo->floorz) && player->mo->Z() <= player->mo->floorz)
{ {