make the condition to start a new sequence less critical

In paticular, if less time than required for a full shading sequence has passed,
don't start a new one. This allows to skip a gametic between two rendered frames,
which apparently happens sometimes.
This commit is contained in:
Fabian Greffrath 2022-11-28 20:10:44 +01:00
parent a63e16b14c
commit b3ff45d15c

View File

@ -862,12 +862,12 @@ void V_ShadeScreen(void)
{ {
int y; int y;
byte *dest = screens[0]; byte *dest = screens[0];
const int targshade = 20; const int targshade = 20, step = 2;
static int oldtic = -1; static int oldtic = -1;
static int screenshade; static int screenshade;
// [FG] more than one tic ago, start a new sequence // [FG] start a new sequence
if (gametic - oldtic > 1) if (gametic - oldtic > targshade / step)
{ {
screenshade = 0; screenshade = 0;
} }
@ -879,7 +879,7 @@ void V_ShadeScreen(void)
if (screenshade < targshade && gametic != oldtic) if (screenshade < targshade && gametic != oldtic)
{ {
screenshade += 2; screenshade += step;
if (screenshade > targshade) if (screenshade > targshade)
screenshade = targshade; screenshade = targshade;