1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-31 19:36:16 +00:00

replaced product::product_sphere()

This commit is contained in:
Zeno Rogue 2019-09-12 14:24:02 +02:00
parent dbc95ed7a4
commit d1bf6fef5e
9 changed files with 19 additions and 16 deletions

View File

@ -300,9 +300,9 @@ void display_data::set_projection(int ed) {
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardH3, pers3 = true;
if(GDIM == 3 && translatable && apply_models && pmodel == mdPerspective)
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardR3, pers3 = true;
if(GDIM == 3 && apply_models && pmodel == mdPerspective && prod && product::product_sphere())
if(GDIM == 3 && apply_models && pmodel == mdPerspective && in_s2xe())
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardR3, pers3 = true;
if(GDIM == 3 && apply_models && pmodel == mdPerspective && prod && !product::product_sphere())
if(GDIM == 3 && apply_models && pmodel == mdPerspective && in_h2xe())
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardEH2, pers3 = true;
if(GDIM == 3 && apply_models && pmodel == mdGeodesic && sol)
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardSolv, pers3 = true;

View File

@ -185,7 +185,7 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) {
if(hybri) {
if(product::product_sphere()) return NULL;
if(hybrid::over_sphere()) return NULL;
c = hybrid::get_where(c).first;
heptagon *res;
hybrid::in_underlying_map([&] { res = createAlternateMap(c, rad, firststate, special); });
@ -981,7 +981,7 @@ EX void setLandSol(cell *c) {
}
EX void setLandHybrid(cell *c) {
if(prod && product::product_sphere() && !among(specialland, laElementalWall)) {
if(in_s2xe() && !among(specialland, laElementalWall)) {
auto w = hybrid::get_where(c);
auto d = w.second;
@ -1676,7 +1676,7 @@ EX void moreBigStuff(cell *c) {
}
else if((c->land == laRlyeh && !euclid) || c->land == laTemple) if(!(binarytiling && specialland != laTemple && c->land == laRlyeh)) {
if(eubinary || (prod && product::product_sphere()) || (c->master->alt && (tactic::on || masterAlt(c) <= 2))) {
if(eubinary || in_s2xe() || (c->master->alt && (tactic::on || masterAlt(c) <= 2))) {
if(!eubinary && !chaosmode) currentmap->generateAlts(c->master);
preventbarriers(c);
int d = celldistAlt(c);
@ -1700,7 +1700,7 @@ EX void moreBigStuff(cell *c) {
else if(geometry == gKiteDart3) {
if(kite::getshape(c->master) == kite::pKite) c->wall = waColumn;
}
else if(prod && product::product_sphere()) {
else if(in_s2xe()) {
auto d = hybrid::get_where(c);
if(!PIU(pseudohept(d.first))) c->wall = waColumn;
}

View File

@ -462,7 +462,7 @@ static const int ALTDIST_ERROR = 90000;
EX int celldistAlt(cell *c) {
if(experimental) return 0;
if(hybri) {
if(prod && product::product_sphere()) return hybrid::get_where(c).second;
if(in_s2xe()) return hybrid::get_where(c).second;
auto w = hybrid::get_where(c);
int d = c->master->alt && c->master->alt->alt ? c->master->alt->alt->fieldval : 0;
d = sl2 ? 0 : abs(w.second - d);

View File

@ -1241,7 +1241,7 @@ EX }
void dqi_poly::draw() {
if(flags & POLY_DEBUG) debug_this();
if(prod && vid.usingGL && pmodel == mdPerspective && (current_display->set_all(global_projection), shaderside_projection) && product::product_sphere()) {
if(in_s2xe() && vid.usingGL && pmodel == mdPerspective && (current_display->set_all(global_projection), shaderside_projection)) {
s2xe::draw_s2xe(this);
return;
}

View File

@ -732,7 +732,7 @@ EX void showEuclideanMenu() {
});
}
if(prod && product::product_sphere()) {
if(in_s2xe()) {
dialog::addSelItem(XLAT("precision of S2xE rings"), its(s2xe::qrings), '4');
dialog::add_action([] {
dialog::editNumber(s2xe::qrings, 1, 256, 4, 32, XLAT("precision of S2xE rings"),

View File

@ -5108,7 +5108,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
}
if(just_gmatrix) return;
#if MAXMDIM >= 4
if(WDIM == 3 && pmodel == mdPerspective && !nonisotropic && !(prod && product::product_sphere())) {
if(WDIM == 3 && pmodel == mdPerspective && !nonisotropic && !in_s2xe()) {
hyperpoint H = tC0(V);
if(prod) H = product::inverse_exp(H);
for(hyperpoint& cpoint: clipping_planes) if((H|cpoint) < -sin_auto(cgi.corner_bonus)) {

View File

@ -1411,9 +1411,9 @@ EX void optimizeview() {
if(prod) {
ld z = zlevel(tC0(View));
View = mscale(View, -z);
if(product::product_sphere()) View = centralsym * View;
if(in_s2xe()) View = centralsym * View;
hybrid::in_underlying_map(optimizeview);
if(product::product_sphere()) View = centralsym * View;
if(in_s2xe()) View = centralsym * View;
if(z > cgi.plevel / 2) { hybrid::current_view_level--; z -= cgi.plevel; }
if(z < -cgi.plevel / 2) { hybrid::current_view_level++; z += cgi.plevel; }
View = mscale(View, z);

View File

@ -288,7 +288,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
c->wall = waPalace;
}
if(d == 8 && (sphere || (hybri && product::product_sphere()))) {
if(d == 8 && (sphere || (hybri && hybrid::over_sphere()))) {
int gs = getHemisphere(c,0);
if(NONSTDVAR) {
int v = 1;
@ -2705,7 +2705,7 @@ EX void setdist(cell *c, int d, cell *from) {
buildEquidistant(c);
}
if(d <= 7 && (c->land == laGraveyard || c->land == laHauntedBorder) && !(hybri && product::product_sphere())) {
if(d <= 7 && (c->land == laGraveyard || c->land == laHauntedBorder) && !(hybri && hybrid::over_sphere())) {
c->land = (c->landparam >= 1 && c->landparam <= HAUNTED_RADIUS) ? laHauntedBorder : laGraveyard;
}

View File

@ -566,12 +566,17 @@ EX namespace nilv {
}
EX }
EX bool in_s2xe() { return prod && hybrid::over_sphere(); }
EX bool in_h2xe() { return prod && !hybrid::over_sphere(); }
EX namespace hybrid {
EX int current_view_level;
EX eGeometry underlying;
EX geometry_information *underlying_cgip;
EX bool over_sphere() { return ginf[hybrid::underlying].cclass == gcSphere; }
EX void configure(eGeometry g) {
if(WDIM == 3) return;
check_cgi();
@ -816,8 +821,6 @@ EX namespace product {
});
}
EX bool product_sphere() { return ginf[hybrid::underlying].cclass == gcSphere; }
EX hyperpoint inverse_exp(hyperpoint h) {
hyperpoint res;
res[2] = zlevel(h);