1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-05-13 12:44:08 +00:00

fixed some distlimit bugs

This commit is contained in:
Zeno Rogue 2025-05-11 12:02:24 +02:00
parent b527183128
commit bcfacd2e9f
4 changed files with 21 additions and 12 deletions

View File

@ -1499,9 +1499,6 @@ struct hrmap_arbi : hrmap {
transmatrix T = lxpush(.01241) * spin(1.4117) * lxpush(0.1241) * Id; transmatrix T = lxpush(.01241) * spin(1.4117) * lxpush(0.1241) * Id;
arbi_matrix[origin] = make_pair(alt, T); arbi_matrix[origin] = make_pair(alt, T);
altmap[alt].emplace_back(origin, T); altmap[alt].emplace_back(origin, T);
if(!current.range)
current.range = auto_compute_range(origin->c7);
} }
~hrmap_arbi() { ~hrmap_arbi() {
@ -1999,7 +1996,7 @@ EX void convert() {
ac.cscale = cgi.scalefactor; ac.cscale = cgi.scalefactor;
ac.boundary_ratio = 1; ac.boundary_ratio = 1;
ac.floor_scale = cgi.hexvdist / cgi.scalefactor; ac.floor_scale = cgi.hexvdist / cgi.scalefactor;
ac.range = cgi.base_distlimit; ac.range = getDistLimit();
ac.shapes.clear(); ac.shapes.clear();
ac.shapes.resize(N); ac.shapes.resize(N);

View File

@ -1764,6 +1764,24 @@ EX int auto_compute_range(cell *c) {
return ginf[geometry].distlimit[0] = cgi.base_distlimit = d; return ginf[geometry].distlimit[0] = cgi.base_distlimit = d;
} }
EX int getDistLimit() {
auto& res = cgi.base_distlimit;
if(res) return res;
if(arb::in() && arb::current.range)
return res = arb::current.range;
if(arcm::in() || arb::in()) {
if(!currentmap) return 0;
cell *c = currentmap->gamestart();
if(!c) return 0;
return res = auto_compute_range(c);
}
if(mhybrid)
return res = hybrid::in_underlying_geometry([&] {
return max(getDistLimit()-1, 0);
});
return ginf[geometry].distlimit[!BITRUNCATED];
}
EX cell out_of_bounds; EX cell out_of_bounds;
EX heptagon oob; EX heptagon oob;

View File

@ -111,8 +111,6 @@ EX eMonster active_switch() {
EX vector<cell*> crush_now, crush_next; EX vector<cell*> crush_now, crush_next;
EX int getDistLimit() { return cgi.base_distlimit; }
EX void activateFlashFrom(cell *cf, eMonster who, flagtype flags); EX void activateFlashFrom(cell *cf, eMonster who, flagtype flags);
EX bool saved_tortoise_on(cell *c) { EX bool saved_tortoise_on(cell *c) {

View File

@ -218,7 +218,7 @@ struct geometry_information {
/** for 2D geometries */ /** for 2D geometries */
vector<transmatrix> heptmove, hexmove, invhexmove; vector<transmatrix> heptmove, hexmove, invhexmove;
int base_distlimit; int base_distlimit = 0;
unique_ptr<embedding_method> emb; unique_ptr<embedding_method> emb;
@ -658,7 +658,6 @@ void geometry_information::prepare_basics() {
t->tessf = cgi.tessf / d; t->tessf = cgi.tessf / d;
t->hexvdist = cgi.hexvdist / d; t->hexvdist = cgi.hexvdist / d;
t->hexhexdist = hdist(xpush0(cgi.hcrossf), xspinpush0(TAU/S7, cgi.hcrossf)) / d; t->hexhexdist = hdist(xpush0(cgi.hcrossf), xspinpush0(TAU/S7, cgi.hcrossf)) / d;
t->base_distlimit = cgi.base_distlimit-1;
}); });
goto hybrid_finish; goto hybrid_finish;
} }
@ -756,8 +755,6 @@ void geometry_information::prepare_basics() {
(hr::format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift, (hr::format("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift,
hexhexdist, hexvdist))); hexhexdist, hexvdist)));
base_distlimit = ginf[geometry].distlimit[!BITRUNCATED];
hybrid_finish: hybrid_finish:
#if CAP_GP #if CAP_GP
@ -823,7 +820,6 @@ void geometry_information::prepare_basics() {
scalefactor = csc; scalefactor = csc;
hcrossf = crossf = orbsize = hcrossf7 * csc; hcrossf = crossf = orbsize = hcrossf7 * csc;
hexf = rhexf = hexvdist = csc * arb::current_or_slided().floor_scale; hexf = rhexf = hexvdist = csc * arb::current_or_slided().floor_scale;
base_distlimit = arb::current.range;
} }
#if MAXMDIM >= 4 #if MAXMDIM >= 4