1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 09:00:34 +00:00

more intuitive tiling selection

This commit is contained in:
Zeno Rogue 2019-09-12 13:52:16 +02:00
parent 165a55d93c
commit d5a99e67e0
4 changed files with 29 additions and 16 deletions

View File

@ -512,8 +512,8 @@ static const flagtype qsZEBRA = qANYQ | qSMALL | qBOUNDED | qZEBRA;
static const flagtype qsFIELD = qANYQ | qFIELD | qBOUNDED; static const flagtype qsFIELD = qANYQ | qFIELD | qBOUNDED;
static const flagtype qsDOCKS = qANYQ | qSMALL | qBOUNDED | qDOCKS; static const flagtype qsDOCKS = qANYQ | qSMALL | qBOUNDED | qDOCKS;
static const flagtype qsSMALLB = qSMALL | qBOUNDED; static const flagtype qsSMALLB = qSMALL | qBOUNDED;
static const flagtype qsSMALLBF = qsSMALLB | qsFIELD; static const flagtype qsSMALLBF = qsSMALLB | qsFIELD | qANYQ;
static const flagtype qsSMALLBE = qsSMALLB | qELLIPTIC; static const flagtype qsSMALLBE = qsSMALLB | qELLIPTIC | qANYQ;
static const flagtype qsBP = qBINARY | qPENROSE; static const flagtype qsBP = qBINARY | qPENROSE;
EX geometryinfo1 giEuclid2 = { gcEuclid, 2, 2, 3, {1,1, 0,0 } }; EX geometryinfo1 giEuclid2 = { gcEuclid, 2, 2, 3, {1,1, 0,0 } };
@ -526,7 +526,7 @@ EX geometryinfo1 giSphere3 = { gcSphere, 3, 3, 4, {1,1, 1,+1} };
EX geometryinfo1 giSol = { gcSol, 3, 3, 4, {1,1, 1,0 } }; EX geometryinfo1 giSol = { gcSol, 3, 3, 4, {1,1, 1,0 } };
EX geometryinfo1 giNil = { gcNil, 3, 3, 4, {1,1, 1,0 } }; EX geometryinfo1 giNil = { gcNil, 3, 3, 4, {1,1, 1,0 } };
EX geometryinfo1 giProduct = { /* will be filled in product::configure() */ }; EX geometryinfo1 giProduct = { gcSL2, 3, 3, 4, {1,1, 1,0 } /* will be filled in product::configure() */ };
EX geometryinfo1 giSL2 = { gcSL2, 3, 3, 4, {1,1,-1,-1} }; EX geometryinfo1 giSL2 = { gcSL2, 3, 3, 4, {1,1,-1,-1} };
/** list of available geometries */ /** list of available geometries */

View File

