1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 18:19:43 +01: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; crewframe = 0;
crewframedelay = 4; crewframedelay = 4;
menuoffset = 0; menuoffset = 0;
oldmenuoffset = 0;
resumegamemode = false; resumegamemode = false;
//Fading stuff //Fading stuff
@ -2609,6 +2610,7 @@ void Graphics::menuoffrender()
int usethisoffset = lerp(oldmenuoffset, menuoffset);
if(flipmode) if(flipmode)
{ {
// flipmatrix.translate(0, menuoffset); // flipmatrix.translate(0, menuoffset);
@ -2620,7 +2622,7 @@ void Graphics::menuoffrender()
BlitSurfaceStandard(tempbufferFlipped, NULL, backBuffer, NULL); BlitSurfaceStandard(tempbufferFlipped, NULL, backBuffer, NULL);
SDL_FreeSurface(tempbufferFlipped); SDL_FreeSurface(tempbufferFlipped);
SDL_Rect offsetRect; SDL_Rect offsetRect;
setRect (offsetRect, 0, menuoffset, backBuffer->w ,backBuffer->h); setRect (offsetRect, 0, usethisoffset, backBuffer->w ,backBuffer->h);
SDL_Surface* temp = FlipSurfaceVerticle(menubuffer); SDL_Surface* temp = FlipSurfaceVerticle(menubuffer);
BlitSurfaceStandard(temp,NULL,backBuffer,&offsetRect); BlitSurfaceStandard(temp,NULL,backBuffer,&offsetRect);
SDL_FreeSurface(temp); SDL_FreeSurface(temp);
@ -2631,7 +2633,7 @@ void Graphics::menuoffrender()
BlitSurfaceStandard(tempBuffer, NULL, backBuffer, NULL); BlitSurfaceStandard(tempBuffer, NULL, backBuffer, NULL);
SDL_Rect offsetRect; SDL_Rect offsetRect;
setRect (offsetRect, 0, menuoffset, backBuffer->w ,backBuffer->h); setRect (offsetRect, 0, usethisoffset, backBuffer->w ,backBuffer->h);
BlitSurfaceStandard(menubuffer,NULL,backBuffer,&offsetRect); BlitSurfaceStandard(menubuffer,NULL,backBuffer,&offsetRect);
} }

View file

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

View file

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

View file

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

View file

@ -1277,7 +1277,12 @@ void scriptclass::run()
//TODO this draw the teleporter screen. This is a problem. :( //TODO this draw the teleporter screen. This is a problem. :(
game.gamestate = TELEPORTERMODE; game.gamestate = TELEPORTERMODE;
graphics.menuoffset = 240; //actually this should count the roomname 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; graphics.resumegamemode = false;