1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-01-11 09:50:34 +00:00

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

View File

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

View File

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

View File

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

View File

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

View File

@ -224,13 +224,19 @@ void initcells() {
#if CAP_ARCM #if CAP_ARCM
else if(archimedean) currentmap = arcm::new_map(); else if(archimedean) currentmap = arcm::new_map();
#endif #endif
#if MAXMDIM >= 4
else if(euclid && DIM == 3) currentmap = euclid3::new_map(); else if(euclid && DIM == 3) currentmap = euclid3::new_map();
#endif
else if(fulltorus) currentmap = new hrmap_torus; else if(fulltorus) currentmap = new hrmap_torus;
else if(euclid) currentmap = new hrmap_euclidean; else if(euclid) currentmap = new hrmap_euclidean;
#if MAXMDIM >= 4
else if(DIM == 3 && !binarytiling) currentmap = reg3::new_map(); else if(DIM == 3 && !binarytiling) currentmap = reg3::new_map();
#endif
else if(sphere) currentmap = new hrmap_spherical; else if(sphere) currentmap = new hrmap_spherical;
else if(quotient) currentmap = new quotientspace::hrmap_quotient; else if(quotient) currentmap = new quotientspace::hrmap_quotient;
#if CAP_BT
else if(binarytiling) currentmap = binary::new_map(); else if(binarytiling) currentmap = binary::new_map();
#endif
else currentmap = new hrmap_hyperbolic; else currentmap = new hrmap_hyperbolic;
allmaps.push_back(currentmap); allmaps.push_back(currentmap);
@ -436,10 +442,10 @@ int celldistAlt(cell *c) {
if(sphere || quotient) { if(sphere || quotient) {
return celldist(c) - 3; return celldist(c) - 3;
} }
#if MAXMDIM == 4 #if MAXMDIM >= 4
if(euclid && DIM == 3) return euclid3::dist_alt(c); if(euclid && DIM == 3) return euclid3::dist_alt(c);
#endif
if(hyperbolic && DIM == 3) return reg3::altdist(c->master); if(hyperbolic && DIM == 3) return reg3::altdist(c->master);
#endif
if(!c->master->alt) return 0; if(!c->master->alt) return 0;
#if CAP_IRR #if CAP_IRR
if(IRREGULAR) return irr::celldist(c, true); if(IRREGULAR) return irr::celldist(c, true);
@ -869,11 +875,13 @@ int celldistance(cell *c1, cell *c2) {
if(binarytiling && DIM == 3) if(binarytiling && DIM == 3)
return binary::celldistance3(c1, c2); return binary::celldistance3(c1, c2);
#endif #endif
#if MAXMDIM >= 4
if(euclid && DIM == 3) if(euclid && DIM == 3)
return euclid3::celldistance(c1, c2); return euclid3::celldistance(c1, c2);
if(hyperbolic && DIM == 3) return reg3::celldistance(c1, c2); if(hyperbolic && DIM == 3) return reg3::celldistance(c1, c2);
#endif
return hyperbolic_celldistance(c1, c2); 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("skip the start menu"), vid.skipstart, 'm');
dialog::addBoolItem_action(XLAT("forget faraway cells"), memory_saving_mode, 'y'); dialog::addBoolItem_action(XLAT("forget faraway cells"), memory_saving_mode, 'y');
#if CAP_AUDIO
if(CAP_AUDIO) { if(CAP_AUDIO) {
dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b'); dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b');
dialog::add_action([] { dialog::add_action([] {
@ -908,6 +909,7 @@ void configureOther() {
dialog::bound_up(MIX_MAX_VOLUME); dialog::bound_up(MIX_MAX_VOLUME);
}); });
} }
#endif
menuitem_sightrange('r'); menuitem_sightrange('r');
@ -1228,6 +1230,7 @@ void show3D() {
dialog::addBreak(50); dialog::addBreak(50);
dialog::addSelItem(XLAT("projection"), current_proj_name(), 'M'); dialog::addSelItem(XLAT("projection"), current_proj_name(), 'M');
} }
#if MAXMDIM >= 4
if(DIM == 3) add_edit_fov('f'); if(DIM == 3) add_edit_fov('f');
if(DIM == 3) { if(DIM == 3) {
dialog::addSelItem(XLAT("radar size"), fts3(vid.radarsize), 'r'); dialog::addSelItem(XLAT("radar size"), fts3(vid.radarsize), 'r');
@ -1259,6 +1262,7 @@ void show3D() {
}; };
}); });
} }
#endif
dialog::addBreak(50); dialog::addBreak(50);
#if CAP_RUG #if CAP_RUG

