1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 01:00:25 +00:00

added missing guards

This commit is contained in:
Zeno Rogue 2021-02-07 18:29:49 +01:00
parent be44d4d2d6
commit b166b64006
6 changed files with 30 additions and 4 deletions

View File

@ -169,10 +169,10 @@ void loadfont(int siz) {
#if !ISFAKEMOBILE && !ISANDROID & !ISIOS
int textwidth(int siz, const string &str) {
fix_font_size(siz);
if(isize(str) == 0) return 0;
#if CAP_SDLTTF
fix_font_size(siz);
loadfont(siz);
int w, h;
@ -1131,10 +1131,12 @@ EX void setvideomode() {
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
vid.current_vsync = want_vsync();
#if !ISMOBWEB
if(vid.current_vsync)
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 );
else
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 );
#endif
if(vid.antialias & AA_MULTI) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, (vid.antialias & AA_MULTI16) ? 16 : 4);

View File

@ -660,15 +660,19 @@ EX void initConfig() {
addsaver(vid.language, "language", -1);
param_b(vid.drawmousecircle, "mouse circle", ISMOBILE || ISPANDORA);
param_b(vid.revcontrol, "reverse control", false);
#if CAP_AUDIO
param_i(musicvolume, "music volume")
->editable(0, 128, 10, "background music volume", "", 'b')
->set_sets(sets_music_volume);
#endif
#if CAP_SDLAUDIO
addsaver(music_out_of_focus, "music out of focus", false);
#endif
#if CAP_AUDIO
param_i(effvolume, "sound effect volume")
->editable(0, 128, 10, "sound effects volume", "", 'e')
->set_sets(sets_sfx_volume);
#endif
param_enum(glyphsortorder, "glyph_sort", "glyph sort order", glyphsortorder)
->editable({
@ -705,8 +709,10 @@ EX void initConfig() {
addsaver(vid.particles, "extra effects", 1);
param_i(vid.framelimit, "frame limit", 999);
#if !ISMOBWEB
param_b(vid.want_vsync, "vsync", true)
->editable("vsync", 'v');
#endif
param_b(vid.want_fullscreen, "fullscreen", false)
->editable("fullscreen mode", 'f');
@ -1389,8 +1395,9 @@ EX void menuitem_sightrange(char c IS('c')) {
#if CAP_SOLV
if(pmodel == mdGeodesic && sol)
dialog::addSelItem(XLAT("sight range settings"), fts(sn::solrange_xy) + "x" + fts(sn::solrange_z), c);
else
#endif
else if(vid.use_smart_range)
if(vid.use_smart_range)
dialog::addSelItem(XLAT("sight range settings"), fts(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail) + " px", c);
else if(WDIM == 3)
dialog::addSelItem(XLAT("sight range settings"), fts(sightranges[geometry]) + "au", c);
@ -1400,6 +1407,7 @@ EX void menuitem_sightrange(char c IS('c')) {
}
EX void sets_sfx_volume() {
#if CAP_AUDIO
dialog::numberdark = dialog::DONT_SHOW;
#if ISANDROID
dialog::reaction = [] () {
@ -1408,9 +1416,11 @@ EX void sets_sfx_volume() {
#endif
dialog::bound_low(0);
dialog::bound_up(MIX_MAX_VOLUME);
#endif
}
EX void sets_music_volume() {
#if CAP_AUDIO
dialog::numberdark = dialog::DONT_SHOW;
dialog::reaction = [] () {
#if CAP_SDLAUDIO
@ -1427,6 +1437,7 @@ EX void sets_music_volume() {
dialog::addBoolItem_action(XLAT("play music when out of focus"), music_out_of_focus, 'A');
};
#endif
#endif
}
EX void showSpecialEffects() {

View File

@ -537,10 +537,12 @@ EX void mode_higlights() {
dialog::addInfo(XLAT("classic game except hyperbolic"));
dialog::extend();
#if CAP_RACING && MAXMDIM >= 4
dialog::addBigItem(XLAT("Racing in Thurston geometries"), 't'-96);
dialog::add_action(dialog::add_confirmation(racing::start_thurston));
dialog::addInfo(XLAT("race through a maze in exotic 3D geometry!"));
dialog::extend();
#endif
dialog::addBigItem(XLAT1("Halloween"), 'Z');
dialog::add_action(dialog::add_confirmation(halloween::start_all));
@ -582,7 +584,8 @@ EX void mode_higlights() {
welcomeMessage();
}));
if(hiitemsMax(itHolyGrail) || cheater || autocheat) {
#if CAP_CRYSTAL
if(hiitemsMax(itHolyGrail) || cheater || autocheat) {
dialog::addItem(XLAT("Knight of the 16-Cell Table"), '1');
dialog::add_action(dialog::add_confirmation([] {
popScreenAll();
@ -612,7 +615,9 @@ EX void mode_higlights() {
else {
dialog::addItem("(locked until you find a Holy Grail)", 0);
}
#endif
#if MAXMDIM >= 4
dialog::addBreak(100);
dialog::addBigItem(XLAT1("some cool visualizations"), 0);
dialog::addItem(XLAT("Emerald Mine in {5,3,4}"), '5');
@ -632,6 +637,7 @@ EX void mode_higlights() {
clearMessages();
welcomeMessage();
}));
#endif
dialog::addBreak(100);
dialog::addBack();

View File

@ -705,6 +705,7 @@ EX namespace models {
if(hyperbolic) {
dialog::addItem(XLAT("Gans model") + " " + XLAT("(zoomed out)"), '4');
dialog::add_action([] { if(rug::rugged) rug::close(); pconf.alpha = 999; pconf.scale = 499; pconf.xposition = pconf.yposition = 0; popScreen(); });
#if CAP_RUG
dialog::addItem(XLAT("Hypersian rug"), 'u');
dialog::add_action([] {
if(rug::rugged) pushScreen(rug::show);
@ -712,6 +713,7 @@ EX namespace models {
pconf.alpha = 1, pconf.scale = 1; if(!rug::rugged) rug::init(); popScreen();
}
});
#endif
}
}
else if(GDIM == 2 && euclid) {
@ -736,6 +738,7 @@ EX namespace models {
dialog::add_action([zoom_to] { zoom_to(1); });
dialog::addItem(XLAT("zoom 0.5x"), '3');
dialog::add_action([zoom_to] { zoom_to(.5); });
#if CAP_RUG
if(quotient) {
dialog::addItem(XLAT("cylinder/donut view"), 'u');
dialog::add_action([] {
@ -745,6 +748,7 @@ EX namespace models {
}
});
}
#endif
}
else if(GDIM == 3) {
auto& ysh = (WDIM == 2 ? vid.camera : vid.yshift);

View File

@ -1486,8 +1486,8 @@ EX void add_debug(cell *c) {
dialog::addSelItem("completion", its(r.completion), 0);
}
}
#endif
#if MAXMDIM >= 4
EX void start_thurston() {
stop_game();
resetModes();
@ -1495,6 +1495,8 @@ EX void start_thurston() {
pushScreen(showStartMenu);
pushScreen(racing::thurston_racing);
}
#endif
#endif
#if !CAP_RACING
EX always_false on;

View File

@ -1927,6 +1927,7 @@ EX namespace rug {
EX bool rug_control() { return false; }
EX bool in_crystal() { return false; }
EX void reset_view() { }
EX void close() { }
#if HDR
struct using_rugview {};
#endif