mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-17 11:30:09 +00:00
missing guards in menuitem_*_volume, also no change of music volume when no music_available
This commit is contained in:
parent
3b7295c26a
commit
17c39c3ca2
@ -1088,6 +1088,7 @@ EX void menuitem_sightrange(char c IS('c')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX void menuitem_sfx_volume() {
|
EX void menuitem_sfx_volume() {
|
||||||
|
#if CAP_AUDIO
|
||||||
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"), "");
|
||||||
@ -1100,10 +1101,12 @@ EX void menuitem_sfx_volume() {
|
|||||||
dialog::bound_low(0);
|
dialog::bound_low(0);
|
||||||
dialog::bound_up(MIX_MAX_VOLUME);
|
dialog::bound_up(MIX_MAX_VOLUME);
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void menuitem_music_volume() {
|
EX void menuitem_music_volume() {
|
||||||
if (!audio) return;
|
#if CAP_AUDIO
|
||||||
|
if (!music_available) return;
|
||||||
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"), "");
|
||||||
@ -1124,6 +1127,7 @@ EX void menuitem_music_volume() {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void showSpecialEffects() {
|
EX void showSpecialEffects() {
|
||||||
|
@ -19,6 +19,7 @@ EX string musiclicense;
|
|||||||
EX string musfname[landtypes];
|
EX string musfname[landtypes];
|
||||||
EX int musicvolume = 60;
|
EX int musicvolume = 60;
|
||||||
EX int effvolume = 60;
|
EX int effvolume = 60;
|
||||||
|
EX bool music_available;
|
||||||
|
|
||||||
EX eLand getCurrentLandForMusic() {
|
EX eLand getCurrentLandForMusic() {
|
||||||
eLand id = ((anims::center_music()) && centerover) ? centerover->land : cwt.at->land;
|
eLand id = ((anims::center_music()) && centerover) ? centerover->land : cwt.at->land;
|
||||||
@ -162,6 +163,7 @@ EX bool loadMusicInfo(string dir) {
|
|||||||
if(id >= 0 && id < landtypes) {
|
if(id >= 0 && id < landtypes) {
|
||||||
if(buf[5] == '*' && buf[6] == '/') musfname[id] = dir2 + (buf+7);
|
if(buf[5] == '*' && buf[6] == '/') musfname[id] = dir2 + (buf+7);
|
||||||
else musfname[id] = buf+5;
|
else musfname[id] = buf+5;
|
||||||
|
music_available = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "warning: bad soundtrack id, use the following format:\n");
|
fprintf(stderr, "warning: bad soundtrack id, use the following format:\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user