1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-03 15:39:46 +01:00

Convert menu names to be an enum instead of being stringly-typed

Stringly-typed things are bad, because if you make a typo when typing
out a string, it's not caught at compile-time. And in the case of this
menu system, you'd have to do an excessive amount of testing to uncover
any bugs caused by a typo. Why do that when you can just use an enum and
catch compile-time errors instead?

Also, you can't use switch-case statements on stringly-typed variables.

So every menu name is now in the enum Menu::MenuName, but you can simply
refer to a menu name by just prefixing it with Menu::.

Unfortunately, I've had to change the "continue" menu name to be
"continuemenu", because "continue" is a keyword in C and C++. Also, it
looks like "timetrialcomplete4" is an unused menu name, even though it
was referenced in Render.cpp.
This commit is contained in:
Misa 2020-04-15 21:53:36 -07:00 committed by Ethan Lee
parent 83ca75a831
commit e8a07f9c3d
7 changed files with 324 additions and 269 deletions

View file

@ -224,16 +224,14 @@ void Game::init(void)
currentmenuoption = 0;
menuselection = "null";
currentmenuname = "null";
current_credits_list_index = 0;
menuxoff = 0;
menuyoff = 0;
menucountdown = 0;
menudest="null";
levelpage=0;
playcustomlevel=0;
customleveltitle="";
createmenu("mainmenu");
createmenu(Menu::mainmenu);
deathcounts = 0;
gameoverdelay = 0;
@ -1341,7 +1339,7 @@ void Game::updatestate()
graphics.backgrounddrawn = false;
map.tdrawback = true;
graphics.flipmode = false;
createmenu("mainmenu");
createmenu(Menu::mainmenu);
state = 0;
break;
@ -1396,7 +1394,7 @@ void Game::updatestate()
graphics.fademode = 4;
graphics.backgrounddrawn = true;
map.tdrawback = true;
createmenu("timetrialcomplete");
createmenu(Menu::timetrialcomplete);
state = 0;
break;
@ -2101,7 +2099,7 @@ void Game::updatestate()
}
}
#endif
createmenu("levellist");
createmenu(Menu::levellist);
state = 0;
break;
@ -3046,7 +3044,7 @@ void Game::updatestate()
graphics.fademode = 4;
graphics.backgrounddrawn = true;
map.tdrawback = true;
createmenu("play");
createmenu(Menu::play);
music.play(6);
state = 0;
break;
@ -3373,7 +3371,7 @@ void Game::updatestate()
graphics.fademode = 4;
graphics.backgrounddrawn = true;
map.tdrawback = true;
createmenu("nodeathmodecomplete");
createmenu(Menu::nodeathmodecomplete);
state = 0;
break;
@ -6545,7 +6543,7 @@ std::string Game::timetstring( int t )
return tempstring;
}
void Game::createmenu( std::string t )
void Game::createmenu( enum Menu::MenuName t )
{
currentmenuoption = 0;
menuselection = "null";
@ -6553,10 +6551,9 @@ void Game::createmenu( std::string t )
menuxoff = 0;
menuyoff = 0;
menucountdown = 0;
menudest="null";
menuoptions.clear();
if (t == "mainmenu")
if (t == Menu::mainmenu)
{
#if !defined(MAKEANDPLAY)
option("start game");
@ -6574,7 +6571,7 @@ void Game::createmenu( std::string t )
menuyoff = -10;
}
#if !defined(NO_CUSTOM_LEVELS)
else if (t == "playerworlds")
else if (t == Menu::playerworlds)
{
option("play a level");
#if !defined(NO_EDITOR)
@ -6585,7 +6582,7 @@ void Game::createmenu( std::string t )
menuxoff = -30;
menuyoff = -40;
}
else if (t == "levellist")
else if (t == Menu::levellist)
{
if(ed.ListOfMetaData.size()==0)
{
@ -6648,7 +6645,7 @@ void Game::createmenu( std::string t )
}
}
#endif
else if (t == "quickloadlevel")
else if (t == Menu::quickloadlevel)
{
option("continue from save");
option("start from beginning");
@ -6656,20 +6653,20 @@ void Game::createmenu( std::string t )
menuxoff = -40;
menuyoff = -30;
}
else if (t == "youwannaquit")
else if (t == Menu::youwannaquit)
{
option("yes, quit");
option("no, return");
menuxoff = 0;
menuyoff = -20;
}
else if (t == "errornostart")
else if (t == Menu::errornostart)
{
option("ok");
menuxoff = 0;
menuyoff = -20;
}
else if (t == "graphicoptions")
else if (t == Menu::graphicoptions)
{
option("toggle fullscreen");
option("toggle letterbox");
@ -6680,7 +6677,7 @@ void Game::createmenu( std::string t )
menuxoff = -50;
menuyoff = 8;
}
else if (t == "ed_settings")
else if (t == Menu::ed_settings)
{
option("change description");
option("edit scripts");
@ -6692,7 +6689,7 @@ void Game::createmenu( std::string t )
menuxoff = -50;
menuyoff = -20;
}
else if (t == "ed_desc")
else if (t == Menu::ed_desc)
{
option("change name");
option("change author");
@ -6703,14 +6700,14 @@ void Game::createmenu( std::string t )
menuxoff = -40;
menuyoff = 6;
}
else if (t == "ed_music")
else if (t == Menu::ed_music)
{
option("next song");
option("back");
menuxoff = -10;
menuyoff = 16;
}
else if (t == "ed_quit")
else if (t == Menu::ed_quit)
{
option("yes, save and quit");
option("no, quit without saving");
@ -6718,7 +6715,7 @@ void Game::createmenu( std::string t )
menuxoff = -50;
menuyoff = 8;
}
else if (t == "options")
else if (t == Menu::options)
{
option("accessibility options");
#if !defined(MAKEANDPLAY)
@ -6735,7 +6732,7 @@ void Game::createmenu( std::string t )
menuxoff = -40;
menuyoff = 0;
}
else if (t == "accessibility")
else if (t == Menu::accessibility)
{
option("animated backgrounds");
option("screen effects");
@ -6748,7 +6745,7 @@ void Game::createmenu( std::string t )
menuxoff = -85;
menuyoff = -10;
}
else if(t == "controller")
else if(t == Menu::controller)
{
option("analog stick sensitivity");
option("bind flip");
@ -6758,28 +6755,28 @@ void Game::createmenu( std::string t )
menuxoff = -40;
menuyoff = 10;
}
else if (t == "cleardatamenu")
else if (t == Menu::cleardatamenu)
{
option("no! don't delete");
option("yes, delete everything");
menuxoff = -30;
menuyoff = 64;
}
else if (t == "setinvincibility")
else if (t == Menu::setinvincibility)
{
option("no, return to options");
option("yes, enable");
menuxoff = -30;
menuyoff = 64;
}
else if (t == "setslowdown1")
else if (t == Menu::setslowdown1)
{
option("no, return to options");
option("yes, delete saves");
menuxoff = -30;
menuyoff = 64;
}
else if (t == "setslowdown2")
else if (t == Menu::setslowdown2)
{
option("normal speed");
option("80% speed");
@ -6788,7 +6785,7 @@ void Game::createmenu( std::string t )
menuxoff = -40;
menuyoff = 16;
}
else if (t == "unlockmenu")
else if (t == Menu::unlockmenu)
{
option("unlock time trials");
option("unlock intermissions", !unlock[16]);
@ -6800,56 +6797,56 @@ void Game::createmenu( std::string t )
menuxoff = -70;
menuyoff = -20;
}
else if (t == "credits")
else if (t == Menu::credits)
{
option("next page");
option("return");
menuxoff = 20;
menuyoff = 64;
}
else if (t == "credits2")
else if (t == Menu::credits2)
{
option("next page");
option("return");
menuxoff = 20;
menuyoff = 64;
}
else if (t == "credits25")
else if (t == Menu::credits25)
{
option("next page");
option("return");
menuxoff = 20;
menuyoff = 64;
}
else if (t == "credits3")
else if (t == Menu::credits3)
{
option("next page");
option("return");
menuxoff = 20;
menuyoff = 64;
}
else if (t == "credits4")
else if (t == Menu::credits4)
{
option("next page");
option("return");
menuxoff = 20;
menuyoff = 64;
}
else if (t == "credits5")
else if (t == Menu::credits5)
{
option("next page");
option("return");
menuxoff = 20;
menuyoff = 64;
}
else if (t == "credits6")
else if (t == Menu::credits6)
{
option("first page");
option("return");
menuxoff = 20;
menuyoff = 64;
}
else if (t == "play")
else if (t == Menu::play)
{
//Ok, here's where the unlock stuff comes into it:
//First up, time trials:
@ -6896,12 +6893,12 @@ void Game::createmenu( std::string t )
if (temp == 1)
{
createmenu("unlocktimetrial");
createmenu(Menu::unlocktimetrial);
savemystats = true;
}
else if (temp > 1)
{
createmenu("unlocktimetrials");
createmenu(Menu::unlocktimetrials);
savemystats = true;
}
}
@ -6920,7 +6917,7 @@ void Game::createmenu( std::string t )
//Unlock No Death Mode
unlocknotify[17] = true;
unlock[17] = true;
createmenu("unlocknodeathmode");
createmenu(Menu::unlocknodeathmode);
savemystats = true;
}
//Alright then! Flip mode?
@ -6928,7 +6925,7 @@ void Game::createmenu( std::string t )
{
unlock[18] = true;
unlocknotify[18] = true;
createmenu("unlockflipmode");
createmenu(Menu::unlockflipmode);
savemystats = true;
}
//What about the intermission levels?
@ -6936,7 +6933,7 @@ void Game::createmenu( std::string t )
{
unlock[16] = true;
unlocknotify[16] = true;
createmenu("unlockintermission");
createmenu(Menu::unlockintermission);
savemystats = true;
}
else
@ -6963,24 +6960,24 @@ void Game::createmenu( std::string t )
}
}
}
else if (t == "unlocktimetrial"
|| t == "unlocktimetrials"
|| t == "unlocknodeathmode"
|| t == "unlockintermission"
|| t == "unlockflipmode")
else if (t == Menu::unlocktimetrial
|| t == Menu::unlocktimetrials
|| t == Menu::unlocknodeathmode
|| t == Menu::unlockintermission
|| t == Menu::unlockflipmode)
{
option("continue");
menuxoff = 20;
menuyoff = 70;
}
else if (t == "newgamewarning")
else if (t == Menu::newgamewarning)
{
option("start new game");
option("return to menu");
menuxoff = -30;
menuyoff = 64;
}
else if (t == "playmodes")
else if (t == Menu::playmodes)
{
option("time trials", !map.invincibility && game.slowdown == 30);
option("intermissions", unlock[16]);
@ -6990,7 +6987,7 @@ void Game::createmenu( std::string t )
menuxoff = -70;
menuyoff = 8;
}
else if (t == "intermissionmenu")
else if (t == Menu::intermissionmenu)
{
option("play intermission 1");
option("play intermission 2");
@ -6998,7 +6995,7 @@ void Game::createmenu( std::string t )
menuxoff = -50;
menuyoff = -35;
}
else if (t == "playint1")
else if (t == Menu::playint1)
{
option("Vitellary");
option("Vermilion");
@ -7008,7 +7005,7 @@ void Game::createmenu( std::string t )
menuxoff = -60;
menuyoff = 10;
}
else if (t == "playint2")
else if (t == Menu::playint2)
{
option("Vitellary");
option("Vermilion");
@ -7018,7 +7015,7 @@ void Game::createmenu( std::string t )
menuxoff = -60;
menuyoff = 10;
}
else if (t == "continue")
else if (t == Menu::continuemenu)
{
option("continue from teleporter");
option("continue from quicksave");
@ -7026,7 +7023,7 @@ void Game::createmenu( std::string t )
menuxoff = -60;
menuyoff = 20;
}
else if (t == "startnodeathmode")
else if (t == Menu::startnodeathmode)
{
option("disable cutscenes");
option("enable cutscenes");
@ -7034,18 +7031,18 @@ void Game::createmenu( std::string t )
menuxoff = -60;
menuyoff = 40;
}
else if (t == "gameover")
else if (t == Menu::gameover)
{
menucountdown = 120;
menudest="gameover2";
menudest=Menu::gameover2;
}
else if (t == "gameover2")
else if (t == Menu::gameover2)
{
option("return to play menu");
menuxoff = -25;
menuyoff = 80;
}
else if (t == "unlockmenutrials")
else if (t == Menu::unlockmenutrials)
{
option("space station 1", !unlock[9]);
option("the laboratory", !unlock[10]);
@ -7058,7 +7055,7 @@ void Game::createmenu( std::string t )
menuxoff = -80;
menuyoff = 0;
}
else if (t == "timetrials")
else if (t == Menu::timetrials)
{
option(unlock[9] ? "space station 1" : "???", unlock[9]);
option(unlock[10] ? "the laboratory" : "???", unlock[10]);
@ -7071,35 +7068,35 @@ void Game::createmenu( std::string t )
menuxoff = -80;
menuyoff = 0;
}
else if (t == "nodeathmodecomplete")
else if (t == Menu::nodeathmodecomplete)
{
menucountdown = 90;
menudest = "nodeathmodecomplete2";
menudest = Menu::nodeathmodecomplete2;
}
else if (t == "nodeathmodecomplete2")
else if (t == Menu::nodeathmodecomplete2)
{
option("return to play menu");
menuxoff = -25;
menuyoff = 70;
}
else if (t == "timetrialcomplete")
else if (t == Menu::timetrialcomplete)
{
menucountdown = 90;
menudest="timetrialcomplete2";
menudest=Menu::timetrialcomplete2;
}
else if (t == "timetrialcomplete2")
else if (t == Menu::timetrialcomplete2)
{
menucountdown = 60;
menudest="timetrialcomplete3";
menudest=Menu::timetrialcomplete3;
}
else if (t == "timetrialcomplete3")
else if (t == Menu::timetrialcomplete3)
{
option("return to play menu");
option("try again");
menuxoff = -25;
menuyoff = 70;
}
else if (t == "gamecompletecontinue")
else if (t == Menu::gamecompletecontinue)
{
option("return to play menu");
menuxoff = -25;

View file

@ -14,6 +14,63 @@ struct MenuOption
bool active;
};
//Menu IDs
namespace Menu
{
enum MenuName
{
mainmenu,
playerworlds,
levellist,
quickloadlevel,
youwannaquit,
errornostart,
graphicoptions,
ed_settings,
ed_desc,
ed_music,
ed_quit,
options,
accessibility,
controller,
cleardatamenu,
setinvincibility,
setslowdown1,
setslowdown2,
unlockmenu,
credits,
credits2,
credits25,
credits3,
credits4,
credits5,
credits6,
play,
unlocktimetrial,
unlocktimetrials,
unlocknodeathmode,
unlockintermission,
unlockflipmode,
newgamewarning,
playmodes,
intermissionmenu,
playint1,
playint2,
continuemenu,
startnodeathmode,
gameover,
gameover2,
unlockmenutrials,
timetrials,
nodeathmodecomplete,
nodeathmodecomplete2,
timetrialcomplete,
timetrialcomplete2,
timetrialcomplete3,
gamecompletecontinue,
};
};
class Game
{
@ -53,7 +110,7 @@ public:
std::string timetstring(int t);
void createmenu(std::string t);
void createmenu(enum Menu::MenuName t);
void lifesequence();
@ -164,7 +221,8 @@ public:
//Main Menu Variables
std::vector<MenuOption> menuoptions;
int currentmenuoption ;
std::string menuselection, currentmenuname, previousmenuname;
std::string menuselection;
enum Menu::MenuName currentmenuname, previousmenuname;
int current_credits_list_index;
int menuxoff, menuyoff;
@ -177,7 +235,7 @@ public:
}
int menucountdown;
std::string menudest;
enum Menu::MenuName menudest;
int creditposx, creditposy, creditposdelay;

