1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-10 15:59:53 +00:00

new patterns for 4D Crystal

This commit is contained in:
Zeno Rogue 2019-10-12 13:12:15 +02:00
parent 300fb6bcbd
commit 48b1773f0d
2 changed files with 75 additions and 8 deletions

View File

@ -614,14 +614,75 @@ array<array<int,2>, MAX_EDGE> distlimit_table = {{
{{6, 4}}, {{5, 3}}, {{4, 3}}, {{4, 3}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}} {{6, 4}}, {{5, 3}}, {{4, 3}}, {{4, 3}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}}
}}; }};
EX color_t colorize(cell *c) { EX color_t colorize(cell *c, char whichCanvas) {
auto m = crystal_map(); auto m = crystal_map();
ldcoord co = m->get_coord(c); ldcoord co = ldc0;
color_t res; int dim;
res = 0; if(cryst) co = m->get_coord(c), dim = m->cs.dim;
#if MAXMDIM >= 4
else if(geometry == gSpace344) {
co = told(reg3::decode_coord(c->master->fieldval)), dim = 4;
for(int a=0; a<4; a++) if(co[a] > 4) co[a] -= 8;
}
else if(euclid && WDIM == 3) {
auto tab = euclid3::getcoord(euclid3::get_ispacemap()[c->master]);
for(int a=0; a<3; a++) co[a] = tab[a];
if(PURE) for(int a=0; a<3; a++) co[a] *= 2;
dim = 3;
}
#endif
else if(masterless && !quotient) {
dim = 2;
tie(co[0], co[1]) = vec_to_pair(decodeId(c->master));
if(PURE) {
co[0] *= 2;
co[1] *= 2;
}
}
color_t res = 0;
coord ico = roundcoord(co);
int ones = 0;
for(int i=0; i<4; i++) if((ico[i] & 2) == 2) ones++;
switch(whichCanvas) {
case 'K':
for(int i=0; i<3; i++) for(int i=0; i<3; i++)
res |= ((int)(((i == 2 && S7 == 5) ? (128 + co[i] * 50) : (255&int(128 + co[i] * 25))))) << (8*i); res |= ((int)(((i == 2 && S7 == 5) ? (128 + co[i] * 50) : (255&int(128 + co[i] * 25))))) << (8*i);
return res; return res;
case '=':
if(ico[dim-1] == 2 && (ones & 1)) return 0x1C0FFC0;
if(ico[dim-1] == 2 && !(ones & 1)) return 0x180FF80;
if(ico[dim-1] == -2 && (ones & 1)) return 0x1C0C0FF;
if(ico[dim-1] == -2 && !(ones & 1)) return 0x18080FF;
return 0x101010;
case '#': {
bool grid = false;
ico[dim-1] -= 2;
for(int d=dim; d<MAXDIM; d++) ico[d] = 0;
if(ico == c0) println(hlog, "ico = ", ico, " co = ", co);
for(int i=0; i<dim; i++) if((ico[i] & 6) == 4) grid = true;
for(int i=0; i<3; i++) part(res, i) = 0xFF + 0x18 * (ico[i]/2-2);
if(grid) res |= 0x1000000;
else if(GDIM == 2) res = (res & 0xFEFEFE) >> 1;
if(ico == c0) res = 0x1FFD500;
return res;
}
case 'O': {
for(int i=0; i<3; i++) part(res, i) = 0xFF + 0x18 * (ico[i]/2-2);
c->landparam = res;
if(ones == dim-1) res |= 0x1000000;
else if(GDIM == 2) res = (res & 0xFEFEFE) >> 1;
return res;
}
}
return res;
} }
EX colortable coordcolors = {0xD04040, 0x40D040, 0x4040D0, 0xFFD500, 0xF000F0, 0x00F0F0, 0xF0F0F0 }; EX colortable coordcolors = {0xD04040, 0x40D040, 0x4040D0, 0xFFD500, 0xF000F0, 0x00F0F0, 0xF0F0F0 };

View File

@ -1540,8 +1540,8 @@ EX namespace patterns {
if(i != -1) return i; if(i != -1) return i;
switch(whichCanvas) { switch(whichCanvas) {
#if CAP_CRYSTAL #if CAP_CRYSTAL
case 'K': case 'K': case '#': case '=': case 'O':
return crystal::colorize(c); return crystal::colorize(c, whichCanvas);
#endif #endif
case 'A': case 'A':
#if CAP_ARCM #if CAP_ARCM
@ -1698,6 +1698,12 @@ EX namespace patterns {
if(cryst) if(cryst)
dialog::addSelItem(XLAT("Crystal coordinates"), "Crystal", 'K'); dialog::addSelItem(XLAT("Crystal coordinates"), "Crystal", 'K');
if(cryst || geometry == gSpace344) {
dialog::addSelItem(XLAT("Cage"), "Crystal", '#');
dialog::addSelItem(XLAT("Hyperplanes"), "Crystal", '=');
dialog::addSelItem(XLAT("Honeycomb"), "Crystal", 'O');
}
dialog::addSelItem(XLAT("sides"), "sides", 'B'); dialog::addSelItem(XLAT("sides"), "sides", 'B');
if(!ISMOBILE) if(!ISMOBILE)