mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-12 10:20:32 +00:00
redone the canvas coloring system
This commit is contained in:
parent
b8a7e6e093
commit
ce825db2c0
@ -220,8 +220,7 @@ void ensure_geometry(eGeometryClass c) {
|
|||||||
|
|
||||||
if(specialland != laCanvas) {
|
if(specialland != laCanvas) {
|
||||||
canvas_default_wall = waInvisibleFloor;
|
canvas_default_wall = waInvisibleFloor;
|
||||||
patterns::whichCanvas = 'g';
|
ccolor::set_plain(0xFFFFFF);
|
||||||
patterns::canvasback = 0xFFFFFF;
|
|
||||||
enable_canvas();
|
enable_canvas();
|
||||||
}
|
}
|
||||||
start_game();
|
start_game();
|
||||||
@ -1283,7 +1282,7 @@ void connection_debugger() {
|
|||||||
|
|
||||||
curvepoint(sh[0]);
|
curvepoint(sh[0]);
|
||||||
|
|
||||||
color_t col = colortables['A'][id];
|
color_t col = ccolor::shape.ctab[id];
|
||||||
col = darkena(col, 0, 0xFF);
|
col = darkena(col, 0, 0xFF);
|
||||||
|
|
||||||
if(&p == &last) {
|
if(&p == &last) {
|
||||||
|
@ -1340,11 +1340,12 @@ EX void enable(archimedean_tiling& arct) {
|
|||||||
start_game();
|
start_game();
|
||||||
}
|
}
|
||||||
|
|
||||||
function<void()> setcanvas(char c) {
|
function<void()> setcanvas(ccolor::data& c) {
|
||||||
return [c] () {
|
auto pc = &c;
|
||||||
|
return [pc] () {
|
||||||
stop_game();
|
stop_game();
|
||||||
enable_canvas();
|
enable_canvas();
|
||||||
patterns::whichCanvas = c;
|
ccolor::which = pc;
|
||||||
start_game();
|
start_game();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -1467,9 +1468,9 @@ EX void show() {
|
|||||||
dialog::addSelItem(XLAT("edge length"), current.get_class() == gcEuclid ? (fts(current.edgelength) + XLAT(" (arbitrary)")) : fts(current.edgelength), 0);
|
dialog::addSelItem(XLAT("edge length"), current.get_class() == gcEuclid ? (fts(current.edgelength) + XLAT(" (arbitrary)")) : fts(current.edgelength), 0);
|
||||||
|
|
||||||
dialog::addItem(XLAT("color by symmetries"), 't');
|
dialog::addItem(XLAT("color by symmetries"), 't');
|
||||||
dialog::add_action(setcanvas('A'));
|
dialog::add_action(setcanvas(ccolor::shape));
|
||||||
dialog::addItem(XLAT("color by symmetries (reversed tiles marked)"), 'r');
|
dialog::addItem(XLAT("color by symmetries (reversed tiles marked)"), 'r');
|
||||||
dialog::add_action(setcanvas('R'));
|
dialog::add_action(setcanvas(ccolor::shape_mirror));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dialog::addBreak(100);
|
dialog::addBreak(100);
|
||||||
@ -1479,20 +1480,20 @@ EX void show() {
|
|||||||
|
|
||||||
if(true) {
|
if(true) {
|
||||||
dialog::addItem(XLAT("color by sides"), 'u');
|
dialog::addItem(XLAT("color by sides"), 'u');
|
||||||
dialog::add_action(setcanvas('B'));
|
dialog::add_action(setcanvas(ccolor::sides));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(geosupport_threecolor() == 2) {
|
if(geosupport_threecolor() == 2) {
|
||||||
dialog::addItem(XLAT("three colors"), 'w');
|
dialog::addItem(XLAT("three colors"), 'w');
|
||||||
dialog::add_action(setcanvas('T'));
|
dialog::add_action(setcanvas(ccolor::threecolor));
|
||||||
}
|
}
|
||||||
else if(geosupport_football() == 2) {
|
else if(geosupport_football() == 2) {
|
||||||
dialog::addItem(XLAT("football"), 'w');
|
dialog::addItem(XLAT("football"), 'w');
|
||||||
dialog::add_action(setcanvas('F'));
|
dialog::add_action(setcanvas(ccolor::football));
|
||||||
}
|
}
|
||||||
else if(geosupport_chessboard()) {
|
else if(geosupport_chessboard()) {
|
||||||
dialog::addItem(XLAT("chessboard"), 'w');
|
dialog::addItem(XLAT("chessboard"), 'w');
|
||||||
dialog::add_action(setcanvas('c'));
|
dialog::add_action(setcanvas(ccolor::chessboard));
|
||||||
}
|
}
|
||||||
else dialog::addBreak(100);
|
else dialog::addBreak(100);
|
||||||
|
|
||||||
|
22
config.cpp
22
config.cpp
@ -1050,8 +1050,8 @@ EX void initConfig() {
|
|||||||
param_f(linepatterns::tree_starter, "tree_starter")
|
param_f(linepatterns::tree_starter, "tree_starter")
|
||||||
-> editable(0, 1, 0.05, "tree-drawing parameter", "How much of edges to draw for tree patterns (to show how the tree edges are oriented).", 't');
|
-> editable(0, 1, 0.05, "tree-drawing parameter", "How much of edges to draw for tree patterns (to show how the tree edges are oriented).", 't');
|
||||||
|
|
||||||
param_char(patterns::whichCanvas, "whichCanvas", 0);
|
// param_char(patterns::whichCanvas, "whichCanvas", 0); %TODO
|
||||||
param_i(patterns::rwalls, "randomwalls");
|
param_i(ccolor::rwalls, "randomwalls");
|
||||||
|
|
||||||
param_b(vid.grid, "grid");
|
param_b(vid.grid, "grid");
|
||||||
param_b(models::desitter_projections, "desitter_projections", false);
|
param_b(models::desitter_projections, "desitter_projections", false);
|
||||||
@ -1347,7 +1347,7 @@ EX void initConfig() {
|
|||||||
->set_extra(draw_crosshair);
|
->set_extra(draw_crosshair);
|
||||||
|
|
||||||
param_b(mapeditor::drawplayer, "drawplayer");
|
param_b(mapeditor::drawplayer, "drawplayer");
|
||||||
param_color((color_t&) patterns::canvasback, "color:canvasback", false);
|
param_color((color_t&) ccolor::plain.ctab[0], "color:canvasback", false);
|
||||||
|
|
||||||
param_color(backcolor, "color:background", false);
|
param_color(backcolor, "color:background", false);
|
||||||
param_color(forecolor, "color:foreground", false);
|
param_color(forecolor, "color:foreground", false);
|
||||||
@ -1359,8 +1359,8 @@ EX void initConfig() {
|
|||||||
param_color(stdgridcolor, "color:stdgrid", true);
|
param_color(stdgridcolor, "color:stdgrid", true);
|
||||||
param_f(vid.multiplier_grid, "mgrid", "mult:grid", 1);
|
param_f(vid.multiplier_grid, "mgrid", "mult:grid", 1);
|
||||||
param_color(dialog::dialogcolor, "color:dialog", false);
|
param_color(dialog::dialogcolor, "color:dialog", false);
|
||||||
for(auto& p: colortables)
|
for(auto p: ccolor::all)
|
||||||
savecolortable(p.second, s0+"canvas"+p.first);
|
savecolortable(p->ctab, s0+"canvas:"+p->name);
|
||||||
savecolortable(distcolors, "distance");
|
savecolortable(distcolors, "distance");
|
||||||
savecolortable(minecolors, "mines");
|
savecolortable(minecolors, "mines");
|
||||||
#if CAP_COMPLEX2
|
#if CAP_COMPLEX2
|
||||||
@ -3456,7 +3456,7 @@ EX void refresh_canvas() {
|
|||||||
int at = 0;
|
int at = 0;
|
||||||
while(at < isize(cl.lst)) {
|
while(at < isize(cl.lst)) {
|
||||||
cell *c2 = cl.lst[at];
|
cell *c2 = cl.lst[at];
|
||||||
c2->landparam = patterns::generateCanvas(c2);
|
c2->landparam = ccolor::generateCanvas(c2);
|
||||||
at++;
|
at++;
|
||||||
|
|
||||||
forCellEx(c3, c2) cl.add(c3);
|
forCellEx(c3, c2) cl.add(c3);
|
||||||
@ -3547,13 +3547,13 @@ EX void show_color_dialog() {
|
|||||||
dialog::add_action([] () { dialog::openColorDialog(dialog::dialogcolor); dialog::colorAlpha = false; dialog::get_di().dialogflags |= sm::SIDE; });
|
dialog::add_action([] () { dialog::openColorDialog(dialog::dialogcolor); dialog::colorAlpha = false; dialog::get_di().dialogflags |= sm::SIDE; });
|
||||||
|
|
||||||
dialog::addBreak(50);
|
dialog::addBreak(50);
|
||||||
if(specialland == laCanvas && colortables.count(patterns::whichCanvas)) {
|
if(specialland == laCanvas && ccolor::which->ctab.size()) {
|
||||||
dialog::addItem(XLAT("pattern colors"), 'P');
|
dialog::addItem(XLAT("pattern colors"), 'P');
|
||||||
dialog::add_action_push([] { edit_color_table(colortables[patterns::whichCanvas], refresh_canvas, true); });
|
dialog::add_action_push([] { edit_color_table(ccolor::which->ctab, refresh_canvas, true); });
|
||||||
|
|
||||||
if(patterns::whichCanvas == 'R') {
|
if(ccolor::which == &ccolor::shape_mirror) {
|
||||||
dialog::addItem(XLAT("unreversed colors"), 'U');
|
dialog::addItem(XLAT("unreversed colors"), 'U');
|
||||||
dialog::add_action_push([] { edit_color_table(colortables['A'], refresh_canvas, true); });
|
dialog::add_action_push([] { edit_color_table(ccolor::shape.ctab, refresh_canvas, true); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3970,7 +3970,7 @@ EX int read_color_args() {
|
|||||||
PHASEFROM(2); shift(); modelcolor = argcolor(32);
|
PHASEFROM(2); shift(); modelcolor = argcolor(32);
|
||||||
}
|
}
|
||||||
else if(argis("-apeirocolor")) {
|
else if(argis("-apeirocolor")) {
|
||||||
PHASEFROM(2); shift(); patterns::apeirogonal_color = argcolor(32);
|
PHASEFROM(2); shift(); ccolor::apeirogonal_color = argcolor(32);
|
||||||
}
|
}
|
||||||
else if(argis("-ring")) {
|
else if(argis("-ring")) {
|
||||||
PHASEFROM(2); shift(); ringcolor = argcolor(32);
|
PHASEFROM(2); shift(); ringcolor = argcolor(32);
|
||||||
|
@ -1113,7 +1113,7 @@ EX void showEuclideanMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialog::addBoolItem(XLAT("pattern"), specialland == laCanvas, 'p');
|
dialog::addBoolItem(XLAT("pattern"), specialland == laCanvas, 'p');
|
||||||
if(specialland == laCanvas) dialog::lastItem().value = patterns::whichCanvas;
|
if(specialland == laCanvas) dialog::lastItem().value = ccolor::which->name;
|
||||||
dialog::add_action_push(patterns::showPrePattern);
|
dialog::add_action_push(patterns::showPrePattern);
|
||||||
validity_info();
|
validity_info();
|
||||||
if(WDIM == 3) {
|
if(WDIM == 3) {
|
||||||
|
@ -3066,7 +3066,7 @@ EX void setdist(cell *c, int d, cell *from) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(d == BARLEV && c->land == laCanvas) {
|
if(d == BARLEV && c->land == laCanvas) {
|
||||||
color_t col = patterns::generateCanvas(c);
|
color_t col = ccolor::generateCanvas(c);
|
||||||
c->landparam = col;
|
c->landparam = col;
|
||||||
c->wall = canvas_default_wall;
|
c->wall = canvas_default_wall;
|
||||||
if((GDIM == 3 || geom3::flipped) && (col & 0x1000000)) c->wall = waWaxWall;
|
if((GDIM == 3 || geom3::flipped) && (col & 0x1000000)) c->wall = waWaxWall;
|
||||||
|
@ -746,14 +746,16 @@ EX namespace mapstream {
|
|||||||
f.write(gen_wandering);
|
f.write(gen_wandering);
|
||||||
f.write(reptilecheat);
|
f.write(reptilecheat);
|
||||||
f.write(timerghost);
|
f.write(timerghost);
|
||||||
f.write(patterns::canvasback);
|
f.write(ccolor::plain.ctab[0]);
|
||||||
f.write(patterns::whichShape);
|
f.write(patterns::whichShape);
|
||||||
f.write(patterns::subpattern_flags);
|
f.write(patterns::subpattern_flags);
|
||||||
f.write(patterns::whichCanvas);
|
char wc = '*';
|
||||||
|
f.write(wc);
|
||||||
|
f.write(ccolor::which->name);
|
||||||
f.write(patterns::displaycodes);
|
f.write(patterns::displaycodes);
|
||||||
f.write(canvas_default_wall);
|
f.write(canvas_default_wall);
|
||||||
f.write(mapeditor::drawplayer);
|
f.write(mapeditor::drawplayer);
|
||||||
if(patterns::whichCanvas == 'f') f.write(patterns::color_formula);
|
if(ccolor::which == &ccolor::formula) f.write(ccolor::color_formula);
|
||||||
f.write(canvasfloor);
|
f.write(canvasfloor);
|
||||||
f.write(canvasdark);
|
f.write(canvasdark);
|
||||||
|
|
||||||
@ -946,15 +948,21 @@ EX namespace mapstream {
|
|||||||
f.read(gen_wandering);
|
f.read(gen_wandering);
|
||||||
f.read(reptilecheat);
|
f.read(reptilecheat);
|
||||||
f.read(timerghost);
|
f.read(timerghost);
|
||||||
f.read(patterns::canvasback);
|
f.read(ccolor::plain.ctab[0]);
|
||||||
f.read(patterns::whichShape);
|
f.read(patterns::whichShape);
|
||||||
f.read(patterns::subpattern_flags);
|
f.read(patterns::subpattern_flags);
|
||||||
f.read(patterns::whichCanvas);
|
char wc;
|
||||||
|
f.read(wc);
|
||||||
|
if(wc == '*') {
|
||||||
|
string name;
|
||||||
|
f.read(name);
|
||||||
|
for(auto& p: ccolor::all) if(p->name == name) ccolor::which = p;
|
||||||
|
}
|
||||||
f.read(patterns::displaycodes);
|
f.read(patterns::displaycodes);
|
||||||
if(f.vernum >= 0xA816)
|
if(f.vernum >= 0xA816)
|
||||||
f.read(canvas_default_wall);
|
f.read(canvas_default_wall);
|
||||||
f.read(mapeditor::drawplayer);
|
f.read(mapeditor::drawplayer);
|
||||||
if(patterns::whichCanvas == 'f') f.read(patterns::color_formula);
|
if(wc == 'f') f.read(ccolor::color_formula);
|
||||||
if(f.vernum >= 0xA90D) {
|
if(f.vernum >= 0xA90D) {
|
||||||
f.read(canvasfloor);
|
f.read(canvasfloor);
|
||||||
f.read(canvasdark);
|
f.read(canvasdark);
|
||||||
@ -2744,8 +2752,7 @@ EX namespace mapeditor {
|
|||||||
stop_game();
|
stop_game();
|
||||||
enable_canvas();
|
enable_canvas();
|
||||||
canvas_default_wall = waInvisibleFloor;
|
canvas_default_wall = waInvisibleFloor;
|
||||||
patterns::whichCanvas = 'g';
|
ccolor::set_plain(0xFFFFFF);
|
||||||
patterns::canvasback = 0xFFFFFF;
|
|
||||||
dtcolor = (forecolor << 8) | 255;
|
dtcolor = (forecolor << 8) | 255;
|
||||||
drawplayer = false;
|
drawplayer = false;
|
||||||
vid.use_smart_range = 2;
|
vid.use_smart_range = 2;
|
||||||
|
@ -1012,7 +1012,7 @@ EX void showStartMenu() {
|
|||||||
stop_game();
|
stop_game();
|
||||||
enable_canvas();
|
enable_canvas();
|
||||||
cheater = true;
|
cheater = true;
|
||||||
patterns::canvasback = 0xFFFFFF;
|
ccolor::set_plain(0xFFFFFF);
|
||||||
mapeditor::drawplayer = false;
|
mapeditor::drawplayer = false;
|
||||||
start_game();
|
start_game();
|
||||||
clearMessages();
|
clearMessages();
|
||||||
|
@ -78,7 +78,7 @@ void gamedata_all(gamedata& gd) {
|
|||||||
gd.store(genrange_bonus);
|
gd.store(genrange_bonus);
|
||||||
gd.store(gamerange_bonus);
|
gd.store(gamerange_bonus);
|
||||||
gd.store(targets);
|
gd.store(targets);
|
||||||
gd.store(patterns::rwalls);
|
gd.store(ccolor::rwalls);
|
||||||
if(GOLDBERG) gd.store(gp::param);
|
if(GOLDBERG) gd.store(gp::param);
|
||||||
callhooks(hooks_gamedata, &gd);
|
callhooks(hooks_gamedata, &gd);
|
||||||
}
|
}
|
||||||
|
928
pattern2.cpp
928
pattern2.cpp
File diff suppressed because it is too large
Load Diff
@ -1329,14 +1329,13 @@ EX void showMenu() {
|
|||||||
|
|
||||||
dialog::addBoolItem(XLATN("Canvas"), specialland == laCanvas, 'X');
|
dialog::addBoolItem(XLATN("Canvas"), specialland == laCanvas, 'X');
|
||||||
dialog::add_action([] () {
|
dialog::add_action([] () {
|
||||||
bool inwhite = specialland == laCanvas && patterns::whichCanvas == 'g' && patterns::canvasback == 0xFFFFFF;
|
bool inwhite = specialland == laCanvas && ccolor::which == &ccolor::plain && ccolor::plain.ctab.size() == 1 && ccolor::plain.ctab[0] == 0xFFFFFF;
|
||||||
if(inwhite)
|
if(inwhite)
|
||||||
pushScreen(patterns::showPrePattern);
|
pushScreen(patterns::showPrePattern);
|
||||||
else {
|
else {
|
||||||
stop_game();
|
stop_game();
|
||||||
enable_canvas();
|
enable_canvas();
|
||||||
patterns::whichCanvas = 'g';
|
ccolor::set_plain(0xFFFFFF);
|
||||||
patterns::canvasback = 0xFFFFFF;
|
|
||||||
start_game();
|
start_game();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
18
tour.cpp
18
tour.cpp
@ -110,8 +110,8 @@ EX void slide_action(presmode mode, char key, string text, reaction_t act) {
|
|||||||
help_extensions.push_back(help_extension{key, text, act});
|
help_extensions.push_back(help_extension{key, text, act});
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void enable_canvas_backup(char canv) {
|
EX void enable_canvas_backup(ccolor::data *canv) {
|
||||||
slide_backup(patterns::whichCanvas, canv);
|
slide_backup(ccolor::which, canv);
|
||||||
slide_backup(firstland, laCanvas);
|
slide_backup(firstland, laCanvas);
|
||||||
slide_backup(specialland, laCanvas);
|
slide_backup(specialland, laCanvas);
|
||||||
slide_backup(land_structure);
|
slide_backup(land_structure);
|
||||||
@ -120,7 +120,7 @@ EX void enable_canvas_backup(char canv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** \brief an auxiliary function to enable a visualization in the Canvas land */
|
/** \brief an auxiliary function to enable a visualization in the Canvas land */
|
||||||
EX void setCanvas(presmode mode, char canv) {
|
EX void setCanvas(presmode mode, ccolor::data *canv) {
|
||||||
if(mode == pmStart) {
|
if(mode == pmStart) {
|
||||||
gamestack::push();
|
gamestack::push();
|
||||||
enable_canvas_backup(canv);
|
enable_canvas_backup(canv);
|
||||||
@ -133,6 +133,10 @@ EX void setCanvas(presmode mode, char canv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX void setCanvas(presmode mode, char c) {
|
||||||
|
setCanvas(mode, ccolor::legacy(c));
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief static mode: we get Orbs of Teleport to use them instead of movement */
|
/** \brief static mode: we get Orbs of Teleport to use them instead of movement */
|
||||||
bool sickmode;
|
bool sickmode;
|
||||||
|
|
||||||
@ -638,7 +642,7 @@ EX slide default_slides[] = {
|
|||||||
"The world of HyperRogue is tiled with hexagons "
|
"The world of HyperRogue is tiled with hexagons "
|
||||||
"and heptagons; heptagons give extra space!\n\n",
|
"and heptagons; heptagons give extra space!\n\n",
|
||||||
[] (presmode mode) {
|
[] (presmode mode) {
|
||||||
setCanvas(mode, 'F');
|
setCanvas(mode, &ccolor::football);
|
||||||
if(mode == 5) {
|
if(mode == 5) {
|
||||||
cwt.at->move(0)->monst = moRunDog;
|
cwt.at->move(0)->monst = moRunDog;
|
||||||
cwt.at->move(1)->monst = moGoblin;
|
cwt.at->move(1)->monst = moGoblin;
|
||||||
@ -700,7 +704,7 @@ EX slide default_slides[] = {
|
|||||||
"running away in a straight line. "
|
"running away in a straight line. "
|
||||||
"Press '2' to try the same in the Euclidean world -- it is impossible.",
|
"Press '2' to try the same in the Euclidean world -- it is impossible.",
|
||||||
[] (presmode mode) {
|
[] (presmode mode) {
|
||||||
setCanvas(mode, 'F');
|
setCanvas(mode, &ccolor::football);
|
||||||
if(mode == 5) {
|
if(mode == 5) {
|
||||||
cwt.at->move(0)->monst = moRunDog;
|
cwt.at->move(0)->monst = moRunDog;
|
||||||
cwt.at->move(1)->monst = moGoblin;
|
cwt.at->move(1)->monst = moGoblin;
|
||||||
@ -861,7 +865,7 @@ EX slide default_slides[] = {
|
|||||||
"Hyperbolic geometry yields much more interesting periodic patterns "
|
"Hyperbolic geometry yields much more interesting periodic patterns "
|
||||||
"than Euclidean.",
|
"than Euclidean.",
|
||||||
[] (presmode mode) {
|
[] (presmode mode) {
|
||||||
setCanvas(mode, 't');
|
setCanvas(mode, &ccolor::zebra_stripes);
|
||||||
if(mode == 1)
|
if(mode == 1)
|
||||||
patterns::displaycodes = true,
|
patterns::displaycodes = true,
|
||||||
patterns::whichPattern = patterns::PAT_ZEBRA;
|
patterns::whichPattern = patterns::PAT_ZEBRA;
|
||||||
@ -895,7 +899,7 @@ EX slide default_slides[] = {
|
|||||||
"On the following slide, the colors change smoothly in the whole infinite world. "
|
"On the following slide, the colors change smoothly in the whole infinite world. "
|
||||||
"Again, this works better than in Euclidean geometry.",
|
"Again, this works better than in Euclidean geometry.",
|
||||||
[] (presmode mode) {
|
[] (presmode mode) {
|
||||||
setCanvas(mode, 'l');
|
setCanvas(mode, &ccolor::landscape);
|
||||||
SHOWLAND ( l == laCanvas );
|
SHOWLAND ( l == laCanvas );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user