1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-16 10:19:58 +00:00

functions with rotation parameters in S84-degree system have been removed or replaced in radian versions

This commit is contained in:
Zeno Rogue 2018-08-19 15:52:39 +02:00
parent 5384ce3274
commit 453c06f9f9
10 changed files with 95 additions and 121 deletions

View File

@ -35,10 +35,6 @@ escher_floorshape shStarFloor(1,2),
shRedRockFloor[3] = {{55, 56}, {55, 56}, {55, 56}}, // 1 - .1 * i shRedRockFloor[3] = {{55, 56}, {55, 56}, {55, 56}}, // 1 - .1 * i
shDragonFloor(181, 182, 2, 183); /* dragon */ shDragonFloor(181, 182, 2, 183); /* dragon */
hyperpoint adist(ld a, ld x) {
return spin(a) * xpush(x) * C0;
}
typedef pair<transmatrix, array<transmatrix, MAX_EDGE>> matrixitem; typedef pair<transmatrix, array<transmatrix, MAX_EDGE>> matrixitem;
struct mesher { struct mesher {
@ -59,10 +55,10 @@ mesher msh(eGeometry g, int sym, ld main, ld v0, ld v1, ld bspi, ld scale) {
hyperpoint bnlfar = xpush(v0) * spin(M_PI) * rspintox(rot) * rspintox(rot) * rspintox(rot) * xpush(hdist0(rot)) * C0; hyperpoint bnlfar = xpush(v0) * spin(M_PI) * rspintox(rot) * rspintox(rot) * rspintox(rot) * xpush(hdist0(rot)) * C0;
hyperpoint bnrfar = xpush(v0) * spin(M_PI) * spintox(rot) * spintox(rot) * spintox(rot) * xpush(hdist0(rot)) * C0; hyperpoint bnrfar = xpush(v0) * spin(M_PI) * spintox(rot) * spintox(rot) * spintox(rot) * xpush(hdist0(rot)) * C0;
m.lcorner = adist (bspi-M_PI/sym, main); m.lcorner = xspinpush0 (bspi-M_PI/sym, main);
m.rcorner = adist (bspi+M_PI/sym, main); m.rcorner = xspinpush0 (bspi+M_PI/sym, main);
m.mfar[0] = adist (bspi, v0); m.mfar[0] = xspinpush0 (bspi, v0);
m.mfar[1] = adist (bspi, v1); m.mfar[1] = xspinpush0 (bspi, v1);
m.vfar[0] = spin(bspi) * bnlfar; m.vfar[0] = spin(bspi) * bnlfar;
m.vfar[2] = spin(bspi) * bnrfar; m.vfar[2] = spin(bspi) * bnrfar;
m.vfar[1] = spin(-2*M_PI/sym) * m.vfar[2]; m.vfar[1] = spin(-2*M_PI/sym) * m.vfar[2];

View File

@ -25,15 +25,8 @@ hyperpoint Crad[MAX_S84];
transmatrix heptmove[MAX_EDGE], hexmove[MAX_EDGE]; transmatrix heptmove[MAX_EDGE], hexmove[MAX_EDGE];
transmatrix invheptmove[MAX_EDGE], invhexmove[MAX_EDGE]; transmatrix invheptmove[MAX_EDGE], invhexmove[MAX_EDGE];
transmatrix spinmatrix[MAX_S84];
ld hexshift; ld hexshift;
const transmatrix& getspinmatrix(int id) {
id = (id + MODFIXER) % S84;
return spinmatrix[id];
}
// the results are: // the results are:
// hexf = 0.378077 hcrossf = 0.620672 tessf = 1.090550 // hexf = 0.378077 hcrossf = 0.620672 tessf = 1.090550
// hexhexdist = 0.566256 // hexhexdist = 0.566256
@ -167,8 +160,6 @@ void precalc() {
printf("S7=%d S6=%d hexf = " LDF" hcross = " LDF" tessf = " LDF" hexshift = " LDF " hexhex = " LDF " hexv = " LDF "\n", S7, S6, hexf, hcrossf, tessf, hexshift, printf("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);
for(int i=0; i<S84; i++) spinmatrix[i] = spin(i * M_PI / S42);
base_distlimit = ginf[geometry].distlimit[nonbitrunc]; base_distlimit = ginf[geometry].distlimit[nonbitrunc];
gp::compute_geometry(); gp::compute_geometry();
@ -176,18 +167,11 @@ void precalc() {
if(syntetic) synt::prepare(); if(syntetic) synt::prepare();
} }
transmatrix ddi(ld dir, ld dist) { transmatrix xspinpush(ld dir, ld dist) {
if(euclid) if(euclid)
return eupush(cos(M_PI*dir/S42) * dist, -sin(M_PI*dir/S42) * dist); return eupush(cos(dir) * dist, -sin(dir) * dist);
else else
return spin(M_PI*dir/S42) * xpush(dist) * spin(-M_PI*dir/S42); return spin(dir) * xpush(dist) * spin(-dir);
}
hyperpoint ddi0(ld dir, ld dist) {
if(euclid)
return hpxy(cos(M_PI*dir/S42) * dist, -sin(M_PI*dir/S42) * dist);
else
return xspinpush0(M_PI*dir/S42, dist);
} }
namespace geom3 { namespace geom3 {

View File

@ -350,7 +350,7 @@ double cellgfxdist(cell *c, int i) {
transmatrix cellrelmatrix(cell *c, int i) { transmatrix cellrelmatrix(cell *c, int i) {
if(gp::on) return calc_relative_matrix(c->move(i), c, i); if(gp::on) return calc_relative_matrix(c->move(i), c, i);
double d = cellgfxdist(c, i); double d = cellgfxdist(c, i);
return ddspin(c, i) * xpush(d) * iddspin(c->move(i), c->c.spin(i), euclid ? 0 : S42); return ddspin(c, i) * xpush(d) * iddspin(c->move(i), c->c.spin(i), euclid ? 0 : M_PI);
} }
double randd() { return (rand() + .5) / (RAND_MAX + 1.); } double randd() { return (rand() + .5) / (RAND_MAX + 1.); }
@ -395,13 +395,13 @@ hyperpoint get_corner_position(cell *c, int cid, ld cf) {
return spin(-t.first) * xpush(t.second * 3 / cf) * C0; return spin(-t.first) * xpush(t.second * 3 / cf) * C0;
} }
if(nonbitrunc) { if(nonbitrunc) {
return ddspin(c,cid,S6) * xpush0(hcrossf * 3 / cf); return ddspin(c,cid,M_PI/S7) * xpush0(hcrossf * 3 / cf);
} }
if(!nonbitrunc) { if(!nonbitrunc) {
if(!ishept(c)) if(!ishept(c))
return ddspin(c,cid,S7) * xpush0(hexvdist * 3 / cf); return ddspin(c,cid,M_PI/S6) * xpush0(hexvdist * 3 / cf);
else else
return ddspin(c,cid,S6) * xpush0(rhexf * 3 / cf); return ddspin(c,cid,M_PI/S7) * xpush0(rhexf * 3 / cf);
} }
return C0; return C0;
} }
@ -517,7 +517,7 @@ hyperpoint farcorner(cell *c, int i, int which) {
hyperpoint get_warp_corner(cell *c, int cid) { hyperpoint get_warp_corner(cell *c, int cid) {
if(gp::on) return gp::get_corner_position(c, cid, 2); if(gp::on) return gp::get_corner_position(c, cid, 2);
if(irr::on) return midcorner(c, cid, .5); if(irr::on) return midcorner(c, cid, .5);
return ddspin(c,cid,S6) * xpush0(tessf/2); return ddspin(c,cid,M_PI/S7) * xpush0(tessf/2);
} }
} }

128
graph.cpp
View File

@ -140,7 +140,7 @@ void drawShield(const transmatrix& V, eItem it) {
double d = it == itOrbShield ? hexf : hexf - .1; double d = it == itOrbShield ? hexf : hexf - .1;
int mt = sphere ? 7 : 5; int mt = sphere ? 7 : 5;
for(ld a=0; a<=S84*mt+1e-6; a+=pow(.5, vid.linequality)) for(ld a=0; a<=S84*mt+1e-6; a+=pow(.5, vid.linequality))
curvepoint(V*ddi0(a, d + sin(ds + M_PI*2*a/4/mt)*.1)); curvepoint(V*xspinpush0(a * M_PI/S42, d + sin(ds + M_PI*2*a/4/mt)*.1));
queuecurve(darkena(col, 0, 0xFF), 0x8080808, PPR_LINE); queuecurve(darkena(col, 0, 0xFF), 0x8080808, PPR_LINE);
#endif #endif
} }
@ -151,7 +151,7 @@ void drawSpeed(const transmatrix& V) {
int col = darkena(iinf[itOrbSpeed].color, 0, 0xFF); int col = darkena(iinf[itOrbSpeed].color, 0, 0xFF);
for(int b=0; b<S84; b+=S14) { for(int b=0; b<S84; b+=S14) {
PRING(a) PRING(a)
curvepoint(V*ddi0(ds+b+a, hexf*a/S84)); curvepoint(V*xspinpush0((ds+b+a) * M_PI/S42, hexf*a/S84));
queuecurve(col, 0x8080808, PPR_LINE); queuecurve(col, 0x8080808, PPR_LINE);
} }
#endif #endif
@ -176,7 +176,7 @@ void drawSafety(const transmatrix& V, int ct) {
ld ds = ticks / 50.; ld ds = ticks / 50.;
int col = darkena(iinf[itOrbSafety].color, 0, 0xFF); int col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
for(int a=0; a<ct; a++) for(int a=0; a<ct; a++)
queueline(V*ddi0(ds+a*S84/ct, 2*hexf), V*ddi0(ds+(a+(ct-1)/2)*S84/ct, 2*hexf), col, vid.linequality); queueline(V*xspinpush0((ds+a*S84/ct) * M_PI/S42, 2*hexf), V*xspinpush0((ds+(a+(ct-1)/2)*S84/ct) * M_PI / S42, 2*hexf), col, vid.linequality);
#endif #endif
} }
@ -187,7 +187,7 @@ void drawFlash(const transmatrix& V) {
col &= ~1; col &= ~1;
for(int u=0; u<5; u++) { for(int u=0; u<5; u++) {
ld rad = hexf * (2.5 + .5 * sin(ds+u*.3)); ld rad = hexf * (2.5 + .5 * sin(ds+u*.3));
PRING(a) curvepoint(V*ddi0(a, rad)); PRING(a) curvepoint(V*xspinpush0(a * M_PI / S42, rad));
queuecurve(col, 0x8080808, PPR_LINE); queuecurve(col, 0x8080808, PPR_LINE);
} }
#endif #endif
@ -205,20 +205,20 @@ void drawLove(const transmatrix& V, int hdir) {
if(z <= 10) d += (10-z) * (10-z) * (10-z) / 3000.; if(z <= 10) d += (10-z) * (10-z) * (10-z) / 3000.;
ld rad = hexf * (2.5 + .5 * sin(ds+u*.3)) * d; ld rad = hexf * (2.5 + .5 * sin(ds+u*.3)) * d;
curvepoint(V*ddi0(S42+hdir+a-1, rad)); curvepoint(V*xspinpush0((S42+hdir+a-1) * M_PI/S42, rad));
} }
queuecurve(col, 0x8080808, PPR_LINE); queuecurve(col, 0x8080808, PPR_LINE);
} }
#endif #endif
} }
void drawWinter(const transmatrix& V, int hdir) { void drawWinter(const transmatrix& V, ld hdir) {
#if CAP_QUEUE #if CAP_QUEUE
float ds = ticks / 300.; float ds = ticks / 300.;
int col = darkena(iinf[itOrbWinter].color, 0, 0xFF); int col = darkena(iinf[itOrbWinter].color, 0, 0xFF);
for(int u=0; u<20; u++) { for(int u=0; u<20; u++) {
ld rad = 6 * sin(ds+u * 2 * M_PI / 20); ld rad = sin(ds+u * 2 * M_PI / 20) * M_PI / S7;
queueline(V*ddi0(S42+hdir+rad, hexf*.5), V*ddi0(S42+hdir+rad, hexf*3), col, 2 + vid.linequality); queueline(V*xspinpush0(M_PI+hdir+rad, hexf*.5), V*xspinpush0(M_PI+hdir+rad, hexf*3), col, 2 + vid.linequality);
} }
#endif #endif
} }
@ -228,35 +228,34 @@ void drawLightning(const transmatrix& V) {
int col = darkena(iinf[itOrbLightning].color, 0, 0xFF); int col = darkena(iinf[itOrbLightning].color, 0, 0xFF);
for(int u=0; u<20; u++) { for(int u=0; u<20; u++) {
ld leng = 0.5 / (0.1 + (rand() % 100) / 100.0); ld leng = 0.5 / (0.1 + (rand() % 100) / 100.0);
ld rad = rand() % S84; ld rad = rand() % 1000;
queueline(V*ddi0(rad, hexf*0.3), V*ddi0(rad, hexf*leng), col, 2 + vid.linequality); queueline(V*xspinpush0(rad, hexf*0.3), V*xspinpush0(rad, hexf*leng), col, 2 + vid.linequality);
} }
#endif #endif
} }
int displaydir(cell *c, int d) { ld displayspin(cell *c, int d) {
if(syntetic) { if(syntetic) {
auto& t1 = synt::get_triangle(c->master, d); auto& t1 = synt::get_triangle(c->master, d);
auto p = spin(-t1.first + M_PI / c->type) * xpush(t1.second) * C0; return t1.first + M_PI / c->type;
return -int(atan2(p[1], p[0]) * S84 / 2 / M_PI + .5);
} }
else if(irr::on) { else if(irr::on) {
auto id = irr::cellindex[c]; auto id = irr::cellindex[c];
auto& vs = irr::cells[id]; auto& vs = irr::cells[id];
if(d < 0 || d >= c->type) return 0; if(d < 0 || d >= c->type) return 0;
auto& p = vs.jpoints[vs.neid[d]]; auto& p = vs.jpoints[vs.neid[d]];
return -int(atan2(p[1], p[0]) * S84 / 2 / M_PI + .5); return -atan2(p[1], p[0]);
} }
else if(binarytiling) { else if(binarytiling) {
if(d == NODIR) return 0; if(d == NODIR) return 0;
if(d == c->type-1) d++; if(d == c->type-1) d++;
int dirs[8] = {0, 11, 21, 31, 42, 53, 63, 73}; int dirs[8] = {0, 11, 21, 31, 42, 53, 63, 73};
return -21-dirs[d]; return (-21-dirs[d]) * 42 / M_PI;
} }
else if(masterless) else if(masterless)
return - d * S84 / c->type; return - d * 2 * M_PI / c->type;
else else
return S42 - d * S84 / c->type; return M_PI - d * 2 * M_PI / c->type;
} }
double hexshiftat(cell *c) { double hexshiftat(cell *c) {
@ -267,18 +266,12 @@ double hexshiftat(cell *c) {
return 0; return 0;
} }
transmatrix ddspin(cell *c, int d, int bonus) { transmatrix ddspin(cell *c, int d, ld bonus) {
int hdir = displaydir(c, d) + bonus; return spin(displayspin(c, d) + bonus - hexshiftat(c));
double ha = hexshiftat(c);
if(ha) return spin(-ha) * getspinmatrix(hdir);
return getspinmatrix(hdir);
} }
transmatrix iddspin(cell *c, int d, int bonus) { transmatrix iddspin(cell *c, int d, ld bonus) {
int hdir = displaydir(c, d) + bonus; return spin(hexshiftat(c) - displayspin(c, d) + bonus);
double ha = hexshiftat(c);
if(ha) return spin(ha) * getspinmatrix(-hdir);
return getspinmatrix(-hdir);
} }
void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) { void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
@ -307,7 +300,7 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
int& ang = angle[multi::cpid]; int& ang = angle[multi::cpid];
ang %= S42; ang %= S42;
transmatrix Vnow = gmatrix[c] * rgpushxto0(inverse(gmatrix[c]) * tC0(V)) * (irr::on ? ddspin(c,0,S42) : spin(-hexshiftat(c))); transmatrix Vnow = gmatrix[c] * rgpushxto0(inverse(gmatrix[c]) * tC0(V)) * (irr::on ? ddspin(c,0,M_PI) : spin(-hexshiftat(c)));
#if CAP_QUEUE #if CAP_QUEUE
if(!masterless) for(int a=0; a<S42; a++) { if(!masterless) for(int a=0; a<S42; a++) {
@ -317,7 +310,7 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
if((a+S21)%S42 == ang && items[itOrbSword2]) continue; if((a+S21)%S42 == ang && items[itOrbSword2]) continue;
bool longer = sword::pos(cwt.at, a-1) != sword::pos(cwt.at, a+1); bool longer = sword::pos(cwt.at, a-1) != sword::pos(cwt.at, a+1);
int col = darkena(0xC0C0C0, 0, 0xFF); int col = darkena(0xC0C0C0, 0, 0xFF);
queueline(Vnow*ddi0(dda, nonbitrunc ? 0.6 * gp::scale : longer ? 0.36 : 0.4), Vnow*ddi0(dda, nonbitrunc ? 0.7 * gp::scale : longer ? 0.44 : 0.42), col, 1); queueline(Vnow*xspinpush0(dda * M_PI / S42, nonbitrunc ? 0.6 * gp::scale : longer ? 0.36 : 0.4), Vnow*xspinpush0(dda * M_PI/S42, nonbitrunc ? 0.7 * gp::scale : longer ? 0.44 : 0.42), col, 1);
} }
#endif #endif
@ -349,7 +342,7 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
ld rad = hexf * u / 250; ld rad = hexf * u / 250;
int col = darkena(iinf[itOrbSafety].color, 0, 0xFF); int col = darkena(iinf[itOrbSafety].color, 0, 0xFF);
PRING(a) PRING(a)
curvepoint(V*ddi0(a, rad)); curvepoint(V*xspinpush0(a * M_PI / S42, rad));
queuecurve(col, 0, PPR_LINE); queuecurve(col, 0, PPR_LINE);
} }
} }
@ -1762,9 +1755,9 @@ double chainAngle(cell *c, transmatrix& V, cell *c2, double dft, const transmatr
} }
// equivalent to V = V * spin(-chainAngle(c,V,c2,dft)); // equivalent to V = V * spin(-chainAngle(c,V,c2,dft));
bool chainAnimation(cell *c, transmatrix& V, cell *c2, int i, int b, const transmatrix &Vwhere, ld& length) { bool chainAnimation(cell *c, transmatrix& V, cell *c2, int i, ld bonus, const transmatrix &Vwhere, ld& length) {
if(!gmatrix0.count(c2)) { if(!gmatrix0.count(c2)) {
V = V * ddspin(c,i,b); V = V * ddspin(c,i,bonus);
length = cellgfxdist(c,i); length = cellgfxdist(c,i);
return false; return false;
} }
@ -1935,10 +1928,10 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
} }
else { else {
int hdir = displaydir(c, c->mondir); int hdir = displayspin(c, c->mondir);
int col = darkena(0x606020, 0, 0xFF); int col = darkena(0x606020, 0, 0xFF);
for(int u=-1; u<=1; u++) for(int u=-1; u<=1; u++)
queueline(Vparam*ddi0(hdir+S21, u*crossf/5), Vparam*ddi(hdir, crossf)*ddi0(hdir+S21, u*crossf/5), col, 2 + vid.linequality); queueline(Vparam*xspinpush0(hdir+M_PI/2, u*crossf/5), Vparam*xspinpush(hdir, crossf)*xspinpush0(hdir+M_PI/2, u*crossf/5), col, 2 + vid.linequality);
} }
} }
@ -1984,7 +1977,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
Vb = Vb * pispin; Vb = Vb * pispin;
} }
else { else {
Vb = Vb0 * ddspin(c, nd, S42); Vb = Vb0 * ddspin(c, nd, M_PI);
} }
transmatrix Vbb = mmscale(Vb, geom3::ABODY); transmatrix Vbb = mmscale(Vb, geom3::ABODY);
queuepoly(Vbb, shDragonTail, darkena(col, c->hitpoints?0:1, 0xFF)); queuepoly(Vbb, shDragonTail, darkena(col, c->hitpoints?0:1, 0xFF));
@ -1995,16 +1988,16 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
ld length; ld length;
chainAnimation(c, Vb, c2, nd, 0, Vparam, length); chainAnimation(c, Vb, c2, nd, 0, Vparam, length);
Vb = Vb * pispin; Vb = Vb * pispin;
double ang = chainAngle(c, Vb, c->move(c->mondir), (displaydir(c, c->mondir) - displaydir(c, nd)) * M_PI / S42, Vparam); double ang = chainAngle(c, Vb, c->move(c->mondir), displayspin(c, c->mondir) - displayspin(c, nd), Vparam);
ang /= 2; ang /= 2;
Vb = Vb * spin(M_PI-ang); Vb = Vb * spin(M_PI-ang);
} }
else { else {
int hdir0 = displaydir(c, nd) + S42; ld hdir0 = displayspin(c, nd) + M_PI;
int hdir1 = displaydir(c, c->mondir); ld hdir1 = displayspin(c, c->mondir);
while(hdir1 > hdir0 + S42) hdir1 -= S84; while(hdir1 > hdir0 + M_PI) hdir1 -= 2*M_PI;
while(hdir1 < hdir0 - S42) hdir1 += S84; while(hdir1 < hdir0 - M_PI) hdir1 += 2*M_PI;
Vb = Vb0 * spin((hdir0 + hdir1)/2 * M_PI / S42 + M_PI); Vb = Vb0 * spin((hdir0 + hdir1)/2 + M_PI);
} }
transmatrix Vbb = mmscale(Vb, geom3::ABODY); transmatrix Vbb = mmscale(Vb, geom3::ABODY);
if(part == 'l' || part == '2') { if(part == 'l' || part == '2') {
@ -2030,7 +2023,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
Vb = Vb * pispin; Vb = Vb * pispin;
} }
else { else {
Vb = Vb0 * ddspin(c, nd, S42); Vb = Vb0 * ddspin(c, nd, M_PI);
} }
transmatrix Vbb = mmscale(Vb, geom3::ABODY) * pispin; transmatrix Vbb = mmscale(Vb, geom3::ABODY) * pispin;
hpcshape& sh = hexsnake ? shWormTail : shSmallWormTail; hpcshape& sh = hexsnake ? shWormTail : shSmallWormTail;
@ -2119,7 +2112,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
Vb = Vb * T * rspintox(tC0(inverse(T))) * xpush(tentacle_length); Vb = Vb * T * rspintox(tC0(inverse(T))) * xpush(tentacle_length);
} }
else { else {
Vb = Vb * ddspin(c, c->mondir, S42); Vb = Vb * ddspin(c, c->mondir, M_PI);
Vb = Vb * xpush(tentacle_length - cellgfxdist(c, c->mondir)); Vb = Vb * xpush(tentacle_length - cellgfxdist(c, c->mondir));
} }
@ -2134,7 +2127,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) {
else if(isFriendly(c) || isBug(c) || (c->monst && conformal::on) || c->monst == moKrakenH || (isBull(c->monst) && c->mondir != NODIR) || c->monst == moButterfly || isMagneticPole(c->monst) || else if(isFriendly(c) || isBug(c) || (c->monst && conformal::on) || c->monst == moKrakenH || (isBull(c->monst) && c->mondir != NODIR) || c->monst == moButterfly || isMagneticPole(c->monst) ||
isSwitch(c->monst) || c->monst == moPair || (c->monst && (quotient || torus || dont_face_pc))) { isSwitch(c->monst) || c->monst == moPair || (c->monst && (quotient || torus || dont_face_pc))) {
if(c->monst == moKrakenH) Vs = Vb, nospins = nospinb; if(c->monst == moKrakenH) Vs = Vb, nospins = nospinb;
if(!nospins) Vs = Vs * ddspin(c, c->mondir, S42); if(!nospins) Vs = Vs * ddspin(c, c->mondir, M_PI);
if(c->monst == moPair) Vs = Vs * xpush(-.12); if(c->monst == moPair) Vs = Vs * xpush(-.12);
if(isFriendly(c)) drawPlayerEffects(Vs, c, false); if(isFriendly(c)) drawPlayerEffects(Vs, c, false);
return drawMonsterTypeDH(m, c, Vs, col, darkhistory, footphase); return drawMonsterTypeDH(m, c, Vs, col, darkhistory, footphase);
@ -2396,14 +2389,14 @@ int countMinesAround(cell *c) {
transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si) { transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si) {
if(gp::on || irr::on || binarytiling) return Id; if(gp::on || irr::on || binarytiling) return Id;
transmatrix V = ddspin(c, si.dir, S42); transmatrix V = ddspin(c, si.dir, M_PI);
if(si.reflect) return V * Mirror; if(si.reflect) return V * Mirror;
if(syntetic) return V * iddspin(c, 0, S42); if(syntetic) return V * iddspin(c, 0, M_PI);
return V; return V;
} }
transmatrix applyDowndir(cell *c, cellfunction *cf) { transmatrix applyDowndir(cell *c, cellfunction *cf) {
return ddspin(c, patterns::downdir(c, cf), S42); return ddspin(c, patterns::downdir(c, cf), M_PI);
} }
void set_towerfloor(cell *c, cellfunction *cf = coastvalEdge) { void set_towerfloor(cell *c, cellfunction *cf = coastvalEdge) {
@ -3399,7 +3392,7 @@ void draw_wall(cell *c, const transmatrix& V, int wcol, int& zcol, int ct6, int
int hdir = 0; int hdir = 0;
for(int i=0; i<c->type; i++) if(c->move(i)->wall == waClosedGate) for(int i=0; i<c->type; i++) if(c->move(i)->wall == waClosedGate)
hdir = i; hdir = i;
transmatrix V2 = mscale(V, wmspatial?geom3::WALL:1) * ddspin(c, hdir, S42); transmatrix V2 = mscale(V, wmspatial?geom3::WALL:1) * ddspin(c, hdir, M_PI);
queuepolyat(V2, shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR_WALL3A:PPR_WALL); queuepolyat(V2, shPalaceGate, darkena(wcol, 0, 0xFF), wmspatial?PPR_WALL3A:PPR_WALL);
starcol = 0; starcol = 0;
} }
@ -3522,7 +3515,6 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
} }
else { else {
playerV = V * ddspin(c, cwt.spin); playerV = V * ddspin(c, cwt.spin);
// playerV = V * spin(displaydir(c, cwt.spin) * M_PI/S42);
if(cwt.mirrored) playerV = playerV * Mirror; if(cwt.mirrored) playerV = playerV * Mirror;
if(orig) cwtV = playerV; if(orig) cwtV = playerV;
} }
@ -3665,7 +3657,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
ld rad = hexf * (.3 * u + (ds%1000) * .0003); ld rad = hexf * (.3 * u + (ds%1000) * .0003);
int tcol = darkena(gradient(forecolor, backcolor, 0, rad, 1.5 * hexf), 0, 0xFF); int tcol = darkena(gradient(forecolor, backcolor, 0, rad, 1.5 * hexf), 0, 0xFF);
PRING(a) PRING(a)
curvepoint(V*ddi0(a, rad)); curvepoint(V*xspinpush0(a * M_PI / S42, rad));
queuecurve(tcol, 0, PPR_LINE); queuecurve(tcol, 0, PPR_LINE);
} }
} }
@ -3732,9 +3724,9 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
if(tim > 1000) tim = 800; if(tim > 1000) tim = 800;
if(elec::havecharge && tim > 400) tim = 400; if(elec::havecharge && tim > 400) tim = 400;
for(int t=0; t<c->type; t++) if(c->move(t) && c->move(t)->ligon) { for(int t=0; t<c->type; t++) if(c->move(t) && c->move(t)->ligon) {
int hdir = displaydir(c, t); ld hdir = displayspin(c, t);
int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF); int lcol = darkena(gradient(iinf[itOrbLightning].color, 0, 0, tim, 1100), 0, 0xFF);
queueline(V*ddi0(ticks, hexf/2), V*ddi0(hdir, crossf), lcol, 2 + vid.linequality); queueline(V*xspinpush0(ticks * M_PI / S42, hexf/2), V*xspinpush0(hdir, crossf), lcol, 2 + vid.linequality);
} }
} }
@ -3843,7 +3835,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
queuepolyat(V2, shHalfMirror[2], 0xC0C0C080, PPR_WALL3); queuepolyat(V2, shHalfMirror[2], 0xC0C0C080, PPR_WALL3);
} }
else { else {
qfi.spin = ddspin(c, d, S42); qfi.spin = ddspin(c, d, M_PI);
transmatrix V2 = V * qfi.spin; transmatrix V2 = V * qfi.spin;
if(!wmblack) { if(!wmblack) {
inmirrorcount++; inmirrorcount++;
@ -3868,7 +3860,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
for(int t=0;t<6; t++) if(c->move(t) && c->move(t)->wall == c->wall) for(int t=0;t<6; t++) if(c->move(t) && c->move(t)->wall == c->wall)
i = t; i = t;
qfi.spin = ddspin(c, i, S14); qfi.spin = ddspin(c, i, M_PI/S3);
transmatrix V2 = V * qfi.spin; transmatrix V2 = V * qfi.spin;
if(wmspatial && wmescher) { if(wmspatial && wmescher) {
@ -4048,8 +4040,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
case laSwitch: case laSwitch:
set_floor(shSwitchFloor); set_floor(shSwitchFloor);
if(ctof(c) && !gp::on && !irr::on) for(int i=0; i<c->type; i++) if(ctof(c) && !gp::on && !irr::on && !syntetic && !binarytiling) for(int i=0; i<c->type; i++)
queuepoly(Vf * ddspin(c, i, S6) * xpush(rhexf), shSwitchDisk, darkena(minf[active_switch()].color, fd, 0xFF)); queuepoly(Vf * ddspin(c, i, M_PI/S7) * xpush(rhexf), shSwitchDisk, darkena(minf[active_switch()].color, fd, 0xFF));
break; break;
case laStorms: case laStorms:
@ -4314,7 +4306,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
Vboat = &(Vboat0 = *Vboat); Vboat = &(Vboat0 = *Vboat);
if(wmspatial && c->wall == waBoat) { if(wmspatial && c->wall == waBoat) {
nospin = c->wall == waBoat && applyAnimation(c, Vboat0, footphase, LAYER_BOAT); nospin = c->wall == waBoat && applyAnimation(c, Vboat0, footphase, LAYER_BOAT);
if(!nospin) Vboat0 = Vboat0 * ddspin(c, c->mondir, S42); if(!nospin) Vboat0 = Vboat0 * ddspin(c, c->mondir, M_PI);
queuepolyat(Vboat0, shBoatOuter, outcol, PPR_BOATLEV); queuepolyat(Vboat0, shBoatOuter, outcol, PPR_BOATLEV);
Vboat = &(Vboat0 = V); Vboat = &(Vboat0 = V);
} }
@ -4322,7 +4314,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
nospin = applyAnimation(c, Vboat0, footphase, LAYER_BOAT); nospin = applyAnimation(c, Vboat0, footphase, LAYER_BOAT);
} }
if(!nospin) if(!nospin)
Vboat0 = Vboat0 * ddspin(c, c->mondir, S42); Vboat0 = Vboat0 * ddspin(c, c->mondir, M_PI);
else { else {
transmatrix Vx; transmatrix Vx;
if(applyAnimation(c, Vx, footphase, LAYER_SMALL)) if(applyAnimation(c, Vx, footphase, LAYER_SMALL))
@ -4665,7 +4657,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
cell *c2 = c->move(i); cell *c2 = c->move(i);
if(airdist(c2) < airdist(c)) { if(airdist(c2) < airdist(c)) {
calcAirdir(c2); // printf("airdir = %d\n", airdir); calcAirdir(c2); // printf("airdir = %d\n", airdir);
transmatrix V0 = ddspin(c, i, S42); transmatrix V0 = ddspin(c, i, M_PI);
double ph = ticks / (nonbitrunc?150:75.0) + airdir * M_PI / (S21+.0); double ph = ticks / (nonbitrunc?150:75.0) + airdir * M_PI / (S21+.0);
@ -4696,8 +4688,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
whirlwind::calcdirs(c); whirlwind::calcdirs(c);
for(int i=0; i<whirlwind::qdirs; i++) { for(int i=0; i<whirlwind::qdirs; i++) {
int hdir0 = displaydir(c, whirlwind::dfrom[i]) + S42; ld hdir0 = displayspin(c, whirlwind::dfrom[i]) + M_PI;
int hdir1 = displaydir(c, whirlwind::dto[i]); ld hdir1 = displayspin(c, whirlwind::dto[i]);
double ph1 = fanframe; double ph1 = fanframe;
@ -4705,12 +4697,12 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
ph1 -= floor(ph1); ph1 -= floor(ph1);
if(hdir1 < hdir0-S42) hdir1 += S84; if(hdir1 < hdir0-M_PI) hdir1 += 2 * M_PI;
if(hdir1 >= hdir0+S42) hdir1 -= S84; if(hdir1 >= hdir0+M_PI) hdir1 -= 2 * M_PI;
int hdir = (hdir1*ph1+hdir0*(1-ph1)); int hdir = (hdir1*ph1+hdir0*(1-ph1));
transmatrix V0 = spin((hdir) * M_PI / S42); transmatrix V0 = spin(hdir);
double ldist = nonbitrunc ? crossf : c->type == 6 ? .2840 : 0.3399; double ldist = nonbitrunc ? crossf : c->type == 6 ? .2840 : 0.3399;
@ -5090,7 +5082,7 @@ void drawFlashes() {
int flashcol = f.color; int flashcol = f.color;
if(u > 500) flashcol = gradient(flashcol, 0, 500, u, 1100); if(u > 500) flashcol = gradient(flashcol, 0, 500, u, 1100);
flashcol = darkena(flashcol, 0, 0xFF); flashcol = darkena(flashcol, 0, 0xFF);
PRING(a) curvepoint(V*ddi0(a, rad)); PRING(a) curvepoint(V*xspinpush0(a * M_PI / S42, rad));
queuecurve(flashcol, 0x8080808, PPR_LINE); queuecurve(flashcol, 0x8080808, PPR_LINE);
} }
} }
@ -5104,7 +5096,7 @@ void drawFlashes() {
int flashcol = f.color; int flashcol = f.color;
if(u > 1000) flashcol = gradient(flashcol, 0, 1000, u, 2200); if(u > 1000) flashcol = gradient(flashcol, 0, 1000, u, 2200);
flashcol = darkena(flashcol, 0, 0xFF); flashcol = darkena(flashcol, 0, 0xFF);
PRING(a) curvepoint(V*ddi0(a, rad)); PRING(a) curvepoint(V*xspinpush0(a * M_PI / S42, rad));
queuecurve(flashcol, 0x8080808, PPR_LINE); queuecurve(flashcol, 0x8080808, PPR_LINE);
} }
} }
@ -5338,7 +5330,7 @@ void drawmovestar(double dx, double dy) {
#if CAP_QUEUE #if CAP_QUEUE
if(euclid) if(euclid)
queueline(tC0(Centered), Centered * ddi0(d * 10.5, 0.5) , col, vid.linequality); queueline(tC0(Centered), Centered * xspinpush0(d * M_PI / 4, 0.5) , col, vid.linequality);
else else
// queueline(tC0(Centered), Centered * spin(M_PI*d/4)* xpush(d==0?.7:d==2?.6:.5) * C0, col >> darken); // queueline(tC0(Centered), Centered * spin(M_PI*d/4)* xpush(d==0?.7:d==2?.6:.5) * C0, col >> darken);
queueline(tC0(Centered), Centered * xspinpush0(M_PI*d/4, d==0?.7:d==2?.5:.2), col, 3 + vid.linequality); queueline(tC0(Centered), Centered * xspinpush0(M_PI*d/4, d==0?.7:d==2?.5:.2), col, 3 + vid.linequality);
@ -5870,7 +5862,7 @@ void drawBug(const cellwalker& cw, int col) {
#if CAP_POLY #if CAP_POLY
initquickqueue(); initquickqueue();
transmatrix V = ggmatrix(cw.at); transmatrix V = ggmatrix(cw.at);
if(cw.spin) V = V * ddspin(cw.at, cw.spin, S42); if(cw.spin) V = V * ddspin(cw.at, cw.spin, M_PI);
queuepoly(V, shBugBody, col); queuepoly(V, shBugBody, col);
quickqueue(); quickqueue();
#endif #endif

View File

@ -852,7 +852,7 @@ bool outofmap(hyperpoint h);
void applymodel(hyperpoint H, hyperpoint& Hscr); void applymodel(hyperpoint H, hyperpoint& Hscr);
void drawCircle(int x, int y, int size, int color); void drawCircle(int x, int y, int size, int color);
void fixcolor(int& col); void fixcolor(int& col);
int displaydir(cell *c, int d); ld displayspin(cell *c, int d);
hyperpoint gethyper(ld x, ld y); hyperpoint gethyper(ld x, ld y);
void resetview(); extern heptspin viewctr; extern cellwalker centerover; void resetview(); extern heptspin viewctr; extern cellwalker centerover;
void drawthemap(); void drawthemap();
@ -2070,8 +2070,8 @@ namespace linepatterns {
void switchAlpha(ePattern id, int col); void switchAlpha(ePattern id, int col);
}; };
transmatrix ddspin(cell *c, int d, int bonus = 0); transmatrix ddspin(cell *c, int d, ld bonus = 0);
transmatrix iddspin(cell *c, int d, int bonus = 0); transmatrix iddspin(cell *c, int d, ld bonus = 0);
bool doexiton(int sym, int uni); bool doexiton(int sym, int uni);
void switchFullscreen(); void switchFullscreen();
string turnstring(int i); string turnstring(int i);
@ -2994,7 +2994,6 @@ namespace texture {
void queueline(const hyperpoint& H1, const hyperpoint& H2, int col, int prf = 0, int prio = PPR_LINE); void queueline(const hyperpoint& H1, const hyperpoint& H2, int col, int prf = 0, int prio = PPR_LINE);
void queuelink(const string *link, int prio); void queuelink(const string *link, int prio);
hyperpoint ddi0(ld dir, ld dist);
extern ld tessf, crossf, hexf, hcrossf, hexhexdist, hexvdist, hepvdist, rhexf; extern ld tessf, crossf, hexf, hcrossf, hexhexdist, hexvdist, hepvdist, rhexf;
unsigned char& part(int& col, int i); unsigned char& part(int& col, int i);
unsigned char& part(unsigned& col, int i); unsigned char& part(unsigned& col, int i);
@ -3154,6 +3153,7 @@ extern int lastsize;
extern int noiseuntil; extern int noiseuntil;
inline hyperpoint xpush0(ld x); inline hyperpoint xpush0(ld x);
extern eGeometry targetgeometry; extern eGeometry targetgeometry;
transmatrix xspinpush(ld alpha, ld x);
inline hyperpoint xspinpush0(ld alpha, ld x); inline hyperpoint xspinpush0(ld alpha, ld x);
#define DF_INIT 0 // always display these #define DF_INIT 0 // always display these

View File

@ -74,24 +74,24 @@ namespace hr { namespace netgen {
hcenter[ii][MAX_EDGE] = V * C0; hcenter[ii][MAX_EDGE] = V * C0;
if(c->type == 7) { if(c->type == S7) {
for(int i=0; i<c->type; i++) { for(int i=0; i<c->type; i++) {
int hdir = displaydir(c, i) + 6; int hdir = displayspin(c, i) + M_PI / S7;
transmatrix V2 = V * spin(hdir * M_PI / 42) * xpush(hexf); transmatrix V2 = V * spin(hdir) * xpush(hexf);
hcenter[ii][i] = V2 * C0; hcenter[ii][i] = V2 * C0;
} }
} }
if(c->type == 6) { if(c->type == S6) {
for(int i=0; i<c->type; i++) { for(int i=0; i<c->type; i++) {
int hdir = displaydir(c, i); int hdir = displayspin(c, i);
transmatrix V2 = transmatrix V2 =
V * spin(hdir * M_PI / 42) * xpush(crossf) * spin(M_PI*8/7) * xpush(hexf); V * spin(hdir) * xpush(crossf) * spin(M_PI+M_PI/S7) * xpush(hexf);
hcenter[ii][i] = V2 * C0; hcenter[ii][i] = V2 * C0;
} }

View File

@ -306,7 +306,7 @@ bool reflectingBarrierAt(cell *c) {
bool reflectingBarrierAt(cellwalker& c, int d) { bool reflectingBarrierAt(cellwalker& c, int d) {
if(d >= 3) return true; if(d >= 3) return true;
if(d <= -3) return true; if(d <= -3) return true;
d = c.spin + d + 42; d = c.spin + d + MODFIXER;
d%=c.at->type; d%=c.at->type;
if(!c.at->move(d)) return true; if(!c.at->move(d)) return true;

View File

@ -1941,8 +1941,8 @@ namespace linepatterns {
double x = hexhexdist / 2; // sphere?.3651:euclid?.2611:.2849; double x = hexhexdist / 2; // sphere?.3651:euclid?.2611:.2849;
queuelinef(V * ddspin(c,i,-S14) * xpush0(x), queuelinef(V * ddspin(c,i,-M_PI/S3) * xpush0(x),
V * ddspin(c,i,+S14) * xpush0(x), V * ddspin(c,i,M_PI/S3) * xpush0(x),
col, 1 + vid.linequality); col, 1 + vid.linequality);
} }
break; break;
@ -1993,8 +1993,8 @@ namespace linepatterns {
cell *c1 = createMov(c, (i+3) % 7); cell *c1 = createMov(c, (i+3) % 7);
cell *c2 = createMov(c, (i+4) % 7); cell *c2 = createMov(c, (i+4) % 7);
if(polarb50(c1) != a && polarb50(c2) != a) if(polarb50(c1) != a && polarb50(c2) != a)
queuelinef(V * ddspin(c,i,84*5/14) * xpush0(tessf/2), queuelinef(V * ddspin(c,i,M_PI*5/7) * xpush0(tessf/2),
V * ddspin(c,i,84*9/14) * xpush0(tessf/2), V * ddspin(c,i,M_PI*9/7) * xpush0(tessf/2),
col, 1 + vid.linequality); col, 1 + vid.linequality);
} }
break; break;
@ -2002,8 +2002,8 @@ namespace linepatterns {
case patPalacelike: case patPalacelike:
if(pseudohept(c)) for(int i=0; i<7; i++) if(pseudohept(c)) for(int i=0; i<7; i++)
queuelinef(V * ddspin(c,i,84*5/14) * xpush0(tessf/2), queuelinef(V * ddspin(c,i,M_PI*5/7) * xpush0(tessf/2),
V * ddspin(c,i,84*9/14) * xpush0(tessf/2), V * ddspin(c,i,M_PI*9/7) * xpush0(tessf/2),
col, 1 + vid.linequality); col, 1 + vid.linequality);
break; break;
@ -2095,8 +2095,8 @@ namespace linepatterns {
heptagon *h2 = c->master->modmove(i-1); heptagon *h2 = c->master->modmove(i-1);
if(!h1 || !h2) continue; if(!h1 || !h2) continue;
if(emeraldval(h1->c7)/4 == 8 && emeraldval(h2->c7)/4 == 8) if(emeraldval(h1->c7)/4 == 8 && emeraldval(h2->c7)/4 == 8)
queuelinef(V * ddspin(c,i,84*5/14) * xpush0(tessf/2), queuelinef(V * ddspin(c,i,M_PI*5/7) * xpush0(tessf/2),
V * ddspin(c,i,84*9/14) * xpush0(tessf/2), V * ddspin(c,i,M_PI*9/7) * xpush0(tessf/2),
col, 1 + vid.linequality); col, 1 + vid.linequality);
} }
} }

View File

@ -1324,6 +1324,8 @@ struct usershape {
usershape *usershapes[USERSHAPEGROUPS][USERSHAPEIDS]; usershape *usershapes[USERSHAPEGROUPS][USERSHAPEIDS];
transmatrix ddi(int a, ld x) { return xspinpush(a * M_PI / S42, x); }
void drawTentacle(hpcshape &h, ld rad, ld var, ld divby) { void drawTentacle(hpcshape &h, ld rad, ld var, ld divby) {
double tlength = max(crossf, hexhexdist * gp::scale * irr::scale); double tlength = max(crossf, hexhexdist * gp::scale * irr::scale);
if(syntetic) tlength = synt::edgelength; if(syntetic) tlength = synt::edgelength;

View File

@ -457,8 +457,8 @@ bool bantar_stats() {
for(auto gm: gmatrix) for(cell *c: {gm.first}) for(auto gm: gmatrix) for(cell *c: {gm.first})
if(euclid || !pseudohept(c)) for(int t=0; t<c->type; t++) if(infos.count(c) && infos.count(c->move(t)) && c->move(t) && infos[c].gid != infos[c->move(t)].gid) if(euclid || !pseudohept(c)) for(int t=0; t<c->type; t++) if(infos.count(c) && infos.count(c->move(t)) && c->move(t) && infos[c].gid != infos[c->move(t)].gid)
if(euclid ? c->move(t)<c : (((t^1)&1) || c->move(t) < c)) if(euclid ? c->move(t)<c : (((t^1)&1) || c->move(t) < c))
queueline(gm.second * ddspin(c,t,-S7) * xpush(x) * C0, queueline(gm.second * ddspin(c,t,-M_PI/S6) * xpush(x) * C0,
gm.second * ddspin(c,t,+S7) * xpush(x) * C0, gm.second * ddspin(c,t,+M_PI/S6) * xpush(x) * C0,
0xFF0000FF, 1); 0xFF0000FF, 1);
vid.linewidth /= (inHighQual ? 10 : 2); vid.linewidth /= (inHighQual ? 10 : 2);
drawqueue(); drawqueue();