View file

@ -112,7 +112,7 @@ void updatebuttonmappings(int bind)
void menuactionpress()
{
if (game.currentmenuname == "mainmenu")
if (game.currentmenuname == Menu::mainmenu)
{
#if defined(MAKEANDPLAY)
#define MPOFFSET -1
@ -143,7 +143,7 @@ void menuactionpress()
{
//Bring you to the normal playmenu
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
}
break;
@ -152,27 +152,27 @@ void menuactionpress()
case OFFSET+1:
//Bring you to the normal playmenu
music.playef(11);
game.createmenu("playerworlds");
game.createmenu(Menu::playerworlds);
map.nexttowercolour();
break;
#endif
case OFFSET+2:
//Options
music.playef(11);
game.createmenu("graphicoptions");
game.createmenu(Menu::graphicoptions);
map.nexttowercolour();
break;
case OFFSET+3:
//Options
music.playef(11);
game.createmenu("options");
game.createmenu(Menu::options);
map.nexttowercolour();
break;
#if !defined(MAKEANDPLAY)
case OFFSET+4:
//Credits
music.playef(11);
game.createmenu("credits");
game.createmenu(Menu::credits);
map.nexttowercolour();
break;
#else
@ -191,12 +191,12 @@ void menuactionpress()
}
}
#if !defined(NO_CUSTOM_LEVELS)
else if(game.currentmenuname=="levellist")
else if(game.currentmenuname==Menu::levellist)
{
if(game.currentmenuoption==(int)game.menuoptions.size()-1){
//go back to menu
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
}else if(game.currentmenuoption==(int)game.menuoptions.size()-2){
//next page
@ -206,7 +206,7 @@ void menuactionpress()
}else{
game.levelpage++;
}
game.createmenu("levellist");
game.createmenu(Menu::levellist);
game.currentmenuoption=game.menuoptions.size()-2;
map.nexttowercolour();
}else{
@ -223,13 +223,13 @@ void menuactionpress()
game.mainmenu = 22;
graphics.fademode = 2;
}else{
game.createmenu("quickloadlevel");
game.createmenu(Menu::quickloadlevel);
map.nexttowercolour();
}
}
}
#endif
else if(game.currentmenuname=="quickloadlevel")
else if(game.currentmenuname==Menu::quickloadlevel)
{
switch (game.currentmenuoption)
{
@ -244,13 +244,13 @@ void menuactionpress()
case 2:
music.playef(11);
game.levelpage=0;
game.createmenu("levellist");
game.createmenu(Menu::levellist);
map.nexttowercolour();
break;
}
}
#if !defined(NO_CUSTOM_LEVELS)
else if(game.currentmenuname=="playerworlds")
else if(game.currentmenuname==Menu::playerworlds)
{
#if defined(NO_EDITOR)
#define OFFSET -1
@ -265,7 +265,7 @@ void menuactionpress()
game.levelpage=0;
ed.getDirectoryData();
game.loadcustomlevelstats(); //Should only load a file if it's needed
game.createmenu("levellist");
game.createmenu(Menu::levellist);
map.nexttowercolour();
break;
#if !defined(NO_EDITOR)
@ -290,19 +290,19 @@ void menuactionpress()
case OFFSET+2:
//back
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
#undef OFFSET
}
#endif
else if(game.currentmenuname=="errornostart"){
else if(game.currentmenuname==Menu::errornostart){
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
}
else if (game.currentmenuname == "graphicoptions")
else if (game.currentmenuname == Menu::graphicoptions)
{
switch (game.currentmenuoption)
{
@ -311,7 +311,7 @@ void menuactionpress()
graphics.screenbuffer->toggleFullScreen();
game.fullscreen = !game.fullscreen;
game.savestats();
game.createmenu("graphicoptions");
game.createmenu(Menu::graphicoptions);
game.currentmenuoption = 0;
break;
case 1:
@ -319,7 +319,7 @@ void menuactionpress()
graphics.screenbuffer->toggleStretchMode();
game.stretchMode = (game.stretchMode + 1) % 3;
game.savestats();
game.createmenu("graphicoptions");
game.createmenu(Menu::graphicoptions);
game.currentmenuoption = 1;
break;
case 2:
@ -327,7 +327,7 @@ void menuactionpress()
graphics.screenbuffer->toggleLinearFilter();
game.useLinearFilter = !game.useLinearFilter;
game.savestats();
game.createmenu("graphicoptions");
game.createmenu(Menu::graphicoptions);
game.currentmenuoption = 2;
break;
case 3:
@ -337,7 +337,7 @@ void menuactionpress()
//Hook the analogue thing in here: ABCDEFG
graphics.screenbuffer->badSignalEffect= !graphics.screenbuffer->badSignalEffect;
game.savestats();
game.createmenu("graphicoptions");
game.createmenu(Menu::graphicoptions);
game.currentmenuoption = 3;
break;
case 4:
@ -355,12 +355,12 @@ void menuactionpress()
default:
//back
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "youwannaquit")
else if (game.currentmenuname == Menu::youwannaquit)
{
switch (game.currentmenuoption)
{
@ -376,14 +376,14 @@ void menuactionpress()
map.nexttowercolour();
}
}
else if (game.currentmenuname == "setinvincibility")
else if (game.currentmenuname == Menu::setinvincibility)
{
switch (game.currentmenuoption)
{
case 0:
//back
music.playef(11);
game.createmenu("accessibility");
game.createmenu(Menu::accessibility);
game.currentmenuoption = 3;
map.nexttowercolour();
break;
@ -391,20 +391,20 @@ void menuactionpress()
map.invincibility = !map.invincibility;
game.savestats();
music.playef(11);
game.createmenu("accessibility");
game.createmenu(Menu::accessibility);
game.currentmenuoption = 3;
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "setslowdown1")
else if (game.currentmenuname == Menu::setslowdown1)
{
switch (game.currentmenuoption)
{
case 0:
//back
music.playef(11);
game.createmenu("accessibility");
game.createmenu(Menu::accessibility);
game.currentmenuoption = 4;
map.nexttowercolour();
break;
@ -412,13 +412,13 @@ void menuactionpress()
//change game speed
game.deletequick();
game.deletetele();
game.createmenu("setslowdown2");
game.createmenu(Menu::setslowdown2);
map.nexttowercolour();
music.playef(11);
break;
}
}
else if (game.currentmenuname == "setslowdown2")
else if (game.currentmenuname == Menu::setslowdown2)
{
switch (game.currentmenuoption)
{
@ -428,7 +428,7 @@ void menuactionpress()
game.slowdown = 30;
game.savestats();
music.playef(11);
game.createmenu("accessibility");
game.createmenu(Menu::accessibility);
game.currentmenuoption = 4;
map.nexttowercolour();
break;
@ -437,7 +437,7 @@ void menuactionpress()
game.slowdown = 24;
game.savestats();
music.playef(11);
game.createmenu("accessibility");
game.createmenu(Menu::accessibility);
game.currentmenuoption = 4;
map.nexttowercolour();
break;
@ -446,7 +446,7 @@ void menuactionpress()
game.slowdown = 18;
game.savestats();
music.playef(11);
game.createmenu("accessibility");
game.createmenu(Menu::accessibility);
game.currentmenuoption = 4;
map.nexttowercolour();
break;
@ -455,13 +455,13 @@ void menuactionpress()
game.slowdown = 12;
game.savestats();
music.playef(11);
game.createmenu("accessibility");
game.createmenu(Menu::accessibility);
game.currentmenuoption = 4;
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "accessibility")
else if (game.currentmenuname == Menu::accessibility)
{
switch (game.currentmenuoption)
{
@ -495,7 +495,7 @@ void menuactionpress()
//invincibility
if (!map.invincibility)
{
game.createmenu("setinvincibility");
game.createmenu(Menu::setinvincibility);
map.nexttowercolour();
}
else
@ -506,7 +506,7 @@ void menuactionpress()
break;
case 4:
//change game speed
game.createmenu("setslowdown2");
game.createmenu(Menu::setslowdown2);
map.nexttowercolour();
music.playef(11);
break;
@ -523,7 +523,7 @@ void menuactionpress()
case 7:
//back
music.playef(11);
game.createmenu("options");
game.createmenu(Menu::options);
map.nexttowercolour();
break;
default:
@ -532,7 +532,7 @@ void menuactionpress()
break;
}
}
else if (game.currentmenuname == "options")
else if (game.currentmenuname == Menu::options)
{
#if defined(MAKEANDPLAY)
#define OFFSET -1
@ -545,27 +545,27 @@ void menuactionpress()
case 0:
//accessibility options
music.playef(11);
game.createmenu("accessibility");
game.createmenu(Menu::accessibility);
map.nexttowercolour();
break;
#if !defined(MAKEANDPLAY)
case 1:
//unlock play options
music.playef(11);
game.createmenu("unlockmenu");
game.createmenu(Menu::unlockmenu);
map.nexttowercolour();
break;
#endif
case OFFSET+2:
//clear data menu
music.playef(11);
game.createmenu("controller");
game.createmenu(Menu::controller);
map.nexttowercolour();
break;
case OFFSET+3:
//clear data menu
music.playef(11);
game.createmenu("cleardatamenu");
game.createmenu(Menu::cleardatamenu);
map.nexttowercolour();
break;
}
@ -588,12 +588,12 @@ void menuactionpress()
{
//back
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
}
#undef OFFSET
}
else if (game.currentmenuname == "unlockmenutrials")
else if (game.currentmenuname == Menu::unlockmenutrials)
{
switch (game.currentmenuoption)
{
@ -602,7 +602,7 @@ void menuactionpress()
game.unlocknotify[9] = true;
music.playef(11);
game.savestats();
game.createmenu("unlockmenutrials");
game.createmenu(Menu::unlockmenutrials);
game.currentmenuoption = 0;
break;
case 1: //unlock 2
@ -610,7 +610,7 @@ void menuactionpress()
game.unlocknotify[10] = true;
music.playef(11);
game.savestats();
game.createmenu("unlockmenutrials");
game.createmenu(Menu::unlockmenutrials);
game.currentmenuoption = 1;
break;
case 2: //unlock 3
@ -618,7 +618,7 @@ void menuactionpress()
game.unlocknotify[11] = true;
music.playef(11);
game.savestats();
game.createmenu("unlockmenutrials");
game.createmenu(Menu::unlockmenutrials);
game.currentmenuoption = 2;
break;
case 3: //unlock 4
@ -626,7 +626,7 @@ void menuactionpress()
game.unlocknotify[12] = true;
music.playef(11);
game.savestats();
game.createmenu("unlockmenutrials");
game.createmenu(Menu::unlockmenutrials);
game.currentmenuoption = 3;
break;
case 4: //unlock 5
@ -634,7 +634,7 @@ void menuactionpress()
game.unlocknotify[13] = true;
music.playef(11);
game.savestats();
game.createmenu("unlockmenutrials");
game.createmenu(Menu::unlockmenutrials);
game.currentmenuoption = 4;
break;
case 5: //unlock 6
@ -642,25 +642,25 @@ void menuactionpress()
game.unlocknotify[14] = true;
music.playef(11);
game.savestats();
game.createmenu("unlockmenutrials");
game.createmenu(Menu::unlockmenutrials);
game.currentmenuoption = 5;
break;
case 6: //back
//back
music.playef(11);
game.createmenu("unlockmenu");
game.createmenu(Menu::unlockmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "unlockmenu")
else if (game.currentmenuname == Menu::unlockmenu)
{
switch (game.currentmenuoption)
{
case 0:
//unlock time trials separately...
music.playef(11);
game.createmenu("unlockmenutrials");
game.createmenu(Menu::unlockmenutrials);
map.nexttowercolour();
break;
case 1:
@ -671,7 +671,7 @@ void menuactionpress()
game.unlock[6] = true;
game.unlock[7] = true;
game.savestats();
game.createmenu("unlockmenu");
game.createmenu(Menu::unlockmenu);
game.currentmenuoption = 1;
break;
case 2:
@ -680,7 +680,7 @@ void menuactionpress()
game.unlock[17] = true;
game.unlocknotify[17] = true;
game.savestats();
game.createmenu("unlockmenu");
game.createmenu(Menu::unlockmenu);
game.currentmenuoption = 2;
break;
case 3:
@ -689,7 +689,7 @@ void menuactionpress()
game.unlock[18] = true;
game.unlocknotify[18] = true;
game.savestats();
game.createmenu("unlockmenu");
game.createmenu(Menu::unlockmenu);
game.currentmenuoption = 3;
break;
case 4:
@ -697,7 +697,7 @@ void menuactionpress()
music.playef(11);
game.stat_trinkets = 20;
game.savestats();
game.createmenu("unlockmenu");
game.createmenu(Menu::unlockmenu);
game.currentmenuoption = 4;
break;
case 5:
@ -706,72 +706,72 @@ void menuactionpress()
game.unlock[8] = true;
game.unlocknotify[8] = true;
game.savestats();
game.createmenu("unlockmenu");
game.createmenu(Menu::unlockmenu);
game.currentmenuoption = 5;
break;
default:
//back
music.playef(11);
game.createmenu("options");
game.createmenu(Menu::options);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "credits")
else if (game.currentmenuname == Menu::credits)
{
switch (game.currentmenuoption)
{
case 0:
//next page
music.playef(11);
game.createmenu("credits2");
game.createmenu(Menu::credits2);
map.nexttowercolour();
break;
default:
//back
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "credits2")
else if (game.currentmenuname == Menu::credits2)
{
switch (game.currentmenuoption)
{
case 0:
//next page
music.playef(11);
game.createmenu("credits25");
game.createmenu(Menu::credits25);
map.nexttowercolour();
break;
case 1:
//back
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "credits25")
else if (game.currentmenuname == Menu::credits25)
{
switch (game.currentmenuoption)
{
case 0:
//next page
music.playef(11);
game.createmenu("credits3");
game.createmenu(Menu::credits3);
map.nexttowercolour();
break;
default:
//back
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "credits3")
else if (game.currentmenuname == Menu::credits3)
{
switch (game.currentmenuoption)
{
@ -784,12 +784,12 @@ void menuactionpress()
{
// No more super patrons. Move to the next credits section
game.current_credits_list_index = 0;
game.createmenu("credits4");
game.createmenu(Menu::credits4);
}
else
{
// There are more super patrons. Refresh the menu with the next ones
game.createmenu("credits3");
game.createmenu(Menu::credits3);
}
map.nexttowercolour();
@ -798,12 +798,12 @@ void menuactionpress()
//back
music.playef(11);
game.current_credits_list_index = 0;
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "credits4")
else if (game.currentmenuname == Menu::credits4)
{
switch (game.currentmenuoption)
{
@ -816,12 +816,12 @@ void menuactionpress()
{
// No more patrons. Move to the next credits section
game.current_credits_list_index = 0;
game.createmenu("credits5");
game.createmenu(Menu::credits5);
}
else
{
// There are more patrons. Refresh the menu with the next ones
game.createmenu("credits4");
game.createmenu(Menu::credits4);
}
map.nexttowercolour();
@ -830,12 +830,12 @@ void menuactionpress()
//back
music.playef(11);
game.current_credits_list_index = 0;
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "credits5")
else if (game.currentmenuname == Menu::credits5)
{
switch (game.currentmenuoption)
{
@ -848,12 +848,12 @@ void menuactionpress()
{
// No more GitHub contributors. Move to the next credits section
game.current_credits_list_index = 0;
game.createmenu("credits6");
game.createmenu(Menu::credits6);
}
else
{
// There are more GitHub contributors. Refresh the menu with the next ones
game.createmenu("credits5");
game.createmenu(Menu::credits5);
}
map.nexttowercolour();
@ -862,31 +862,31 @@ void menuactionpress()
//back
music.playef(11);
game.current_credits_list_index = 0;
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "credits6")
else if (game.currentmenuname == Menu::credits6)
{
switch (game.currentmenuoption)
{
case 0:
//first page
music.playef(11);
game.createmenu("credits");
game.createmenu(Menu::credits);
map.nexttowercolour();
break;
default:
//back
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
music.niceplay(6);
break;
}
}
else if (game.currentmenuname == "play")
else if (game.currentmenuname == Menu::play)
{
//Do we have the Secret Lab option?
int offset = game.unlock[8] ? 0 : -1;
@ -911,7 +911,7 @@ void menuactionpress()
//go to a menu!
music.playef(11);
game.loadsummary(); //Prepare save slots to display
game.createmenu("continue");
game.createmenu(Menu::continuemenu);
map.settowercolour(3);
}
}
@ -929,25 +929,25 @@ void menuactionpress()
{
//play modes
music.playef(11);
game.createmenu("playmodes");
game.createmenu(Menu::playmodes);
map.nexttowercolour();
}
else if (game.currentmenuoption == offset+3)
{
//newgame
music.playef(11);
game.createmenu("newgamewarning");
game.createmenu(Menu::newgamewarning);
map.nexttowercolour();
}
else if (game.currentmenuoption == offset+4)
{
//back
music.playef(11);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
}
}
else if (game.currentmenuname == "newgamewarning")
else if (game.currentmenuname == Menu::newgamewarning)
{
switch (game.currentmenuoption)
{
@ -961,13 +961,13 @@ void menuactionpress()
default:
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "controller")
else if (game.currentmenuname == Menu::controller)
{
switch (game.currentmenuoption)
{
@ -982,18 +982,18 @@ void menuactionpress()
case 4:
music.playef(11);
game.createmenu("options");
game.createmenu(Menu::options);
break;
}
}
else if (game.currentmenuname == "cleardatamenu")
else if (game.currentmenuname == Menu::cleardatamenu)
{
switch (game.currentmenuoption)
{
case 0:
//back
music.playef(11);
game.createmenu("options");
game.createmenu(Menu::options);
map.nexttowercolour();
break;
default:
@ -1004,30 +1004,30 @@ void menuactionpress()
game.deletestats();
game.flashlight = 5;
game.screenshake = 15;
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "playmodes")
else if (game.currentmenuname == Menu::playmodes)
{
if (game.currentmenuoption == 0 && game.slowdown == 30 && !map.invincibility) //go to the time trial menu
{
music.playef(11);
game.createmenu("timetrials");
game.createmenu(Menu::timetrials);
map.nexttowercolour();
}
else if (game.currentmenuoption == 1 && game.unlock[16])
{
//intermission mode menu
music.playef(11);
game.createmenu("intermissionmenu");
game.createmenu(Menu::intermissionmenu);
map.nexttowercolour();
}
else if (game.currentmenuoption == 2 && game.unlock[17] && game.slowdown == 30 && !map.invincibility) //start a game in no death mode
{
music.playef(11);
game.createmenu("startnodeathmode");
game.createmenu(Menu::startnodeathmode);
map.nexttowercolour();
}
else if (game.currentmenuoption == 3 && game.unlock[18]) //enable/disable flip mode
@ -1042,7 +1042,7 @@ void menuactionpress()
{
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
}
else
@ -1051,7 +1051,7 @@ void menuactionpress()
music.playef(2);
}
}
else if (game.currentmenuname == "startnodeathmode")
else if (game.currentmenuname == Menu::startnodeathmode)
{
switch (game.currentmenuoption)
{
@ -1066,12 +1066,12 @@ void menuactionpress()
case 2:
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "continue")
else if (game.currentmenuname == Menu::continuemenu)
{
switch (game.currentmenuoption)
{
@ -1086,36 +1086,36 @@ void menuactionpress()
case 2:
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "intermissionmenu")
else if (game.currentmenuname == Menu::intermissionmenu)
{
switch (game.currentmenuoption)
{
case 0:
music.playef(11);
music.play(6);
game.createmenu("playint1");
game.createmenu(Menu::playint1);
map.nexttowercolour();
break;
case 1:
music.playef(11);
music.play(6);
game.createmenu("playint2");
game.createmenu(Menu::playint2);
map.nexttowercolour();
break;
case 2:
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "playint1")
else if (game.currentmenuname == Menu::playint1)
{
switch (game.currentmenuoption)
{
@ -1138,12 +1138,12 @@ void menuactionpress()
case 4:
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "playint2")
else if (game.currentmenuname == Menu::playint2)
{
switch (game.currentmenuoption)
{
@ -1166,31 +1166,31 @@ void menuactionpress()
case 4:
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "gameover2")
else if (game.currentmenuname == Menu::gameover2)
{
//back
music.playef(11);
music.play(6);
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
map.nexttowercolour();
}
else if (game.currentmenuname == "unlocktimetrials"
|| game.currentmenuname == "unlocktimetrial"
|| game.currentmenuname == "unlocknodeathmode"
|| game.currentmenuname == "unlockintermission"
|| game.currentmenuname == "unlockflipmode")
else if (game.currentmenuname == Menu::unlocktimetrials
|| game.currentmenuname == Menu::unlocktimetrial
|| game.currentmenuname == Menu::unlocknodeathmode
|| game.currentmenuname == Menu::unlockintermission
|| game.currentmenuname == Menu::unlockflipmode)
{
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
}
else if (game.currentmenuname == "timetrials")
else if (game.currentmenuname == Menu::timetrials)
{
if (game.currentmenuoption == 0 && game.unlock[9]) //space station 1
{
@ -1226,7 +1226,7 @@ void menuactionpress()
{
//back
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
}
else
@ -1235,7 +1235,7 @@ void menuactionpress()
music.playef(2);
}
}
else if (game.currentmenuname == "timetrialcomplete3")
else if (game.currentmenuname == Menu::timetrialcomplete3)
{
switch (game.currentmenuoption)
{
@ -1243,7 +1243,7 @@ void menuactionpress()
//back
music.playef(11);
music.play(6);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
break;
case 1:
@ -1281,11 +1281,11 @@ void menuactionpress()
break;
}
}
else if (game.currentmenuname == "gamecompletecontinue" || game.currentmenuname == "nodeathmodecomplete2")
else if (game.currentmenuname == Menu::gamecompletecontinue || game.currentmenuname == Menu::nodeathmodecomplete2)
{
music.play(6);
music.playef(11);
game.createmenu("play");
game.createmenu(Menu::play);
map.nexttowercolour();
}
}
@ -1334,11 +1334,11 @@ void titleinput()
game.jumpheld = true;
}
if (key.isDown(27) && game.currentmenuname != "youwannaquit" && game.menustart)
if (key.isDown(27) && game.currentmenuname != Menu::youwannaquit && game.menustart)
{
music.playef(11);
game.previousmenuname = game.currentmenuname;
game.createmenu("youwannaquit");
game.createmenu(Menu::youwannaquit);
map.nexttowercolour();
}
@ -1374,7 +1374,7 @@ void titleinput()
menuactionpress();
}
}
if ( game.currentmenuname == "controller" &&
if ( game.currentmenuname == Menu::controller &&
game.currentmenuoption > 0 &&
game.currentmenuoption < 4 &&
key.controllerButtonDown() )

View file

@ -18,15 +18,15 @@ void titlelogic()
game.menucountdown--;
if (game.menucountdown == 0)
{
if (game.menudest == "mainmenu")
if (game.menudest == Menu::mainmenu)
{
music.play(6);
}
else if (game.menudest == "gameover2")
else if (game.menudest == Menu::gameover2)
{
music.playef(11);
}
else if (game.menudest == "timetrialcomplete3")
else if (game.menudest == Menu::timetrialcomplete3)
{
music.playef(3);
}
@ -109,7 +109,7 @@ void gamecompletelogic2()
game.gamestate = 1;
graphics.fademode = 4;
music.playef(18);
game.createmenu("gamecompletecontinue");
game.createmenu(Menu::gamecompletecontinue);
map.nexttowercolour();
}
}

View file

@ -20,7 +20,7 @@ void menurender()
{
int temp = 50;
if(game.currentmenuname=="mainmenu")
if(game.currentmenuname==Menu::mainmenu)
{
graphics.drawsprite((160 - 96) + 0 * 32, temp, 23, tr, tg, tb);
graphics.drawsprite((160 - 96) + 1 * 32, temp, 23, tr, tg, tb);
@ -38,7 +38,7 @@ void menurender()
}
}
#if !defined(NO_CUSTOM_LEVELS)
else if (game.currentmenuname == "levellist")
else if (game.currentmenuname == Menu::levellist)
{
if(ed.ListOfMetaData.size()==0){
graphics.Print( -1, 100, "ERROR: No levels found.", tr, tg, tb, true);
@ -59,12 +59,12 @@ void menurender()
}
}
#endif
else if (game.currentmenuname == "errornostart")
else if (game.currentmenuname == Menu::errornostart)
{
graphics.Print( -1, 65, "ERROR: This level has", tr, tg, tb, true);
graphics.Print( -1, 75, "no start point!", tr, tg, tb, true);
}
else if (game.currentmenuname == "options")
else if (game.currentmenuname == Menu::options)
{
#if defined(MAKEANDPLAY)
#define OFFSET -1
@ -110,7 +110,7 @@ void menurender()
}
#undef OFFSET
}
else if (game.currentmenuname == "graphicoptions")
else if (game.currentmenuname == Menu::graphicoptions)
{
switch (game.currentmenuoption)
{
@ -167,7 +167,7 @@ void menurender()
break;
}
}
else if (game.currentmenuname == "credits")
else if (game.currentmenuname == Menu::credits)
{
graphics.Print( -1, 50, "VVVVVV is a game by", tr, tg, tb, true);
graphics.bigprint( 40, 65, "Terry Cavanagh", tr, tg, tb, true, 2);
@ -178,7 +178,7 @@ void menurender()
graphics.bigprint( 40, 135, "Magnus P~lsson", tr, tg, tb, true, 2);
graphics.drawimagecol(8, -1, 156, tr *0.75, tg *0.75, tb *0.75, true);
}
else if (game.currentmenuname == "credits2")
else if (game.currentmenuname == Menu::credits2)
{
graphics.Print( -1, 50, "Roomnames are by", tr, tg, tb, true);
graphics.bigprint( 40, 65, "Bennett Foddy", tr, tg, tb, true);
@ -187,7 +187,7 @@ void menurender()
graphics.bigprint( 40, 125, "Simon Roth", tr, tg, tb, true);
graphics.bigprint( 40, 145, "Ethan Lee", tr, tg, tb, true);
}
else if (game.currentmenuname == "credits25")
else if (game.currentmenuname == Menu::credits25)
{
graphics.Print( -1, 40, "Beta Testing by", tr, tg, tb, true);
graphics.bigprint( 40, 55, "Sam Kaplan", tr, tg, tb, true);
@ -195,7 +195,7 @@ void menurender()
graphics.Print( -1, 130, "Ending Picture by", tr, tg, tb, true);
graphics.bigprint( 40, 145, "Pauli Kohberger", tr, tg, tb, true);
}
else if (game.currentmenuname == "credits3")
else if (game.currentmenuname == Menu::credits3)
{
graphics.Print( -1, 20, "VVVVVV is supported by", tr, tg, tb, true);
graphics.Print( 40, 30, "the following patrons", tr, tg, tb, true);
@ -213,7 +213,7 @@ void menurender()
yofs += 14;
}
}
else if (game.currentmenuname == "credits4")
else if (game.currentmenuname == Menu::credits4)
{
graphics.Print( -1, 20, "and also by", tr, tg, tb, true);
@ -232,7 +232,7 @@ void menurender()
yofs += 10;
}
}
else if (game.currentmenuname == "credits5")
else if (game.currentmenuname == Menu::credits5)
{
graphics.Print( -1, 20, "With contributions on", tr, tg, tb, true);
graphics.Print( 40, 30, "GitHub from", tr, tg, tb, true);
@ -254,7 +254,7 @@ void menurender()
yofs += 14;
}
}
else if (game.currentmenuname == "credits6")
else if (game.currentmenuname == Menu::credits6)
{
graphics.Print( -1, 20, "and thanks also to:", tr, tg, tb, true);
@ -267,19 +267,19 @@ void menurender()
graphics.Print( 80, 150,"Thank you!", tr, tg, tb,true);
}
else if (game.currentmenuname == "setinvincibility")
else if (game.currentmenuname == Menu::setinvincibility)
{
graphics.Print( -1, 100, "Are you sure you want to ", tr, tg, tb, true);
graphics.Print( -1, 110, "enable invincibility?", tr, tg, tb, true);
}
else if (game.currentmenuname == "setslowdown1")
else if (game.currentmenuname == Menu::setslowdown1)
{
graphics.Print( -1, 90, "Warning! Changing the game speed", tr, tg, tb, true);
graphics.Print( -1, 100, "requires a game restart, and will", tr, tg, tb, true);
graphics.Print( -1, 110, "delete your current saves.", tr, tg, tb, true);
graphics.Print( -1, 120, "Is this ok?", tr, tg, tb, true);
}
else if (game.currentmenuname == "setslowdown2")
else if (game.currentmenuname == Menu::setslowdown2)
{
graphics.bigprint( -1, 40, "Game Speed", tr, tg, tb, true);
graphics.Print( -1, 75, "Select a new game speed below.", tr, tg, tb, true);
@ -299,24 +299,24 @@ void menurender()
break;
}
}
else if (game.currentmenuname == "newgamewarning")
else if (game.currentmenuname == Menu::newgamewarning)
{
graphics.Print( -1, 100, "Are you sure? This will", tr, tg, tb, true);
graphics.Print( -1, 110, "delete your current saves...", tr, tg, tb, true);
}
else if (game.currentmenuname == "cleardatamenu")
else if (game.currentmenuname == Menu::cleardatamenu)
{
graphics.Print( -1, 100, "Are you sure you want to", tr, tg, tb, true);
graphics.Print( -1, 110, "delete all your saved data?", tr, tg, tb, true);
}
else if (game.currentmenuname == "startnodeathmode")
else if (game.currentmenuname == Menu::startnodeathmode)
{
graphics.Print( -1, 45, "Good luck!", tr, tg, tb, true);
graphics.Print( -1, 80, "You cannot save in this mode.", tr, tg, tb, true);
graphics.Print( -1, 100, "Would you like to disable the", tr, tg, tb, true);
graphics.Print( -1, 112, "cutscenes during the game?", tr, tg, tb, true);
}
else if (game.currentmenuname == "controller")
else if (game.currentmenuname == Menu::controller)
{
graphics.bigprint( -1, 30, "Game Pad", tr, tg, tb, true);
graphics.Print( -1, 55, "Change controller options.", tr, tg, tb, true);
@ -358,7 +358,7 @@ void menurender()
}
else if (game.currentmenuname == "accessibility")
else if (game.currentmenuname == Menu::accessibility)
{
switch (game.currentmenuoption)
{
@ -450,12 +450,12 @@ void menurender()
break;
}
}
else if (game.currentmenuname == "playint1" || game.currentmenuname == "playint2")
else if (game.currentmenuname == Menu::playint1 || game.currentmenuname == Menu::playint2)
{
graphics.Print( -1, 65, "Who do you want to play", tr, tg, tb, true);
graphics.Print( -1, 75, "the level with?", tr, tg, tb, true);
}
else if (game.currentmenuname == "playmodes")
else if (game.currentmenuname == Menu::playmodes)
{
switch (game.currentmenuoption)
{
@ -519,11 +519,11 @@ void menurender()
break;
}
}
else if (game.currentmenuname == "youwannaquit")
else if (game.currentmenuname == Menu::youwannaquit)
{
graphics.Print( -1, 75, "Are you sure you want to quit?", tr, tg, tb, true);
}
else if (game.currentmenuname == "continue")
else if (game.currentmenuname == Menu::continuemenu)
{
graphics.crewframedelay--;
if (graphics.crewframedelay <= 0)
@ -567,7 +567,7 @@ void menurender()
break;
}
}
else if (game.currentmenuname == "gameover" || game.currentmenuname == "gameover2")
else if (game.currentmenuname == Menu::gameover || game.currentmenuname == Menu::gameover2)
{
graphics.bigprint( -1, 25, "GAME OVER", tr, tg, tb, true, 3);
@ -616,7 +616,7 @@ void menurender()
graphics.Print(0, 190, tempstring, tr, tg, tb, true);
}
else if (game.currentmenuname == "nodeathmodecomplete" || game.currentmenuname == "nodeathmodecomplete2")
else if (game.currentmenuname == Menu::nodeathmodecomplete || game.currentmenuname == Menu::nodeathmodecomplete2)
{
graphics.bigprint( -1, 8, "WOW", tr, tg, tb, true, 4);
@ -640,8 +640,8 @@ void menurender()
graphics.Print(0, 170, "placed in the secret lab to", tr, tg, tb, true);
graphics.Print(0, 180, "acknowledge your achievement!", tr, tg, tb, true);
}
else if (game.currentmenuname == "timetrialcomplete" || game.currentmenuname == "timetrialcomplete2"
|| game.currentmenuname == "timetrialcomplete3" || game.currentmenuname == "timetrialcomplete4")
else if (game.currentmenuname == Menu::timetrialcomplete || game.currentmenuname == Menu::timetrialcomplete2
|| game.currentmenuname == Menu::timetrialcomplete3)
{
graphics.bigprint( -1, 20, "Results", tr, tg, tb, true, 3);
@ -673,12 +673,12 @@ void menurender()
graphics.Print(220, 85+55, "+1 Rank!", 255, 255, 255);
}
if (game.currentmenuname == "timetrialcomplete2" || game.currentmenuname == "timetrialcomplete3")
if (game.currentmenuname == Menu::timetrialcomplete2 || game.currentmenuname == Menu::timetrialcomplete3)
{
graphics.bigprint( 100, 175, "Rank:", tr, tg, tb, false, 2);
}
if (game.currentmenuname == "timetrialcomplete3")
if (game.currentmenuname == Menu::timetrialcomplete3)
{
switch(game.timetrialrank)
{
@ -697,13 +697,13 @@ void menurender()
}
}
}
else if (game.currentmenuname == "unlockmenutrials")
else if (game.currentmenuname == Menu::unlockmenutrials)
{
graphics.bigprint( -1, 30, "Unlock Time Trials", tr, tg, tb, true);
graphics.Print( -1, 65, "You can unlock each time", tr, tg, tb, true);
graphics.Print( -1, 75, "trial separately.", tr, tg, tb, true);
}
else if (game.currentmenuname == "timetrials")
else if (game.currentmenuname == Menu::timetrials)
{
switch (game.currentmenuoption)
{
@ -985,7 +985,7 @@ void menurender()
break;
}
}
else if (game.currentmenuname == "gamecompletecontinue")
else if (game.currentmenuname == Menu::gamecompletecontinue)
{
graphics.bigprint( -1, 25, "Congratulations!", tr, tg, tb, true, 2);
@ -995,7 +995,7 @@ void menurender()
graphics.Print( -1, 120, "the game, select CONTINUE", tr, tg, tb, true);
graphics.Print( -1, 130, "from the play menu.", tr, tg, tb, true);
}
else if (game.currentmenuname == "unlockmenu")
else if (game.currentmenuname == Menu::unlockmenu)
{
graphics.bigprint( -1, 25, "Unlock Play Modes", tr, tg, tb, true, 2);
@ -1003,41 +1003,41 @@ void menurender()
graphics.Print( -1, 65, "of the game that are normally", tr, tg, tb, true);
graphics.Print( -1, 75, "unlocked as you play.", tr, tg, tb, true);
}
else if (game.currentmenuname == "unlocktimetrial")
else if (game.currentmenuname == Menu::unlocktimetrial)
{
graphics.bigprint( -1, 45, "Congratulations!", tr, tg, tb, true, 2);
graphics.Print( -1, 125, "You have unlocked", tr, tg, tb, true);
graphics.Print( -1, 135, "a new Time Trial.", tr, tg, tb, true);
}
else if (game.currentmenuname == "unlocktimetrials")
else if (game.currentmenuname == Menu::unlocktimetrials)
{
graphics.bigprint( -1, 45, "Congratulations!", tr, tg, tb, true, 2);
graphics.Print( -1, 125, "You have unlocked some", tr, tg, tb, true);
graphics.Print( -1, 135, "new Time Trials.", tr, tg, tb, true);
}
else if (game.currentmenuname == "unlocknodeathmode")
else if (game.currentmenuname == Menu::unlocknodeathmode)
{
graphics.bigprint( -1, 45, "Congratulations!", tr, tg, tb, true, 2);
graphics.Print( -1, 125, "You have unlocked", tr, tg, tb, true);
graphics.Print( -1, 135, "No Death Mode.", tr, tg, tb, true);
}
else if (game.currentmenuname == "unlockflipmode")
else if (game.currentmenuname == Menu::unlockflipmode)
{
graphics.bigprint( -1, 45, "Congratulations!", tr, tg, tb, true, 2);
graphics.Print( -1, 125, "You have unlocked", tr, tg, tb, true);
graphics.Print( -1, 135, "Flip Mode.", tr, tg, tb, true);
}
else if (game.currentmenuname == "unlockintermission")
else if (game.currentmenuname == Menu::unlockintermission)
{
graphics.bigprint( -1, 45, "Congratulations!", tr, tg, tb, true, 2);
graphics.Print( -1, 125, "You have unlocked", tr, tg, tb, true);
graphics.Print( -1, 135, "the intermission levels.", tr, tg, tb, true);
}else if (game.currentmenuname == "playerworlds")
}else if (game.currentmenuname == Menu::playerworlds)
{
std::string tempstring = FILESYSTEM_getUserLevelDirectory();
if(tempstring.length()>80){
@ -1109,27 +1109,27 @@ void titlerender()
if(tg>255) tg=255;
if (tb < 0) tb = 0;
if(tb>255) tb=255;
if (game.currentmenuname == "timetrials" || game.currentmenuname == "unlockmenutrials")
if (game.currentmenuname == Menu::timetrials || game.currentmenuname == Menu::unlockmenutrials)
{
graphics.drawmenu(tr, tg, tb, 15);
}
else if (game.currentmenuname == "unlockmenu")
else if (game.currentmenuname == Menu::unlockmenu)
{
graphics.drawmenu(tr, tg, tb, 15);
}
else if (game.currentmenuname == "playmodes")
else if (game.currentmenuname == Menu::playmodes)
{
graphics.drawmenu(tr, tg, tb, 20);
}
else if (game.currentmenuname == "mainmenu")
else if (game.currentmenuname == Menu::mainmenu)
{
graphics.drawmenu(tr, tg, tb, 15);
}
else if (game.currentmenuname == "playerworlds")
else if (game.currentmenuname == Menu::playerworlds)
{
graphics.drawmenu(tr, tg, tb, 15);
}
else if (game.currentmenuname == "levellist")
else if (game.currentmenuname == Menu::levellist)
{
graphics.drawlevelmenu(tr, tg, tb, 5);
}

View file

@ -2534,7 +2534,7 @@ void scriptclass::resetgametomenu()
graphics.flipmode = false;
obj.entities.clear();
graphics.fademode = 4;
game.createmenu("gameover");
game.createmenu(Menu::gameover);
}
void scriptclass::startgamemode( int t )

View file

@ -2183,11 +2183,11 @@ void editorclass::generatecustomminimap()
void editormenurender(int tr, int tg, int tb)
{
if (game.currentmenuname == "ed_settings")
if (game.currentmenuname == Menu::ed_settings)
{
graphics.bigprint( -1, 75, "Map Settings", tr, tg, tb, true);
}
else if (game.currentmenuname=="ed_desc")
else if (game.currentmenuname==Menu::ed_desc)
{
if(ed.titlemod)
{
@ -2280,7 +2280,7 @@ void editormenurender(int tr, int tg, int tb)
graphics.Print( -1, 110, ed.Desc3, tr, tg, tb, true);
}
}
else if (game.currentmenuname == "ed_music")
else if (game.currentmenuname == Menu::ed_music)
{
graphics.bigprint( -1, 65, "Map Music", tr, tg, tb, true);
@ -2328,7 +2328,7 @@ void editormenurender(int tr, int tg, int tb)
break;
}
}
else if (game.currentmenuname == "ed_quit")
else if (game.currentmenuname == Menu::ed_quit)
{
graphics.bigprint( -1, 90, "Save before", tr, tg, tb, true);
graphics.bigprint( -1, 110, "quitting?", tr, tg, tb, true);
@ -3454,14 +3454,14 @@ void editorlogic()
map.nexttowercolour();
ed.settingsmod=false;
graphics.backgrounddrawn=false;
game.createmenu("mainmenu");
game.createmenu(Menu::mainmenu);
}
}
void editormenuactionpress()
{
if (game.currentmenuname == "ed_desc")
if (game.currentmenuname == Menu::ed_desc)
{
switch (game.currentmenuoption)
{
@ -3491,19 +3491,19 @@ void editormenuactionpress()
break;
case 4:
music.playef(11);
game.createmenu("ed_settings");
game.createmenu(Menu::ed_settings);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "ed_settings")
else if (game.currentmenuname == Menu::ed_settings)
{
switch (game.currentmenuoption)
{
case 0:
//Change level description stuff
music.playef(11);
game.createmenu("ed_desc");
game.createmenu(Menu::ed_desc);
map.nexttowercolour();
break;
case 1:
@ -3522,7 +3522,7 @@ void editormenuactionpress()
break;
case 2:
music.playef(11);
game.createmenu("ed_music");
game.createmenu(Menu::ed_music);
map.nexttowercolour();
if(ed.levmusic>0) music.play(ed.levmusic);
break;
@ -3556,12 +3556,12 @@ void editormenuactionpress()
break;
case 5:
music.playef(11);
game.createmenu("ed_quit");
game.createmenu(Menu::ed_quit);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "ed_music")
else if (game.currentmenuname == Menu::ed_music)
{
switch (game.currentmenuoption)
{
@ -3584,12 +3584,12 @@ void editormenuactionpress()
case 1:
music.playef(11);
music.fadeout();
game.createmenu("ed_settings");
game.createmenu(Menu::ed_settings);
map.nexttowercolour();
break;
}
}
else if (game.currentmenuname == "ed_quit")
else if (game.currentmenuname == Menu::ed_quit)
{
switch (game.currentmenuoption)
{
@ -3618,7 +3618,7 @@ void editormenuactionpress()
case 2:
//Go back to editor
music.playef(11);
game.createmenu("ed_settings");
game.createmenu(Menu::ed_settings);
map.nexttowercolour();
break;
}
@ -3701,7 +3701,7 @@ void editorinput()
ed.settingsmod=!ed.settingsmod;
graphics.backgrounddrawn=false;
game.createmenu("ed_settings");
game.createmenu(Menu::ed_settings);
map.nexttowercolour();
}
}