From 43bf7c5cfe6e587e07011b313af8b0ad8eeff72a Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 3 Nov 2019 14:19:11 +0100 Subject: [PATCH] fixed MAXMDIM guards --- crystal.cpp | 6 ++++-- graph.cpp | 6 ++++-- hyperpoint.cpp | 7 +++++++ hypgraph.cpp | 4 +--- raycaster.cpp | 9 +++++++++ reg3.cpp | 10 +--------- sky.cpp | 3 ++- 7 files changed, 28 insertions(+), 17 deletions(-) diff --git a/crystal.cpp b/crystal.cpp index 3168ccb0..8a21a8d3 100644 --- a/crystal.cpp +++ b/crystal.cpp @@ -406,8 +406,10 @@ struct hrmap_crystal : hrmap_standard { bool crystal3() { return WDIM == 3; } hrmap_crystal() { - if(crystal3()) reg3::generate(), cs.dim = 4; - else cs.build(); +#if MAXMDIM >= 4 + if(crystal3()) reg3::generate(), cs.dim = 4; else +#endif + cs.build(); camelot_center = NULL; } diff --git a/graph.cpp b/graph.cpp index 2b426cfc..8ee6d188 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3791,6 +3791,8 @@ EX int ceiling_category(cell *c) { } } +#endif + EX void set_detail_level(const transmatrix& V) { ld dist0 = hdist0(tC0(V)) - 1e-6; if(vid.use_smart_range) detaillevel = 2; @@ -3807,8 +3809,6 @@ EX void set_detail_level(const transmatrix& V) { } } -#endif - struct flashdata { int t; int size; @@ -4455,7 +4455,9 @@ EX void drawthemap() { for(int m=0; m= 4 ray::in_use = ray::requested(); + #endif no_wall_rendering = ray::in_use; // ray::comparison_mode = true; if(ray::comparison_mode) no_wall_rendering = false; diff --git a/hyperpoint.cpp b/hyperpoint.cpp index f4ee30ef..3246cf29 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -1193,5 +1193,12 @@ EX ld raddif(ld a, ld b) { return d; } +EX int bucketer(ld x) { + return int(x * 10 + 100000.5) - 100000; + } + +EX int bucketer(hyperpoint h) { + return bucketer(h[0]) + 1000 * bucketer(h[1]) + 1000000 * bucketer(h[2]); + } } diff --git a/hypgraph.cpp b/hypgraph.cpp index 2e7df472..5c0c56ee 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -2011,16 +2011,14 @@ EX namespace dq { drawqueue.emplace(h, T, band_shift); } - #if MAXMDIM >= 4 EX set visited_by_matrix; EX void enqueue_by_matrix(heptagon *h, const transmatrix& T) { if(!h) return; - int b = reg3::bucketer(tC0(T)); + int b = bucketer(tC0(T)); if(visited_by_matrix.count(b)) { return; } visited_by_matrix.insert(b); drawqueue.emplace(h, T, band_shift); } - #endif EX } EX bool do_draw(cell *c) { diff --git a/raycaster.cpp b/raycaster.cpp index 5ddf3611..cfccb3d2 100644 --- a/raycaster.cpp +++ b/raycaster.cpp @@ -11,6 +11,8 @@ namespace hr { EX namespace ray { +#if MAXMDIM >= 4 + /** texture IDs */ GLuint txConnections = 0, txWallcolor = 0, txTextureMap = 0; @@ -1046,6 +1048,13 @@ int readArgs() { auto hook = addHook(hooks_args, 100, readArgs); #endif +#endif +#if MAXMDIM == 3 +EX always_false in_use; +EX always_false comparison_mode; +EX void reset_raycaster() { } +EX void cast() { } +#endif EX } } diff --git a/reg3.cpp b/reg3.cpp index 5bd50129..6331f22f 100644 --- a/reg3.cpp +++ b/reg3.cpp @@ -28,14 +28,6 @@ EX namespace reg3 { map close_distances; - EX int bucketer(ld x) { - return int(x * 10 + 100000.5) - 100000; - } - - EX int bucketer(hyperpoint h) { - return bucketer(h[0]) + 1000 * bucketer(h[1]) + 1000000 * bucketer(h[2]); - } - EX int loop; EX int face; @@ -288,7 +280,7 @@ EX namespace reg3 { void seek(set& seen_matrices, set& seen_codes, const transmatrix& at, int ccode, const hyperpoint checker) { if(hdist0(tC0(at)) > 4) return; - int b = reg3::bucketer(tC0(at)); + int b = bucketer(tC0(at)); if(seen_matrices.count(b)) return; seen_matrices.insert(b); for(int a=0; a= 4 EX ld camera_level; EX int get_skybrightness(int mul IS(1)) { @@ -295,5 +296,5 @@ void celldrawer::draw_ceiling() { } } } - +#endif }