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

synt:: patterns

This commit is contained in:
Zeno Rogue 2018-08-19 15:15:47 +02:00
parent f738bb7002
commit 5384ce3274
4 changed files with 34 additions and 18 deletions

View File

@ -2395,8 +2395,10 @@ int countMinesAround(cell *c) {
} }
transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si) { transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si) {
if(gp::on || irr::on || binarytiling) return Id;
transmatrix V = ddspin(c, si.dir, S42); transmatrix V = ddspin(c, si.dir, S42);
if(si.reflect) return V * Mirror; if(si.reflect) return V * Mirror;
if(syntetic) return V * iddspin(c, 0, S42);
return V; return V;
} }

View File

@ -873,11 +873,6 @@ namespace patterns {
si.dir = 0; si.reflect = false; si.id = ctof(c); si.dir = 0; si.reflect = false; si.id = ctof(c);
si.symmetries = c->type; si.symmetries = c->type;
if(syntetic) {
si.id = synt::id_of(c->master);
return si;
}
if(binarytiling) { if(binarytiling) {
if(pat == PAT_SINGLETYPE) si.id = 0; if(pat == PAT_SINGLETYPE) si.id = 0;
si.dir = 2; si.dir = 2;
@ -891,6 +886,17 @@ namespace patterns {
return si; return si;
} }
if(syntetic && pat == PAT_SIBLING) {
int id = synt::id_of(c->master);
si.id = synt::tilegroup[id];
si.symmetries = synt::periods[si.id];
si.dir = synt::groupoffset[id];
if((sub & SPF_EXTRASYM) && synt::have_symmetry && synt::tilegroup[id^1] < synt::tilegroup[id])
si.id = synt::tilegroup[id^1],
si.reflect = true;
return si;
}
if(pat == PAT_ZEBRA && stdhyperbolic) { if(pat == PAT_ZEBRA && stdhyperbolic) {
si.id = zebra40(c); // 4 to 43 si.id = zebra40(c); // 4 to 43
@ -1468,7 +1474,7 @@ namespace patterns {
if(stdhyperbolic || euclid) if(stdhyperbolic || euclid)
dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == PAT_PALACE), PAT_PALACE); dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == PAT_PALACE), PAT_PALACE);
if(nonbitrunc && S3 == 4) if((nonbitrunc && S3 == 4) || (syntetic && synt::support_chessboard()))
dialog::addBoolItem(XLAT("chessboard"), (whichPattern == PAT_CHESS), PAT_CHESS); dialog::addBoolItem(XLAT("chessboard"), (whichPattern == PAT_CHESS), PAT_CHESS);
if(a38 || a46 || euclid || S3 == 4 || S7 == 4) if(a38 || a46 || euclid || S3 == 4 || S7 == 4)
@ -1477,6 +1483,9 @@ namespace patterns {
if(sphere) if(sphere)
dialog::addBoolItem(XLAT("siblings"), (whichPattern == PAT_SIBLING), PAT_SIBLING); dialog::addBoolItem(XLAT("siblings"), (whichPattern == PAT_SIBLING), PAT_SIBLING);
if(syntetic)
dialog::addBoolItem(XLAT("Archimedean"), (whichPattern == PAT_SIBLING), PAT_SIBLING);
if(euclid) if(euclid)
dialog::addBoolItem(XLAT("torus pattern"), (whichPattern == PAT_FIELD), PAT_FIELD); dialog::addBoolItem(XLAT("torus pattern"), (whichPattern == PAT_FIELD), PAT_FIELD);
else if(sphere) else if(sphere)
@ -1520,7 +1529,10 @@ namespace patterns {
dialog::addBoolItem(XLAT("symmetry 0-2"), subpattern_flags & SPF_SYM02, '2'); dialog::addBoolItem(XLAT("symmetry 0-2"), subpattern_flags & SPF_SYM02, '2');
dialog::addBoolItem(XLAT("symmetry 0-3"), subpattern_flags & SPF_SYM03, '3'); dialog::addBoolItem(XLAT("symmetry 0-3"), subpattern_flags & SPF_SYM03, '3');
} }
if(euclid && among(whichPattern, PAT_COLORING, 0)) if(euclid && among(whichPattern, PAT_COLORING, 0) && !syntetic)
dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '=');
if(syntetic && synt::have_symmetry && whichPattern == PAT_SIBLING)
dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '='); dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '=');
if(whichPattern == PAT_SINGLETYPE) { if(whichPattern == PAT_SINGLETYPE) {

View File

@ -4,14 +4,14 @@ namespace synt {
#define SDEBUG(x) if(debug_geometry) { doindent(); x; fflush(stdout); } #define SDEBUG(x) if(debug_geometry) { doindent(); x; fflush(stdout); }
static const int sfPH = 1;
static const int sfLINE = 2;
// Marek-snub // Marek-snub
vector<int> faces = {3, 6, 6, 6}; vector<int> faces = {3, 6, 6, 6};
vector<int> adj = {1, 0, 2, 3}; vector<int> adj = {1, 0, 2, 3};
vector<bool> invert = {false, false, true, false}; vector<bool> invert = {false, false, true, false};
vector<int> nflags; vector<int> nflags = {sfPH | sfLINE, 0, 0, 0};
static const int sfPH = 1;
static const int sfLINE = 2;
bool have_ph, have_line, have_symmetry; bool have_ph, have_line, have_symmetry;
@ -559,6 +559,10 @@ int support_graveyard() {
0; 0;
} }
bool support_chessboard() {
return 0;
}
bool pseudohept(int id) { bool pseudohept(int id) {
return flags[id] & synt::sfPH; return flags[id] & synt::sfPH;
} }

View File

@ -266,10 +266,8 @@ int celltriangles(cell *c) {
return c->type; return c->type;
} }
#define no_patterndir (gp::on || irr::on || binarytiling)
array<hyperpoint, 3> findTextureTriangle(cell *c, patterns::patterninfo& si, int i) { array<hyperpoint, 3> findTextureTriangle(cell *c, patterns::patterninfo& si, int i) {
transmatrix M = no_patterndir ? ggmatrix(c) : ggmatrix(c) * applyPatterndir(c, si); transmatrix M = ggmatrix(c) * applyPatterndir(c, si);
return make_array(M * C0, M * get_corner_position(c, i), M * get_corner_position(c, i+1)); return make_array(M * C0, M * get_corner_position(c, i), M * get_corner_position(c, i+1));
} }
@ -299,7 +297,7 @@ void mapTexture(cell *c, textureinfo& mi, patterns::patterninfo &si, const trans
mi.symmetries = si.symmetries; mi.symmetries = si.symmetries;
mi.current_type = celltriangles(c); mi.current_type = celltriangles(c);
mi.M = no_patterndir ? T : T * applyPatterndir(c, si); mi.M = T * applyPatterndir(c, si);
mi.triangles.clear(); mi.triangles.clear();
for(int i=0; i<c->type; i++) { for(int i=0; i<c->type; i++) {
@ -351,7 +349,7 @@ bool texture_config::apply(cell *c, const transmatrix &V, int col) {
set_floor(shFullFloor); set_floor(shFullFloor);
qfi.tinf = &mi; qfi.tinf = &mi;
qfi.spin = no_patterndir ? Id : applyPatterndir(c, si); qfi.spin = applyPatterndir(c, si);
if(grid_color) { if(grid_color) {
draw_floorshape(c, V, shFullFloor, 0, PPR_FLOOR); draw_floorshape(c, V, shFullFloor, 0, PPR_FLOOR);