mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
altmap height now uses an outside parameter
This commit is contained in:
parent
83ffa89fbf
commit
8d913f525d
@ -156,10 +156,6 @@ namespace altmap {
|
|||||||
/** h->move(relspin(h->alt)) corresponds to h->alt->move(0) */
|
/** h->move(relspin(h->alt)) corresponds to h->alt->move(0) */
|
||||||
inline short& relspin(heptagon *alt) { return alt->zebraval; }
|
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 */
|
/** for Camelot, the radius */
|
||||||
inline short& radius(heptagon *alt) { return alt->emeraldval; }
|
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) */
|
/** the original land, for altmaps which may appear in multiple lands (Camelot) */
|
||||||
inline short& orig_land(heptagon *alt) { return alt->fiftyval; }
|
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
|
#endif
|
||||||
|
|
||||||
@ -302,7 +300,7 @@ EX heptagon *create_altmap(cell *c, int rad, hstate firststate, int special IS(0
|
|||||||
allmaps.push_back(newAltMap(alt));
|
allmaps.push_back(newAltMap(alt));
|
||||||
//printf("new alt {%p}\n", hr::voidp(alt));
|
//printf("new alt {%p}\n", hr::voidp(alt));
|
||||||
alt->s = firststate;
|
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;
|
alt->alt = alt;
|
||||||
if(!currentmap->link_alt(h, alt, firststate, bf.spin)) {
|
if(!currentmap->link_alt(h, alt, firststate, bf.spin)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
2
cell.cpp
2
cell.cpp
@ -548,7 +548,7 @@ EX int celldistAlt(cell *c) {
|
|||||||
if(hybri) {
|
if(hybri) {
|
||||||
if(in_s2xe()) return hybrid::get_where(c).second;
|
if(in_s2xe()) 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 ? 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);
|
d = sl2 ? 0 : abs(w.second - d);
|
||||||
PIU ( d += celldistAlt(w.first) );
|
PIU ( d += celldistAlt(w.first) );
|
||||||
return d;
|
return d;
|
||||||
|
@ -1061,6 +1061,8 @@ EX namespace hybrid {
|
|||||||
|
|
||||||
EX int disc_quotient = 0;
|
EX int disc_quotient = 0;
|
||||||
|
|
||||||
|
EX map<heptagon*, short> altmap_heights;
|
||||||
|
|
||||||
EX void configure(eGeometry g) {
|
EX void configure(eGeometry g) {
|
||||||
if(WDIM == 3) return;
|
if(WDIM == 3) return;
|
||||||
ray::reset_raycaster();
|
ray::reset_raycaster();
|
||||||
@ -1397,6 +1399,7 @@ EX namespace hybrid {
|
|||||||
auto clear_samples = addHook(hooks_clearmemory, 40, [] () {
|
auto clear_samples = addHook(hooks_clearmemory, 40, [] () {
|
||||||
for(auto& c: cgis) for(auto& v: c.second.walloffsets)
|
for(auto& c: cgis) for(auto& v: c.second.walloffsets)
|
||||||
v.second = nullptr;
|
v.second = nullptr;
|
||||||
|
altmap_heights.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
EX vector<pair<int, cell*>> gen_sample_list() {
|
EX vector<pair<int, cell*>> gen_sample_list() {
|
||||||
|
Loading…
Reference in New Issue
Block a user