diff --git a/CHANGELOG.md b/CHANGELOG.md index 64537c591..aa488a6fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - **Blazing door sound fix not applying to Boom doors** - **Teleporter Zoom and BFG "explosion" shake affecting all players in multiplayer** - **Explosion shake being stopped by the menu during demo playback and netgames** +- **Choppy Chasecam speed effect when looking up or down** - **View snapping when teleporting to Automap pointer while crouching** - **View clipping through floor when landing while crouching** - **Fixed a demo desync** caused by a failed weapon autoswitch when picking up ammo diff --git a/src/p_map.c b/src/p_map.c index 6ade4f9fd..117669088 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1931,8 +1931,8 @@ void P_PositionChasecam(fixed_t z, fixed_t dist, fixed_t slope) const boolean intercepts_overflow_enabled = overflow[emu_intercepts].enabled; dist += FRACUNIT; - x2 = viewx + (dist >> FRACBITS) * finecosine[angle]; - y2 = viewy + (dist >> FRACBITS) * finesine[angle]; + x2 = viewx + FixedMul(dist, finecosine[angle]); + y2 = viewy + FixedMul(dist, finesine[angle]); shootz = z; attackrange = dist; aimslope = slope; diff --git a/src/r_main.c b/src/r_main.c index 5ddd74c4f..b5a5e6be4 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -924,8 +924,8 @@ void R_SetupFrame (player_t *player) const fixed_t z = MIN(playerz + ((player->mo->health <= 0 && player->playerstate == PST_DEAD) ? 6*FRACUNIT : chasecamheight), player->mo->ceilingz - (2*FRACUNIT)); fixed_t slope; - fixed_t dist = chasecam_distance*FRACUNIT; - const fixed_t oldviewx = viewx, oldviewy = viewy; + fixed_t dist = chasecam_distance * FRACUNIT; + const fixed_t oldviewx = viewx, oldviewy = viewy; const angle_t oldviewangle = viewangle; if (chasecam_mode == CHASECAMMODE_FRONT) @@ -961,15 +961,17 @@ void R_SetupFrame (player_t *player) viewz = chasecam.z; } else { - const fixed_t dx = FixedMul(dist, finecosine[viewangle >> ANGLETOFINESHIFT]); - const fixed_t dy = FixedMul(dist, finesine[viewangle >> ANGLETOFINESHIFT]); + const fixed_t dx = FixedMul(dist, finecosine[viewangle >> ANGLETOFINESHIFT]), + dy = FixedMul(dist, finesine[viewangle >> ANGLETOFINESHIFT]); + const sector_t *const sec = R_PointInSubsector(viewx-dx, viewy-dy)->sector; - viewz = z + (slope * (dist / FRACUNIT)); + viewz = z + FixedMul(slope, dist); if (viewz < sec->floorheight+FRACUNIT || sec->ceilingheight-FRACUNIT < viewz) { fixed_t frac; + viewz = BETWEEN(sec->floorheight+FRACUNIT, sec->ceilingheight-FRACUNIT, viewz); frac = FixedDiv(viewz - z, FixedMul(slope, dist)); viewx -= FixedMul(dx, frac);