From bd59b4e23ae4239b1b399b6649b4599c106c2fbb Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 2 Aug 2018 22:25:08 +0200 Subject: [PATCH] fixed singletype texture patterns --- classes.h | 2 +- hyper.h | 1 + pattern2.cpp | 56 +++++++++++++++++++++++++++++++++++++++++----------- textures.cpp | 4 ++-- 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/classes.h b/classes.h index 14f4981b..fd18a569 100644 --- a/classes.h +++ b/classes.h @@ -235,7 +235,7 @@ extern itemtype iinf[ittypes]; extern const landtype linf[landtypes]; enum cpatterntype { - cpFootball, cpThree, cpChess, cpSingle, cpLarge, cpZebra, cpUnknown + cpFootball, cpThree, cpChess, cpSingle, cpSingleSym, cpOddEven, cpLarge, cpZebra, cpUnknown }; struct landtacinfo { eLand l; int tries, multiplier; }; diff --git a/hyper.h b/hyper.h index 3d455f9d..4d093b40 100644 --- a/hyper.h +++ b/hyper.h @@ -905,6 +905,7 @@ namespace patterns { static const char PAT_COLORING = 'C'; static const char PAT_SIBLING = 'S'; static const char PAT_CHESS = 'c'; + static const char PAT_SINGLETYPE = 't'; extern int subpattern_flags; diff --git a/pattern2.cpp b/pattern2.cpp index be403c5f..0df4e373 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -862,10 +862,17 @@ namespace patterns { patterninfo getpatterninfo(cell *c, char pat, int sub) { bool symRotation = sub & SPF_ROT; // bool sym0 = sub & (SPF_SYM01 | SPF_SYM02 | SPF_SYM03); - + patterninfo si; si.dir = 0; si.reflect = false; si.id = ctof(c); si.symmetries = c->type; + + if(pat == PAT_SINGLETYPE) { + si.id = 0; si.symmetries = 1; + if(sub & SPF_TWOCOL) si.id = c->type & 1; + if(sub & SPF_EXTRASYM) si.reflect = true; + return si; + } if(pat == PAT_ZEBRA && stdhyperbolic) { @@ -1447,6 +1454,8 @@ namespace patterns { dialog::addBoolItem(XLAT("single cells"), (whichPattern == PAT_FIELD), PAT_FIELD); else dialog::addBoolItem(XLAT("field pattern"), (whichPattern == PAT_FIELD), PAT_FIELD); + + dialog::addBoolItem(XLAT("single type"), (whichPattern == PAT_SINGLETYPE), PAT_SINGLETYPE); if( (whichPattern == PAT_EMERALD && (stdhyperbolic || a38)) || @@ -1485,6 +1494,11 @@ namespace patterns { if(euclid && among(whichPattern, PAT_COLORING, 0)) dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '='); + if(whichPattern == PAT_SINGLETYPE) { + dialog::addBoolItem(XLAT("odd/even"), subpattern_flags & SPF_TWOCOL, '5'); + dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '='); + } + if(euclid && among(whichPattern, PAT_COLORING, 0)) dialog::addBoolItem(XLAT("full symmetry"), subpattern_flags & SPF_FULLSYM, '!'); @@ -1522,7 +1536,7 @@ namespace patterns { keyhandler = [] (int sym, int uni) { dialog::handleNavigation(sym, uni); - if(among(uni, PAT_EMERALD, PAT_PALACE, PAT_ZEBRA, PAT_DOWN, PAT_FIELD, PAT_COLORING, PAT_SIBLING, PAT_CHESS)) { + if(among(uni, PAT_EMERALD, PAT_PALACE, PAT_ZEBRA, PAT_DOWN, PAT_FIELD, PAT_COLORING, PAT_SIBLING, PAT_CHESS, PAT_SINGLETYPE)) { if(whichPattern == uni) whichPattern = 0; else whichPattern = uni; #if CAP_EDIT @@ -1630,16 +1644,34 @@ namespace patterns { {g47, true, PAT_CHESS, 0} }}, {"single type", { - {gNormal, true, 0, 0}, - {gSphere, true, 0, SPF_EXTRASYM}, - {gEuclid, false, PAT_COLORING, SPF_EXTRASYM | SPF_ROT | SPF_FULLSYM}, - {gOctagon, true, 0, SPF_EXTRASYM}, - {g45, true, 0, 0}, - {g46, true, 0, 0}, - {g47, true, 0, 0}, - {gSmallSphere, true, 0, SPF_EXTRASYM}, - {gTinySphere, true, 0, SPF_EXTRASYM}, - {gEuclidSquare, true, 0, SPF_EXTRASYM}, + {gNormal, true, PAT_SINGLETYPE, 0}, + {gSphere, true, PAT_SINGLETYPE, 0}, + {gEuclid, false, PAT_SINGLETYPE, 0}, + {gOctagon, true, PAT_SINGLETYPE, 0}, + {g45, true, PAT_SINGLETYPE, 0}, + {g46, true, PAT_SINGLETYPE, 0}, + {g47, true, PAT_SINGLETYPE, 0}, + {gSmallSphere, true, PAT_SINGLETYPE, 0}, + {gTinySphere, true, PAT_SINGLETYPE, 0}, + {gEuclidSquare, true, PAT_SINGLETYPE, 0}, + }}, + {"single type+symmetry", { + {gNormal, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gSphere, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gEuclid, false, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gOctagon, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {g45, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {g46, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {g47, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gSmallSphere, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gTinySphere, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gEuclidSquare, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + }}, + {"odd/even", { + {gNormal, false, PAT_SINGLETYPE, SPF_TWOCOL}, + {gSphere, false, PAT_SINGLETYPE, SPF_TWOCOL}, + {g45, true, PAT_SINGLETYPE, SPF_TWOCOL}, + {g47, true, PAT_SINGLETYPE, SPF_TWOCOL} }}, {"large picture", { {gNormal, false, PAT_PALACE, SPF_SYM0123}, diff --git a/textures.cpp b/textures.cpp index d6fea4ed..d8bcf1dd 100644 --- a/textures.cpp +++ b/textures.cpp @@ -1425,7 +1425,7 @@ void texture_config::remap(eTextureState old_tstate, eTextureState old_tstate_ma if(texture_map.count(si.id)) continue; int pshift = 0; - if(texture::cgroup == cpSingle) oldid = 1; + if(texture::cgroup == cpSingle) oldid = 0; if(texture::cgroup == cpFootball && patterns::cgroup == cpThree) { if(si.id == 4) pshift = 1; oldid = !si.id; @@ -1450,7 +1450,7 @@ void texture_config::remap(eTextureState old_tstate, eTextureState old_tstate_ma // printf("%08x remapping %d vertices to %d vertices\n", si.id, isize(mi.tvertices), isize(mi2.tvertices)); } catch(out_of_range&) { - printf("Unexpected missing cell #%d/%d", si.id, oldid); + printf("Unexpected missing cell #%d/%d\n", si.id, oldid); addMessage(XLAT("Unexpected missing cell #%d/%d", its(si.id), its(oldid))); config.tstate_max = config.tstate = tsAdjusting; return;