better pseudohept in INVERSE tilings

This commit is contained in:
Zeno Rogue 2024-03-21 19:35:22 +01:00
parent e762da439c
commit 1b3aecc10c
3 changed files with 19 additions and 6 deletions

View File

@ -1441,11 +1441,17 @@ EX namespace gp {
return C0;
}
};
EX hrmap* new_inverse() { return new hrmap_inverse; }
hrmap_inverse* inv_map() { return (hrmap_inverse*)currentmap; }
EX bool inverse_pseudohept(cell *c) {
cell *c1 = inv_map()->mapping[c];
if(!c1) return false;
return UIU(pseudohept(c1));
}
EX hrmap* get_underlying_map() { return inv_map()->underlying_map; }
EX cell* get_mapped(cell *c) { return inv_map()->get_mapped(c, 0); }
EX int untruncated_shift(cell *c) { return inv_map()->shift[c]; }

View File

@ -1238,7 +1238,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
if(fargen) {
if(hrand(500) < 15)
createArrowTrapAt(c, laTerracotta);
if(pseudohept(c) && hrand(100) < 40 && c->wall == waNone && !racing::on) {
if(pseudohept_r(c) && hrand(100) < 40 && c->wall == waNone && !racing::on) {
c->wall = waTerraWarrior;
c->wparam = terracotta::randterra ? 0 : 3 + hrand(3);
if(hrand(100) < items[itTerra]-10)
@ -1521,7 +1521,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
if(fargen) {
if(randomPatternsMode)
c->wall = RANDPAT ? ((RANDPATV(laCrossroads) || RANDPATV(laCrossroads2)) ? waAncientGrave : waFreshGrave) : waNone;
else if(pseudohept(c))
else if(pseudohept_r(c))
c->wall = hrand(5) ? waAncientGrave : waFreshGrave;
}
ONEMPTY {
@ -1554,7 +1554,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
c->move(i)->wall = waNone;
}
}
if(pseudohept(c) && hrand(2)) c->wall = waColumn;
if(pseudohept_r(c) && hrand(2)) c->wall = waColumn;
}
}
ONEMPTY {
@ -2273,7 +2273,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
c->monst = moMonkey;
else if(hrand_monster(80000) < 5 + items[itRuby] + yendor::hardness())
c->monst = moEagle;
else if(pseudohept(c) && c != currentmap->gamestart() && hrand_monster(4000) < 300 + items[itRuby] && !c->monst) {
else if(pseudohept_r(c) && c != currentmap->gamestart() && hrand_monster(4000) < 300 + items[itRuby] && !c->monst) {
int hardchance = items[itRuby] + yendor::hardness();
if(hardchance > 25) hardchance = 25;
bool hardivy = hrand(100) < hardchance;

View File

@ -1493,7 +1493,7 @@ EX bool pseudohept(cell *c) {
#endif
if(arb::in()) return arb::pseudohept(c);
#if CAP_GP
if(INVERSE) return false;
if(INVERSE) return gp::inverse_pseudohept(c);
if(GOLDBERG && gp_threecolor() == 2)
return gp::pseudohept_val(c) == 0;
if(GOLDBERG && gp_threecolor() == 1 && (S7&1) && (S3 == 3))
@ -1502,6 +1502,13 @@ EX bool pseudohept(cell *c) {
return pattern_threecolor(c) == 0;
}
/** like pseudohept, but return randomly if no pseudohept is available */
EX bool pseudohept_r(cell *c) {
if(UNTRUNCATED || UNRECTIFIED)
return hrand(100) < 20;
return pseudohept(c);
}
// while Krakens movement is usually restricted to non-pseudohept cells,
// there is one special case when this does not work (because non-pseudohept cells have varying degrees)
EX bool kraken_pseudohept(cell *c) {