1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 22:39:53 +00:00

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 { namespace hr {
#if CAP_MODELS
namespace ply { namespace ply {
using namespace rogueviz::objmodels; using namespace rogueviz::objmodels;
@ -296,4 +297,5 @@ auto plyhook =
}); });
} }
#endif
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@
namespace hr { namespace hr {
#if CAP_RAY && MAXMDIM >= 4
namespace intraf { namespace intraf {
using namespace intra; using namespace intra;
@ -629,5 +630,5 @@ auto hooks =
{loader{"run this visualization", 'r', load("solv-h3-scene.lev", 0.05, 3000)}}); {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; bool in_special = false;
#if CAP_RVSLIDES
auto geoslide(eGeometry g, char canvas, int jhole, int jblock) { auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
using namespace tour; using namespace tour;
return [=] (presmode mode) { return [=] (presmode mode) {
@ -85,9 +86,11 @@ auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
} }
}; };
} }
#endif
string cap = "honeycombs/"; string cap = "honeycombs/";
#if CAP_RVSLIDES
void honey(string s, vector<tour::slide>& v) { void honey(string s, vector<tour::slide>& v) {
if(s != "noniso") return; if(s != "noniso") return;
using namespace tour; using namespace tour;
@ -148,6 +151,7 @@ void honey(string s, vector<tour::slide>& v) {
}); });
} }
#endif
#if CAP_RVSLIDES #if CAP_RVSLIDES
vector<tour::slide> noniso_slides; vector<tour::slide> noniso_slides;

View File

@ -3,7 +3,7 @@
#include "rogueviz.h" #include "rogueviz.h"
namespace rogueviz { namespace rogueviz {
#if CAP_MODELS
namespace objmodels { namespace objmodels {
bool scan(fhstream& hs, char& c) { return fscanf(hs.f, "%c", &c) == 1; } 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(); tdata.loadTextureGL();
#endif
rug::alternate_texture = tdata.textureid; rug::alternate_texture = tdata.textureid;
#endif
} }
void create_model(); void create_model();

View File

@ -2,6 +2,7 @@
namespace hr { namespace hr {
#if CAP_TEXTURE
namespace planets { namespace planets {
texture::texture_data earth, neptune, mars, moon, sun; 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 { namespace hr {
#if CAP_TEXTURE
namespace platformer { namespace platformer {
/* the size of a block, in pixels */ /* 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 { namespace rogueviz {
#if CAP_MODELS
#ifndef RV_ALL #ifndef RV_ALL
namespace cylon { namespace cylon {
extern void enable(); extern void enable();
@ -1306,7 +1307,7 @@ int phooks =
}); });
} }
#endif
} }
// kolor zmienic dziada // kolor zmienic dziada

View File

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

View File

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

View File

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

View File

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