diff --git a/rogueviz/bringris.cpp b/rogueviz/bringris.cpp index fefc8000..a1fbe704 100644 --- a/rogueviz/bringris.cpp +++ b/rogueviz/bringris.cpp @@ -1283,19 +1283,27 @@ void draw_screen(int xstart, bool show_next) { void create_game(); -void geometry_menu() { +int score_bgeom, score_max_piece; + +void geometry_menu(bool for_scores) { + auto& c_geom = for_scores ? score_bgeom : bgeom; + auto& c_max = for_scores ? score_max_piece : bgeom; clearMessages(); cmode = sm::VR_MENU | sm::NOSCR; gamescreen(); - dialog::init("Bringris geometries"); + dialog::init(for_scores ? "highscores for..." : "Bringris geometries"); dialog::addBreak(100); int total_stars = 0; for(int i=0; i= bgeoms[i].stars_needed || !stars_enabled) { - dialog::addTitle(bgeoms[i].name, i == bgeom ? 0xFF00 : 0xFF0000, 150); + dialog::addTitle(bgeoms[i].name, i == c_geom ? 0xFF00 : 0xFF0000, 150); dialog::items.back().key = 'a' + i; - dialog::add_action([i] { - enable_bgeom(i); + dialog::add_action([i, for_scores] { + if(for_scores) { + score_bgeom = i; + score_max_piece = bgeoms[score_bgeom].default_max_piece; + } + else enable_bgeom(i); }); dialog::addInfo(bgeoms[i].cap); dialog::items.back().key = 'a' + i; @@ -1317,10 +1325,11 @@ void geometry_menu() { } } dialog::addBreak(100); - dialog::addSelItem("max piece", its(cur.max_piece), 'M'); - dialog::add_action([] { - cur.max_piece++; - if(cur.max_piece == 6) cur.max_piece = 2; + dialog::addSelItem("max piece", its(c_max), 'M'); + dialog::add_action([&c_max, for_scores] { + c_max++; + if(c_max == 6) c_max = 2; + if(for_scores) return; create_game(); state = tsPreGame; }); @@ -1331,15 +1340,18 @@ void geometry_menu() { else dialog::addBreak(100); - dialog::addBreak(100); - if(stars_enabled) { - if(total_stars < 6000) - dialog::addHelp("Collect stars to unlock more spaces!\n\n" - "training mode: 1 block removed = 1 star\n\n" - "expert mode: 1 block removed = 5 stars\n\n" - "only best score per space counts"); - dialog::addInfo("currently " + its(total_stars) + " stars"); + if(!for_scores) { + dialog::addBreak(100); + if(stars_enabled) { + if(total_stars < 6000) + dialog::addHelp("Collect stars to unlock more spaces!\n\n" + "training mode: 1 block removed = 1 star\n\n" + "expert mode: 1 block removed = 5 stars\n\n" + "only best score per space counts"); + dialog::addInfo("currently " + its(total_stars) + " stars"); + } } + dialog::addBack(); dialog::display(); } @@ -1405,7 +1417,7 @@ void settings_menu() { cmode = sm::VR_MENU | sm::NOSCR; gamescreen(); dialog::init("Bringris settings"); dialog::addItem("alternative geometry", 'g'); - dialog::add_action_push(geometry_menu); + dialog::add_action_push([] { geometry_menu(false); }); dialog::addItem("visuals & Virtual Reality", 'v'); dialog::add_action_push(visual_menu); dialog::addItem("configure keys", 'k'); @@ -1435,14 +1447,15 @@ bool hi_pro; void hiscore_menu() { cmode = sm::VR_MENU | sm::NOSCR; gamescreen(); dialog::init("High scores"); - string s = bgeoms[bgeom].name; - if(cur.max_piece != bgeoms[bgeom].default_max_piece) s = s + " (block " + its(cur.max_piece) + ")"; - dialog::addInfo(s); + string s = bgeoms[score_bgeom].name; + if(score_max_piece != bgeoms[score_bgeom].default_max_piece) s = s + " (block " + its(score_max_piece) + ")"; + dialog::addItem(s, 'g'); + dialog::add_action_push([] { geometry_menu(true); }); dialog::addItem(hi_pro ? "expert mode" : "training mode", 'm'); dialog::add_action([] { hi_pro = !hi_pro; }); vector v; for(auto& ad: allsaves) - if(ad.bgeom_name == bgeoms[bgeom].name && ad.max_piece == cur.max_piece && ad.pro_game == hi_pro) + if(ad.bgeom_name == bgeoms[score_bgeom].name && ad.max_piece == score_max_piece && ad.pro_game == hi_pro) v.push_back(&ad); sort(v.begin(), v.end(), [] (gamedata* g1, gamedata* g2) { return g1->sorter() > g2->sorter(); }); dialog::start_list(900, 900, '1'); @@ -1868,6 +1881,7 @@ void run() { pushScreen(settings_menu); } if(in_menu && sym == 'h') { + score_bgeom = bgeom; score_max_piece = cur.max_piece; pushScreen(hiscore_menu); } if(in_menu && sym == 'x') {