1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-07 20:02:50 +00:00

monster facing in product

This commit is contained in:
Zeno Rogue 2019-08-20 19:29:03 +02:00
parent 5724b30140
commit 21a38293d0

View File

@ -2769,12 +2769,22 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m
else { else {
// other monsters face the player // other monsters face the player
if(!nospins && !prod) { if(!nospins) {
if(WDIM == 2) { if(WDIM == 2 || prod) {
hyperpoint V0 = inverse(cwtV) * tC0(Vs); hyperpoint V0 = inverse(cwtV) * tC0(Vs);
ld z = 0;
if(prod) {
auto d = product_decompose(V0);
z = d.first;
V0 = d.second;
}
hyperpoint V1 = spintox(V0) * V0; hyperpoint V1 = spintox(V0) * V0;
if(hypot_d(2, tC0(Vs)) > 1e-3) {
Vs = cwtV * rspintox(V0) * rpushxto0(V1) * pispin; Vs = cwtV * rspintox(V0) * rpushxto0(V1) * pispin;
if(prod) Vs = mscale(Vs, z);
}
} }
else { else {
hyperpoint V0 = inverse(cwtV) * tC0(Vs); hyperpoint V0 = inverse(cwtV) * tC0(Vs);
@ -2782,7 +2792,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m
// cwtV * rgpushxto0(inverse(cwtV) * tC0(Vs)); // cwtV * rgpushxto0(inverse(cwtV) * tC0(Vs));
} }
if(c->monst == moHunterChanging) if(c->monst == moHunterChanging)
Vs = Vs * cspin(WDIM-2, WDIM-1, M_PI); Vs = Vs * (prod ? spin(M_PI) : cspin(WDIM-2, WDIM-1, M_PI));
} }
if(c->monmirror) Vs = Vs * Mirror; if(c->monmirror) Vs = Vs * Mirror;