From 088426a654133afffe57f82832d202080847a3d5 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 11 Feb 2024 15:05:58 +0100 Subject: [PATCH] only interpolate those if we use the stuff that uses them --- src/r_fps.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/r_fps.c b/src/r_fps.c index 5a454c679..7045e17ee 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -298,11 +298,29 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out) out->x = R_LerpFixed(mobj->old_x, mobj->x, frac); out->y = R_LerpFixed(mobj->old_y, mobj->y, frac); out->z = R_LerpFixed(mobj->old_z, mobj->z, frac); - out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac); - out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac); - out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac); - out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac); - + + if (cv_gravstretch.value || cv_saltysquish.value) // for now we only use it for those two features so no need to interpolate this when we dont use stuff + { + out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac); + out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac); + } + else + { + out->spritexscale = mobj->spritexscale; + out->spriteyscale = mobj->spriteyscale; + } + + if (cv_saltyhop.value) // same here + { + out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac); + out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac); + } + else + { + out->spritexoffset = mobj->spritexoffset; + out->spriteyoffset = mobj->spriteyoffset; + } + if (mobj->scale == mobj->old_scale) // Tiny optimisation - scale is usually unchanging, so let's skip a lerp, two FixedMuls, and two FixedDivs { out->scale = mobj->scale; @@ -312,11 +330,6 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out) out->scale = R_LerpFixed(mobj->old_scale, mobj->scale, frac); } - // Sprite offsets are not interpolated until we have a way to interpolate them explicitly in Lua. - // It seems existing mods visually break more often than not if it is interpolated. - //out->spritexoffset = mobj->spritexoffset; - //out->spriteyoffset = mobj->spriteyoffset; - if (cv_mobjssector.value) out->subsector = R_PointInSubsector(out->x, out->y); else