1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

product:: big stuff

This commit is contained in:
Zeno Rogue 2019-08-18 15:32:46 +02:00
parent fb0f5872c8
commit f40072511b
6 changed files with 44 additions and 6 deletions

View File

@ -31,12 +31,13 @@ EX bool checkBarriersFront(cellwalker bb, int q IS(5), bool cross IS(false)) {
return checkBarriersBack(bb, q);
}
/** return true if the cell c is not allowed to generate barriers because of other large things already existing nearby. */
EX bool hasbardir(cell *c) {
return c->bardir != NODIR && c->bardir != NOBARRIERS;
}
/** return true if the cell c is not allowed to generate barriers because of other large things already existing nearby. */
EX void preventbarriers(cell *c) {
if(prod) c = product::get_where(c).first;
if(c && c->bardir == NODIR) c->bardir = NOBARRIERS;
}

View File

@ -132,6 +132,7 @@ EX bool grailWasFound(cell *c) {
}
void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
if(prod) { product::in_underlying_map([&] { generateAlts(h, levs, link_cdata); }); }
if(!h->alt) return;
preventbarriers(h->c7);
if(h->c7) forCellEx(c2, h->c7) preventbarriers(c2);
@ -182,6 +183,13 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) {
if(prod) {
c = product::get_where(c).first;
heptagon *res;
product::in_underlying_map([&] { res = createAlternateMap(c, rad, firststate, special); });
return res;
}
// check for direction
int gdir = -1;
for(int i=0; i<c->type; i++) {
@ -969,6 +977,16 @@ EX void setLandSol(cell *c) {
}
}
EX void setLandProduct(cell *c) {
auto wc = product::get_where(c).first;
c->barleft = wc->barleft;
c->barright = wc->barright;
c->bardir = wc->bardir;
if(wc->land) setland(c, wc->land);
if(among(wc->wall, waBarrier, waMercury) || wc->land == laElementalWall)
c->wall = wc->wall;
}
EX void setLandNil(cell *c) {
setland(c, specialland);
@ -1257,9 +1275,9 @@ EX int wallchance(cell *c, bool deepOcean) {
50;
}
/** should we generate the horocycles in the current geometry? */
EX bool horo_ok() {
// do the horocycles work in the current geometry?
return hyperbolic && !binarytiling && !archimedean && !penrose && !experimental;
return hyperbolic && !binarytiling && !archimedean && !penrose && !experimental && !prod;
}
EX bool gp_wall_test() {
@ -1317,7 +1335,9 @@ EX void buildBigStuff(cell *c, cell *from) {
// buildgreatwalls
if(geometry == gNormal && celldist(c) < 3 && !GOLDBERG) {
if(prod) ; /* Great Walls generated via the underlying geometry */
else if(geometry == gNormal && celldist(c) < 3 && !GOLDBERG) {
if(top_land && c == cwt.at->master->move(3)->c7) {
buildBarrierStrong(c, 6, true, top_land);
}
@ -1645,6 +1665,10 @@ EX void moreBigStuff(cell *c) {
else if(geometry == gKiteDart3) {
if(kite::getshape(c->master) == kite::pKite) c->wall = waColumn;
}
else if(prod) {
auto d = product::get_where(c);
if(d.first->wall == waColumn || (d.second&1)) c->wall = waColumn;
}
else if(WDIM == 3) {
if(c->master->zebraval != 1) c->wall = waColumn;
}

View File

@ -448,6 +448,7 @@ EX int compdist(int dx[]) {
EX int celldist(cell *c) {
if(experimental) return 0;
if(prod) { auto w = product::get_where(c); return PIU(celldist(w.first)) + abs(w.second); }
if(fulltorus && WDIM == 2)
return torusmap()->dists[decodeId(c->master)];
if(nil) return DISTANCE_UNKNOWN;
@ -478,6 +479,7 @@ static const int ALTDIST_ERROR = 90000;
EX int celldistAlt(cell *c) {
if(experimental) return 0;
if(prod) { auto w = product::get_where(c); return PIU(celldistAlt(w.first)) + abs(w.second); }
if(masterless) {
if(fulltorus) return celldist(c);
if(euwrap) return cylinder_alt(c);
@ -982,6 +984,8 @@ EX cell *random_in_distance(cell *c, int d) {
EX int celldistance(cell *c1, cell *c2) {
if(prod) { auto w1 = product::get_where(c1), w2 = product::get_where(c2); return PIU(celldistance(w1.first, w2.first) + abs(w1.second - w2.second)); }
if((masterless) && (euclid6 || (euclid4 && PURE))) {
if(!euwrap)
return eudist(decodeId(c1->master) - decodeId(c2->master)); // fix cylinder

View File

@ -2550,6 +2550,13 @@ EX void setdist(cell *c, int d, cell *from) {
if(d <= 10 - getDistLimit()) lastexplore = shmup::on ? shmup::curtime : turncount;
if(prod) {
auto wc = product::get_where(c).first;
auto wf = from ? product::get_where(from).first : NULL;
if(c->land && !wc->land) wc->land = c->land;
product::in_underlying_map([&] { setdist(wc, d, wf); });
}
if(buggyGeneration) {
if(d < BARLEV) for(int i=0; i<c->type; i++) {
setdist(createMov(c, i), d+1, c);
@ -2612,6 +2619,7 @@ EX void setdist(cell *c, int d, cell *from) {
#if MAXMDIM == 4
else if(euclid && WDIM == 3) euclid3::set_land(c);
#endif
else if(prod) setLandProduct(c);
else if(sphere || fulltorus) setLandSphere(c);
else if(euclid) setLandEuclid(c);
else if(quotient) { setland(c, specialland); setLandQuotient(c); }

View File

@ -554,7 +554,6 @@ EX namespace product {
geometry = gProduct;
ginf[gProduct] = ginf[underlying];
ginf[gProduct].cclass = gcProduct;
ginf[gProduct].flags |= qEXPERIMENTAL;
pmodel = mdPerspective;
}

View File

@ -372,6 +372,7 @@ EX pair<int, bool> fieldval(cell *c) {
EX int fieldval_uniq(cell *c) {
if(experimental) return 0;
else if(prod) { auto c1 = product::get_where(c).first; return PIU(fieldval_uniq(c1)); }
else if(sphere) {
if(archimedean) return c->master->fiftyval;
#if CAP_IRR
@ -1362,6 +1363,7 @@ EX bool pseudohept(cell *c) {
#if CAP_IRR
if(IRREGULAR) return irr::pseudohept(c);
#endif
if(prod) { auto d = product::get_where(c); return (d.second & 1) && PIU(pseudohept(d.first)); }
#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);