From 1b9a9c4f17c56bbde5bbe213926d7bb892036756 Mon Sep 17 00:00:00 2001 From: pionere Date: Tue, 17 Dec 2024 11:36:34 +0100 Subject: [PATCH] do not render intermediate cutscene-steps in case the progression is too fast --- Source/interfac.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/interfac.cpp b/Source/interfac.cpp index 5219015b009..35cb020fa40 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -4,6 +4,7 @@ * Implementation of load screens. */ #include "all.h" +#include "utils/display.h" #include "engine/render/cel_render.h" #include "engine/render/text_render.h" @@ -13,7 +14,8 @@ DEVILUTION_BEGIN_NAMESPACE CelImageBuf* sgpBackCel; /** Counter to maintain the status of the level-change. */ unsigned sgdwProgress; - +/** Specifies the next tick-count to draw the cutscene and progress bar. */ +static Uint32 sgdwNextCut; /** Specifies whether the progress bar is drawn on top or at the bottom of the image. */ static BOOLEAN sgbLoadBarOnTop; /** Color of the progress bar. */ @@ -137,6 +139,12 @@ static void DrawProgress() static void DrawCutscene() { + Uint32 now = SDL_GetTicks(); + if (sgdwProgress > 0 && sgdwProgress < BAR_WIDTH && now < sgdwNextCut) { + return; // skip drawing if the progression is too fast + } + sgdwNextCut = now + gnRefreshDelay; // calculate the next tick to draw the cutscene + lock_buf(1); if (sgdwProgress == 0) CelDraw(PANEL_X, PANEL_Y + PANEL_HEIGHT - 1, sgpBackCel, 1);