1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Interpolate bringing up and down quit/pause/teleporter screen

Now it's really, really smooth. Except for like the last frame when it
goes down, which I sometimes didn't notice (but maybe it didn't happen
every time due to being lucky on the delta timesteps or something,
whatevs.)
This commit is contained in:
Misa 2020-04-28 20:46:33 -07:00 committed by Ethan Lee
parent 45c7292096
commit 3b41721563
5 changed files with 36 additions and 7 deletions

View File

@ -84,6 +84,7 @@ void Graphics::init()
crewframe = 0;
crewframedelay = 4;
menuoffset = 0;
oldmenuoffset = 0;
resumegamemode = false;
//Fading stuff
@ -2609,6 +2610,7 @@ void Graphics::menuoffrender()
int usethisoffset = lerp(oldmenuoffset, menuoffset);
if(flipmode)
{
// flipmatrix.translate(0, menuoffset);
@ -2620,7 +2622,7 @@ void Graphics::menuoffrender()
BlitSurfaceStandard(tempbufferFlipped, NULL, backBuffer, NULL);
SDL_FreeSurface(tempbufferFlipped);
SDL_Rect offsetRect;
setRect (offsetRect, 0, menuoffset, backBuffer->w ,backBuffer->h);
setRect (offsetRect, 0, usethisoffset, backBuffer->w ,backBuffer->h);
SDL_Surface* temp = FlipSurfaceVerticle(menubuffer);
BlitSurfaceStandard(temp,NULL,backBuffer,&offsetRect);
SDL_FreeSurface(temp);
@ -2631,7 +2633,7 @@ void Graphics::menuoffrender()
BlitSurfaceStandard(tempBuffer, NULL, backBuffer, NULL);
SDL_Rect offsetRect;
setRect (offsetRect, 0, menuoffset, backBuffer->w ,backBuffer->h);
setRect (offsetRect, 0, usethisoffset, backBuffer->w ,backBuffer->h);
BlitSurfaceStandard(menubuffer,NULL,backBuffer,&offsetRect);
}

View File

@ -255,6 +255,7 @@ public:
bool backgrounddrawn, foregrounddrawn;
int menuoffset;
int oldmenuoffset;
bool resumegamemode;
SDL_Rect warprect;

View File

@ -1625,7 +1625,12 @@ void gameinput()
//Alright, normal teleporting
game.gamestate = TELEPORTERMODE;
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
graphics.oldmenuoffset = 240;
if (map.extrarow)
{
graphics.menuoffset -= 10;
graphics.oldmenuoffset -= 10;
}
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
@ -1681,7 +1686,12 @@ void gameinput()
game.menupage = 20; // The Map Page
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
graphics.oldmenuoffset = 240;
if (map.extrarow)
{
graphics.menuoffset -= 10;
graphics.oldmenuoffset -= 10;
}
}
else if (game.intimetrial && graphics.fademode==0)
{
@ -1705,7 +1715,12 @@ void gameinput()
game.menupage = 0; // The Map Page
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
graphics.oldmenuoffset = 240;
if (map.extrarow)
{
graphics.menuoffset -= 10;
graphics.oldmenuoffset -= 10;
}
}
}
@ -1720,7 +1735,12 @@ void gameinput()
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
graphics.oldmenuoffset = 240;
if (map.extrarow)
{
graphics.menuoffset -= 10;
graphics.oldmenuoffset -= 10;
}
}
if (key.keymap[SDLK_r] && game.deathseq<=0)// && map.custommode) //Have fun glitchrunners!

View File

@ -40,6 +40,7 @@ void maplogic()
help.updateglow();
graphics.updatetextboxes();
graphics.oldmenuoffset = graphics.menuoffset;
if (graphics.resumegamemode)
{
graphics.menuoffset += 25;

View File

@ -1277,7 +1277,12 @@ void scriptclass::run()
//TODO this draw the teleporter screen. This is a problem. :(
game.gamestate = TELEPORTERMODE;
graphics.menuoffset = 240; //actually this should count the roomname
if (map.extrarow) graphics.menuoffset -= 10;
graphics.oldmenuoffset = 240;
if (map.extrarow)
{
graphics.menuoffset -= 10;
graphics.oldmenuoffset -= 10;
}
graphics.resumegamemode = false;