mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
Eliminate some use of CAP_FOO and ISFOO outside of the preprocessor.
The old code worked, but it's strange to use these macros as if they were C++ `bool` variables at runtime.
This commit is contained in:
parent
f2b7746c1b
commit
3e3457bd81
74
config.cpp
74
config.cpp
@ -1269,36 +1269,34 @@ EX void configureOther() {
|
|||||||
|
|
||||||
// dialog::addBoolItem_action(XLAT("forget faraway cells"), memory_saving_mode, 'y');
|
// dialog::addBoolItem_action(XLAT("forget faraway cells"), memory_saving_mode, 'y');
|
||||||
|
|
||||||
#if CAP_AUDIO
|
#if CAP_AUDIO
|
||||||
if(CAP_AUDIO) {
|
dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b');
|
||||||
dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b');
|
dialog::add_action([] {
|
||||||
dialog::add_action([] {
|
dialog::editNumber(musicvolume, 0, 128, 10, 60, XLAT("background music volume"), "");
|
||||||
dialog::editNumber(musicvolume, 0, 128, 10, 60, XLAT("background music volume"), "");
|
dialog::reaction = [] () {
|
||||||
dialog::reaction = [] () {
|
#if CAP_SDLAUDIO
|
||||||
#if CAP_SDLAUDIO
|
Mix_VolumeMusic(musicvolume);
|
||||||
Mix_VolumeMusic(musicvolume);
|
#endif
|
||||||
#endif
|
#if ISANDROID
|
||||||
#if ISANDROID
|
settingsChanged = true;
|
||||||
settingsChanged = true;
|
#endif
|
||||||
#endif
|
};
|
||||||
};
|
dialog::bound_low(0);
|
||||||
dialog::bound_low(0);
|
dialog::bound_up(MIX_MAX_VOLUME);
|
||||||
dialog::bound_up(MIX_MAX_VOLUME);
|
});
|
||||||
});
|
|
||||||
|
|
||||||
dialog::addSelItem(XLAT("sound effects volume"), its(effvolume), 'e');
|
dialog::addSelItem(XLAT("sound effects volume"), its(effvolume), 'e');
|
||||||
dialog::add_action([] {
|
dialog::add_action([] {
|
||||||
dialog::editNumber(effvolume, 0, 128, 10, 60, XLAT("sound effects volume"), "");
|
dialog::editNumber(effvolume, 0, 128, 10, 60, XLAT("sound effects volume"), "");
|
||||||
dialog::reaction = [] () {
|
dialog::reaction = [] () {
|
||||||
#if ISANDROID
|
#if ISANDROID
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
dialog::bound_low(0);
|
dialog::bound_low(0);
|
||||||
dialog::bound_up(MIX_MAX_VOLUME);
|
dialog::bound_up(MIX_MAX_VOLUME);
|
||||||
});
|
});
|
||||||
}
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
menuitem_sightrange('r');
|
menuitem_sightrange('r');
|
||||||
|
|
||||||
@ -1317,12 +1315,10 @@ EX void configureInterface() {
|
|||||||
gamescreen(3);
|
gamescreen(3);
|
||||||
dialog::init(XLAT("interface"));
|
dialog::init(XLAT("interface"));
|
||||||
|
|
||||||
#if CAP_TRANS
|
#if CAP_TRANS
|
||||||
if(CAP_TRANS) {
|
dialog::addSelItem(XLAT("language"), XLAT("EN"), 'l');
|
||||||
dialog::addSelItem(XLAT("language"), XLAT("EN"), 'l');
|
dialog::add_action_push(selectLanguageScreen);
|
||||||
dialog::add_action_push(selectLanguageScreen);
|
#endif
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dialog::addSelItem(XLAT("player character"), numplayers() > 1 ? "" : csname(vid.cs), 'g');
|
dialog::addSelItem(XLAT("player character"), numplayers() > 1 ? "" : csname(vid.cs), 'g');
|
||||||
dialog::add_action_push(showCustomizeChar);
|
dialog::add_action_push(showCustomizeChar);
|
||||||
@ -2312,11 +2308,9 @@ EX void showSettings() {
|
|||||||
dialog::addItem(XLAT("colors & aura"), 'c');
|
dialog::addItem(XLAT("colors & aura"), 'c');
|
||||||
dialog::add_action_push(show_color_dialog);
|
dialog::add_action_push(show_color_dialog);
|
||||||
|
|
||||||
#if CAP_SHMUP
|
#if CAP_SHMUP && !ISMOBILE
|
||||||
if(CAP_SHMUP && !ISMOBILE) {
|
dialog::addSelItem(XLAT("keyboard & joysticks"), "", 'k');
|
||||||
dialog::addSelItem(XLAT("keyboard & joysticks"), "", 'k');
|
dialog::add_action(multi::configure);
|
||||||
dialog::add_action(multi::configure);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dialog::addSelItem(XLAT("mouse & touchscreen"), "", 'm');
|
dialog::addSelItem(XLAT("mouse & touchscreen"), "", 'm');
|
||||||
|
4
rug.cpp
4
rug.cpp
@ -1624,8 +1624,10 @@ EX void show() {
|
|||||||
else if(uni == 'n' && !rug::rugged)
|
else if(uni == 'n' && !rug::rugged)
|
||||||
pushScreen(rug_geometry_choice);
|
pushScreen(rug_geometry_choice);
|
||||||
#endif
|
#endif
|
||||||
else if(uni == 'g' && !rug::rugged && CAP_SDL)
|
#if CAP_SDL
|
||||||
|
else if(uni == 'g' && !rug::rugged)
|
||||||
rendernogl = !rendernogl;
|
rendernogl = !rendernogl;
|
||||||
|
#endif
|
||||||
else if(uni == 's') {
|
else if(uni == 's') {
|
||||||
texturesize *= 2;
|
texturesize *= 2;
|
||||||
if(texturesize == 8192) texturesize = 64;
|
if(texturesize == 8192) texturesize = 64;
|
||||||
|
@ -285,7 +285,7 @@ EX void show_memory_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX bool protect_memory() {
|
EX bool protect_memory() {
|
||||||
if(!CAP_MEMORY_RESERVE) return false;
|
#if CAP_MEMORY_RESERVE
|
||||||
apply_memory_reserve();
|
apply_memory_reserve();
|
||||||
if(reserve_limit && reserve_count < reserve_limit && !ignored_memory_warning) {
|
if(reserve_limit && reserve_count < reserve_limit && !ignored_memory_warning) {
|
||||||
pushScreen(show_memory_menu);
|
pushScreen(show_memory_menu);
|
||||||
@ -295,6 +295,7 @@ EX bool protect_memory() {
|
|||||||
pushScreen(show_memory_menu);
|
pushScreen(show_memory_menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,13 +358,14 @@ EX always_false in;
|
|||||||
/** 0 = no/unknown/disabled texture, 1 = rug, 2 = gradient, 3 = floor texture */
|
/** 0 = no/unknown/disabled texture, 1 = rug, 2 = gradient, 3 = floor texture */
|
||||||
EX int texture_type(dqi_poly& p) {
|
EX int texture_type(dqi_poly& p) {
|
||||||
if(!p.tinf) return 0;
|
if(!p.tinf) return 0;
|
||||||
if(!CAP_PNG) return 0;
|
#if CAP_PNG
|
||||||
if(!textures) return 0;
|
if(!textures) return 0;
|
||||||
if(p.tinf == &rug::tinf) return 1;
|
if(p.tinf == &rug::tinf) return 1;
|
||||||
#if MAXMDIM >= 4
|
#if MAXMDIM >= 4
|
||||||
if(p.tinf->texture_id == (int) floor_textures->renderedTexture)
|
if(p.tinf->texture_id == (int) floor_textures->renderedTexture)
|
||||||
return (p.tinf->tvertices[0][0] == 0) ? 2 : 3;
|
return (p.tinf->tvertices[0][0] == 0) ? 2 : 3;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1730,8 +1731,13 @@ startanim perspective { "projection distance", no_init, [] {
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
startanim rug { "Hypersian Rug", [] {
|
startanim rug { "Hypersian Rug", [] {
|
||||||
if(!CAP_RUG) { pick(); return; }
|
#if CAP_RUG
|
||||||
rug::init(), rug::rugged = false; }, [] {
|
rug::init();
|
||||||
|
rug::rugged = false;
|
||||||
|
#else
|
||||||
|
pick();
|
||||||
|
#endif
|
||||||
|
}, [] {
|
||||||
dynamicval<bool> b(rug::rugged, true);
|
dynamicval<bool> b(rug::rugged, true);
|
||||||
rug::physics();
|
rug::physics();
|
||||||
dynamicval<transmatrix> t(rug::rugView, cspin(1, 2, ticks / 3000.) * rug::rugView);
|
dynamicval<transmatrix> t(rug::rugView, cspin(1, 2, ticks / 3000.) * rug::rugView);
|
||||||
|
Loading…
Reference in New Issue
Block a user