mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 09:00:34 +00:00
Penrose staircase pattern in Nil, and diagonal pattern in Crystal
This commit is contained in:
parent
85a08d205d
commit
72e6859dd5
@ -687,6 +687,11 @@ EX color_t colorize(cell *c, char whichCanvas) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case '/': {
|
||||||
|
int s = ico[1] + ico[2] + ico[3] + ico[0];
|
||||||
|
if(s > 0) return 0x1FF20FF;
|
||||||
|
else if (s < -2) return 0x1C0C0C0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -774,6 +774,7 @@ EX namespace nilv {
|
|||||||
{ point31(0,0,0.5), point31(-0.5,0.5,0.25), point31(-0.5,-0.5,0.75), point31(0,0,0.5), point31(-0.5,-0.5,0.75), point31(-0.5,-0.5,0.5), point31(0,0,0.5), point31(-0.5,-0.5,0.5), point31(0.5,-0.5,0.5), point31(0,0,0.5), point31(0.5,-0.5,0.5), point31(0.5,-0.5,0.25), point31(0,0,0.5), point31(0.5,-0.5,0.25), point31(0.5,0.5,0.75), point31(0,0,0.5), point31(0.5,0.5,0.75), point31(0.5,0.5,0.5), point31(0,0,0.5), point31(0.5,0.5,0.5), point31(-0.5,0.5,0.5), point31(0,0,0.5), point31(-0.5,0.5,0.5), point31(-0.5,0.5,0.25), },
|
{ point31(0,0,0.5), point31(-0.5,0.5,0.25), point31(-0.5,-0.5,0.75), point31(0,0,0.5), point31(-0.5,-0.5,0.75), point31(-0.5,-0.5,0.5), point31(0,0,0.5), point31(-0.5,-0.5,0.5), point31(0.5,-0.5,0.5), point31(0,0,0.5), point31(0.5,-0.5,0.5), point31(0.5,-0.5,0.25), point31(0,0,0.5), point31(0.5,-0.5,0.25), point31(0.5,0.5,0.75), point31(0,0,0.5), point31(0.5,0.5,0.75), point31(0.5,0.5,0.5), point31(0,0,0.5), point31(0.5,0.5,0.5), point31(-0.5,0.5,0.5), point31(0,0,0.5), point31(-0.5,0.5,0.5), point31(-0.5,0.5,0.25), },
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
EX int zgmod(int a, int b) { return b ? a%b : a; }
|
||||||
|
|
||||||
array<int,3> nilperiod, nilperiod_edit;
|
array<int,3> nilperiod, nilperiod_edit;
|
||||||
|
|
||||||
@ -805,7 +806,7 @@ EX namespace nilv {
|
|||||||
heptagon *create_step(heptagon *parent, int d) override {
|
heptagon *create_step(heptagon *parent, int d) override {
|
||||||
auto p = coords[parent];
|
auto p = coords[parent];
|
||||||
auto q = p * movevectors[d];
|
auto q = p * movevectors[d];
|
||||||
for(int a=0; a<3; a++) if(nilperiod[a]) q[a] = gmod(q[a], nilperiod[a]);
|
for(int a=0; a<3; a++) q[a] = zgmod(q[a], nilperiod[a]);
|
||||||
auto child = get_at(q);
|
auto child = get_at(q);
|
||||||
parent->c.connect(d, child, (d + nilv_S7/2) % nilv_S7, false);
|
parent->c.connect(d, child, (d + nilv_S7/2) % nilv_S7, false);
|
||||||
return child;
|
return child;
|
||||||
@ -857,6 +858,27 @@ EX namespace nilv {
|
|||||||
return nisot::translate(s0) * formula_exp(h * x);
|
return nisot::translate(s0) * formula_exp(h * x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX color_t colorize(cell *c, char whichCanvas) {
|
||||||
|
mvec at = ((hrmap_nil*)currentmap)->coords[c->master];
|
||||||
|
color_t res = 0;
|
||||||
|
|
||||||
|
auto setres = [&] (int z, color_t which) {
|
||||||
|
if(zgmod(at[2] - z, nilperiod[2]) == 0) res = which;
|
||||||
|
if(zgmod(at[2] - z-1, nilperiod[2]) == 0) res = which;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(at[1] == 0 && at[0] >=0 && at[0] < 4)
|
||||||
|
setres(-at[0], gradient(0x1FF0000, 0x10000FF, 0, at[0], 4));
|
||||||
|
else if(at[0] == 4 && at[1] >= 0 && at[1] < 4)
|
||||||
|
setres(at[1]*3-4, gradient(0x10000FF, 0x100FF00, 0, at[1], 4));
|
||||||
|
else if(at[1] == 4 && at[0] >= 0 && at[0] <= 4)
|
||||||
|
setres(4+at[0], gradient(0x100FF00, 0x1FFFF00, 4, at[0], 0));
|
||||||
|
else if(at[0] == 0 && at[1] >= 0 && at[1] <= 4)
|
||||||
|
setres(at[1], gradient(0x1FFFF00, 0x1FF0000, 4, at[1], 0));
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
EX void prepare_niltorus3() {
|
EX void prepare_niltorus3() {
|
||||||
nilperiod_edit = nilperiod;
|
nilperiod_edit = nilperiod;
|
||||||
}
|
}
|
||||||
|
@ -1540,7 +1540,10 @@ 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 '#': case '=': case 'O':
|
case 'K': case '#': case '=': case 'O': case '/':
|
||||||
|
if(nil)
|
||||||
|
return nilv::colorize(c, whichCanvas);
|
||||||
|
else
|
||||||
return crystal::colorize(c, whichCanvas);
|
return crystal::colorize(c, whichCanvas);
|
||||||
#endif
|
#endif
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -1702,6 +1705,10 @@ EX namespace patterns {
|
|||||||
dialog::addSelItem(XLAT("Cage"), "Crystal", '#');
|
dialog::addSelItem(XLAT("Cage"), "Crystal", '#');
|
||||||
dialog::addSelItem(XLAT("Hyperplanes"), "Crystal", '=');
|
dialog::addSelItem(XLAT("Hyperplanes"), "Crystal", '=');
|
||||||
dialog::addSelItem(XLAT("Honeycomb"), "Crystal", 'O');
|
dialog::addSelItem(XLAT("Honeycomb"), "Crystal", 'O');
|
||||||
|
dialog::addSelItem(XLAT("Diagonal"), "Crystal", '/');
|
||||||
|
}
|
||||||
|
if(nil) {
|
||||||
|
dialog::addSelItem(XLAT("Penrose staircase"), "Nil", '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog::addSelItem(XLAT("sides"), "sides", 'B');
|
dialog::addSelItem(XLAT("sides"), "sides", 'B');
|
||||||
|
Loading…
Reference in New Issue
Block a user