music reset modes

This commit is contained in:
Zeno Rogue
2026-08-05 15:08:53 +02:00
parent 23c9f2c31d
commit 50f464ebcc
3 changed files with 31 additions and 0 deletions
+8
View File
@@ -1700,6 +1700,13 @@ EX void initConfig() {
param_b(nohud, "no-hud", false);
param_b(nomap, "nomap", false);
param_b(nofps, "no-fps", false);
param_enum(music_reset, "music_reset", music_reset_t::always)
->editable({
{"always", "even if both lands use the same music"},
{"non-subland", "except sublands using the same music"},
{"if different", "only if lands use different music"}},
"reset music when land changes", 'r');
#if CAP_IRR
param_f(irr::density, "irregular-density", 2);
@@ -2702,6 +2709,7 @@ EX void configureOther() {
#if CAP_AUDIO
add_edit(musicvolume);
add_edit(effvolume);
add_edit(music_reset);
#endif
menuitem_sightrange('r');
+12
View File
@@ -477,6 +477,18 @@ EX eLand pickluck(eLand l1, eLand l2) {
l == laPrairie || l == laHalloween;
} */
EX eLand get_superland(eLand l) {
if(l == laMountain) return laJungle;
if(l == laHaunted) return laGraveyard;
if(l == laCamelot || isCrossroads(l)) return laCrossroads;
if(l == laTemple) return laRlyeh;
if(l == laPrincessQuest) return laPalace;
if(l == laClearing) return laOvergrown;
if(l == laMirrorWall || l == laMirrored || l == laMirrorWall2) return laMirror;
if(l == laBrownian || l == laWhirlpool) return laOcean;
return l;
}
EX eLand getNewSealand(eLand old) {
for(int it=0; it<100; it++) {
eLand p = pick(laOcean, pick(laCaribbean, laLivefjord, laWarpSea, laKraken, laDocks));
+11
View File
@@ -27,6 +27,12 @@ EX int effvolume = 60;
EX bool music_available;
EX int musiclength[MUSIC_MAX];
#if HDR
enum class music_reset_t { always, subland, never };
#endif
EX music_reset_t music_reset;
EX eLand getCurrentLandForMusic() {
eLand id = ((anims::center_music()) && centerover) ? centerover->land : cwt.at->land;
if(isHaunted(id)) id = laHaunted;
@@ -129,6 +135,11 @@ EX void handlemusic() {
}
}
}
if(id != cid && musfname[id] == musfname[cid]) {
if(music_reset == music_reset_t::never) id = cid;
if(music_reset == music_reset_t::subland && get_superland(id) == get_superland(cid))
id = cid;
}
if(cid != id && !musfadeval) {
musicpos[cid] = SDL_GetTicks() - musstart;
musfadeval = musicpos[id] ? 500 : 2000;