Fixed a bug with night to day transition.
This commit is contained in:
1 parent
efd90b596c
commit
6b2f9d4457
1 file changed
+12
@@ -445,6 +445,14 @@ void update_time() {
|
|||||||
check_invasion_status();
|
check_invasion_status();
|
||||||
|
|
||||||
check_ambience_transition();
|
check_ambience_transition();
|
||||||
|
// Safety: if crossfade failed or was skipped, align day/night with the current hour.
|
||||||
|
if (!crossfade_active) {
|
||||||
|
bool expected_daytime = (current_hour >= 6 && current_hour < 19);
|
||||||
|
if (expected_daytime != is_daytime) {
|
||||||
|
is_daytime = expected_daytime;
|
||||||
|
update_ambience(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_daytime && residents_count > 0 && barricade_health < BARRICADE_MAX_HEALTH && current_hour % 4 == 0) {
|
if (is_daytime && residents_count > 0 && barricade_health < BARRICADE_MAX_HEALTH && current_hour % 4 == 0) {
|
||||||
if (has_any_storage_food()) {
|
if (has_any_storage_food()) {
|
||||||
@@ -578,22 +586,26 @@ void update_crossfade() {
|
|||||||
if (crossfade_to_night) {
|
if (crossfade_to_night) {
|
||||||
if (day_sound_handle == -1 || !p.sound_is_active(day_sound_handle)) {
|
if (day_sound_handle == -1 || !p.sound_is_active(day_sound_handle)) {
|
||||||
crossfade_active = false;
|
crossfade_active = false;
|
||||||
|
is_daytime = false;
|
||||||
update_ambience(true);
|
update_ambience(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (night_sound_handle == -1 || !p.sound_is_active(night_sound_handle)) {
|
if (night_sound_handle == -1 || !p.sound_is_active(night_sound_handle)) {
|
||||||
crossfade_active = false;
|
crossfade_active = false;
|
||||||
|
is_daytime = false;
|
||||||
update_ambience(true);
|
update_ambience(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (night_sound_handle == -1 || !p.sound_is_active(night_sound_handle)) {
|
if (night_sound_handle == -1 || !p.sound_is_active(night_sound_handle)) {
|
||||||
crossfade_active = false;
|
crossfade_active = false;
|
||||||
|
is_daytime = true;
|
||||||
update_ambience(true);
|
update_ambience(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (day_sound_handle == -1 || !p.sound_is_active(day_sound_handle)) {
|
if (day_sound_handle == -1 || !p.sound_is_active(day_sound_handle)) {
|
||||||
crossfade_active = false;
|
crossfade_active = false;
|
||||||
|
is_daytime = true;
|
||||||
update_ambience(true);
|
update_ambience(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user