rogueviz:: added some guards

This commit is contained in:
Zeno Rogue 2023-04-15 01:24:16 +02:00
parent 782b6ab4f8
commit 0410f54d43
17 changed files with 53 additions and 13 deletions

View File

@ -2,6 +2,7 @@
namespace hr {
#if CAP_MODELS
namespace ply {
using namespace rogueviz::objmodels;
@ -296,4 +297,5 @@ auto plyhook =
});
}
#endif
}

View File

@ -3,7 +3,7 @@
#include "rogueviz.h"
#define RVPATH HYPERPATH "rogueviz/"
#if CAP_RVPRES
namespace dhrg {
void graphv(std::string s);
extern double graph_R;
@ -749,3 +749,4 @@ int dhrg_phooks =
});
}
#endif

View File

@ -21,7 +21,7 @@
#include "rogueviz.h"
namespace hr {
#if CAP_THREADS
EX namespace gobot {
eWall empty = waChasm;
@ -615,6 +615,6 @@ auto gobot_hook =
#endif
EX }
#endif
EX }

View File

@ -15,6 +15,7 @@
// add -PM 0 -alpha 1
namespace hr {
#if CAP_MODELS
namespace hypcity {
using namespace rogueviz::objmodels;
@ -165,4 +166,6 @@ auto hypcity_ah = arg::add3("-hypcity", enable)
cb(XLAT("non-Euclidean city"), &hypcity_slides[0], 'c');
});
}}
}
#endif
}

View File

@ -4,7 +4,7 @@
// run: -analogs
namespace hr {
#if CAP_TEXTURE
namespace analogs {
patterns::ePattern wp;
@ -464,5 +464,6 @@ auto msc = arg::add3("-analogs", enable)
});
}
#endif
}

View File

@ -5,7 +5,7 @@
#include "dynamic-wfc.cpp"
namespace hr {
#if CAP_RVSLIDES
cell* starter;
void geom_euc_rec() {
@ -966,7 +966,7 @@ int phooks =
addHook_slideshows(100, [] (tour::ss::slideshow_callback cb) {
cb(XLAT("Hyperbolic Minesweeper is in P"), &sweeper_slides[0], 'h');
});
#endif
}
// kolor zmienic dziada

View File

@ -8,6 +8,7 @@
namespace hr {
#if CAP_RAY && MAXMDIM >= 4
namespace intraf {
using namespace intra;
@ -629,5 +630,5 @@ auto hooks =
{loader{"run this visualization", 'r', load("solv-h3-scene.lev", 0.05, 3000)}});
}));
}
#endif
}

View File

@ -8,6 +8,7 @@ bool alone = true;
bool in_special = false;
#if CAP_RVSLIDES
auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
using namespace tour;
return [=] (presmode mode) {
@ -85,9 +86,11 @@ auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
}
};
}
#endif
string cap = "honeycombs/";
#if CAP_RVSLIDES
void honey(string s, vector<tour::slide>& v) {
if(s != "noniso") return;
using namespace tour;
@ -148,6 +151,7 @@ void honey(string s, vector<tour::slide>& v) {
});
}
#endif
#if CAP_RVSLIDES
vector<tour::slide> noniso_slides;

View File

@ -3,7 +3,7 @@
#include "rogueviz.h"
namespace rogueviz {
#if CAP_MODELS
namespace objmodels {
bool scan(fhstream& hs, char& c) { return fscanf(hs.f, "%c", &c) == 1; }
@ -330,4 +330,5 @@ auto cf = addHook(hooks_configfile, 100, [] {
});
}
#endif
}

View File

@ -86,8 +86,8 @@ void make_texture() {
}
tdata.loadTextureGL();
#endif
rug::alternate_texture = tdata.textureid;
#endif
}
void create_model();

View File

@ -2,6 +2,7 @@
namespace hr {
#if CAP_TEXTURE
namespace planets {
texture::texture_data earth, neptune, mars, moon, sun;
@ -544,5 +545,6 @@ auto msc =
});
}
#endif
}

