1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-18 11:19:59 +00:00

product:: land generation for various lands

This commit is contained in:
Zeno Rogue 2019-08-19 14:29:10 +02:00
parent d91adc45a5
commit db42409878
2 changed files with 24 additions and 7 deletions

View File

@ -262,7 +262,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
} }
} }
} }
else if(hyperbolic_not37 || fulltorus || S7 < 5 || archimedean || WDIM == 3) { else if(PIU(hyperbolic_not37 || fulltorus || S7 < 5 || archimedean || WDIM == 3)) {
if(fargen) { if(fargen) {
int i = hrand(100); int i = hrand(100);
if(i < 10) if(i < 10)
@ -314,12 +314,17 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
} }
if(d == 8 && !sphere) { if(d == 8 && !sphere) {
if(prod && polarb50(c) && (product::get_where(c).second & 3) == 2) {
c->wall = waPalace;
break;
}
// note: Princess Challenge brings back the normal Palace generation // note: Princess Challenge brings back the normal Palace generation
bool lookingForPrincess = !euclid && c->master->alt && !princess::challenge; bool lookingForPrincess = !euclid && c->master->alt && !princess::challenge;
bool pgate = false; bool pgate = false;
if(PURE) { if(PURE || GOLDBERG) {
int i = fiftyval049(c->master->c7); int i = fiftyval049(c->master->c7);
if(i >= 8 && i <= 14 && !polarb50(c->master->c7)) pgate = true; if(i >= 8 && i <= 14 && !polarb50(c->master->c7)) pgate = true;
if(GOLDBERG) { if(GOLDBERG) {
@ -348,17 +353,19 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
if(GOLDBERG) ; if(GOLDBERG) ;
else { else {
int q = 0, s = 0; int q = 0, s = 0;
if(!ishept(c)) for(int i=0; i<c->type; i++) if(!ishept(c)) for(int i=0; i<c->type - (prod ? 2 : 0); i++)
if(cdist50(c->move(i)) == 3 && polarb50(c->move(i)) && !ishept(c->move(i))) if(cdist50(c->move(i)) == 3 && polarb50(c->move(i)) && !ishept(c->move(i)))
q++, s += i; q++, s += i;
if(q == 1 && c->move(s)->land == laPalace) { if(q == 1 && c->move(s)->land == laPalace) {
switch(princess::generating ? 0 : hrand(2)) { switch(princess::generating ? 0 : hrand(2)) {
case 0: case 0:
c->wall = waClosedGate; c->wall = waClosedGate;
if(prod) toggleGates(c, waClosePlate, 1);
c->move(s)->wall = waClosedGate; c->move(s)->wall = waClosedGate;
break; break;
case 1: case 1:
c->wall = waOpenGate; c->wall = waOpenGate;
if(prod) toggleGates(c, waOpenPlate, 1);
c->move(s)->wall = waOpenGate; c->move(s)->wall = waOpenGate;
break; break;
} }
@ -697,6 +704,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
else if(v == 25 || v == 59 || v == 27 || v == 57) else if(v == 25 || v == 59 || v == 27 || v == 57)
c->wall = waVineHalfB; c->wall = waVineHalfB;
else c->wall = waNone; else c->wall = waNone;
if(prod && cellHalfvine(c)) c->wall = waNone;
if(NONSTDVAR && cellHalfvine(c)) { if(NONSTDVAR && cellHalfvine(c)) {
c->wall = waNone; c->wall = waNone;
forCellCM(c2, c) if(emeraldval(c2) == (v^1)) forCellCM(c2, c) if(emeraldval(c2) == (v^1))
@ -1257,7 +1265,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
break; break;
case laStorms: { case laStorms: {
bool randstorm = hyperbolic_not37 || NONSTDVAR || (quotient && geometry != gZebraQuotient); bool randstorm = PIU(hyperbolic_not37 || NONSTDVAR || (quotient && geometry != gZebraQuotient));
if(fargen) { if(fargen) {
if(fulltorus) { if(fulltorus) {
@ -1323,6 +1331,13 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
while(i) { if(i&1) b++; i>>=1; } while(i) { if(i&1) b++; i>>=1; }
if(ctof(c) && (b&1) && hrand(100) < 20) c->wall = (z&2) ? waCharged : waGrounded; if(ctof(c) && (b&1) && hrand(100) < 20) c->wall = (z&2) ? waCharged : waGrounded;
} }
else if(prod) {
cell *c1 = product::get_where(c).first;
if(among(c1->wall, waCharged, waGrounded))
c->wall = c1->wall;
else if(hrand(100) < 15)
c->wall = waSandstone;
}
else { else {
int i = zebra40(c); int i = zebra40(c);
if(c->wall); if(c->wall);

View File

@ -747,12 +747,14 @@ EX void generateSnake(cell *c, int i, int snakecolor) {
if(c3->monst || c3->bardir != NODIR || c3->wall) break; if(c3->monst || c3->bardir != NODIR || c3->wall) break;
c2 = c3; c2 = c3;
c2->monst = moHexSnakeTail; c2->hitpoints = snakecolor; c2->monst = moHexSnakeTail; c2->hitpoints = snakecolor;
i = (j + (c2->type%4 == 0 ? c2->type/2 : (len%2 ? 2 : c2->type - 2))) % c2->type; int t = c2->type;
if(prod) t -= 2;
i = (j + (t%4 == 0 ? t/2 : (len%2 ? 2 : t - 2))) % t;
createMov(c2, i); createMov(c2, i);
if(!inpair(c2->move(i), cpair)) { if(!inpair(c2->move(i), cpair)) {
vector<int> goodsteps; vector<int> goodsteps;
{for(int i=0; i<c2->type; i++) {for(int i=0; i<t; i++)
if(inpair(c2->move(i), cpair)) if(inpair(c2->cmove(i), cpair))
goodsteps.push_back(i);} goodsteps.push_back(i);}
if(!isize(goodsteps)) break; if(!isize(goodsteps)) break;
i = goodsteps[hrand(isize(goodsteps))]; i = goodsteps[hrand(isize(goodsteps))];