From 9b9e7ccaf23d3a869580de7e13257a0482d4d1ba Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 16 Sep 2020 19:48:25 +0200 Subject: [PATCH] fixed errors with mirrors walls: monsters face the player correctly; mimics in mirrors display their X-signs correctly; player in mirror displays their X sign while previously they did not --- celldrawer.cpp | 5 ++++- graph.cpp | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/celldrawer.cpp b/celldrawer.cpp index e57486f3..9625e551 100644 --- a/celldrawer.cpp +++ b/celldrawer.cpp @@ -2520,6 +2520,8 @@ void celldrawer::draw_gravity_particles() { } } +EX shiftmatrix ocwtV; + void celldrawer::draw() { cells_drawn++; @@ -2557,13 +2559,14 @@ void celldrawer::draw() { cellwalker cw(c); cellwalker cw2 = mirror::reflect(cw); int cmc = (cw2.mirrored == cw.mirrored) ? 2 : 1; + if(inmirrorcount == 0) ocwtV = cwtV; inmirrorcount += cmc; draw_grid(); if(cw2.mirrored != cw.mirrored) V = V * Mirror; if(cw2.spin) V = V * spin(2*M_PI*cw2.spin/cw2.at->type); cw2.spin = 0; dynamicval dc(cwtV, cwtV); - cwtV = V * inverse_shift(gmatrix0[c], cwtV); + cwtV = V * inverse_shift(ggmatrix(cw2.at), cwtV); drawcell(cw2.at, V); inmirrorcount -= cmc; return; diff --git a/graph.cpp b/graph.cpp index 375f5cb5..39600ff0 100644 --- a/graph.cpp +++ b/graph.cpp @@ -2729,7 +2729,7 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col if(inmirrorcount&1) mirr = !mirr; col = mirrorcolor(geometry == gElliptic ? det(Vs.T) < 0 : mirr); if(!mouseout() && !nospins && GDIM == 2) { - shiftpoint P2 = Vs * inverse_shift(cwtV, mouseh); + shiftpoint P2 = Vs * inverse_shift(inmirrorcount ? ocwtV : cwtV, mouseh); queuestr(P2, 10, "x", 0xFF00); } if(!nospins && flipplayer) Vs = Vs * pispin; @@ -2852,6 +2852,12 @@ EX bool drawMonster(const shiftmatrix& Vparam, int ct, cell *c, color_t col, col drawPlayerEffects(Vs, c, true); if(!mmmon) return true; + if(inmirrorcount && !mouseout() && !nospins && GDIM == 2) { + hyperpoint h = inverse_shift(ocwtV, mouseh); + if(flipplayer) h = pispin * h; + shiftpoint P2 = Vs * h; + queuestr(P2, 10, "x", 0xFF00); + } if(hide_player()) { first_cell_to_draw = false;