1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-02 02:53:32 +02:00

Fix frame flickers when fading during loads/exits

This is because the fade delay did not last long enough.

I was under the mistaken impression that the fade animation lasts for 15
frames. However, this does not account for the fact that the offset of
each fade bar is dependent on RNG, and the worst case scenario is that
they have an offset of 96 pixels (in the opposite direction of the
fade).

The actual fade animation timer accounts for the worst case scenario, so
the fade animation actually lasts for (320 pixels plus 96 pixels is 416
pixels, 416 pixels divided by 24 pixels per frame equals 17.333...
frames, but since the actual timer keeps adding/subtracting 24 pixels
per frame until it passes the 416-pixel threshold, that gets rounded up
to...) 18 frames.

And an extra frame to make it so deltaframe interpolation doesn't
suddenly stop on the last deltaframes before the screen is completely
black.

I also need to draw the screen black on the map screen when glitchrunner
mode is off, if there's a fadeout going on. Else that would introduce
yet another frame flicker.
This commit is contained in:
Misa 2021-08-05 15:05:14 -07:00 committed by Ethan Lee
parent 90660d67a7
commit b9202dee8b
2 changed files with 8 additions and 4 deletions

View File

@ -283,7 +283,7 @@ static void startmode(const int mode)
gotomode = mode;
graphics.fademode = 2; /* fading out */
fadetomode = true;
fadetomodedelay = 16;
fadetomodedelay = 19;
}
static int* user_changing_volume = NULL;
@ -2531,7 +2531,7 @@ static void mapmenuactionpress(const bool version2_2)
if (!version2_2)
{
game.fadetomenu = true;
game.fadetomenudelay = 16;
game.fadetomenudelay = 19;
}
music.playef(11);
break;
@ -2549,7 +2549,7 @@ static void mapmenuactionpress(const bool version2_2)
if (!version2_2)
{
game.fadetolab = true;
game.fadetolabdelay = 16;
game.fadetolabdelay = 19;
}
music.playef(11);
break;

View File

@ -2714,7 +2714,11 @@ void maprender(void)
// We need to draw the black screen above the menu in order to disguise it
// being jankily brought down in glitchrunner mode when exiting to the title
// Otherwise, there's no reason to obscure the menu
if (GlitchrunnerMode_less_than_or_equal(Glitchrunner2_2) || graphics.fademode == 3 || graphics.fademode == 5)
if (GlitchrunnerMode_less_than_or_equal(Glitchrunner2_2)
|| graphics.fademode == 3
|| graphics.fademode == 5
|| game.fadetomenu
|| game.fadetolab)
{
graphics.drawfade();
}