mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 09:50:34 +00:00
in 3D geometries, patterns may create walls
This commit is contained in:
parent
f0ca277b10
commit
9850dd557e
16
config.cpp
16
config.cpp
@ -1872,14 +1872,24 @@ EX void refresh_canvas() {
|
||||
}
|
||||
}
|
||||
|
||||
EX void edit_color_table(colortable& ct, const reaction_t& r IS(reaction_t())) {
|
||||
EX void edit_color_table(colortable& ct, const reaction_t& r IS(reaction_t()), bool has_bit IS(false)) {
|
||||
cmode = sm::SIDE;
|
||||
gamescreen(0);
|
||||
dialog::init(XLAT("colors & aura"));
|
||||
|
||||
for(int i=0; i<isize(ct); i++) {
|
||||
dialog::addColorItem(its(i), ct[i] << 8, 'a'+i);
|
||||
dialog::add_action([i, &ct, r] () { dialog::openColorDialog(ct[i]); dialog::reaction = r; dialog::colorAlpha = false; dialog::dialogflags |= sm::SIDE; });
|
||||
if(WDIM == 3 && has_bit && !(ct[i] & 0x1000000)) dialog::lastItem().value = XLAT("(no wall)");
|
||||
dialog::add_action([i, &ct, r, has_bit] () {
|
||||
if(WDIM == 3 && has_bit) {
|
||||
ct[i] ^= 0x1000000;
|
||||
if(!(ct[i] & 0x1000000)) return;
|
||||
}
|
||||
dialog::openColorDialog(ct[i]);
|
||||
dialog::reaction = r;
|
||||
dialog::colorAlpha = false;
|
||||
dialog::dialogflags |= sm::SIDE;
|
||||
});
|
||||
}
|
||||
|
||||
dialog::addBack();
|
||||
@ -1929,7 +1939,7 @@ EX void show_color_dialog() {
|
||||
dialog::addBreak(50);
|
||||
if(specialland == laCanvas && colortables.count(patterns::whichCanvas)) {
|
||||
dialog::addItem(XLAT("pattern colors"), 'P');
|
||||
dialog::add_action_push([] { edit_color_table(colortables[patterns::whichCanvas], refresh_canvas); });
|
||||
dialog::add_action_push([] { edit_color_table(colortables[patterns::whichCanvas], refresh_canvas, true); });
|
||||
}
|
||||
|
||||
if(cwt.at->land == laMinefield) {
|
||||
|
@ -2663,9 +2663,11 @@ EX void setdist(cell *c, int d, cell *from) {
|
||||
}
|
||||
|
||||
if(d == BARLEV && c->land == laCanvas) {
|
||||
c->landparam = patterns::generateCanvas(c);
|
||||
color_t col = patterns::generateCanvas(c);
|
||||
c->landparam = col;
|
||||
if(canvas_invisible)
|
||||
c->wall = waInvisibleFloor;
|
||||
if(WDIM == 3 && (col & 0x1000000)) c->wall = waWaxWall;
|
||||
}
|
||||
|
||||
#if CAP_FIELD
|
||||
|
24
pattern2.cpp
24
pattern2.cpp
@ -1451,14 +1451,14 @@ EX map<char, colortable> colortables = {
|
||||
0x404040, 0x606060, 0x808080
|
||||
}},
|
||||
{'a', {0x800000, 0x503000, 0x206000, 0x007010, 0x004040, 0x001070, 0x200060, 0x500030}},
|
||||
{'e', {0x404040, 0x800000, 0x008000, 0x000080 }},
|
||||
{'b', {0x404040, 0x800000, 0x008000, 0x000080 }},
|
||||
{'z', {0xC0C0C0, 0xE0E0E0, 0x404040, 0x606060 }},
|
||||
{'x', {0xC0C0C0, 0x800000, 0x008000, 0x000080 }},
|
||||
{'t', {0x804040, 0x408040, 0x404080, 0x808040 }},
|
||||
{'c', {0x202020, 0xC0C0C0}},
|
||||
{'F', {0xC0C0C0, 0x202020}},
|
||||
{'w', {0x303030, 0xC0C0C0}},
|
||||
{'e', {0x404040, 0x1800000, 0x1008000, 0x000080 }},
|
||||
{'b', {0x404040, 0x1800000, 0x1008000, 0x000080 }},
|
||||
{'z', {0x1C0C0C0, 0x1E0E0E0, 0x404040, 0x606060 }},
|
||||
{'x', {0xC0C0C0, 0x1800000, 0x1008000, 0x000080 }},
|
||||
{'t', {0x804040, 0x1408040, 0x404080, 0x1808040 }},
|
||||
{'c', {0x202020, 0x1C0C0C0}},
|
||||
{'F', {0x1C0C0C0, 0x202020}},
|
||||
{'w', {0x303030, 0x1C0C0C0}},
|
||||
{'v', {0xC00000, 0xC08000, 0xC0C000, 0x00C000, 0xC0C0, 0x00C0, 0xC000C0}},
|
||||
};
|
||||
|
||||
@ -1475,7 +1475,9 @@ color_t random_landscape(cell *c, int mul, int div, int step, color_t base) {
|
||||
col[1] /= div;
|
||||
col[2] /= div;
|
||||
if(ISWEB) for(int a=0; a<3; a++) col[a] = (col[a] + step/2) / step * step;
|
||||
return (base + col[0] + (col[1] << 8) + (col[2] << 16));
|
||||
color_t res = base + col[0] + (col[1] << 8) + (col[2] << 16);
|
||||
if(WDIM == 3 && (getBits(c) & 1)) res |= 0x1000000;
|
||||
return res;
|
||||
}
|
||||
|
||||
EX namespace patterns {
|
||||
@ -1579,7 +1581,7 @@ EX namespace patterns {
|
||||
case 'g':
|
||||
return canvasback;
|
||||
case 'r':
|
||||
return hrand(0xFFFFFF + 1);
|
||||
return hrand(0x1FFFFFF + 1);
|
||||
case 'e':
|
||||
return colortables['e'][emeraldval(c)];
|
||||
case 'a': {
|
||||
@ -1637,7 +1639,7 @@ EX namespace patterns {
|
||||
gamescreen(0);
|
||||
|
||||
dialog::init("predesigned patterns");
|
||||
dialog::addItem(XLAT("single color"), 'g');
|
||||
dialog::addItem(WDIM == 3 ? XLAT("empty") : XLAT("single color"), 'g');
|
||||
dialog::addItem(XLAT("random colors"), 'r');
|
||||
dialog::addItem(XLAT("distance from origin"), 'M');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user