From 454850d3492a8e374edb87f297df696544b03661 Mon Sep 17 00:00:00 2001 From: "James R." Date: Sun, 1 Oct 2023 17:53:34 -0700 Subject: [PATCH] ST_CalculateFadeIn: do not interpolate at very beginning or end of fade --- src/st_stuff.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index a0dd6e984..153e2a48b 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1451,8 +1451,15 @@ static fixed_t ST_CalculateFadeIn(player_t *player) if (player->tally.hudSlide != 0) { tic_t timer = length - player->tally.hudSlide; + fixed_t f = timer * FRACUNIT; - return ((timer * FRACUNIT) + (FRACUNIT - rendertimefrac)) / length; + // Not interpolated at very beginning or end + if (timer > 0 && timer < length) + { + f += FRACUNIT - rendertimefrac; + } + + return f / length; } tic_t timer = lt_exitticker; @@ -1467,9 +1474,18 @@ static fixed_t ST_CalculateFadeIn(player_t *player) if (timer < length) { - return ((timer * FRACUNIT) + rendertimefrac) / length; + fixed_t f = timer * FRACUNIT; + + // Not interpolated at very beginning + if (timer > 0) + { + f += rendertimefrac; + } + + return f / length; } + // Not interpolated at very end return FRACUNIT; }