1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-24 13:38:29 +02:00

Save BG vars to temp vars when entering menu and revert them upon exit

Since the exact same tower background is also used on the menu, we need
to save the current state of the background when entering the menu
(before overwriting it), and then put it back when we're done. Maybe we
ought to separate the in-game and menu tower backgrounds...

This also fixes a semi-hilarious bug where you could make Panic Room go
in the other direction by simply going to the options menu in-game.

This is accomplished by adding convenience functions
mapclass::bg_to_kludge() and mapclass::kludge_to_bg().
This commit is contained in:
Misa 2020-06-22 17:14:01 -07:00 committed by Ethan Lee
parent 46d1e4053e
commit 75326ca2ee
2 changed files with 20 additions and 0 deletions

View File

@ -380,6 +380,7 @@ void menuactionpress()
{
game.ingame_titlemode = false;
game.gamestate = MAPMODE;
map.kludge_to_bg();
}
else
{
@ -594,6 +595,7 @@ void menuactionpress()
{
game.ingame_titlemode = false;
game.gamestate = MAPMODE;
map.kludge_to_bg();
}
else
{
@ -2119,6 +2121,8 @@ void mapmenuactionpress()
{
game.createmenu(Menu::options);
}
map.bg_to_kludge();
map.nexttowercolour();
map.scrolldir = 0;

View File

@ -168,6 +168,22 @@ public:
//Map cursor
int cursorstate, cursordelay;
int kludge_bypos;
int kludge_colstate;
int kludge_scrolldir;
void inline bg_to_kludge()
{
kludge_bypos = bypos;
kludge_colstate = colstate;
kludge_scrolldir = scrolldir;
}
void inline kludge_to_bg()
{
bypos = kludge_bypos;
colstate = kludge_colstate;
scrolldir = kludge_scrolldir;
}
};
extern mapclass map;