mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
3D:: fixed monster facings in noshmup
This commit is contained in:
parent
0c125efb15
commit
07a51bed10
28
graph.cpp
28
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<numplayers(); i++)
|
||||
if(playerpos(i) == c) {
|
||||
playerV = V * ddspin(c, multi::player[i].spin);
|
||||
playerV = V * ddspin(c, multi::player[i].spin, FACE3);
|
||||
if(multi::player[i].mirrored) playerV = playerV * Mirror;
|
||||
if(multi::player[i].mirrored == mirrored)
|
||||
multi::whereis[i] = playerV;
|
||||
}
|
||||
}
|
||||
else {
|
||||
playerV = V * ddspin(c, cwt.spin);
|
||||
playerV = V * ddspin(c, cwt.spin, FACE3);
|
||||
if(cwt.mirrored) playerV = playerV * Mirror;
|
||||
if(orig) cwtV = playerV;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user