First adventure added. A bit of sound management improvement.

This commit is contained in:
Storm Dragon
2026-01-22 19:51:10 -05:00
parent ab7f3dc899
commit 35e192cb21
26 changed files with 851 additions and 54 deletions

View File

@@ -99,14 +99,6 @@ void expand_regular_area() {
int stream_start = random(0, EXPANSION_SIZE - stream_width);
int actual_start = new_start + stream_start;
add_world_stream(actual_start, stream_width);
string width_desc = "very small";
if (stream_width == 2) width_desc = "small";
else if (stream_width == 3) width_desc = "medium";
else if (stream_width == 4) width_desc = "wide";
else if (stream_width == 5) width_desc = "very wide";
notify("A " + width_desc + " stream flows through the new area at x " + actual_start + ".");
} else {
// Try to place a tree with proper spacing and per-area limits
spawn_tree_in_area(new_start, new_end);
@@ -480,12 +472,22 @@ void start_crossfade(bool to_night) {
if (to_night) {
// Starting night sound
if (night_sound_handle == -1 || !p.sound_is_active(night_sound_handle)) {
// Clean up invalid handle if it exists
if (night_sound_handle != -1) {
p.destroy_sound(night_sound_handle);
night_sound_handle = -1;
}
night_sound_handle = p.play_stationary("sounds/nature/night.ogg", true);
}
p.update_sound_start_values(night_sound_handle, 0.0, CROSSFADE_MIN_VOLUME, 1.0);
} else {
// Starting day sound
if (day_sound_handle == -1 || !p.sound_is_active(day_sound_handle)) {
// Clean up invalid handle if it exists
if (day_sound_handle != -1) {
p.destroy_sound(day_sound_handle);
day_sound_handle = -1;
}
day_sound_handle = p.play_stationary("sounds/nature/day.ogg", true);
}
p.update_sound_start_values(day_sound_handle, 0.0, CROSSFADE_MIN_VOLUME, 1.0);
@@ -550,6 +552,11 @@ void update_ambience(bool force_restart) {
night_sound_handle = -1;
}
if (day_sound_handle == -1 || !p.sound_is_active(day_sound_handle)) {
// Clean up invalid handle if it exists
if (day_sound_handle != -1) {
p.destroy_sound(day_sound_handle);
day_sound_handle = -1;
}
day_sound_handle = p.play_stationary("sounds/nature/day.ogg", true);
}
} else {
@@ -559,6 +566,11 @@ void update_ambience(bool force_restart) {
day_sound_handle = -1;
}
if (night_sound_handle == -1 || !p.sound_is_active(night_sound_handle)) {
// Clean up invalid handle if it exists
if (night_sound_handle != -1) {
p.destroy_sound(night_sound_handle);
night_sound_handle = -1;
}
night_sound_handle = p.play_stationary("sounds/nature/night.ogg", true);
}
}