mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
De-duplicate menu animation code when bringing up map screen
When bringing up the map screen, the game does a small menu animation where the menu comes in from the bottom. The code to calculate the menu offset is copy-pasted everywhere, so I thought I'd de-duplicate it to make my life easier when working with it. I also included the game.gamestate assignment in the de-duplicated function, so it would be easier for a future bugfix. At the same time, I'm also removing all the BlitSurfaceStandard()s that copied menubuffer to backBuffer. The red flag is that this blit happened for every single entry point to MAPMODE and TELEPORTERMODE, except for the script command gamemode(teleporter). Pressing Enter to bring up the map screen, pressing Enter to quit the Super Gravitron, pressing Esc to bring up the pause screen, and pressing Enter to bring up the teleporter screen all do this blit, so if this blit was there to fix a bug, then there's a bug with using the script command gamemode(teleporter)... but, as far as I can tell, there isn't. That's because the blit basically does nothing. All the blit does is copy menubuffer onto backBuffer. Then the next thing that happens is that either maprender() or teleporterrender() will be called, and the first thing that those functions will always do is fill backBuffer with solid black, completely overriding the previous blit. So that's why removing this blit won't have any effect, and it can be safely removed for code clarity.
This commit is contained in:
@@ -7146,3 +7146,16 @@ void Game::unlockAchievement(const char *name) {
|
||||
if (!map.custommode) NETWORK_unlockAchievement(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Game::mapmenuchange(const int newgamestate)
|
||||
{
|
||||
gamestate = newgamestate;
|
||||
graphics.resumegamemode = false;
|
||||
|
||||
graphics.menuoffset = 240;
|
||||
if (map.extrarow)
|
||||
{
|
||||
graphics.menuoffset -= 10;
|
||||
}
|
||||
graphics.oldmenuoffset = graphics.menuoffset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user