// Copyright (C) 2018 Zeno and Tehora Rogue, see 'hyper.cpp' for details // this is a plugin which generates branched tilings for newconformist // https://github.com/zenorogue/newconformist (see the option '-cvl') namespace hr { struct location { transmatrix lView; heptspin lviewctr; }; struct lineinfo { vector locs; int plus_matrices; int minus_matrices; }; map lines; location loc_multiply(location orig, transmatrix T) { dynamicval dv(View, orig.lView); dynamicval dc(viewctr, orig.lviewctr); View = inverse(T) * View; for(int a=0; a<10; a++) optimizeview(); return location{View, viewctr}; } bool show_map = false; void cvl_marker() { if(show_map) for(auto& l: lines) { int id = 0; for(auto& loc: l.second.locs) { if(gmatrix.count(loc.lviewctr.at->c7)) { transmatrix T = gmatrix[loc.lviewctr.at->c7] * inverse(spin(loc.lviewctr.spin*2*M_PI/S7 + master_to_c7_angle())) * inverse(loc.lView); queuepoly(T, shAsymmetric, 0xFF00FFFF); queuestr(T, 1.0, its(l.first)+"/"+its(id), 0xFFFFFF); } id++; } } } int readArgs() { using namespace arg; if(0) ; else if(argis("-cvlbuild")) { PHASEFROM(3); start_game(); shift(); FILE *f = fopen(argcs(), "rt"); if(!f) { shift(); printf("failed to open file\n"); return 0; } int id; lineinfo l0; ignore(fscanf(f, "%d%d%d", &id, &l0.plus_matrices, &l0.minus_matrices)); l0.locs.push_back(location{View, viewctr}); for(int i=1; i dv(View, loc.lView); dynamicval dc(viewctr, loc.lviewctr); shot::take(format(s.c_str(), p.first, i++)); } } } else return 1; return 0; } auto magichook = addHook(hooks_args, 100, readArgs) + addHook(hooks_frame, 100, cvl_marker); }