mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-11-17 14:17:10 +00:00
Z period in product geometries
This commit is contained in:
22
geom-exp.cpp
22
geom-exp.cpp
@@ -748,7 +748,7 @@ EX void showEuclideanMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(in_s2xe()) {
|
if(in_s2xe()) {
|
||||||
dialog::addSelItem(XLAT("precision of S2xE rings"), its(s2xe::qrings), '4');
|
dialog::addSelItem(XLAT("precision of S2xE rings"), its(s2xe::qrings), '5');
|
||||||
dialog::add_action([] {
|
dialog::add_action([] {
|
||||||
dialog::editNumber(s2xe::qrings, 1, 256, 4, 32, XLAT("precision of S2xE rings"),
|
dialog::editNumber(s2xe::qrings, 1, 256, 4, 32, XLAT("precision of S2xE rings"),
|
||||||
XLAT(
|
XLAT(
|
||||||
@@ -761,9 +761,9 @@ EX void showEuclideanMenu() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(hybri) {
|
if(hybri) {
|
||||||
auto r = rots::underlying_scale;
|
auto r = rots::underlying_scale;
|
||||||
dialog::addSelItem(XLAT("view the underlying geometry"), r > 0 ? fts(r)+"x" : ONOFF(false), '4');
|
dialog::addSelItem(XLAT("view the underlying geometry"), r > 0 ? fts(r)+"x" : ONOFF(false), '6');
|
||||||
dialog::add_action([] {
|
dialog::add_action([] {
|
||||||
dialog::editNumber(rots::underlying_scale, 0, 1, 0.05, 0.25, XLAT("view the underlying geometry"),
|
dialog::editNumber(rots::underlying_scale, 0, 1, 0.05, 0.25, XLAT("view the underlying geometry"),
|
||||||
XLAT(
|
XLAT(
|
||||||
@@ -780,7 +780,7 @@ EX void showEuclideanMenu() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(euwrap || geometry == gFieldQuotient || cryst || archimedean || (euclid && WDIM == 3) || nil || asonov::in()) {
|
if(euwrap || geometry == gFieldQuotient || cryst || archimedean || (euclid && WDIM == 3) || nil || asonov::in() || prod) {
|
||||||
dialog::addItem(XLAT("advanced parameters"), '4');
|
dialog::addItem(XLAT("advanced parameters"), '4');
|
||||||
dialog::add_action([] {
|
dialog::add_action([] {
|
||||||
if(0);
|
if(0);
|
||||||
@@ -802,6 +802,20 @@ EX void showEuclideanMenu() {
|
|||||||
else if(asonov::in())
|
else if(asonov::in())
|
||||||
asonov::prepare_config(),
|
asonov::prepare_config(),
|
||||||
pushScreen(asonov::show_config);
|
pushScreen(asonov::show_config);
|
||||||
|
else if(prod) {
|
||||||
|
static int s;
|
||||||
|
s = product::csteps;
|
||||||
|
dialog::editNumber(s, 0, 16, 1, 0, XLAT("%1 period", "Z"),
|
||||||
|
XLAT("Set to 0 to make it non-periodic."));
|
||||||
|
dialog::bound_low(0);
|
||||||
|
dialog::reaction_final = [] {
|
||||||
|
product::csteps = s;
|
||||||
|
if(product::csteps == cgi.steps) return;
|
||||||
|
hybrid::reconfigure();
|
||||||
|
start_game();
|
||||||
|
println(hlog, "csteps = ", cgi.steps);
|
||||||
|
};
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
else if(euwrap)
|
else if(euwrap)
|
||||||
prepare_torusconfig(),
|
prepare_torusconfig(),
|
||||||
|
|||||||
@@ -580,7 +580,7 @@ void geometry_information::prepare_basics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plevel = vid.plevel_factor * scalefactor;
|
plevel = vid.plevel_factor * scalefactor;
|
||||||
steps = 0;
|
steps = product::csteps;
|
||||||
single_step = 1;
|
single_step = 1;
|
||||||
if(hybri && !prod) {
|
if(hybri && !prod) {
|
||||||
if(hybrid::underlying == gArchimedean)
|
if(hybrid::underlying == gArchimedean)
|
||||||
@@ -925,6 +925,8 @@ EX void check_cgi() {
|
|||||||
if(hybri) V("U", its(int(hybrid::underlying)));
|
if(hybri) V("U", its(int(hybrid::underlying)));
|
||||||
|
|
||||||
if(prod) V("PL", fts(vid.plevel_factor));
|
if(prod) V("PL", fts(vid.plevel_factor));
|
||||||
|
|
||||||
|
if(prod) V("PS", its(product::csteps));
|
||||||
|
|
||||||
if(binarytiling) V("BT", fts(vid.binary_width));
|
if(binarytiling) V("BT", fts(vid.binary_width));
|
||||||
|
|
||||||
|
|||||||
@@ -970,9 +970,19 @@ EX namespace hybrid {
|
|||||||
ginf[g].g.gameplay_dimension++;
|
ginf[g].g.gameplay_dimension++;
|
||||||
ginf[g].g.graphical_dimension++;
|
ginf[g].g.graphical_dimension++;
|
||||||
ginf[g].tiling_name += "xZ";
|
ginf[g].tiling_name += "xZ";
|
||||||
|
if(product::csteps) ginf[g].flags |= qANYQ, ginf[g].tiling_name += its(product::csteps);
|
||||||
}
|
}
|
||||||
ginf[g].flags |= qHYBRID;
|
ginf[g].flags |= qHYBRID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX void reconfigure() {
|
||||||
|
if(!hybri) return;
|
||||||
|
stop_game();
|
||||||
|
auto g = geometry;
|
||||||
|
geometry = underlying;
|
||||||
|
configure(g);
|
||||||
|
geometry = g;
|
||||||
|
}
|
||||||
|
|
||||||
EX hrmap *pmap;
|
EX hrmap *pmap;
|
||||||
geometry_information *pcgip;
|
geometry_information *pcgip;
|
||||||
@@ -1006,7 +1016,7 @@ EX namespace hybrid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cell *getCell(cell *u, int h) {
|
cell *getCell(cell *u, int h) {
|
||||||
if(cgi.steps) h = gmod(h, cgi.steps);
|
h = zgmod(h, cgi.steps);
|
||||||
cell*& c = at[make_pair(u, h)];
|
cell*& c = at[make_pair(u, h)];
|
||||||
if(!c) { c = newCell(u->type+2, u->master); where[c] = {u, h}; }
|
if(!c) { c = newCell(u->type+2, u->master); where[c] = {u, h}; }
|
||||||
return c;
|
return c;
|
||||||
@@ -1045,7 +1055,7 @@ EX namespace hybrid {
|
|||||||
auto cu = m->where[c].first;
|
auto cu = m->where[c].first;
|
||||||
auto cu1 = m->in_underlying([&] { return cu->cmove(d); });
|
auto cu1 = m->in_underlying([&] { return cu->cmove(d); });
|
||||||
int d1 = cu->c.spin(d);
|
int d1 = cu->c.spin(d);
|
||||||
int s = cgi.steps ? d*cgi.steps / cu->type - d1*cgi.steps / cu1->type + cgi.steps/2 : 0;
|
int s = (geometry == gRotSpace && 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);
|
cell *c1 = get_at(cu1, m->where[c].second + s);
|
||||||
c->c.connect(d, c1, d1, cu->c.mirror(d));
|
c->c.connect(d, c1, d1, cu->c.mirror(d));
|
||||||
}
|
}
|
||||||
@@ -1153,7 +1163,7 @@ EX namespace product {
|
|||||||
|
|
||||||
struct hrmap_product : hybrid::hrmap_hybrid {
|
struct hrmap_product : hybrid::hrmap_hybrid {
|
||||||
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& point_hint) override {
|
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& point_hint) override {
|
||||||
return in_underlying([&] { return calc_relative_matrix(where[c2].first, where[c1].first, point_hint); }) * mscale(Id, cgi.plevel * (where[c2].second - where[c1].second));
|
return in_underlying([&] { return calc_relative_matrix(where[c2].first, where[c1].first, point_hint); }) * mscale(Id, cgi.plevel * szgmod(where[c2].second - where[c1].second, csteps));
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
@@ -1162,7 +1172,7 @@ EX namespace product {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EX int cwall_offset, cwall_mask, actual_view_level;
|
EX int cwall_offset, cwall_mask, actual_view_level, csteps;
|
||||||
|
|
||||||
EX void drawcell_stack(cellwalker cw, transmatrix V) {
|
EX void drawcell_stack(cellwalker cw, transmatrix V) {
|
||||||
cell *c = cw.at;
|
cell *c = cw.at;
|
||||||
@@ -1874,6 +1884,13 @@ EX namespace nisot {
|
|||||||
asonov::set_flags();
|
asonov::set_flags();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else if(argis("-prodperiod")) {
|
||||||
|
PHASEFROM(2);
|
||||||
|
if(prod) stop_game();
|
||||||
|
shift(); product::csteps = argi();
|
||||||
|
hybrid::reconfigure();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
7
util.cpp
7
util.cpp
@@ -43,6 +43,13 @@ EX int gmod(int i, int j) {
|
|||||||
|
|
||||||
EX int zgmod(int a, int b) { return b ? gmod(a, b) : a; }
|
EX int zgmod(int a, int b) { return b ? gmod(a, b) : a; }
|
||||||
|
|
||||||
|
EX int szgmod(int a, int b) {
|
||||||
|
if(!b) return a;
|
||||||
|
a = gmod(a, b);
|
||||||
|
if(2*a >= b) return a - b;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
EX int gdiv(int i, int j) {
|
EX int gdiv(int i, int j) {
|
||||||
return (i - gmod(i, j)) / j;
|
return (i - gmod(i, j)) / j;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user