added some missing CAP_ and MAXMDIM guards

This commit is contained in:
Zeno Rogue 2019-05-07 01:08:49 +02:00
parent 044298d0bd
commit c8e950cd40
25 changed files with 126 additions and 25 deletions

View File

@ -7,6 +7,8 @@
namespace hr {
#if MAXMDIM >= 4
#define S (scalefactor / 0.805578)
#define SH (scalefactor / 0.805578 * geom3::height_width / 1.5)
@ -858,5 +860,6 @@ void make_3d_models() {
#undef S
#undef SH
#endif
}

View File

@ -734,6 +734,7 @@ void buildCrossroads2(cell *c) {
}
}
#if MAXMDIM >= 4
void extend3D(cell *c) {
eLand l1 = c->land;
c->barleft = NOWALLSEP_USED;
@ -812,13 +813,16 @@ bool buildBarrier3D(cell *c, eLand l2, int forced_dir) {
built = true;
return true;
}
#endif
bool buildBarrierNowall(cell *c, eLand l2, int forced_dir) {
#if MAXMDIM >= 4
// 3D binary tilings create walls using their own methods
if(DIM == 3 && binarytiling) return false;
if(DIM == 3 && hyperbolic) return buildBarrier3D(c, l2, forced_dir);
#endif
if(c->land == laNone) {
printf("barrier nowall! [%p]\n", c);

View File

@ -686,6 +686,8 @@ void resetGL() {
delete glfont[i];
glfont[i] = NULL;
}
#endif
#if MAXMDIM >= 4
if(floor_textures) {
delete floor_textures;
floor_textures = NULL;

View File

@ -40,7 +40,9 @@ int celldistAltRelative(cell *c) {
#if CAP_CRYSTAL
if(geometry == gCrystal) return crystal::dist_relative(c);
#endif
#if MAXMDIM >= 4
if(euclid && DIM == 3) return euclid3::dist_relative(c);
#endif
if(euwrap) return celldistAlt(c) - roundTableRadius(c);
if(sphere || quotient) {
return celldist(c) - 3;
@ -586,6 +588,7 @@ void buildEquidistant(cell *c) {
if(c->land == laEndorian) {
int ct = c->type;
#if CAP_BT
if(binarytiling) {
int skip = geometry == gHoroRec ? 3 : 2;
if(c->landparam == 1)
@ -603,7 +606,10 @@ void buildEquidistant(cell *c) {
c->landflags = 1;
if(c->landflags) c->wall = (DIM == 3 ? waTrunk3 : waTrunk);
}
else if(DIM == 3 && hyperbolic) {
else
#endif
#if MAXMDIM >= 4
if(DIM == 3 && hyperbolic) {
if(c->landparam == 1)
c->landflags = (hrand(100) < 20);
else if(S7 == 12) {
@ -655,7 +661,9 @@ void buildEquidistant(cell *c) {
}
if(c->landflags) c->wall = waTrunk3;
}
else if(c->landparam == 1 && ctof(c)) {
else
#endif
if(c->landparam == 1 && ctof(c)) {
for(int i=0; i<ct; i++) {
int i1 = (i+1) % c->type;
if(c->move(i) && c->move(i)->land != laEndorian && c->move(i)->land != laNone)
@ -1462,7 +1470,9 @@ void buildCamelot(cell *c) {
}
int masterAlt(cell *c) {
#if MAXMDIM >= 4
if(DIM == 3 && hyperbolic) return reg3::altdist(c->master);
#endif
return c->master->alt->distance;
}

View File

@ -206,6 +206,7 @@ namespace binary {
breakhere();
return NULL;
}
#if MAXMDIM >= 4
case gBinary3: {
switch(d) {
case 0: case 1:
@ -311,7 +312,7 @@ namespace binary {
return path(h, 12, (z+1)%3+3, {13, z+6});
}
}
#endif
default: ;
}
printf("error: case not handled in binary tiling\n");
@ -758,7 +759,6 @@ int celldistance3(heptagon *c1, heptagon *c2) {
}
int celldistance3(cell *c1, cell *c2) { return celldistance3(c1->master, c2->master); }
#endif
void virtualRebaseSimple(heptagon*& base, transmatrix& at) {
@ -791,6 +791,7 @@ void virtualRebaseSimple(heptagon*& base, transmatrix& at) {
return;
}
}
#endif
}

View File

@ -224,13 +224,19 @@ void initcells() {
#if CAP_ARCM
else if(archimedean) currentmap = arcm::new_map();
#endif
#if MAXMDIM >= 4
else if(euclid && DIM == 3) currentmap = euclid3::new_map();
#endif
else if(fulltorus) currentmap = new hrmap_torus;
else if(euclid) currentmap = new hrmap_euclidean;
#if MAXMDIM >= 4
else if(DIM == 3 && !binarytiling) currentmap = reg3::new_map();
#endif
else if(sphere) currentmap = new hrmap_spherical;
else if(quotient) currentmap = new quotientspace::hrmap_quotient;
#if CAP_BT
else if(binarytiling) currentmap = binary::new_map();
#endif
else currentmap = new hrmap_hyperbolic;
allmaps.push_back(currentmap);
@ -436,10 +442,10 @@ int celldistAlt(cell *c) {
if(sphere || quotient) {
return celldist(c) - 3;
}
#if MAXMDIM == 4
#if MAXMDIM >= 4
if(euclid && DIM == 3) return euclid3::dist_alt(c);
#endif
if(hyperbolic && DIM == 3) return reg3::altdist(c->master);
#endif
if(!c->master->alt) return 0;
#if CAP_IRR
if(IRREGULAR) return irr::celldist(c, true);
@ -869,11 +875,13 @@ int celldistance(cell *c1, cell *c2) {
if(binarytiling && DIM == 3)
return binary::celldistance3(c1, c2);
#endif
#if MAXMDIM >= 4
if(euclid && DIM == 3)
return euclid3::celldistance(c1, c2);
if(hyperbolic && DIM == 3) return reg3::celldistance(c1, c2);
#endif
return hyperbolic_celldistance(c1, c2);
}

View File

@ -879,7 +879,8 @@ void configureOther() {
dialog::addBoolItem_action(XLAT("skip the start menu"), vid.skipstart, 'm');
dialog::addBoolItem_action(XLAT("forget faraway cells"), memory_saving_mode, 'y');
#if CAP_AUDIO
if(CAP_AUDIO) {
dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b');
dialog::add_action([] {
@ -908,6 +909,7 @@ void configureOther() {
dialog::bound_up(MIX_MAX_VOLUME);
});
}
#endif
menuitem_sightrange('r');
@ -1228,6 +1230,7 @@ void show3D() {
dialog::addBreak(50);
dialog::addSelItem(XLAT("projection"), current_proj_name(), 'M');
}
#if MAXMDIM >= 4
if(DIM == 3) add_edit_fov('f');
if(DIM == 3) {
dialog::addSelItem(XLAT("radar size"), fts3(vid.radarsize), 'r');
@ -1259,6 +1262,7 @@ void show3D() {
};
});
}
#endif
dialog::addBreak(50);
#if CAP_RUG

View File

@ -604,8 +604,10 @@ void showEuclideanMenu() {
dialog::add_action_push([] { ge_select_tiling(quotientlist); });
#if MAXMDIM >= 4
dialog::addSelItem(XLAT("dimension"), its(DIM), 'd');
dialog::add_action_push([] { ge_select_tiling(list3d); });
#endif
#if CAP_IRR
if(hyperbolic && IRREGULAR) {

View File

@ -213,27 +213,33 @@ transmatrix calc_relative_matrix_help(cell *c, heptagon *h1) {
struct horo_distance {
ld a, b;
horo_distance(hyperpoint h1) {
#if CAP_BT
if(binarytiling) {
b = intval(h1, C0);
a = abs(binary::horo_level(h1));
}
else
#endif
a = 0, b = intval(h1, C0);
}
horo_distance(hyperpoint h1, const transmatrix& T) {
#if CAP_BT
if(binarytiling) {
hyperpoint ih1 = inverse(T) * h1;
b = intval(ih1, C0);
a = abs(binary::horo_level(ih1));
}
else
#endif
a = 0, b = intval(h1, tC0(T));
}
bool operator < (const horo_distance z) {
#if CAP_BT
if(binarytiling) {
if(a < z.a-1e-6) return true;
if(a > z.a+1e-6) return false;
}
#endif
return b < z.b - 1e-4;
}
};

View File

@ -4961,14 +4961,17 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
char xch = winf[c->wall].glyph;
#if MAXMDIM >= 4
if(DIM == 3) {
color_t dummy;
if(isWall3(c, wcol)) {
color_t wcol2 = wcol;
#if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive) wcol2 = texture::config.recolor(wcol);
#endif
int d = (wcol & 0xF0F0F0) >> 4;
for(int a=0; a<c->type; a++)
if(c->move(a) && !isWall3(c->move(a), dummy)) {
if(a < 4 && pmodel == mdPerspective && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue;
@ -5033,6 +5036,9 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
if(rd == 2)
queuepoly(face_the_player(V), shLoveRing, darkena(0x402030, 0, 0xFF));
}
#else
if(0) ;
#endif
else switch(c->wall) {
@ -6681,8 +6687,10 @@ auto graphcm = addHook(clearmemory, 0, [] () {
});
void resetGeometry() {
#if MAXMDIM >= 4
if(DIM == 3 && !floor_textures)
make_floor_textures();
#endif
precalc();
#if CAP_FIELD
if(hyperbolic && &currfp != &fieldpattern::fp_invalid) currfp.analyze();

View File

@ -1300,8 +1300,10 @@ namespace mapeditor {
extern cell *drawcell;
void initdraw(cell *c);
#if CAP_EDIT
void showMapEditor();
void showDrawEditor();
#endif
enum eShapegroup { sgPlayer, sgMonster, sgItem, sgFloor, sgWall };
static const int USERSHAPEGROUPS = 5;

View File

@ -1174,8 +1174,10 @@ void optimizeview() {
int i1 = i * DUALMUL;
heptagon *h2 = createStep(viewctr.at, i1);
transmatrix T = currentmap->relative_matrix(h2, viewctr.at);
#if MAXMDIM >= 4
if(euclid && DIM == 3)
T = euclid3::move_matrix(viewctr.at->c7, i);
#endif
hyperpoint H = View * tC0(T);
ld quality = hdist0(H);
if(quality < best) best = quality, turn = i1, TB = T;
@ -1637,6 +1639,7 @@ namespace dq {
drawqueue.emplace(h, T, band_shift);
}
#if MAXMDIM >= 4
set<int> visited_by_matrix;
void enqueue_by_matrix(heptagon *h, const transmatrix& T) {
if(!h) return;
@ -1645,6 +1648,7 @@ namespace dq {
visited_by_matrix.insert(b);
drawqueue.emplace(h, T, band_shift);
}
#endif
}
bool do_draw(cell *c) {

View File

@ -426,8 +426,10 @@ void giantLandSwitch(cell *c, int d, cell *from) {
}
else if(DIM == 3 && hyperbolic && !binarytiling)
c->wall = (c->master->zebraval & 1) ? waCavewall : waCavefloor;
#if MAXMDIM >= 4
else if(euclid && DIM == 3)
c->wall = euclid3::get_emerald(c) ? waCavewall : waCavefloor;
#endif
else if(euclid) {
int x, y;
tie(x,y) = cell_to_pair(c);

View File

@ -417,6 +417,7 @@ void showCreative() {
gamescreen(3);
dialog::init(XLAT("creative mode"));
#if CAP_EDIT
dialog::addItem(XLAT("map editor"), 'm');
dialog::add_action([] {
if(tactic::on)
@ -431,6 +432,7 @@ void showCreative() {
addMessage(XLAT("You activate your terraforming powers!"));
});
});
#endif
#if CAP_EDIT
dialog::addItem(XLAT("vector graphics editor"), 'g');
@ -448,11 +450,15 @@ void showCreative() {
}
#endif
#if CAP_SHOT
dialog::addItem(XLAT("screenshots"), 's');
dialog::add_action_push(shot::menu);
#endif
#if CAP_ANIMATIONS
dialog::addBoolItem(XLAT("animations"), anims::any_on(), 'a');
dialog::add_action_push(anims::show);
#endif
dialog::addBoolItem(XLAT("history mode"), conformal::on || conformal::includeHistory, 'h');
dialog::add_action_push(conformal::history_menu);

View File

@ -568,7 +568,9 @@ void glapplymatrix(const transmatrix& V) {
int global_projection;
#if MAXMDIM >= 4
extern renderbuffer *floor_textures;
#endif
void dqi_poly::gldraw() {
auto& v = *tab;
@ -1963,6 +1965,7 @@ void pushShape(usershapelayer& ds) {
if(DIM == 2) hpcpush(T * ds.list[0]);
#if MAXMDIM >= 4
if(DIM == 3) {
auto& utt = user_triangles_texture;
utt.texture_id = floor_textures->renderedTexture;
@ -1975,6 +1978,7 @@ void pushShape(usershapelayer& ds) {
utt.tvertices.push_back(glhr::makevertex(-1, factor, 0));
}
}
#endif
}
ld gsca() { return 1; }
@ -2681,7 +2685,9 @@ void configure_floorshapes() {
generate_floorshapes();
}
#if MAXMDIM >= 4
extern void make_3d_models();
#endif
void buildpolys() {
@ -3098,7 +3104,9 @@ void buildpolys() {
bshape(shBead1, PPR(20), 1, 251);
bshape(shArrow, PPR::ARROW, 1, 252);
#if MAXMDIM >= 4
make_3d_models();
#endif
bshapeend();

View File

@ -962,6 +962,7 @@ int dist_alt(cell *c) {
// Construct a cellwalker in direction j from cw.at, such that its direction is as close
// as possible to cw.spin. Assume that j and cw.spin are adjacent
#if MAXMDIM >= 4
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);
@ -971,7 +972,7 @@ cellwalker strafe(cellwalker cw, int j) {
println(hlog, "incorrect strafe");
exit(1);
}
}
#endif
}

View File

@ -3,7 +3,7 @@
// https://github.com/zenorogue/newconformist (see the option '-cvl')
namespace hr {
#if CAP_SHOT
struct location {
transmatrix lView;
heptspin lviewctr;
@ -106,7 +106,7 @@ int readArgs() {
}
auto magichook = addHook(hooks_args, 100, readArgs) + addHook(hooks_frame, 100, cvl_marker);
#endif
}

View File

@ -421,11 +421,15 @@ pair<int, int> get_cellcrawler_id(cell *c) {
if(fulltorus && (torusconfig::tmflags() & torusconfig::TF_KLEIN))
return make_pair(cell_to_pair(c).second * 2 + ctof(c), 0);
int id = 0, dir = 0;
#if CAP_GP
if(GOLDBERG) {
gp::local_info li = gp::get_local_info(c);
id = (li.relative.first & 15) + (li.relative.second & 15) * 16 + fix6(li.total_dir) * 256;
// ld = li.last_dir;
}
#else
if(0) ;
#endif
else {
id = c->type == S7;
// if(id == 0) ld = c->c.spin(0);

View File

@ -1,5 +1,6 @@
namespace hr {
#if CAP_CRYSTAL
void performMarkCommand(cell *c);
namespace crystal {
@ -171,5 +172,5 @@ auto magichook = addHook(hooks_args, 100, readArgs) + addHook(hooks_drawcell, 10
+ addHook(hooks_handleKey, 150, magic_rugkey);
}
#endif
}

View File

@ -1,5 +1,6 @@
namespace rogueviz {
#if CAP_ARCM
namespace pentagonal {
transmatrix ts[3];
@ -343,4 +344,5 @@ auto xhook = addHook(hooks_args, 100, readArgs)
+ addHook(clearmemory, 40, [] () { snubon = false; } );
}
#endif
}

View File

@ -3,7 +3,7 @@
namespace rogueviz {
#if CAP_SDL
#if CAP_SDL && CAP_SHOT
// see: https://www.youtube.com/watch?v=4Vu3F95jpQ4&t=6s (Collatz)
// see: https://www.youtube.com/watch?v=mDG3_f8R2Ns (SAG boardgames)
@ -217,9 +217,8 @@ int videoArgs() {
else return 1;
return 0;
}
#endif
#endif
auto rv_hooks = addHook(hooks_args, 100, videoArgs);
#endif
#endif
}

View File

@ -28,7 +28,9 @@
#include "rogueviz.h"
namespace hr { extern hpcshape shEagle, shMiniGhost, shGhost, shShark, shAnimatedEagle[30], shAnimatedTinyEagle[30]; }
#if MAXMDIM >= 4
namespace hr { extern renderbuffer *floor_textures; }
#endif
namespace rogueviz {
@ -1160,6 +1162,12 @@ color_t darken_a(color_t c) {
return c;
}
#if CAP_SVG
#define SVG_LINK(x) svg::link = (x)
#else
#define SVG_LINK(x)
#endif
void queuedisk(const transmatrix& V, const colorpair& cp, bool legend, const string* info, int i) {
if(legend && (int) cp.color1 == (int) 0x000000FF && backcolor == 0)
poly_outline = 0x606060FF;
@ -1176,23 +1184,23 @@ void queuedisk(const transmatrix& V, const colorpair& cp, bool legend, const str
}
else if(DIM == 3) {
V1 = face_the_player(V);
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = *info; });
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { SVG_LINK(*info); });
queuepolyat(V1, sh, darken_a(cp.color1), PPR::MONSTER_HEAD);
if(info) queueaction(PPR::MONSTER_HEAD, [] () { svg::link = ""; });
if(info) queueaction(PPR::MONSTER_HEAD, [] () { SVG_LINK(""); });
V1 = V;
}
else if(rog3) {
int p = poly_outline; poly_outline = OUTLINE_TRANS;
queuepolyat(V, sh, 0x80, PPR::MONSTER_SHADOW);
poly_outline = p;
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = *info; });
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { SVG_LINK(*info); });
queuepolyat(V1 = mscale(V, geom3::BODY), sh, darken_a(cp.color1), PPR::MONSTER_HEAD);
if(info) queueaction(PPR::MONSTER_HEAD, [] () { svg::link = ""; });
if(info) queueaction(PPR::MONSTER_HEAD, [] () { SVG_LINK(""); });
}
else {
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = *info; });
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { SVG_LINK(*info); });
queuepoly(V1 = V, sh, darken_a(cp.color1));
if(info) queueaction(PPR::MONSTER_HEAD, [] () { svg::link = ""; });
if(info) queueaction(PPR::MONSTER_HEAD, [] () { SVG_LINK(""); });
}
switch(cp.shade) {
case 't': queuepoly(V1, shDiskT, darken_a(cp.color2)); return;
@ -1222,6 +1230,7 @@ transmatrix& memo_relative_matrix(cell *c1, cell *c2) {
void queue_prec(const transmatrix& V, edgeinfo*& ei, color_t col) {
if(!fat_edges)
queuetable(V, ei->prec, isize(ei->prec), col, 0, PPR::STRUCT0);
#if MAXMDIM >= 4
else {
auto& t = queuetable(V, ei->prec, isize(ei->prec), 0, col | 0x000000FF, PPR::STRUCT0);
t.flags |= (1<<22), // poly triangles
@ -1229,6 +1238,7 @@ void queue_prec(const transmatrix& V, edgeinfo*& ei, color_t col) {
t.tinf = &ei->tinf;
t.tinf->texture_id = floor_textures->renderedTexture;
}
#endif
}
bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
@ -1413,9 +1423,9 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
transmatrix V2 = DIM == 3 ? V * m->at : rgpushxto0(h) * ypush(PURE ? .3 : .2); // todo-variation
if(doshow && !behindsphere(V2)) {
auto info = vd.info;
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { svg::link = *info; });
if(info) queueaction(PPR::MONSTER_HEAD, [info] () { SVG_LINK(*info); });
queuestr(V2, (svg::in ? .28 : .2) * crossf / hcrossf, vd.name, backcolor ? 0x000000 : 0xFFFF00, (svg::in || ISWEB) ? 0 : 1);
if(info) queueaction(PPR::MONSTER_HEAD, [] () { svg::link = ""; });
if(info) queueaction(PPR::MONSTER_HEAD, [] () { SVG_LINK(""); });
}
}

View File

@ -455,7 +455,9 @@ union SDL_Event;
#endif
#endif
#ifndef MAXMDIM
#define MAXMDIM 4
#endif
#ifndef CAP_GEOMETRY
#define CAP_GEOMETRY (!(ISMINI))

View File

@ -1264,7 +1264,9 @@ void switch_game_mode(char switchWhat) {
yendor::on = tactic::on = princess::challenge = peace::on = inv::on = false;
chaosmode = randomPatternsMode = false;
variation = eVariation::bitruncated;
#if CAP_GP
gp::param = gp::loc(1, 1);
#endif
shmup::on = false;
need_reset_geometry = true;
tour::on = !tour::on;

View File

@ -504,6 +504,7 @@ void texture_config::finish_mapping() {
// printf("texture_map has %d elements (S%d)\n", isize(texture_map), config.tstate);
}
#if CAP_SHOT
void texture_config::saveFullTexture(string tn) {
addMessage(XLAT("Saving full texture to %1...", tn));
dynamicval<color_t> dd(grid_color, 0);
@ -529,6 +530,7 @@ void texture_config::saveFullTexture(string tn) {
finish_mapping();
}
}
#endif
bool newmove = false;
@ -1094,6 +1096,7 @@ string texturehelp =
"(these probably work best with the 'large picture' setting in geometry selection). "
"Again, tesselations can have their geometry changed.\n\n";
#if CAP_EDIT
void start_editor() {
addMessage("white");
if(config.data.whitetexture() && config.data.loadTextureGL()) {
@ -1104,6 +1107,7 @@ void start_editor() {
pushScreen(mapeditor::showDrawEditor);
}
}
#endif
void showMenu() {
cmode = sm::SIDE | sm::MAYDARK | sm::DIALOG_STRICT_X;
@ -1167,7 +1171,9 @@ void showMenu() {
dialog::addBreak(50);
dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P');
#if CAP_SHOT
dialog::addItem(XLAT("save the raw texture"), 'S');
#endif
}
if(config.tstate == tsActive) {
@ -1187,7 +1193,9 @@ void showMenu() {
#if CAP_EDIT
if(DIM == 2) dialog::addItem(XLAT("edit the texture"), 'e');
#endif
#if CAP_SHOT
dialog::addItem(XLAT("save the full texture image"), 'S');
#endif
dialog::addItem(XLAT("save texture config"), 's');
}
@ -1296,6 +1304,7 @@ void showMenu() {
if(config.tstate == tsActive) dialog::reaction = [] () { config.finish_mapping();
};
}
#if CAP_SHOT
else if(uni == 'S' && config.tstate == tsAdjusting)
dialog::openFileDialog(config.texturename, XLAT("save the raw texture"), ".png",
[] () {
@ -1307,6 +1316,7 @@ void showMenu() {
config.saveFullTexture(config.texturename);
return true;
});
#endif
else if(uni == SDLK_F1)
gotoHelp(texturehelp);
else if(doexiton(sym, uni))