1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 09:00:34 +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,21 +1510,30 @@ 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] () {
stop_game(); if(instant) {
whichCanvas = 'g'; stop_game();
canvasback = c >> 8; whichCanvas = 'g';
firstland = specialland = laCanvas; canvasback = c >> 8;
randomPatternsMode = false; firstland = specialland = laCanvas;
start_game(); randomPatternsMode = false;
start_game();
}
else {
whichCanvas = 'g';
canvasback = c >> 8;
}
}; };
} }
else if(uni == 'i') { else if(uni == 'i') {
stop_game(); if(instant) {
canvas_invisible = !canvas_invisible; stop_game();
firstland = specialland = laCanvas; canvas_invisible = !canvas_invisible;
randomPatternsMode = false; firstland = specialland = laCanvas;
start_game(); randomPatternsMode = false;
start_game();
}
else canvas_invisible = !canvas_invisible;
} }
else if(uni == 'f') { else if(uni == 'f') {
@ -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')) {
stop_game(); if(instant)
stop_game();
whichCanvas = uni; whichCanvas = uni;
subcanvas = rand(); subcanvas = rand();
firstland = specialland = laCanvas; if(instant) {
randomPatternsMode = false; firstland = specialland = laCanvas;
start_game(); randomPatternsMode = false;
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