1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-09 18:04:07 +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 #if !ISFAKEMOBILE && !ISANDROID & !ISIOS
int textwidth(int siz, const string &str) { int textwidth(int siz, const string &str) {
fix_font_size(siz);
if(isize(str) == 0) return 0; if(isize(str) == 0) return 0;
#if CAP_SDLTTF #if CAP_SDLTTF
fix_font_size(siz);
loadfont(siz); loadfont(siz);
int w, h; int w, h;
@ -1131,10 +1131,12 @@ EX void setvideomode() {
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
vid.current_vsync = want_vsync(); vid.current_vsync = want_vsync();
#if !ISMOBWEB
if(vid.current_vsync) if(vid.current_vsync)
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 ); SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 );
else else
SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 ); SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 0 );
#endif
if(vid.antialias & AA_MULTI) { if(vid.antialias & AA_MULTI) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, (vid.antialias & AA_MULTI16) ? 16 : 4); 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); addsaver(vid.language, "language", -1);
param_b(vid.drawmousecircle, "mouse circle", ISMOBILE || ISPANDORA); param_b(vid.drawmousecircle, "mouse circle", ISMOBILE || ISPANDORA);
param_b(vid.revcontrol, "reverse control", false); param_b(vid.revcontrol, "reverse control", false);
#if CAP_AUDIO
param_i(musicvolume, "music volume") param_i(musicvolume, "music volume")
->editable(0, 128, 10, "background music volume", "", 'b') ->editable(0, 128, 10, "background music volume", "", 'b')
->set_sets(sets_music_volume); ->set_sets(sets_music_volume);
#endif
#if CAP_SDLAUDIO #if CAP_SDLAUDIO
addsaver(music_out_of_focus, "music out of focus", false); addsaver(music_out_of_focus, "music out of focus", false);
#endif #endif
#if CAP_AUDIO
param_i(effvolume, "sound effect volume") param_i(effvolume, "sound effect volume")
->editable(0, 128, 10, "sound effects volume", "", 'e') ->editable(0, 128, 10, "sound effects volume", "", 'e')
->set_sets(sets_sfx_volume); ->set_sets(sets_sfx_volume);
#endif
param_enum(glyphsortorder, "glyph_sort", "glyph sort order", glyphsortorder) param_enum(glyphsortorder, "glyph_sort", "glyph sort order", glyphsortorder)
->editable({ ->editable({
@ -705,8 +709,10 @@ EX void initConfig() {
addsaver(vid.particles, "extra effects", 1); addsaver(vid.particles, "extra effects", 1);
param_i(vid.framelimit, "frame limit", 999); param_i(vid.framelimit, "frame limit", 999);
#if !ISMOBWEB
param_b(vid.want_vsync, "vsync", true) param_b(vid.want_vsync, "vsync", true)
->editable("vsync", 'v'); ->editable("vsync", 'v');
#endif
param_b(vid.want_fullscreen, "fullscreen", false) param_b(vid.want_fullscreen, "fullscreen", false)
->editable("fullscreen mode", 'f'); ->editable("fullscreen mode", 'f');
@ -1389,8 +1395,9 @@ EX void menuitem_sightrange(char c IS('c')) {
#if CAP_SOLV #if CAP_SOLV
if(pmodel == mdGeodesic && sol) if(pmodel == mdGeodesic && sol)
dialog::addSelItem(XLAT("sight range settings"), fts(sn::solrange_xy) + "x" + fts(sn::solrange_z), c); dialog::addSelItem(XLAT("sight range settings"), fts(sn::solrange_xy) + "x" + fts(sn::solrange_z), c);
else
#endif #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); dialog::addSelItem(XLAT("sight range settings"), fts(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail) + " px", c);
else if(WDIM == 3) else if(WDIM == 3)
dialog::addSelItem(XLAT("sight range settings"), fts(sightranges[geometry]) + "au", c); 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() { EX void sets_sfx_volume() {
#if CAP_AUDIO
dialog::numberdark = dialog::DONT_SHOW; dialog::numberdark = dialog::DONT_SHOW;
#if ISANDROID #if ISANDROID
dialog::reaction = [] () { dialog::reaction = [] () {
@ -1408,9 +1416,11 @@ EX void sets_sfx_volume() {
#endif #endif
dialog::bound_low(0); dialog::bound_low(0);
dialog::bound_up(MIX_MAX_VOLUME); dialog::bound_up(MIX_MAX_VOLUME);
#endif
} }
EX void sets_music_volume() { EX void sets_music_volume() {
#if CAP_AUDIO
dialog::numberdark = dialog::DONT_SHOW; dialog::numberdark = dialog::DONT_SHOW;
dialog::reaction = [] () { dialog::reaction = [] () {
#if CAP_SDLAUDIO #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'); dialog::addBoolItem_action(XLAT("play music when out of focus"), music_out_of_focus, 'A');
}; };
#endif #endif
#endif
} }
EX void showSpecialEffects() { EX void showSpecialEffects() {

View File

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

View File

@ -705,6 +705,7 @@ EX namespace models {
if(hyperbolic) { if(hyperbolic) {
dialog::addItem(XLAT("Gans model") + " " + XLAT("(zoomed out)"), '4'); 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(); }); 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::addItem(XLAT("Hypersian rug"), 'u');
dialog::add_action([] { dialog::add_action([] {
if(rug::rugged) pushScreen(rug::show); 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(); pconf.alpha = 1, pconf.scale = 1; if(!rug::rugged) rug::init(); popScreen();
} }
}); });
#endif
} }
} }
else if(GDIM == 2 && euclid) { else if(GDIM == 2 && euclid) {
@ -736,6 +738,7 @@ EX namespace models {
dialog::add_action([zoom_to] { zoom_to(1); }); dialog::add_action([zoom_to] { zoom_to(1); });
dialog::addItem(XLAT("zoom 0.5x"), '3'); dialog::addItem(XLAT("zoom 0.5x"), '3');
dialog::add_action([zoom_to] { zoom_to(.5); }); dialog::add_action([zoom_to] { zoom_to(.5); });
#if CAP_RUG
if(quotient) { if(quotient) {
dialog::addItem(XLAT("cylinder/donut view"), 'u'); dialog::addItem(XLAT("cylinder/donut view"), 'u');
dialog::add_action([] { dialog::add_action([] {
@ -745,6 +748,7 @@ EX namespace models {
} }
}); });
} }
#endif
} }
else if(GDIM == 3) { else if(GDIM == 3) {
auto& ysh = (WDIM == 2 ? vid.camera : vid.yshift); 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); dialog::addSelItem("completion", its(r.completion), 0);
} }
} }
#endif
#if MAXMDIM >= 4
EX void start_thurston() { EX void start_thurston() {
stop_game(); stop_game();
resetModes(); resetModes();
@ -1495,6 +1495,8 @@ EX void start_thurston() {
pushScreen(showStartMenu); pushScreen(showStartMenu);
pushScreen(racing::thurston_racing); pushScreen(racing::thurston_racing);
} }
#endif
#endif
#if !CAP_RACING #if !CAP_RACING
EX always_false on; EX always_false on;

View File

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