1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 07:30:26 +00:00

mapeditor:: an option to change new canvas cells without clearing the map

This commit is contained in:
Zeno Rogue 2019-01-17 00:59:45 +01:00
parent 44c3e2eb0a
commit 26fe57ef92
2 changed files with 37 additions and 18 deletions

View File

@ -1960,6 +1960,9 @@ namespace mapeditor {
dialog::add_action([] () { autocheat = true; }); dialog::add_action([] () { autocheat = true; });
dialog::addInfo("(unlock all, allow cheats, normal character display)"); dialog::addInfo("(unlock all, allow cheats, normal character display)");
dialog::addItem("change the pattern/color of new Canvas cells", 'c');
dialog::add_action([] () { pushScreen(patterns::showPrePatternNoninstant); });
dialog::addBack(); dialog::addBack();
dialog::display(); dialog::display();
} }

View File

@ -1443,7 +1443,7 @@ namespace patterns {
return canvasback; return canvasback;
} }
void showPrePattern() { void showPrePatternP(bool instant) {
cmode = sm::SIDE | sm::MAYDARK; cmode = sm::SIDE | sm::MAYDARK;
gamescreen(0); gamescreen(0);
@ -1502,7 +1502,7 @@ namespace patterns {
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [instant] (int sym, int uni) {
dialog::handleNavigation(sym, uni); dialog::handleNavigation(sym, uni);
if(uni == 'g') { if(uni == 'g') {
static unsigned c = (canvasback << 8) | 0xFF; static unsigned c = (canvasback << 8) | 0xFF;
@ -1510,22 +1510,31 @@ namespace patterns {
6, 0xFFFFFFFF, 0x101010FF, 0x404040FF, 0x808080FF, 0x800000FF, unsigned(linf[laCanvas].color >> 2) << 8 6, 0xFFFFFFFF, 0x101010FF, 0x404040FF, 0x808080FF, 0x800000FF, unsigned(linf[laCanvas].color >> 2) << 8
}; };
dialog::openColorDialog(c, canvasbacks); dialog::openColorDialog(c, canvasbacks);
dialog::reaction = [] () { dialog::reaction = [instant] () {
if(instant) {
stop_game(); stop_game();
whichCanvas = 'g'; whichCanvas = 'g';
canvasback = c >> 8; canvasback = c >> 8;
firstland = specialland = laCanvas; firstland = specialland = laCanvas;
randomPatternsMode = false; randomPatternsMode = false;
start_game(); start_game();
}
else {
whichCanvas = 'g';
canvasback = c >> 8;
}
}; };
} }
else if(uni == 'i') { else if(uni == 'i') {
if(instant) {
stop_game(); stop_game();
canvas_invisible = !canvas_invisible; canvas_invisible = !canvas_invisible;
firstland = specialland = laCanvas; firstland = specialland = laCanvas;
randomPatternsMode = false; randomPatternsMode = false;
start_game(); start_game();
} }
else canvas_invisible = !canvas_invisible;
}
else if(uni == 'f') { else if(uni == 'f') {
dialog::edit_string(color_formula, "formula", dialog::edit_string(color_formula, "formula",
@ -1550,12 +1559,15 @@ namespace patterns {
} }
else if((uni >= 'a' && uni <= 'z') || (uni >= 'A' && uni <= 'Z')) { else if((uni >= 'a' && uni <= 'z') || (uni >= 'A' && uni <= 'Z')) {
if(instant)
stop_game(); stop_game();
whichCanvas = uni; whichCanvas = uni;
subcanvas = rand(); subcanvas = rand();
if(instant) {
firstland = specialland = laCanvas; firstland = specialland = laCanvas;
randomPatternsMode = false; randomPatternsMode = false;
start_game(); start_game();
}
if(uni == 'x' || uni == 'z' || uni == 't') if(uni == 'x' || uni == 'z' || uni == 't')
whichPattern = PAT_ZEBRA, subpattern_flags = SPF_SYM0123 | SPF_ROT; whichPattern = PAT_ZEBRA, subpattern_flags = SPF_SYM0123 | SPF_ROT;
if(uni == 'e') if(uni == 'e')
@ -1569,6 +1581,10 @@ namespace patterns {
}; };
} }
void showPrePattern() { showPrePatternP(true); }
void showPrePatternNoninstant() { showPrePatternP(false); }
#if CAP_TEXTURE #if CAP_TEXTURE
#define REMAP_TEXTURE texture::config.remap() #define REMAP_TEXTURE texture::config.remap()
#else #else