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

Add a "previous page" option to the levels list

This makes it more convenient if you have a large levels directory, as
some people in the VVVVVV custom levels community do.

On the first page, this option will change to be "last page" instead.

Since the addition of another menu option pushes up the list of levels
too close to the selected level data itself, I've had to move the list
of levels down by 4 pixels (but "next page"/"previous page"/"return to
menu" are still in their same position).

This feature was already added to VCE but hasn't been upstreamed until
now.
This commit is contained in:
Misa 2020-04-16 23:05:49 -07:00 committed by Ethan Lee
parent e909515f3d
commit 85b16b969a
4 changed files with 28 additions and 9 deletions

View file

@ -6690,6 +6690,14 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
{
option("first page");
}
if (levelpage == 0)
{
option("last page");
}
else
{
option("previous page");
}
option("return to menu");
menuxoff = -90;

View file

@ -1129,7 +1129,7 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
{
if ((int) i == game.currentmenuoption)
{
if(game.menuoptions.size()-i<=2){
if(game.menuoptions.size()-i<=3){
//Draw it highlighted
if (game.menuoptions[i].active)
{
@ -1152,20 +1152,20 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
std::string tempstring = game.menuoptions[i].text;
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
tempstring = std::string("[ ") + tempstring + std::string(" ]");
Print(110 + (i * division) - 16 +game.menuxoff, 140 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
Print(110 + (i * division) - 16 +game.menuxoff, 144 + (i * 12) +game.menuyoff, tempstring, cr, cg, cb);
}
else
{
std::string tempstring = game.menuoptions[i].text;
tempstring = "[ " + tempstring + " ]";
//Draw it in gray
Print(110 + (i * division) - 16 +game.menuxoff, 140 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
Print(110 + (i * division) - 16 +game.menuxoff, 144 + (i * 12)+game.menuyoff, tempstring, 128, 128, 128);
}
}
}
else
{
if(game.menuoptions.size()-i<=2){
if(game.menuoptions.size()-i<=3){
//Draw it normally
if (game.menuoptions[i].active)
{
@ -1180,12 +1180,12 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
//Draw it normally
if (game.menuoptions[i].active)
{
Print(110 + (i * division) +game.menuxoff, 140 + (i * 12)+game.menuyoff, game.menuoptions[i].text, cr, cg, cb);
Print(110 + (i * division) +game.menuxoff, 144 + (i * 12)+game.menuyoff, game.menuoptions[i].text, cr, cg, cb);
}
else
{
//Draw it in gray
Print(110 + (i * division) +game.menuxoff, 140 + (i * 12)+game.menuyoff, game.menuoptions[i].text, 128, 128, 128);
Print(110 + (i * division) +game.menuxoff, 144 + (i * 12)+game.menuyoff, game.menuoptions[i].text, 128, 128, 128);
}
}
}

View file

@ -199,6 +199,17 @@ void menuactionpress()
game.returnmenu();
map.nexttowercolour();
}else if(game.currentmenuoption==(int)game.menuoptions.size()-2){
//previous page
music.playef(11);
if(game.levelpage==0){
game.levelpage=(ed.ListOfMetaData.size()-1)/8;
}else{
game.levelpage--;
}
game.createmenu(Menu::levellist, true);
game.currentmenuoption=game.menuoptions.size()-2;
map.nexttowercolour();
}else if(game.currentmenuoption==(int)game.menuoptions.size()-3){
//next page
music.playef(11);
if((size_t) ((game.levelpage*8)+8) >= ed.ListOfMetaData.size()){
@ -207,7 +218,7 @@ void menuactionpress()
game.levelpage++;
}
game.createmenu(Menu::levellist, true);
game.currentmenuoption=game.menuoptions.size()-2;
game.currentmenuoption=game.menuoptions.size()-3;
map.nexttowercolour();
}else{
//Ok, launch the level!

View file

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