remplace euclid6, euclid4, 'euclid && \!archimedean && \!penrose' with standard_tiling(), euc::in(dimension, s7)

This commit is contained in:
Zeno Rogue 2019-12-14 11:26:03 +01:00
parent 7568accff7
commit 0a9ec78c18
16 changed files with 56 additions and 51 deletions

View File

@ -49,7 +49,7 @@ EX int celldistAltRelative(cell *c) {
if(cryst) return crystal::dist_relative(c);
#endif
#if MAXMDIM >= 4
if(euclid && WDIM == 3) return euc::dist_relative(c);
if(euc::in(3)) return euc::dist_relative(c);
#endif
if(euclid && quotient) return celldistAlt(c) - roundTableRadius(c);
if(sphere || quotient) {
@ -63,7 +63,7 @@ EX gp::loc camelot_coords() { return gp::loc(a4 ? 21 : 20, 10); }
EX int euclidAlt(short x, short y) {
if(among(specialland, laTemple, laClearing, laCanvas)) {
if(euclid6)
if(euc::in(2,6))
return max(int(x), x+y);
else if(PURE)
return x + abs(y);
@ -71,7 +71,7 @@ EX int euclidAlt(short x, short y) {
return max(x, y);
}
else if(specialland == laCaribbean || specialland == laWhirlpool || specialland == laMountain) {
if(euclid6)
if(euc::in(2,6))
return
min(
min(max(int(-x), -x-y) + 3,
@ -1148,7 +1148,7 @@ EX void setLandEuclid(cell *c) {
if(specialland == laElementalWall) {
auto co = euc2_coordinates(c);
int x = co.first, y = co.second;
int x0 = euclid4 ? x : x + (y>>1);
int x0 = euc::in(2,4) ? x : x + (y>>1);
int y0 = y;
int id = 0;
@ -1177,8 +1177,8 @@ EX void setLandEuclid(cell *c) {
if(specialland == laCrossroads3) {
auto co = euc2_coordinates(c);
int x = co.first, y = co.second;
int y0 = euclid4 ? 2 * y - x : y;
int x0 = euclid4 ? 2 * x + y : x + y/2;
int y0 = euc::in(2,4) ? 2 * y - x : y;
int x0 = euc::in(2,4) ? 2 * x + y : x + y/2;
x0 += 24; y0 += 8;
@ -1188,7 +1188,7 @@ EX void setLandEuclid(cell *c) {
setland(c, id ? laCrossroads3 : laDesert);
if(euclid4 ? (!(y0&15) || !(x0&15)) : ((y0&15) == 15 && (x0&1)) || ((x0&15) == 0 && ((y0+1)&1))) {
if(euc::in(2,4) ? (!(y0&15) || !(x0&15)) : ((y0&15) == 15 && (x0&1)) || ((x0&15) == 0 && ((y0+1)&1))) {
setland(c, laBarrier);
c->wall = waBarrier;
}

View File

@ -487,7 +487,7 @@ EX int celldistAlt(cell *c) {
return celldist(c) - 3;
}
#if MAXMDIM >= 4
if(euclid && WDIM == 3) return euc::dist_alt(c);
if(euc::in(3)) return euc::dist_alt(c);
if(hyperbolic && WDIM == 3) return reg3::altdist(c->master);
#endif
if(!c->master->alt) return 0;
@ -862,7 +862,7 @@ EX cdata *arcmCdata(cell *c) {
EX int getCdata(cell *c, int j) {
if(prod) { c = hybrid::get_where(c).first; return PIU(getBits(c)); }
else if(euclid && !archimedean && !penrose) return getEuclidCdata(euc2_coordinates(c))->val[j];
else if(euc::in()) return getEuclidCdata(euc2_coordinates(c))->val[j];
else if(archimedean && euclid)
return getEuclidCdata(pseudocoords(c))->val[j];
else if(archimedean && hyperbolic)
@ -880,7 +880,7 @@ EX int getCdata(cell *c, int j) {
EX int getBits(cell *c) {
if(prod) { c = hybrid::get_where(c).first; return PIU(getBits(c)); }
else if(euclid && !archimedean && !penrose) return getEuclidCdata(euc2_coordinates(c))->bits;
else if(euc::in()) return getEuclidCdata(euc2_coordinates(c))->bits;
else if(archimedean && euclid)
return getEuclidCdata(pseudocoords(c))->bits;
else if(archimedean && (hyperbolic || sl2))
@ -1012,7 +1012,7 @@ EX int celldistance(cell *c1, cell *c2) {
if(cryst) return crystal::precise_distance(c1, c2);
#endif
if(euclid && WDIM == 2 && !penrose && !archimedean) {
if(euc::in() && WDIM == 2) {
return euc::cyldist(euc2_coordinates(c1), euc2_coordinates(c2));
}
@ -1236,4 +1236,8 @@ EX vector<int> reverse_directions(heptagon *c, int dir) {
}
}
EX bool standard_tiling() {
return !archimedean && !penrose && !binarytiling;
}
}

View File

@ -2564,7 +2564,7 @@ void celldrawer::set_maywarp_floor() {
void celldrawer::set_reptile_floor(const transmatrix& V, color_t col, bool nodetails) {
auto si =
euclid6 ?
euc::in(2,6) ?
patterns::getpatterninfo(c, patterns::PAT_COLORING, patterns::SPF_CHANGEROT)
:
patterns::getpatterninfo(c, patterns::PAT_ZEBRA, patterns::SPF_SYM0123);
@ -2579,11 +2579,11 @@ void celldrawer::set_reptile_floor(const transmatrix& V, color_t col, bool nodet
else if(si.id >= 28 && si.id < 40) j = 3;
else j = 4;
if(euclid6) j = 0;
if(euc::in(2,6)) j = 0;
transmatrix D = applyPatterndir(c, si);
if(euclid6 && GOLDBERG) D = ddspin(c, si.dir);
if(wmescher && (stdhyperbolic || euclid6))
if(euc::in(2,6) && GOLDBERG) D = ddspin(c, si.dir);
if(wmescher && (stdhyperbolic || euc::in(2,6)))
set_floor(D, cgi.shReptile[j][0]);
else set_maywarp_floor();

View File

@ -3799,7 +3799,7 @@ EX namespace dungeon {
if(y0 >= 6) { y0 -= 6; x += 4; }
char ch = euclid6 ? tab6[y0][(x+(y+1)/2)&7] : tab4[y0][x&7];
char ch = euc::in(2,6) ? tab6[y0][(x+(y+1)/2)&7] : tab4[y0][x&7];
if(ch == '#')
c->wall = waPlatform;

View File

@ -1159,6 +1159,10 @@ EX int cyldist(gp::loc a, gp::loc b) {
return best;
}
EX bool in() { return euclid && standard_tiling(); }
EX bool in(int dim) { return in() && WDIM == dim; }
EX bool in(int dim, int s7) { return in(dim) && S7 == s7; }
EX }
EX gp::loc euc2_coordinates(cell *c) { return euc::full_coords2(c); }

View File

@ -326,9 +326,8 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
for(auto pfsh: all_plain_floorshapes) {
auto& fsh = *pfsh;
if(STDVAR && !archimedean && !penrose) {
if(STDVAR && (standard_tiling() || binarytiling)) {
// standard and binary
ld hexside = fsh.rad0, heptside = fsh.rad1;
for(int k=0; k<SIDEPARS; k++) sizeto(fsh.side[k], id);
@ -451,7 +450,7 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
sizeto(fsh.b, id);
sizeto(fsh.shadow, id);
if(STDVAR && !binarytiling && !archimedean && !penrose) {
if(STDVAR && standard_tiling()) {
generate_matrices_scale(fsh.scale, fsh.noftype);
if(PURE && geosupport_football() < 2) {
bshape2(fsh.b[id], fsh.prio, fsh.shapeid2 ? fsh.shapeid2 : fsh.shapeid1, hept_matrices);

View File

@ -231,7 +231,7 @@ EX geometry_filter gf_spherical = {"spherical", [] { return (archimedean || sphe
EX geometry_filter gf_euclidean = {"Euclidean", [] { return (archimedean || euclid) && !forced_quotient(); }};
EX geometry_filter gf_other = {"non-isotropic", [] { return prod || nonisotropic; }};
EX geometry_filter gf_regular_2d = {"regular 2D tesselations", [] {
return !archimedean && !binarytiling && !penrose && WDIM == 2 && !forced_quotient();
return standard_tiling() && WDIM == 2 && !forced_quotient();
}};
EX geometry_filter gf_regular_3d = {"regular 3D honeycombs", [] {
if(euclid) return geometry == gCubeTiling;
@ -613,7 +613,7 @@ EX void showEuclideanMenu() {
else if(binarytiling)
spf = "6,[6,7],7";
#endif
else if(BITRUNCATED && !euclid6)
else if(BITRUNCATED)
spf = spf + "," + its(S6) + "," + its(S6);
#if CAP_IRR
else if(IRREGULAR && irr::bitruncations_performed)
@ -685,7 +685,7 @@ EX void showEuclideanMenu() {
#if CAP_ARCM
else if(archimedean) arcm::next_variation();
#endif
else if(euclid4 || !CAP_GP) dialog::do_if_confirmed([] {
else if(euc::in(2,4) || !CAP_GP) dialog::do_if_confirmed([] {
set_variation(PURE ? eVariation::bitruncated : eVariation::pure);
start_game();
});
@ -789,7 +789,7 @@ EX void showEuclideanMenu() {
string fgname = XLAT(ginf[geometry].tiling_name);
if(qstring != "none") fgname += " " + XLAT(qstring);
if(!euclid6) fgname = gp::operation_name() + " " + fgname;
if(!euc::in(2,6)) fgname = gp::operation_name() + " " + fgname;
dialog::addTitle(XLAT("info about: %1", fgname), 0xFFFFFF, 150);

View File

@ -531,7 +531,7 @@ void geometry_information::prepare_basics() {
floorrad0 = hexvdist* (GDIM == 3 ? 1 : 0.92);
floorrad1 = rhexf * (GDIM == 3 ? 1 : 0.94);
if(euclid4) {
if(euc::in(2,4)) {
if(!BITRUNCATED)
floorrad0 = floorrad1 = rhexf * (GDIM == 3 ? 1 : .94);
else

View File

@ -3249,7 +3249,7 @@ EX bool placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, color_t
dynamicval<bool> ncor(approx_nearcorner, true);
transmatrix V2 = V * ddspin(c, i);
if(binarytiling || archimedean || NONSTDVAR || penrose) {
if(NONSTDVAR || !standard_tiling()) {
#if CAP_ARCM
if(archimedean && !PURE)
i = (i + arcm::parent_index_of(c->master)/DUALMUL + MODFIXER) % c->type;

View File

@ -814,14 +814,14 @@ EX void describeMouseover() {
if(randomPatternsMode)
out += " " + describeRPM(c->land);
if(euclid && cheater && WDIM == 2 && !archimedean && !penrose) {
if(cheater && euc::in(2)) {
auto co = euc2_coordinates(c);
out += " (" + its(co.first);
for(int i=1; i<WDIM; i++) out += "," + its(co.second);
out += ")";
}
if(euclid && cheater && WDIM == 3) {
if(cheater && euc::in(3)) {
auto co = euc::get_ispacemap()[c->master];
out += " (" + its(co[0]);
for(int i=1; i<WDIM; i++) out += "," + its(co[i]);

View File

@ -165,8 +165,6 @@ void addMessage(string s, char spamtype = 0);
#define stdeuc (geometry == gNormal || geometry == gEuclid || geometry == gEuclidSquare)
#define smallsphere (sphere_narcm && S7 < 5)
#define bigsphere (sphere_narcm && S7 == 5)
#define euclid4 (euclid && WDIM == 2 && a4)
#define euclid6 (euclid && WDIM == 2 && !a4)
#define S6 (S3*2)
#define MAX_S3 4

View File

@ -506,7 +506,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
else if(WDIM == 3 && hyperbolic && !binarytiling)
c->wall = (c->master->zebraval & 1) ? waCavewall : waCavefloor;
#if MAXMDIM >= 4
else if(euclid && WDIM == 3)
else if(euc::in(3))
c->wall = euc::get_emerald(c) ? waCavewall : waCavefloor;
#endif
else if(euclid) {
@ -1284,16 +1284,16 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
break;
case laStorms: {
bool randstorm = PIU(hyperbolic_not37 || NONSTDVAR || (quotient && geometry != gZebraQuotient && !(euclid && !archimedean && !penrose && WDIM == 2)));
bool randstorm = PIU(hyperbolic_not37 || NONSTDVAR || (quotient && geometry != gZebraQuotient && !euc::in(2)));
if(fargen) {
if(euclid && smallbounded && WDIM == 2) {
if(euc::in(2) && smallbounded) {
auto s = euc::sdxy();
gp::loc st {s.first/3, s.second/3};
if(c == euc::at(st)) c->wall = waCharged;
if(c == euc::at(s-st)) c->wall = waGrounded;
}
else if(euclid && WDIM == 2) {
else if(euc::in(2)) {
auto co = euc2_coordinates(c);
int x = co.first, y = co.second;
if((x+1)%3 == 0 && y%3 == 0) {
@ -2656,7 +2656,7 @@ EX void setdist(cell *c, int d, cell *from) {
else if(cryst) crystal::set_land(c);
#endif
#if MAXMDIM == 4
else if(euclid && WDIM == 3) euc::set_land(c);
else if(euc::in(3)) euc::set_land(c);
#endif
else if(hybri) setLandHybrid(c);
else if(sphere || (euclid && bounded)) setLandSphere(c);

View File

@ -1081,7 +1081,7 @@ EX land_validity_t& land_validity(eLand l) {
else {
bool reptile_good = false;
if(hyperbolic_37 && BITRUNCATED) reptile_good = true;
if(euclid6) reptile_good = true;
if(euc::in(2,6)) reptile_good = true;
if(quotient && geometry != gZebraQuotient && !euclid)
reptile_good = false;
if(!reptile_good)

View File

@ -167,7 +167,7 @@ namespace mapstream {
}
if(binarytiling && VERNUM_HEX >= 0xA80C)
f.write(vid.binary_width);
if(euclid && !penrose && !archimedean) {
if(euc::in()) {
f.write(euc::eu_input.user_axes);
f.write(euc::eu_input.twisted);
}
@ -253,7 +253,7 @@ namespace mapstream {
}
if(binarytiling && VERNUM_HEX >= 0xA80C)
f.read(vid.binary_width);
if(euclid && !penrose && !archimedean && VERNUM_HEX >= 0xA80D) {
if(euc::in() && VERNUM_HEX >= 0xA80D) {
f.read(euc::eu_input.user_axes);
f.read(euc::eu_input.twisted);
}

View File

@ -804,7 +804,7 @@ EX namespace patterns {
si.dir = (zebra40(c)*4) % 6;
}
if(symRotation) si.id = 1;
if(euclid6 && (sub & SPF_FULLSYM))
if(euc::in(2,6) && (sub & SPF_FULLSYM))
si.symmetries = 1;
}
@ -829,8 +829,8 @@ EX namespace patterns {
else if(a46) val46(c, si, sub, pat);
else if(a38) val38(c, si, sub, pat);
else if(sphere && S3 == 3) valSibling(c, si, sub, pat);
else if(euclid4 && !penrose && !archimedean) valEuclid4(c, si, sub);
else if(euclid6 && !penrose && !archimedean) valEuclid6(c, si, sub);
else if(euc::in(2,4)) valEuclid4(c, si, sub);
else if(euc::in(2,6)) valEuclid6(c, si, sub);
else if(a4) val457(c, si, sub);
else si.symmetries = ctof(c) ? 1 : 2;
}
@ -911,7 +911,7 @@ EX namespace patterns {
val_warped(c, si);
else {
si.id = pseudohept(c) ? 1 : 0;
if(euclid && !penrose && !archimedean) {
if(euc::in()) {
si.dir = ishex1(c) ? 0 : 3;
if(ctof(c)) si.symmetries = 3;
if(subpattern_flags & SPF_EXTRASYM)
@ -955,7 +955,7 @@ EX namespace patterns {
break;
}
}
if(euclid6 && (sub & SPF_CHANGEROT)) {
if(euc::in(2,6) && (sub & SPF_CHANGEROT)) {
if(GOLDBERG) {
auto li = gp::get_local_info(c);
if(li.first_dir >= 0)
@ -969,10 +969,10 @@ EX namespace patterns {
si.dir = (zebra40(c)*4 + 9 - c->c.spin(0)) % 6;
}
if(sub & SPF_ROT) si.id = 1;
if(euclid6 && !(sub & SPF_EXTRASYM)) {
if(euc::in(2,6) && !(sub & SPF_EXTRASYM)) {
si.symmetries = 6;
}
if(euclid6 && (sub & SPF_FULLSYM))
if(euc::in(2,6) && (sub & SPF_FULLSYM))
si.symmetries = 1;
applyAlt(si, sub, PAT_COLORING);
}
@ -1283,7 +1283,7 @@ EX int pattern_threecolor(cell *c) {
patterns::val38(c, si, !BITRUNCATED ? 0 : patterns::SPF_ROT, patterns::PAT_COLORING);
return si.id >> 2;
}
if(euclid6 && gp_threecolor() == 2) {
if(euc::in(2,6) && gp_threecolor() == 2) {
auto li = gp::get_local_info(c);
int rel = gmod(li.relative.first - li.relative.second, 3);
if(rel && (li.last_dir&1)) rel = 3 - rel;
@ -1315,7 +1315,7 @@ EX int pattern_threecolor(cell *c) {
}
if(euclid) {
if(a4 && PURE) return eupattern4(c);
if(euclid6 && !BITRUNCATED) return eupattern(c) % 3;
if(euc::in(2,6) && !BITRUNCATED) return eupattern(c) % 3;
return c == c->master->c7 ? 0 : (c->c.spin(0)&1) ? 1 : 2;
}
if(S3 >= OINF) return c->master->distance % 3;
@ -1755,7 +1755,7 @@ EX namespace patterns {
dialog::addItem(XLAT("nice coloring"), 'T');
if(euclid6)
if(euc::in(2,6))
dialog::addItem(XLAT("seven-coloring"), 'v');
if(stdhyperbolic) {
@ -2441,7 +2441,7 @@ EX namespace linepatterns {
switch(id) {
case patZebraTriangles:
if(euclid6) {
if(euc::in(2,6)) {
if(c != c->master->c7 || patterns::sevenval(c)) break;
gridline(V, C0, tC0(euc::eumove(gp::loc(-1, +3))), col, 3 + vid.linequality);
gridline(V, C0, tC0(euc::eumove(gp::loc(-3, +2))), col, 3 + vid.linequality);

View File

@ -1134,7 +1134,7 @@ void geometry_information::configure_floorshapes() {
double eps = hexhexdist * .05;
if(euclid) trihepta0 = hexhexdist * .5 - eps * sqrt(3)/2, trihepta1 = hexhexdist * sqrt(3)/2 - eps; // .5-.1; .75-.05
if(euclid4)
if(euc::in(2,4))
trihepta0 = trihepta1 = crossf * 1.35 / 2;
if(sphere&&S7==3) trihepta0 *= 1.3, trihepta1 *= 1.6;
@ -1340,7 +1340,7 @@ void geometry_information::prepare_shapes() {
if(sphere) krsc *= 1.4;
if(S7 ==8) krsc *= 1.3;
if(PURE && !euclid4) {
if(PURE && !euc::in(2,4)) {
tentacle_length = 1.52;
bshape(shSeaTentacle, PPR::TENTACLE1, 1, 245);
}
@ -1353,7 +1353,7 @@ void geometry_information::prepare_shapes() {
bshape(shSeaTentacle, PPR::TENTACLE1, scalefactor, 246);
}
ld ksc = (!BITRUNCATED ? 1.8 : 1.5) * scalefactor * krsc;
if(euclid4 && PURE) ksc *= .5;
if(euc::in(2,4) && PURE) ksc *= .5;
bshape(shKrakenHead, PPR::ONTENTACLE, ksc, 247);
bshape(shKrakenEye, PPR::ONTENTACLE_EYES, ksc, 248);
bshape(shKrakenEye2, PPR::ONTENTACLE_EYES2, ksc, 249);