1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Remove unnecessary currentmenuoption reassignments

Now that recreating the same menu keeps currentmenuoption, we can remove
all these superfluous assignments. This means repeating ourselves less;
in case the option numbers change in the future, we won't have to
remember to update these reassignments, too.
This commit is contained in:
Misa 2021-03-05 00:50:26 -08:00 committed by Ethan Lee
parent ac04281a9f
commit 37947814aa
2 changed files with 0 additions and 29 deletions

View file

@ -6196,13 +6196,7 @@ void Game::returntomenu(enum Menu::MenuName t)
{
if (currentmenuname == t)
{
//Re-create the menu
int keep_menu_option = currentmenuoption;
createmenu(t, true);
if (keep_menu_option < (int) menuoptions.size())
{
currentmenuoption = keep_menu_option;
}
return;
}

View file

@ -388,7 +388,6 @@ static void menuactionpress(void)
// Recreate menu to update "resize to nearest"
game.createmenu(game.currentmenuname, true);
game.currentmenuoption = 0;
game.savestatsandsettings_menu();
break;
@ -492,7 +491,6 @@ static void menuactionpress(void)
game.slowdown = 30;
music.playef(11);
game.returnmenu();
game.currentmenuoption = 4;
map.nexttowercolour();
game.savestatsandsettings_menu();
break;
@ -500,7 +498,6 @@ static void menuactionpress(void)
game.slowdown = 24;
music.playef(11);
game.returnmenu();
game.currentmenuoption = 4;
map.nexttowercolour();
game.savestatsandsettings_menu();
break;
@ -508,7 +505,6 @@ static void menuactionpress(void)
game.slowdown = 18;
music.playef(11);
game.returnmenu();
game.currentmenuoption = 4;
map.nexttowercolour();
game.savestatsandsettings_menu();
break;
@ -516,7 +512,6 @@ static void menuactionpress(void)
game.slowdown = 12;
music.playef(11);
game.returnmenu();
game.currentmenuoption = 4;
map.nexttowercolour();
game.savestatsandsettings_menu();
break;
@ -783,7 +778,6 @@ static void menuactionpress(void)
game.unlocknotify[9] = true;
music.playef(11);
game.createmenu(Menu::unlockmenutrials, true);
game.currentmenuoption = 0;
game.savestatsandsettings_menu();
break;
case 1: //unlock 2
@ -791,7 +785,6 @@ static void menuactionpress(void)
game.unlocknotify[10] = true;
music.playef(11);
game.createmenu(Menu::unlockmenutrials, true);
game.currentmenuoption = 1;
game.savestatsandsettings_menu();
break;
case 2: //unlock 3
@ -799,7 +792,6 @@ static void menuactionpress(void)
game.unlocknotify[11] = true;
music.playef(11);
game.createmenu(Menu::unlockmenutrials, true);
game.currentmenuoption = 2;
game.savestatsandsettings_menu();
break;
case 3: //unlock 4
@ -807,7 +799,6 @@ static void menuactionpress(void)
game.unlocknotify[12] = true;
music.playef(11);
game.createmenu(Menu::unlockmenutrials, true);
game.currentmenuoption = 3;
game.savestatsandsettings_menu();
break;
case 4: //unlock 5
@ -815,7 +806,6 @@ static void menuactionpress(void)
game.unlocknotify[13] = true;
music.playef(11);
game.createmenu(Menu::unlockmenutrials, true);
game.currentmenuoption = 4;
game.savestatsandsettings_menu();
break;
case 5: //unlock 6
@ -823,7 +813,6 @@ static void menuactionpress(void)
game.unlocknotify[14] = true;
music.playef(11);
game.createmenu(Menu::unlockmenutrials, true);
game.currentmenuoption = 5;
game.savestatsandsettings_menu();
break;
case 6: //back
@ -851,7 +840,6 @@ static void menuactionpress(void)
game.unlock[6] = true;
game.unlock[7] = true;
game.createmenu(Menu::unlockmenu, true);
game.currentmenuoption = 1;
game.savestatsandsettings_menu();
break;
case 2:
@ -860,7 +848,6 @@ static void menuactionpress(void)
game.unlock[17] = true;
game.unlocknotify[17] = true;
game.createmenu(Menu::unlockmenu, true);
game.currentmenuoption = 2;
game.savestatsandsettings_menu();
break;
case 3:
@ -869,7 +856,6 @@ static void menuactionpress(void)
game.unlock[18] = true;
game.unlocknotify[18] = true;
game.createmenu(Menu::unlockmenu, true);
game.currentmenuoption = 3;
game.savestatsandsettings_menu();
break;
case 4:
@ -877,7 +863,6 @@ static void menuactionpress(void)
music.playef(11);
game.stat_trinkets = 20;
game.createmenu(Menu::unlockmenu, true);
game.currentmenuoption = 4;
game.savestatsandsettings_menu();
break;
case 5:
@ -886,7 +871,6 @@ static void menuactionpress(void)
game.unlock[8] = true;
game.unlocknotify[8] = true;
game.createmenu(Menu::unlockmenu, true);
game.currentmenuoption = 5;
game.savestatsandsettings_menu();
break;
default:
@ -910,7 +894,6 @@ static void menuactionpress(void)
//last page
music.playef(11);
game.createmenu(Menu::credits6, true);
game.currentmenuoption = 1;
map.nexttowercolour();
break;
default:
@ -934,7 +917,6 @@ static void menuactionpress(void)
//previous page
music.playef(11);
game.createmenu(Menu::credits, true);
game.currentmenuoption = 1;
map.nexttowercolour();
break;
case 2:
@ -958,7 +940,6 @@ static void menuactionpress(void)
//previous page
music.playef(11);
game.createmenu(Menu::credits2, true);
game.currentmenuoption = 1;
map.nexttowercolour();
break;
default:
@ -1007,7 +988,6 @@ static void menuactionpress(void)
//There are more super patrons. Refresh the menu with the next ones
game.createmenu(Menu::credits3, true);
}
game.currentmenuoption = 1;
map.nexttowercolour();
break;
@ -1058,7 +1038,6 @@ static void menuactionpress(void)
//There are more patrons. Refresh the menu with the next ones
game.createmenu(Menu::credits4, true);
}
game.currentmenuoption = 1;
map.nexttowercolour();
break;
@ -1109,7 +1088,6 @@ static void menuactionpress(void)
//There are more GitHub contributors. Refresh the menu with the next ones
game.createmenu(Menu::credits5, true);
}
game.currentmenuoption = 1;
map.nexttowercolour();
break;
@ -1136,7 +1114,6 @@ static void menuactionpress(void)
music.playef(11);
game.current_credits_list_index = SDL_arraysize(Credits::githubfriends) - 1 - (SDL_arraysize(Credits::githubfriends)-1)%9;
game.createmenu(Menu::credits5, true);
game.currentmenuoption = 1;
map.nexttowercolour();
break;
default: