edit random/singlecolor wall probability

This commit is contained in:
Zeno Rogue 2020-05-31 17:12:31 +02:00
parent 5bc60b9d10
commit d91f37780b
1 changed files with 15 additions and 2 deletions

View File

@ -1681,6 +1681,12 @@ EX namespace patterns {
EX int jhole = 0; EX int jhole = 0;
EX int jblock = 0; EX int jblock = 0;
EX int rwalls = 50; EX int rwalls = 50;
EX void edit_rwalls() {
if(WDIM == 2) return;
dialog::editNumber(rwalls, 0, 100, 10, 50, XLAT("probability of a wall (%)"), "");
dialog::reaction = [] { stop_game(); start_game(); };
}
EX int generateCanvas(cell *c) { EX int generateCanvas(cell *c) {
@ -1748,8 +1754,12 @@ EX namespace patterns {
if(!hyperbolic) return canvasback; if(!hyperbolic) return canvasback;
return 0x3F1F0F * fieldpattern::subval(c).second + 0x000080; return 0x3F1F0F * fieldpattern::subval(c).second + 0x000080;
#endif #endif
case 'g': case 'g': {
return canvasback; color_t r = canvasback;
if(hrand(100) < rwalls) r |= 0x1000000;
if(c == cwt.at) r &= 0xFFFFFF;
return r;
}
case 'r': { case 'r': {
color_t r = hrand(0xFFFFFF + 1); color_t r = hrand(0xFFFFFF + 1);
if(hrand(100) < rwalls) r |= 0x1000000; if(hrand(100) < rwalls) r |= 0x1000000;
@ -1981,6 +1991,7 @@ EX namespace patterns {
canvasback = c >> 8; canvasback = c >> 8;
} }
}; };
dialog::reaction_final = edit_rwalls;
} }
else if(uni == 'i') { else if(uni == 'i') {
if(instant) if(instant)
@ -2046,6 +2057,8 @@ EX namespace patterns {
randomPatternsMode = false; randomPatternsMode = false;
start_game(); start_game();
} }
if(uni == 'r')
edit_rwalls();
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')