From 5add972bdd5df072aa266f19fa4ada076085a4e3 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 28 Nov 2019 23:09:38 +0100 Subject: [PATCH] product:: using in_h2xe() and in_s2xe() more consistently --- bigstuff.cpp | 2 +- game.cpp | 2 +- landgen.cpp | 4 ++-- nonisotropic.cpp | 7 ++++--- shaders.cpp | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index a1cffa77..894db67f 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -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(hybrid::over_sphere()) return NULL; + if(hybrid::under_class() == gcSphere) return NULL; c = hybrid::get_where(c).first; return PIU ( createAlternateMap(c, rad, firststate, special) ); } diff --git a/game.cpp b/game.cpp index 44f541b9..96a268c7 100644 --- a/game.cpp +++ b/game.cpp @@ -7505,7 +7505,7 @@ EX bool in_full_game() { if(euclid && isCrossroads(specialland)) return true; if(weirdhyperbolic && specialland == laCrossroads4) return true; if(cryst && isCrossroads(specialland)) return true; - if((in_s2xe() || nonisotropic || (hybri && !hybrid::over_sphere())) && isCrossroads(specialland)) return true; + if((in_s2xe() || nonisotropic || (hybri && hybrid::under_class() != gcSphere)) && isCrossroads(specialland)) return true; if(geometry == gNormal && !NONSTDVAR) return true; return false; } diff --git a/landgen.cpp b/landgen.cpp index b352e944..7ad1e7fc 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -296,7 +296,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { c->wall = waPalace; } - if(d == 8 && (sphere || (hybri && hybrid::over_sphere()))) { + if(d == 8 && (sphere || in_s2xe())) { int gs = getHemisphere(c,0); if(NONSTDVAR) { int v = 1; @@ -2715,7 +2715,7 @@ EX void setdist(cell *c, int d, cell *from) { buildEquidistant(c); } - if(d <= 7 && (c->land == laGraveyard || c->land == laHauntedBorder) && !(hybri && hybrid::over_sphere())) { + if(d <= 7 && (c->land == laGraveyard || c->land == laHauntedBorder) && !in_s2xe()) { c->land = (c->landparam >= 1 && c->landparam <= HAUNTED_RADIUS) ? laHauntedBorder : laGraveyard; } diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 9b316102..65e52bb9 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -973,15 +973,16 @@ EX void show_niltorus3() { EX } -EX bool in_s2xe() { return prod && hybrid::over_sphere(); } -EX bool in_h2xe() { return prod && !hybrid::over_sphere(); } +EX bool in_s2xe() { return prod && hybrid::under_class() == gcSphere; } +EX bool in_h2xe() { return prod && hybrid::under_class() == gcHyperbolic; } +EX bool in_e2xe() { return prod && hybrid::under_class() == gcEuclid; } EX namespace hybrid { EX eGeometry underlying; EX geometry_information *underlying_cgip; - EX bool over_sphere() { return ginf[hybrid::underlying].cclass == gcSphere; } + EX eGeometryClass under_class() { return ginf[hybrid::underlying].cclass; } EX void configure(eGeometry g) { if(WDIM == 3) return; diff --git a/shaders.cpp b/shaders.cpp index 1adc035d..d641c868 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -197,7 +197,7 @@ shared_ptr write_shader(flagtype shader_flags) { break; } } - else if(geometry == gProduct && !hybrid::over_sphere() && pmodel == mdPerspective) { + else if(in_h2xe() && pmodel == mdPerspective) { shader_flags |= SF_PERS3 | SF_DIRECT; coordinator += "float z = log(t[2] * t[2] - t[0] * t[0] - t[1] * t[1]) / 2.;\n" @@ -209,7 +209,7 @@ shared_ptr write_shader(flagtype shader_flags) { distfun = "sqrt(z*z+d*d)"; treset = true; } - else if(geometry == gProduct && hybrid::over_sphere() && pmodel == mdPerspective) { + else if(in_s2xe() && pmodel == mdPerspective) { shader_flags |= SF_PERS3 | SF_DIRECT; distfun = "length(t.xyz)", treset = true; }