Refactor menu creation code

Firstly, menu options are no longer ad-hoc objects, and are added by
using Game::option() (this is the biggest change). This removes the
vector Game::menuoptionsactive, and Game::menuoptions is now a vector of
MenuOption instead of std::string.

Secondly, the manual tracker variable of the amount of menu options,
Game::nummenuoptions, has been removed, in favor of using vectors
properly and using Game::menuoptions::size().

As a result, a lot of copy-pasted code has been removed from
Game::createmenu(), mostly due to having to have different versions of
menus depending on whether or not we have certain defines, or having an
mmmmmm.vvv file inside the VVVVVV directory. In the old days, you
couldn't just add or remove a menu option conveniently, you had to
shuffle around the position of every other menu option too, which
resulted in lots of copy-pasted code. But now this copy-pasted code has
been de-duplicated, at least in Game::createmenu().
This commit is contained in:
Misa
2020-04-14 21:50:17 -07:00
committed by Ethan Lee
parent a0d2be6362
commit 511de0c5c1
6 changed files with 209 additions and 630 deletions

View File

@@ -83,7 +83,7 @@ void titlerender()
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.nummenuoptions - game.currentmenuoption<=2){
if(game.menuoptions.size() - game.currentmenuoption<=2){
}else{
graphics.bigprint( -1, 15, ed.ListOfMetaData[tmp].title, tr, tg, tb, true);