diff --git a/attack.cpp b/attack.cpp index 939a92c8..5c75ff59 100644 --- a/attack.cpp +++ b/attack.cpp @@ -302,8 +302,15 @@ EX void prespill(cell* c, eWall t, int rad, cell *from) { // block spill if(t == waTemporary) return; // cwt.at->item = itNone; - if(rad) for(cell *c2: adj_minefield_cells(c)) - prespill(c2, t, rad-1, c); + if(rad) for(auto p: adj_minefield_cells_with_orientation(c)) { + prespill(p.first, conditional_flip_slime(p.second, t), rad-1, c); + } + } + +EX eWall conditional_flip_slime(bool flip, eWall t) { + if(flip && t == waFloorA) return waFloorB; + if(flip && t == waFloorB) return waFloorA; + return t; } EX void spillfix(cell* c, eWall t, int rad) { @@ -311,8 +318,9 @@ EX void spillfix(cell* c, eWall t, int rad) { changes.ccell(c); c->wall = t; } - if(rad) for(cell *c2: adj_minefield_cells(c)) - spillfix(c2, t, rad-1); + if(rad) for(auto p: adj_minefield_cells_with_orientation(c)) { + spillfix(p.first, conditional_flip_slime(p.second, t), rad-1); + } } EX void spill(cell* c, eWall t, int rad) { diff --git a/cell.cpp b/cell.cpp index 5d07129b..e6b4ef49 100644 --- a/cell.cpp +++ b/cell.cpp @@ -1331,7 +1331,7 @@ EX int neighborId(cell *ofWhat, cell *whichOne) { EX int mine_adjacency_rule = 0; -EX map> adj_memo; +EX map>> adj_memo; EX bool geometry_has_alt_mine_rule() { if(S3 >= OINF) return false; @@ -1340,17 +1340,17 @@ EX bool geometry_has_alt_mine_rule() { return true; } -EX vector adj_minefield_cells(cell *c) { - vector res; +EX vector> adj_minefield_cells_with_orientation(cell *c) { + vector> res; if(mine_adjacency_rule == 0 || !geometry_has_alt_mine_rule()) - forCellCM(c2, c) res.push_back(c2); + forCellIdCM(c2, i, c) res.emplace_back(c2, c->c.mirror(i)); else if(WDIM == 2) { cellwalker cw(c, 0); cw += wstep; cw++; cellwalker cw1 = cw; do { - res.push_back(cw.at); + res.emplace_back(cw.at, cw.mirrored); cw += wstep; cw++; if(cw.cpeek() == c) cw++; @@ -1373,7 +1373,7 @@ EX vector adj_minefield_cells(cell *c) { auto& vertices1 = ss1.vertices_only_local; for(hyperpoint h: vertices) for(hyperpoint h2: vertices1) if(hdist(h, T * h2) < 1e-6) shares = true; - if(shares) res.push_back(c1); + if(shares) res.emplace_back(c1, det(T) < 0); } if(shares || c == c1) forCellIdEx(c2, i, c1) { if(cl.listed(c2)) continue; @@ -1387,6 +1387,13 @@ EX vector adj_minefield_cells(cell *c) { return res; } +EX vector adj_minefield_cells(cell *c) { + vector res; + auto ori = adj_minefield_cells_with_orientation(c); + for(auto p: ori) res.push_back(p.first); + return res; + } + EX vector reverse_directions(cell *c, int dir) { if(PURE && !(kite::in() && WDIM == 2)) return reverse_directions(c->master, dir); int d = c->degree(); diff --git a/celldrawer.cpp b/celldrawer.cpp index d3410a86..085b2a18 100644 --- a/celldrawer.cpp +++ b/celldrawer.cpp @@ -502,6 +502,8 @@ void celldrawer::setcolors() { } case waFloorA: case waFloorB: // isAlch + wcol = winf[conditional_flip_slime(det(V.T) < 0, c->wall)].color; + if(c->item && !(history::includeHistory && history::infindhistory.count(c))) fcol = wcol = iinf[c->item].color; else @@ -2422,7 +2424,7 @@ void celldrawer::draw_monster_full() { moncol >>= 1; if(c->monst == moSlime) { - moncol = winf[c->wall].color; + moncol = winf[conditional_flip_slime(det(V.T) < 0, c->wall)].color; moncol |= (moncol>>1); } diff --git a/passable.cpp b/passable.cpp index 64bb49f6..fd8b07dd 100644 --- a/passable.cpp +++ b/passable.cpp @@ -89,9 +89,16 @@ EX bool strictlyAgainstGravity(cell *w, cell *from, bool revdir, flagtype flags) } EX bool anti_alchemy(cell *w, cell *from) { - bool alch1 = w->wall == waFloorA && from && from->wall == waFloorB && !w->item && !from->item; - alch1 |= w->wall == waFloorB && from && from->wall == waFloorA && !w->item && !from->item; - return alch1; + if(!from) return false; + if(!isAlchAny(w)) return false; + if(!isAlchAny(from)) return false; + if(w->item) return false; + if(from->item) return false; + if(!nonorientable) return w->wall != from->wall; + forCellIdEx(c1, i, w) + if(c1 == from && (w->c.mirror(i) ? w->wall != from->wall : w->wall == from->wall)) + return false; + return true; } #if HDR diff --git a/pcmove.cpp b/pcmove.cpp index 417ac3a6..b843b8cc 100644 --- a/pcmove.cpp +++ b/pcmove.cpp @@ -1112,7 +1112,7 @@ bool pcmove::perform_actual_move() { }); if(c2->item && isAlch(c2)) { if(alchMayDuplicate(cwt.at->wall)) { - c2->wall = cwt.at->wall; + c2->wall = conditional_flip_slime(mi.mirror(), cwt.at->wall); c2->wparam = cwt.at->wparam; } else