mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Turn game.currentmenuname "else-if"s into case-switches
Much more stylistic, you don't need to repeat "game.currentmenuname" for each case, and you don't need to deal with the dangling first "if" that doesn't have an "else".
This commit is contained in:
@@ -112,8 +112,9 @@ void updatebuttonmappings(int bind)
|
||||
|
||||
void menuactionpress()
|
||||
{
|
||||
if (game.currentmenuname == Menu::mainmenu)
|
||||
switch (game.currentmenuname)
|
||||
{
|
||||
case Menu::mainmenu:
|
||||
#if defined(MAKEANDPLAY)
|
||||
#define MPOFFSET -1
|
||||
#else
|
||||
@@ -189,10 +190,9 @@ void menuactionpress()
|
||||
#undef NOCUSTOMSOFFSET
|
||||
#undef MPOFFSET
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
else if(game.currentmenuname==Menu::levellist)
|
||||
{
|
||||
case Menu::levellist:
|
||||
if(game.currentmenuoption==(int)game.menuoptions.size()-1){
|
||||
//go back to menu
|
||||
music.playef(11);
|
||||
@@ -227,10 +227,9 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
else if(game.currentmenuname==Menu::quickloadlevel)
|
||||
{
|
||||
case Menu::quickloadlevel:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0: //continue save
|
||||
@@ -248,10 +247,9 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if !defined(NO_CUSTOM_LEVELS)
|
||||
else if(game.currentmenuname==Menu::playerworlds)
|
||||
{
|
||||
case Menu::playerworlds:
|
||||
#if defined(NO_EDITOR)
|
||||
#define OFFSET -1
|
||||
#else
|
||||
@@ -295,15 +293,14 @@ void menuactionpress()
|
||||
break;
|
||||
}
|
||||
#undef OFFSET
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
else if(game.currentmenuname==Menu::errornostart){
|
||||
case Menu::errornostart:
|
||||
music.playef(11);
|
||||
game.createmenu(Menu::mainmenu);
|
||||
map.nexttowercolour();
|
||||
}
|
||||
else if (game.currentmenuname == Menu::graphicoptions)
|
||||
{
|
||||
break;
|
||||
case Menu::graphicoptions:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -359,9 +356,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::youwannaquit)
|
||||
{
|
||||
break;
|
||||
case Menu::youwannaquit:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -375,9 +371,8 @@ void menuactionpress()
|
||||
game.createmenu(game.previousmenuname);
|
||||
map.nexttowercolour();
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::setinvincibility)
|
||||
{
|
||||
break;
|
||||
case Menu::setinvincibility:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -396,9 +391,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::setslowdown1)
|
||||
{
|
||||
break;
|
||||
case Menu::setslowdown1:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -417,9 +411,8 @@ void menuactionpress()
|
||||
music.playef(11);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::setslowdown2)
|
||||
{
|
||||
break;
|
||||
case Menu::setslowdown2:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -460,9 +453,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::accessibility)
|
||||
{
|
||||
break;
|
||||
case Menu::accessibility:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -531,8 +523,8 @@ void menuactionpress()
|
||||
music.playef(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::options)
|
||||
break;
|
||||
case Menu::options:
|
||||
{
|
||||
#if defined(MAKEANDPLAY)
|
||||
#define OFFSET -1
|
||||
@@ -592,9 +584,9 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
}
|
||||
#undef OFFSET
|
||||
break;
|
||||
}
|
||||
else if (game.currentmenuname == Menu::unlockmenutrials)
|
||||
{
|
||||
case Menu::unlockmenutrials:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0: //unlock 1
|
||||
@@ -652,9 +644,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::unlockmenu)
|
||||
{
|
||||
break;
|
||||
case Menu::unlockmenu:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -716,9 +707,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::credits)
|
||||
{
|
||||
break;
|
||||
case Menu::credits:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -734,9 +724,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::credits2)
|
||||
{
|
||||
break;
|
||||
case Menu::credits2:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -752,9 +741,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::credits25)
|
||||
{
|
||||
break;
|
||||
case Menu::credits25:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -770,9 +758,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::credits3)
|
||||
{
|
||||
break;
|
||||
case Menu::credits3:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -802,9 +789,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::credits4)
|
||||
{
|
||||
break;
|
||||
case Menu::credits4:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -834,9 +820,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::credits5)
|
||||
{
|
||||
break;
|
||||
case Menu::credits5:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -866,9 +851,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::credits6)
|
||||
{
|
||||
break;
|
||||
case Menu::credits6:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -885,8 +869,8 @@ void menuactionpress()
|
||||
music.niceplay(6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::play)
|
||||
break;
|
||||
case Menu::play:
|
||||
{
|
||||
//Do we have the Secret Lab option?
|
||||
int offset = game.unlock[8] ? 0 : -1;
|
||||
@@ -946,9 +930,9 @@ void menuactionpress()
|
||||
game.createmenu(Menu::mainmenu);
|
||||
map.nexttowercolour();
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (game.currentmenuname == Menu::newgamewarning)
|
||||
{
|
||||
case Menu::newgamewarning:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -965,10 +949,9 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
else if (game.currentmenuname == Menu::controller)
|
||||
{
|
||||
case Menu::controller:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -985,9 +968,8 @@ void menuactionpress()
|
||||
game.createmenu(Menu::options);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::cleardatamenu)
|
||||
{
|
||||
break;
|
||||
case Menu::cleardatamenu:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -1008,9 +990,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::playmodes)
|
||||
{
|
||||
break;
|
||||
case Menu::playmodes:
|
||||
if (game.currentmenuoption == 0 && game.slowdown == 30 && !map.invincibility) //go to the time trial menu
|
||||
{
|
||||
music.playef(11);
|
||||
@@ -1050,9 +1031,8 @@ void menuactionpress()
|
||||
//Can't do yet! play sad sound
|
||||
music.playef(2);
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::startnodeathmode)
|
||||
{
|
||||
break;
|
||||
case Menu::startnodeathmode:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0: //start no death mode, disabling cutscenes
|
||||
@@ -1070,9 +1050,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::continuemenu)
|
||||
{
|
||||
break;
|
||||
case Menu::continuemenu:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -1090,9 +1069,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::intermissionmenu)
|
||||
{
|
||||
break;
|
||||
case Menu::intermissionmenu:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -1114,9 +1092,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::playint1)
|
||||
{
|
||||
break;
|
||||
case Menu::playint1:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -1142,9 +1119,8 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::playint2)
|
||||
{
|
||||
break;
|
||||
case Menu::playint2:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -1170,28 +1146,25 @@ void menuactionpress()
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::gameover2)
|
||||
{
|
||||
break;
|
||||
case Menu::gameover2:
|
||||
//back
|
||||
music.playef(11);
|
||||
music.play(6);
|
||||
game.createmenu(Menu::mainmenu);
|
||||
map.nexttowercolour();
|
||||
}
|
||||
else if (game.currentmenuname == Menu::unlocktimetrials
|
||||
|| game.currentmenuname == Menu::unlocktimetrial
|
||||
|| game.currentmenuname == Menu::unlocknodeathmode
|
||||
|| game.currentmenuname == Menu::unlockintermission
|
||||
|| game.currentmenuname == Menu::unlockflipmode)
|
||||
{
|
||||
break;
|
||||
case Menu::unlocktimetrials:
|
||||
case Menu::unlocktimetrial:
|
||||
case Menu::unlocknodeathmode:
|
||||
case Menu::unlockintermission:
|
||||
case Menu::unlockflipmode:
|
||||
//back
|
||||
music.playef(11);
|
||||
game.createmenu(Menu::play);
|
||||
map.nexttowercolour();
|
||||
}
|
||||
else if (game.currentmenuname == Menu::timetrials)
|
||||
{
|
||||
break;
|
||||
case Menu::timetrials:
|
||||
if (game.currentmenuoption == 0 && game.unlock[9]) //space station 1
|
||||
{
|
||||
game.mainmenu = 3;
|
||||
@@ -1234,9 +1207,8 @@ void menuactionpress()
|
||||
//Can't do yet! play sad sound
|
||||
music.playef(2);
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::timetrialcomplete3)
|
||||
{
|
||||
break;
|
||||
case Menu::timetrialcomplete3:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
@@ -1280,13 +1252,16 @@ void menuactionpress()
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (game.currentmenuname == Menu::gamecompletecontinue || game.currentmenuname == Menu::nodeathmodecomplete2)
|
||||
{
|
||||
break;
|
||||
case Menu::gamecompletecontinue:
|
||||
case Menu::nodeathmodecomplete2:
|
||||
music.play(6);
|
||||
music.playef(11);
|
||||
game.createmenu(Menu::play);
|
||||
map.nexttowercolour();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user