product:: selectable from menu

This commit is contained in:
Zeno Rogue 2019-08-18 23:12:36 +02:00
parent 14b70224a8
commit 1a1725dec8
4 changed files with 23 additions and 10 deletions

View File

@ -398,7 +398,7 @@ vector<eGeometry> list3d = {
gCell24, gECell24,
gCell16, gECell16,
gCell8, gECell8,
gCell5, gKiteDart3, gSol, gNil
gCell5, gKiteDart3, gSol, gNil, gProduct
};
void ge_select_tiling(const vector<eGeometry>& lst) {
@ -417,7 +417,7 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
if(archimedean && !CAP_ARCM) continue;
if(geometry == gCrystal && !CAP_CRYSTAL) continue;
if(geometry == gFieldQuotient && !CAP_FIELD) continue;
dialog::addBoolItem(XLAT(ginf[i].menu_displayed_name), on, letter++);
dialog::addBoolItem(XLAT((geometry == gProduct && !on) ? XLAT("current geometry x E") : ginf[i].menu_displayed_name), on, letter++);
dialog::lastItem().value += validclasses[land_validity(specialland).quality_level];
dialog::add_action(dual::mayboth([i] {
eGeometry targetgeometry = eGeometry(i);
@ -431,6 +431,10 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
pushScreen(arcm::show);
#endif
else dialog::do_if_confirmed([targetgeometry] () {
if(targetgeometry == gProduct && (WDIM == 3 || euclid)) {
addMessage(XLAT("Only works with 2D non-Euclidean geometries"));
return;
}
set_geometry(targetgeometry);
start_game();
if(euwrap) {
@ -624,7 +628,13 @@ EX void showEuclideanMenu() {
}
#endif
if(ts == 6 && tv == 3)
if(prod) {
dialog::addSelItem(XLAT("Z-level height factor"), fts(vid.plevel_factor), 'Z');
dialog::add_action([] {
dialog::editNumber(vid.plevel_factor, 0, 2, 0.1, 0.7, XLAT("Z-level height factor"), "");
});
}
else if(ts == 6 && tv == 3)
dialog::addSelItem(XLAT("variations"), XLAT("does not matter"), 'v');
else if(binarytiling) {
dialog::addSelItem(XLAT("width"), fts(vid.binary_width), 'v');

View File

@ -855,6 +855,8 @@ EX void check_cgi() {
if(binarytiling || GDIM == 3) V("WQ", its(vid.texture_step));
if(prod) V("PL", fts(vid.plevel_factor));
if(binarytiling) V("BT", fts(vid.binary_width));
if(GDIM == 2) {

View File

@ -554,7 +554,6 @@ EX namespace product {
geometry = gProduct;
ginf[gProduct] = ginf[underlying];
ginf[gProduct].cclass = gcProduct;
pmodel = mdPerspective;
}
EX int current_view_level;
@ -643,9 +642,11 @@ EX namespace product {
}
EX hyperpoint get_corner(cell *c, int i, ld z) {
ld lev = cgi.plevel * z / 2;
println(hlog, "getcorner ", i, " @ ", lev);
dynamicval<eGeometry> g(geometry, underlying);
dynamicval<geometry_information*> gc(cgip, underlying_cgip);
return mscale(get_corner_position(c, i), exp(cgi.plevel * z/2));
return mscale(get_corner_position(c, i), exp(lev));
}
EX int wall_offset(cell *c) {
@ -655,7 +656,7 @@ EX namespace product {
if(wo == -1) {
cell *c1 = get_where(c).first;
wo = isize(cgi.shWall3D);
println(hlog, "generating a model for ", c->type-2, "+2");
println(hlog, "generating a model for ", c->type-2, "+2", " while plevel is ", cgi.plevel);
int won = wo + c->type;
cgi.shWall3D.resize(won);
cgi.shPlainWall3D.resize(won);
@ -876,9 +877,7 @@ EX namespace nisot {
}
else if(argis("-product")) {
PHASEFROM(2);
stop_game();
product::configure();
if(vid.texture_step < 4) vid.texture_step = 4;
set_geometry(gProduct);
return 0;
}
return 1;

View File

@ -1158,6 +1158,7 @@ EX void set_geometry(eGeometry target) {
int old_DIM = GDIM;
stop_game();
ors::reset();
if(target == gProduct) product::configure();
geometry = target;
if(chaosmode && bounded) chaosmode = false;
@ -1180,12 +1181,13 @@ EX void set_geometry(eGeometry target) {
if(DUAL && geometry != gArchimedean)
variation = ginf[geometry].default_variation;
#if CAP_BT
if(binarytiling || WDIM == 3 || penrose) variation = eVariation::pure;
if(binarytiling || WDIM == 3 || penrose) if(!prod) variation = eVariation::pure;
#endif
if(GDIM == 3 && old_DIM == 2 && pmodel == mdDisk) pmodel = mdPerspective;
if(nonisotropic && old_DIM == 2) pmodel = mdGeodesic;
if(GDIM == 2 && among(pmodel, mdPerspective, mdGeodesic)) pmodel = mdDisk;
if(nonisotropic && old_DIM == 2 && vid.texture_step < 4) vid.texture_step = 4;
if(prod) { pmodel = mdPerspective; if(vid.texture_step < 4) vid.texture_step = 4; }
}
}