mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 15:22:20 +00:00
Fix lookback interpolating
This commit is contained in:
parent
b5b2810838
commit
d45390f617
4 changed files with 35 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
34
src/r_fps.c
34
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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue