A few more audio tweaks.
This commit is contained in:
@@ -39,6 +39,7 @@ class Bandit {
|
||||
int health;
|
||||
string alert_sound;
|
||||
string weapon_type; // "spear" or "axe"
|
||||
int sound_handle;
|
||||
timer move_timer;
|
||||
timer alert_timer;
|
||||
timer attack_timer;
|
||||
@@ -55,6 +56,7 @@ class Bandit {
|
||||
// Spawn somewhere in the expanded area
|
||||
position = random(expansion_start, expansion_end);
|
||||
health = BANDIT_HEALTH;
|
||||
sound_handle = -1;
|
||||
|
||||
// Choose random alert sound
|
||||
int sound_index = random(0, bandit_sounds.length() - 1);
|
||||
@@ -616,7 +618,7 @@ void spawn_zombie() {
|
||||
|
||||
Zombie@ z = Zombie(spawn_x);
|
||||
zombies.insert_last(z);
|
||||
z.sound_handle = play_1d_with_volume_step(z.voice_sound, x, spawn_x, false, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
z.sound_handle = play_creature_voice(z.voice_sound, x, spawn_x, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
}
|
||||
|
||||
void try_attack_barricade(Zombie@ zombie) {
|
||||
@@ -628,7 +630,7 @@ void try_attack_barricade(Zombie@ zombie) {
|
||||
barricade_health -= damage;
|
||||
if (barricade_health < 0) barricade_health = 0;
|
||||
|
||||
play_1d_with_volume_step("sounds/enemies/zombie_hits_player.ogg", x, zombie.position, false, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
play_creature_attack_sound("sounds/enemies/zombie_hits_player.ogg", x, zombie.position, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
|
||||
// Resident defense counter-attack
|
||||
if (can_residents_defend()) {
|
||||
@@ -677,7 +679,7 @@ bool try_attack_player(Zombie@ zombie) {
|
||||
player_health = 0;
|
||||
}
|
||||
|
||||
play_1d_with_volume_step("sounds/enemies/zombie_hits_player.ogg", x, zombie.position, false, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
play_creature_attack_sound("sounds/enemies/zombie_hits_player.ogg", x, zombie.position, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -685,7 +687,7 @@ void update_zombie(Zombie@ zombie) {
|
||||
if (zombie.groan_timer.elapsed > zombie.next_groan_delay) {
|
||||
zombie.groan_timer.restart();
|
||||
zombie.next_groan_delay = random(ZOMBIE_GROAN_MIN_DELAY, ZOMBIE_GROAN_MAX_DELAY);
|
||||
zombie.sound_handle = play_1d_with_volume_step(zombie.voice_sound, x, zombie.position, false, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
zombie.sound_handle = play_creature_voice(zombie.voice_sound, x, zombie.position, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
}
|
||||
|
||||
if (try_attack_player(zombie)) {
|
||||
@@ -723,7 +725,7 @@ void update_zombie(Zombie@ zombie) {
|
||||
}
|
||||
|
||||
zombie.position = target_x;
|
||||
play_positional_footstep(x, zombie.position, BASE_END, GRASS_END, ZOMBIE_FOOTSTEP_MAX_DISTANCE, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
play_creature_footstep(x, zombie.position, BASE_END, GRASS_END, ZOMBIE_FOOTSTEP_MAX_DISTANCE, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
}
|
||||
|
||||
void update_zombies() {
|
||||
@@ -750,7 +752,7 @@ bool damage_zombie_at(int pos, int damage) {
|
||||
p.destroy_sound(zombies[i].sound_handle);
|
||||
zombies[i].sound_handle = -1;
|
||||
}
|
||||
play_1d_with_volume_step("sounds/enemies/enemy_falls.ogg", x, pos, false, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
play_creature_death_sound("sounds/enemies/enemy_falls.ogg", x, pos, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
zombies.remove_at(i);
|
||||
}
|
||||
return true;
|
||||
@@ -809,7 +811,7 @@ void spawn_bandit(int expansion_start, int expansion_end) {
|
||||
|
||||
Bandit@ b = Bandit(spawn_x, expansion_start, expansion_end);
|
||||
bandits.insert_last(b);
|
||||
play_1d_with_volume_step(b.alert_sound, x, spawn_x, false, BANDIT_SOUND_VOLUME_STEP);
|
||||
b.sound_handle = play_creature_voice(b.alert_sound, x, spawn_x, BANDIT_SOUND_VOLUME_STEP);
|
||||
}
|
||||
|
||||
bool can_bandit_attack_player(Bandit@ bandit) {
|
||||
@@ -903,7 +905,7 @@ 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);
|
||||
play_1d_with_volume_step(bandit.alert_sound, x, bandit.position, false, BANDIT_SOUND_VOLUME_STEP);
|
||||
bandit.sound_handle = play_creature_voice(bandit.alert_sound, x, bandit.position, BANDIT_SOUND_VOLUME_STEP);
|
||||
}
|
||||
|
||||
if (try_attack_player_bandit(bandit)) {
|
||||
@@ -947,7 +949,7 @@ void update_bandit(Bandit@ bandit) {
|
||||
bandit.wander_direction = -bandit.wander_direction;
|
||||
} else {
|
||||
bandit.position = target_x;
|
||||
play_positional_footstep(x, bandit.position, BASE_END, GRASS_END, BANDIT_FOOTSTEP_MAX_DISTANCE, BANDIT_SOUND_VOLUME_STEP);
|
||||
play_creature_footstep(x, bandit.position, BASE_END, GRASS_END, BANDIT_FOOTSTEP_MAX_DISTANCE, BANDIT_SOUND_VOLUME_STEP);
|
||||
}
|
||||
} else {
|
||||
// Hit map boundary, reverse direction
|
||||
@@ -990,7 +992,7 @@ void update_bandit(Bandit@ bandit) {
|
||||
}
|
||||
|
||||
bandit.position = target_x;
|
||||
play_positional_footstep(x, bandit.position, BASE_END, GRASS_END, BANDIT_FOOTSTEP_MAX_DISTANCE, BANDIT_SOUND_VOLUME_STEP);
|
||||
play_creature_footstep(x, bandit.position, BASE_END, GRASS_END, BANDIT_FOOTSTEP_MAX_DISTANCE, BANDIT_SOUND_VOLUME_STEP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1005,7 +1007,11 @@ bool damage_bandit_at(int pos, int damage) {
|
||||
if (bandits[i].position == pos) {
|
||||
bandits[i].health -= damage;
|
||||
if (bandits[i].health <= 0) {
|
||||
play_1d_with_volume_step("sounds/enemies/enemy_falls.ogg", x, pos, false, BANDIT_SOUND_VOLUME_STEP);
|
||||
if (bandits[i].sound_handle != -1) {
|
||||
p.destroy_sound(bandits[i].sound_handle);
|
||||
bandits[i].sound_handle = -1;
|
||||
}
|
||||
play_creature_death_sound("sounds/enemies/enemy_falls.ogg", x, pos, BANDIT_SOUND_VOLUME_STEP);
|
||||
bandits.remove_at(i);
|
||||
} else {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user