@ -402,7 +402,9 @@ vector<eGeometry> list3d = {
gCell5, gKiteDart3, gSol, gNil, gProduct, gRotSpace gCell5, gKiteDart3, gSol, gNil, gProduct, gRotSpace
}; };
void ge_select_tiling(const vector<eGeometry>& lst) { bool select_dims, select_quotient;
void ge_select_tiling() {
cmode = sm::SIDE | sm::MAYDARK; cmode = sm::SIDE | sm::MAYDARK;
gamescreen(0); gamescreen(0);
@ -412,15 +414,20 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
dialog::addInfo("3D geometries are a work in progress", 0x800000); */ dialog::addInfo("3D geometries are a work in progress", 0x800000); */
char letter = 'a'; char letter = 'a';
for(eGeometry i: lst) { for(int i=0; i<isize(ginf); i++) {
bool on = geometry == i; eGeometry g = eGeometry(i);
dynamicval<eGeometry> cg(geometry, eGeometry(i)); if(among(g, gProduct, gRotSpace)) hybrid::configure(g);
bool on = geometry == g;
bool in_2d = WDIM == 2;
dynamicval<eGeometry> cg(geometry, g);
if(archimedean && !CAP_ARCM) continue; if(archimedean && !CAP_ARCM) continue;
if(cryst && !CAP_CRYSTAL) continue; if(cryst && !CAP_CRYSTAL) continue;
if(geometry == gFieldQuotient && !CAP_FIELD) continue; if(geometry == gFieldQuotient && !CAP_FIELD) continue;
if((!!quotient) ^ select_quotient) continue;
if((WDIM == 3) ^ select_dims) continue;
dialog::addBoolItem(XLAT( dialog::addBoolItem(XLAT(
(geometry == gProduct && !hybri) ? XLAT("current geometry x E") : (geometry == gProduct && in_2d) ? XLAT("current geometry x E") :
(geometry == gRotSpace && !hybri) ? XLAT("space of rotations in current geometry") : (geometry == gRotSpace && in_2d) ? XLAT("space of rotations in current geometry") :
ginf[i].menu_displayed_name), on, letter++); ginf[i].menu_displayed_name), on, letter++);
dialog::lastItem().value += validclasses[land_validity(specialland).quality_level]; dialog::lastItem().value += validclasses[land_validity(specialland).quality_level];
dialog::add_action(dual::mayboth([i] { dialog::add_action(dual::mayboth([i] {
@ -472,6 +479,10 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
})); }));
} }
dialog::addBreak(100);
dialog::addBoolItem_action(XLAT("show quotient spaces"), select_quotient, 'Q');
dialog::addBoolItem_action(XLAT("three-dimensional"), select_dims, 'D');
dual::add_choice(); dual::add_choice();
dialog::addBack(); dialog::addBack();
dialog::display(); dialog::display();
@ -507,7 +518,7 @@ EX void showEuclideanMenu() {
dialog::init(XLAT("experiment with geometry")); dialog::init(XLAT("experiment with geometry"));
dialog::addSelItem(XLAT("basic tiling"), XLAT(ginf[geometry].tiling_name), 't'); dialog::addSelItem(XLAT("basic tiling"), XLAT(ginf[geometry].tiling_name), 't');
dialog::add_action_push([] { ge_select_tiling(tilinglist); }); dialog::add_action([] { select_quotient = quotient; select_dims = WDIM == 3; pushScreen(ge_select_tiling); });
int ts = ginf[geometry].sides; int ts = ginf[geometry].sides;
int tv = ginf[geometry].vertex; int tv = ginf[geometry].vertex;
@ -636,11 +647,11 @@ EX void showEuclideanMenu() {
else else
dialog::addSelItem(XLAT("quotient space"), XLAT(qstring), 'q'); dialog::addSelItem(XLAT("quotient space"), XLAT(qstring), 'q');
dialog::add_action_push([] { ge_select_tiling(quotientlist); }); dialog::add_action([] { select_quotient = !quotient; select_dims = WDIM == 3; pushScreen(ge_select_tiling); });
#if MAXMDIM >= 4 #if MAXMDIM >= 4
dialog::addSelItem(XLAT("dimension"), its(WDIM), 'd'); dialog::addSelItem(XLAT("dimension"), its(WDIM), 'd');
dialog::add_action_push([] { ge_select_tiling(list3d); }); dialog::add_action([] { select_quotient = quotient; select_dims = WDIM != 3; pushScreen(ge_select_tiling); });
#endif #endif
#if CAP_IRR #if CAP_IRR

View File

@ -573,13 +573,12 @@ EX namespace hybrid {
EX geometry_information *underlying_cgip; EX geometry_information *underlying_cgip;
EX void configure(eGeometry g) { EX void configure(eGeometry g) {
if(vid.always3) { vid.always3 = false; geom3::apply_always3(); } if(WDIM == 3) return;
check_cgi(); check_cgi();
cgi.prepare_basics(); cgi.require_basics();
underlying = geometry; underlying = geometry;
underlying_cgip = cgip; underlying_cgip = cgip;
bool sph = sphere; bool sph = sphere;
geometry = g;
auto keep = ginf[g].menu_displayed_name; auto keep = ginf[g].menu_displayed_name;
ginf[g] = ginf[underlying]; ginf[g] = ginf[underlying];
ginf[g].menu_displayed_name = keep; ginf[g].menu_displayed_name = keep;

View File

@ -1179,7 +1179,10 @@ EX void set_geometry(eGeometry target) {
int old_DIM = GDIM; int old_DIM = GDIM;
stop_game(); stop_game();
ors::reset(); ors::reset();
if(among(target, gProduct, gRotSpace)) hybrid::configure(target); if(among(target, gProduct, gRotSpace)) {
if(vid.always3) { vid.always3 = false; geom3::apply_always3(); }
hybrid::configure(target);
}
geometry = target; geometry = target;
if(chaosmode && bounded) chaosmode = false; if(chaosmode && bounded) chaosmode = false;