// 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') #include "../hyper.h" namespace hr { #if CAP_SHOT struct location { transmatrix lView; cell *lco; }; 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(centerover, orig.lco); View = inverse(T) * View; for(int a=0; a<10; a++) optimizeview(); return location{View, centerover}; } 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.lco)) { shiftmatrix T = gmatrix[loc.lco] * inverse(loc.lView); queuepoly(T, cgi.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(); fhstream f(argcs(), "rt"); if(!f.f) { shift(); printf("failed to open file\n"); return 0; } int id; lineinfo l0; scan(f, id, l0.plus_matrices, l0.minus_matrices); l0.locs.push_back(location{View, centerover}); for(int i=1; i dv(View, loc.lView); dynamicval dc(centerover, loc.lco); shot::take(hr::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); #endif }