From 78b0324a91bbcc71ac745993c111ba2872f72e05 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 6 May 2022 12:40:48 +0200 Subject: [PATCH] fixed some CAP guards --- bigstuff.cpp | 2 ++ cell.cpp | 2 ++ complex2.cpp | 12 ++++++++++-- debug.cpp | 2 ++ floorshapes.cpp | 2 ++ geom-exp.cpp | 2 ++ geometry.cpp | 2 ++ intra.cpp | 22 ++++++++++++++++++++++ mapeditor.cpp | 2 ++ screenshot.cpp | 4 ++++ textures.cpp | 6 +++++- util.cpp | 2 ++ 12 files changed, 57 insertions(+), 3 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index 535d0cb7..4f0db017 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -1788,6 +1788,7 @@ EX eMonster camelot_monster() { } EX void buildCamelot(cell *c) { + #if CAP_COMPLEX2 int d = celldistAltRelative(c); if(anthrax() || (d <= 14 && roundTableRadius(c) > 20)) { gen_alt(c); @@ -1852,6 +1853,7 @@ EX void buildCamelot(cell *c) { if(c->land == laNone) printf("Camelot\n"); // NONEDEBUG } } + #endif } EX int masterAlt(cell *c) { diff --git a/cell.cpp b/cell.cpp index e6b4ef49..68b3cb12 100644 --- a/cell.cpp +++ b/cell.cpp @@ -267,6 +267,8 @@ void hrmap_standard::find_cell_connection(cell *c, int d) { if(IRREGULAR) { irr::link_cell(c, d); } + #else + if(0) {} #endif #if CAP_GP else if(GOLDBERG) { diff --git a/complex2.cpp b/complex2.cpp index 3d137931..ce2637f9 100644 --- a/complex2.cpp +++ b/complex2.cpp @@ -8,10 +8,10 @@ */ #include "hyper.h" -#if CAP_COMPLEX2 namespace hr { +#if CAP_COMPLEX2 EX namespace brownian { #if HDR @@ -1450,5 +1450,13 @@ EX namespace dice { int hook = addHook(hooks_clearmemory, 0, [] () { data.clear(); }); EX } -} #endif + +#if !CAP_COMPLEX2 +EX namespace dice { + EX bool on(cell *c) { return false; } + EX bool swap_forbidden(cell *a, cell *b) { return false; } + EX void chaos_swap(cellwalker wa, cellwalker wb) {} +EX } +#endif +} diff --git a/debug.cpp b/debug.cpp index 2feda6e8..b6fcc3c2 100644 --- a/debug.cpp +++ b/debug.cpp @@ -403,6 +403,7 @@ struct debugScreen { dialog::use_hexeditor(); }); } + #if CAP_COMPLEX2 if(dice::on(what)) { dialog::addSelItem(XLAT("die shape"), dice::die_name(dice::data[what].which), 'A'); dialog::add_action_push([what] { @@ -435,6 +436,7 @@ struct debugScreen { }); dialog::addBoolItem_action(XLAT("die mirror status"), dice::data[what].mirrored, 'D'); } + #endif dialog::addBreak(50); if(show_debug_data) { diff --git a/floorshapes.cpp b/floorshapes.cpp index d1f2d336..6c1bafd6 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -908,12 +908,14 @@ void geometry_information::generate_floorshapes() { generate_floorshapes_for(0, &model, 1, 0); } + #if CAP_BT else if(bt::in()) { dynamicval c(currentmap, bt::new_alt_map(nullptr)); model.type = S6; generate_floorshapes_for(0, &model, 0, 0); model.type = S7; generate_floorshapes_for(1, &model, 1, 0); delete currentmap; } + #endif else { static hrmap_standard stdmap; diff --git a/geom-exp.cpp b/geom-exp.cpp index 1ce5d027..8093adcb 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -634,7 +634,9 @@ EX string full_geometry_name() { string fgname = XLAT(ginf[geometry].tiling_name); if(qstring != "none") fgname += " " + XLAT(qstring); + #if CAP_ARCM if(arcm::in()) fgname = arcm::current.symbol; + #endif if(variable) fgname = gp::operation_name() + " " + fgname; return fgname; } diff --git a/geometry.cpp b/geometry.cpp index bb5691a8..13b9c642 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1232,7 +1232,9 @@ EX void check_cgi() { cgi.timestamp = ++ntimestamp; if(hybri) hybrid::underlying_cgip->timestamp = ntimestamp; if(fake::in()) fake::underlying_cgip->timestamp = ntimestamp; + #if CAP_ARCM if(arcm::alt_cgip) arcm::alt_cgip->timestamp = ntimestamp; + #endif if(isize(cgis) > 4 && IFINTRA(intra::data.empty(), true)) { vector> timestamps; diff --git a/intra.cpp b/intra.cpp index 8578d278..26103465 100644 --- a/intra.cpp +++ b/intra.cpp @@ -75,6 +75,7 @@ hyperpoint portal_data::to_poco(hyperpoint h) const { h[3] = 1; return h; } + #if CAP_BT else if(hyperbolic && bt::in()) { h = deparabolic13(h); h[3] = 1; @@ -83,6 +84,7 @@ hyperpoint portal_data::to_poco(hyperpoint h) const { h[2] *= exp(h[1]); return h; } + #endif else if(sol) { h = T * h; h[2] *= exp(-h[1]); @@ -103,10 +105,12 @@ hyperpoint portal_data::from_poco(hyperpoint h) const { if(prod && kind == 1) { ld xd = h[2]; if(d<0) xd = -xd, h[0] = -h[0]; + #if CAP_BT if(bt::in()) { h[2] = 0; return PIU( parabolic13(h) ) * exp(d+xd); } + #endif h[2] = 1; auto z = product_decompose(h).first; return iT * h * exp(d+xd-z); @@ -119,6 +123,7 @@ hyperpoint portal_data::from_poco(hyperpoint h) const { h[3] = 1; return iT * h * exp(h0[1]); } + #if CAP_BT else if(hyperbolic && bt::in()) { h[2] *= exp(-h[1]); h = iT * h; @@ -128,6 +133,7 @@ hyperpoint portal_data::from_poco(hyperpoint h) const { h[2] *= exp(h[1]); return iT * h; } + #endif else { h[3] = 1; if(sphere) @@ -151,6 +157,7 @@ EX portal_data make_portal(cellwalker cw, int spin) { id.kind = 1; id.d = product_decompose(fac[0]).first; id.v0 = C0 * exp(id.d); + #if CAP_BT if(bt::in()) { for(auto h: fac) println(hlog, PIU(deparabolic13(normalize_flat(h)))); @@ -160,6 +167,9 @@ EX portal_data make_portal(cellwalker cw, int spin) { fac.erase(fac.begin() + 1); id.scale = log(2)/2; } + #else + if(false) {} + #endif else { hyperpoint ctr = Hypc; for(auto p: fac) ctr += product_decompose(p).second; @@ -183,6 +193,7 @@ EX portal_data make_portal(cellwalker cw, int spin) { println(hlog, kz(h), " -> ", kz(spintox(id.v0)*h), " -> ", kz(cpush(0, -hdist0(id.v0))) * kz(spintox(id.v0) * h), " -> ", kz(id.to_poco(h))); } } + #if CAP_BT else if(bt::in()) { hyperpoint removed = Hypc; @@ -236,6 +247,7 @@ EX portal_data make_portal(cellwalker cw, int spin) { sca = pow(sca, .5 / isize(v)); id.scale = sca / 2; } + #endif else { id.kind = 0; id.v0 = project_on_triangle(fac[0], fac[1], fac[2]); @@ -552,7 +564,9 @@ EX void check_portal_movement() { ds[2] = inverse(get_shift_view_of(ctangent(1, +eps), View)) * C0; ds[3] = inverse(get_shift_view_of(ctangent(0, +eps), View)) * C0; if(debug_portal & 8) { + #if CAP_BT println(hlog, "at = ", ds[0], " det = ", dsdet(ds), " bt = ", bt::minkowski_to_bt(ds[0])); + #endif analyze_orthonormal(ds, ss); } @@ -600,7 +614,9 @@ EX void check_portal_movement() { xds[1] = inverse(get_shift_view_of(ctangent(2, -eps), View)) * C0; xds[2] = inverse(get_shift_view_of(ctangent(1, +eps), View)) * C0; xds[3] = inverse(get_shift_view_of(ctangent(0, +eps), View)) * C0; + #if CAP_BT println(hlog, "goal: at = ", xds[0], " det = ", dsdet(xds), " bt = ", bt::minkowski_to_bt(xds[0])); + #endif } ld scale = p->id2.scale / p->id1.scale; @@ -871,12 +887,14 @@ EX void handle() { default: throw hr_exception("not solnihv"); } } + #if CAP_BT else if(colors_of_floors.empty() && hyperbolic && bt::in()) { auto z = bt::minkowski_to_bt(inverse(View) * C0); on_floor_of = centerover; floor_dir = z[2] > 0 ? bt::updir() : 0; println(hlog, "set floor_dir to ", floor_dir); } + #endif else { println(hlog, "there are ", isize(choices), " choices for floor_dir"); if(!on_floor_of) return; @@ -895,6 +913,7 @@ EX void handle() { f.hy = ToOld * csh.faces_local[floor_dir][2]; auto find_nearest = [&] (const face& fac, hyperpoint at) { + #if CAP_BT if(sol) { at[2] = fac.h0[2]; return at; } else if(hyperbolic && bt::in()) { auto z = bt::minkowski_to_bt(at); @@ -909,6 +928,9 @@ EX void handle() { dep[0] = h[0]; return zshift(PIU(parabolic13(dep)), dec.first); } + #else + if(false) {} + #endif else { transmatrix M = ray::mirrorize(currentmap->ray_iadj(on_floor_of, floor_dir)); M = ToOld * M * inverse(ToOld); diff --git a/mapeditor.cpp b/mapeditor.cpp index 47bbab73..b2db3899 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -158,8 +158,10 @@ EX namespace mapeditor { EX void clear_dtshapes() { dtshapes.clear(); } EX shiftpoint full_mouseh() { + #if CAP_EDIT if(GDIM == 3) return find_mouseh3(); if(snapping) return mouse_snap(); + #endif return mouseh; } diff --git a/screenshot.cpp b/screenshot.cpp index 45f3db07..bf46c407 100644 --- a/screenshot.cpp +++ b/screenshot.cpp @@ -377,7 +377,9 @@ EX always_false in; if(!p.tinf) return 0; #if CAP_PNG if(!textures) return 0; + #if CAP_RUG if(p.tinf == &rug::tinf) return 1; + #endif #if MAXMDIM >= 4 if(p.tinf->texture_id == (int) floor_textures->renderedTexture) return (p.tinf->tvertices[0][0] == 0) ? 2 : 3; @@ -574,6 +576,7 @@ EX always_false in; } #if CAP_PNG + #if CAP_RUG if(used_rug) { resetbuffer rb; rug::glbuf->enable(); @@ -582,6 +585,7 @@ EX always_false in; dynamicval dy(shot::shoty, rug::texturesize); shot::postprocess(filename + "-rug.png", s, s); } + #endif #if MAXMDIM >= 4 if(isize(texture_position) || isize(gradient_position)) { diff --git a/textures.cpp b/textures.cpp index e6942ba2..527abda0 100644 --- a/textures.cpp +++ b/textures.cpp @@ -1050,8 +1050,10 @@ bool texture_config::save() { if(arb::in()) tes = arb::current.filename; + csymbol = ""; + #if CAP_ARCM if(arcm::in()) csymbol = arcm::current.symbol; - else csymbol = ""; + #endif for(auto s: texturesavers) if(s->dosave()) fprintf(f, "%s=%s\n", s->name.c_str(), s->save().c_str()); @@ -1080,6 +1082,7 @@ bool texture_config::load() { if(targetgeometry != geometry) { stop_game(); + #if CAP_ARCM if(targetgeometry == gArchimedean) { arcm::current.symbol = csymbol; arcm::current.parse(); @@ -1089,6 +1092,7 @@ bool texture_config::load() { return false; } } + #endif if(targetgeometry == gArbitrary) { arb::run(tes); stop_game(); diff --git a/util.cpp b/util.cpp index 0836b2da..b5c797a1 100644 --- a/util.cpp +++ b/util.cpp @@ -394,7 +394,9 @@ cld exp_parser::parse(int prio) { else if(number == "random") res = randd(); else if(number == "mousez") res = cld(mousex - current_display->xcenter, mousey - current_display->ycenter) / cld(current_display->radius, 0); else if(number == "shot") res = inHighQual ? 1 : 0; + #if CAP_ARCM else if(number == "fake_edgelength") res = arcm::fake_current.edgelength; + #endif else if(number == "MAX_EDGE") res = FULL_EDGE; else if(number == "MAX_VALENCE") res = 120; else if(number[0] >= 'a' && number[0] <= 'z') throw hr_parse_exception("unknown value: " + number);