1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-12-17 19:48:06 +00:00

hybrid:: refactored the common parts of prod and sl2, also used them when applicable

This commit is contained in:
Zeno Rogue
2019-08-24 14:07:46 +02:00
parent ab80b28782
commit 1e6970ca28
20 changed files with 169 additions and 224 deletions

View File

@@ -2668,7 +2668,7 @@ EX namespace sword {
};
/** dimensions available to the Sword */
#define SWORDDIM ((prod || sl2) ? 2 : WDIM)
#define SWORDDIM (hybri ? 2 : WDIM)
#endif
@@ -2695,7 +2695,7 @@ EX namespace sword {
cell *pos2(cell *c, int s) {
int t = c->type;
if(prod || sl2) t -= 2;
if(hybri) t -= 2;
s *= 2;
s += sword_angles/t;
s %= (2 * sword_angles);
@@ -2748,7 +2748,7 @@ EX namespace sword {
int s2 = neighborId(c2, c1);
if(s1 < 0 || s2 < 0) return d;
if(SWORDDIM == 2) {
int sub = (prod || sl2) ? 2 : 0;
int sub = (hybri) ? 2 : 0;
int t2 = c2->type - sub;
int t1 = c1->type - sub;
if(c1->c.mirror(s1))
@@ -3397,7 +3397,7 @@ EX namespace windmap {
// cw.spin = 0;
neighbors.emplace_back();
auto &v = neighbors.back();
if(NONSTDVAR && !sphere && !archimedean && !prod)
if(NONSTDVAR && !sphere && !archimedean && !hybri)
for(int l=0; l<S7; l++) {
v.push_back(getId(cw + cth + l + wstep + cth));
}
@@ -3414,7 +3414,7 @@ EX namespace windmap {
if(N == 18920) precomp = windcodes18920;
if(N == 5676) precomp = windcodes5676;
if(precomp && (hyperbolic || prod) && isize(currfp.matrices)) {
if(precomp && (hyperbolic || hybri) && isize(currfp.matrices)) {
int randval = hrand(isize(currfp.matrices));
for(int i=0; i<N; i++)
windcodes[i] = precomp[getid[fieldpattern::fieldval_uniq_rand(samples[i].at, randval)]-1];