generating various lands in Sol

This commit is contained in:
Zeno Rogue 2019-08-06 20:59:43 +02:00
parent 632957b678
commit 602e6f27db
5 changed files with 96 additions and 8 deletions

View File

@ -885,13 +885,13 @@ eLand& get_euland(int c) {
void clear_euland(eLand first) {
euland.resize(max_vec);
for(int i=0; i<max_vec; i++) euland[i] = laNone;
euland[0] = euland[1] = euland[max_vec-1] = first;
if(!nonisotropic) euland[0] = euland[1] = euland[max_vec-1] = first;
euland3.clear();
euland3[0] = laCrossroads;
}
bool valid_wall_at(int c) {
if(sol) return true;
if(nonisotropic) return true;
return short(c) % 3 == 0;
}
@ -904,11 +904,11 @@ eLand switchable(eLand nearland, eLand farland, int c) {
else if(specialland == laCrossroads4) {
if((dual::state && nearland == laCrossroads4) || hrand(15) == 0)
return getNewLand(nearland);
if(nearland == laCrossroads4 && sol)
return getNewLand(nearland);
if(nearland == laCrossroads4 && nonisotropic)
return getNewLand(nearland);
return nearland;
}
else if(nearland == laCrossroads && sol) {
else if(nearland == laCrossroads && nonisotropic) {
return laBarrier;
}
else if(nearland == laCrossroads) {
@ -964,6 +964,60 @@ void setLandSol(cell *c) {
}
}
void setLandNil(cell *c) {
setland(c, specialland);
if(chaosmode) {
int hash = (((c->master->zebraval + 4) >> 3) << 16) + ((c->master->emeraldval + 4) >> 3);
auto& l = euland3_hash[hash];
if(l == laNone) l = getNewLand(laNone);
setland(c, l);
return;
}
switch(specialland) {
case laCrossroads: case laCrossroads4:
setland(c, getEuclidLand(c->master->zebraval));
if(c->land == laBarrier && c->master->emeraldval % 3) c->wall = waBarrier;
break;
case laCrossroads2:
setland(c, getEuclidLand(c->master->emeraldval));
if(c->land == laBarrier && c->master->zebraval % 3) c->wall = waBarrier;
break;
case laCrossroads3: {
int ox = c->master->zebraval - 8;
int oy = c->master->emeraldval - 8;
int hash = (((ox + 16) >> 5) << 16) + ((oy + 16) >> 5);
auto& l = euland3_hash[hash];
if(l == laNone) l = getNewLand(laCrossroads3);
if(ox % 16 == 0) setland(c, laBarrier);
else if(oy % 16 == 0) setland(c, laBarrier);
else setland(c, l);
if(c->land == laBarrier && ((c->master->zebraval & 3) || (c->master->emeraldval & 3))) c->wall = waBarrier;
break;
}
case laElementalWall: {
int ox = c->master->zebraval - 4;
int oy = c->master->emeraldval - 4;
int x = (ox & 7) ? ((ox & 8) ? 1 : -1) : 0;
int y = (oy & 7) ? ((oy & 8) ? 1 : -1) : 0;
elementalXY(c, x, y, (ox & 3) || (oy & 3));
break;
}
case laTerracotta:
if((c->master->zebraval & 7) == 4 && (c->master->emeraldval & 7) == 4) {
setland(c, laMercuryRiver);
c->wall = waMercury;
}
break;
case laOcean: case laIvoryTower: case laEndorian: case laDungeon:
if(c->master->zebraval <= 0) setland(c, laRlyeh);
else c->landparam = c->master->zebraval;
break;
default: ;
}
}
void setLandEuclid(cell *c) {
#if CAP_RACING
if(racing::track_ready) {
@ -1523,7 +1577,7 @@ int masterAlt(cell *c) {
void moreBigStuff(cell *c) {
if((bearsCamelot(c->land) && !euclid && !quotient) || c->land == laCamelot)
if((bearsCamelot(c->land) && !euclid && !quotient && !nil) || c->land == laCamelot)
if(eubinary || binarytiling || c->master->alt) if(!(binarytiling && specialland != laCamelot))
buildCamelot(c);

View File

@ -443,6 +443,7 @@ int celldistAlt(cell *c) {
#if CAP_BT
if(binarytiling || sol) return c->master->distance + (specialland == laCamelot && !tactic::on? 30 : 0);
#endif
if(nil) return c->master->zebraval + abs(c->master->emeraldval) + (specialland == laCamelot && !tactic::on? 30 : 0);;
#if CAP_CRYSTAL
if(geometry == gCrystal)
return crystal::dist_alt(c);

View File

@ -106,7 +106,7 @@ void addMessage(string s, char spamtype = 0);
#define penrose (ginf[geometry].flags & qPENROSE)
// these geometries do not feature alternate structures for horocycles
#define eubinary (euclid || binarytiling || geometry == gCrystal)
#define eubinary (euclid || binarytiling || geometry == gCrystal || nil)
#define cgclass (ginf[geometry].cclass)
#define euclid (cgclass == gcEuclid)
@ -3076,6 +3076,7 @@ void setLandWeird(cell *c);
void moreBigStuff(cell *c);
void setLandEuclid(cell *c);
void setLandSol(cell *c);
void setLandNil(cell *c);
bool checkInTree(cell *c, int maxv);
cell *findcompass(cell *c);
int edgeDepth(cell *c);

View File

@ -235,7 +235,28 @@ void giantLandSwitch(cell *c, int d, cell *from) {
case laPalace: // -------------------------------------------------------------
if(hyperbolic_not37 || fulltorus || S7 < 5 || archimedean || WDIM == 3) {
if(nil) {
if(fargen) {
int i = hrand(100);
if(c->master->zebraval % 4 == 2 || c->master->emeraldval % 4 == 2) {
if(i < 85)
c->wall = waPalace;
else if(i < 95)
c->wall = waClosedGate;
else
c->wall = waOpenGate;
}
else {
if(i < 10)
c->wall = waTrapdoor;
else if(i < 15)
c->wall = waClosePlate;
else if(i < 20)
c->wall = waOpenPlate;
}
}
}
else if(hyperbolic_not37 || fulltorus || S7 < 5 || archimedean || WDIM == 3) {
if(fargen) {
int i = hrand(100);
if(i < 10)
@ -439,6 +460,11 @@ void giantLandSwitch(cell *c, int d, cell *from) {
else if(fulltorus) {
c->wall = waCavefloor;
}
else if(nil) {
int a = c->master->zebraval % 7;
int b = c->master->emeraldval % 7;
c->wall = (a-3.5) * (a-3.5) + (b-3.5) * (b-3.5) <= 12 ? waCavewall : waCavefloor;
}
else if(sol)
c->wall = (c->master->zebraval % 7 >= 5 || c->master->emeraldval % 7 >= 5) ? waCavewall : waCavefloor;
else if(WDIM == 3 && hyperbolic && !binarytiling)
@ -633,6 +659,10 @@ void giantLandSwitch(cell *c, int d, cell *from) {
else if(archimedean && arcm::current.have_line)
c->wall = arcm::linespattern(c) ? waVinePlant : waNone;
#endif
else if(nil) {
if((c->master->emeraldval & 1) == 1)
c->wall = waVinePlant;
}
else if(sol) {
if((c->master->distance & 1) == 1 && (c->master->emeraldval % 3))
c->wall = waVinePlant;
@ -2579,6 +2609,7 @@ void setdist(cell *c, int d, cell *from) {
else if(euclid) setLandEuclid(c);
else if(quotient) { setland(c, specialland); setLandQuotient(c); }
else if(sol) setLandSol(c);
else if(nil) setLandNil(c);
else if(weirdhyperbolic) setLandWeird(c);
}

View File

@ -1296,6 +1296,7 @@ bool pseudohept(cell *c) {
if(IRREGULAR) return irr::pseudohept(c);
#endif
#if CAP_BT
if(nil) return c->master->zebraval & c->master->emeraldval & c->master->fieldval & 1;
if(sol) return (c->master->emeraldval % 3 == 2) && (c->master->zebraval % 3 == 2) && (c->master->distance % 2);
if(penrose) return kite::getshape(c->master) == kite::pDart;
if(binarytiling) return binary::pseudohept(c);