added missing guards, mostly for CAP_WRL

This commit is contained in:
Zeno Rogue 2020-04-16 21:00:28 +02:00
parent 45bffedfbb
commit 84cf5d6e3a
5 changed files with 20 additions and 3 deletions

View File

@ -1590,6 +1590,10 @@ void celldrawer::draw_features_and_walls_3d() {
if(c->move(a) && (among(pmodel, mdPerspective, mdGeodesic) || gmatrix0.count(c->move(a))))
b = (patterns::innerwalls && (tC0(V)[2] < tC0(V * currentmap->adj(c, a))[2])) || !isWall3(c->move(a), dummy);
if(b) {
#if CAP_WRL
/* always render */
if(wrl::in && wrl::print) ; else
#endif
if(pmodel == mdPerspective && !sphere && !quotient && !kite::in() && !nonisotropic && !hybri && !experimental && !nih) {
if(a < 4 && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(centerover)) continue;
else if(a < 2 && among(geometry, gHoroRec) && celldistAlt(c) >= celldistAlt(centerover)) continue;

View File

@ -2035,7 +2035,9 @@ EX hookset<bool()> *hooks_vr_draw_all;
EX void drawqueue() {
#if CAP_WRL
if(wrl::in) { wrl::render(); return; }
#endif
callhooks(hook_drawqueue);
current_display->next_shader_flags = 0;

View File

@ -1276,6 +1276,7 @@ EX void actDraw() {
if(keystate[SDLK_LALT]) alpha /= 10;
#endif
#if CAP_HOLDKEYS
auto perform_finger = [=] () {
if(keystate[SDLK_HOME]) finger_range /= exp(alpha);
if(keystate[SDLK_END]) finger_range *= exp(alpha);
@ -1288,8 +1289,8 @@ EX void actDraw() {
};
if(finger_center)
perform_finger();
perform_finger();
#endif
}
catch(rug_exception) {
rug::close();

View File

@ -358,6 +358,7 @@ EX always_false in;
/** 0 = no/unknown/disabled texture, 1 = rug, 2 = gradient, 3 = floor texture */
EX int texture_type(dqi_poly& p) {
if(!p.tinf) return 0;
if(!CAP_PNG) return 0;
if(!textures) return 0;
if(p.tinf == &rug::tinf) return 1;
if(p.tinf->texture_id == (int) floor_textures->renderedTexture)
@ -543,6 +544,7 @@ EX always_false in;
println(f, " }");
}
#if CAP_PNG
if(used_rug) {
resetbuffer rb;
rug::glbuf->enable();
@ -582,6 +584,7 @@ EX always_false in;
IMAGESAVE(s, (filename + "-floors.png").c_str());
SDL_FreeSurface(s);
}
#endif
fclose(f.f);
f.f = nullptr;
@ -766,6 +769,7 @@ EX void take(string fname, const function<void()>& what IS(default_screenshot_co
#if CAP_PNG
render_png(fname, what);
#endif
return;
}
}
@ -793,6 +797,7 @@ int png_read_args() {
else if(argis("-shotaa")) {
shift(); shot_aa = argi();
}
#if CAP_WRL
else if(argis("-modelshot")) {
PHASE(3); shift(); start_game();
printf("saving WRL model to %s\n", argcs());
@ -805,6 +810,7 @@ int png_read_args() {
shot::format = screenshot_format::wrl; wrl::print = true;
shot::take(argcs());
}
#endif
else return 1;
return 0;
}
@ -917,8 +923,10 @@ EX void menu() {
dialog::add_action_push(models::model_menu);
}
dialog::addBoolItem_action("generate a model for 3D printing", wrl::print, 'p');
#if CAP_PNG
dialog::addBoolItem_action("use textures", wrl::textures, 'u');
#endif
#endif
}
}
if(!dowrl) dialog::addBoolItem_action(XLAT("transparent"), transparent, 't');
@ -932,7 +940,9 @@ EX void menu() {
if(!dowrl) dialog::addBoolItem_action(XLAT("disable the HUD"), hide_hud, 'h');
dialog::addBoolItem_action_neg(XLAT("hide the player"), mapeditor::drawplayer, 'H');
#if CAP_WRL
if(dowrl && wrl::print) dialog::lastItem().value = XLAT("N/A");
#endif
if(WDIM == 2) {
dialog::addItem(XLAT("centering"), 'x');

View File

@ -228,7 +228,7 @@
#endif
#ifndef CAP_WRL
#define CAP_WRL (CAP_FILES && !ISMOBILE && !ISMINI)
#define CAP_WRL (CAP_FILES && !ISMOBILE && !ISMINI && !ISWEB)
#endif
#ifndef CAP_POLY