View File

@ -24,7 +24,7 @@ Have fun!
*/
namespace hr {
#if CAP_TEXTURE
namespace platformer {
/* the size of a block, in pixels */
@ -863,4 +863,5 @@ auto chk = arg::add3("-platformer", enable)
});
}
#endif
}

View File

@ -6,6 +6,7 @@
namespace rogueviz {
#if CAP_MODELS
#ifndef RV_ALL
namespace cylon {
extern void enable();
@ -1306,7 +1307,7 @@ int phooks =
});
}
#endif
}
// kolor zmienic dziada

View File

@ -3,7 +3,9 @@
/* basics */
#include "rogueviz.cpp"
#include "presentation.cpp"
#if CAP_MODELS
#include "objmodels.cpp"
#endif
#include "smoothcam.cpp"
#include "staircase.cpp"
@ -44,7 +46,9 @@
#include "weirdmaze.cpp"
#include "inner-maps.cpp"
#if CAP_TEXTURE
#include "planets.cpp"
#endif
#include "hyperbolic-analogs.cpp"
#define RV_ALL

View File

@ -14,6 +14,10 @@
#define CAP_RVSLIDES (CAP_TOUR && !ISWEB)
#endif
#ifndef CAP_MODELS
#define CAP_MODELS (!ISWEB)
#endif
namespace rogueviz {
using namespace hr;
@ -367,6 +371,10 @@ namespace objmodels {
for(Res r: results) res += r;
return res;
}
#else
template<class T> auto parallelize(long long N, T action) -> decltype(action(0,0)) {
return action(0, N);
}
#endif
}

View File

@ -20,6 +20,7 @@ namespace rogueviz {
namespace snow {
#if CAP_MODELS
using rogueviz::objmodels::model;
using rogueviz::objmodels::tf_result;
@ -31,6 +32,7 @@ struct snowmodel : model {
};
vector<snowmodel> models;
#endif
ld snow_lambda = 0;
@ -162,17 +164,20 @@ bool draw_snow(cell *c, const shiftmatrix& V) {
snowball b{just_centered ? Id : random_snow_matrix(c), 0, -1, snow_color};
if(random_colors)
b.color = (hrand(0x1000000) << 8) | 0x808080FF;
#if CAP_MODELS
if(isize(models)) {
b.model_id = hrand(isize(models));
if(single_objects)
b.object_id = hrand(isize(models[b.model_id].get().objindex)-1);
}
#endif
v.emplace_back(b);
}
}
poly_outline = 0xFF;
for(auto& T: snowballs_at[c]) {
#if CAP_MODELS
if(models.size()) {
if(T.object_id == -1)
models[T.model_id].render(V*T.T);
@ -184,7 +189,9 @@ bool draw_snow(cell *c, const shiftmatrix& V) {
}
}
}
else {
else
#endif
{
auto& p = queuepoly(V * T.T, shapeid(snow_shape), T.color);
if(!snow_texture) p.tinf = nullptr;
if(snow_intense) p.flags |= POLY_INTENSE;
@ -285,6 +292,7 @@ auto hchook = addHook(hooks_drawcell, 100, draw_snow)
else if(argis("-snow-glitch")) {
snow_test = true;
}
#if CAP_MODELS
else if(argis("-use-model")) {
shift(); string s = args();
shift(); ld scale = argf();
@ -296,6 +304,7 @@ auto hchook = addHook(hooks_drawcell, 100, draw_snow)
s = "/" + s;
}
}
#endif
else return 1;
return 0;
})

View File

@ -219,7 +219,9 @@ void draw_staircase() {
p.offset = 0;
p.offset_texture = 0;
p.tinf = &tinf;
#if CAP_TEXTURE
tinf.texture_id = tdata.textureid;
#endif
}
void enable_hooks() {