mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Made animations when dual wielding less bad
This commit is contained in:
parent
bc8f794309
commit
937db8706c
@ -4,7 +4,7 @@ use super::{
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::StageSection,
|
||||
states::utils::{AbilityInfo, StageSection},
|
||||
};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
@ -17,6 +17,7 @@ type BlockAnimationDependency<'a> = (
|
||||
Vec3<f32>,
|
||||
Option<&'a str>,
|
||||
Option<StageSection>,
|
||||
Option<AbilityInfo>,
|
||||
);
|
||||
impl Animation for BlockAnimation {
|
||||
type Dependency<'a> = BlockAnimationDependency<'a>;
|
||||
@ -28,7 +29,15 @@ impl Animation for BlockAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_block")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(hands, active_tool_kind, second_tool_kind, velocity, ability_id, stage_section): Self::Dependency<'a>,
|
||||
(
|
||||
hands,
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
velocity,
|
||||
ability_id,
|
||||
stage_section,
|
||||
_ability_info,
|
||||
): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
|
@ -38,6 +38,9 @@ impl Animation for ChargeswingAnimation {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main_weapon_trail = true;
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.off_weapon_trail = true;
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.balanced_thrust") => {
|
||||
|
@ -2,16 +2,12 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::Hands,
|
||||
states::utils::{AbilityInfo, StageSection},
|
||||
};
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct ComboAnimation;
|
||||
impl Animation for ComboAnimation {
|
||||
type Dependency<'a> = (
|
||||
(Option<Hands>, Option<Hands>),
|
||||
Option<&'a str>,
|
||||
Option<StageSection>,
|
||||
Option<AbilityInfo>,
|
||||
@ -26,7 +22,7 @@ impl Animation for ComboAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_combo")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_hands, ability_id, stage_section, _ability_info, current_strike, move_dir): Self::Dependency<'a>,
|
||||
(ability_id, stage_section, _ability_info, current_strike, move_dir): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -37,6 +33,9 @@ impl Animation for ComboAnimation {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main_weapon_trail = true;
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.off_weapon_trail = true;
|
||||
let multi_strike_pullback = 1.0
|
||||
- if matches!(stage_section, Some(StageSection::Recover)) {
|
||||
anim_time.powi(4)
|
||||
|
@ -38,6 +38,9 @@ impl Animation for DashAnimation {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main_weapon_trail = true;
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.off_weapon_trail = true;
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.reaching_charge") => {
|
||||
|
@ -2,11 +2,16 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
|
||||
pub struct DiveMeleeAnimation;
|
||||
impl Animation for DiveMeleeAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>, f32);
|
||||
type Dependency<'a> = (
|
||||
Option<&'a str>,
|
||||
Option<StageSection>,
|
||||
f32,
|
||||
Option<AbilityInfo>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -15,7 +20,7 @@ impl Animation for DiveMeleeAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_dive_melee")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section, ground_dist): Self::Dependency<'a>,
|
||||
(ability_id, stage_section, ground_dist, _ability_info): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -26,6 +31,9 @@ impl Animation for DiveMeleeAnimation {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main_weapon_trail = true;
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.off_weapon_trail = true;
|
||||
|
||||
let ground_dist = ground_dist.clamp(0.0, 0.5) * 2.0;
|
||||
let ground_dist = if ground_dist.is_nan() {
|
||||
|
@ -2,12 +2,12 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct FinisherMeleeAnimation;
|
||||
impl Animation for FinisherMeleeAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>);
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>, Option<AbilityInfo>);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -16,19 +16,20 @@ impl Animation for FinisherMeleeAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_finisher_melee")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section): Self::Dependency<'a>,
|
||||
(ability_id, stage_section, _ability_info): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main_weapon_trail = true;
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.off_weapon_trail = true;
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.balanced_finisher") => {
|
||||
|
@ -2,12 +2,17 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
use std::ops::{Mul, Sub};
|
||||
|
||||
pub struct RapidMeleeAnimation;
|
||||
impl Animation for RapidMeleeAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>, (u32, u32));
|
||||
type Dependency<'a> = (
|
||||
Option<&'a str>,
|
||||
Option<StageSection>,
|
||||
(u32, u32),
|
||||
Option<AbilityInfo>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -16,7 +21,9 @@ impl Animation for RapidMeleeAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_rapid_melee")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section, (current_strike, max_strikes)): Self::Dependency<'a>,
|
||||
(ability_id, stage_section, (current_strike, max_strikes), _ability_info): Self::Dependency<
|
||||
'a,
|
||||
>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -27,6 +34,9 @@ impl Animation for RapidMeleeAnimation {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main_weapon_trail = true;
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.off_weapon_trail = true;
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.reaching_flurry") => {
|
||||
|
@ -2,11 +2,11 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
|
||||
pub struct RiposteMeleeAnimation;
|
||||
impl Animation for RiposteMeleeAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>);
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>, Option<AbilityInfo>);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -15,7 +15,7 @@ impl Animation for RiposteMeleeAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_riposte_melee")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section): Self::Dependency<'a>,
|
||||
(ability_id, stage_section, _ability_info): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -26,6 +26,9 @@ impl Animation for RiposteMeleeAnimation {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main_weapon_trail = true;
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.off_weapon_trail = true;
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.parrying_riposte") => {
|
||||
|
@ -2,11 +2,11 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
|
||||
pub struct SelfBuffAnimation;
|
||||
impl Animation for SelfBuffAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>);
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>, Option<AbilityInfo>);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -15,7 +15,7 @@ impl Animation for SelfBuffAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_self_buff")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section): Self::Dependency<'a>,
|
||||
(ability_id, stage_section, _ability_info): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -25,6 +25,8 @@ impl Animation for SelfBuffAnimation {
|
||||
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.defensive_bulwark") => {
|
||||
|
@ -1189,7 +1189,11 @@ impl FigureMgr {
|
||||
};
|
||||
anim::character::FinisherMeleeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, Some(s.stage_section)),
|
||||
(
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1218,7 +1222,12 @@ impl FigureMgr {
|
||||
/ vel.0.magnitude_squared();
|
||||
anim::character::DiveMeleeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, Some(s.stage_section), ground_dist),
|
||||
(
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
ground_dist,
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1240,7 +1249,11 @@ impl FigureMgr {
|
||||
};
|
||||
anim::character::SelfBuffAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, Some(s.stage_section)),
|
||||
(
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1593,6 +1606,7 @@ impl FigureMgr {
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
(s.current_strike, s.static_data.max_strikes),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
@ -1761,7 +1775,6 @@ impl FigureMgr {
|
||||
anim::character::ComboAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
hands,
|
||||
ability_id,
|
||||
Some(stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
@ -1846,6 +1859,7 @@ impl FigureMgr {
|
||||
rel_vel,
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
@ -2064,7 +2078,11 @@ impl FigureMgr {
|
||||
|
||||
anim::character::RiposteMeleeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, Some(s.stage_section)),
|
||||
(
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
|
Loading…
Reference in New Issue
Block a user