audio indicator for roll cancels

This commit is contained in:
do-no-van
2025-01-27 17:23:32 -05:00
parent a439ce2641
commit 8362a117c3
9 changed files with 30 additions and 2 deletions

View File

@ -304,6 +304,14 @@
threshold: 0.3,
subtitle: "subtitle-roll",
),
RollCancel: (
files: [
"voxygen.audio.sfx.character.dive_roll_cancel_1",
"voxygen.audio.sfx.character.dive_roll_cancel_2",
],
threshold: 0.3,
subtitle: "subtitle-roll_cancel",
),
Climb: (
files: [
// TODO: sync with animation, make actual sfx

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

Binary file not shown.

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

Binary file not shown.

View File

@ -19,6 +19,7 @@ subtitle-glider_open = Glider equipped
subtitle-glider_close = Glider unequipped
subtitle-glide = Gliding
subtitle-roll = Rolling
subtitle-roll_cancel = Roll cancelling
subtitle-swim = Swimming
subtitle-climb = Climbing
subtitle-damage = Damage

View File

@ -864,6 +864,7 @@ pub enum CharacterAbility {
recover_duration: f32,
roll_strength: f32,
attack_immunities: AttackFilters,
was_cancel: bool,
#[serde(default)]
meta: AbilityMeta,
},
@ -1331,6 +1332,7 @@ impl CharacterAbility {
air_shockwaves: true,
explosions: true,
},
was_cancel: remaining_duration > 0.0,
meta: Default::default(),
}
}
@ -1454,6 +1456,7 @@ impl CharacterAbility {
ref mut recover_duration,
roll_strength: _,
attack_immunities: _,
was_cancel: _,
meta: _,
} => {
*buildup_duration /= stats.speed;
@ -2453,6 +2456,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
recover_duration,
roll_strength,
attack_immunities,
was_cancel,
meta: _,
} => CharacterState::Roll(roll::Data {
static_data: roll::StaticData {
@ -2461,6 +2465,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
recover_duration: Duration::from_secs_f32(*recover_duration),
roll_strength: *roll_strength,
attack_immunities: *attack_immunities,
was_cancel: *was_cancel,
ability_info,
},
timer: Duration::default(),

View File

@ -29,6 +29,8 @@ pub struct StaticData {
pub attack_immunities: AttackFilters,
/// Information about the ability
pub ability_info: AbilityInfo,
/// Whether the roll cancelled another ability
pub was_cancel: bool,
}
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]

View File

@ -196,8 +196,12 @@ impl MovementEventMapper {
} else if physics_state.on_ground.is_some() && vel.magnitude() > 0.1
|| !previous_state.on_ground && physics_state.on_ground.is_some()
{
return if matches!(character_state, CharacterState::Roll(_)) {
SfxEvent::Roll
return if let CharacterState::Roll(data) = character_state {
if data.static_data.was_cancel {
SfxEvent::RollCancel
} else {
SfxEvent::Roll
}
} else if character_state.is_stealthy() {
SfxEvent::Sneak
} else {

View File

@ -196,6 +196,7 @@ fn maps_roll() {
explosions: false,
},
ability_info: empty_ability_info(),
was_cancel: false,
},
timer: Duration::default(),
stage_section: states::utils::StageSection::Buildup,

View File

@ -136,6 +136,7 @@ pub enum SfxEvent {
Run(BlockKind),
QuadRun(BlockKind),
Roll,
RollCancel,
Sneak,
Climb,
GliderOpen,