From a4ced4a5045c5e2b054b8dee2b6c558bbc9df97f Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 20 Aug 2018 15:49:17 +0200 Subject: [PATCH] color by sides; canvas coloring selectable from the texture menu --- archimedean.cpp | 14 ++++++++++++-- geom-exp.cpp | 2 +- pattern2.cpp | 24 ++++++++++++++++++++++-- textures.cpp | 14 ++++++++++++++ 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/archimedean.cpp b/archimedean.cpp index ed863c97..cdf2d356 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -844,13 +844,23 @@ void show() { }); if(archimedean) { - dialog::addItem(XLAT("colored tiling"), 't'); + dialog::addItem(XLAT("color by symmetries"), 't'); dialog::add_action([] () { - specialland = laCanvas; + firstland = specialland = laCanvas; patterns::whichCanvas = 'A'; restart_game(); }); } + else dialog::addBreak(100); + + if(true) { + dialog::addItem(XLAT("color by sides"), 'u'); + dialog::add_action([] () { + firstland = specialland = laCanvas; + patterns::whichCanvas = 'B'; + restart_game(); + }); + } } dialog::addHelp(); diff --git a/geom-exp.cpp b/geom-exp.cpp index b67debe6..900e8661 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -507,8 +507,8 @@ void showEuclideanMenu() { else if(lid >= 0 && lid < isize(landlist)) { eLand nland = landlist[lid]; if(landvisited[nland]) { - firstland = specialland = nland; stop_game_and_switch_mode(tactic::on ? rg::tactic : rg::nothing); + firstland = specialland = nland; start_game(); } } diff --git a/pattern2.cpp b/pattern2.cpp index 157adf55..096fa38a 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -1241,8 +1241,26 @@ namespace patterns { char whichCanvas = 0; int generateCanvas(cell *c) { - if(whichCanvas == 'A' && archimedean) - return distcolors[arcm::current.tilegroup[arcm::id_of(c->master)] & 7]; + if(whichCanvas == 'A' && archimedean) { + int gcolors[16] = { + 0xF04040, 0x40F040, 0x4040F0, + 0xD0D000, 0xD000D0, 0x00D0D0, + 0xC0C0C0, 0x404040, 0x808080, + 0xF08040, 0xF04080, 0x40F080, + 0x4080F0, 0x8040F0, 0x80F040, + 0xFFD500 }; + return gcolors[arcm::current.tilegroup[arcm::id_of(c->master)] & 15]; + } + if(whichCanvas == 'B') { + int gcolors[16] = { + // trying to get colors as in Wikipedia [ https://en.wikipedia.org/wiki/Euclidean_tilings_by_convex_regular_polygons#k-uniform_tilings ] + 0, 0, 0xFFFFFF, 0xFFFF00, + 0xFF0000, 0xC000C0 /* unknown5 */, 0x00FF00, 0x00C0C0 /* unknown7 */, 0xFF8000, + 0xFFFF80, 0xC040C0, 0xFFD500, 0x000080, + 0x404040, 0x606060, 0x808080 + }; + return gcolors[c->type & 15]; + } if(whichCanvas == 'C' && hyperbolic) { using namespace fieldpattern; int z = currfp.getdist(fieldval(c), make_pair(0,false)); @@ -1421,6 +1439,8 @@ namespace patterns { if(archimedean) dialog::addSelItem(XLAT("Archimedean"), "Archimedean", 'A'); + dialog::addSelItem(XLAT("sides"), "sides", 'B'); + dialog::addBreak(100); dialog::addBoolItem(XLATN(winf[waInvisibleFloor].name), canvas_invisible, 'i'); diff --git a/textures.cpp b/textures.cpp index 9ebdb018..61ade066 100644 --- a/textures.cpp +++ b/textures.cpp @@ -1059,6 +1059,20 @@ void showMenu() { dialog::addItem(XLAT("paint a new texture"), 'n'); #endif dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P'); + + dialog::addBoolItem(XLAT("Canvas"), specialland == laCanvas, 'X'); + dialog::add_action([] () { + bool inwhite = specialland == laCanvas && patterns::whichCanvas == 'g' && patterns::canvasback == 0xFFFFFF; + if(inwhite) + pushScreen(patterns::showPrePattern); + else { + stop_game(); + firstland = specialland = laCanvas; + patterns::whichCanvas = 'g'; + patterns::canvasback = 0xFFFFFF; + start_game(); + } + }); } if(config.tstate == tsAdjusting) {