From d6376e1ddff0e248deb3bd0d317ca6fa92d51868 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 3 Dec 2017 11:48:02 +0100 Subject: [PATCH] emeraldpattern on a46; fixed/improved darkening when sidedialog not available; pattern dialogs are now sidedialogs --- cell.cpp | 3 ++- config.cpp | 4 ++-- dialogs.cpp | 31 ++++++++++++++++++++++--------- graph.cpp | 6 +++++- hyper.h | 2 ++ mapeditor.cpp | 31 +++++++++++++++++++++++++------ patterns.cpp | 2 ++ 7 files changed, 60 insertions(+), 19 deletions(-) diff --git a/cell.cpp b/cell.cpp index 053b56be..988330bd 100644 --- a/cell.cpp +++ b/cell.cpp @@ -61,7 +61,7 @@ hrmap_hyperbolic::hrmap_hyperbolic() { origin = new heptagon; heptagon& h = *origin; h.s = hsOrigin; - h.emeraldval = 98; + h.emeraldval = a46 ? 0 : 98; h.zebraval = 40; h.fiftyval = 0; h.fieldval = 0; @@ -731,6 +731,7 @@ bool ishex1(cell *c) { int emeraldval(cell *c) { if(euclid) return eupattern(c); + if(a46) return c->master->distance & 1; if(sphere) return 0; if(ctof(c)) return c->master->emeraldval >> 3; diff --git a/config.cpp b/config.cpp index f69b00c6..7fd97c26 100644 --- a/config.cpp +++ b/config.cpp @@ -557,8 +557,8 @@ void handleAllConfig(int sym, int uni) { } void showGraphConfig() { + cmode = vid.xres > vid.yres * 1.4 ? sm::SIDE : sm::MAYDARK; gamescreen(0); - cmode = vid.xres > vid.yres * 1.4 ? sm::SIDE : 0; dialog::init(XLAT("graphics configuration")); @@ -993,8 +993,8 @@ string explain3D(ld *param) { } void show3D() { + cmode = sm::SIDE | sm::A3 | sm::MAYDARK; gamescreen(0); - cmode = sm::SIDE | sm::A3; using namespace geom3; dialog::init(XLAT("3D configuration")); diff --git a/dialogs.cpp b/dialogs.cpp index f6f1379b..7692b636 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -414,7 +414,7 @@ namespace dialog { unsigned& color = *colorPointer; if(uni >= 'A' && uni <= 'D') { - int x = (mousex - vid.xres/4) * 510 / vid.xres; + int x = (mousex - (dcenter-dwidth/4)) * 510 / dwidth; if(x < 0) x = 0; if(x > 255) x = 255; unsigned char* pts = (unsigned char*) &color; @@ -453,12 +453,23 @@ namespace dialog { } void drawColorDialog() { + cmode = sm::NUMBER | dialogflags; + if(cmode & sm::SIDE) gamescreen(0); + + dcenter = vid.xres/2; + dwidth = vid.xres; + + if(sidescreen) { + dwidth = vid.xres - vid.yres; + dcenter = vid.xres - dwidth / 2; + } + int color = *colorPointer; int ash = 8; for(int j=0; j<10; j++) { - int x = vid.xres / 2 + vid.fsize * 2 * (j-5); + int x = dcenter + vid.fsize * 2 * (j-5); int y = vid.yres / 2- 5 * vid.fsize; string s0 = ""; s0 += ('0'+j); @@ -471,7 +482,7 @@ namespace dialog { if(palette) { int q = palette[0]; for(int i=0; i> (8*i)) & 0xFF) / 510, y, "#", 0, 8, 0, col); + displayColorButton(dcenter + dwidth/4, y, rgt, 0, 0, 0, col); + displayColorButton(dcenter - dwidth/4 + dwidth * ((color >> (8*i)) & 0xFF) / 510, y, "#", 0, 8, 0, col); if(mousey >= y - vid.fsize && mousey < y + vid.fsize) getcstat = 'A' + i, inslider = true; } - displayColorButton(vid.xres/2, vid.yres/2+vid.fsize * 6, XLAT("select this color") + " : " + itsh(color), ' ', 8, 0, color >> ash); + displayColorButton(dcenter, vid.yres/2+vid.fsize * 6, XLAT("select this color") + " : " + itsh(color), ' ', 8, 0, color >> ash); keyhandler = handleKeyColor; } void openColorDialog(unsigned int& col, unsigned int *pal) { colorPointer = &col; palette = pal; + dialogflags = 0; pushScreen(drawColorDialog); } @@ -641,7 +653,7 @@ namespace dialog { void drawNumberDialog() { cmode = sm::NUMBER | dialogflags; - gamescreen((cmode & sm::SIDE) ? 0 : 2); + gamescreen(0); init(ne.title); addInfo(ne.s); addSlider(ne.scale(ne.vmin), ne.scale(*ne.editwhat), ne.scale(ne.vmax), 500); @@ -802,7 +814,8 @@ namespace dialog { ne.scale = ne.inverse_scale = identity; ne.intval = NULL; ne.positive = false; - dialogflags = (cmode & (sm::SIDE | sm::A3)); + dialogflags = (cmode & sm::A3); + if(cmode & sm::SIDE) dialogflags |= sm::MAYDARK; cmode |= sm::NUMBER; pushScreen(drawNumberDialog); reaction = reaction_t(); diff --git a/graph.cpp b/graph.cpp index 1ad539e6..8b92ce3d 100644 --- a/graph.cpp +++ b/graph.cpp @@ -5179,7 +5179,11 @@ void gamescreen(int _darken) { if(ISMOBILE && (cmode & sm::SIDE)) { cmode ^= sm::SIDE; - darken += 2; + _darken += 2; + } + + if((cmode & sm::MAYDARK) && !sidescreen) { + _darken += 2; } darken = _darken; diff --git a/hyper.h b/hyper.h index be72d342..d1ebef7f 100644 --- a/hyper.h +++ b/hyper.h @@ -1118,6 +1118,7 @@ namespace dialog { void displayPageButtons(int i, bool pages); bool handlePageButtons(int uni); extern bool sidedialog; + extern int dialogflags; } void checkStunKill(cell *dest); @@ -1517,6 +1518,7 @@ namespace sm { static const int A3 = 2048; // affects poly static const int ZOOMABLE = 4096; static const int TORUSCONFIG = 8192; + static const int MAYDARK = 16384; }; namespace linepatterns { diff --git a/mapeditor.cpp b/mapeditor.cpp index 5db9b857..bb437c2b 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -379,6 +379,7 @@ namespace mapeditor { case 'f': { int t = emeraldval(c); + if(a46) return c->master->emeraldval ^ (c->master->distance & 1); if(euclid) return 0; int tcdir = 0, tbest = (t&3); for(int i=0; itype; i++) { @@ -411,6 +412,7 @@ namespace mapeditor { case 0: { if(euclid) return 0; + if(a46) return c->master->emeraldval; int u = nopattern(c); if(u == 6) { @@ -745,11 +747,21 @@ namespace mapeditor { } void showPattern() { + cmode = sm::SIDE | sm::MAYDARK; + { + dynamicval dc(displaycodes, displaycodes ? displaycodes : 2); + gamescreen(0); + } dialog::init(); - dialog::addBoolItem(XLAT(euclid ? "three colors" : "Emerald Pattern"), (whichPattern == 'f'), 'f'); - dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == 'p'), 'p'); - dialog::addBoolItem(XLAT(euclid ? "three colors rotated" : "Zebra Pattern"), (whichPattern == 'z'), 'z'); + if(a46) + dialog::addBoolItem("two colors", (whichPattern == 'f'), 'f'); + else + dialog::addBoolItem(XLAT(euclid ? "three colors" : "Emerald Pattern"), (whichPattern == 'f'), 'f'); + if(!a4) + dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == 'p'), 'p'); + if(!a4) + dialog::addBoolItem(XLAT(euclid ? "three colors rotated" : "Zebra Pattern"), (whichPattern == 'z'), 'z'); dialog::addBoolItem(XLAT("field pattern"), (whichPattern == 'F'), 'F'); if(whichPattern == 'f') symRotation = true; @@ -757,8 +769,10 @@ namespace mapeditor { else if(!euclid) { dialog::addBoolItem(XLAT("rotational symmetry"), (symRotation), '0'); dialog::addBoolItem(XLAT("symmetry 0-1"), (sym01), '1'); - dialog::addBoolItem(XLAT("symmetry 0-2"), (sym02), '2'); - dialog::addBoolItem(XLAT("symmetry 0-3"), (sym03), '3'); + if(!a46) { + dialog::addBoolItem(XLAT("symmetry 0-2"), (sym02), '2'); + dialog::addBoolItem(XLAT("symmetry 0-3"), (sym03), '3'); + } } else dialog::addBoolItem(XLAT("edit all three colors"), (symRotation), '0'); @@ -2341,6 +2355,9 @@ namespace linepatterns { int numpat = 0; void showMenu() { + cmode = sm::SIDE | sm::MAYDARK; + gamescreen(0); + dialog::init(XLAT("line patterns")); for(numpat=0; patterns[numpat].lpname; numpat++) @@ -2356,8 +2373,10 @@ namespace linepatterns { keyhandler = [] (int sym, int uni) { dialog::handleNavigation(sym, uni); - if(uni >= 'a' && uni < 'a' + numpat) + if(uni >= 'a' && uni < 'a' + numpat) { dialog::openColorDialog(patterns[uni - 'a'].color, NULL); + dialog::dialogflags |= sm::MAYDARK | sm::SIDE; + } else if(doexiton(sym,uni)) popScreen(); }; } diff --git a/patterns.cpp b/patterns.cpp index 5b826805..f4349415 100644 --- a/patterns.cpp +++ b/patterns.cpp @@ -7,6 +7,8 @@ // rules for the emeraldvalues of heptagons. int emerald_heptagon(int parent, int dir) { + if(a46) return (parent+dir)&1; + if(S7 == 8 && dir > 3) dir--; // no emeraldgen here