emeraldpattern on a46; fixed/improved darkening when sidedialog not available; pattern dialogs are now sidedialogs

This commit is contained in:
Zeno Rogue 2017-12-03 11:48:02 +01:00
parent ad7c453d18
commit d6376e1ddf
7 changed files with 60 additions and 19 deletions

View File

@ -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;

View File

@ -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"));

View File

@ -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<q; i++) {
int x = vid.xres / 2 + vid.fsize * (2 * i-q);
int x = dcenter + vid.fsize * (2 * i-q);
int y = vid.yres / 2- 7 * vid.fsize;
string s0 = ""; s0 += ('a'+i);
vid.fsize *= 2;
@ -485,22 +496,23 @@ namespace dialog {
int col = ((i==colorp) && !mousing) ? 0xFFD500 : forecolor;
displayColorButton(vid.xres / 4, y, "(", 0, 16, 0, col);
displayColorButton(dcenter - dwidth/4, y, "(", 0, 16, 0, col);
string rgt = ") "; rgt += "ABGR" [i];
displayColorButton(vid.xres * 3/4, y, rgt, 0, 0, 0, col);
displayColorButton(vid.xres /4 + vid.xres * ((color >> (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();

View File

@ -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;

View File

@ -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 {

View File

@ -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; i<c->type; 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<int> 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();
};
}

View File

@ -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