From 4e71ec9d46cedcc2b0678c8da82090e2cc40df5b Mon Sep 17 00:00:00 2001 From: Boondorl Date: Sat, 14 Jun 2025 09:47:48 -0400 Subject: [PATCH] Fixed camera interpolating when using outdated information If it's been more than a tick since the last render then disable interpolation as the data for the Actor at this point is likely too outdated. Also fixes quaking while the console and menu are open. --- src/rendering/r_utility.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/rendering/r_utility.cpp b/src/rendering/r_utility.cpp index adc3df2f1..ab0a8c6e6 100644 --- a/src/rendering/r_utility.cpp +++ b/src/rendering/r_utility.cpp @@ -922,6 +922,8 @@ static void R_DoActorTickerAngleChanges(player_t* const player, DRotator& angles EXTERN_CVAR(Float, chase_dist) EXTERN_CVAR(Float, chase_height) +int WorldPaused(); + void R_SetupFrame(FRenderViewpoint& viewPoint, const FViewWindow& viewWindow, AActor* const actor) { viewPoint.TicFrac = I_GetTimeFrac(); @@ -958,8 +960,17 @@ void R_SetupFrame(FRenderViewpoint& viewPoint, const FViewWindow& viewWindow, AA iView->AngleOffsets.Zero(); if (iView->prevTic != -1 && curTic > iView->prevTic) { - iView->prevTic = curTic; - iView->Old = iView->New; + // If it's been more than a tic since it was rendered, don't interpolate + // from whatever last position it had (it's probably no longer valid). + if (curTic - iView->prevTic > 1) + { + iView->prevTic = -1; + } + else + { + iView->prevTic = curTic; + iView->Old = iView->New; + } } const auto& mainView = r_viewpoint; @@ -1034,7 +1045,7 @@ void R_SetupFrame(FRenderViewpoint& viewPoint, const FViewWindow& viewWindow, AA viewPoint.sector = viewPoint.ViewLevel->PointInRenderSubsector(camPos)->sector; } - if (!paused) + if (!WorldPaused()) { FQuakeJiggers jiggers; if (DEarthquake::StaticGetQuakeIntensities(viewPoint.TicFrac, viewPoint.camera, jiggers) > 0)