mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
renamed gRotSpace to gTwistedProduct, and similar
This commit is contained in:
parent
d1793a774e
commit
de3ad6d718
@ -745,7 +745,7 @@ enum eGeometry {
|
||||
gHoroTris, gHoroRec, gHoroHex,
|
||||
gField435, gField534,
|
||||
gBinary4, gSol,
|
||||
gKiteDart2, gKiteDart3, gNil, gProduct, gRotSpace,
|
||||
gKiteDart2, gKiteDart3, gNil, gProduct, gTwistedProduct,
|
||||
gTernary, gNIH, gSolN, gInfOrder, gSpace336, gSpace344, gCrystal344,
|
||||
gArnoldCat, gArbitrary, gInfOrder4, gCrystal534,
|
||||
gSpace535, gSpace536, gSeifertCover, gSeifertWeber, gHomologySphere,
|
||||
@ -939,7 +939,7 @@ EX vector<geometryinfo> ginf = {
|
||||
{"kd3", "none", "kite-and-dart on horospheres", "kd3", 12, 3, qsBP, giHyperb3, {{7, 3}}, eVariation::pure},
|
||||
{"nil", "none", "Nil geometry", "nil", 6, 3, qOPTQ, giNil, {{7, 5}}, eVariation::pure},
|
||||
{"product","none", "product space", "product", 7, 3, qHYBRID, giProduct, {{7, 3}}, eVariation::pure},
|
||||
{"twisted","none", "rotation space", "twisted", 7, 3, qHYBRID, giSL2, {{6, 4}}, eVariation::pure},
|
||||
{"twisted","none", "twisted product space", "twisted", 7, 3, qHYBRID, giSL2, {{6, 4}}, eVariation::pure},
|
||||
{"ternary","none", "standard ternary tiling", "ternary", 6, 3, qBINARY, giHyperb2, {{6, 4}}, eVariation::pure},
|
||||
{"3x2", "none", "stretched hyperbolic", "3:2", 11, 3, qBINARY|qNIH, giNIH, {{6, 3}}, eVariation::pure},
|
||||
{"3x1/2", "none", "stretched Solv", "3:1/2", 9, 3, (qBINARY|qSOL|qNIH), giSolN, {{7, 3}}, eVariation::pure},
|
||||
|
20
geom-exp.cpp
20
geom-exp.cpp
@ -314,16 +314,16 @@ void set_or_configure_geometry(eGeometry g) {
|
||||
else if(g == gArbitrary)
|
||||
arb::choose();
|
||||
else {
|
||||
if(among(g, gProduct, gRotSpace)) {
|
||||
if(WDIM == 3 || (g == gRotSpace && euclid)) {
|
||||
if(among(g, gProduct, gTwistedProduct)) {
|
||||
if(WDIM == 3 || (g == gTwistedProduct && euclid)) {
|
||||
addMessage(
|
||||
g == gRotSpace ?
|
||||
g == gTwistedProduct ?
|
||||
XLAT("Only works with 2D non-Euclidean geometries")
|
||||
: XLAT("Only works with 2D geometries")
|
||||
);
|
||||
return;
|
||||
}
|
||||
if(g == gRotSpace) {
|
||||
if(g == gTwistedProduct) {
|
||||
bool ok = true;
|
||||
if(arcm::in()) ok = PURE;
|
||||
else if(bt::in() || aperiodic) ok = false;
|
||||
@ -387,7 +387,7 @@ void ge_select_tiling() {
|
||||
|
||||
for(int i=0; i<isize(ginf); i++) {
|
||||
eGeometry g = eGeometry(i);
|
||||
if(among(g, gProduct, gRotSpace)) hybrid::configure(g);
|
||||
if(among(g, gProduct, gTwistedProduct)) hybrid::configure(g);
|
||||
bool orig_el = elliptic;
|
||||
bool on = geometry == g;
|
||||
bool in_2d = WDIM == 2;
|
||||
@ -408,10 +408,10 @@ void ge_select_tiling() {
|
||||
}
|
||||
|
||||
bool is_product = (geometry == gProduct && in_2d);
|
||||
bool is_rotspace = (geometry == gRotSpace && in_2d);
|
||||
bool is_twisted = (geometry == gTwistedProduct && in_2d);
|
||||
dialog::addBoolItem(
|
||||
is_product ? XLAT("current geometry x E") :
|
||||
is_rotspace ? XLAT("space of rotations in current geometry") :
|
||||
is_twisted ? XLAT("twisted current x E") :
|
||||
XLAT(ginf[g].menu_displayed_name), on, dialog::list_fake_key++);
|
||||
dialog::lastItem().value += validclasses[land_validity(specialland).quality_level];
|
||||
dialog::add_action([g] { set_or_configure_geometry(g); });
|
||||
@ -624,7 +624,7 @@ EX void select_quotient() {
|
||||
#endif
|
||||
else if(mproduct)
|
||||
pushScreen(product::show_config);
|
||||
else if(rotspace)
|
||||
else if(mtwisted)
|
||||
hybrid::configure_period();
|
||||
else {
|
||||
vector<eGeometry> choices;
|
||||
@ -1068,8 +1068,8 @@ EX void showEuclideanMenu() {
|
||||
dialog::addSelItem(XLAT("view the underlying geometry"), r > 0 ? fts(r)+"x" : ONOFF(false), '6');
|
||||
dialog::add_action([] {
|
||||
dialog::editNumber(rots::underlying_scale, 0, 1, 0.05, 0.25, XLAT("view the underlying geometry"),
|
||||
geometry == gRotSpace ?
|
||||
XLAT("The space you are currently in is the space of rotations of the underlying hyperbolic or spherical geometry. ")
|
||||
geometry == gTwistedProduct ?
|
||||
XLAT("The space you are currently in a twisted product space. ")
|
||||
: XLAT("You are currently in a product space.") +
|
||||
XLAT(
|
||||
"This option lets you see the underlying space. Lands and some walls (e.g. in the Graveyard) are based on "
|
||||
|
2
hud.cpp
2
hud.cpp
@ -492,7 +492,7 @@ EX void drawStats() {
|
||||
bool cornermode = (vid.xres > vid.yres * 85/100 && vid.yres > vid.xres * 85/100);
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(geometry == gRotSpace || geometry == gProduct) rots::draw_underlying(!cornermode);
|
||||
if(among(geometry, gProduct, gTwistedProduct)) rots::draw_underlying(!cornermode);
|
||||
#endif
|
||||
|
||||
{
|
||||
|
@ -420,7 +420,7 @@ EX hyperpoint hpxy(ld x, ld y) {
|
||||
return cgi.emb->base_to_actual(h);
|
||||
}
|
||||
if(sl2) return hyperpoint(x, y, 0, sqrt(1+x*x+y*y));
|
||||
if(rotspace) return hyperpoint(x, y, 0, sqrt(1-x*x-y*y));
|
||||
if(mtwisted) return hyperpoint(x, y, 0, sqrt(1-x*x-y*y));
|
||||
return PIU(hpxyz(x,y, translatable ? 1 : sphere ? sqrt(1-x*x-y*y) : sqrt(1+x*x+y*y)));
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ EX land_validity_t& land_validity(eLand l) {
|
||||
return lv::not_implemented;
|
||||
if(among(l, laReptile, laDragon, laTortoise))
|
||||
return lv::bad_graphics;
|
||||
if((hybrid::actual_geometry == gRotSpace || geometry == gRotSpace) && l == laDryForest)
|
||||
if((hybrid::actual_geometry == gTwistedProduct || geometry == gTwistedProduct) && l == laDryForest)
|
||||
return lv::hedgehogs;
|
||||
if(mhybrid && hybrid::underlying && hybrid::underlying_cgip) {
|
||||
return *PIU(&land_validity(l));
|
||||
|
@ -5,6 +5,12 @@
|
||||
namespace hr {
|
||||
|
||||
#if CAP_LEGACY
|
||||
|
||||
#if HDR
|
||||
/** legacy name */
|
||||
constexpr eGeometry gRotSpace = gTwistedProduct;
|
||||
#endif
|
||||
|
||||
namespace shmup {
|
||||
|
||||
void scanchar(FILE *f, char& c) {
|
||||
|
@ -556,7 +556,7 @@ EX namespace mapstream {
|
||||
f.write(product::cmirror);
|
||||
f.write(vid.plevel_factor);
|
||||
}
|
||||
if(rotspace) {
|
||||
if(mtwisted) {
|
||||
f.write(hybrid::csteps);
|
||||
}
|
||||
if(mhybrid) {
|
||||
@ -695,7 +695,7 @@ EX namespace mapstream {
|
||||
if(vernum >= 0xA833) f.read(product::cmirror);
|
||||
if(vernum >= 0xA908) f.read(vid.plevel_factor);
|
||||
}
|
||||
if(geometry == gRotSpace && vernum >= 0xA833) {
|
||||
if(geometry == gTwistedProduct && vernum >= 0xA833) {
|
||||
f.read(hybrid::csteps);
|
||||
}
|
||||
if(mhybrid && vernum >= 0xA80C) {
|
||||
|
@ -1189,11 +1189,12 @@ EX namespace hybrid {
|
||||
underlying = geometry;
|
||||
underlying_cgip = cgip;
|
||||
bool sph = sphere;
|
||||
bool euc = euclid;
|
||||
auto keep = ginf[g].menu_displayed_name;
|
||||
ginf[g] = ginf[underlying];
|
||||
ginf[g].menu_displayed_name = keep;
|
||||
if(g == gRotSpace) {
|
||||
ginf[g].g = sph ? giSphere3 : giSL2;
|
||||
if(g == gTwistedProduct) {
|
||||
ginf[g].g = euc ? giNil : sph ? giSphere3 : giSL2;
|
||||
ginf[g].tiling_name = "Iso(" + ginf[g].tiling_name + ")";
|
||||
string& qn = ginf[g].quotient_name;
|
||||
if(csteps && csteps != (sph ? cgi.psl_steps*2 : 0)) {
|
||||
@ -1211,7 +1212,7 @@ EX namespace hybrid {
|
||||
ginf[g].flags |= qANYQ;
|
||||
}
|
||||
else {
|
||||
ginf[g].cclass = g == gRotSpace ? gcSL2 : gcProduct;
|
||||
ginf[g].cclass = gcProduct;
|
||||
ginf[g].g.gameplay_dimension++;
|
||||
ginf[g].g.graphical_dimension++;
|
||||
ginf[g].tiling_name += "xZ";
|
||||
@ -1229,6 +1230,25 @@ EX namespace hybrid {
|
||||
geometry = g;
|
||||
}
|
||||
|
||||
EX void enable_rotspace() {
|
||||
if(euclid) {
|
||||
start_game();
|
||||
int q = cwt.at->type;
|
||||
stop_game();
|
||||
hybrid::csteps = q;
|
||||
set_plevel(TAU / q);
|
||||
set_geometry(gProduct);
|
||||
hybrid::reconfigure();
|
||||
}
|
||||
else {
|
||||
stop_game();
|
||||
set_geometry(gTwistedProduct);
|
||||
check_cgi(); cgi.require_basics();
|
||||
hybrid::csteps = cgi.psl_steps;
|
||||
hybrid::reconfigure();
|
||||
}
|
||||
}
|
||||
|
||||
EX hrmap *pmap;
|
||||
EX geometry_information *pcgip;
|
||||
EX eGeometry actual_geometry;
|
||||
@ -1356,7 +1376,7 @@ EX namespace hybrid {
|
||||
}
|
||||
|
||||
EX void fix_bounded_cycles() {
|
||||
if(!rotspace) return;
|
||||
if(!mtwisted) return;
|
||||
if(!closed_manifold) return;
|
||||
in_underlying([&] {
|
||||
cellwalker final(currentmap->gamestart(), 0);
|
||||
@ -1474,7 +1494,7 @@ EX namespace hybrid {
|
||||
auto cu1 = m->in_underlying([&] { return cu->cmove(d); });
|
||||
int d1 = cu->c.spin(d);
|
||||
int s = 0;
|
||||
if(geometry == gRotSpace) {
|
||||
if(geometry == gTwistedProduct) {
|
||||
auto cm = (hrmap_hybrid*)currentmap;
|
||||
m->in_underlying([&] { cm->ensure_shifts(cu); });
|
||||
s = ((hrmap_hybrid*)currentmap)->get_shift(cellwalker(cu, d));
|
||||
@ -1660,7 +1680,7 @@ EX namespace hybrid {
|
||||
static int s;
|
||||
s = csteps / cgi.single_step;
|
||||
string str = "";
|
||||
if(rotspace)
|
||||
if(mtwisted)
|
||||
str = XLAT(
|
||||
"If the 2D underlying manifold is bounded, the period should be a divisor of the 'rotation space' "
|
||||
"value (PSL(2,R)) times the Euler characteristics of the underlying manifold. "
|
||||
@ -1680,7 +1700,7 @@ EX namespace hybrid {
|
||||
};
|
||||
};
|
||||
dialog::get_di().extra_options = [=] () {
|
||||
if(rotspace) {
|
||||
if(mtwisted) {
|
||||
int e_steps = cgi.psl_steps / gcd(cgi.single_step, cgi.psl_steps);
|
||||
bool ubounded = PIU(closed_manifold);
|
||||
dialog::addSelItem( sphere ? XLAT("elliptic") : XLAT("PSL(2,R)"), its(e_steps), 'P');
|
||||
@ -2627,7 +2647,7 @@ EX namespace stretch {
|
||||
}
|
||||
|
||||
EX bool applicable() {
|
||||
return rotspace || (cgflags & qSTRETCHABLE);
|
||||
return mtwisted || (cgflags & qSTRETCHABLE);
|
||||
}
|
||||
|
||||
EX bool in() {
|
||||
@ -3065,9 +3085,14 @@ EX namespace nisot {
|
||||
shift(); s2xe::qrings = argi();
|
||||
return 0;
|
||||
}
|
||||
else if(argis("-twisted-product")) {
|
||||
PHASEFROM(2);
|
||||
set_geometry(gTwistedProduct);
|
||||
return 0;
|
||||
}
|
||||
else if(argis("-rotspace")) {
|
||||
PHASEFROM(2);
|
||||
set_geometry(gRotSpace);
|
||||
hybrid::enable_rotspace();
|
||||
return 0;
|
||||
}
|
||||
else if(argis("-rot_uscale")) {
|
||||
|
@ -879,7 +879,7 @@ void geometry_information::compute_cornerbonus() { }
|
||||
|
||||
EX int kleinize_sides;
|
||||
|
||||
hyperpoint ray_kleinize_rotspace(hyperpoint h, int ks, int id) {
|
||||
hyperpoint ray_kleinize_twisted(hyperpoint h, int ks, int id) {
|
||||
|
||||
/* todo: in Archimedean tilings it may be the case that pispin is incorrect, as shown by `angle of zero` -- need to carry it to raycaster */
|
||||
h = pispin * h;
|
||||
@ -923,7 +923,7 @@ hyperpoint ray_kleinize_rotspace(hyperpoint h, int ks, int id) {
|
||||
hyperpoint ray_kleinize(hyperpoint h, int id, ld pz) {
|
||||
if(nil && nilv::nil_structure_index == 0 && among(id, 2, 5)) h[2] = 0;
|
||||
if(nil && nilv::nil_structure_index == 2 && among(id, 6, 7)) h[2] = 0;
|
||||
if(rotspace) return ray_kleinize_rotspace(h, kleinize_sides, id);
|
||||
if(mtwisted) return ray_kleinize_twisted(h, kleinize_sides, id);
|
||||
#if CAP_BT
|
||||
if(hyperbolic && bt::in()) {
|
||||
// ld co = vid.binary_width / log(2) / 4;
|
||||
|
@ -1106,7 +1106,7 @@ void race_projection() {
|
||||
add_thurston_race(XLAT("S2xE"), [] { set_geometry(gSphere); set_variation(eVariation::bitruncated); set_geometry(gProduct); });
|
||||
add_thurston_race(XLAT("H2xE"), [] { set_geometry(gNormal); set_variation(eVariation::bitruncated); set_geometry(gProduct); });
|
||||
add_thurston_race(XLAT("Nil"), [] { stop_game(); nilv::nilperiod[0] = 0; set_geometry(gNil); });
|
||||
add_thurston_race(XLAT("PSL(2,R)"), [] { set_geometry(gNormal); set_variation(eVariation::pure); set_geometry(gRotSpace); });
|
||||
add_thurston_race(XLAT("PSL(2,R)"), [] { set_geometry(gNormal); set_variation(eVariation::pure); hybrid::enable_rotspace(); });
|
||||
}
|
||||
else {
|
||||
#if CAP_SOLV
|
||||
|
@ -80,7 +80,7 @@ EX bool is_eyes() {
|
||||
}
|
||||
|
||||
EX bool is_stepbased() {
|
||||
return nonisotropic || stretch::in() || is_eyes() || rotspace;
|
||||
return nonisotropic || stretch::in() || is_eyes() || mtwisted;
|
||||
}
|
||||
|
||||
EX bool horos() {
|
||||
@ -153,7 +153,7 @@ EX bool requested() {
|
||||
#endif
|
||||
if(!available()) return false;
|
||||
if(want_use == 2) return true;
|
||||
if(rotspace) return false; // not very good
|
||||
if(mtwisted) return false; // not very good, sometimes
|
||||
if(WDIM == 2) return false; // not very good
|
||||
return racing::on || quotient || fake::in();
|
||||
}
|
||||
@ -341,7 +341,7 @@ struct raygen {
|
||||
void create();
|
||||
|
||||
string f_xpush() { return hyperbolic ? "xpush_h3" : "xpush_s3"; }
|
||||
string f_len() { return hyperbolic ? "len_h3" : rotspace ? "rot_flatdist" : sphere ? "len_s3" : "len_x"; }
|
||||
string f_len() { return hyperbolic ? "len_h3" : mtwisted ? "rot_flatdist" : sphere ? "len_s3" : "len_x"; }
|
||||
string f_len_prod() { return in_h2xe() ? "len_h2" : in_s2xe() ? "len_s2" : "len_e2"; }
|
||||
void add_functions();
|
||||
};
|
||||
@ -858,14 +858,14 @@ void raygen::move_forward() {
|
||||
bool reg = hyperbolic || sphere || euclid || sl2 || gproduct;
|
||||
|
||||
if(reg) {
|
||||
string s = (rotspace || gproduct) ? "-2" : "";
|
||||
string s = (mtwisted || gproduct) ? "-2" : "";
|
||||
fmain +=
|
||||
" mediump float best = "+f_len()+"(nposition);\n"
|
||||
" for(int i=0; i<sides"+s+"; i++) {\n"
|
||||
" mediump float cand = "+f_len()+"(" + getM("walloffset+i") + " * nposition);\n"
|
||||
" if(cand < best) { best = cand; which = i; }\n"
|
||||
" }\n";
|
||||
if(rotspace) fmain +=
|
||||
if(mtwisted) fmain +=
|
||||
" if(which == -1) {\n"
|
||||
" mediump float z = rot_zlevel(nposition, sides-2);\n"
|
||||
" if(z > uPLevel) which = sides-1;\n"
|
||||
@ -1283,7 +1283,7 @@ void raygen::emit_iterate(int gid1) {
|
||||
fmain += " const mediump float uPLevel = " + to_glsl(cgi.plevel/2) + ";\n";
|
||||
|
||||
int flat1 = 0, flat2 = deg;
|
||||
if(gproduct || rotspace) flat2 -= 2;
|
||||
if(gproduct || mtwisted) flat2 -= 2;
|
||||
|
||||
#if CAP_BT
|
||||
if(horos()) {
|
||||
@ -1407,7 +1407,7 @@ void raygen::emit_iterate(int gid1) {
|
||||
fmain += " mediump vec4 pos = position;\n";
|
||||
if(nil && nilv::nil_structure_index == 0) fmain += "if(which == 2 || which == 5) pos.z = 0.;\n";
|
||||
if(nil && nilv::nil_structure_index == 2) fmain += "if(which == 6 || which == 7) pos.z = 0.;\n";
|
||||
else if(rotspace) {
|
||||
else if(mtwisted) {
|
||||
fmain += "pos = rot_coordinates(pos, sides-2, which);\n";
|
||||
string spinner = "h = cspin(0, 1, PI) * h;\n";
|
||||
string calc_dxy = sl2 ?
|
||||
@ -1482,7 +1482,7 @@ void raygen::emit_iterate(int gid1) {
|
||||
if(!volumetric::on) fmain +=
|
||||
" col.xyz = col.xyz * d + uFogColor.xyz * (1.-d);\n";
|
||||
|
||||
if(rotspace) fmain +=
|
||||
if(mtwisted) fmain +=
|
||||
" if(rot_dark(position, sides-2)) col.xyz /= 2.;\n";
|
||||
if(nil && nilv::nil_structure_index == 0) fmain +=
|
||||
" if(abs(abs(position.x)-abs(position.y)) < .005) col.xyz /= 2.;\n";
|
||||
@ -2044,7 +2044,7 @@ void raygen::create() {
|
||||
if((gproduct || intra::in) && vid.stereo_mode != sODS) fsh +=
|
||||
"uniform mediump mat4 uLP;\n";
|
||||
|
||||
if(gproduct || intra::in || rotspace) fsh +=
|
||||
if(gproduct || intra::in || mtwisted) fsh +=
|
||||
"uniform mediump float uPLevel;\n";
|
||||
|
||||
if(many_cell_types) fsh +=
|
||||
|
10
system.cpp
10
system.cpp
@ -988,7 +988,7 @@ constexpr int MODECODE_BOX = 387;
|
||||
modecode_t fill_modecode() {
|
||||
dynamicval<int> sp1(multi::players, save.box[197]);
|
||||
dynamicval<eGeometry> sp2(geometry, (eGeometry) save.box[116]);
|
||||
if(among(geometry, gArchimedean, gProduct, gRotSpace, gArbitrary))
|
||||
if(among(geometry, gArchimedean, gProduct, gTwistedProduct, gArbitrary))
|
||||
return 6; /* these would not be saved nor loaded correctly */
|
||||
dynamicval<bool> sp3(shmup::on, save.box[119]);
|
||||
dynamicval<eLandStructure> sp4(land_structure, (eLandStructure) save.box[196]);
|
||||
@ -1451,9 +1451,8 @@ EX void set_geometry(eGeometry target) {
|
||||
if(geometry != target) {
|
||||
stop_game();
|
||||
ors::reset();
|
||||
if(among(target, gProduct, gRotSpace)) {
|
||||
if(among(target, gProduct, gTwistedProduct)) {
|
||||
if(vid.always3) { vid.always3 = false; geom3::apply_always3(); }
|
||||
if(target == gRotSpace) hybrid::csteps = 0;
|
||||
hybrid::configure(target);
|
||||
}
|
||||
geometry = target;
|
||||
@ -1485,11 +1484,6 @@ EX void set_geometry(eGeometry target) {
|
||||
arb::convert::base_geometry = geometry;
|
||||
arb::convert::base_variation = variation;
|
||||
}
|
||||
|
||||
if(rotspace) {
|
||||
check_cgi(); cgi.require_basics();
|
||||
hybrid::csteps = cgi.psl_steps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user