diff --git a/src/p_setup.c b/src/p_setup.c index 9506905f2..3929c2aa7 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3383,8 +3383,8 @@ boolean P_SetupLevel(boolean skipprecip) G_AddMapToBuffer(gamemap-1); - R_ResetViewInterpolation(); - R_ResetViewInterpolation(); + R_ResetViewInterpolation(0); + R_ResetViewInterpolation(0); R_UpdateMobjInterpolators(); return true; diff --git a/src/p_user.c b/src/p_user.c index 81129f094..0de4fdb82 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7992,7 +7992,11 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } if (lookbackdown) + { P_MoveChaseCamera(player, thiscam, false); + R_ResetViewInterpolation(num + 1); + R_ResetViewInterpolation(num + 1); + } return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming); } diff --git a/src/r_fps.c b/src/r_fps.c index e50a51d6c..3d3258eb5 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -72,7 +72,7 @@ static viewvars_t skyview_old[MAXSPLITSCREENPLAYERS]; static viewvars_t skyview_new[MAXSPLITSCREENPLAYERS]; static viewvars_t *oldview = &pview_old[0]; -static int oldview_invalid = 0; +static int oldview_invalid[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0}; viewvars_t *newview = &pview_new[0]; @@ -141,12 +141,23 @@ void R_InterpolateView(fixed_t frac) { viewvars_t* prevview = oldview; boolean skybox = 0; + UINT8 i; + if (FIXED_TO_FLOAT(frac) < 0) frac = 0; if (frac > FRACUNIT) frac = FRACUNIT; - if (oldview_invalid != 0) + if (viewcontext >= VIEWCONTEXT_SKY1) + { + i = viewcontext - VIEWCONTEXT_SKY1; + } + else + { + i = viewcontext - VIEWCONTEXT_PLAYER1; + } + + if (oldview_invalid[i] != 0) { // interpolate from newview to newview prevview = newview; @@ -178,14 +189,25 @@ void R_UpdateViewInterpolation(void) { pview_old[i] = pview_new[i]; skyview_old[i] = skyview_new[i]; - } - if (oldview_invalid) oldview_invalid--; + if (oldview_invalid[i]) oldview_invalid[i]--; + } } -void R_ResetViewInterpolation(void) +void R_ResetViewInterpolation(UINT8 p) { - oldview_invalid++; + if (p == 0) + { + UINT8 i; + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) + { + oldview_invalid[i]++; + } + } + else + { + oldview_invalid[p - 1]++; + } } void R_SetViewContext(enum viewcontext_e _viewcontext) diff --git a/src/r_fps.h b/src/r_fps.h index 34a84eafe..7e64683fc 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -114,7 +114,7 @@ void R_InterpolateView(fixed_t frac); // Buffer the current new views into the old views. Call once after each real tic. void R_UpdateViewInterpolation(void); // Reset the view states (e.g. after level load) so R_InterpolateView doesn't interpolate invalid data -void R_ResetViewInterpolation(void); +void R_ResetViewInterpolation(UINT8 p); // Set the current view context (the viewvars pointed to by newview) void R_SetViewContext(enum viewcontext_e _viewcontext);