diff --git a/celldrawer.cpp b/celldrawer.cpp index 4e0cea71..3e2b860f 100644 --- a/celldrawer.cpp +++ b/celldrawer.cpp @@ -5,7 +5,7 @@ namespace hr { int coastvalEdge(cell *c); struct celldrawer { - cellwalker cw; + cell *c; transmatrix V; color_t fcol; @@ -64,16 +64,14 @@ struct celldrawer { void do_viewdist(); }; -inline void drawcell(const cellwalker& cw, const transmatrix& V) { +inline void drawcell(cell *c, const transmatrix& V) { celldrawer dd; - dd.cw = cw; + dd.c = c; dd.V = V; dd.draw(); } #endif -#define c (cw.at) - static const int trapcol[4] = {0x904040, 0xA02020, 0xD00000, 0x303030}; static const int terracol[8] = {0xD000, 0xE25050, 0xD0D0D0, 0x606060, 0x303030, 0x181818, 0x0080, 0x8080}; @@ -1706,7 +1704,7 @@ void celldrawer::bookkeeping() { if(playerpos(i) == c) { playerV = V * ddspin(c, multi::player[i].spin, 0); if(multi::player[i].mirrored) playerV = playerV * Mirror; - if(multi::player[i].mirrored == cw.mirrored) + if(orig) multi::whereis[i] = playerV; } } @@ -2184,7 +2182,7 @@ void celldrawer::draw_monster_full() { #if CAP_SHAPES int q = isize(ptds); #endif - bool m = drawMonster(V, c->type, c, moncol, cw.mirrored, asciicol); + bool m = drawMonster(V, c->type, c, moncol, asciicol); if(m) error = true; if(m || c->monst) onradar = false; #if CAP_SHAPES @@ -2362,7 +2360,8 @@ void celldrawer::draw_gravity_particles() { } void celldrawer::draw() { - if(hybrid::pmap) { product::drawcell_stack(cw, V); return; } + + if(hybrid::pmap) { product::drawcell_stack(c, V); return; } cells_drawn++; @@ -2396,16 +2395,15 @@ void celldrawer::draw() { if(inmirror(c)) { if(inmirrorcount >= 10) return; - cellwalker cw2 = cw; - cw2.spin = 0; - cw2 = mirror::reflect(cw); + cellwalker cw(c); + cellwalker cw2 = mirror::reflect(cw); int cmc = (cw2.mirrored == cw.mirrored) ? 2 : 1; 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; - drawcell(cw2, V); + drawcell(cw2.at, V); inmirrorcount -= cmc; return; } diff --git a/expansion.cpp b/expansion.cpp index 004474b3..0302c75a 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -643,8 +643,6 @@ color_t distribute_color(int id) { void celldrawer::do_viewdist() { if(behindsphere(V)) return; - cell *c = cw.at; - int cd = (use_color_codes || number_coding == ncDistance || number_coding == ncDebug) ? curr_dist(c) : 0; if(use_color_codes) { diff --git a/graph.cpp b/graph.cpp index a28d5b1a..684ffaf9 100644 --- a/graph.cpp +++ b/graph.cpp @@ -2321,7 +2321,7 @@ void drawWormSegments() { EX bool dont_face_pc = false; -EX bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool mirrored, color_t asciicol) { +EX bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, color_t asciicol) { #if CAP_SHAPES bool darkhistory = history::includeHistory && history::inkillhistory.count(c); @@ -2342,6 +2342,7 @@ EX bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, boo eMonster m = c->monst; bool half_elliptic = elliptic && GDIM == 3 && WDIM == 2; + bool mirrored = det(Vparam) > 0; if(!m) ; @@ -3805,7 +3806,6 @@ EX void fallingMonsterAnimation(cell *c, eMonster m, int id IS(multi::cpid)) { } void celldrawer::draw_fallanims() { - cell*& c = cw.at; poly_outline = OUTLINE_NONE; if(fallanims.count(c)) { int q = isize(ptds); @@ -3825,7 +3825,7 @@ void celldrawer::draw_fallanims() { celldrawer ddalt; eWall w = c->wall; int p = c->wparam; c->wall = fa.walltype; c->wparam = fa.m; - ddalt.cw.at = c; + ddalt.c = c; ddalt.setcolors(); int starcol = c->wall == waVinePlant ? 0x60C000 : ddalt.wcol; c->wall = w; c->wparam = p; diff --git a/hypgraph.cpp b/hypgraph.cpp index 98b841d9..e693ac48 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -1138,6 +1138,46 @@ vector > drawn_cells; bool in_multi = false; +bool drawcell_subs(cell *c, transmatrix V) { + + #if CAP_GP + if(GOLDBERG) { + return gp::drawrec(c, V); + } + #endif + + bool draw = false; + + #if CAP_IRR + if(IRREGULAR) { + auto& hi = irr::periodmap[c->master]; + auto& vc = irr::cells_of_heptagon[hi.base.at]; + for(int i=0; ic.spin(d) == 0) { + transmatrix V2 = V * currentmap->adj(c, d); + if(do_draw(c1, V2)) + draw = true, + drawcell(c1, V2); + } + } + + return draw; + } + void hrmap_standard::draw() { if(sphere && pmodel == mdSpiral && !in_multi) { in_multi = true; @@ -1181,49 +1221,7 @@ void hrmap_standard::draw() { transmatrix V10; const transmatrix& V1 = hs.mirrored ? (V10 = V * Mirror) : V; - bool draw = false; - - if(0) ; - - #if CAP_GP - else if(GOLDBERG) { - draw = gp::drawrec(c, actualV(hs, V1)); - } - #endif - - #if CAP_IRR - else if(IRREGULAR) { - auto& hi = irr::periodmap[hs.at]; - transmatrix V0 = actualV(hs, V1); - auto& vc = irr::cells_of_heptagon[hi.base.at]; - for(int i=0; ic.fix(hs.spin + d); - // createMov(c, ds); - if(c->move(ds) && c->c.spin(ds) == 0) { - transmatrix V2 = V1 * cgi.hexmove[d]; - if(do_draw(c->move(ds), V2)) - draw = true, - drawcell(cellwalker(c->move(ds), 0, hs.mirrored ^ c->c.mirror(ds)), V2); - } - } - } + bool draw = drawcell_subs(c, actualV(hs, V1)); if(sphere) draw = true; diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 2bb070a1..804a735f 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -1245,8 +1245,7 @@ EX namespace product { if(z == 1) cwall_mask ^= (1<type); cell *c1 = hybrid::get_at(c, actual_view_level+z); setdist(c1, 7, NULL); - cw.at = c1; - drawcell(cw, V * mscale(Id, cgi.plevel * (z+actual_view_level - z0))); + drawcell(c1, V * mscale(Id, cgi.plevel * (z+actual_view_level - z0))); } }); } diff --git a/radar.cpp b/radar.cpp index 0e1cd64f..1b72f0d8 100644 --- a/radar.cpp +++ b/radar.cpp @@ -67,7 +67,6 @@ EX void addradar(const hyperpoint h1, const hyperpoint h2, color_t col) { } void celldrawer::drawcell_in_radar() { - cell *c = cw.at; #if CAP_SHMUP if(shmup::on) { pair p = @@ -85,7 +84,6 @@ void celldrawer::drawcell_in_radar() { } void celldrawer::radar_grid() { - cell *c = cw.at; for(int t=0; ttype; t++) if(c->move(t) && c->move(t) < c) addradar(V*get_corner_position(c, t%c->type), V*get_corner_position(c, (t+1)%c->type), gridcolor(c, c->move(t))); diff --git a/raycaster.cpp b/raycaster.cpp index 0b15d3dd..3ff97e69 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -906,7 +906,7 @@ EX void cast() { connections[u][1] = code[1]; if(isWall3(c1)) { celldrawer dd; - dd.cw.at = c1; + dd.c = c1; dd.setcolors(); transmatrix Vf; dd.set_land_floor(Vf); diff --git a/shmup.cpp b/shmup.cpp index c133057c..94db480f 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -2875,7 +2875,6 @@ auto hooksw = addHook(hooks_swapdim, 100, [] { bool celldrawer::draw_shmup_monster() { using namespace shmup; - auto& c = cw.at; #if CAP_SHAPES pair p = diff --git a/sky.cpp b/sky.cpp index cfaf83e9..9c519f4a 100644 --- a/sky.cpp +++ b/sky.cpp @@ -133,8 +133,6 @@ void celldrawer::draw_ceiling() { if(pmodel != mdPerspective || sphere) return; - cell *c = cw.at; - switch(ceiling_category(c)) { /* ceilingless levels */ case 1: {