Lots of changes, forgot to add the heal scroll sound. Sounds for when enemies come in and go out of range. Menu filtering added.
This commit is contained in:
@@ -9,6 +9,7 @@ class Undead {
|
||||
string undead_type; // "zombie", future: "vampire", "ghost", etc.
|
||||
string voice_sound;
|
||||
int sound_handle;
|
||||
bool in_weapon_range;
|
||||
timer move_timer;
|
||||
timer attack_timer;
|
||||
|
||||
@@ -19,16 +20,30 @@ class Undead {
|
||||
int sound_index = random(0, undead_zombie_sounds.length() - 1);
|
||||
voice_sound = undead_zombie_sounds[sound_index];
|
||||
sound_handle = -1;
|
||||
in_weapon_range = false;
|
||||
move_timer.restart();
|
||||
attack_timer.restart();
|
||||
}
|
||||
}
|
||||
Undead@[] undeads;
|
||||
|
||||
void update_undead_weapon_range_audio() {
|
||||
for (uint i = 0; i < undeads.length(); i++) {
|
||||
update_weapon_range_audio(undeads[i].position, undeads[i].in_weapon_range);
|
||||
}
|
||||
}
|
||||
bool undead_range_audio_registered = false;
|
||||
|
||||
void ensure_undead_range_audio_registration() {
|
||||
if (undead_range_audio_registered) return;
|
||||
undead_range_audio_registered = register_weapon_range_audio_callback(@update_undead_weapon_range_audio);
|
||||
}
|
||||
|
||||
void clear_undeads() {
|
||||
if (undeads.length() == 0) return;
|
||||
|
||||
for (uint i = 0; i < undeads.length(); i++) {
|
||||
force_weapon_range_exit(undeads[i].position, undeads[i].in_weapon_range);
|
||||
if (undeads[i].sound_handle != -1) {
|
||||
p.destroy_sound(undeads[i].sound_handle);
|
||||
undeads[i].sound_handle = -1;
|
||||
@@ -191,6 +206,7 @@ void update_undead(Undead@ undead, bool audio_active) {
|
||||
}
|
||||
|
||||
void update_undeads() {
|
||||
ensure_undead_range_audio_registration();
|
||||
if (is_daytime) {
|
||||
clear_undeads();
|
||||
return;
|
||||
@@ -227,7 +243,7 @@ bool damage_undead_at(int pos, int damage) {
|
||||
p.destroy_sound(undeads[i].sound_handle);
|
||||
undeads[i].sound_handle = -1;
|
||||
}
|
||||
play_creature_death_sound("sounds/enemies/enemy_falls.ogg", x, pos, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
play_creature_death_sounds("sounds/enemies/enemy_falls.ogg", undeads[i].voice_sound, x, pos, ZOMBIE_SOUND_VOLUME_STEP);
|
||||
undeads.remove_at(i);
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user