From be64d4f704b1a941169e934310404f86f7dcccde Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 15 Apr 2020 10:14:42 -0700 Subject: [PATCH] Move menu ACTION press handling to separate function This takes out 3 indentation levels from the ACTION press handling, making titleinput() easier to read as a whole. Unfortunately, we have to put menuactionpress() first, even though I'd want it the other way around, otherwise titleinput() won't know what it is. --- desktop_version/src/Input.cpp | 2697 +++++++++++++++++---------------- 1 file changed, 1351 insertions(+), 1346 deletions(-) diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index f30d51a6..3a8d5f91 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -110,6 +110,1356 @@ void updatebuttonmappings(int bind) } } +void menuactionpress() +{ + if (game.currentmenuname == "mainmenu") + { + +#if defined(MAKEANDPLAY) + if (game.currentmenuoption == 0) + { + //Bring you to the normal playmenu + music.playef(11); + game.createmenu("playerworlds"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 1) + { + //Options + music.playef(11); + game.createmenu("graphicoptions"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 2) + { + //Options + music.playef(11); + game.createmenu("options"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 3) + { + //bye! + music.playef(2); + game.mainmenu = 100; + graphics.fademode = 2; + } + } +#elif !defined(MAKEANDPLAY) + #if defined(NO_CUSTOM_LEVELS) + if (game.currentmenuoption == 0) + { + //Play + if (game.telesummary == "" && game.quicksummary == "") + { + //No saves exist, just start a new game + game.mainmenu = 0; + graphics.fademode = 2; + } + else + { + //Bring you to the normal playmenu + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } + else if (game.currentmenuoption == 1) + { + //Options + music.playef(11); + game.createmenu("graphicoptions"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 2) + { + //Options + music.playef(11); + game.createmenu("options"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 3) + { + //Credits + music.playef(11); + game.createmenu("credits"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 4) + { + //bye! + music.playef(2); + game.mainmenu = 100; + graphics.fademode = 2; + } + #else + if (game.currentmenuoption == 0) + { + //Play + if (game.telesummary == "" && game.quicksummary == "") + { + //No saves exist, just start a new game + game.mainmenu = 0; + graphics.fademode = 2; + } + else + { + //Bring you to the normal playmenu + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } + else if (game.currentmenuoption == 1) + { + //Bring you to the normal playmenu + music.playef(11); + game.createmenu("playerworlds"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 2) + { + //Options + music.playef(11); + game.createmenu("graphicoptions"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 3) + { + //Options + music.playef(11); + game.createmenu("options"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 4) + { + //Credits + music.playef(11); + game.createmenu("credits"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 5) + { + //bye! + music.playef(2); + game.mainmenu = 100; + graphics.fademode = 2; + } + #endif + } +#endif +#if !defined(NO_CUSTOM_LEVELS) + else if(game.currentmenuname=="levellist") + { + if(game.currentmenuoption==(int)game.menuoptions.size()-1){ + //go back to menu + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + }else if(game.currentmenuoption==(int)game.menuoptions.size()-2){ + //next page + music.playef(11); + if((size_t) ((game.levelpage*8)+8) >= ed.ListOfMetaData.size()){ + game.levelpage=0; + }else{ + game.levelpage++; + } + game.createmenu("levellist"); + game.currentmenuoption=game.menuoptions.size()-2; + map.nexttowercolour(); + }else{ + //Ok, launch the level! + //PLAY CUSTOM LEVEL HOOK + music.playef(11); + game.playcustomlevel=(game.levelpage*8)+game.currentmenuoption; + game.customleveltitle=ed.ListOfMetaData[game.playcustomlevel].title; + game.customlevelfilename=ed.ListOfMetaData[game.playcustomlevel].filename; + + std::string name = "saves/" + ed.ListOfMetaData[game.playcustomlevel].filename.substr(7) + ".vvv"; + TiXmlDocument doc; + if (!FILESYSTEM_loadTiXmlDocument(name.c_str(), &doc)){ + game.mainmenu = 22; + graphics.fademode = 2; + }else{ + game.createmenu("quickloadlevel"); + map.nexttowercolour(); + } + } + } +#endif + else if(game.currentmenuname=="quickloadlevel") + { + if(game.currentmenuoption==0){//continue save + game.mainmenu = 23; + graphics.fademode = 2; + }else if(game.currentmenuoption==1){ + game.mainmenu = 22; + graphics.fademode = 2; + }else if(game.currentmenuoption==2){ + music.playef(11); + game.levelpage=0; + game.createmenu("levellist"); + map.nexttowercolour(); + } + } +#if !defined(NO_CUSTOM_LEVELS) + else if(game.currentmenuname=="playerworlds") + { + #if !defined(NO_EDITOR) + if(game.currentmenuoption==0){ + + music.playef(11); + game.levelpage=0; + ed.getDirectoryData(); + game.loadcustomlevelstats(); //Should only load a file if it's needed + game.createmenu("levellist"); + map.nexttowercolour(); + }else if(game.currentmenuoption==1){ + //LEVEL EDITOR HOOK + music.playef(11); + game.mainmenu = 20; + graphics.fademode = 2; + ed.filename=""; + }/*else if(game.currentmenuoption==2){ + music.playef(11); + //"OPENFOLDERHOOK" + //When the player selects the "open level folder" menu option, + //this is where it should run the appropriate code. + //This code should: + // - Minimise the game + // - Open the levels folder for whatever operating system we're on + SDL_assert(0 && "Remove open level dir"); + + }*/else if(game.currentmenuoption==2){ + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + #else + if(game.currentmenuoption==0){ + music.playef(11); + game.levelpage=0; + ed.getDirectoryData(); + game.loadcustomlevelstats(); //Should only load a file if it's needed + game.createmenu("levellist"); + map.nexttowercolour(); + }else if(game.currentmenuoption==1){ + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + #endif + } +#endif + else if(game.currentmenuname=="errornostart"){ + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + else if (game.currentmenuname == "graphicoptions") + { + if (game.currentmenuoption == 0){ + music.playef(11); + graphics.screenbuffer->toggleFullScreen(); + game.fullscreen = !game.fullscreen; + game.savestats(); + game.createmenu("graphicoptions"); + game.currentmenuoption = 0; + }else if (game.currentmenuoption == 1){ + music.playef(11); + graphics.screenbuffer->toggleStretchMode(); + game.stretchMode = (game.stretchMode + 1) % 3; + game.savestats(); + game.createmenu("graphicoptions"); + game.currentmenuoption = 1; + }else if (game.currentmenuoption == 2){ + music.playef(11); + graphics.screenbuffer->toggleLinearFilter(); + game.useLinearFilter = !game.useLinearFilter; + game.savestats(); + game.createmenu("graphicoptions"); + game.currentmenuoption = 2; + }else if (game.currentmenuoption == 3){ + //change smoothing + music.playef(11); + game.fullScreenEffect_badSignal = !game.fullScreenEffect_badSignal; + //Hook the analogue thing in here: ABCDEFG + graphics.screenbuffer->badSignalEffect= !graphics.screenbuffer->badSignalEffect; + game.savestats(); + game.createmenu("graphicoptions"); + game.currentmenuoption = 3; + }else if (game.currentmenuoption == 4) { + //toggle mouse cursor + music.playef(11); + if (graphics.showmousecursor == true) { + SDL_ShowCursor(SDL_DISABLE); + graphics.showmousecursor = false; + } + else { + SDL_ShowCursor(SDL_ENABLE); + graphics.showmousecursor = true; + } + } + else + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "youwannaquit") + { + if (game.currentmenuoption == 0) + { + //bye! + music.playef(2); + game.mainmenu = 100; + graphics.fademode = 2; + } + else + { + music.playef(11); + game.createmenu(game.previousmenuname); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "setinvincibility") + { + if (game.currentmenuoption == 0) + { + //back + music.playef(11); + game.createmenu("accessibility"); + game.currentmenuoption = 3; + map.nexttowercolour(); + } + else + { + map.invincibility = !map.invincibility; + game.savestats(); + music.playef(11); + game.createmenu("accessibility"); + game.currentmenuoption = 3; + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "setslowdown1") + { + if (game.currentmenuoption == 0) + { + //back + music.playef(11); + game.createmenu("accessibility"); + game.currentmenuoption = 4; + map.nexttowercolour(); + } + else + { + //change game speed + game.deletequick(); + game.deletetele(); + game.createmenu("setslowdown2"); + map.nexttowercolour(); + music.playef(11); + } + } + else if (game.currentmenuname == "setslowdown2") + { + if (game.currentmenuoption == 0) + { + //back + game.gameframerate=34; + game.slowdown = 30; + game.savestats(); + music.playef(11); + game.createmenu("accessibility"); + game.currentmenuoption = 4; + map.nexttowercolour(); + } + else if (game.currentmenuoption == 1) + { + game.gameframerate=41; + game.slowdown = 24; + game.savestats(); + music.playef(11); + game.createmenu("accessibility"); + game.currentmenuoption = 4; + map.nexttowercolour(); + } + else if (game.currentmenuoption == 2) + { + game.gameframerate=55; + game.slowdown = 18; + game.savestats(); + music.playef(11); + game.createmenu("accessibility"); + game.currentmenuoption = 4; + map.nexttowercolour(); + } + else if (game.currentmenuoption == 3) + { + game.gameframerate=83; + game.slowdown = 12; + game.savestats(); + music.playef(11); + game.createmenu("accessibility"); + game.currentmenuoption = 4; + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "accessibility") + { + if (game.currentmenuoption == 0) + { + //disable animated backgrounds + game.colourblindmode = !game.colourblindmode; + game.savestats(); + map.tdrawback = true; + music.playef(11); + } + else if (game.currentmenuoption == 1) + { + //disable screeneffects + game.noflashingmode = !game.noflashingmode; + game.savestats(); + if (!game.noflashingmode) + { + music.playef(18); + game.screenshake = 10; + game.flashlight = 5; + }else{ + music.playef(11); + } + } + else if (game.currentmenuoption == 2) + { + //disable text outline + graphics.notextoutline = !graphics.notextoutline; + game.savestats(); + music.playef(11); + } + else if (game.currentmenuoption == 3) + { + //invincibility + if (!map.invincibility) + { + game.createmenu("setinvincibility"); + map.nexttowercolour(); + } + else + { + map.invincibility = !map.invincibility; + } + music.playef(11); + } + else if (game.currentmenuoption == 4) + { + //change game speed + game.createmenu("setslowdown2"); + map.nexttowercolour(); + music.playef(11); + } + else if (game.currentmenuoption == 5) + { + // toggle fake load screen + game.skipfakeload = !game.skipfakeload; + music.playef(11); + } + else if (game.currentmenuoption == 6) + { + // toggle translucent roomname BG + graphics.translucentroomname = !graphics.translucentroomname; + music.playef(11); + } + else if (game.currentmenuoption == 7) + { + //back + music.playef(11); + game.createmenu("options"); + map.nexttowercolour(); + } + else + { + //Can't do yet! play sad sound + music.playef(2); + } + } + else if (game.currentmenuname == "options") + { + +#if defined(MAKEANDPLAY) + if (game.currentmenuoption == 0) + { + //accessibility options + music.playef(11); + game.createmenu("accessibility"); + map.nexttowercolour(); + } + + else if (game.currentmenuoption == 1) + { + //clear data menu + music.playef(11); + game.createmenu("controller"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 2) + { + //clear data menu + music.playef(11); + game.createmenu("cleardatamenu"); + map.nexttowercolour(); + } + + if(music.mmmmmm){ + if (game.currentmenuoption == 3) + { + //**** TOGGLE MMMMMM + if(game.usingmmmmmm > 0){ + game.usingmmmmmm=0; + }else{ + game.usingmmmmmm=1; + } + music.usingmmmmmm = !music.usingmmmmmm; + music.playef(11); + music.play(6); + game.savestats(); + } + if (game.currentmenuoption == 4) + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + }else{ + if (game.currentmenuoption == 3) + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + +#elif !defined(MAKEANDPLAY) + if (game.currentmenuoption == 0) + { + //accessibility options + music.playef(11); + game.createmenu("accessibility"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 1) + { + //unlock play options + music.playef(11); + game.createmenu("unlockmenu"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 2) + { + //clear data menu + music.playef(11); + game.createmenu("controller"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 3) + { + //clear data menu + music.playef(11); + game.createmenu("cleardatamenu"); + map.nexttowercolour(); + } + + if(music.mmmmmm){ + if (game.currentmenuoption == 4) + { + //**** TOGGLE MMMMMM + if(game.usingmmmmmm > 0){ + game.usingmmmmmm=0; + }else{ + game.usingmmmmmm=1; + } + music.usingmmmmmm = !music.usingmmmmmm; + music.playef(11); + music.play(6); + game.savestats(); + } + if (game.currentmenuoption == 5) + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + }else{ + if (game.currentmenuoption == 4) + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } +#endif + } + else if (game.currentmenuname == "unlockmenutrials") + { + if (game.currentmenuoption == 0) //unlock 1 + { + game.unlock[9] = true; + game.unlocknotify[9] = true; + music.playef(11); + game.savestats(); + game.createmenu("unlockmenutrials"); + game.currentmenuoption = 0; + } + else if (game.currentmenuoption == 1) //unlock 2 + { + game.unlock[10] = true; + game.unlocknotify[10] = true; + music.playef(11); + game.savestats(); + game.createmenu("unlockmenutrials"); + game.currentmenuoption = 1; + } + else if (game.currentmenuoption == 2) //unlock 3 + { + game.unlock[11] = true; + game.unlocknotify[11] = true; + music.playef(11); + game.savestats(); + game.createmenu("unlockmenutrials"); + game.currentmenuoption = 2; + } + else if (game.currentmenuoption == 3) //unlock 4 + { + game.unlock[12] = true; + game.unlocknotify[12] = true; + music.playef(11); + game.savestats(); + game.createmenu("unlockmenutrials"); + game.currentmenuoption = 3; + } + else if (game.currentmenuoption == 4) //unlock 5 + { + game.unlock[13] = true; + game.unlocknotify[13] = true; + music.playef(11); + game.savestats(); + game.createmenu("unlockmenutrials"); + game.currentmenuoption = 4; + } + else if (game.currentmenuoption == 5) //unlock 6 + { + game.unlock[14] = true; + game.unlocknotify[14] = true; + music.playef(11); + game.savestats(); + game.createmenu("unlockmenutrials"); + game.currentmenuoption = 5; + } + else if (game.currentmenuoption == 6) //back + { + //back + music.playef(11); + game.createmenu("unlockmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "unlockmenu") + { + if (game.currentmenuoption == 0) + { + //unlock time trials separately... + music.playef(11); + game.createmenu("unlockmenutrials"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 1) + { + //unlock intermissions + music.playef(11); + game.unlock[16] = true; + game.unlocknotify[16] = true; + game.unlock[6] = true; + game.unlock[7] = true; + game.savestats(); + game.createmenu("unlockmenu"); + game.currentmenuoption = 1; + } + else if (game.currentmenuoption == 2) + { + //unlock no death mode + music.playef(11); + game.unlock[17] = true; + game.unlocknotify[17] = true; + game.savestats(); + game.createmenu("unlockmenu"); + game.currentmenuoption = 2; + } + else if (game.currentmenuoption == 3) + { + //unlock flip mode + music.playef(11); + game.unlock[18] = true; + game.unlocknotify[18] = true; + game.savestats(); + game.createmenu("unlockmenu"); + game.currentmenuoption = 3; + } + else if (game.currentmenuoption == 4) + { + //unlock jukebox + music.playef(11); + game.stat_trinkets = 20; + game.savestats(); + game.createmenu("unlockmenu"); + game.currentmenuoption = 4; + } + else if (game.currentmenuoption == 5) + { + //unlock secret lab + music.playef(11); + game.unlock[8] = true; + game.unlocknotify[8] = true; + game.savestats(); + game.createmenu("unlockmenu"); + game.currentmenuoption = 5; + } + else + { + //back + music.playef(11); + game.createmenu("options"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "credits") + { + if (game.currentmenuoption == 0) + { + //next page + music.playef(11); + game.createmenu("credits2"); + map.nexttowercolour(); + } + else + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "credits2") + { + if (game.currentmenuoption == 0) + { + //next page + music.playef(11); + game.createmenu("credits25"); + map.nexttowercolour(); + } + else + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "credits25") + { + if (game.currentmenuoption == 0) + { + //next page + music.playef(11); + game.createmenu("credits3"); + map.nexttowercolour(); + } + else + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "credits3") + { + if (game.currentmenuoption == 0) + { + //next page + music.playef(11); + game.current_credits_list_index += 9; + + if (game.current_credits_list_index >= (int)game.superpatrons.size()) + { + // No more super patrons. Move to the next credits section + game.current_credits_list_index = 0; + game.createmenu("credits4"); + } + else + { + // There are more super patrons. Refresh the menu with the next ones + game.createmenu("credits3"); + } + + map.nexttowercolour(); + } + else + { + //back + music.playef(11); + game.current_credits_list_index = 0; + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "credits4") + { + if (game.currentmenuoption == 0) + { + //next page + music.playef(11); + game.current_credits_list_index += 14; + + if (game.current_credits_list_index >= (int)game.patrons.size()) + { + // No more patrons. Move to the next credits section + game.current_credits_list_index = 0; + game.createmenu("credits5"); + } + else + { + // There are more patrons. Refresh the menu with the next ones + game.createmenu("credits4"); + } + + map.nexttowercolour(); + } + else + { + //back + music.playef(11); + game.current_credits_list_index = 0; + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "credits5") + { + if (game.currentmenuoption == 0) + { + //next page + music.playef(11); + game.current_credits_list_index += 9; + + if (game.current_credits_list_index >= (int)game.githubfriends.size()) + { + // No more GitHub contributors. Move to the next credits section + game.current_credits_list_index = 0; + game.createmenu("credits6"); + } + else + { + // There are more GitHub contributors. Refresh the menu with the next ones + game.createmenu("credits5"); + } + + map.nexttowercolour(); + } + else + { + //back + music.playef(11); + game.current_credits_list_index = 0; + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "credits6") + { + if (game.currentmenuoption == 0) + { + //first page + music.playef(11); + game.createmenu("credits"); + map.nexttowercolour(); + } + else + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + music.niceplay(6); + } + } + else if (game.currentmenuname == "play") + { + if (game.currentmenuoption == 0) + { + //continue + //right, this depends on what saves you've got + if (game.telesummary == "") + { + //You at least have a quicksave, or you couldn't have gotten here + game.mainmenu = 2; + graphics.fademode = 2; + } + else if (game.quicksummary == "") + { + //You at least have a telesave, or you couldn't have gotten here + game.mainmenu = 1; + graphics.fademode = 2; + } + else + { + //go to a menu! + music.playef(11); + game.loadsummary(); //Prepare save slots to display + game.createmenu("continue"); + map.settowercolour(3); + } + } + else if (game.currentmenuoption == 1) + { + //play modes + music.playef(11); + game.createmenu("playmodes"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 2) + { + //newgame + music.playef(11); + game.createmenu("newgamewarning"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 3) + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "playsecretlab") + { + //as above, except with an extra option... + if (game.currentmenuoption == 0) + { + //continue + //right, this depends on what saves you've got + if (game.telesummary == "") + { + //You at least have a quicksave, or you couldn't have gotten here + game.mainmenu = 2; + graphics.fademode = 2; + } + else if (game.quicksummary == "") + { + //You at least have a telesave, or you couldn't have gotten here + game.mainmenu = 1; + graphics.fademode = 2; + } + else + { + //go to a menu! + music.playef(11); + game.loadsummary(); //Prepare save slots to display + game.createmenu("continue"); + map.settowercolour(3); + } + } + else if (game.currentmenuoption == 1) + { + if(!map.invincibility){ + game.mainmenu = 11; + graphics.fademode = 2; + }else{ + //Can't do yet! play sad sound + music.playef(2); + } + } + else if (game.currentmenuoption == 2) + { + //play modes + music.playef(11); + game.createmenu("playmodes"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 3) + { + //newgame + music.playef(11); + game.createmenu("newgamewarning"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 4) + { + //back + music.playef(11); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "newgamewarning") + { + if (game.currentmenuoption == 0) + { + //yep + game.mainmenu = 0; + graphics.fademode = 2; + game.deletequick(); + game.deletetele(); + } + else + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } + + else if (game.currentmenuname == "controller") + { + if (game.currentmenuoption == 0) + { + game.controllerSensitivity++; + music.playef(11); + if(game.controllerSensitivity > 4) + { + game.controllerSensitivity = 0; + } + } + + if (game.currentmenuoption == 4) + { + music.playef(11); + game.createmenu("options"); + } + } + else if (game.currentmenuname == "cleardatamenu") + { + if (game.currentmenuoption == 0) + { + //back + music.playef(11); + game.createmenu("options"); + map.nexttowercolour(); + } + else + { + //yep + music.playef(23); + game.deletequick(); + game.deletetele(); + game.deletestats(); + game.flashlight = 5; + game.screenshake = 15; + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "playmodes") + { + if (game.currentmenuoption == 0 && game.slowdown == 30 && !map.invincibility) //go to the time trial menu + { + music.playef(11); + game.createmenu("timetrials"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 1 && game.unlock[16]) + { + //intermission mode menu + music.playef(11); + game.createmenu("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"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 3 && game.unlock[18]) //enable/disable flip mode + { + music.playef(18); + game.screenshake = 10; + game.flashlight = 5; + graphics.setflipmode = !graphics.setflipmode; + game.savemystats = true; + } + else if (game.currentmenuoption == 4) + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + else + { + //Can't do yet! play sad sound + music.playef(2); + } + } + else if (game.currentmenuname == "startnodeathmode") + { + if (game.currentmenuoption == 0) //start no death mode, disabling cutscenes + { + game.mainmenu = 10; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 1) + { + game.mainmenu = 9; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 2) + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "continue") + { + if (game.currentmenuoption == 0) + { + game.mainmenu = 1; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 1) + { + game.mainmenu = 2; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 2) + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "intermissionmenu") + { + if (game.currentmenuoption == 0) + { + music.playef(11); + music.play(6); + game.createmenu("playint1"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 1) + { + music.playef(11); + music.play(6); + game.createmenu("playint2"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 2) + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "playint1") + { + if (game.currentmenuoption == 0) + { + game.mainmenu = 12; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 1) + { + game.mainmenu = 13; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 2) + { + game.mainmenu = 14; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 3) + { + game.mainmenu = 15; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 4) + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "playint2") + { + if (game.currentmenuoption == 0) + { + game.mainmenu = 16; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 1) + { + game.mainmenu = 17; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 2) + { + game.mainmenu = 18; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 3) + { + game.mainmenu = 19; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 4) + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } + else if (game.currentmenuname == "gameover2") + { + //back + music.playef(11); + music.play(6); + game.createmenu("mainmenu"); + map.nexttowercolour(); + } + else if (game.currentmenuname == "unlocktimetrials" || game.currentmenuname == "unlocktimetrial") + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + else if (game.currentmenuname == "unlocknodeathmode" || game.currentmenuname == "unlockintermission" + || game.currentmenuname == "unlockflipmode") + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + else if (game.currentmenuname == "timetrials") + { + if (game.currentmenuoption == 0 && game.unlock[9]) //space station 1 + { + game.mainmenu = 3; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 1 && game.unlock[10]) //lab + { + game.mainmenu = 4; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 2 && game.unlock[11]) //tower + { + game.mainmenu = 5; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 3 && game.unlock[12]) //station 2 + { + game.mainmenu = 6; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 4 && game.unlock[13]) //warp + { + game.mainmenu = 7; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 5 && game.unlock[14]) //final + { + game.mainmenu = 8; + graphics.fademode = 2; + } + else if (game.currentmenuoption == 6) //go to the time trial menu + { + //back + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + else + { + //Can't do yet! play sad sound + music.playef(2); + } + } + else if (game.currentmenuname == "timetrialcomplete3") + { + if (game.currentmenuoption == 0) + { + //back + music.playef(11); + music.play(6); + game.createmenu("play"); + map.nexttowercolour(); + } + else if (game.currentmenuoption == 1) + { + //duplicate the above based on given time trial level! + if (game.timetriallevel == 0) //space station 1 + { + game.mainmenu = 3; + graphics.fademode = 2; + } + else if (game.timetriallevel == 1) //lab + { + game.mainmenu = 4; + graphics.fademode = 2; + } + else if (game.timetriallevel == 2) //tower + { + game.mainmenu = 5; + graphics.fademode = 2; + } + else if (game.timetriallevel == 3) //station 2 + { + game.mainmenu = 6; + graphics.fademode = 2; + } + else if (game.timetriallevel == 4) //warp + { + game.mainmenu = 7; + graphics.fademode = 2; + } + else if (game.timetriallevel == 5) //final + { + game.mainmenu = 8; + graphics.fademode = 2; + } + } + } + else if (game.currentmenuname == "gamecompletecontinue" || game.currentmenuname == "nodeathmodecomplete2") + { + if (game.currentmenuoption == 0) + { + music.play(6); + music.playef(11); + game.createmenu("play"); + map.nexttowercolour(); + } + } +} + void titleinput() { //game.mx = (mouseX / 4); @@ -191,1352 +1541,7 @@ void titleinput() } else { - if (game.currentmenuname == "mainmenu") - { - -#if defined(MAKEANDPLAY) - if (game.currentmenuoption == 0) - { - //Bring you to the normal playmenu - music.playef(11); - game.createmenu("playerworlds"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 1) - { - //Options - music.playef(11); - game.createmenu("graphicoptions"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 2) - { - //Options - music.playef(11); - game.createmenu("options"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 3) - { - //bye! - music.playef(2); - game.mainmenu = 100; - graphics.fademode = 2; - } - } -#elif !defined(MAKEANDPLAY) - #if defined(NO_CUSTOM_LEVELS) - if (game.currentmenuoption == 0) - { - //Play - if (game.telesummary == "" && game.quicksummary == "") - { - //No saves exist, just start a new game - game.mainmenu = 0; - graphics.fademode = 2; - } - else - { - //Bring you to the normal playmenu - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } - else if (game.currentmenuoption == 1) - { - //Options - music.playef(11); - game.createmenu("graphicoptions"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 2) - { - //Options - music.playef(11); - game.createmenu("options"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 3) - { - //Credits - music.playef(11); - game.createmenu("credits"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 4) - { - //bye! - music.playef(2); - game.mainmenu = 100; - graphics.fademode = 2; - } - #else - if (game.currentmenuoption == 0) - { - //Play - if (game.telesummary == "" && game.quicksummary == "") - { - //No saves exist, just start a new game - game.mainmenu = 0; - graphics.fademode = 2; - } - else - { - //Bring you to the normal playmenu - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } - else if (game.currentmenuoption == 1) - { - //Bring you to the normal playmenu - music.playef(11); - game.createmenu("playerworlds"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 2) - { - //Options - music.playef(11); - game.createmenu("graphicoptions"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 3) - { - //Options - music.playef(11); - game.createmenu("options"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 4) - { - //Credits - music.playef(11); - game.createmenu("credits"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 5) - { - //bye! - music.playef(2); - game.mainmenu = 100; - graphics.fademode = 2; - } - #endif - } -#endif -#if !defined(NO_CUSTOM_LEVELS) - else if(game.currentmenuname=="levellist") - { - if(game.currentmenuoption==(int)game.menuoptions.size()-1){ - //go back to menu - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - }else if(game.currentmenuoption==(int)game.menuoptions.size()-2){ - //next page - music.playef(11); - if((size_t) ((game.levelpage*8)+8) >= ed.ListOfMetaData.size()){ - game.levelpage=0; - }else{ - game.levelpage++; - } - game.createmenu("levellist"); - game.currentmenuoption=game.menuoptions.size()-2; - map.nexttowercolour(); - }else{ - //Ok, launch the level! - //PLAY CUSTOM LEVEL HOOK - music.playef(11); - game.playcustomlevel=(game.levelpage*8)+game.currentmenuoption; - game.customleveltitle=ed.ListOfMetaData[game.playcustomlevel].title; - game.customlevelfilename=ed.ListOfMetaData[game.playcustomlevel].filename; - - std::string name = "saves/" + ed.ListOfMetaData[game.playcustomlevel].filename.substr(7) + ".vvv"; - TiXmlDocument doc; - if (!FILESYSTEM_loadTiXmlDocument(name.c_str(), &doc)){ - game.mainmenu = 22; - graphics.fademode = 2; - }else{ - game.createmenu("quickloadlevel"); - map.nexttowercolour(); - } - } - } -#endif - else if(game.currentmenuname=="quickloadlevel") - { - if(game.currentmenuoption==0){//continue save - game.mainmenu = 23; - graphics.fademode = 2; - }else if(game.currentmenuoption==1){ - game.mainmenu = 22; - graphics.fademode = 2; - }else if(game.currentmenuoption==2){ - music.playef(11); - game.levelpage=0; - game.createmenu("levellist"); - map.nexttowercolour(); - } - } -#if !defined(NO_CUSTOM_LEVELS) - else if(game.currentmenuname=="playerworlds") - { - #if !defined(NO_EDITOR) - if(game.currentmenuoption==0){ - - music.playef(11); - game.levelpage=0; - ed.getDirectoryData(); - game.loadcustomlevelstats(); //Should only load a file if it's needed - game.createmenu("levellist"); - map.nexttowercolour(); - }else if(game.currentmenuoption==1){ - //LEVEL EDITOR HOOK - music.playef(11); - game.mainmenu = 20; - graphics.fademode = 2; - ed.filename=""; - }/*else if(game.currentmenuoption==2){ - music.playef(11); - //"OPENFOLDERHOOK" - //When the player selects the "open level folder" menu option, - //this is where it should run the appropriate code. - //This code should: - // - Minimise the game - // - Open the levels folder for whatever operating system we're on - SDL_assert(0 && "Remove open level dir"); - - }*/else if(game.currentmenuoption==2){ - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - #else - if(game.currentmenuoption==0){ - music.playef(11); - game.levelpage=0; - ed.getDirectoryData(); - game.loadcustomlevelstats(); //Should only load a file if it's needed - game.createmenu("levellist"); - map.nexttowercolour(); - }else if(game.currentmenuoption==1){ - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - #endif - } -#endif - else if(game.currentmenuname=="errornostart"){ - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - else if (game.currentmenuname == "graphicoptions") - { - if (game.currentmenuoption == 0){ - music.playef(11); - graphics.screenbuffer->toggleFullScreen(); - game.fullscreen = !game.fullscreen; - game.savestats(); - game.createmenu("graphicoptions"); - game.currentmenuoption = 0; - }else if (game.currentmenuoption == 1){ - music.playef(11); - graphics.screenbuffer->toggleStretchMode(); - game.stretchMode = (game.stretchMode + 1) % 3; - game.savestats(); - game.createmenu("graphicoptions"); - game.currentmenuoption = 1; - }else if (game.currentmenuoption == 2){ - music.playef(11); - graphics.screenbuffer->toggleLinearFilter(); - game.useLinearFilter = !game.useLinearFilter; - game.savestats(); - game.createmenu("graphicoptions"); - game.currentmenuoption = 2; - }else if (game.currentmenuoption == 3){ - //change smoothing - music.playef(11); - game.fullScreenEffect_badSignal = !game.fullScreenEffect_badSignal; - //Hook the analogue thing in here: ABCDEFG - graphics.screenbuffer->badSignalEffect= !graphics.screenbuffer->badSignalEffect; - game.savestats(); - game.createmenu("graphicoptions"); - game.currentmenuoption = 3; - }else if (game.currentmenuoption == 4) { - //toggle mouse cursor - music.playef(11); - if (graphics.showmousecursor == true) { - SDL_ShowCursor(SDL_DISABLE); - graphics.showmousecursor = false; - } - else { - SDL_ShowCursor(SDL_ENABLE); - graphics.showmousecursor = true; - } - } - else - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "youwannaquit") - { - if (game.currentmenuoption == 0) - { - //bye! - music.playef(2); - game.mainmenu = 100; - graphics.fademode = 2; - } - else - { - music.playef(11); - game.createmenu(game.previousmenuname); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "setinvincibility") - { - if (game.currentmenuoption == 0) - { - //back - music.playef(11); - game.createmenu("accessibility"); - game.currentmenuoption = 3; - map.nexttowercolour(); - } - else - { - map.invincibility = !map.invincibility; - game.savestats(); - music.playef(11); - game.createmenu("accessibility"); - game.currentmenuoption = 3; - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "setslowdown1") - { - if (game.currentmenuoption == 0) - { - //back - music.playef(11); - game.createmenu("accessibility"); - game.currentmenuoption = 4; - map.nexttowercolour(); - } - else - { - //change game speed - game.deletequick(); - game.deletetele(); - game.createmenu("setslowdown2"); - map.nexttowercolour(); - music.playef(11); - } - } - else if (game.currentmenuname == "setslowdown2") - { - if (game.currentmenuoption == 0) - { - //back - game.gameframerate=34; - game.slowdown = 30; - game.savestats(); - music.playef(11); - game.createmenu("accessibility"); - game.currentmenuoption = 4; - map.nexttowercolour(); - } - else if (game.currentmenuoption == 1) - { - game.gameframerate=41; - game.slowdown = 24; - game.savestats(); - music.playef(11); - game.createmenu("accessibility"); - game.currentmenuoption = 4; - map.nexttowercolour(); - } - else if (game.currentmenuoption == 2) - { - game.gameframerate=55; - game.slowdown = 18; - game.savestats(); - music.playef(11); - game.createmenu("accessibility"); - game.currentmenuoption = 4; - map.nexttowercolour(); - } - else if (game.currentmenuoption == 3) - { - game.gameframerate=83; - game.slowdown = 12; - game.savestats(); - music.playef(11); - game.createmenu("accessibility"); - game.currentmenuoption = 4; - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "accessibility") - { - if (game.currentmenuoption == 0) - { - //disable animated backgrounds - game.colourblindmode = !game.colourblindmode; - game.savestats(); - map.tdrawback = true; - music.playef(11); - } - else if (game.currentmenuoption == 1) - { - //disable screeneffects - game.noflashingmode = !game.noflashingmode; - game.savestats(); - if (!game.noflashingmode) - { - music.playef(18); - game.screenshake = 10; - game.flashlight = 5; - }else{ - music.playef(11); - } - } - else if (game.currentmenuoption == 2) - { - //disable text outline - graphics.notextoutline = !graphics.notextoutline; - game.savestats(); - music.playef(11); - } - else if (game.currentmenuoption == 3) - { - //invincibility - if (!map.invincibility) - { - game.createmenu("setinvincibility"); - map.nexttowercolour(); - } - else - { - map.invincibility = !map.invincibility; - } - music.playef(11); - } - else if (game.currentmenuoption == 4) - { - //change game speed - game.createmenu("setslowdown2"); - map.nexttowercolour(); - music.playef(11); - } - else if (game.currentmenuoption == 5) - { - // toggle fake load screen - game.skipfakeload = !game.skipfakeload; - music.playef(11); - } - else if (game.currentmenuoption == 6) - { - // toggle translucent roomname BG - graphics.translucentroomname = !graphics.translucentroomname; - music.playef(11); - } - else if (game.currentmenuoption == 7) - { - //back - music.playef(11); - game.createmenu("options"); - map.nexttowercolour(); - } - else - { - //Can't do yet! play sad sound - music.playef(2); - } - } - else if (game.currentmenuname == "options") - { - -#if defined(MAKEANDPLAY) - if (game.currentmenuoption == 0) - { - //accessibility options - music.playef(11); - game.createmenu("accessibility"); - map.nexttowercolour(); - } - - else if (game.currentmenuoption == 1) - { - //clear data menu - music.playef(11); - game.createmenu("controller"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 2) - { - //clear data menu - music.playef(11); - game.createmenu("cleardatamenu"); - map.nexttowercolour(); - } - - if(music.mmmmmm){ - if (game.currentmenuoption == 3) - { - //**** TOGGLE MMMMMM - if(game.usingmmmmmm > 0){ - game.usingmmmmmm=0; - }else{ - game.usingmmmmmm=1; - } - music.usingmmmmmm = !music.usingmmmmmm; - music.playef(11); - music.play(6); - game.savestats(); - } - if (game.currentmenuoption == 4) - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - }else{ - if (game.currentmenuoption == 3) - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - -#elif !defined(MAKEANDPLAY) - if (game.currentmenuoption == 0) - { - //accessibility options - music.playef(11); - game.createmenu("accessibility"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 1) - { - //unlock play options - music.playef(11); - game.createmenu("unlockmenu"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 2) - { - //clear data menu - music.playef(11); - game.createmenu("controller"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 3) - { - //clear data menu - music.playef(11); - game.createmenu("cleardatamenu"); - map.nexttowercolour(); - } - - if(music.mmmmmm){ - if (game.currentmenuoption == 4) - { - //**** TOGGLE MMMMMM - if(game.usingmmmmmm > 0){ - game.usingmmmmmm=0; - }else{ - game.usingmmmmmm=1; - } - music.usingmmmmmm = !music.usingmmmmmm; - music.playef(11); - music.play(6); - game.savestats(); - } - if (game.currentmenuoption == 5) - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - }else{ - if (game.currentmenuoption == 4) - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } -#endif - } - else if (game.currentmenuname == "unlockmenutrials") - { - if (game.currentmenuoption == 0) //unlock 1 - { - game.unlock[9] = true; - game.unlocknotify[9] = true; - music.playef(11); - game.savestats(); - game.createmenu("unlockmenutrials"); - game.currentmenuoption = 0; - } - else if (game.currentmenuoption == 1) //unlock 2 - { - game.unlock[10] = true; - game.unlocknotify[10] = true; - music.playef(11); - game.savestats(); - game.createmenu("unlockmenutrials"); - game.currentmenuoption = 1; - } - else if (game.currentmenuoption == 2) //unlock 3 - { - game.unlock[11] = true; - game.unlocknotify[11] = true; - music.playef(11); - game.savestats(); - game.createmenu("unlockmenutrials"); - game.currentmenuoption = 2; - } - else if (game.currentmenuoption == 3) //unlock 4 - { - game.unlock[12] = true; - game.unlocknotify[12] = true; - music.playef(11); - game.savestats(); - game.createmenu("unlockmenutrials"); - game.currentmenuoption = 3; - } - else if (game.currentmenuoption == 4) //unlock 5 - { - game.unlock[13] = true; - game.unlocknotify[13] = true; - music.playef(11); - game.savestats(); - game.createmenu("unlockmenutrials"); - game.currentmenuoption = 4; - } - else if (game.currentmenuoption == 5) //unlock 6 - { - game.unlock[14] = true; - game.unlocknotify[14] = true; - music.playef(11); - game.savestats(); - game.createmenu("unlockmenutrials"); - game.currentmenuoption = 5; - } - else if (game.currentmenuoption == 6) //back - { - //back - music.playef(11); - game.createmenu("unlockmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "unlockmenu") - { - if (game.currentmenuoption == 0) - { - //unlock time trials separately... - music.playef(11); - game.createmenu("unlockmenutrials"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 1) - { - //unlock intermissions - music.playef(11); - game.unlock[16] = true; - game.unlocknotify[16] = true; - game.unlock[6] = true; - game.unlock[7] = true; - game.savestats(); - game.createmenu("unlockmenu"); - game.currentmenuoption = 1; - } - else if (game.currentmenuoption == 2) - { - //unlock no death mode - music.playef(11); - game.unlock[17] = true; - game.unlocknotify[17] = true; - game.savestats(); - game.createmenu("unlockmenu"); - game.currentmenuoption = 2; - } - else if (game.currentmenuoption == 3) - { - //unlock flip mode - music.playef(11); - game.unlock[18] = true; - game.unlocknotify[18] = true; - game.savestats(); - game.createmenu("unlockmenu"); - game.currentmenuoption = 3; - } - else if (game.currentmenuoption == 4) - { - //unlock jukebox - music.playef(11); - game.stat_trinkets = 20; - game.savestats(); - game.createmenu("unlockmenu"); - game.currentmenuoption = 4; - } - else if (game.currentmenuoption == 5) - { - //unlock secret lab - music.playef(11); - game.unlock[8] = true; - game.unlocknotify[8] = true; - game.savestats(); - game.createmenu("unlockmenu"); - game.currentmenuoption = 5; - } - else - { - //back - music.playef(11); - game.createmenu("options"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "credits") - { - if (game.currentmenuoption == 0) - { - //next page - music.playef(11); - game.createmenu("credits2"); - map.nexttowercolour(); - } - else - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "credits2") - { - if (game.currentmenuoption == 0) - { - //next page - music.playef(11); - game.createmenu("credits25"); - map.nexttowercolour(); - } - else - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "credits25") - { - if (game.currentmenuoption == 0) - { - //next page - music.playef(11); - game.createmenu("credits3"); - map.nexttowercolour(); - } - else - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "credits3") - { - if (game.currentmenuoption == 0) - { - //next page - music.playef(11); - game.current_credits_list_index += 9; - - if (game.current_credits_list_index >= (int)game.superpatrons.size()) - { - // No more super patrons. Move to the next credits section - game.current_credits_list_index = 0; - game.createmenu("credits4"); - } - else - { - // There are more super patrons. Refresh the menu with the next ones - game.createmenu("credits3"); - } - - map.nexttowercolour(); - } - else - { - //back - music.playef(11); - game.current_credits_list_index = 0; - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "credits4") - { - if (game.currentmenuoption == 0) - { - //next page - music.playef(11); - game.current_credits_list_index += 14; - - if (game.current_credits_list_index >= (int)game.patrons.size()) - { - // No more patrons. Move to the next credits section - game.current_credits_list_index = 0; - game.createmenu("credits5"); - } - else - { - // There are more patrons. Refresh the menu with the next ones - game.createmenu("credits4"); - } - - map.nexttowercolour(); - } - else - { - //back - music.playef(11); - game.current_credits_list_index = 0; - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "credits5") - { - if (game.currentmenuoption == 0) - { - //next page - music.playef(11); - game.current_credits_list_index += 9; - - if (game.current_credits_list_index >= (int)game.githubfriends.size()) - { - // No more GitHub contributors. Move to the next credits section - game.current_credits_list_index = 0; - game.createmenu("credits6"); - } - else - { - // There are more GitHub contributors. Refresh the menu with the next ones - game.createmenu("credits5"); - } - - map.nexttowercolour(); - } - else - { - //back - music.playef(11); - game.current_credits_list_index = 0; - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "credits6") - { - if (game.currentmenuoption == 0) - { - //first page - music.playef(11); - game.createmenu("credits"); - map.nexttowercolour(); - } - else - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - music.niceplay(6); - } - } - else if (game.currentmenuname == "play") - { - if (game.currentmenuoption == 0) - { - //continue - //right, this depends on what saves you've got - if (game.telesummary == "") - { - //You at least have a quicksave, or you couldn't have gotten here - game.mainmenu = 2; - graphics.fademode = 2; - } - else if (game.quicksummary == "") - { - //You at least have a telesave, or you couldn't have gotten here - game.mainmenu = 1; - graphics.fademode = 2; - } - else - { - //go to a menu! - music.playef(11); - game.loadsummary(); //Prepare save slots to display - game.createmenu("continue"); - map.settowercolour(3); - } - } - else if (game.currentmenuoption == 1) - { - //play modes - music.playef(11); - game.createmenu("playmodes"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 2) - { - //newgame - music.playef(11); - game.createmenu("newgamewarning"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 3) - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "playsecretlab") - { - //as above, except with an extra option... - if (game.currentmenuoption == 0) - { - //continue - //right, this depends on what saves you've got - if (game.telesummary == "") - { - //You at least have a quicksave, or you couldn't have gotten here - game.mainmenu = 2; - graphics.fademode = 2; - } - else if (game.quicksummary == "") - { - //You at least have a telesave, or you couldn't have gotten here - game.mainmenu = 1; - graphics.fademode = 2; - } - else - { - //go to a menu! - music.playef(11); - game.loadsummary(); //Prepare save slots to display - game.createmenu("continue"); - map.settowercolour(3); - } - } - else if (game.currentmenuoption == 1) - { - if(!map.invincibility){ - game.mainmenu = 11; - graphics.fademode = 2; - }else{ - //Can't do yet! play sad sound - music.playef(2); - } - } - else if (game.currentmenuoption == 2) - { - //play modes - music.playef(11); - game.createmenu("playmodes"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 3) - { - //newgame - music.playef(11); - game.createmenu("newgamewarning"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 4) - { - //back - music.playef(11); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "newgamewarning") - { - if (game.currentmenuoption == 0) - { - //yep - game.mainmenu = 0; - graphics.fademode = 2; - game.deletequick(); - game.deletetele(); - } - else - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } - - else if (game.currentmenuname == "controller") - { - if (game.currentmenuoption == 0) - { - game.controllerSensitivity++; - music.playef(11); - if(game.controllerSensitivity > 4) - { - game.controllerSensitivity = 0; - } - } - - if (game.currentmenuoption == 4) - { - music.playef(11); - game.createmenu("options"); - } - } - else if (game.currentmenuname == "cleardatamenu") - { - if (game.currentmenuoption == 0) - { - //back - music.playef(11); - game.createmenu("options"); - map.nexttowercolour(); - } - else - { - //yep - music.playef(23); - game.deletequick(); - game.deletetele(); - game.deletestats(); - game.flashlight = 5; - game.screenshake = 15; - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "playmodes") - { - if (game.currentmenuoption == 0 && game.slowdown == 30 && !map.invincibility) //go to the time trial menu - { - music.playef(11); - game.createmenu("timetrials"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 1 && game.unlock[16]) - { - //intermission mode menu - music.playef(11); - game.createmenu("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"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 3 && game.unlock[18]) //enable/disable flip mode - { - music.playef(18); - game.screenshake = 10; - game.flashlight = 5; - graphics.setflipmode = !graphics.setflipmode; - game.savemystats = true; - } - else if (game.currentmenuoption == 4) - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - else - { - //Can't do yet! play sad sound - music.playef(2); - } - } - else if (game.currentmenuname == "startnodeathmode") - { - if (game.currentmenuoption == 0) //start no death mode, disabling cutscenes - { - game.mainmenu = 10; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 1) - { - game.mainmenu = 9; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 2) - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "continue") - { - if (game.currentmenuoption == 0) - { - game.mainmenu = 1; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 1) - { - game.mainmenu = 2; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 2) - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "intermissionmenu") - { - if (game.currentmenuoption == 0) - { - music.playef(11); - music.play(6); - game.createmenu("playint1"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 1) - { - music.playef(11); - music.play(6); - game.createmenu("playint2"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 2) - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "playint1") - { - if (game.currentmenuoption == 0) - { - game.mainmenu = 12; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 1) - { - game.mainmenu = 13; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 2) - { - game.mainmenu = 14; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 3) - { - game.mainmenu = 15; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 4) - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "playint2") - { - if (game.currentmenuoption == 0) - { - game.mainmenu = 16; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 1) - { - game.mainmenu = 17; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 2) - { - game.mainmenu = 18; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 3) - { - game.mainmenu = 19; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 4) - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } - else if (game.currentmenuname == "gameover2") - { - //back - music.playef(11); - music.play(6); - game.createmenu("mainmenu"); - map.nexttowercolour(); - } - else if (game.currentmenuname == "unlocktimetrials" || game.currentmenuname == "unlocktimetrial") - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - else if (game.currentmenuname == "unlocknodeathmode" || game.currentmenuname == "unlockintermission" - || game.currentmenuname == "unlockflipmode") - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - else if (game.currentmenuname == "timetrials") - { - if (game.currentmenuoption == 0 && game.unlock[9]) //space station 1 - { - game.mainmenu = 3; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 1 && game.unlock[10]) //lab - { - game.mainmenu = 4; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 2 && game.unlock[11]) //tower - { - game.mainmenu = 5; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 3 && game.unlock[12]) //station 2 - { - game.mainmenu = 6; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 4 && game.unlock[13]) //warp - { - game.mainmenu = 7; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 5 && game.unlock[14]) //final - { - game.mainmenu = 8; - graphics.fademode = 2; - } - else if (game.currentmenuoption == 6) //go to the time trial menu - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - else - { - //Can't do yet! play sad sound - music.playef(2); - } - } - else if (game.currentmenuname == "timetrialcomplete3") - { - if (game.currentmenuoption == 0) - { - //back - music.playef(11); - music.play(6); - game.createmenu("play"); - map.nexttowercolour(); - } - else if (game.currentmenuoption == 1) - { - //duplicate the above based on given time trial level! - if (game.timetriallevel == 0) //space station 1 - { - game.mainmenu = 3; - graphics.fademode = 2; - } - else if (game.timetriallevel == 1) //lab - { - game.mainmenu = 4; - graphics.fademode = 2; - } - else if (game.timetriallevel == 2) //tower - { - game.mainmenu = 5; - graphics.fademode = 2; - } - else if (game.timetriallevel == 3) //station 2 - { - game.mainmenu = 6; - graphics.fademode = 2; - } - else if (game.timetriallevel == 4) //warp - { - game.mainmenu = 7; - graphics.fademode = 2; - } - else if (game.timetriallevel == 5) //final - { - game.mainmenu = 8; - graphics.fademode = 2; - } - } - } - else if (game.currentmenuname == "gamecompletecontinue" || game.currentmenuname == "nodeathmodecomplete2") - { - if (game.currentmenuoption == 0) - { - music.play(6); - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - } + menuactionpress(); } } if ( game.currentmenuname == "controller" &&