1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-09-27 13:48:15 +00:00

linepatterns:: works with gp, uses computed constants rather than hardcoded ones, extra horocycle linepattern, Goldberg pattern added

This commit is contained in:
Zeno Rogue 2018-04-10 17:57:33 +02:00
parent 56fe281674
commit e41bc0b3b9
2 changed files with 70 additions and 41 deletions

View File

@ -1827,7 +1827,8 @@ namespace linepatterns {
patNormal, patNormal,
patTrihepta, patTrihepta,
patBigTriangles, patBigTriangles,
patBigRings patBigRings,
patHorocycles
}; };
void clearAll(); void clearAll();

View File

@ -1679,6 +1679,7 @@ namespace linepatterns {
{patPalacelike, "firewall lines", 0xFF400000}, {patPalacelike, "firewall lines", 0xFF400000},
{patPalace, "firewall lines: Palace", 0xFFD50000}, {patPalace, "firewall lines: Palace", 0xFFD50000},
{patPower, "firewall lines: Power", 0xFFFF0000}, {patPower, "firewall lines: Power", 0xFFFF0000},
{patHorocycles, "horocycles", 0xd060d000},
{0, NULL, 0} {0, NULL, 0}
}; };
@ -1729,7 +1730,7 @@ namespace linepatterns {
if(fv2/4 == 4 || fv2/4 == 6 || fv2/4 == 5 || fv2/4 == 10) fv2 ^= 2; if(fv2/4 == 4 || fv2/4 == 6 || fv2/4 == 5 || fv2/4 == 10) fv2 ^= 2;
if((fv1&1) == (fv2&1)) continue; if((fv1&1) == (fv2&1)) continue;
double x = sphere?.3651:euclid?.2611:.2849; double x = hexhexdist / 2; // sphere?.3651:euclid?.2611:.2849;
queueline(V * ddspin(c,i,-S14) * xpush0(x), queueline(V * ddspin(c,i,-S14) * xpush0(x),
V * ddspin(c,i,+S14) * xpush0(x), V * ddspin(c,i,+S14) * xpush0(x),
@ -1738,40 +1739,48 @@ namespace linepatterns {
break; break;
case patNormal: { case patNormal: {
double x = sphere?.401:euclid?.3 : .328; double x = hexvdist; // sphere?.401:euclid?.3 : .328;
if(euclid || !pseudohept(c)) for(int t=0; t<c->type; t++) if(gp::on) {
if(euclid ? c->mov[t]<c : (((t^1)&1) || c->mov[t] < c)) for(int t=0; t<c->type; t++)
if(c->mov[t] && c->mov[t] < c)
queueline(V * gp::get_corner_position(c, t),
V * gp::get_corner_position(c, (t+1)%c->type),
col, 1);
}
else if(euclid || !pseudohept(c)) for(int t=0; t<c->type; t++)
if(euclid ? c->mov[t]<c : (((t^1)&1) || c->mov[t] < c)) {
queueline(V * ddspin(c,t,-S7) * xpush0(x), queueline(V * ddspin(c,t,-S7) * xpush0(x),
V * ddspin(c,t,+S7) * xpush0(x), V * ddspin(c,t,+S7) * xpush0(x),
col, 1); col, 1);
}
break; break;
} }
case patTrihepta: case patTrihepta:
if(!pseudohept(c)) for(int i=0; i<6; i++) { if(gp::on) {
if(pseudohept(c)) for(int t=0; t<c->type; t++)
queueline(V * gp::get_corner_position(c, t%c->type, 2),
V * gp::get_corner_position(c, (t+1)%c->type, 2),
col, 1);
}
else {
if(!pseudohept(c)) for(int i=0; i<c->type; i++) {
cell *c2 = c->mov[i]; cell *c2 = c->mov[i];
if(!c2 || !pseudohept(c2)) continue; if(!c2 || !pseudohept(c2)) continue;
double x = sphere?.3651:euclid?.2611:.2849; double x = hexhexdist / 2; // sphere?.3651:euclid?.2611:.2849;
queueline(V * ddspin(c,i,-S14) * xpush0(x), queueline(V * ddspin(c,i,-S14) * xpush0(x),
V * ddspin(c,i,+S14) * xpush0(x), V * ddspin(c,i,+S14) * xpush0(x),
col, 1); col, 1);
} }
}
break; break;
case patTriNet: case patTriNet:
if(gp::on) {
if(c->master->c7 != c) if(gmatrix.count(c->mov[0]))
queueline(tC0(V), gmatrix[c->mov[0]]*C0,
darkena(backcolor ^ 0xFFFFFF, 0, col),
2);
}
else {
forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2)) if(celldist(c) != celldist(c2)) { forCellEx(c2, c) if(c2 > c) if(gmatrix.count(c2)) if(celldist(c) != celldist(c2)) {
queueline(tC0(V), gmatrix[c2]*C0, queueline(tC0(V), gmatrix[c2]*C0,
darkena(backcolor ^ 0xFFFFFF, 0, col), darkena(backcolor ^ 0xFFFFFF, 0, col),
2); 2);
} }
}
break; break;
case patTriRings: case patTriRings:
@ -1816,34 +1825,52 @@ namespace linepatterns {
break; break;
case patBigTriangles: { case patBigTriangles: {
if(pseudohept(c) && !euclid) for(int i=0; i<S7; i++) if(is_master(c) && !euclid) for(int i=0; i<S7; i++)
if(c->master->move[i] < c->master) { if(c->master->move[i] && c->master->move[i] < c->master) {
queueline(tC0(V), V*xspinpush0((nonbitrunc?M_PI:0) -2*M_PI*i/S7, tessf), col, 2); queueline(tC0(V), V*xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), tessf), col, 2);
} }
break; break;
} }
case patBigRings: { case patBigRings: {
if(pseudohept(c) && !euclid) for(int i=0; i<S7; i++) if(is_master(c) && !euclid) for(int i=0; i<S7; i++)
if(c->master->move[i] && c->master->move[i] < c->master && c->master->move[i]->dm4 == c->master->dm4) if(c->master->move[i] && c->master->move[i] < c->master && c->master->move[i]->dm4 == c->master->dm4)
queueline(tC0(V), V*xspinpush0((nonbitrunc?M_PI:0) -2*M_PI*i/S7, tessf), col, 2); queueline(tC0(V), V*xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), tessf), col, 2);
// V*xspinpush0((nonbitrunc?M_PI:0) -2*M_PI*i/S7
break; break;
} }
case patTree: case patTree:
if(ctof(c) && !euclid) if(is_master(c))
queueline(tC0(V), V*ddi0(nonbitrunc?S42:0, tessf), col, 2); queueline(tC0(V), V*xspinpush0(-master_to_c7_angle(), tessf), col, 2);
break;
case patHorocycles:
if(c->master->alt) {
int d = celldistAlt(c);
forCellEx(c2, c) if(c2 > c && c2->master->alt && celldistAlt(c2) == d && gmatrix.count(c2))
queueline(tC0(V), gmatrix[c2]*C0,
darkena(backcolor ^ 0xFFFFFF, 0, col),
2);
}
break; break;
case patAltTree: case patAltTree:
if(ctof(c) && !euclid && c->master->alt) { if(ctof(c) && !euclid && c->master->alt) {
for(int i=0; i<S7; i++) for(int i=0; i<S7; i++)
if(c->master->move[i] && c->master->move[i]->alt == c->master->alt->move[0]) if(c->master->move[i] && c->master->move[i]->alt == c->master->alt->move[0])
queueline(tC0(V), V*xspinpush0((nonbitrunc?M_PI:0) -2*M_PI*i/S7, tessf), col, 2); queueline(tC0(V), V*xspinpush0(-2*M_PI*i/S7-master_to_c7_angle(), tessf), col, 2);
} }
break; break;
case patVine: { case patVine: {
if(gp::on) {
if(c->master->c7 != c) if(gmatrix.count(c->mov[0]))
queueline(tC0(V), gmatrix[c->mov[0]]*C0,
darkena(backcolor ^ 0xFFFFFF, 0, col),
2);
}
else {
int p = emeraldval(c); int p = emeraldval(c);
double hdist = hdist0(heptmove[0] * heptmove[2] * C0); double hdist = hdist0(heptmove[0] * heptmove[2] * C0);
if(pseudohept(c) && (p/4 == 10 || p/4 == 8)) if(pseudohept(c) && (p/4 == 10 || p/4 == 8))
@ -1851,6 +1878,7 @@ namespace linepatterns {
queueline(tC0(V), V*tC0(heptmove[i]), col, 2); queueline(tC0(V), V*tC0(heptmove[i]), col, 2);
queueline(tC0(V), V*tC0(spin(-i * ALPHA) * xpush(-hdist/2)), col, 2); queueline(tC0(V), V*tC0(spin(-i * ALPHA) * xpush(-hdist/2)), col, 2);
} }
}
break; break;
} }
@ -1895,7 +1923,7 @@ namespace linepatterns {
dialog::init(XLAT("line patterns")); dialog::init(XLAT("line patterns"));
for(numpat=0; patterns[numpat].lpname; numpat++) for(numpat=0; patterns[numpat].lpname; numpat++)
dialog::addColorItem(XLAT(patterns[numpat].lpname), patterns[numpat].color, 'a'+numpat); dialog::addColorItem(patterns[numpat].id == patVine && gp::on ? XLAT("Goldberg") : XLAT(patterns[numpat].lpname), patterns[numpat].color, 'a'+numpat);
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("exit menu"), 'v'); dialog::addItem(XLAT("exit menu"), 'v');