From 41952afdcd0798db97f4ad8199bd20d2df8720cd Mon Sep 17 00:00:00 2001 From: still-flow <46608177+still-flow@users.noreply.github.com> Date: Tue, 3 Nov 2020 00:00:04 +0300 Subject: [PATCH 1/2] add missing natchar for CAP_TRANS=0 case --- language.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/language.cpp b/language.cpp index 1d5dea17..0cf886eb 100644 --- a/language.cpp +++ b/language.cpp @@ -63,10 +63,10 @@ struct fullnoun { #if !CAP_TRANS #if HDR -#define NUMEXTRA 11 +#define NUMEXTRA 12 extern const char* natchars[NUMEXTRA]; #endif -const char* natchars[NUMEXTRA] = {"°","é","á", "²", "½", "Θ", "δ", "π", "ϕ", "ᵈ", "∞"}; +const char* natchars[NUMEXTRA] = {"°","é","á", "²", "½", "Θ", "δ", "π", "ϕ", "ᵈ", "∞", "⌫"}; #endif #if CAP_TRANS From 2319dce683261db7c41c557a05c4e2153abe3529 Mon Sep 17 00:00:00 2001 From: still-flow <46608177+still-flow@users.noreply.github.com> Date: Mon, 2 Nov 2020 20:27:52 +0300 Subject: [PATCH 2/2] refactor sound-related settings also only show music volume setting when music is available --- config.cpp | 70 ++++++++++++++++++++++++------------------- rogueviz/bringris.cpp | 16 ++-------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/config.cpp b/config.cpp index 372a59ad..0ca2be81 100644 --- a/config.cpp +++ b/config.cpp @@ -1085,7 +1085,44 @@ EX void menuitem_sightrange(char c IS('c')) { dialog::addSelItem(XLAT("sight range"), its(sightrange_bonus), c); dialog::add_action(edit_sightrange); } - + +EX void menuitem_sfx_volume() { + dialog::addSelItem(XLAT("sound effects volume"), its(effvolume), 'e'); + dialog::add_action([] { + dialog::editNumber(effvolume, 0, 128, 10, 60, XLAT("sound effects volume"), ""); + dialog::numberdark = dialog::DONT_SHOW; + dialog::reaction = [] () { + #if ISANDROID + settingsChanged = true; + #endif + }; + dialog::bound_low(0); + dialog::bound_up(MIX_MAX_VOLUME); + }); + } + +EX void menuitem_music_volume() { + if (!audio) return; + dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b'); + dialog::add_action([] { + dialog::editNumber(musicvolume, 0, 128, 10, 60, XLAT("background music volume"), ""); + dialog::numberdark = dialog::DONT_SHOW; + dialog::reaction = [] () { + #if CAP_SDLAUDIO + Mix_VolumeMusic(musicvolume); + #endif + #if ISANDROID + settingsChanged = true; + #endif + }; + dialog::bound_low(0); + dialog::bound_up(MIX_MAX_VOLUME); + dialog::extra_options = [] { + dialog::addBoolItem_action(XLAT("play music when out of focus"), music_out_of_focus, 'A'); + }; + }); + } + EX void showSpecialEffects() { cmode = vid.xres > vid.yres * 1.4 ? sm::SIDE : sm::MAYDARK; gamescreen(0); @@ -1337,35 +1374,8 @@ EX void configureOther() { // dialog::addBoolItem_action(XLAT("forget faraway cells"), memory_saving_mode, 'y'); #if CAP_AUDIO - dialog::addSelItem(XLAT("background music volume"), its(musicvolume), 'b'); - dialog::add_action([] { - dialog::editNumber(musicvolume, 0, 128, 10, 60, XLAT("background music volume"), ""); - dialog::reaction = [] () { -#if CAP_SDLAUDIO - Mix_VolumeMusic(musicvolume); -#endif -#if ISANDROID - settingsChanged = true; -#endif - }; - dialog::bound_low(0); - dialog::bound_up(MIX_MAX_VOLUME); - dialog::extra_options = [] { - dialog::addBoolItem_action(XLAT("play music when out of focus"), music_out_of_focus, 'A'); - }; - }); - - dialog::addSelItem(XLAT("sound effects volume"), its(effvolume), 'e'); - dialog::add_action([] { - dialog::editNumber(effvolume, 0, 128, 10, 60, XLAT("sound effects volume"), ""); - dialog::reaction = [] () { -#if ISANDROID - settingsChanged = true; -#endif - }; - dialog::bound_low(0); - dialog::bound_up(MIX_MAX_VOLUME); - }); + menuitem_music_volume(); + menuitem_sfx_volume(); #endif menuitem_sightrange('r'); diff --git a/rogueviz/bringris.cpp b/rogueviz/bringris.cpp index 3f4a8113..482a3e39 100644 --- a/rogueviz/bringris.cpp +++ b/rogueviz/bringris.cpp @@ -1295,19 +1295,9 @@ void settings_menu() { dialog::add_action_push(multi::get_key_configurer(1, move_names, "Bringris keys")); #if CAP_AUDIO - dialog::addSelItem(XLAT("sound effects volume"), its(effvolume), 'e'); - dialog::add_action([] { - dialog::editNumber(effvolume, 0, 128, 10, 60, XLAT("sound effects volume"), ""); - dialog::numberdark = dialog::DONT_SHOW; - dialog::reaction = [] () { -#if ISANDROID - settingsChanged = true; -#endif - }; - dialog::bound_low(0); - dialog::bound_up(MIX_MAX_VOLUME); - }); -#endif + menuitem_sfx_volume(); + menuitem_music_volume(); + #endif dialog::addBreak(100);