Music: six more dungeon pieces and six surface pieces with flute, harp, birdsong and wind

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 22:58:41 +01:00
1 parent 86c707e151
commit d54de78f37
19 files changed
+166 -16

No files matched your search

+28 -2
View File
@@ -487,6 +487,19 @@ impl MusicDirector {
}
n >= 4
};
// the camera looks at the land above ground: the music of the surface
let above = {
let (cx, cz) = (cam.0 as i32, cam.1 as i32);
let mut n = 0;
for y in (cz - 4..=cz + 4).step_by(2) {
for x in (cx - 4..=cx + 4).step_by(2) {
if map::inb(x, y) && g.map.sky(map::idx(x, y)) {
n += 1;
}
}
}
n >= 13
};
let want = if title {
C::Title
} else if g.state == 1 {
@@ -508,11 +521,24 @@ impl MusicDirector {
} else {
C::Build
};
let rotate = matches!(want, C::Build | C::Title) && self.current == Some(want) && audio::music_loops() >= 2;
let want = match want {
C::Battle if above => C::SurfaceBattle,
C::Build | C::Torture | C::Temple if above => C::Surface,
w => w,
};
let rotate = matches!(want, C::Build | C::Title | C::Surface) && self.current == Some(want) && audio::music_loops() >= 2;
if self.current != Some(want) || rotate || audio::current_track().is_none() {
let before = self.current;
self.current = Some(want);
let t = self.pick(want);
let fade = if matches!(want, C::Victory | C::Defeat) { 1.0 } else { 2.5 };
// between the dungeon and the surface the music changes slowly
let fade = if matches!(want, C::Victory | C::Defeat) {
1.0
} else if matches!((before, want), (Some(C::Surface | C::SurfaceBattle), _) | (_, C::Surface | C::SurfaceBattle)) {
4.0
} else {
2.5
};
audio::play_music(t, fade);
}
}