interpolation for weapon bobbing from PrBoom+ (#554)

This commit is contained in:
Roman Fomin 2022-05-18 14:15:11 +07:00 committed by GitHub
parent aee87ebe09
commit c953d919e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -750,6 +750,39 @@ void R_DrawPSprite (pspdef_t *psp)
else
vis->colormap = spritelights[MAXLIGHTSCALE-1]; // local light
// interpolation for weapon bobbing
if (uncapped)
{
static int oldx1, x1_saved;
static fixed_t oldtexturemid, texturemid_saved;
static int oldlump = -1;
static int oldgametic = -1;
if (oldgametic < gametic)
{
oldx1 = x1_saved;
oldtexturemid = texturemid_saved;
oldgametic = gametic;
}
x1_saved = vis->x1;
texturemid_saved = vis->texturemid;
if (lump == oldlump)
{
int deltax = vis->x2 - vis->x1;
vis->x1 = oldx1 + FixedMul(vis->x1 - oldx1, fractionaltic);
vis->x2 = vis->x1 + deltax;
vis->texturemid = oldtexturemid + FixedMul(vis->texturemid - oldtexturemid, fractionaltic);
}
else
{
oldx1 = vis->x1;
oldtexturemid = vis->texturemid;
oldlump = lump;
}
}
R_DrawVisSprite(vis, vis->x1, vis->x2);
}