From 2162e5142458c393037b6c80e71731c3c72c144e Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 14 Mar 2023 21:44:28 +1100 Subject: [PATCH] - Blood: Amend how QAVs process when game is paused. * Repair of initial implementation in ebdc9c31f29e25a315c524061cdc5fd7a27704e5. * Fixes #883. --- source/games/blood/src/qav.cpp | 46 ++++++++++++++++------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/source/games/blood/src/qav.cpp b/source/games/blood/src/qav.cpp index a6917648a..5450a0b20 100644 --- a/source/games/blood/src/qav.cpp +++ b/source/games/blood/src/qav.cpp @@ -309,9 +309,8 @@ void qavProcessTicker(QAV* const pQAV, int* duration, int* lastTick) { if (*duration > 0) { - auto thisTick = I_GetTime(pQAV->ticrate); - auto numTicks = thisTick - (*lastTick); - if (numTicks) + const auto thisTick = I_GetTime(pQAV->ticrate); + if (const auto numTicks = thisTick - (*lastTick)) { *lastTick = thisTick; *duration -= pQAV->ticksPerFrame * numTicks; @@ -328,35 +327,34 @@ void qavProcessTicker(QAV* const pQAV, int* duration, int* lastTick) void qavProcessTimer(PLAYER* const pPlayer, QAV* const pQAV, int* duration, double* interpfrac, bool const fixedduration, bool const ignoreWeaponTimer) { - // Process if not paused. + // Process clock based on QAV's ticrate and last tick value. if (!paused) { - // Process clock based on QAV's ticrate and last tick value. qavProcessTicker(pQAV, &pPlayer->qavTimer, &pPlayer->qavLastTick); - - if (pPlayer->weaponTimer == 0 && pPlayer->qavTimer == 0 && !ignoreWeaponTimer) - { - // Check if we're playing an idle QAV as per the ticker's weapon timer. - *duration = fixedduration ? pQAV->duration - 1 : I_GetBuildTime() % pQAV->duration; - *interpfrac = 1.; - } - else if (pPlayer->qavTimer == 0) - { - // If qavTimer is 0, play the last frame uninterpolated. Sometimes the timer can be just ahead of weaponTimer. - *duration = pQAV->duration - 1; - *interpfrac = 1.; - } - else - { - // Apply normal values. - *duration = pQAV->duration - pPlayer->qavTimer; - *interpfrac = !cl_interpolate || cl_capfps ? 1. : I_GetTimeFrac(pQAV->ticrate); - } } else { + pPlayer->qavLastTick = I_GetTime(pQAV->ticrate); + } + + if (pPlayer->weaponTimer == 0 && pPlayer->qavTimer == 0 && !ignoreWeaponTimer) + { + // Check if we're playing an idle QAV as per the ticker's weapon timer. + *duration = fixedduration ? pQAV->duration - 1 : I_GetBuildTime() % pQAV->duration; *interpfrac = 1.; } + else if (pPlayer->qavTimer == 0) + { + // If qavTimer is 0, play the last frame uninterpolated. Sometimes the timer can be just ahead of weaponTimer. + *duration = pQAV->duration - 1; + *interpfrac = 1.; + } + else + { + // Apply normal values. + *duration = pQAV->duration - pPlayer->qavTimer; + *interpfrac = !cl_interpolate || cl_capfps || paused ? 1. : I_GetTimeFrac(pQAV->ticrate); + } }