mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-24 04:29:34 -04:00
interpolation for weapon bobbing from PrBoom+ (#554)
This commit is contained in:
parent
aee87ebe09
commit
c953d919e6
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user