diff --git a/irregular.cpp b/irregular.cpp index 108ab329..3195099b 100644 --- a/irregular.cpp +++ b/irregular.cpp @@ -1056,21 +1056,23 @@ EX array get_masters(cell *c) { return make_array(s0.at, (s0 + wstep).at, (s0 + 1 + wstep).at); } +EX void swap_vertices() { + for(auto& c: cells) { + swapmatrix(c.p); + swapmatrix(c.pusher); + swapmatrix(c.rpusher); + for(auto& jp: c.jpoints) swapmatrix(jp); + for(auto& rm: c.relmatrices) swapmatrix(rm.second); + for(auto& v: c.vertices) swapmatrix(v); + } + } + auto hook = #if CAP_COMMANDLINE addHook(hooks_args, 100, readArgs) + #endif #if MAXMDIM >= 4 - addHook(hooks_swapdim, 100, [] { - for(auto& c: cells) { - swapmatrix(c.p); - swapmatrix(c.pusher); - swapmatrix(c.rpusher); - for(auto& jp: c.jpoints) swapmatrix(jp); - for(auto& rm: c.relmatrices) swapmatrix(rm.second); - for(auto& v: c.vertices) swapmatrix(v); - } - }) + + addHook(hooks_swapdim, 100, swap_vertices) + #endif addHook(hooks_drawcell, 100, draw_cell_schematics) + addHook(shmup::hooks_turn, 100, step); diff --git a/sky.cpp b/sky.cpp index 32ba84c2..b2ac29ce 100644 --- a/sky.cpp +++ b/sky.cpp @@ -518,6 +518,12 @@ void celldrawer::draw_ceiling() { EX struct renderbuffer *airbuf; +EX void swap_if_missing(bool missing) { + if(!missing) return; + arb::swap_vertices(); + irr::swap_vertices(); + } + EX void make_air() { if(!sky) return; @@ -576,7 +582,7 @@ EX void make_air() { geom3::apply_always3(); check_cgi(); missing = !(cgi.state & 2); - if(missing) arb::swap_vertices(); + swap_if_missing(missing); cgi.require_shapes(); eGeometry orig = geometry; @@ -625,7 +631,7 @@ EX void make_air() { GLERR("after draw"); geom3::apply_always3(); - if(missing) arb::swap_vertices(); + swap_if_missing(missing); check_cgi(); calcparam(); GLERR("after make_air");