mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09: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:
parent
e909515f3d
commit
85b16b969a
4 changed files with 28 additions and 9 deletions
|
@ -6690,6 +6690,14 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
||||||
{
|
{
|
||||||
option("first page");
|
option("first page");
|
||||||
}
|
}
|
||||||
|
if (levelpage == 0)
|
||||||
|
{
|
||||||
|
option("last page");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
option("previous page");
|
||||||
|
}
|
||||||
option("return to menu");
|
option("return to menu");
|
||||||
|
|
||||||
menuxoff = -90;
|
menuxoff = -90;
|
||||||
|
|
|
@ -1129,7 +1129,7 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||||
{
|
{
|
||||||
if ((int) i == game.currentmenuoption)
|
if ((int) i == game.currentmenuoption)
|
||||||
{
|
{
|
||||||
if(game.menuoptions.size()-i<=2){
|
if(game.menuoptions.size()-i<=3){
|
||||||
//Draw it highlighted
|
//Draw it highlighted
|
||||||
if (game.menuoptions[i].active)
|
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::string tempstring = game.menuoptions[i].text;
|
||||||
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
|
std::transform(tempstring.begin(), tempstring.end(),tempstring.begin(), ::toupper);
|
||||||
tempstring = std::string("[ ") + tempstring + std::string(" ]");
|
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
|
else
|
||||||
{
|
{
|
||||||
std::string tempstring = game.menuoptions[i].text;
|
std::string tempstring = game.menuoptions[i].text;
|
||||||
tempstring = "[ " + tempstring + " ]";
|
tempstring = "[ " + tempstring + " ]";
|
||||||
//Draw it in gray
|
//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
|
else
|
||||||
{
|
{
|
||||||
if(game.menuoptions.size()-i<=2){
|
if(game.menuoptions.size()-i<=3){
|
||||||
//Draw it normally
|
//Draw it normally
|
||||||
if (game.menuoptions[i].active)
|
if (game.menuoptions[i].active)
|
||||||
{
|
{
|
||||||
|
@ -1180,12 +1180,12 @@ void Graphics::drawlevelmenu( int cr, int cg, int cb, int division /*= 30*/ )
|
||||||
//Draw it normally
|
//Draw it normally
|
||||||
if (game.menuoptions[i].active)
|
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
|
else
|
||||||
{
|
{
|
||||||
//Draw it in gray
|
//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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,6 +199,17 @@ void menuactionpress()
|
||||||
game.returnmenu();
|
game.returnmenu();
|
||||||
map.nexttowercolour();
|
map.nexttowercolour();
|
||||||
}else if(game.currentmenuoption==(int)game.menuoptions.size()-2){
|
}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
|
//next page
|
||||||
music.playef(11);
|
music.playef(11);
|
||||||
if((size_t) ((game.levelpage*8)+8) >= ed.ListOfMetaData.size()){
|
if((size_t) ((game.levelpage*8)+8) >= ed.ListOfMetaData.size()){
|
||||||
|
@ -207,7 +218,7 @@ void menuactionpress()
|
||||||
game.levelpage++;
|
game.levelpage++;
|
||||||
}
|
}
|
||||||
game.createmenu(Menu::levellist, true);
|
game.createmenu(Menu::levellist, true);
|
||||||
game.currentmenuoption=game.menuoptions.size()-2;
|
game.currentmenuoption=game.menuoptions.size()-3;
|
||||||
map.nexttowercolour();
|
map.nexttowercolour();
|
||||||
}else{
|
}else{
|
||||||
//Ok, launch the level!
|
//Ok, launch the level!
|
||||||
|
|
|
@ -46,8 +46,8 @@ void menurender()
|
||||||
}
|
}
|
||||||
int tmp=game.currentmenuoption+(game.levelpage*8);
|
int tmp=game.currentmenuoption+(game.levelpage*8);
|
||||||
if(tmp>=0 && tmp < (int) ed.ListOfMetaData.size()){ // FIXME: size_t/int! -flibit
|
if(tmp>=0 && tmp < (int) ed.ListOfMetaData.size()){ // FIXME: size_t/int! -flibit
|
||||||
//Don't show next page or return to menu options here!
|
//Don't show next/previous page or return to menu options here!
|
||||||
if(game.menuoptions.size() - game.currentmenuoption<=2){
|
if(game.menuoptions.size() - game.currentmenuoption<=3){
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
graphics.bigprint( -1, 15, ed.ListOfMetaData[tmp].title, tr, tg, tb, true);
|
graphics.bigprint( -1, 15, ed.ListOfMetaData[tmp].title, tr, tg, tb, true);
|
||||||
|
|
Loading…
Reference in a new issue