diff --git a/crystal.cpp b/crystal.cpp index 40597775..c1575ece 100644 --- a/crystal.cpp +++ b/crystal.cpp @@ -804,29 +804,23 @@ void set_land(cell *c) { } } +void set_crystal(int sides) { + stop_game(); + set_geometry(gCrystal); + set_variation(eVariation::pure); + ginf[gCrystal].sides = sides; + ginf[gCrystal].vertex = 4; + if(sides < MAX_EDGE) + ginf[gCrystal].distlimit = distlimit_table[sides]; + } + int readArgs() { using namespace arg; if(0) ; else if(argis("-crystal")) { - PHASE(2); - stop_game(); - geometry = gCrystal; variation = eVariation::pure; - shift(); int N = argi(); - ginf[gCrystal].sides = N; - ginf[gCrystal].vertex = 4; - if(N < MAX_EDGE) - ginf[gCrystal].distlimit = distlimit_table[N]; - add_bitruncation = false; - } - else if(argis("-crystalb")) { - PHASE(2); - stop_game(); - geometry = gCrystal; variation = eVariation::bitruncated; - ginf[gCrystal].sides = 8; - ginf[gCrystal].vertex = 3; - ginf[gCrystal].distlimit = {7, 5}; - add_bitruncation = true; + PHASEFROM(2); + shift(); set_crystal(argi()); } else if(argis("-cview")) { view_coordinates = true; @@ -848,6 +842,26 @@ hrmap *new_map() { return new hrmap_crystal; } +void show() { + cmode = sm::SIDE | sm::MAYDARK; + gamescreen(0); + dialog::init(XLAT("multi-dimensional")); + for(int i=5; i<=14; i++) { + string s; + if(i % 2) s = its(i/2) + ".5D"; + else s = its(i/2) + "D"; + dialog::addBoolItem(s, geometry == gCrystal && ginf[gCrystal].sides == i && ginf[gCrystal].vertex == 4, 'a' + i - 5); + dialog::add_action([i]() { set_crystal(i); start_game(); }); + } + dialog::addBoolItem("4D double bitruncated", ginf[gCrystal].vertex == 3, 'D'); + dialog::add_action([]() { set_crystal(8); set_variation(eVariation::bitruncated); set_variation(eVariation::bitruncated); }); + dialog::addBreak(50); + dialog::addBoolItem("view coordinates in the cheat mode", view_coordinates, 'v'); + dialog::add_action([]() { view_coordinates = !view_coordinates; }); + dialog::addBack(); + dialog::display(); + } + auto crystalhook = addHook(hooks_args, 100, readArgs) + addHook(hooks_drawcell, 100, crystal_cell); diff --git a/geom-exp.cpp b/geom-exp.cpp index 4682f1a4..45f04067 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -328,7 +328,9 @@ void showEuclideanMenu() { dialog::lastItem().value += validclasses[land_validity(specialland).quality_level]; dialog::add_action([i] { eGeometry targetgeometry = eGeometry(i); - if(targetgeometry == gArchimedean) + if(targetgeometry == gCrystal) + pushScreen(crystal::show); + else if(targetgeometry == gArchimedean) pushScreen(arcm::show); else { set_geometry(targetgeometry); diff --git a/hyper.h b/hyper.h index 0a4accb5..13f0da4d 100644 --- a/hyper.h +++ b/hyper.h @@ -4153,6 +4153,7 @@ namespace crystal { void set_land(cell *c); int dist_alt(cell *c); int dist_relative(cell *c); + void show(); } hyperpoint get_warp_corner(cell *c, int cid);