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

altmap height now uses an outside parameter

This commit is contained in:
Zeno Rogue 2021-07-30 15:31:33 +02:00
parent 83ffa89fbf
commit 8d913f525d
3 changed files with 7 additions and 6 deletions

View File

@ -156,10 +156,6 @@ namespace altmap {
/** h->move(relspin(h->alt)) corresponds to h->alt->move(0) */
inline short& relspin(heptagon *alt) { return alt->zebraval; }
/** in product geometries: the height of the center; call on alt->alt */
inline int hybrid_height(heptagon *alt) { return alt->fieldval; }
inline void set_hybrid_height(heptagon *alt, int z) { alt->fieldval = z; }
/** for Camelot, the radius */
inline short& radius(heptagon *alt) { return alt->emeraldval; }
@ -168,6 +164,8 @@ namespace altmap {
/** the original land, for altmaps which may appear in multiple lands (Camelot) */
inline short& orig_land(heptagon *alt) { return alt->fiftyval; }
/** NOTE: do not use fieldval, because it would conflict with the map generation for hrmap_h3_rule and hrmap_rulegen */
}
#endif
@ -302,7 +300,7 @@ EX heptagon *create_altmap(cell *c, int rad, hstate firststate, int special IS(0
allmaps.push_back(newAltMap(alt));
//printf("new alt {%p}\n", hr::voidp(alt));
alt->s = firststate;
if(hybri) altmap::set_hybrid_height(alt, hybrid::get_where(centerover).second);
if(hybri) hybrid::altmap_heights[alt] = hybrid::get_where(centerover).second;
alt->alt = alt;
if(!currentmap->link_alt(h, alt, firststate, bf.spin)) {
return nullptr;

View File

@ -548,7 +548,7 @@ EX int celldistAlt(cell *c) {
if(hybri) {
if(in_s2xe()) return hybrid::get_where(c).second;
auto w = hybrid::get_where(c);
int d = c->master->alt && c->master->alt->alt ? altmap::hybrid_height(c->master->alt->alt) : 0;
int d = c->master->alt && c->master->alt->alt ? hybrid::altmap_heights[c->master->alt->alt] : 0;
d = sl2 ? 0 : abs(w.second - d);
PIU ( d += celldistAlt(w.first) );
return d;

View File

@ -1061,6 +1061,8 @@ EX namespace hybrid {
EX int disc_quotient = 0;
EX map<heptagon*, short> altmap_heights;
EX void configure(eGeometry g) {
if(WDIM == 3) return;
ray::reset_raycaster();
@ -1397,6 +1399,7 @@ EX namespace hybrid {
auto clear_samples = addHook(hooks_clearmemory, 40, [] () {
for(auto& c: cgis) for(auto& v: c.second.walloffsets)
v.second = nullptr;
altmap_heights.clear();
});
EX vector<pair<int, cell*>> gen_sample_list() {