diff --git a/src/p_tick.c b/src/p_tick.c index 10270107f..217af3714 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -835,7 +835,7 @@ void P_PreTicker(INT32 frames) R_UpdateLevelInterpolators(); R_UpdateViewInterpolation(); - R_ResetViewInterpolation(); + R_ResetViewInterpolation(0); P_MapEnd(); } diff --git a/src/r_fps.c b/src/r_fps.c index 10e3cc10b..f3675ab97 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -83,7 +83,7 @@ static viewvars_t sky2view_old; static viewvars_t sky2view_new; static viewvars_t *oldview = &p1view_old; -static int oldview_invalid = 0; +static int oldview_invalid[MAXSPLITSCREENPLAYERS] = {0, 0}; viewvars_t *newview = &p1view_new; @@ -160,12 +160,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 || viewcontext == VIEWCONTEXT_PLAYER1) + { + i = 0; + } + else + { + i = 1; + } + + if (oldview_invalid[i] != 0) { // interpolate from newview to newview prevview = newview; @@ -201,12 +212,24 @@ void R_UpdateViewInterpolation(void) p2view_old = p2view_new; sky1view_old = sky1view_new; sky2view_old = sky2view_new; - if (oldview_invalid) oldview_invalid--; + if (oldview_invalid[0] > 0) oldview_invalid[0]--; + if (oldview_invalid[1] > 0) oldview_invalid[1]--; } -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 97d6022b7..85c87a2f4 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -118,7 +118,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);