1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

product:: lands in S2xE

This commit is contained in:
Zeno Rogue 2019-09-10 09:21:46 +02:00
parent 0785d970f1
commit e8c7285cc2
4 changed files with 65 additions and 14 deletions

View File

@ -185,6 +185,7 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) {
EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) { EX heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special IS(0)) {
if(hybri) { if(hybri) {
if(product::product_sphere()) return NULL;
c = hybrid::get_where(c).first; c = hybrid::get_where(c).first;
heptagon *res; heptagon *res;
hybrid::in_underlying_map([&] { res = createAlternateMap(c, rad, firststate, special); }); hybrid::in_underlying_map([&] { res = createAlternateMap(c, rad, firststate, special); });
@ -900,13 +901,13 @@ EX eLand& get_euland(int c) {
EX void clear_euland(eLand first) { EX void clear_euland(eLand first) {
euland.resize(max_vec); euland.resize(max_vec);
for(int i=0; i<max_vec; i++) euland[i] = laNone; for(int i=0; i<max_vec; i++) euland[i] = laNone;
if(!nonisotropic) euland[0] = euland[1] = euland[max_vec-1] = first; if(!nonisotropic && !hybri) euland[0] = euland[1] = euland[max_vec-1] = first;
euland3.clear(); euland3.clear();
euland3[0] = laCrossroads; euland3[0] = laCrossroads;
} }
bool valid_wall_at(int c) { bool valid_wall_at(int c) {
if(nonisotropic) return true; if(nonisotropic || hybri) return true;
return short(c) % 3 == 0; return short(c) % 3 == 0;
} }
@ -919,7 +920,7 @@ EX eLand switchable(eLand nearland, eLand farland, int c) {
else if(specialland == laCrossroads4) { else if(specialland == laCrossroads4) {
if((dual::state && nearland == laCrossroads4) || hrand(15) == 0) if((dual::state && nearland == laCrossroads4) || hrand(15) == 0)
return getNewLand(nearland); return getNewLand(nearland);
if(nearland == laCrossroads4 && nonisotropic) if(nearland == laCrossroads4 && (nonisotropic || hybri))
return getNewLand(nearland); return getNewLand(nearland);
return nearland; return nearland;
} }
@ -980,6 +981,38 @@ EX void setLandSol(cell *c) {
} }
EX void setLandHybrid(cell *c) { EX void setLandHybrid(cell *c) {
if(prod && product::product_sphere() && !among(specialland, laElementalWall)) {
auto w = hybrid::get_where(c);
auto d = w.second;
setland(c, specialland);
if(chaosmode) {
setland(c, getEuclidLand(c->master->distance));
return;
}
bool ps = PIU(pseudohept(w.first));
switch(specialland) {
case laCrossroads4: case laCrossroads: case laCrossroads2:
setland(c, getEuclidLand(d));
if(c->land == laBarrier) c->wall = ps ? waNone : waBarrier;
break;
case laTerracotta:
if((d & 15) == 1) {
setland(c, laMercuryRiver);
c->wall = ps ? waNone : waMercury;
}
break;
case laOcean: case laIvoryTower: case laEndorian: case laDungeon:
if(d < 0) setland(c, laCrossroads);
else if(d == 0) {
setland(c, laBarrier); c->wall = ps ? waNone : waBarrier;
}
else c->landparam = d;
break;
default: ;
}
return;
}
auto wc = hybrid::get_where(c).first; auto wc = hybrid::get_where(c).first;
c->barleft = wc->barleft; c->barleft = wc->barleft;
c->barright = wc->barright; c->barright = wc->barright;
@ -1643,7 +1676,7 @@ EX void moreBigStuff(cell *c) {
} }
else if((c->land == laRlyeh && !euclid) || c->land == laTemple) if(!(binarytiling && specialland != laTemple && c->land == laRlyeh)) { else if((c->land == laRlyeh && !euclid) || c->land == laTemple) if(!(binarytiling && specialland != laTemple && c->land == laRlyeh)) {
if(eubinary || (c->master->alt && (tactic::on || masterAlt(c) <= 2))) { if(eubinary || (prod && product::product_sphere()) || (c->master->alt && (tactic::on || masterAlt(c) <= 2))) {
if(!eubinary && !chaosmode) currentmap->generateAlts(c->master); if(!eubinary && !chaosmode) currentmap->generateAlts(c->master);
preventbarriers(c); preventbarriers(c);
int d = celldistAlt(c); int d = celldistAlt(c);
@ -1667,6 +1700,10 @@ EX void moreBigStuff(cell *c) {
else if(geometry == gKiteDart3) { else if(geometry == gKiteDart3) {
if(kite::getshape(c->master) == kite::pKite) c->wall = waColumn; if(kite::getshape(c->master) == kite::pKite) c->wall = waColumn;
} }
else if(prod && product::product_sphere()) {
auto d = hybrid::get_where(c);
if(!PIU(pseudohept(d.first))) c->wall = waColumn;
}
else if(hybri) { else if(hybri) {
auto d = hybrid::get_where(c); auto d = hybrid::get_where(c);
if(d.first->wall == waColumn || (d.second&1)) c->wall = waColumn; if(d.first->wall == waColumn || (d.second&1)) c->wall = waColumn;

View File

@ -462,6 +462,7 @@ static const int ALTDIST_ERROR = 90000;
EX int celldistAlt(cell *c) { EX int celldistAlt(cell *c) {
if(experimental) return 0; if(experimental) return 0;
if(hybri) { if(hybri) {
if(prod && product::product_sphere()) return hybrid::get_where(c).second;
auto w = hybrid::get_where(c); auto w = hybrid::get_where(c);
int d = c->master->alt && c->master->alt->alt ? c->master->alt->alt->fieldval : 0; int d = c->master->alt && c->master->alt->alt ? c->master->alt->alt->fieldval : 0;
d = sl2 ? 0 : abs(w.second - d); d = sl2 ? 0 : abs(w.second - d);

View File

@ -288,7 +288,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
c->wall = waPalace; c->wall = waPalace;
} }
if(d == 8 && sphere) { if(d == 8 && (sphere || (hybri && product::product_sphere()))) {
int gs = getHemisphere(c,0); int gs = getHemisphere(c,0);
if(NONSTDVAR) { if(NONSTDVAR) {
int v = 1; int v = 1;
@ -302,19 +302,31 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
else else
if(gs == 1) if(gs == 1)
c->wall = waPalace; c->wall = waPalace;
if(gs == 3) if(gs == 3) {
if(hybri) {
c->wall = pick(waClosedGate, waOpenGate);
if(c->wall == waClosedGate) toggleGates(c, waClosePlate, 1);
else toggleGates(c, waOpenPlate, 1);
}
else
c->wall = PURE ? waOpenGate : waClosedGate; c->wall = PURE ? waOpenGate : waClosedGate;
if(gs == 4 && hrand(100) < 40) }
if(gs == 4 && hrand(100) < 40 && !reptilecheat)
c->wall = waClosePlate; c->wall = waClosePlate;
if(gs == 6) if(gs == 6 && !reptilecheat)
c->wall = waOpenPlate; c->wall = waOpenPlate;
if(gs == -3) if(gs == -3 && !reptilecheat)
c->wall = pick(waClosePlate, waOpenPlate); c->wall = pick(waClosePlate, waOpenPlate);
if(gs == -6) if(gs == -6 && !reptilecheat)
c->wall = waTrapdoor; c->wall = waTrapdoor;
if(hybri) {
int l = hybrid::get_where(c).second;
if(gs >= 3 && (l % 4) == 0) c->wall = waPalace;
if(gs < 3 && (l % 4) == 2) c->wall = waPalace;
}
} }
if(d == 8 && !sphere) { else if(d == 8 && !sphere) {
if(prod && polarb50(c) && (hybrid::get_where(c).second & 3) == 2) { if(prod && polarb50(c) && (hybrid::get_where(c).second & 3) == 2) {
c->wall = waPalace; c->wall = waPalace;
@ -2693,7 +2705,7 @@ EX void setdist(cell *c, int d, cell *from) {
buildEquidistant(c); buildEquidistant(c);
} }
if(d <= 7 && (c->land == laGraveyard || c->land == laHauntedBorder)) { if(d <= 7 && (c->land == laGraveyard || c->land == laHauntedBorder) && !(hybri && product::product_sphere())) {
c->land = (c->landparam >= 1 && c->landparam <= HAUNTED_RADIUS) ? laHauntedBorder : laGraveyard; c->land = (c->landparam >= 1 && c->landparam <= HAUNTED_RADIUS) ? laHauntedBorder : laGraveyard;
} }

View File

@ -483,7 +483,8 @@ EX int getHemisphere(heptagon *h, int which) {
EX int getHemisphere(cell *c, int which) { EX int getHemisphere(cell *c, int which) {
if(euwrap) return 0; if(euwrap) return 0;
if(WDIM == 3) { if(hybri) { auto d = hybrid::get_where(c); return PIU(getHemisphere(d.first, which)); }
if(WDIM == 3 && !hybri) {
hyperpoint p = tC0(calc_relative_matrix(c, currentmap->gamestart(), C0)); hyperpoint p = tC0(calc_relative_matrix(c, currentmap->gamestart(), C0));
return int(p[which] * 6 + 10.5) - 10; return int(p[which] * 6 + 10.5) - 10;
} }