mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-09-28 22:10:40 +00:00
Working Chessboard pattern. Chessboard pattern used in the Warped Coast.
This commit is contained in:
parent
e9ab4bf2dd
commit
c5395097fe
@ -18,7 +18,7 @@ struct archimedean_tiling {
|
|||||||
vector<bool> invert;
|
vector<bool> invert;
|
||||||
vector<int> nflags;
|
vector<int> nflags;
|
||||||
|
|
||||||
bool have_ph, have_line, have_symmetry, have_chessboard;
|
bool have_ph, have_line, have_symmetry;
|
||||||
|
|
||||||
int repetition = 1;
|
int repetition = 1;
|
||||||
int N;
|
int N;
|
||||||
@ -236,23 +236,6 @@ void archimedean_tiling::prepare() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(have_symmetry) {
|
|
||||||
have_chessboard = true;
|
|
||||||
for(int o=0; o<2; o++)
|
|
||||||
for(int i=o; i<2*N; i+=2)
|
|
||||||
for(int j=i+2; j<2*N; j+=4)
|
|
||||||
if(tilegroup[i] == tilegroup[j])
|
|
||||||
have_chessboard = false;
|
|
||||||
for(int i=0; i<N; i+=2)
|
|
||||||
for(int j=0; j<2*N; j++)
|
|
||||||
if(tilegroup[j] == tilegroup[i])
|
|
||||||
flags[j] |= sfCHESS;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
have_chessboard = N % 2 == 0;
|
|
||||||
for(int i=0; i<M; i+=4) flags[i] |= sfCHESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDEBUG( for(int i=0; i<M; i+=(have_symmetry?1:2)) {
|
SDEBUG( for(int i=0; i<M; i+=(have_symmetry?1:2)) {
|
||||||
printf("tiling group of %2d: [%2d]%2d+Z%2d\n", i, tilegroup[i], groupoffset[i], periods[i]);
|
printf("tiling group of %2d: [%2d]%2d+Z%2d\n", i, tilegroup[i], groupoffset[i], periods[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -411,6 +394,8 @@ heptagon *build_child(heptagon *parent, int d, int id, int pindex) {
|
|||||||
int nei = neighbors_of(h);
|
int nei = neighbors_of(h);
|
||||||
h->c7 = newCell(nei, h);
|
h->c7 = newCell(nei, h);
|
||||||
h->distance = parent->distance + 1;
|
h->distance = parent->distance + 1;
|
||||||
|
if(id < 2*current.N)
|
||||||
|
h->fieldval = parent->move(0)->fieldval + (d/2);
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,7 +648,7 @@ int archimedean_tiling::support_graveyard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool archimedean_tiling::support_chessboard() {
|
bool archimedean_tiling::support_chessboard() {
|
||||||
return 0;
|
return N % 2 == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pseudohept(int id) {
|
bool pseudohept(int id) {
|
||||||
@ -671,7 +656,7 @@ bool pseudohept(int id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool chessvalue(cell *c) {
|
bool chessvalue(cell *c) {
|
||||||
return current.flags[id_of(c->master)] & arcm::sfCHESS;
|
return c->master->fieldval & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool linespattern(cell *c) {
|
bool linespattern(cell *c) {
|
||||||
|
21
pattern2.cpp
21
pattern2.cpp
@ -1063,6 +1063,10 @@ namespace patterns {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool geosupport_chessboard() {
|
||||||
|
return archimedean ? arcm::current.support_chessboard() : (nonbitrunc && S3 == 4);
|
||||||
|
}
|
||||||
|
|
||||||
int geosupport_threecolor() {
|
int geosupport_threecolor() {
|
||||||
if(irr::on) return 0;
|
if(irr::on) return 0;
|
||||||
if(!nonbitrunc && S3 == 3) {
|
if(!nonbitrunc && S3 == 3) {
|
||||||
@ -1222,12 +1226,8 @@ bool kraken_pseudohept(cell *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool warptype(cell *c) {
|
bool warptype(cell *c) {
|
||||||
if(a4 && nonbitrunc) {
|
if(geosupport_chessboard())
|
||||||
if(euclid)
|
return chessvalue(c);
|
||||||
return among(eupattern4(c), 1, 2);
|
|
||||||
else
|
|
||||||
return c->master->distance & 1;
|
|
||||||
}
|
|
||||||
else if(gp::on || irr::on)
|
else if(gp::on || irr::on)
|
||||||
return pseudohept(c);
|
return pseudohept(c);
|
||||||
else
|
else
|
||||||
@ -1366,7 +1366,7 @@ namespace patterns {
|
|||||||
return (0x202020 + col[0] + (col[1] << 8) + (col[2] << 16)) >> (err?2:0);
|
return (0x202020 + col[0] + (col[1] << 8) + (col[2] << 16)) >> (err?2:0);
|
||||||
}
|
}
|
||||||
if(whichCanvas == 'c') {
|
if(whichCanvas == 'c') {
|
||||||
return (c->master->distance&1) ? 0xC0C0C0 : 0x202020;
|
return chessvalue(c) ? 0xC0C0C0 : 0x202020;
|
||||||
}
|
}
|
||||||
if(whichCanvas == 'F') {
|
if(whichCanvas == 'F') {
|
||||||
return pseudohept(c) ? 0x202020 : 0xC0C0C0;
|
return pseudohept(c) ? 0x202020 : 0xC0C0C0;
|
||||||
@ -1393,7 +1393,7 @@ namespace patterns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialog::addItem(XLAT("football"), 'F');
|
dialog::addItem(XLAT("football"), 'F');
|
||||||
if(S3 == 4 && nonbitrunc)
|
if(geosupport_chessboard())
|
||||||
dialog::addItem(XLAT("chessboard"), 'c');
|
dialog::addItem(XLAT("chessboard"), 'c');
|
||||||
|
|
||||||
dialog::addItem(XLAT("nice coloring"), 'T');
|
dialog::addItem(XLAT("nice coloring"), 'T');
|
||||||
@ -1490,7 +1490,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) || (archimedean && arcm::current.support_chessboard()))
|
if(geosupport_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)
|
||||||
@ -1499,9 +1499,6 @@ 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(archimedean)
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user