1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-19 11:44:48 +00:00

ccolor:: live_canvas feature

This commit is contained in:
Zeno Rogue 2024-05-27 13:37:18 +02:00
parent 4f761c70cb
commit bfacda7207
3 changed files with 12 additions and 13 deletions

View File

@ -3293,6 +3293,8 @@ EX int config3 = addHook(hooks_configfile, 100, [] {
});
param_ccolor(ccolor::which, "pattern");
param_b(ccolor::live_canvas, "live_canvas")
-> editable("apply color/pattern changes to canvas automatically", 'l');
param_str(ccolor::color_formula, "color_formula");
});
@ -3383,19 +3385,7 @@ EX void showCustomizeChar() {
};
}
EX void refresh_canvas() {
manual_celllister cl;
cl.add(cwt.at);
int at = 0;
while(at < isize(cl.lst)) {
cell *c2 = cl.lst[at];
c2->landparam = ccolor::generateCanvas(c2);
at++;
forCellEx(c3, c2) cl.add(c3);
}
}
EX void refresh_canvas() { ccolor::live_canvas = true; }
EX color_t addalpha(color_t c) { return (c << 8) | 0xFF; }
@ -3489,6 +3479,8 @@ EX void show_color_dialog() {
dialog::addItem(XLAT("unreversed colors"), 'U');
dialog::add_action_push([] { edit_color_table(ccolor::shape.ctab, refresh_canvas, true); });
}
add_edit(ccolor::live_canvas);
}
if(cwt.at->land == laMinefield) {

View File

@ -744,6 +744,12 @@ EX void checkTide(cell *c) {
else if(c->wall == waMagma) c->wall = waNone;
}
#endif
if(c->land == laCanvas && ccolor::live_canvas) {
color_t col = ccolor::generateCanvas(c);
c->landparam = col;
c->wall = canvas_default_wall;
if(col & 0x1000000) c->wall = waWaxWall;
}
}
EX bool makeNoMonster(cell *c) {

View File

@ -1565,6 +1565,7 @@ EX namespace ccolor {
EX int jhole = 0;
EX int jblock = 0;
EX int rwalls = 50;
EX bool live_canvas;
EX void edit_rwalls() {
dialog::editNumber(rwalls, 0, 100, 10, 50, XLAT("probability of a wall (%)"), "");