1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-27 23:18:30 +02:00

Interpolate cutscene bars position

Cutscene bars will now smoothly fade in and out at above 30 FPS instead
of at 30 FPS only.
This commit is contained in:
Misa 2020-04-28 17:16:24 -07:00 committed by Ethan Lee
parent 6655ae418c
commit 2510d3a6ba
5 changed files with 13 additions and 4 deletions

View File

@ -3440,6 +3440,7 @@ void Game::updatestate()
map.finaly = 100; map.finaly = 100;
graphics.cutscenebarspos = 320; graphics.cutscenebarspos = 320;
graphics.oldcutscenebarspos = 320;
teleport_to_new_area = true; teleport_to_new_area = true;
teleportscript = "gamecomplete"; teleportscript = "gamecomplete";

View File

@ -33,6 +33,7 @@ void Graphics::init()
showcutscenebars = false; showcutscenebars = false;
cutscenebarspos = 0; cutscenebarspos = 0;
oldcutscenebarspos = 0;
notextoutline = false; notextoutline = false;
flipmode = false; flipmode = false;
@ -837,10 +838,11 @@ void Graphics::drawpartimage( int t, int xp, int yp, int wp, int hp)
void Graphics::cutscenebars() void Graphics::cutscenebars()
{ {
int usethispos = lerp(oldcutscenebarspos, cutscenebarspos);
if (showcutscenebars) if (showcutscenebars)
{ {
FillRect(backBuffer, 0, 0, cutscenebarspos, 16, 0x000000); FillRect(backBuffer, 0, 0, usethispos, 16, 0x000000);
FillRect(backBuffer, 360-cutscenebarspos, 224, cutscenebarspos, 16, 0x000000); FillRect(backBuffer, 360-usethispos, 224, usethispos, 16, 0x000000);
} }
else else
{ {
@ -848,14 +850,15 @@ void Graphics::cutscenebars()
if (cutscenebarspos > 0) if (cutscenebarspos > 0)
{ {
//draw //draw
FillRect(backBuffer, 0, 0, cutscenebarspos, 16, 0x000000); FillRect(backBuffer, 0, 0, usethispos, 16, 0x000000);
FillRect(backBuffer, 360-cutscenebarspos, 224, cutscenebarspos, 16, 0x000000); FillRect(backBuffer, 360-usethispos, 224, usethispos, 16, 0x000000);
} }
} }
} }
void Graphics::cutscenebarstimer() void Graphics::cutscenebarstimer()
{ {
oldcutscenebarspos = cutscenebarspos;
if (showcutscenebars) if (showcutscenebars)
{ {
cutscenebarspos += 25; cutscenebarspos += 25;

View File

@ -269,6 +269,7 @@ public:
bool showcutscenebars; bool showcutscenebars;
int cutscenebarspos; int cutscenebarspos;
int oldcutscenebarspos;
std::vector<SDL_Rect> stars; std::vector<SDL_Rect> stars;
std::vector<int> starsspeed; std::vector<int> starsspeed;

View File

@ -65,6 +65,7 @@ void gamecompletelogic()
//Fix some graphical things //Fix some graphical things
graphics.showcutscenebars = false; graphics.showcutscenebars = false;
graphics.cutscenebarspos = 0; graphics.cutscenebarspos = 0;
graphics.oldcutscenebarspos = 0;
map.scrolldir = 0; map.scrolldir = 0;
map.bypos = 0; map.bypos = 0;
//Return to game //Return to game

View File

@ -2593,6 +2593,7 @@ void scriptclass::startgamemode( int t )
game.jumpheld = true; game.jumpheld = true;
graphics.showcutscenebars = true; graphics.showcutscenebars = true;
graphics.cutscenebarspos = 320; graphics.cutscenebarspos = 320;
graphics.oldcutscenebarspos = 320;
//set flipmode //set flipmode
if (graphics.setflipmode) graphics.flipmode = true; if (graphics.setflipmode) graphics.flipmode = true;
@ -2849,6 +2850,7 @@ void scriptclass::startgamemode( int t )
game.jumpheld = true; game.jumpheld = true;
graphics.showcutscenebars = true; graphics.showcutscenebars = true;
graphics.cutscenebarspos = 320; graphics.cutscenebarspos = 320;
graphics.oldcutscenebarspos = 320;
//set flipmode //set flipmode
if (graphics.setflipmode) graphics.flipmode = true; if (graphics.setflipmode) graphics.flipmode = true;
@ -2876,6 +2878,7 @@ void scriptclass::startgamemode( int t )
game.jumpheld = true; game.jumpheld = true;
graphics.showcutscenebars = true; graphics.showcutscenebars = true;
graphics.cutscenebarspos = 320; graphics.cutscenebarspos = 320;
graphics.oldcutscenebarspos = 320;
//set flipmode //set flipmode
if (graphics.setflipmode) graphics.flipmode = true; if (graphics.setflipmode) graphics.flipmode = true;