diff --git a/dialogs.cpp b/dialogs.cpp index 5fc99eef..c18ab1c8 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -449,8 +449,10 @@ namespace dialog { unsigned char* pts = (unsigned char*) &color; pts[colorp] += abs(shiftmul) < .6 ? 1 : 17; } - else if(doexiton(sym, uni)) + else if(doexiton(sym, uni)) { + if(reaction) reaction(); popScreen(); + } return false; } @@ -516,6 +518,7 @@ namespace dialog { colorPointer = &col; palette = pal; dialogflags = 0; pushScreen(drawColorDialog); + reaction = reaction_t(); } struct numberEditor { diff --git a/mapeditor.cpp b/mapeditor.cpp index 9fc35c9b..c7b983ed 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -836,7 +836,6 @@ namespace mapeditor { int dslayer; bool coloring; unsigned int colortouse = 0xC0C0C0FFu; - bool colorkey = false; // fake key sent to change the color static const int COLORKEY = (-10000); @@ -881,7 +880,6 @@ namespace mapeditor { void drawHandleKey(int sym, int uni); void showDrawEditor() { - if(colorkey) drawHandleKey(COLORKEY, COLORKEY), colorkey = false; cmode = sm::DRAW; gamescreen(0); drawGrid(); @@ -1342,9 +1340,7 @@ namespace mapeditor { 0x404040FF, 0x804000FF }; - dialog::openColorDialog(colortouse, texture_colors); - dialog::openColorDialog(texture::paint_color); - colorkey = true; + dialog::openColorDialog(texture::paint_color, texture_colors); } if(uni == 'w') @@ -1387,7 +1383,9 @@ namespace mapeditor { if(uni == 'p') { dialog::openColorDialog(colortouse); - colorkey = true; + dialog::reaction = [] () { + drawHandleKey(COLORKEY, COLORKEY); + }; } if(sym == SDLK_F2)