1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Don't show next/previous page options if only one page

It's possible to get one page of levels by removing all the built-ins,
either by removing them directly from data.zip or by putting files with
the same filenames as them in your level folder that don't contain
nothing.

And hey, there's already a check for if no levels exist at all, so why
not check for this too?
This commit is contained in:
Misa 2021-08-11 19:48:40 -07:00 committed by Ethan Lee
parent 254cede905
commit 28e4a155d4
3 changed files with 24 additions and 17 deletions

View file

@ -6002,6 +6002,8 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(text);
}
}
if (ed.ListOfMetaData.size() > 8)
{
if((size_t) ((levelpage*8)+8) <ed.ListOfMetaData.size())
{
option("next page");
@ -6018,6 +6020,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
{
option("previous page");
}
}
option("return to menu");
menuxoff = 20;

View file

@ -412,12 +412,14 @@ static void menuactionpress(void)
break;
#if !defined(NO_CUSTOM_LEVELS)
case Menu::levellist:
{
const bool nextlastoptions = ed.ListOfMetaData.size() > 8;
if(game.currentmenuoption==(int)game.menuoptions.size()-1){
//go back to menu
music.playef(11);
game.returnmenu();
map.nexttowercolour();
}else if(game.currentmenuoption==(int)game.menuoptions.size()-2){
}else if(nextlastoptions && game.currentmenuoption==(int)game.menuoptions.size()-2){
//previous page
music.playef(11);
if(game.levelpage==0){
@ -428,7 +430,7 @@ static void menuactionpress(void)
game.createmenu(Menu::levellist, true);
game.currentmenuoption=game.menuoptions.size()-2;
map.nexttowercolour();
}else if(game.currentmenuoption==(int)game.menuoptions.size()-3){
}else if(nextlastoptions && game.currentmenuoption==(int)game.menuoptions.size()-3){
//next page
music.playef(11);
if((size_t) ((game.levelpage*8)+8) >= ed.ListOfMetaData.size()){
@ -457,6 +459,7 @@ static void menuactionpress(void)
}
}
break;
}
#endif
case Menu::quickloadlevel:
switch (game.currentmenuoption)

View file

@ -173,8 +173,9 @@ static void menurender(void)
}
int tmp=game.currentmenuoption+(game.levelpage*8);
if(INBOUNDS_VEC(tmp, ed.ListOfMetaData)){
const bool nextlastoptions = ed.ListOfMetaData.size() > 8;
//Don't show next/previous page or return to menu options here!
if(game.menuoptions.size() - game.currentmenuoption<=3){
if(nextlastoptions && game.menuoptions.size() - game.currentmenuoption<=3){
}else{
graphics.bigprint( -1, 15, ed.ListOfMetaData[tmp].title, tr, tg, tb, true);