View File

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

View File

@ -213,27 +213,33 @@ transmatrix calc_relative_matrix_help(cell *c, heptagon *h1) {
struct horo_distance { struct horo_distance {
ld a, b; ld a, b;
horo_distance(hyperpoint h1) { horo_distance(hyperpoint h1) {
#if CAP_BT
if(binarytiling) { if(binarytiling) {
b = intval(h1, C0); b = intval(h1, C0);
a = abs(binary::horo_level(h1)); a = abs(binary::horo_level(h1));
} }
else else
#endif
a = 0, b = intval(h1, C0); a = 0, b = intval(h1, C0);
} }
horo_distance(hyperpoint h1, const transmatrix& T) { horo_distance(hyperpoint h1, const transmatrix& T) {
#if CAP_BT
if(binarytiling) { if(binarytiling) {
hyperpoint ih1 = inverse(T) * h1; hyperpoint ih1 = inverse(T) * h1;
b = intval(ih1, C0); b = intval(ih1, C0);
a = abs(binary::horo_level(ih1)); a = abs(binary::horo_level(ih1));
} }
else else
#endif
a = 0, b = intval(h1, tC0(T)); a = 0, b = intval(h1, tC0(T));
} }
bool operator < (const horo_distance z) { bool operator < (const horo_distance z) {
#if CAP_BT
if(binarytiling) { if(binarytiling) {
if(a < z.a-1e-6) return true; if(a < z.a-1e-6) return true;
if(a > z.a+1e-6) return false; if(a > z.a+1e-6) return false;
} }
#endif
return b < z.b - 1e-4; 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; char xch = winf[c->wall].glyph;
#if MAXMDIM >= 4
if(DIM == 3) { if(DIM == 3) {
color_t dummy; color_t dummy;
if(isWall3(c, wcol)) { if(isWall3(c, wcol)) {
color_t wcol2 = wcol; color_t wcol2 = wcol;
#if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive) wcol2 = texture::config.recolor(wcol); if(texture::config.tstate == texture::tsActive) wcol2 = texture::config.recolor(wcol);
#endif
int d = (wcol & 0xF0F0F0) >> 4; int d = (wcol & 0xF0F0F0) >> 4;
for(int a=0; a<c->type; a++) for(int a=0; a<c->type; a++)
if(c->move(a) && !isWall3(c->move(a), dummy)) { 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; 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) if(rd == 2)
queuepoly(face_the_player(V), shLoveRing, darkena(0x402030, 0, 0xFF)); queuepoly(face_the_player(V), shLoveRing, darkena(0x402030, 0, 0xFF));
} }
#else
if(0) ;
#endif
else switch(c->wall) { else switch(c->wall) {
@ -6681,8 +6687,10 @@ auto graphcm = addHook(clearmemory, 0, [] () {
}); });
void resetGeometry() { void resetGeometry() {
#if MAXMDIM >= 4
if(DIM == 3 && !floor_textures) if(DIM == 3 && !floor_textures)
make_floor_textures(); make_floor_textures();
#endif
precalc(); precalc();
#if CAP_FIELD #if CAP_FIELD
if(hyperbolic && &currfp != &fieldpattern::fp_invalid) currfp.analyze(); if(hyperbolic && &currfp != &fieldpattern::fp_invalid) currfp.analyze();

View File

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

View File

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

View File

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

View File

@ -568,7 +568,9 @@ void glapplymatrix(const transmatrix& V) {
int global_projection; int global_projection;
#if MAXMDIM >= 4
extern renderbuffer *floor_textures; extern renderbuffer *floor_textures;
#endif
void dqi_poly::gldraw() { void dqi_poly::gldraw() {
auto& v = *tab; auto& v = *tab;
@ -1963,6 +1965,7 @@ void pushShape(usershapelayer& ds) {
if(DIM == 2) hpcpush(T * ds.list[0]); if(DIM == 2) hpcpush(T * ds.list[0]);
#if MAXMDIM >= 4
if(DIM == 3) { if(DIM == 3) {
auto& utt = user_triangles_texture; auto& utt = user_triangles_texture;
utt.texture_id = floor_textures->renderedTexture; utt.texture_id = floor_textures->renderedTexture;
@ -1975,6 +1978,7 @@ void pushShape(usershapelayer& ds) {
utt.tvertices.push_back(glhr::makevertex(-1, factor, 0)); utt.tvertices.push_back(glhr::makevertex(-1, factor, 0));
} }
} }
#endif
} }
ld gsca() { return 1; } ld gsca() { return 1; }
@ -2681,7 +2685,9 @@ void configure_floorshapes() {
generate_floorshapes(); generate_floorshapes();
} }
#if MAXMDIM >= 4
extern void make_3d_models(); extern void make_3d_models();
#endif
void buildpolys() { void buildpolys() {
@ -3098,7 +3104,9 @@ void buildpolys() {
bshape(shBead1, PPR(20), 1, 251); bshape(shBead1, PPR(20), 1, 251);
bshape(shArrow, PPR::ARROW, 1, 252); bshape(shArrow, PPR::ARROW, 1, 252);
#if MAXMDIM >= 4
make_3d_models(); make_3d_models();
#endif
bshapeend(); 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 // 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 // as possible to cw.spin. Assume that j and cw.spin are adjacent
#if MAXMDIM >= 4
cellwalker strafe(cellwalker cw, int j) { cellwalker strafe(cellwalker cw, int j) {
hyperpoint hfront = tC0(adjmoves[cw.spin]); hyperpoint hfront = tC0(adjmoves[cw.spin]);
transmatrix T = currentmap->relative_matrix(cw.at->cmove(j)->master, cw.at->master); 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"); println(hlog, "incorrect strafe");
exit(1); exit(1);
} }
} }
#endif
} }

View File

@ -3,7 +3,7 @@
// https://github.com/zenorogue/newconformist (see the option '-cvl') // https://github.com/zenorogue/newconformist (see the option '-cvl')
namespace hr { namespace hr {
#if CAP_SHOT
struct location { struct location {
transmatrix lView; transmatrix lView;
heptspin lviewctr; heptspin lviewctr;
@ -106,7 +106,7 @@ int readArgs() {
} }
auto magichook = addHook(hooks_args, 100, readArgs) + addHook(hooks_frame, 100, cvl_marker); 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)) if(fulltorus && (torusconfig::tmflags() & torusconfig::TF_KLEIN))
return make_pair(cell_to_pair(c).second * 2 + ctof(c), 0); return make_pair(cell_to_pair(c).second * 2 + ctof(c), 0);
int id = 0, dir = 0; int id = 0, dir = 0;
#if CAP_GP
if(GOLDBERG) { if(GOLDBERG) {
gp::local_info li = gp::get_local_info(c); gp::local_info li = gp::get_local_info(c);
id = (li.relative.first & 15) + (li.relative.second & 15) * 16 + fix6(li.total_dir) * 256; id = (li.relative.first & 15) + (li.relative.second & 15) * 16 + fix6(li.total_dir) * 256;
// ld = li.last_dir; // ld = li.last_dir;
} }
#else
if(0) ;
#endif
else { else {
id = c->type == S7; id = c->type == S7;
// if(id == 0) ld = c->c.spin(0); // if(id == 0) ld = c->c.spin(0);

View File

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

View File

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

View File

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

View File

@ -28,7 +28,9 @@
#include "rogueviz.h" #include "rogueviz.h"
namespace hr { extern hpcshape shEagle, shMiniGhost, shGhost, shShark, shAnimatedEagle[30], shAnimatedTinyEagle[30]; } namespace hr { extern hpcshape shEagle, shMiniGhost, shGhost, shShark, shAnimatedEagle[30], shAnimatedTinyEagle[30]; }
#if MAXMDIM >= 4
namespace hr { extern renderbuffer *floor_textures; } namespace hr { extern renderbuffer *floor_textures; }
#endif
namespace rogueviz { namespace rogueviz {
@ -1160,6 +1162,12 @@ color_t darken_a(color_t c) {
return 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) { void queuedisk(const transmatrix& V, const colorpair& cp, bool legend, const string* info, int i) {
if(legend && (int) cp.color1 == (int) 0x000000FF && backcolor == 0) if(legend && (int) cp.color1 == (int) 0x000000FF && backcolor == 0)
poly_outline = 0x606060FF; poly_outline = 0x606060FF;
@ -1176,23 +1184,23 @@ void queuedisk(const transmatrix& V, const colorpair& cp, bool legend, const str
} }
else if(DIM == 3) { else if(DIM == 3) {
V1 = face_the_player(V); 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); 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; V1 = V;
} }
else if(rog3) { else if(rog3) {
int p = poly_outline; poly_outline = OUTLINE_TRANS; int p = poly_outline; poly_outline = OUTLINE_TRANS;
queuepolyat(V, sh, 0x80, PPR::MONSTER_SHADOW); queuepolyat(V, sh, 0x80, PPR::MONSTER_SHADOW);
poly_outline = p; 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); 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 { 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)); 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) { switch(cp.shade) {
case 't': queuepoly(V1, shDiskT, darken_a(cp.color2)); return; 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) { void queue_prec(const transmatrix& V, edgeinfo*& ei, color_t col) {
if(!fat_edges) if(!fat_edges)
queuetable(V, ei->prec, isize(ei->prec), col, 0, PPR::STRUCT0); queuetable(V, ei->prec, isize(ei->prec), col, 0, PPR::STRUCT0);
#if MAXMDIM >= 4
else { else {
auto& t = queuetable(V, ei->prec, isize(ei->prec), 0, col | 0x000000FF, PPR::STRUCT0); auto& t = queuetable(V, ei->prec, isize(ei->prec), 0, col | 0x000000FF, PPR::STRUCT0);
t.flags |= (1<<22), // poly triangles 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 = &ei->tinf;
t.tinf->texture_id = floor_textures->renderedTexture; t.tinf->texture_id = floor_textures->renderedTexture;
} }
#endif
} }
bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) { 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 transmatrix V2 = DIM == 3 ? V * m->at : rgpushxto0(h) * ypush(PURE ? .3 : .2); // todo-variation
if(doshow && !behindsphere(V2)) { if(doshow && !behindsphere(V2)) {
auto info = vd.info; 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); 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
#endif #endif
#ifndef MAXMDIM
#define MAXMDIM 4 #define MAXMDIM 4
#endif
#ifndef CAP_GEOMETRY #ifndef CAP_GEOMETRY
#define CAP_GEOMETRY (!(ISMINI)) #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; yendor::on = tactic::on = princess::challenge = peace::on = inv::on = false;
chaosmode = randomPatternsMode = false; chaosmode = randomPatternsMode = false;
variation = eVariation::bitruncated; variation = eVariation::bitruncated;
#if CAP_GP
gp::param = gp::loc(1, 1); gp::param = gp::loc(1, 1);
#endif
shmup::on = false; shmup::on = false;
need_reset_geometry = true; need_reset_geometry = true;
tour::on = !tour::on; 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); // printf("texture_map has %d elements (S%d)\n", isize(texture_map), config.tstate);
} }
#if CAP_SHOT
void texture_config::saveFullTexture(string tn) { void texture_config::saveFullTexture(string tn) {
addMessage(XLAT("Saving full texture to %1...", tn)); addMessage(XLAT("Saving full texture to %1...", tn));
dynamicval<color_t> dd(grid_color, 0); dynamicval<color_t> dd(grid_color, 0);
@ -529,6 +530,7 @@ void texture_config::saveFullTexture(string tn) {
finish_mapping(); finish_mapping();
} }
} }
#endif
bool newmove = false; bool newmove = false;
@ -1094,6 +1096,7 @@ string texturehelp =
"(these probably work best with the 'large picture' setting in geometry selection). " "(these probably work best with the 'large picture' setting in geometry selection). "
"Again, tesselations can have their geometry changed.\n\n"; "Again, tesselations can have their geometry changed.\n\n";
#if CAP_EDIT
void start_editor() { void start_editor() {
addMessage("white"); addMessage("white");
if(config.data.whitetexture() && config.data.loadTextureGL()) { if(config.data.whitetexture() && config.data.loadTextureGL()) {
@ -1104,6 +1107,7 @@ void start_editor() {
pushScreen(mapeditor::showDrawEditor); pushScreen(mapeditor::showDrawEditor);
} }
} }
#endif
void showMenu() { void showMenu() {
cmode = sm::SIDE | sm::MAYDARK | sm::DIALOG_STRICT_X; cmode = sm::SIDE | sm::MAYDARK | sm::DIALOG_STRICT_X;
@ -1167,7 +1171,9 @@ void showMenu() {
dialog::addBreak(50); dialog::addBreak(50);
dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P'); dialog::addSelItem(XLAT("precision"), its(config.gsplits), 'P');
#if CAP_SHOT
dialog::addItem(XLAT("save the raw texture"), 'S'); dialog::addItem(XLAT("save the raw texture"), 'S');
#endif
} }
if(config.tstate == tsActive) { if(config.tstate == tsActive) {
@ -1187,7 +1193,9 @@ void showMenu() {
#if CAP_EDIT #if CAP_EDIT
if(DIM == 2) dialog::addItem(XLAT("edit the texture"), 'e'); if(DIM == 2) dialog::addItem(XLAT("edit the texture"), 'e');
#endif #endif
#if CAP_SHOT
dialog::addItem(XLAT("save the full texture image"), 'S'); dialog::addItem(XLAT("save the full texture image"), 'S');
#endif
dialog::addItem(XLAT("save texture config"), 's'); dialog::addItem(XLAT("save texture config"), 's');
} }
@ -1296,6 +1304,7 @@ void showMenu() {
if(config.tstate == tsActive) dialog::reaction = [] () { config.finish_mapping(); if(config.tstate == tsActive) dialog::reaction = [] () { config.finish_mapping();
}; };
} }
#if CAP_SHOT
else if(uni == 'S' && config.tstate == tsAdjusting) else if(uni == 'S' && config.tstate == tsAdjusting)
dialog::openFileDialog(config.texturename, XLAT("save the raw texture"), ".png", dialog::openFileDialog(config.texturename, XLAT("save the raw texture"), ".png",
[] () { [] () {
@ -1307,6 +1316,7 @@ void showMenu() {
config.saveFullTexture(config.texturename); config.saveFullTexture(config.texturename);
return true; return true;
}); });
#endif
else if(uni == SDLK_F1) else if(uni == SDLK_F1)
gotoHelp(texturehelp); gotoHelp(texturehelp);
else if(doexiton(sym, uni)) else if(doexiton(sym, uni))