mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
made the equidistant lands generate something without crashing in all geometries
This commit is contained in:
parent
142e39ec4d
commit
ccbe7feb96
26
bigstuff.cpp
26
bigstuff.cpp
@ -662,6 +662,16 @@ int towerval(cell *c, cellfunction* cf) {
|
|||||||
|
|
||||||
/* other geometries */
|
/* other geometries */
|
||||||
|
|
||||||
|
void setLandWeird(cell *c) {
|
||||||
|
if(specialland == laIvoryTower || specialland == laEndorian || specialland == laDungeon || specialland == laOcean) {
|
||||||
|
int d = celldist(c) - (getDistLimit() - 2);
|
||||||
|
if(d <= 0)
|
||||||
|
c->land = laCrossroads4;
|
||||||
|
else
|
||||||
|
c->land = specialland, c->landparam = d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setLandQuotient(cell *c) {
|
void setLandQuotient(cell *c) {
|
||||||
int fv = zebra40(c);
|
int fv = zebra40(c);
|
||||||
if(fv/4 == 4 || fv/4 == 6 || fv/4 == 5 || fv/4 == 10) fv ^= 2;
|
if(fv/4 == 4 || fv/4 == 6 || fv/4 == 5 || fv/4 == 10) fv ^= 2;
|
||||||
@ -669,6 +679,13 @@ void setLandQuotient(cell *c) {
|
|||||||
if(fv%4==0 || fv%4 == 2) setland(c, laWarpSea);
|
if(fv%4==0 || fv%4 == 2) setland(c, laWarpSea);
|
||||||
if(specialland == laElementalWall)
|
if(specialland == laElementalWall)
|
||||||
setland(c, eLand(laEFire + (fv%4)));
|
setland(c, eLand(laEFire + (fv%4)));
|
||||||
|
if(specialland == laIvoryTower || specialland == laEndorian || specialland == laDungeon || specialland == laOcean) {
|
||||||
|
int d = celldist(c) - 1;
|
||||||
|
if(d <= 0)
|
||||||
|
c->land = laCrossroads4;
|
||||||
|
else
|
||||||
|
c->land = specialland, c->landparam = d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLandSphere(cell *c) {
|
void setLandSphere(cell *c) {
|
||||||
@ -700,6 +717,13 @@ void setLandSphere(cell *c) {
|
|||||||
if(specialland == laCrossroads3 && c->type != 6 && c->master->fiftyval == 1)
|
if(specialland == laCrossroads3 && c->type != 6 && c->master->fiftyval == 1)
|
||||||
c->wall = waBigTree;
|
c->wall = waBigTree;
|
||||||
}
|
}
|
||||||
|
if(specialland == laIvoryTower || specialland == laEndorian || specialland == laDungeon || specialland == laOcean) {
|
||||||
|
int d = celldist(c);
|
||||||
|
if(d <= 0)
|
||||||
|
c->land = laCrossroads4;
|
||||||
|
else
|
||||||
|
c->land = specialland, c->landparam = d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eLand euland[65536];
|
eLand euland[65536];
|
||||||
@ -880,7 +904,7 @@ void buildBigStuff(cell *c, cell *from) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(generatingEquidistant) deepOcean = false;
|
if(generatingEquidistant) deepOcean = false;
|
||||||
if(weirdhyperbolic && c->land == laOcean) deepOcean = true;
|
if(weirdhyperbolic && c->land == laOcean) deepOcean = c->landparam >= 30;
|
||||||
|
|
||||||
// buildgreatwalls
|
// buildgreatwalls
|
||||||
|
|
||||||
|
17
complex.cpp
17
complex.cpp
@ -2679,6 +2679,9 @@ namespace prairie {
|
|||||||
else if(sphere) {
|
else if(sphere) {
|
||||||
c->LHU.fi.rval = celldistance(c, cwt.c) + 8 - (nontruncated ? 2 : 3);
|
c->LHU.fi.rval = celldistance(c, cwt.c) + 8 - (nontruncated ? 2 : 3);
|
||||||
}
|
}
|
||||||
|
else if(weirdhyperbolic) {
|
||||||
|
c->LHU.fi.rval = max(celldist(c), 15);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
if(!from) {
|
if(!from) {
|
||||||
for(int i=0; i<size(currfp.matrices); i++)
|
for(int i=0; i<size(currfp.matrices); i++)
|
||||||
@ -3348,6 +3351,12 @@ namespace halloween {
|
|||||||
|
|
||||||
namespace dungeon {
|
namespace dungeon {
|
||||||
|
|
||||||
|
void towerError(cell *c) {
|
||||||
|
// only care in the standard geometry -- weird ones are intentionally left buggy
|
||||||
|
if(!weirdhyperbolic && !sphere && !quotient)
|
||||||
|
raiseBuggyGeneration(c, "ivory tower/dungeon generation error");
|
||||||
|
}
|
||||||
|
|
||||||
void buildIvoryTower(cell *c) {
|
void buildIvoryTower(cell *c) {
|
||||||
/* if(int(c->landparam) % 5 == 0)
|
/* if(int(c->landparam) % 5 == 0)
|
||||||
c->wall = waCamelot;
|
c->wall = waCamelot;
|
||||||
@ -3397,8 +3406,8 @@ namespace dungeon {
|
|||||||
rdepths[i] = c2 && c3 && c4 && (c2->landflags == 3 || c3->landflags == 3 || c4->landflags == 3);
|
rdepths[i] = c2 && c3 && c4 && (c2->landflags == 3 || c3->landflags == 3 || c4->landflags == 3);
|
||||||
c2 = chosenDown(c2, 1, 0); // if(!c2) break;
|
c2 = chosenDown(c2, 1, 0); // if(!c2) break;
|
||||||
c3 = chosenDown(c3, -1, 0);
|
c3 = chosenDown(c3, -1, 0);
|
||||||
if(!c2) { raiseBuggyGeneration(c, "ivory c2"); return; }
|
if(!c2) { towerError(c); return; }
|
||||||
if(!c3) { raiseBuggyGeneration(c, "ivory c3"); return; }
|
if(!c3) { towerError(c); return; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3452,8 +3461,8 @@ namespace dungeon {
|
|||||||
switchcount++;
|
switchcount++;
|
||||||
c2 = chosenDown(c2, 1, 0); // if(!c2) break;
|
c2 = chosenDown(c2, 1, 0); // if(!c2) break;
|
||||||
c3 = chosenDown(c3, -1, 0);
|
c3 = chosenDown(c3, -1, 0);
|
||||||
if(!c2) { raiseBuggyGeneration(c, "ivory c2"); return 0; }
|
if(!c2) { towerError(c); return 0; }
|
||||||
if(!c3) { raiseBuggyGeneration(c, "ivory c3"); return 0; }
|
if(!c3) { towerError(c); return 0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2148,6 +2148,10 @@ transmatrix applyDowndir(cell *c, cellfunction *cf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void drawTowerFloor(const transmatrix& V, cell *c, int col, cellfunction *cf = coastvalEdge) {
|
void drawTowerFloor(const transmatrix& V, cell *c, int col, cellfunction *cf = coastvalEdge) {
|
||||||
|
if(weirdhyperbolic || sphere) {
|
||||||
|
int ct6 = ctof(c);
|
||||||
|
qfloor(c, V, PLAINFLOOR, col); return;
|
||||||
|
}
|
||||||
int j = -1;
|
int j = -1;
|
||||||
|
|
||||||
if(euclid) j = 10;
|
if(euclid) j = 10;
|
||||||
|
1
hyper.h
1
hyper.h
@ -1891,6 +1891,7 @@ bool openplains(cell *c);
|
|||||||
void buildBigStuff(cell *c, cell *from);
|
void buildBigStuff(cell *c, cell *from);
|
||||||
void setLandQuotient(cell *c);
|
void setLandQuotient(cell *c);
|
||||||
void setLandSphere(cell *c);
|
void setLandSphere(cell *c);
|
||||||
|
void setLandWeird(cell *c);
|
||||||
void moreBigStuff(cell *c);
|
void moreBigStuff(cell *c);
|
||||||
void setLandEuclid(cell *c);
|
void setLandEuclid(cell *c);
|
||||||
bool checkInTree(cell *c, int maxv);
|
bool checkInTree(cell *c, int maxv);
|
||||||
|
@ -2078,6 +2078,7 @@ void setdist(cell *c, int d, cell *from) {
|
|||||||
|
|
||||||
if(sphere || torus) setLandSphere(c);
|
if(sphere || torus) setLandSphere(c);
|
||||||
else if(euclid) setLandEuclid(c);
|
else if(euclid) setLandEuclid(c);
|
||||||
|
if(weirdhyperbolic) setLandWeird(c);
|
||||||
if(quotient) { setland(c, specialland); setLandQuotient(c); }
|
if(quotient) { setland(c, specialland); setLandQuotient(c); }
|
||||||
|
|
||||||
// if(chaosmode) setland(c, getCLand(c));
|
// if(chaosmode) setland(c, getCLand(c));
|
||||||
|
Loading…
Reference in New Issue
Block a user