fix weapon bobbing interpolation at the start of the level

This commit is contained in:
Roman Fomin 2022-05-25 17:42:59 +07:00
parent 1d4c8b2b0d
commit bf9a63b090

View File

@ -777,18 +777,23 @@ void R_DrawPSprite (pspdef_t *psp)
x1_saved = vis->x1; x1_saved = vis->x1;
texturemid_saved = vis->texturemid; texturemid_saved = vis->texturemid;
if (lump == oldlump) // Do not interpolate on the first tic of the level,
// otherwise oldx1 and oldtexturemid are not reset
if (leveltime > 1)
{ {
int deltax = vis->x2 - vis->x1; if (lump == oldlump)
vis->x1 = oldx1 + FixedMul(vis->x1 - oldx1, fractionaltic); {
vis->x2 = vis->x1 + deltax; int deltax = vis->x2 - vis->x1;
vis->texturemid = oldtexturemid + FixedMul(vis->texturemid - oldtexturemid, fractionaltic); vis->x1 = oldx1 + FixedMul(vis->x1 - oldx1, fractionaltic);
} vis->x2 = vis->x1 + deltax;
else vis->texturemid = oldtexturemid + FixedMul(vis->texturemid - oldtexturemid, fractionaltic);
{ }
oldx1 = vis->x1; else
oldtexturemid = vis->texturemid; {
oldlump = lump; oldx1 = vis->x1;
oldtexturemid = vis->texturemid;
oldlump = lump;
}
} }
} }