Skip to content

Commit

Permalink
do not render intermediate cutscene-steps in case the progression is …
Browse files Browse the repository at this point in the history
…too fast
  • Loading branch information
pionere committed Dec 17, 2024
1 parent 05cdc61 commit 1b9a9c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/interfac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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. */
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1b9a9c4

Please sign in to comment.