1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

fixed some CAP guards

This commit is contained in:
Zeno Rogue 2022-05-06 12:40:48 +02:00
parent 075630e753
commit 78b0324a91
12 changed files with 57 additions and 3 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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
}

View File

@ -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) {

View File

@ -908,12 +908,14 @@ void geometry_information::generate_floorshapes() {
generate_floorshapes_for(0, &model, 1, 0);
}
#if CAP_BT
else if(bt::in()) {
dynamicval<hrmap*> 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;

View File

@ -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;
}

View File

@ -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<pair<int, string>> timestamps;

View File

@ -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);

View File

@ -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;
}

View File

@ -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<int> dy(shot::shoty, rug::texturesize);
shot::postprocess(filename + "-rug.png", s, s);
}
#endif
#if MAXMDIM >= 4
if(isize(texture_position) || isize(gradient_position)) {

View File

@ -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();

View File

@ -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);