VoiceKind for better sound effect specs

This commit is contained in:
Joshua Barretto 2021-06-15 17:57:52 +01:00
parent 559311e1b0
commit 0ef29a6989
10 changed files with 59 additions and 21 deletions

View File

@ -831,11 +831,24 @@
],
threshold: 0.2,
),
Utterance(Angry, BipedLarge((species: Wendigo, body_type: Female))): (
Utterance(Angry, Wendigo): (
files: [
"voxygen.audio.sfx.utterance.wendigo_angry",
],
threshold: 4.0,
),
Utterance(Angry, BipedLarge): (
files: [
"voxygen.audio.sfx.utterance.ogre_angry",
"voxygen.audio.sfx.utterance.ogre_angry2",
],
threshold: 4.0,
),
Utterance(Angry, Saurok): (
files: [
"voxygen.audio.sfx.utterance.saurok_angry",
],
threshold: 4.0,
),
}
)

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/audio/sfx/utterance/saurok_angry.ogg (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -67,7 +67,8 @@ pub use self::{
combo::Combo,
controller::{
Climb, ControlAction, ControlEvent, Controller, ControllerInputs, GroupManip, InputAttr,
InputKind, InventoryAction, InventoryEvent, InventoryManip, MountState, Mounting, UtteranceKind,
InputKind, InventoryAction, InventoryEvent, InventoryManip, MountState, Mounting,
UtteranceKind,
},
energy::{Energy, EnergyChange, EnergySource},
fluid_dynamics::Fluid,

View File

@ -1,5 +1,8 @@
use common::{
comp::{BuffChange, ControlEvent, Controller, Pos, Body, agent::{Sound, SoundKind}},
comp::{
agent::{Sound, SoundKind},
Body, BuffChange, ControlEvent, Controller, Pos,
},
event::{EventBus, ServerEvent},
uid::UidAllocator,
};
@ -7,7 +10,7 @@ use common_ecs::{Job, Origin, Phase, System};
use specs::{
saveload::{Marker, MarkerAllocator},
shred::ResourceId,
Entities, Join, Read, SystemData, World, WriteStorage, ReadStorage,
Entities, Join, Read, ReadStorage, SystemData, World, WriteStorage,
};
use vek::*;

View File

@ -6,7 +6,7 @@ use common::{
assets,
comp::{
self,
agent::{AgentEvent, Sound, MAX_LISTEN_DIST, SoundKind},
agent::{AgentEvent, Sound, SoundKind, MAX_LISTEN_DIST},
dialogue::Subject,
inventory::slot::EquipSlot,
item,
@ -386,7 +386,8 @@ pub fn handle_sound(server: &mut Server, sound: &Sound) {
let positions = &ecs.read_storage::<comp::Pos>();
let agents = &mut ecs.write_storage::<comp::Agent>();
// TODO: Reduce the complexity of this problem by using spatial partitioning system
// TODO: Reduce the complexity of this problem by using spatial partitioning
// system
for (agent, agent_pos) in (agents, positions).join() {
// TODO: Use pathfinding for more dropoff around obstacles
let agent_dist_sqrd = agent_pos.0.distance_squared(sound.pos);
@ -413,9 +414,7 @@ pub fn handle_sound(server: &mut Server, sound: &Sound) {
}),
_ => None,
} {
ecs
.write_resource::<Vec<Outcome>>()
.push(outcome);
ecs.write_resource::<Vec<Outcome>>().push(outcome);
}
}
}

View File

@ -21,7 +21,7 @@ use common::{
Agent, Alignment, BehaviorCapability, BehaviorState, Body, CharacterAbility,
CharacterState, ControlAction, ControlEvent, Controller, Energy, Health, HealthChange,
InputKind, Inventory, InventoryAction, LightEmitter, MountState, Ori, PhysicsState, Pos,
Scale, SkillSet, Stats, UnresolvedChatMsg, Vel, UtteranceKind,
Scale, SkillSet, Stats, UnresolvedChatMsg, UtteranceKind, Vel,
},
consts::GRAVITY,
effect::{BuffEffect, Effect},

View File

@ -91,12 +91,11 @@ use client::Client;
use common::{
assets::{self, AssetExt, AssetHandle},
comp::{
beam,
beam, biped_large,
item::{ItemKind, ToolKind},
object,
poise::PoiseState,
Body, CharacterAbilityType, InventoryUpdateEvent,
UtteranceKind,
Body, CharacterAbilityType, InventoryUpdateEvent, UtteranceKind,
},
outcome::Outcome,
terrain::{BlockKind, TerrainChunk},
@ -183,7 +182,29 @@ pub enum SfxEvent {
FlameThrower,
PoiseChange(PoiseState),
GroundSlam,
Utterance(UtteranceKind, Body),
Utterance(UtteranceKind, VoiceKind),
}
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
pub enum VoiceKind {
Mute,
Human,
BipedLarge,
Wendigo,
Saurok,
}
fn body_to_voice(body: &Body) -> VoiceKind {
match body {
Body::BipedLarge(body) => match body.species {
biped_large::Species::Wendigo => VoiceKind::Wendigo,
biped_large::Species::Occultsaurok
| biped_large::Species::Mightysaurok
| biped_large::Species::Slysaurok => VoiceKind::Saurok,
_ => VoiceKind::BipedLarge,
},
_ => VoiceKind::Mute,
}
}
#[derive(Clone, Debug, PartialEq, Deserialize, Hash, Eq)]
@ -455,8 +476,9 @@ impl SfxMgr {
},
},
Outcome::Utterance { pos, kind, body } => {
let sfx_trigger_item = triggers.get_key_value(&SfxEvent::Utterance(*kind, *body));
audio.emit_sfx(sfx_trigger_item, *pos, None, false);
let sfx_trigger_item =
triggers.get_key_value(&SfxEvent::Utterance(*kind, body_to_voice(body)));
audio.emit_sfx(sfx_trigger_item, *pos, Some(2.5), false);
},
Outcome::ExpChange { .. }
| Outcome::ComboChange { .. }