From e1194ff588fe33fcb35e77631e4a9b66cbc43005 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 9 Aug 2019 22:37:11 +0200 Subject: [PATCH] more header cleanup --- complex2.cpp | 11 ++- config.cpp | 2 +- crystal.cpp | 75 ++++++++++-------- euclid.cpp | 14 ++-- fieldpattern.cpp | 23 +++++- floorshapes.cpp | 2 +- game.cpp | 10 ++- geometry.cpp | 10 ++- goldberg.cpp | 70 ++++++++++------- graph.cpp | 2 +- hyper.h | 199 ----------------------------------------------- hypgraph.cpp | 16 ++-- makeh.cpp | 5 ++ reg3.cpp | 24 +++--- 14 files changed, 164 insertions(+), 299 deletions(-) diff --git a/complex2.cpp b/complex2.cpp index c855f8dc..204023a9 100644 --- a/complex2.cpp +++ b/complex2.cpp @@ -8,7 +8,12 @@ namespace hr { -namespace brownian { +EX namespace brownian { + + #if HDR + const int level = 5; + #endif + map> > futures; int centersteps = 0; @@ -97,7 +102,7 @@ namespace brownian { else if(cellHalfvine(c)) destroyHalfvine(c, waNone, 4); } - void init(cell *c) { + EX void init(cell *c) { if(!hyperbolic) return; recurse(c, FAT); recurse(c, FAT); @@ -148,7 +153,7 @@ namespace brownian { } } - void build(cell *c, int d) { + EX void build(cell *c, int d) { if(!hyperbolic) c->wall = waNone, c->landparam = 256; diff --git a/config.cpp b/config.cpp index 9ae0625e..60a759b7 100644 --- a/config.cpp +++ b/config.cpp @@ -799,7 +799,7 @@ EX void edit_sightrange() { }; } -EX void menuitem_sightrange(char c) { +EX void menuitem_sightrange(char c IS('c')) { if(vid.use_smart_range) dialog::addSelItem(XLAT("minimum visible cell in pixels"), fts(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail), c); else if(pmodel == mdGeodesic && sol) diff --git a/crystal.cpp b/crystal.cpp index 1252409e..1f2a6ac7 100644 --- a/crystal.cpp +++ b/crystal.cpp @@ -4,7 +4,7 @@ namespace hr { -namespace crystal { +EX namespace crystal { #if CAP_CRYSTAL // Crystal can be bitruncated either by changing variation to bitruncated. // In case of the 4D Crystal, the standard HyperRogue bitruncation becomes @@ -15,14 +15,23 @@ namespace crystal { // Function pure() checks for both kinds of bitruncation (or any other variations). -bool pure() { +#if HDR +static const int MAXDIM = 7; +typedef array coord; +static const coord c0 = {}; + +typedef array ldcoord; +static const ldcoord ldc0 = {}; +#endif + +EX bool pure() { return PURE && ginf[gCrystal].vertex == 4; } -bool view_coordinates = false; +EX bool view_coordinates = false; bool view_east = false; -bool used_compass_inside; +EX bool used_compass_inside; ldcoord told(coord c) { ldcoord a; for(int i=0; i> 1)); } @@ -482,9 +491,9 @@ hrmap_crystal *crystal_map() { return (hrmap_crystal*) currentmap; } -heptagon *get_heptagon_at(coord c) { return crystal_map()->get_heptagon_at(c, S7); } -coord get_coord(heptagon *h) { return crystal_map()->hcoords[h]; } -ldcoord get_ldcoord(cell *c) { return crystal_map()->get_coord(c); } +EX heptagon *get_heptagon_at(coord c) { return crystal_map()->get_heptagon_at(c, S7); } +EX coord get_coord(heptagon *h) { return crystal_map()->hcoords[h]; } +EX ldcoord get_ldcoord(cell *c) { return crystal_map()->get_coord(c); } bool is_bi(crystal_structure& cs, coord co) { for(int i=0; i, MAX_EDGE> distlimit_table = {{ {{6, 4}}, {{5, 3}}, {{4, 3}}, {{4, 3}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}}, {{3, 2}} }}; -color_t colorize(cell *c) { +EX color_t colorize(cell *c) { auto m = crystal_map(); ldcoord co = m->get_coord(c); color_t res; @@ -506,14 +515,14 @@ color_t colorize(cell *c) { return res; } -colortable coordcolors = {0xD04040, 0x40D040, 0x4040D0, 0xFFD500, 0xF000F0, 0x00F0F0, 0xF0F0F0 }; +EX colortable coordcolors = {0xD04040, 0x40D040, 0x4040D0, 0xFFD500, 0xF000F0, 0x00F0F0, 0xF0F0F0 }; -ld compass_angle() { +EX ld compass_angle() { bool bitr = ginf[gCrystal].vertex == 3; return (bitr ? M_PI/8 : 0) - master_to_c7_angle(); } -bool crystal_cell(cell *c, transmatrix V) { +EX bool crystal_cell(cell *c, transmatrix V) { if(geometry != gCrystal) return false; @@ -544,7 +553,7 @@ bool crystal_cell(cell *c, transmatrix V) { return false; } -vector build_shortest_path(cell *c1, cell *c2) { +EX vector build_shortest_path(cell *c1, cell *c2) { auto m = crystal_map(); ldcoord co1 = m->get_coord(c1); ldcoord co2 = m->get_coord(c2) - co1; @@ -597,7 +606,7 @@ vector build_shortest_path(cell *c1, cell *c2) { return p; } -int precise_distance(cell *c1, cell *c2) { +EX int precise_distance(cell *c1, cell *c2) { if(c1 == c2) return 0; auto m = crystal_map(); if(pure()) { @@ -661,19 +670,19 @@ int precise_distance(cell *c1, cell *c2) { return 999999; } -ld space_distance(cell *c1, cell *c2) { +EX ld space_distance(cell *c1, cell *c2) { auto m = crystal_map(); ldcoord co1 = m->get_coord(c1); ldcoord co2 = m->get_coord(c2); return sqrt(sqhypot2(m->cs, co1, co2)); } -ld space_distance_camelot(cell *c) { +EX ld space_distance_camelot(cell *c) { auto m = crystal_map(); return m->camelot_mul * sqrt(sqhypot2(m->cs, m->get_coord(c), m->camelot_coord)); } -int dist_relative(cell *c) { +EX int dist_relative(cell *c) { auto m = crystal_map(); auto& cc = m->camelot_center; int r = roundTableRadius(NULL); @@ -796,7 +805,7 @@ void hrmap_crystal::prepare_east() { if(east.data.empty()) build_east(1); } -int dist_alt(cell *c) { +EX int dist_alt(cell *c) { auto m = crystal_map(); if(specialland == laCamelot && m->camelot_center) { if(pure()) @@ -818,7 +827,7 @@ ldcoord rug_center; bool draw_cut = false; ld cut_level = 0; -void init_rotation() { +EX void init_rotation() { for(int i=0; ics; for(int i=0; i<100; i++) { int a = hrand(cs.dim); @@ -857,12 +866,12 @@ void random_rotation() { } -void next_home_orientation() { +EX void next_home_orientation() { ho++; init_rotation(); } -void flip_z() { +EX void flip_z() { for(int i=0; ics; for(int i=0; ics; for(int i=0; i= 4.99) aspd = 1000; auto m = crystal_map(); @@ -941,7 +950,7 @@ void cut_triangle(const hyperpoint pa, const hyperpoint pb, const hyperpoint pc, cut_triangle2(pb, pc, pa, hb, hc, ha); } -void build_rugdata() { +EX void build_rugdata() { using namespace rug; rug::clear_model(); rug::good_shape = true; @@ -1000,7 +1009,7 @@ void build_rugdata() { println(hlog, "cut ", cut_level, "r ", crug_rotation); } -void set_land(cell *c) { +EX void set_land(cell *c) { setland(c, specialland); auto m = crystal_map(); @@ -1103,11 +1112,11 @@ int readArgs() { } #endif -hrmap *new_map() { +EX hrmap *new_map() { return new hrmap_crystal; } -string compass_help() { +EX string compass_help() { return XLAT( "Lands in this geometry are usually built on North-South or West-East axis. " "Compasses always point North, and all the cardinal directions to the right from compass North are East (this is not " @@ -1132,7 +1141,7 @@ string make_help() { ); } -void show() { +EX void show() { cmode = sm::SIDE | sm::MAYDARK; gamescreen(0); dialog::init(XLAT("dimensional crystal")); @@ -1234,7 +1243,7 @@ struct shift_data { shift_data shift_data_zero; -string get_table_volume() { +EX string get_table_volume() { if(!pure()) { auto m = crystal_map(); bignum res; @@ -1282,7 +1291,7 @@ string get_table_volume() { return (compute_volume(s/2, r-1) + compute_volume(s/2, r-2)).get_str(100); } -string get_table_boundary() { +EX string get_table_boundary() { if(!pure()) return ""; int r = roundTableRadius(NULL); int s = ginf[gCrystal].sides; @@ -1292,7 +1301,7 @@ string get_table_boundary() { return (compute_volume(s/2, r) - compute_volume(s/2, r-2)).get_str(100); } -void may_place_compass(cell *c) { +EX void may_place_compass(cell *c) { if(c != c->master->c7) return; auto m = crystal_map(); auto co = m->hcoords[c->master]; diff --git a/euclid.cpp b/euclid.cpp index 48329d07..f93223fb 100644 --- a/euclid.cpp +++ b/euclid.cpp @@ -498,7 +498,7 @@ EX heptagon* encodeId(int id) { #if MAXMDIM == 4 -namespace euclid3 { +EX namespace euclid3 { typedef long long coord; static const long long COORDMAX = (1<<16); @@ -551,7 +551,7 @@ namespace euclid3 { } coord canonicalize(coord x); - void build_torus3(); + EX void build_torus3(); coord twist(coord x, transmatrix& M); extern int twisted; extern intmatrix T0; @@ -719,7 +719,7 @@ namespace euclid3 { return ((hrmap_euclid3*) currentmap); } - hrmap* new_map() { + EX hrmap* new_map() { return new hrmap_euclid3; } @@ -814,7 +814,7 @@ namespace euclid3 { set_euland3(c, co[0]*120, co[1]*120, (co[1]+co[2]) / dv, hash); } - int dist_relative(cell *c) { + EX int dist_relative(cell *c) { auto m = cubemap(); auto& cc = m->camelot_center; int r = roundTableRadius(NULL); @@ -864,7 +864,7 @@ namespace euclid3 { int coords; int twisted, twisted0, twisted_edit; - void clear_torus3() { + EX void clear_torus3() { for(int i=0; i<3; i++) user_axes[i] = 0; } @@ -1014,7 +1014,7 @@ namespace euclid3 { twisted_edit = twisted0; } - void show_torus3() { + EX void show_torus3() { cmode = sm::SIDE | sm::MAYDARK; gamescreen(1); dialog::init(XLAT("3D Euclidean spaces")); @@ -1153,7 +1153,7 @@ namespace euclid3 { auto euhook = addHook(hooks_args, 100, euArgs); #endif - } + EX } #endif diff --git a/fieldpattern.cpp b/fieldpattern.cpp index d9216063..460d456e 100644 --- a/fieldpattern.cpp +++ b/fieldpattern.cpp @@ -4,7 +4,22 @@ #if CAP_FIELD namespace hr { -namespace fieldpattern { +EX namespace fieldpattern { + +#if HDR +struct primeinfo { + int p; + int cells; + bool squared; + }; + +struct fgeomextra { + eGeometry base; + vector primes; + int current_prime_id; + fgeomextra(eGeometry b, int i) : base(b), current_prime_id(i) {} + }; +#endif extern int subpathid; extern int subpathorder; @@ -760,7 +775,7 @@ fpattern& getcurrfp() { // extra information for field quotient extra configuration -vector fgeomextras = { +EX vector fgeomextras = { fgeomextra(gNormal, 3), fgeomextra(gOctagon, 1), fgeomextra(g45, 0), @@ -773,7 +788,7 @@ vector fgeomextras = { fgeomextra(gTinySphere, 0) */ }; -int current_extra = 0; +EX int current_extra = 0; void nextPrime(fgeomextra& ex) { dynamicval g(geometry, ex.base); @@ -800,7 +815,7 @@ void nextPrimes(fgeomextra& ex) { nextPrime(ex); } -void enableFieldChange() { +EX void enableFieldChange() { fgeomextra& gxcur = fgeomextras[current_extra]; fieldpattern::quotient_field_changed = true; nextPrimes(gxcur); diff --git a/floorshapes.cpp b/floorshapes.cpp index 86587000..286bcc7b 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -998,7 +998,7 @@ void geometry_information::make_floor_textures_here() { last_texture_step = vid.texture_step; } -void make_floor_textures() { +EX void make_floor_textures() { DEBBI(DF_POLY, ("make_floor_textures")); dynamicval g(geometry, gEuclidSquare); dynamicval gm(pmodel, mdDisk); diff --git a/game.cpp b/game.cpp index 6e41eddd..0d629096 100644 --- a/game.cpp +++ b/game.cpp @@ -5,6 +5,14 @@ namespace hr { +#if HDR +enum eLastmovetype { lmSkip, lmMove, lmAttack, lmPush, lmTree, lmInstant }; +extern eLastmovetype lastmovetype, nextmovetype; + +enum eForcemovetype { fmSkip, fmMove, fmAttack, fmInstant, fmActivate }; +extern eForcemovetype forcedmovetype; +#endif + EX int lastsafety; EX int mutantphase; EX int turncount; @@ -2945,7 +2953,7 @@ EX void clear_pathdata() { reachedfrom.clear(); } -int pathlock = 0; +EX int pathlock = 0; EX void compute_graphical_distance() { if(pathlock) { printf("path error: compute_graphical_distance\n"); } diff --git a/geometry.cpp b/geometry.cpp index d0bfd4e6..b929b864 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -431,14 +431,18 @@ EX void switch_always3() { EX } -geometry_information *cgip; -map cgis; +EX geometry_information *cgip; +EX map cgis; + +#if HDR +#define cgi (*cgip) +#endif int last_texture_step; int ntimestamp; -void check_cgi() { +EX void check_cgi() { string s; auto V = [&] (string a, string b) { s += a; s += ": "; s += b; s += "; "; }; V("GEO", its(int(geometry))); diff --git a/goldberg.cpp b/goldberg.cpp index e0680684..038c57cd 100644 --- a/goldberg.cpp +++ b/goldberg.cpp @@ -1,13 +1,29 @@ -namespace hr { namespace gp { - loc operator+(loc e1, loc e2) { +namespace hr { + +EX namespace gp { + + #if HDR + typedef pair loc; + + struct local_info { + int last_dir; + loc relative; + int first_dir; + int total_dir; + }; + #endif + + EX local_info draw_li; + + EX loc operator+(loc e1, loc e2) { return make_pair(e1.first+e2.first, e1.second+e2.second); } - loc operator-(loc e1, loc e2) { + EX loc operator-(loc e1, loc e2) { return make_pair(e1.first-e2.first, e1.second-e2.second); } - loc operator*(loc e1, loc e2) { + EX loc operator*(loc e1, loc e2) { return make_pair(e1.first*e2.first-e1.second*e2.second, e1.first*e2.second + e2.first*e1.second + (S3 == 3 ? e1.second*e2.second : 0)); } @@ -16,7 +32,7 @@ namespace hr { namespace gp { return loc(e1.first*i, e1.second*i); } - loc eudir(int d) { + EX loc eudir(int d) { if(S3 == 3) { d %= 6; if (d < 0) d += 6; switch(d) { @@ -38,12 +54,12 @@ namespace hr { namespace gp { } } - int length(loc p) { + EX int length(loc p) { return eudist(p.first, p.second); } #if CAP_GP - loc param(1, 0); + EX loc param = loc(1, 0); hyperpoint next; @@ -64,7 +80,7 @@ namespace hr { namespace gp { ((li.last_dir & 15) << 12); } - local_info get_local_info(cell *c) { + EX local_info get_local_info(cell *c) { local_info li; if(c == c->master->c7) { li.relative = loc(0,0); @@ -96,15 +112,15 @@ namespace hr { namespace gp { return li; } - int last_dir(cell *c) { + EX int last_dir(cell *c) { return get_local_info(c).last_dir; } - loc get_coord(cell *c) { + EX loc get_coord(cell *c) { return get_local_info(c).relative; } - int pseudohept_val(cell *c) { + EX int pseudohept_val(cell *c) { loc v = get_coord(c); return (v.first - v.second + MODFIXER)%3; } @@ -222,7 +238,7 @@ namespace hr { namespace gp { return ac0; } - void extend_map(cell *c, int d) { + EX void extend_map(cell *c, int d) { DEBB(DF_GP, ("EXTEND ",c, " ", d)); if(c->master->c7 != c) { while(c->master->c7 != c) { @@ -549,7 +565,7 @@ namespace hr { namespace gp { map, loc> center_locs; - void compute_geometry() { + EX void compute_geometry() { center_locs.clear(); if(GOLDBERG) { if(!cgi.gpdata) cgi.gpdata = make_shared(); @@ -739,20 +755,20 @@ namespace hr { namespace gp { }; } - loc univ_param() { + EX loc univ_param() { if(GOLDBERG) return param; else if(PURE) return loc(1,0); else return loc(1,1); } - void configure() { + EX void configure() { auto l = univ_param(); param = l; config = human_representation(l); pushScreen(gp::show); } - void be_in_triangle(local_info& li) { + EX void be_in_triangle(local_info& li) { int sp = 0; auto& at = li.relative; again: @@ -769,7 +785,7 @@ namespace hr { namespace gp { // from some point X, (0,0) is in distance dmain, param is in distance d0, and param*z is in distance d1 // what is the distance of at from X? - int solve_triangle(int dmain, int d0, int d1, loc at) { + EX int solve_triangle(int dmain, int d0, int d1, loc at) { loc centerloc(0, 0); auto rel = make_pair(d0-dmain, d1-dmain); if(center_locs.count(rel)) @@ -820,13 +836,13 @@ namespace hr { namespace gp { return dmain + length(centerloc-at) - length(centerloc); } - hyperpoint get_master_coordinates(cell *c) { + EX hyperpoint get_master_coordinates(cell *c) { auto li = get_local_info(c); be_in_triangle(li); return cgi.gpdata->corners * loctoh_ort(li.relative); } - int compute_dist(cell *c, int master_function(cell*)) { + EX int compute_dist(cell *c, int master_function(cell*)) { auto li = get_local_info(c); be_in_triangle(li); @@ -849,24 +865,24 @@ namespace hr { namespace gp { return solve_triangle(dmain, d0, d1, at); } - int dist_2() { + EX int dist_2() { return length(univ_param()); } - int dist_3() { + EX int dist_3() { return length(univ_param() * loc(1,1)); } - int dist_1() { + EX int dist_1() { return dist_3() - dist_2(); } #else - int dist_1() { return 1; } - int dist_2() { return BITRUNCATED ? 2 : 1; } - int dist_3() { return BITRUNCATED ? 3 : 2; } + EX int dist_1() { return 1; } + EX int dist_2() { return BITRUNCATED ? 2 : 1; } + EX int dist_3() { return BITRUNCATED ? 3 : 2; } #endif - array get_masters(cell *c) { + EX array get_masters(cell *c) { if(0); #if CAP_GP else if(GOLDBERG) { @@ -885,7 +901,7 @@ namespace hr { namespace gp { return make_array(c->move(0)->master, c->move(2)->master, c->move(4)->master); } - string operation_name() { + EX string operation_name() { if(0); #if CAP_IRR else if(IRREGULAR) diff --git a/graph.cpp b/graph.cpp index bcd12e1c..1451f4f2 100644 --- a/graph.cpp +++ b/graph.cpp @@ -7838,7 +7838,7 @@ auto graphcm = addHook(clearmemory, 0, [] () { array, ANIMLAYERS> animations; -int revhint(cell *c, int hint) { +EX int revhint(cell *c, int hint) { if(hint >= 0 && hint < c->type) return c->c.spin(hint); else return hint; } diff --git a/hyper.h b/hyper.h index 00c2ed02..b8c91705 100644 --- a/hyper.h +++ b/hyper.h @@ -2848,49 +2848,6 @@ template array make_array(T a, T b) { array x; x[0] = a; x[1 extern const hyperpoint Hypc; -namespace gp { - typedef pair loc; - - loc operator+(loc e1, loc e2); - loc operator-(loc e1, loc e2); - loc operator*(loc e1, loc e2); - extern loc eudir(int dir); - int length(loc p); - - #if CAP_GP - void compute_geometry(); - void extend_map(cell *c, int d); - extern loc param; - extern int pseudohept_val(cell *); - extern int last_dir(cell *c); - extern void configure(); - - struct local_info { - int last_dir; - loc relative; - int first_dir; - int total_dir; - }; - - extern local_info draw_li; - - local_info get_local_info(cell *c); - const char *disp(loc at); - - void be_in_triangle(local_info& li); - - int compute_dist(cell *c, int master_function(cell*)); - - int solve_triangle(int dmain, int d0, int d1, loc at); - - hyperpoint get_master_coordinates(cell *c); - loc univ_param(); - #endif - int dist_1(), dist_2(), dist_3(); - array get_masters(cell *c); - extern string operation_name(); - } - struct supersaver { string name; virtual string save() = 0; @@ -2980,7 +2937,6 @@ template<> struct saver : dsaver { string fts(ld val, int prec); string itsh(int x); -extern int debugflags; template<> struct saver : dsaver { saver(ld& val) : dsaver(val) { } @@ -3074,35 +3030,8 @@ namespace torusconfig { flagtype tmflags(); } -#if CAP_FIELD -namespace fieldpattern { - extern int current_extra; - - struct primeinfo { - int p; - int cells; - bool squared; - }; - - struct fgeomextra { - eGeometry base; - vector primes; - int current_prime_id; - fgeomextra(eGeometry b, int i) : base(b), current_prime_id(i) {} - }; - - extern vector fgeomextras; - extern void enableFieldChange(); - } -#endif - -bool incompatible(eLand l1, eLand l2); - struct plainshape; void clear_plainshape(plainshape& gsh); -#if CAP_GP -void build_plainshape(plainshape& gsh, gp::local_info& li); -#endif namespace gp { void clear_plainshapes(); @@ -3467,134 +3396,13 @@ hpcshape int timestamp; }; -#if MAXMDIM >= 4 -void make_floor_textures(); -#endif - -extern map cgis; -extern geometry_information *cgip; -void check_cgi(); -#define cgi (*cgip) - -#if ISMOBILE -bool buttonclicked; -void gdpush(int t); -#endif - -extern int fontscale; - -bool confusingGeometry(); - -int revhint(cell *c, int hint); - -extern int pathlock; -extern void computePathdist(eMonster m); -extern void onpath(cell *c, int d); -extern void clear_pathdata(); - -extern int timetowait; - #define RING(i) for(double i=0; i<=cgi.S84+1e-6; i+=SD3 * pow(.5, vid.linequality)) #define REVRING(i) for(double i=cgi.S84; i>=-1e-6; i-=SD3 * pow(.5, vid.linequality)) #define PRING(i) for(double i=0; i<=cgi.S84+1e-6; i+= pow(.5, vid.linequality)) #define REVPRING(i) for(double i=cgi.S84; i>=-1e-6; i-=pow(.5, vid.linequality)) -#if MAXMDIM == 4 -namespace euclid3 { - hrmap* new_map(); - void draw(); - int dist_relative(cell *c); - void build_torus3(); - void clear_torus3(); - void show_torus3(); - } - -namespace reg3 { - void generate(); - hrmap* new_map(); - extern vector cellshape; - int celldistance(cell *c1, cell *c2); - bool pseudohept(cell *c); - inline short& altdist(heptagon *h) { return h->emeraldval; } - extern transmatrix spins[12], adjmoves[12]; - int bucketer(hyperpoint h); - extern bool dirs_adjacent[16][16]; - cellwalker strafe(cellwalker cw, int j); - } -#endif - -namespace crystal { - #if CAP_CRYSTAL - static const int MAXDIM = 7; - typedef array coord; - static const coord c0 = {}; - - typedef array ldcoord; - static const ldcoord ldc0 = {}; - - heptagon *get_heptagon_at(coord c); - coord get_coord(heptagon *h); - ldcoord get_ldcoord(cell *c); - - extern colortable coordcolors; - extern ld compass_probability; - extern bool view_coordinates; - color_t colorize(cell *c); - int precise_distance(cell *c1, cell *c2); - ld space_distance(cell *c1, cell *c2); - hrmap *new_map(); - void build_rugdata(); - void apply_rotation(const transmatrix t); - void switch_z_coordinate(); - void next_home_orientation(); - void flip_z(); - void set_land(cell *c); - int dist_alt(cell *c); - int dist_relative(cell *c); - void show(); - void init_rotation(); - string get_table_volume(); - string get_table_boundary(); - bool pure(); - ld compass_angle(); - string compass_help(); - void may_place_compass(cell *c); - void centerrug(ld aspd); - vector build_shortest_path(cell *c1, cell *c2); - #endif - } - -int towerval(cell *c, const cellfunction& cf); - -#if CAP_COMPLEX2 -namespace brownian { - const int level = 5; - void init(cell *c); - void build(cell *c, int d); - void explosion(cell *c, int x); - }; -#else -namespace brownian { - inline void dissolve_brownian(cell*, int) {}; - inline void build(cell *c, int d) {} - inline void init(cell *c) {} - } -#endif - #define ONEMPTY if(d == 7 && passable(c, NULL, 0) && !safety && !reptilecheat) -void menuitem_sightrange(char c = 'r'); - -namespace dq { - extern queue> drawqueue; - - extern set visited; - void enqueue(heptagon *h, const transmatrix& T); - - extern set visited_by_matrix; - void enqueue_by_matrix(heptagon *h, const transmatrix& T); - } - template void texture_order(const T& f) { const int STEP = vid.texture_step; const ld STEP2 = STEP; @@ -3613,13 +3421,6 @@ template void texture_order(const T& f) { } } -/* lastmovetype uses lmSkip, lmMove, lmAttack, lmPush, lmTree */ -enum eLastmovetype { lmSkip, lmMove, lmAttack, lmPush, lmTree, lmInstant }; -extern eLastmovetype lastmovetype, nextmovetype; - -enum eForcemovetype { fmSkip, fmMove, fmAttack, fmInstant, fmActivate }; -extern eForcemovetype forcedmovetype; - static const color_t NOCOLOR = 0; typedef pair euc_pointer; diff --git a/hypgraph.cpp b/hypgraph.cpp index 900e6668..c571cf68 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -971,8 +971,6 @@ void drawrec(cell *c, const transmatrix& V) { } } */ - gp::local_info draw_li; - bool drawrec(cell *c, const transmatrix& V, gp::loc at, int dir, int maindir) { bool res = false; transmatrix V1 = V * cgi.gpdata->Tf[draw_li.last_dir][at.first&31][at.second&31][fixg6(dir)]; @@ -1829,19 +1827,19 @@ struct bandfixer { }; #endif -namespace dq { - queue> drawqueue; +EX namespace dq { + EX queue> drawqueue; - set visited; - void enqueue(heptagon *h, const transmatrix& T) { + EX set visited; + EX void enqueue(heptagon *h, const transmatrix& T) { if(!h || visited.count(h)) { return; } visited.insert(h); drawqueue.emplace(h, T, band_shift); } #if MAXMDIM >= 4 - set visited_by_matrix; - void enqueue_by_matrix(heptagon *h, const transmatrix& T) { + EX set visited_by_matrix; + EX void enqueue_by_matrix(heptagon *h, const transmatrix& T) { if(!h) return; int b = reg3::bucketer(tC0(T)); if(visited_by_matrix.count(b)) { return; } @@ -1849,7 +1847,7 @@ namespace dq { drawqueue.emplace(h, T, band_shift); } #endif - } + EX } EX bool do_draw(cell *c) { // do not display out of range cells, unless on torus diff --git a/makeh.cpp b/makeh.cpp index 9ab5ad3e..00a19b90 100644 --- a/makeh.cpp +++ b/makeh.cpp @@ -3,6 +3,7 @@ #include #include #include +#include using namespace std; @@ -28,7 +29,11 @@ void mark_file() { int in_hdr; +set seen; + void gen(string s) { + if(seen.count(s)) return; + seen.insert(s); which_file = s; ifstream in(s); while(getline(in, s)) { diff --git a/reg3.cpp b/reg3.cpp index 7a76b4fc..41533c06 100644 --- a/reg3.cpp +++ b/reg3.cpp @@ -16,11 +16,15 @@ namespace binary { hyperpoint deparabolic3(hyperpoint h); } -namespace reg3 { +EX namespace reg3 { + + #if HDR + inline short& altdist(heptagon *h) { return h->emeraldval; } + #endif map close_distances; - int bucketer(ld x) { + EX int bucketer(ld x) { return int(x * 10 + 100000.5) - 100000; } @@ -30,13 +34,13 @@ namespace reg3 { int loop, face; - vector cellshape; + EX vector cellshape; vector vertices_only; - transmatrix spins[12], adjmoves[12]; + EX transmatrix spins[12], adjmoves[12]; ld adjcheck, strafedist; - bool dirs_adjacent[16][16]; + EX bool dirs_adjacent[16][16]; template ld binsearch(ld dmin, ld dmax, const T& f) { for(int i=0; i<200; i++) { @@ -47,7 +51,7 @@ namespace reg3 { return dmin; } - void generate() { + EX void generate() { if(S7 == 4) face = 3; if(S7 == 6) face = 4; @@ -805,7 +809,7 @@ namespace reg3 { } }; -hrmap* new_map() { +EX hrmap* new_map() { if(quotient) return new hrmap_field3; return new hrmap_reg3; } @@ -814,7 +818,7 @@ hrmap_reg3* regmap() { return ((hrmap_reg3*) currentmap); } -int celldistance(cell *c1, cell *c2) { +EX int celldistance(cell *c1, cell *c2) { if(c1 == c2) return 0; if(c1 == currentmap->gamestart()) return c2->master->distance; if(c2 == currentmap->gamestart()) return c1->master->distance; @@ -829,7 +833,7 @@ int celldistance(cell *c1, cell *c2) { return 20 + binary::celldistance3(r->reg_gmatrix[c1->master].first, r->reg_gmatrix[c2->master].first); } -bool pseudohept(cell *c) { +EX bool pseudohept(cell *c) { auto m = regmap(); if(sphere) { hyperpoint h = tC0(m->relative_matrix(c->master, regmap()->origin)); @@ -958,7 +962,7 @@ int dist_alt(cell *c) { // as possible to cw.spin. Assume that j and cw.spin are adjacent #if MAXMDIM >= 4 -cellwalker strafe(cellwalker cw, int j) { +EX cellwalker strafe(cellwalker cw, int j) { hyperpoint hfront = tC0(adjmoves[cw.spin]); transmatrix T = currentmap->relative_matrix(cw.at->cmove(j)->master, cw.at->master); for(int i=0; ic.spin(j))