diff --git a/control.cpp b/control.cpp index 16c6e39b..36a506f8 100644 --- a/control.cpp +++ b/control.cpp @@ -86,12 +86,10 @@ EX movedir vectodir(hyperpoint P) { ld dirdist[MAX_EDGE]; for(int i=0; itype; i++) { - transmatrix T; - if(compute_relamatrix((cwt+i).peek(), cwt.at, i, T)) { - ld d1 = geo_dist(U * T * C0, Centered * P, iTable); - ld d2 = geo_dist(U * T * C0, Centered * C0, iTable); - dirdist[i] = d1 - d2; - } + transmatrix T = currentmap->adj(cwt.at, (cwt + i).spin); + ld d1 = geo_dist(U * T * C0, Centered * P, iTable); + ld d2 = geo_dist(U * T * C0, Centered * C0, iTable); + dirdist[i] = d1 - d2; //xspinpush0(-i * 2 * M_PI /cwt.at->type, .5), P); } @@ -146,11 +144,8 @@ EX void calcMousedest() { transmatrix U = ggmatrix(cwt.at); for(int i=0; itype; i++) { - transmatrix T; - if(compute_relamatrix(cwt.at->move(i), cwt.at, i, T)) - dists[i] = intval(mouseh, U * T * C0); - else - dists[i] = HUGE_VAL; + transmatrix T = currentmap->adj(cwt.at, (cwt+i).spin); + dists[i] = intval(mouseh, U * T * C0); } // confusingGeometry() ? ggmatrix(cwt.at) * calc_relative_matrix(cwt.at->move(i), cwt.at, i) : shmup::ggmatrix(cwt.at->move(i)))); diff --git a/graph.cpp b/graph.cpp index 6c2dfc21..46fda2e0 100644 --- a/graph.cpp +++ b/graph.cpp @@ -4020,7 +4020,7 @@ EX void drawMarkers() { #if CAP_SHAPES if((vid.axes == 4 || (vid.axes == 1 && !mousing)) && !shmup::on && GDIM == 2) { if(multi::players == 1) { - forCellIdAll(c2, d, cwt.at) IG(c2) draw_movement_arrows(c2, confusingGeometry() ? Gm(cwt.at) * calc_relative_matrix(c2, cwt.at, d) : Gm(c2)); + forCellIdAll(c2, d, cwt.at) IG(c2) draw_movement_arrows(c2, Gm(cwt.at) * currentmap->adj(cwt.at, d)); } else if(multi::players > 1) for(int p=0; p ttm(cwtV, multi::whereis[p]); dynamicval tcw(cwt, multi::player[p]); - draw_movement_arrows(c2, confusingGeometry() ? Gm(cwt.at) * calc_relative_matrix(c2, cwt.at, d) : Gm(c2)); + draw_movement_arrows(c2, Gm(cwt.at) * currentmap->adj(cwt.at, d)); } } } @@ -5020,24 +5020,13 @@ EX int revhint(cell *c, int hint) { else return hint; } -EX bool compute_relamatrix(cell *src, cell *tgt, int direction_hint, transmatrix& T) { - if(confusingGeometry()) { - T = calc_relative_matrix(src, tgt, revhint(src, direction_hint)); - } - else { - if(gmatrix.count(src) && gmatrix.count(tgt)) - T = inverse(gmatrix[tgt]) * gmatrix[src]; - else - return false; - } - return true; - } - - EX void animateMovement(cell *src, cell *tgt, int layer, int direction_hint) { if(vid.mspeed >= 5) return; // no animations! transmatrix T; - if(!compute_relamatrix(src, tgt, direction_hint, T)) return; + if(direction_hint >= 0 && direction_hint < src->degree() && tgt == src->move(direction_hint)) + T = currentmap->iadj(src, direction_hint); + else + T = currentmap->relative_matrix(src, tgt, C0); animation& a = animations[layer][tgt]; if(animations[layer].count(src)) { a = animations[layer][src]; @@ -5060,7 +5049,10 @@ EX void animateMovement(cell *src, cell *tgt, int layer, int direction_hint) { EX void animateAttack(cell *src, cell *tgt, int layer, int direction_hint) { if(vid.mspeed >= 5) return; // no animations! transmatrix T; - if(!compute_relamatrix(src, tgt, direction_hint, T)) return; + if(direction_hint >= 0 && direction_hint < src->degree() && tgt == src->move(direction_hint)) + T = currentmap->iadj(src, direction_hint); + else + T = currentmap->relative_matrix(src, tgt, C0); bool newanim = !animations[layer].count(src); animation& a = animations[layer][src]; a.attacking = 1; diff --git a/hud.cpp b/hud.cpp index ad778c64..38476004 100644 --- a/hud.cpp +++ b/hud.cpp @@ -326,8 +326,7 @@ void drawMobileArrow(int i) { cell *c = cwt.at->move(i); if(!c) return; - transmatrix T; - if(!compute_relamatrix(c, cwt.at, i, T)) return; + transmatrix T = currentmap->adj(cwt.at, i); // color_t col = getcs().uicolor; // col -= (col & 0xFF) >> 1;