diff --git a/graph.cpp b/graph.cpp index d2bbdde2..93338714 100644 --- a/graph.cpp +++ b/graph.cpp @@ -306,11 +306,15 @@ double hexshiftat(cell *c) { return 0; } +#define FACE3 (DIM == 3 ? M_PI/2 : 0) + transmatrix ddspin(cell *c, int d, ld bonus) { + if(DIM == 3) return rspintox(tC0(calc_relative_matrix(c->move(d), c, C0))) * cspin(2, 0, bonus); return spin(displayspin(c, d) + bonus - hexshiftat(c)); } transmatrix iddspin(cell *c, int d, ld bonus) { + if(DIM == 3) return spintox(tC0(calc_relative_matrix(c->move(d), c, C0))) * cspin(0, 2, bonus); return spin(hexshiftat(c) - displayspin(c, d) + bonus); } @@ -1843,6 +1847,7 @@ bool applyAnimation(cell *c, transmatrix& V, double& footphase, int layer) { footphase = a.footphase; V = V * a.wherenow; if(a.attacking == 2) V = V * pispin; + if(DIM == 3) V = V * cspin(0, 2, M_PI/2); a.ltick = ticks; return true; } @@ -2195,7 +2200,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col) { bheat = HEAT(c->move(i)); d = i; } - Vs = Vs * ddspin(c, d); + Vs = Vs * ddspin(c, d, FACE3); } return drawMonsterTypeDH(m, c, Vs, col, darkhistory, footphase); } @@ -2238,12 +2243,19 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col) { // other monsters face the player if(!nospins) { - hyperpoint V0 = inverse(cwtV) * tC0(Vs); - hyperpoint V1 = spintox(V0) * V0; - - Vs = cwtV * rspintox(V0) * rpushxto0(V1) * pispin; + if(DIM == 2) { + hyperpoint V0 = inverse(cwtV) * tC0(Vs); + hyperpoint V1 = spintox(V0) * V0; + + Vs = cwtV * rspintox(V0) * rpushxto0(V1) * pispin; + } + else { + hyperpoint V0 = inverse(cwtV) * tC0(Vs); + Vs = cwtV * rspintox(V0) * xpush(hdist0(V0)) * cspin(0, 2, -M_PI/2); + // cwtV * rgpushxto0(inverse(cwtV) * tC0(Vs)); + } if(c->monst == moHunterChanging) - Vs = Vs * spin(M_PI); + Vs = Vs * cspin(DIM-1, DIM, M_PI); } if(c->monst == moShadow) @@ -3838,14 +3850,14 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(multi::players > 1) { for(int i=0; i