better flagging of geometries, and isometry spaces nicely selectable

This commit is contained in:
Zeno Rogue 2019-08-26 16:21:05 +02:00
parent 689020ee6d
commit d046211a9c
12 changed files with 40 additions and 24 deletions

View File

@ -550,12 +550,12 @@ vector<geometryinfo> ginf = {
{"{8,3}", "Bolza2", "Bolza Surface x2", "Bolza2", 8, 3, qsDOCKS, giHyperb2, 0x18400, {{6, 4}}, eVariation::bitruncated},
{"{7,3}", "minimal", "minimal quotient", "minimal", 7, 3, qsSMALLN, giHyperb2, 0x18600, {{7, 5}}, eVariation::bitruncated},
{"binary","none", "variant of the binary tiling", "binary", 7, 3, qBINARY, giHyperb2, 0x48400, {{7, 5}}, eVariation::pure},
{"Arch", "none", "Archimedean", "A", 7, 3, 0, giHyperb2, 0, {{7, 5}}, eVariation::pure},
{"Arch", "none", "Archimedean", "A", 7, 3, qARCHI, giHyperb2, 0, {{7, 5}}, eVariation::pure},
{"{7,3}", "Macbeath", "Macbeath Surface", "Macbeath", 7, 3, qsSMALL, giHyperb2, 0x20000, {{7, 5}}, eVariation::bitruncated},
{"{5,4}", "Bring", "Bring's Surface", "Bring", 5, 4, qsSMALL, giHyperb2, 0x20200, {{6, 4}}, eVariation::bitruncated},
{"{12,3}","M3", "Schmutz's M(3)", "M3", 12, 3, qsSMALL, giHyperb2, 0x20400, {{4, 2}}, eVariation::bitruncated},
{"{12,3}","M4", "Schmutz's M(4)", "M4", 12, 3, qsSMALL, giHyperb2, 0x20600, {{4, 2}}, eVariation::bitruncated},
{"{6,4}", "Crystal", "dimensional crystal", "Crystal", 6, 4, qANYQ, giHyperb2, 0x28000, {{5, 3}}, eVariation::pure},
{"{6,4}", "Crystal", "dimensional crystal", "Crystal", 6, 4, qANYQ|qCRYSTAL, giHyperb2, 0x28000, {{5, 3}}, eVariation::pure},
{"{3,4}", "none", "{3,4} (octahedron)", "4x3", 3, 4, qsSMALLB, giSphere2, 0x28200, {{SEE_ALL, SEE_ALL}}, eVariation::bitruncated},
{"bin{4,4}", "none", "{4,4} on horospheres", "bin44", 9, 3, qBINARY, giHyperb3, 0x30000, {{7, 3}}, eVariation::pure},
{"{4,3,4}","none", "{4,3,4} cube tiling", "434", 6, 4, 0, giEuclid3, 0x30200, {{7, 5}}, eVariation::pure},
@ -584,8 +584,8 @@ vector<geometryinfo> ginf = {
{"kd2", "none", "kite-and-dart", "kd2", 4, 3, qPENROSE, giEuclid2, 0x48000, {{7, 7}}, eVariation::pure},
{"kd3", "none", "kite-and-dart on horospheres", "kd3", 12, 3, qsBP, giHyperb3, 0x48200, {{7, 3}}, eVariation::pure},
{"nil", "none", "Nil geometry", "nil", 6, 3, 0, giNil, 0x48600, {{7, 5}}, eVariation::pure},
{"product","none", "product space", "product", 7, 3, 0, giProduct, 0x48400, {{7, 3}}, eVariation::pure},
{"psl2", "psl2", "PSL(2,R)", "psl2", 7, 3, qEXPERIMENTAL, giSL2, 0x49000, {{6, 4}}, eVariation::pure},
{"product","none", "product space", "product", 7, 3, qHYBRID, giProduct, 0x48400, {{7, 3}}, eVariation::pure},
{"twisted","none", "space of isometries", "twisted", 7, 3, qHYBRID, giSL2, 0x49000, {{6, 4}}, eVariation::pure},
};
// bits: 9, 10, 15, 16, (reserved for later) 17, 18

View File

@ -238,8 +238,8 @@ struct geometryinfo1 {
};
struct geometryinfo {
const char* tiling_name;
const char* quotient_name;
std::string tiling_name;
std::string quotient_name;
const char* menu_displayed_name;
const char* shortname;
int sides;
@ -265,6 +265,11 @@ static const flagtype qELLIPTIC = 128;
static const flagtype qBINARY = 256;
static const flagtype qPENROSE = 512;
static const flagtype qREGULAR = 1024; /* not set! */
static const flagtype qARCHI = 2048;
static const flagtype qHYBRID = 4096;
static const flagtype qCRYSTAL = 8192;
static const flagtype qEXPERIMENTAL = 32768;
// note: dnext assumes that x&7 equals 7

View File

@ -857,7 +857,7 @@ int expansion_hook = addHook(hooks_handleKey, 0, expansion_handleKey);
#if !ISMINI
void compute_coefficients() {
printf("%s %s\n", gp::operation_name().c_str(), ginf[geometry].tiling_name);
println(hlog, gp::operation_name(), " ", ginf[geometry].tiling_name);
start_game();
printf(" sizes:");

View File

@ -417,7 +417,10 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
if(archimedean && !CAP_ARCM) continue;
if(cryst && !CAP_CRYSTAL) continue;
if(geometry == gFieldQuotient && !CAP_FIELD) continue;
dialog::addBoolItem(XLAT((geometry == gProduct && !on) ? XLAT("current geometry x E") : ginf[i].menu_displayed_name), on, letter++);
dialog::addBoolItem(XLAT(
(geometry == gProduct && !on) ? XLAT("current geometry x E") :
(geometry == gSL2 && !on) ? XLAT("isometries of current geometry") :
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);
@ -830,7 +833,7 @@ EX void showEuclideanMenu() {
break;
case gcSL2:
dialog::addSelItem(XLAT("Curvature"), XLAT("~SL2(R)~"), 0);
dialog::addSelItem(XLAT("Curvature"), XLAT("~SL(2,R)~"), 0);
break;
case gcProduct:

View File

@ -808,8 +808,8 @@ color_t kind_outline(eItem it) {
EX transmatrix face_the_player(const transmatrix V) {
if(GDIM == 2) return V;
if(sl2) return V * zpush(cos(ptick(750)) * cgi.plevel / 16);
if(prod) return mscale(V, cos(ptick(750)) * cgi.plevel / 16);
if(hybri) return V * zpush(cos(ptick(750)) * cgi.plevel / 16);
transmatrix dummy; /* used only in prod anyways */
if(nonisotropic) return spin_towards(V, dummy, C0, 2, 0);
return rgpushxto0(tC0(V));
@ -4564,7 +4564,7 @@ void radar_grid(cell *c, const transmatrix& V) {
int wall_offset(cell *c) {
if(prod) return product::cwall_offset;
if(sl2) return hybrid::wall_offset(c);
if(hybri) return hybrid::wall_offset(c);
if(penrose && kite::getshape(c->master) == kite::pKite) return 10;
return 0;
}

View File

@ -110,8 +110,8 @@ void addMessage(string s, char spamtype = 0);
#define stdhyperbolic (S7 == 7 && S3 == 3 && STDVAR && !binarytiling && !archimedean)
#define binarytiling (ginf[geometry].flags & qBINARY)
#define archimedean (geometry == gArchimedean)
#define cryst (geometry == gCrystal)
#define archimedean (ginf[geometry].flags & qARCHI)
#define cryst (ginf[geometry].flags & qCRYSTAL)
#define penrose (ginf[geometry].flags & qPENROSE)
/** convenience flag for geometries with major aspects missing */
@ -127,7 +127,7 @@ void addMessage(string s, char spamtype = 0);
#define nil (cgclass == gcNil)
#define sl2 (cgclass == gcSL2)
#define prod (cgclass == gcProduct)
#define hybri (prod || sl2)
#define hybri (ginf[geometry].flags & qHYBRID)
#define hyperbolic (cgclass == gcHyperbolic)
#define nonisotropic (sol || nil || sl2)
#define translatable (euclid || nonisotropic)

View File

@ -1379,7 +1379,7 @@ EX void optimizeview() {
if(subscreens::split(optimizeview)) return;
if(dual::split(optimizeview)) return;
if(sl2) {
if(hybri && !prod) {
cell *c = viewcenter();
cell *cbest = NULL;
ld best = hdist0(tC0(gmatrix[c]));

View File

@ -527,7 +527,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
if(hrand_monster(8000) < 50 + 10 * (items[itEmerald] + yendor::hardness())) {
static eMonster emeraldmonsters[4] = { moHedge, moLancer, moFlailer, moMiner };
c->monst = emeraldmonsters[hrand(4)];
if(c->monst == moHedge && (S3 != 3 || sl2))
if(c->monst == moHedge && (S3 != 3 || (hybri && !prod)))
c->monst = moFlailer;
}
if(sphere && c->type != 6 && c->master->fiftyval == 5) {

View File

@ -576,12 +576,20 @@ EX namespace hybrid {
underlying_cgip = cgip;
geometry = g;
ginf[g] = ginf[underlying];
if(g == gSL2) ginf[g].g = giSL2;
if(g == gSL2) {
ginf[g].g = giSL2;
ginf[g].tiling_name = "Iso(" + ginf[g].tiling_name + ")";
string& qn = ginf[g].quotient_name;
if(qn == "none") qn = "PSL(2,R)";
else qn = qn + "/PSL(2,R)";
}
else {
ginf[g].cclass = g == gSL2 ? gcSL2 : gcProduct;
ginf[g].g.gameplay_dimension++;
ginf[g].g.graphical_dimension++;
ginf[g].tiling_name += "xZ";
}
ginf[g].flags |= qHYBRID;
}
hrmap *pmap;
@ -616,7 +624,7 @@ EX namespace hybrid {
}
cell *getCell(cell *u, int h) {
if(sl2) h = gmod(h, cgi.steps);
if(cgi.steps) h = gmod(h, cgi.steps);
cell*& c = at[make_pair(u, h)];
if(!c) { c = newCell(u->type+2, u->master); where[c] = {u, h}; }
return c;
@ -655,7 +663,7 @@ EX namespace hybrid {
auto cu = m->where[c].first;
auto cu1 = m->in_underlying([&] { return cu->cmove(d); });
int d1 = cu->c.spin(d);
int s = sl2 ? d*cgi.steps / cu->type - d1*cgi.steps / cu1->type + cgi.steps/2 : 0;
int s = cgi.steps ? d*cgi.steps / cu->type - d1*cgi.steps / cu1->type + cgi.steps/2 : 0;
cell *c1 = get_at(cu1, m->where[c].second + s);
c->c.connect(d, c1, d1, cu->c.mirror(d));
}
@ -1268,8 +1276,8 @@ EX namespace nisot {
EX hrmap *new_map() {
if(sol) return new solv::hrmap_sol;
if(nil) return new nilv::hrmap_nil;
if(sl2) return new slr::hrmap_psl2;
if(geometry == gProduct) return new product::hrmap_product;
if(hybri) return new slr::hrmap_psl2;
return NULL;
}

View File

@ -1374,7 +1374,7 @@ EX bool pseudohept(cell *c) {
#if CAP_IRR
if(IRREGULAR) return irr::pseudohept(c);
#endif
if(hybri) { auto d = hybrid::get_where(c); return (sl2 ? true : (d.second & 1)) && PIU(pseudohept(d.first)); }
if(hybri) { auto d = hybrid::get_where(c); return ((!prod) || (d.second & 1)) && PIU(pseudohept(d.first)); }
#if CAP_BT
if(nil) return c->master->zebraval & c->master->emeraldval & c->master->fieldval & 1;
if(sol) return (c->master->emeraldval % 3 == 2) && (c->master->zebraval % 3 == 2) && (c->master->distance % 2);

View File

@ -803,7 +803,7 @@ void geometry_information::reserve_wall3d(int i) {
void geometry_information::create_wall3d() {
if(WDIM == 2) return;
reserve_wall3d(penrose ? 22 : prod ? 0 : sl2 ? 0 : S7);
reserve_wall3d(penrose ? 22 : hybri ? 0 : S7);
if(GDIM == 3 && binarytiling && geometry == gBinary3) {
hyperpoint h00 = point3(-1,-1,-1);
hyperpoint h01 = point3(-1,0,-1);
@ -958,7 +958,7 @@ void geometry_information::create_wall3d() {
}
}
if(GDIM == 3 && !euclid && !binarytiling && !nil && !prod && !sl2) {
if(GDIM == 3 && !euclid && !binarytiling && !nonisotropic && !hybri && !penrose) {
reg3::generate();
int facesize = isize(reg3::cellshape) / S7;
for(int w=0; w<S7; w++) {

View File

@ -958,7 +958,7 @@ EX void saveStats(bool emergency IS(false)) {
fprintf(f, "Total enemies killed: %d\n", tkills());
fprintf(f, "cells generated: %d\n", cellcount);
if(pureHardcore()) fprintf(f, "Pure hardcore mode\n");
if(geometry) fprintf(f, "Geometry: %s/%s/%s\n", gp::operation_name().c_str(), ginf[geometry].tiling_name, ginf[geometry].quotient_name);
if(geometry) fprintf(f, "Geometry: %s/%s/%s\n", gp::operation_name().c_str(), ginf[geometry].tiling_name.c_str(), ginf[geometry].quotient_name.c_str());
if(chaosmode) fprintf(f, "Chaos mode\n");
if(shmup::on) fprintf(f, "Shoot-em up mode\n");
if(inv::on) fprintf(f, "Inventory mode\n");