First adventure added. A bit of sound management improvement.
This commit is contained in:
@@ -181,6 +181,13 @@ void update_bandit(Bandit@ bandit) {
|
||||
if (bandit.alert_timer.elapsed > bandit.next_alert_delay) {
|
||||
bandit.alert_timer.restart();
|
||||
bandit.next_alert_delay = random(BANDIT_ALERT_MIN_DELAY, BANDIT_ALERT_MAX_DELAY);
|
||||
|
||||
// Destroy old sound handle before playing new one to prevent overlapping
|
||||
if (bandit.sound_handle != -1) {
|
||||
p.destroy_sound(bandit.sound_handle);
|
||||
bandit.sound_handle = -1;
|
||||
}
|
||||
|
||||
bandit.sound_handle = play_creature_voice(bandit.alert_sound, x, bandit.position, BANDIT_SOUND_VOLUME_STEP);
|
||||
}
|
||||
|
||||
|
||||
@@ -330,7 +330,6 @@ void update_flying_creature(FlyingCreature@ creature) {
|
||||
}
|
||||
|
||||
play_creature_death_sound(cfg.impact_sound, x, creature.position, cfg.sound_volume_step);
|
||||
notify("A " + creature.creature_type + " fell from the sky at " + creature.position + "!");
|
||||
add_world_drop(creature.position, cfg.drop_type);
|
||||
creature.health = 0;
|
||||
}
|
||||
|
||||
@@ -134,6 +134,13 @@ void update_undead(Undead@ undead) {
|
||||
if (undead.groan_timer.elapsed > undead.next_groan_delay) {
|
||||
undead.groan_timer.restart();
|
||||
undead.next_groan_delay = random(ZOMBIE_GROAN_MIN_DELAY, ZOMBIE_GROAN_MAX_DELAY);
|
||||
|
||||
// Destroy old sound handle before playing new one to prevent overlapping
|
||||
if (undead.sound_handle != -1) {
|
||||
p.destroy_sound(undead.sound_handle);
|
||||
undead.sound_handle = -1;
|
||||
}
|
||||
|
||||
undead.sound_handle = play_creature_voice(undead.voice_sound, x, undead.position, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user