From 4ef1be08ecdea8ff106ab1cae78a6b4f0d055fcf Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 5 Jun 2024 22:31:17 -0400 Subject: [PATCH] Character animation restructuring --- voxygen/anim/src/character/alpha.rs | 458 ---- voxygen/anim/src/character/basic.rs | 2066 +++++++++++++++++ voxygen/anim/src/character/beam.rs | 119 - voxygen/anim/src/character/beta.rs | 148 -- voxygen/anim/src/character/block.rs | 351 --- voxygen/anim/src/character/chargeswing.rs | 291 --- voxygen/anim/src/character/dash.rs | 86 - voxygen/anim/src/character/divemelee.rs | 140 -- voxygen/anim/src/character/finishermelee.rs | 590 ----- voxygen/anim/src/character/leapmelee.rs | 27 - voxygen/anim/src/character/mod.rs | 64 +- .../src/character/{combomelee.rs => multi.rs} | 904 +++++--- voxygen/anim/src/character/rapidmelee.rs | 438 ---- voxygen/anim/src/character/repeater.rs | 116 - voxygen/anim/src/character/ripostemelee.rs | 110 - voxygen/anim/src/character/selfbuff.rs | 424 ---- voxygen/anim/src/character/shockwave.rs | 194 -- voxygen/anim/src/character/shoot.rs | 164 -- voxygen/src/scene/figure/mod.rs | 321 ++- 19 files changed, 2839 insertions(+), 4172 deletions(-) delete mode 100644 voxygen/anim/src/character/alpha.rs create mode 100644 voxygen/anim/src/character/basic.rs delete mode 100644 voxygen/anim/src/character/beam.rs delete mode 100644 voxygen/anim/src/character/beta.rs delete mode 100644 voxygen/anim/src/character/block.rs delete mode 100644 voxygen/anim/src/character/chargeswing.rs delete mode 100644 voxygen/anim/src/character/dash.rs delete mode 100644 voxygen/anim/src/character/divemelee.rs delete mode 100644 voxygen/anim/src/character/finishermelee.rs delete mode 100644 voxygen/anim/src/character/leapmelee.rs rename voxygen/anim/src/character/{combomelee.rs => multi.rs} (63%) delete mode 100644 voxygen/anim/src/character/rapidmelee.rs delete mode 100644 voxygen/anim/src/character/repeater.rs delete mode 100644 voxygen/anim/src/character/ripostemelee.rs delete mode 100644 voxygen/anim/src/character/selfbuff.rs delete mode 100644 voxygen/anim/src/character/shockwave.rs delete mode 100644 voxygen/anim/src/character/shoot.rs diff --git a/voxygen/anim/src/character/alpha.rs b/voxygen/anim/src/character/alpha.rs deleted file mode 100644 index 12ebd2e061..0000000000 --- a/voxygen/anim/src/character/alpha.rs +++ /dev/null @@ -1,458 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - dual_wield_start, hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, -}; -use common::{ - comp::item::{Hands, ToolKind}, - states::utils::{AbilityInfo, StageSection}, -}; -use core::f32::consts::PI; - -pub struct AlphaAnimation; - -type AlphaAnimationDependency<'a> = ( - Option<&'a str>, - (Option, Option), - Option, - Option, -); -impl Animation for AlphaAnimation { - type Dependency<'a> = AlphaAnimationDependency<'a>; - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_alpha\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_alpha")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, hands, stage_section, ability_info): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - if matches!(stage_section, Some(StageSection::Action)) { - next.main_weapon_trail = true; - next.off_weapon_trail = true; - } - - match ability_id { - Some("common.abilities.hammer.solid_smash") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.control.orientation.rotate_x(move1 * 2.7); - next.control.orientation.rotate_z(move1 * 1.4); - next.control.position += Vec3::new(-12.0, 0.0, 0.0) * move1; - next.control.orientation.rotate_x(move1 * -1.2); - twist_back(&mut next, move1, 0.8, 0.3, 0.1, 0.5); - - twist_forward(&mut next, move2, 1.4, 0.5, 0.3, 1.0); - next.control.orientation.rotate_x(move2 * -1.9); - next.control.orientation.rotate_z(move2 * 0.6); - }, - Some("common.abilities.hammer.scornful_swipe") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - let move1_pre = move1.min(0.5) * 2.0; - let move1_shake = ((move1.max(0.3) - 0.3) * 15.0).sin(); - let move1_late = move1.powi(4); - - next.control.orientation.rotate_x(move1_pre * 2.3); - next.control.position += Vec3::new(0.0, 2.0, 16.0) * move1_pre; - next.control.position += Vec3::new(0.0, 0.0, 4.0) * move1_shake; - next.control.orientation.rotate_y(move1_late * 1.6); - next.control.position += Vec3::new(-8.0, 0.0, -8.0) * move1_late; - twist_back(&mut next, move1_late, 1.0, 0.4, 0.2, 0.7); - next.control.orientation.rotate_z(move1_late * 1.2); - - twist_forward(&mut next, move2, 1.9, 0.9, 0.6, 1.1); - next.control.orientation.rotate_y(move2 * -1.7); - next.control.orientation.rotate_z(move2 * -2.7); - }, - Some("common.abilities.hammer.heavy_whorl") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2base = move2; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 2.0, 0.8, 0.4, 1.4); - next.control.orientation.rotate_x(move1 * 0.6); - - next.torso.orientation.rotate_z(move2base * -2.0 * PI); - twist_forward(&mut next, move2, 3.4, 1.2, 0.8, 1.8); - next.control.orientation.rotate_z(move2 * -2.3); - next.control.position += Vec3::new(6.0, 0.0, 6.0) * move2; - }, - Some("common.abilities.hammer.dual_heavy_whorl") => { - dual_wield_start(&mut next); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2base = move2; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 2.0, 0.8, 0.4, 1.4); - next.control_l.orientation.rotate_y(move1 * -PI / 2.0); - next.control_r.orientation.rotate_y(move1 * -PI / 2.0); - next.control.position += Vec3::new(0.0, 0.0, 4.0) * move1; - - next.torso.orientation.rotate_z(move2base * -2.0 * PI); - twist_forward(&mut next, move2, 3.4, 1.2, 0.8, 1.8); - next.control_l.orientation.rotate_z(move2 * -2.3); - next.control_r.orientation.rotate_z(move2 * -2.3); - }, - Some("common.abilities.hammer.breach") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.control.orientation.rotate_x(move1 * 2.5); - next.control.orientation.rotate_z(move1 * -4.8); - next.control.position += Vec3::new(-12.0, 0.0, 22.0) * move1; - twist_back(&mut next, move1, 0.6, 0.2, 0.0, 0.3); - - twist_forward(&mut next, move2, 1.6, 0.4, 0.2, 0.7); - next.control.orientation.rotate_x(move2 * -4.5); - next.control.position += Vec3::new(0.0, 0.0, -20.0) * move2; - }, - Some("common.abilities.hammer.pile_driver") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let shake = (move1 * 15.0).sin(); - let move1 = (move1 * 2.0).min(1.0) * pullback; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 0.9, 0.3, 0.1, 0.5); - next.control.orientation.rotate_x(move1 * 2.4); - next.control.position += Vec3::new(-14.0, 0.0, 14.0) * move1; - next.control.orientation.rotate_z(move1 * 1.8); - - next.control.orientation.rotate_x(shake * 0.15); - - twist_forward(&mut next, move2, 1.6, 0.5, 0.2, 0.9); - next.control.orientation.rotate_x(move2 * -4.0); - next.control.orientation.rotate_z(move2 * 0.4); - next.control.position += Vec3::new(0.0, 0.0, -12.0) * move2; - }, - Some("common.abilities.hammer.upheaval") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1base = move1; - let move1 = move1 * pullback; - let move2base = move2; - let move2 = move2 * pullback; - let move1_twist = move1 * (move1 * PI * 1.5).sin(); - - twist_forward(&mut next, move1_twist, 0.8, 0.3, 0.0, 0.4); - let angle1 = 5.0; - let angle2 = 4.0; - next.control - .orientation - .rotate_x(move1base * (2.0 - angle1) + move2base * (2.0 - angle2)); - next.control.orientation.rotate_y(move1 * -0.8); - next.control - .orientation - .rotate_x(move1base * angle1 + move2base * angle2); - next.control.orientation.rotate_z(move1 * 1.0); - next.control.orientation.rotate_x(move2 * 6.0); - next.control.orientation.rotate_z(move2 * -0.6); - next.control.position += Vec3::new(-16.0, 0.0, 0.0) * move1; - next.control.position += Vec3::new(12.0, 0.0, 10.0) * move2; - twist_forward(&mut next, move2, 1.0, 0.9, 0.4, 1.1); - }, - Some("common.abilities.hammer.dual_upheaval") => { - dual_wield_start(&mut next); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1base = move1; - let move1_return = (3.0 * move1).sin(); - let move1 = move1 * pullback; - let move2base = move2; - let move2 = move2 * pullback; - - next.control.orientation.rotate_x(4.0 * move1base); - next.control_l.orientation.rotate_z(move1 * 0.6); - next.control_r.orientation.rotate_z(move1 * -0.6); - next.control.position += Vec3::new(0.0, 6.0, 8.0) * move1_return; - next.control.orientation.rotate_x(3.5 * move2base); - next.control_l.orientation.rotate_z(move2 * -1.4); - next.control_r.orientation.rotate_z(move2 * 1.4); - next.control.position += Vec3::new(0.0, 12.0, 10.0) * move2; - }, - _ => { - let (move1, move2, _move3, move2h) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0), - Some(StageSection::Action) => { - (1.0, anim_time.powi(2), 0.0, anim_time.powf(0.25)) - }, - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 1.0), - _ => (0.0, 0.0, 0.0, 0.0), - }; - - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - next.second.position = Vec3::new(0.0, 0.0, 0.0); - next.second.orientation = Quaternion::rotation_z(0.0); - next.torso.position = Vec3::new(0.0, 0.0, 1.1); - next.torso.orientation = Quaternion::rotation_z(0.0); - - match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Dagger) => { - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.chest.orientation = Quaternion::rotation_z(move1 * 1.1 + move2 * -2.0); - - next.head.position = Vec3::new(0.0 + move2 * 2.0, s_a.head.0, s_a.head.1); - next.head.orientation = Quaternion::rotation_z(move1 * -0.9 + move2 * 1.8); - }, - - Some(ToolKind::Pick | ToolKind::Shovel) => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let moveret1 = move1 * pullback; - let moveret2 = move2 * pullback; - - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - next.head.orientation = - Quaternion::rotation_x(moveret1 * 0.1 + moveret2 * 0.3) - * Quaternion::rotation_z(move1 * -0.2 + moveret2 * 0.2); - next.chest.position = - Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + moveret2 * -2.0); - next.chest.orientation = - Quaternion::rotation_x(moveret1 * 0.4 + moveret2 * -0.7) - * Quaternion::rotation_y(moveret1 * 0.3 + moveret2 * -0.4) - * Quaternion::rotation_z(moveret1 * 0.5 + moveret2 * -0.5); - }, - Some(ToolKind::Debug) => { - next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0); - next.hand_l.orientation = Quaternion::rotation_x(1.27); - next.main.position = Vec3::new(-5.0, 5.0, 23.0); - next.main.orientation = Quaternion::rotation_x(PI); - }, - _ => {}, - } - - match hands { - (Some(Hands::Two), _) | (None, Some(Hands::Two)) => { - match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Pick) => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let moveret1 = move1 * pullback; - let moveret2 = move2 * pullback; - next.hand_l.position = - Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + moveret2 * -7.0); - next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3) - * Quaternion::rotation_y(s_a.hhl.4) - * Quaternion::rotation_z(s_a.hhl.5); - next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3) - * Quaternion::rotation_y(s_a.hhr.4) - * Quaternion::rotation_z(s_a.hhr.5); - - next.control.position = Vec3::new( - s_a.hc.0 + moveret1 * -13.0 + moveret2 * 3.0, - s_a.hc.1 + (moveret2 * 5.0), - s_a.hc.2 + moveret1 * 8.0 + moveret2 * -6.0, - ); - next.control.orientation = - Quaternion::rotation_x( - s_a.hc.3 + (moveret1 * 1.5 + moveret2 * -2.55), - ) * Quaternion::rotation_y( - s_a.hc.4 + moveret1 * PI / 2.0 + moveret2 * 0.5, - ) * Quaternion::rotation_z(s_a.hc.5 + (moveret2 * -0.5)); - }, - Some(ToolKind::Shovel) => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let moveret1 = move1 * pullback; - let moveret2 = move2 * pullback; - - next.hand_l.position = Vec3::new(8.0, 6.0, 3.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); - next.hand_r.position = Vec3::new(8.0, 6.0, 15.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); - next.main.position = Vec3::new(7.5, 7.5, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); - - next.control.position = Vec3::new(-11.0 + moveret1 * 8.0, 1.8, 4.0); - next.control.orientation = - Quaternion::rotation_x(moveret1 * 0.3 + moveret2 * 0.2) - * Quaternion::rotation_y( - 0.8 - moveret1 * 0.7 + moveret2 * 0.7, - ) - * Quaternion::rotation_z(moveret2 * 0.1 - moveret1 * 0.4); - }, - _ => {}, - } - }, - (_, _) => {}, - }; - - match hands { - (Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Dagger) => { - next.control_l.position = Vec3::new(-7.0, 8.0, 2.0); - next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0) - * Quaternion::rotation_y(move1 * -1.2 + move2 * -1.5) - * Quaternion::rotation_z(move2 * 1.5); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) - }, - Some(ToolKind::Pick | ToolKind::Shovel) => { - next.control_l.position = Vec3::new( - -7.0, - 8.0 + move1 * -4.0 + move2 * 4.0, - 2.0 + move1 * 16.0 + move2 * -19.0, - ); - next.control_l.orientation = - Quaternion::rotation_x(-0.3 + move1 * 1.9 + move2 * -3.0) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) - }, - - _ => {}, - }, - (_, _) => {}, - }; - match hands { - (None | Some(Hands::One), Some(Hands::One)) => { - match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Dagger) => { - next.control_r.position = Vec3::new(7.0 + move2 * 8.0, 8.0, 2.0); - next.control_r.orientation = - Quaternion::rotation_x(-0.3 + move2 * 2.0) - * Quaternion::rotation_y(move1 * -1.8 + move2 * -1.5) - * Quaternion::rotation_z(move2 * 1.5); - next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) - }, - Some(ToolKind::Pick | ToolKind::Shovel) => { - next.control_r.position = Vec3::new( - 7.0, - 8.0 + move1 * -4.0 + move2h * 4.0, - 2.0 + move1 * 12.0 + move2h * -16.0, - ); - next.control_r.orientation = - Quaternion::rotation_x(-0.3 + move1 * 2.3 + move2h * -3.5) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) - }, - _ => {}, - } - }, - (_, _) => {}, - }; - - match hands { - (None, None) | (None, Some(Hands::One)) => { - next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0); - next.hand_l.orientation = - Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5) - }, - (_, _) => {}, - }; - match hands { - (None, None) | (Some(Hands::One), None) => { - next.hand_r.position = Vec3::new(4.5, 8.0, 5.0); - next.hand_r.orientation = - Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5) - }, - (_, _) => {}, - }; - - if let (None, Some(Hands::Two)) = hands { - next.second = next.main; - } - - if skeleton.holding_lantern { - next.hand_r.position = - Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 12.0); - next.hand_r.orientation = - Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9); - - next.lantern.position = Vec3::new(-0.5, -0.5, -1.5); - next.lantern.orientation = next.hand_r.orientation.inverse(); - } - }, - } - - next - } -} diff --git a/voxygen/anim/src/character/basic.rs b/voxygen/anim/src/character/basic.rs new file mode 100644 index 0000000000..7159cab3e0 --- /dev/null +++ b/voxygen/anim/src/character/basic.rs @@ -0,0 +1,2066 @@ +use super::{ + super::{vek::*, Animation}, + dual_wield_start, hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, +}; +use common::{ + comp::item::Hands, + states::utils::{AbilityInfo, HandInfo, StageSection}, + util::Dir, +}; +use core::f32::consts::{PI, TAU}; + +pub struct BasicAction; + +pub struct BasicActionDependency<'a> { + pub ability_id: Option<&'a str>, + pub hands: (Option, Option), + pub stage_section: Option, + pub ability_info: Option, + pub velocity: Vec3, + // Optional so we can skip calculating this when it doesn't matter + pub ground_dist: Option, + pub last_ori: Vec3, + pub orientation: Vec3, + pub look_dir: Dir, +} + +impl Animation for BasicAction { + type Dependency<'a> = BasicActionDependency<'a>; + type Skeleton = CharacterSkeleton; + + #[cfg(feature = "use-dyn-lib")] + const UPDATE_FN: &'static [u8] = b"character_basic\0"; + + #[cfg_attr(feature = "be-dyn-lib", export_name = "character_basic")] + fn update_skeleton_inner( + skeleton: &Self::Skeleton, + d: Self::Dependency<'_>, + anim_time: f32, + rate: &mut f32, + s_a: &SkeletonAttr, + ) -> Self::Skeleton { + *rate = 1.0; + let mut next = (*skeleton).clone(); + + if matches!(d.stage_section, Some(StageSection::Action)) { + next.main_weapon_trail = true; + next.off_weapon_trail = true; + } + let (move1base, chargebase, movementbase, move2base, move3base) = match d.stage_section { + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0, 0.0), + Some(StageSection::Charge) => (1.0, anim_time, 0.0, 0.0, 0.0), + Some(StageSection::Movement) => (1.0, 1.0, anim_time, 0.0, 0.0), + Some(StageSection::Action) => (1.0, 1.0, 1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, 1.0, anim_time), + _ => (0.0, 0.0, 0.0, 0.0, 0.0), + }; + let pullback = 1.0 - move3base; + let move1 = move1base * pullback; + let move2 = move2base * pullback; + + match d.ability_id { + // ================================== + // SWORD + // ================================== + Some( + "common.abilities.sword.basic_guard" | "common.abilities.sword.defensive_guard", + ) => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = (move2base * 10.0).sin(); + + if d.velocity.xy().magnitude_squared() < 0.5_f32.powi(2) { + next.chest.position = + Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2); + next.chest.orientation = Quaternion::rotation_x(move1 * -0.15); + next.head.orientation = Quaternion::rotation_x(move1 * 0.25); + + next.belt.position = + Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5); + next.shorts.position = + Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0); + + next.belt.orientation = Quaternion::rotation_x(move1 * 0.15); + next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25); + + next.foot_l.position = + Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5); + + next.foot_r.position = + Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5); + } + + match d.hands { + (Some(Hands::Two), _) => { + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = Vec3::new( + s_a.shr.0 + move1 * -2.0, + s_a.shr.1, + s_a.shr.2 + move1 * 20.0, + ); + next.hand_r.orientation = Quaternion::rotation_x(s_a.shr.3) + * Quaternion::rotation_y(s_a.shr.4) + * Quaternion::rotation_z(move1 * 1.5); + + next.control.position = + Vec3::new(s_a.sc.0 + move1 * -3.0, s_a.sc.1, s_a.sc.2 + move1 * 4.0); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3) + * Quaternion::rotation_y(move1 * 1.1) + * Quaternion::rotation_z(move1 * 1.7); + }, + (Some(Hands::One), offhand) => { + next.control_l.position = + Vec3::new(-7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0); + next.control_l.orientation = + Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * 1.0); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); + if offhand.is_some() { + next.control_r.position = + Vec3::new(7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0); + next.control_r.orientation = + Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * -1.0); + next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) + } else { + next.hand_r.position = Vec3::new(4.5, 8.0, 5.0); + next.hand_r.orientation = + Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5) + } + }, + (_, _) => {}, + } + }, + Some("common.abilities.sword.defensive_deflect") => { + let move1 = move1base.powi(2); + let move2 = (move2base * 20.0).sin(); + let move3 = move3base.powf(0.5); + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1 * -0.9); + + next.chest.orientation = Quaternion::rotation_z(move1 * -0.6); + next.head.orientation = Quaternion::rotation_z(move1 * 0.2); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.1); + next.shorts.orientation = Quaternion::rotation_z(move1 * 0.1); + next.control.orientation.rotate_y(move1 * -1.7); + next.control.orientation.rotate_z(move1 * 0.6); + next.control.position += Vec3::new(move1 * 11.0, move1 * 2.0, move1 * 5.0); + + next.control.orientation.rotate_y(move2 / 50.0); + + next.chest.orientation.rotate_z(move3 * -0.6); + next.head.orientation.rotate_z(move3 * 0.4); + next.belt.orientation.rotate_z(move3 * 0.2); + next.shorts.orientation.rotate_z(move3 * 0.6); + next.control.position += Vec3::new(move3 * 6.0, 0.0, move3 * 9.0); + next.control.orientation.rotate_z(move3 * -0.5); + next.control.orientation.rotate_y(move3 * 0.6); + }, + Some( + "common.abilities.sword.basic_thrust" + | "common.abilities.sword.defensive_vital_jab", + ) => { + let pullback = 1.0 - move3base.powi(4); + let move1 = chargebase.powf(0.25).min(1.0) * pullback; + let move2 = move2base.powi(2) * pullback; + let tension = (chargebase * 20.0).sin(); + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(PI * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + move2 * 5.0); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -0.9) + * Quaternion::rotation_y(move1 * 1.0 + move2 * -1.0) + * Quaternion::rotation_z(move1 * 1.3 + move2 * -1.3); + + next.chest.orientation = + Quaternion::rotation_z(move1 * 1.0 + tension * 0.02 + move2 * -1.2); + next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4); + }, + Some("common.abilities.sword.heavy_slam") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = chargebase.powf(0.25).min(1.0) * pullback; + let move2 = move2base.powi(2) * pullback; + let tension = (chargebase * 20.0).sin(); + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3) + * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.7); + + next.control + .orientation + .rotate_x(move1 * 1.4 + tension / 50.0); + next.control.position += + Vec3::new(move1 * -1.0, move1 * 2.0, move1 * 8.0) + Vec3::one() * tension / 4.0; + next.chest.orientation = Quaternion::rotation_z(move1 * 0.4 + tension / 50.0); + + if move2 < f32::EPSILON { + next.main_weapon_trail = false; + next.off_weapon_trail = false; + } + next.control.orientation.rotate_x(move2 * -3.0); + next.control.orientation.rotate_z(move2 * -0.4); + next.control.position += Vec3::new(move2 * 10.0, 0.0, move2 * -10.0); + next.chest.orientation.rotate_z(move2 * -0.6); + }, + Some("common.abilities.sword.crippling_deep_rend") => { + let move1pre = move1base.min(0.5) * 2.0 * pullback; + let move1post = (move1base.max(0.5) * 2.0 - 1.0) * pullback; + let move2 = chargebase.min(1.0) * pullback; + let move3 = move2 * pullback; + let tension = (chargebase * 20.0).sin(); + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1pre * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1pre * PI / 2.0); + + next.foot_r.position += Vec3::new(0.0, move1pre * -3.0, 0.0); + next.foot_r.orientation.rotate_z(move1pre * -1.2); + next.chest.orientation = Quaternion::rotation_z(move1pre * -1.3); + next.head.orientation = Quaternion::rotation_z(move1pre * 0.7); + next.belt.orientation = Quaternion::rotation_z(move1pre * 0.4); + next.shorts.orientation = Quaternion::rotation_z(move1pre * 0.8); + next.control.orientation.rotate_y(move1pre * -1.5); + next.control.orientation.rotate_z(move1pre * 0.0); + next.control.position += Vec3::new(move1pre * 12.0, 0.0, 0.0); + + next.chest.orientation.rotate_z(move1post * 1.2); + next.head.orientation.rotate_z(move1post * -0.7); + next.belt.orientation.rotate_z(move1post * -0.3); + next.shorts.orientation.rotate_z(move1post * -0.8); + next.foot_r.orientation.rotate_z(move1post * 1.2); + next.foot_r.orientation.rotate_x(move1post * -0.6); + next.control.orientation.rotate_z(move1post * -1.2); + next.control.position += Vec3::new(0.0, move1post * 4.0, move1post * 3.0); + + next.control + .orientation + .rotate_y(move2 * -2.0 + tension / 10.0); + next.chest.orientation.rotate_z(move2 * -0.4 + move3 * -1.4); + next.control + .orientation + .rotate_z(move2 * 0.3 + move3 * -1.2); + next.head.orientation.rotate_z(move2 * 0.2 + move3 * 0.7); + next.belt.orientation.rotate_z(move3 * 0.3); + next.shorts.orientation.rotate_z(move2 * 0.2 + move3 * 0.7); + next.chest + .orientation + .rotate_y(move2 * -0.3 - tension / 100.0); + next.foot_r.orientation.rotate_z(move3 * -1.5); + }, + Some( + "common.abilities.sword.cleaving_spiral_slash" + | "common.abilities.sword.cleaving_dual_spiral_slash", + ) => { + let move1 = chargebase.powf(0.25).min(1.0) * pullback; + let move2_pre = move2base.min(0.3) * 10.0 / 3.0 * pullback; + let tension = (chargebase * 15.0).sin(); + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.chest.orientation = Quaternion::rotation_z(move1 * 1.2 + tension / 50.0); + next.head.orientation = Quaternion::rotation_z(move1 * -0.7); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.3); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.8); + next.control.orientation.rotate_x(move1 * 0.2); + next.foot_r + .orientation + .rotate_x(move1 * -0.4 + move2_pre * 0.4); + next.foot_r.orientation.rotate_z(move1 * 1.4); + + next.control.orientation.rotate_y(move2_pre * -1.6); + next.control.position += Vec3::new(0.0, 0.0, move2_pre * 4.0); + next.torso.orientation.rotate_z(move2base * -TAU); + next.chest.orientation.rotate_z(move2 * -2.0); + next.head.orientation.rotate_z(move2 * 1.3); + next.belt.orientation.rotate_z(move2 * 0.6); + next.shorts.orientation.rotate_z(move2 * 1.5); + next.foot_r.orientation.rotate_z(move2_pre * -1.7); + next.control.orientation.rotate_z(move2 * -1.8); + next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0); + }, + Some("common.abilities.sword.cleaving_earth_splitter") => { + let ground_dist = d.ground_dist.map_or(0.0, |gd| gd.clamp(0.0, 0.5) * 2.0); + let ground_dist = if ground_dist.is_nan() { + 0.0 + } else { + ground_dist + }; + + let pullback = 1.0 - move3base.powi(4); + let move1 = movementbase.min(1.0).powi(2) * pullback; + let move1alt = (movementbase.min(1.5) / 1.5).powf(0.5); + let move2 = (1.0 - ground_dist).powi(2) * pullback; + let move3 = move2base.powf(0.25) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + next.torso.orientation.rotate_x(move1alt * -TAU); + + next.torso.orientation.rotate_x(move1 * -0.8); + next.control.orientation.rotate_x(move1 * 1.5); + next.control.position += Vec3::new(move1 * 7.0, move1.powi(4) * -6.0, move1 * 20.0); + + next.torso.orientation.rotate_x(move2 * 0.8); + next.chest.orientation = Quaternion::rotation_x(move2 * -0.4); + next.control.orientation.rotate_x(move2 * -1.2); + next.control.position += Vec3::new(0.0, move2 * 12.0, move2 * -8.0); + + next.control.orientation.rotate_x(move3 * -1.2); + next.control.position += Vec3::new(0.0, move3 * 4.0, move3 * -8.0); + }, + Some("common.abilities.sword.heavy_pillar_thrust") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.5) * pullback; + let move1alt1 = move1base.powf(0.5).min(0.5) * 2.0 * pullback; + let move1alt2 = (move1base.powf(0.5).max(0.5) - 0.5) * 2.0 * pullback; + let move2 = move2base.powi(2) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3 + move1alt2 * PI) + * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = Vec3::new( + -s_a.sc.0 + 6.0 + move1alt1 * -12.0, + -4.0 + move1alt1 * 3.0, + -2.0, + ); + next.hand_r.orientation = + Quaternion::rotation_x(0.9 + move1 * 0.5 + move1alt1 * PI); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.control.position += Vec3::new( + move1 * 6.0, + (1.0 - (move1 - 0.5).abs() * 2.0) * 3.0, + move1 * 22.0, + ); + next.control.orientation.rotate_x(move1 * -1.5); + + next.chest.orientation = Quaternion::rotation_x(move2 * -0.4); + next.head.orientation = Quaternion::rotation_x(move2 * 0.2); + next.belt.orientation = Quaternion::rotation_x(move2 * 0.4); + next.shorts.orientation = Quaternion::rotation_x(move2 * 0.8); + next.control.orientation.rotate_x(move2 * -0.4); + next.control.position += Vec3::new(0.0, 0.0, move2 * -10.0); + next.belt.position += Vec3::new(0.0, move2 * 2.0, move2 * 0.0); + next.shorts.position += Vec3::new(0.0, move2 * 4.0, move2 * 1.0); + next.chest.position += Vec3::new(0.0, move2 * -2.5, 0.0); + }, + Some("common.abilities.sword.basic_mighty_strike") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = move2base.powf(0.1) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new( + s_a.sc.0 + move2 * 12.0, + s_a.sc.1, + s_a.sc.2 + move1 * 6.0 - move2 * 8.0, + ); + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3 + move1 * 1.6 + move2 * -2.6) + * Quaternion::rotation_y(move1 * -0.4 + move2 * 0.6) + * Quaternion::rotation_z(move1 * -0.2 + move2 * -0.2); + + next.chest.orientation = Quaternion::rotation_z(move1 * 1.0 + move2 * -1.2); + next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4); + }, + Some("common.abilities.sword.heavy_guillotine") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = move2base.powi(2) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3) + * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.7); + + next.control.orientation.rotate_x(move1 * 1.4); + next.control.position += Vec3::new(move1 * -1.0, move1 * 2.0, move1 * 8.0); + next.chest.orientation = Quaternion::rotation_z(move1 * 0.4); + + next.control.orientation.rotate_x(move2 * -3.0); + next.control.orientation.rotate_z(move2 * -0.4); + next.control.position += Vec3::new(move2 * 10.0, 0.0, move2 * -10.0); + next.chest.orientation.rotate_z(move2 * -0.6); + }, + Some("common.abilities.sword.defensive_counter") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.5) * pullback; + let move2 = (move2base.min(2.0 / 3.0) * 1.5).powi(2) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move2 * -PI / 4.0); + + next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2); + next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); + next.foot_l.orientation = Quaternion::identity(); + next.foot_r.orientation = Quaternion::identity(); + + next.foot_r.position += + Vec3::new(0.0, move1 * 4.0, (1.0 - (move1 - 0.5) * 2.0) * 2.0); + next.torso.position += Vec3::new(0.0, move1 * -2.0, 0.0); + next.chest.position += Vec3::new(0.0, move1 * 2.0, move1 * -3.0); + next.shorts.orientation = Quaternion::rotation_x(move1 * 0.5); + next.shorts.position += Vec3::new(0.0, move1 * 1.5, 0.0); + next.control.orientation.rotate_y(move1 * -1.5); + next.control.orientation.rotate_z(move1 * 0.8); + + next.chest.orientation = Quaternion::rotation_z(move2 * -0.7); + next.head.orientation = Quaternion::rotation_z(move2 * 0.4); + next.shorts.orientation.rotate_z(move2 * 0.5); + next.belt.orientation = Quaternion::rotation_z(move2 * 0.1); + next.control.orientation.rotate_z(move2 * -1.4); + next.control.orientation.rotate_x(move2 * 0.5); + next.control.position += Vec3::new(move2 * 7.0, 0.0, move2 * 6.0); + }, + Some("common.abilities.sword.defensive_riposte") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2_slow = move2base.powi(8) * pullback; + let move2 = move2base.powi(2) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3) + * Quaternion::rotation_z(move1 * 1.3 + move2 * -0.7); + + next.chest.orientation = Quaternion::rotation_z(move1 * 0.8); + next.head.orientation = Quaternion::rotation_z(move1 * -0.4); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5); + next.control.orientation.rotate_x(move1 * 0.5); + next.control.orientation.rotate_y(move1 * 2.1); + next.control.orientation.rotate_z(move1 * -0.5); + next.control.position += Vec3::new(0.0, move1 * 5.0, move1 * 8.0); + + next.chest.orientation.rotate_z(move2 * -1.4); + next.head.orientation.rotate_z(move2 * 0.9); + next.belt.orientation.rotate_z(move2 * -0.3); + next.shorts.orientation.rotate_z(move2 * 0.6); + next.control.orientation.rotate_y(move2 * -4.0); + next.control + .orientation + .rotate_z(move2_slow * -3.0 + move2 * 1.0); + next.control.position += + Vec3::new(move2_slow * 11.0, move2_slow * -4.0, move2_slow * -6.0); + }, + Some("common.abilities.sword.heavy_fortitude") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = move2base.powi(2) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.foot_l.position += Vec3::new(move1 * 1.0, move1 * 2.0, 0.0); + next.chest.orientation = Quaternion::rotation_z(move1 * -0.4); + next.head.orientation = Quaternion::rotation_z(move1 * 0.2); + next.shorts.orientation = Quaternion::rotation_z(move1 * 0.3); + next.belt.orientation = Quaternion::rotation_z(move1 * 0.1); + next.control.orientation.rotate_x(move1 * 0.4 + move2 * 0.6); + next.control.orientation.rotate_z(move1 * 0.4); + + next.foot_r.position += Vec3::new(move2 * -1.0, move2 * -2.0, 0.0); + next.control.position += Vec3::new(move2 * 5.0, move2 * 7.0, move2 * 5.0); + next.chest.position += Vec3::new(0.0, 0.0, move2 * -1.0); + next.shorts.orientation.rotate_x(move2 * 0.2); + next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0); + }, + Some("common.abilities.sword.defensive_stalwart_sword") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = move2base.powi(2) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move2 * -0.5); + + next.foot_r.position += Vec3::new(move1 * 1.0, move1 * -2.0, 0.0); + next.foot_r.orientation.rotate_z(move1 * -0.9); + next.chest.orientation = Quaternion::rotation_z(move1 * -0.5); + next.head.orientation = Quaternion::rotation_z(move1 * 0.3); + next.shorts.orientation = Quaternion::rotation_z(move1 * 0.1); + next.control.orientation.rotate_x(move1 * 0.4); + next.control.orientation.rotate_z(move1 * 0.5); + next.control.position += Vec3::new(0.0, 0.0, move1 * 4.0); + + next.control.position += Vec3::new(move2 * 8.0, 0.0, move2 * -1.0); + next.control.orientation.rotate_x(move2 * -0.6); + next.chest.position += Vec3::new(0.0, 0.0, move2 * -2.0); + next.belt.position += Vec3::new(0.0, 0.0, move2 * 1.0); + next.shorts.position += Vec3::new(0.0, 0.0, move2 * 1.0); + next.shorts.orientation.rotate_x(move2 * 0.2); + next.control.orientation.rotate_z(move2 * 0.4); + }, + Some("common.abilities.sword.agile_dancing_edge") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = move2base.powi(2) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.head.orientation = Quaternion::rotation_x(move1 * 0.3); + next.head.position += Vec3::new(0.0, 0.0, move1 * -1.0); + next.control.position += Vec3::new(move1 * 8.0, move1 * 5.0, 0.0); + + next.head.orientation.rotate_x(move2 * 0.2); + next.head.position += Vec3::new(0.0, 0.0, move2 * -1.0); + next.control.position += Vec3::new(0.0, move2 * -2.0, move2 * 12.0); + next.control.orientation.rotate_x(move2 * 1.1); + }, + Some("common.abilities.sword.cleaving_blade_fever") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = move2base.powi(2) * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.foot_l.position += Vec3::new(move1 * 1.0, move1 * 2.0, 0.0); + next.chest.orientation = Quaternion::rotation_z(move1 * -0.4); + next.head.orientation = Quaternion::rotation_z(move1 * 0.2); + next.shorts.orientation = Quaternion::rotation_z(move1 * 0.3); + next.belt.orientation = Quaternion::rotation_z(move1 * 0.1); + next.control.orientation.rotate_x(move1 * 0.4 + move2 * 0.6); + next.control.orientation.rotate_z(move1 * 0.4); + + next.foot_r.position += Vec3::new(move2 * -1.0, move2 * -2.0, 0.0); + next.control.position += Vec3::new(move2 * 5.0, move2 * 7.0, move2 * 5.0); + next.chest.position += Vec3::new(0.0, 0.0, move2 * -1.0); + next.shorts.orientation.rotate_x(move2 * 0.2); + next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0); + }, + // ================================== + // AXE + // ================================== + Some("common.abilities.axe.basic_guard") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = (move2base * 10.0).sin(); + + if d.velocity.xy().magnitude_squared() < 0.5_f32.powi(2) { + next.chest.position = + Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2); + next.chest.orientation = Quaternion::rotation_x(move1 * -0.15); + next.head.orientation = Quaternion::rotation_x(move1 * 0.25); + + next.belt.position = + Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5); + next.shorts.position = + Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0); + + next.belt.orientation = Quaternion::rotation_x(move1 * 0.15); + next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25); + + next.foot_l.position = + Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5); + + next.foot_r.position = + Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5); + } + + match d.hands { + (Some(Hands::Two), _) => { + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new( + s_a.ac.0 + move1 * 13.0, + s_a.ac.1 + move1 * -3.0, + s_a.ac.2 + move1 * 8.0, + ); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3 + move1 * -2.0) + * Quaternion::rotation_y(s_a.ac.4 + move1 * -1.8) + * Quaternion::rotation_z(s_a.ac.5 + move1 * 4.0); + }, + (Some(Hands::One), offhand) => { + next.control_l.position = + Vec3::new(-7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0); + next.control_l.orientation = + Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * 1.0); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); + if offhand.is_some() { + next.control_r.position = + Vec3::new(7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0); + next.control_r.orientation = + Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * -1.0); + next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) + } else { + next.hand_r.position = Vec3::new(4.5, 8.0, 5.0); + next.hand_r.orientation = + Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5) + } + }, + (_, _) => {}, + } + }, + Some("common.abilities.axe.cleave") => { + let move1 = chargebase.min(1.0) * pullback; + let move2 = move2base.powi(2) * pullback; + let tension = (chargebase * 20.0).sin(); + + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new( + s_a.ac.0 + move1 * 7.0, + s_a.ac.1 + move1 * -4.0, + s_a.ac.2 + move1 * 18.0 + tension / 5.0, + ); + next.control.orientation = + Quaternion::rotation_x(s_a.ac.3 + move1 * -1.0 + tension / 30.0) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); + + next.control.orientation.rotate_x(move2 * -3.0); + next.control.position += Vec3::new(0.0, move2 * 8.0, move2 * -30.0); + }, + Some("common.abilities.axe.execute") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); + + next.control.orientation.rotate_x(move1 * 0.9); + next.chest.orientation.rotate_z(move1 * 1.2); + next.head.orientation.rotate_z(move1 * -0.5); + next.belt.orientation.rotate_z(move1 * -0.3); + next.shorts.orientation.rotate_z(move1 * -0.7); + next.control.position += Vec3::new(move1 * 4.0, move1 * -12.0, move1 * 11.0); + + next.chest.orientation.rotate_z(move2 * -2.0); + next.head.orientation.rotate_z(move2 * 0.9); + next.belt.orientation.rotate_z(move2 * 0.4); + next.shorts.orientation.rotate_z(move2 * 1.1); + next.control.orientation.rotate_x(move2 * -5.0); + next.control.position += Vec3::new(move2 * -3.0, move2 * 12.0, move2 * -17.0); + next.control.orientation.rotate_z(move2 * 0.7); + }, + Some("common.abilities.axe.maelstrom") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); + + next.control.orientation.rotate_x(move1 * 0.9); + next.chest.orientation.rotate_z(move1 * 1.2); + next.head.orientation.rotate_z(move1 * -0.5); + next.belt.orientation.rotate_z(move1 * -0.3); + next.shorts.orientation.rotate_z(move1 * -0.7); + next.control.position += Vec3::new(move1 * 4.0, move1 * -12.0, move1 * 11.0); + + next.chest.orientation.rotate_z(move2 * -2.0); + next.head.orientation.rotate_z(move2 * 0.9); + next.belt.orientation.rotate_z(move2 * 0.4); + next.shorts.orientation.rotate_z(move2 * 1.1); + next.control.orientation.rotate_x(move2 * -5.0); + next.control.position += Vec3::new(move2 * 5.0, move2 * 12.0, move2 * -17.0); + next.control.orientation.rotate_y(move2 * -2.0); + next.control.orientation.rotate_z(move2 * -1.0); + next.torso.orientation.rotate_z(move2base * -4.0 * PI); + }, + Some("common.abilities.axe.lacerate") => { + let move2_reset = ((move2base - 0.5).abs() - 0.5).abs() * 2.0; + + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2 + 10.0); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 - move1 * PI * 0.75); + + next.chest.orientation.rotate_z(move1 * 1.2); + next.head.orientation.rotate_z(move1 * -0.7); + next.shorts.orientation.rotate_z(move1 * -0.9); + next.belt.orientation.rotate_z(move1 * -0.3); + + next.chest.orientation.rotate_z(move2 * -2.9); + next.head.orientation.rotate_z(move2 * 1.2); + next.shorts.orientation.rotate_z(move2 * 2.0); + next.belt.orientation.rotate_z(move2 * 0.7); + next.control.orientation.rotate_x(move2_reset * -1.0); + next.control.orientation.rotate_z(move2 * -5.0); + next.control.position += Vec3::new(move2 * 17.0, move2 * 3.0, 0.0); + }, + Some("common.abilities.axe.riptide") => { + let move2_reset = ((move2base - 0.5).abs() - 0.5).abs() * 2.0; + + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 - move1 * PI * 0.75); + + next.chest.orientation.rotate_z(move1 * 1.2); + next.head.orientation.rotate_z(move1 * -0.7); + next.shorts.orientation.rotate_z(move1 * -0.9); + next.belt.orientation.rotate_z(move1 * -0.3); + + next.chest.orientation.rotate_z(move2 * -2.9); + next.head.orientation.rotate_z(move2 * 1.2); + next.shorts.orientation.rotate_z(move2 * 2.0); + next.belt.orientation.rotate_z(move2 * 0.7); + next.control.orientation.rotate_x(move2_reset * -1.0); + next.control.orientation.rotate_z(move2 * -5.0); + next.control.position += Vec3::new(move2 * 17.0, move2 * 3.0, 0.0); + next.torso.orientation.rotate_z(move2base * -TAU) + }, + Some("common.abilities.axe.keelhaul") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5); + + next.control.orientation.rotate_z(move1 * -3.3); + next.control.orientation.rotate_x(move1 * 0.8); + next.control.position += + Vec3::new(move1 * 4.0, move1 * 4.0 - move2 * 6.0, move1 * 10.0); + + next.chest.orientation.rotate_z(move2 * 1.2); + next.head.orientation.rotate_z(move2 * -0.5); + next.belt.orientation.rotate_z(move2 * -0.3); + next.shorts.orientation.rotate_z(move2 * -0.9); + next.control.orientation.rotate_z(move2 * -1.2); + }, + Some("common.abilities.axe.bulkhead") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI * 0.75 + move2 * PI * 0.25); + + next.chest.orientation.rotate_z(move1 * 1.8); + next.head.orientation.rotate_z(move1 * -0.6); + next.belt.orientation.rotate_z(move1 * -0.4); + next.shorts.orientation.rotate_z(move1 * -1.3); + next.control.orientation.rotate_x(move1 * -0.8); + + next.chest.orientation.rotate_z(move2 * -3.8); + next.head.orientation.rotate_z(move2 * 1.2); + next.belt.orientation.rotate_z(move2 * 0.8); + next.shorts.orientation.rotate_z(move2 * 2.1); + next.control.orientation.rotate_x(move2 * 0.6); + next.control.orientation.rotate_z(move2 * -4.0); + next.control.position += Vec3::new(move2 * 12.0, move2 * -6.0, 0.0); + }, + Some("common.abilities.axe.capsize") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI * 0.75 + move2 * PI * 0.25); + + next.chest.orientation.rotate_z(move1 * 1.8); + next.head.orientation.rotate_z(move1 * -0.6); + next.belt.orientation.rotate_z(move1 * -0.4); + next.shorts.orientation.rotate_z(move1 * -1.3); + next.control.orientation.rotate_x(move1 * -0.8); + + next.chest.orientation.rotate_z(move2 * -3.8); + next.head.orientation.rotate_z(move2 * 1.2); + next.belt.orientation.rotate_z(move2 * 0.8); + next.shorts.orientation.rotate_z(move2 * 2.1); + next.control.orientation.rotate_x(move2 * 0.6); + next.control.orientation.rotate_z(move2 * -4.0); + next.control.position += Vec3::new(move2 * 12.0, move2 * -6.0, 0.0); + next.torso.orientation.rotate_z(move2base * -TAU); + }, + Some("common.abilities.axe.fracture") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI / 2.0 + move2 * -0.5); + + next.control.orientation.rotate_x(move1 * 0.0); + next.chest.orientation.rotate_x(move1 * -0.5); + next.chest.orientation.rotate_z(move1 * 0.7); + next.head.orientation.rotate_z(move1 * -0.3); + next.belt.orientation.rotate_z(move1 * -0.1); + next.shorts.orientation.rotate_z(move1 * -0.4); + + next.chest.orientation.rotate_z(move2 * -1.8); + next.head.orientation.rotate_z(move2 * 0.9); + next.shorts.orientation.rotate_z(move2 * 1.3); + next.belt.orientation.rotate_z(move2 * 0.6); + next.control.orientation.rotate_x(move2 * -0.9); + next.control.orientation.rotate_z(move2 * -3.5); + next.control.position += Vec3::new(move2 * 14.0, move2 * 6.0, 0.0); + }, + Some("common.abilities.axe.berserk") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5); + + next.control.orientation.rotate_z(move1 * -2.0); + next.control.orientation.rotate_x(move1 * 3.5); + next.control.position += Vec3::new(move1 * 14.0, move1 * -6.0, move1 * 15.0); + + next.head.orientation.rotate_x(move2 * 0.6); + next.chest.orientation.rotate_x(move2 * 0.4); + }, + Some("common.abilities.axe.savage_sense") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5); + + next.chest.orientation = Quaternion::rotation_z(move1 * 0.6); + next.head.orientation = Quaternion::rotation_z(move1 * -0.2); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.3); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.1); + next.foot_r.position += Vec3::new(0.0, move1 * 4.0, move1 * 4.0); + next.foot_r.orientation.rotate_x(move1 * 1.2); + + next.foot_r.position += Vec3::new(0.0, move2 * 4.0, move2 * -4.0); + next.foot_r.orientation.rotate_x(move2 * -1.2); + }, + Some("common.abilities.axe.adrenaline_rush") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); + + next.control.orientation.rotate_z(move1 * -1.8); + next.control.orientation.rotate_y(move1 * 1.5); + next.control.position += Vec3::new(move1 * 11.0, 0.0, 0.0); + + next.control.orientation.rotate_y(move2 * 0.7); + next.control.orientation.rotate_z(move2 * 1.6); + next.control.position += Vec3::new(move2 * -8.0, 0.0, move2 * -3.0); + }, + Some("common.abilities.axe.bloodfeast") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5); + + next.control.orientation.rotate_z(move1 * -3.4); + next.control.orientation.rotate_x(move1 * 1.1); + next.control.position += Vec3::new(move1 * 14.0, move1 * -3.0, 0.0); + + next.control.orientation.rotate_x(move2 * 1.7); + next.control.orientation.rotate_z(move2 * -1.3); + next.control.orientation.rotate_y(move2 * 0.8); + }, + Some("common.abilities.axe.furor") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); + + next.control.orientation.rotate_x(move1 * -1.0); + next.control.position += Vec3::new(move1 * 3.0, move1 * -2.0, move1 * 14.0); + next.control.orientation.rotate_z(move1 * 1.5); + + next.control.orientation.rotate_y(move2 * -1.0); + next.control.orientation.rotate_z(move2 * -1.6); + next.control.orientation.rotate_y(move2 * 0.7); + next.control.orientation.rotate_x(move2 * -0.5); + next.control.position += Vec3::new(move2 * 9.0, move2 * -3.0, move2 * -14.0); + }, + Some("common.abilities.axe.sunder") => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5); + + next.control.orientation.rotate_z(move1 * -1.5); + next.control.position += Vec3::new(move1 * 12.0, 0.0, move1 * 5.0); + next.control.orientation.rotate_y(move1 * 0.5); + next.main.position += Vec3::new(0.0, move1 * 10.0, 0.0); + next.main.orientation.rotate_z(move1base * TAU); + next.second.position += Vec3::new(0.0, move1 * 10.0, 0.0); + next.second.orientation.rotate_z(move1base * -TAU); + + next.main.orientation.rotate_z(move2base * TAU); + next.main.position += Vec3::new(0.0, move2 * -10.0, 0.0); + next.second.orientation.rotate_z(move2base * -TAU); + next.second.position += Vec3::new(0.0, move2 * -10.0, 0.0); + next.control.position += Vec3::new(0.0, 0.0, move2 * -5.0); + }, + Some("common.abilities.axe.defiance") => { + let tension = (move2base * 20.0).sin(); + + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5); + + next.control.orientation.rotate_z(move1 * -1.6); + next.control.orientation.rotate_x(move1 * 1.7); + next.control.position += Vec3::new(move1 * 12.0, move1 * -10.0, move1 * 18.0); + next.head.orientation.rotate_x(move1 * 0.6); + next.head.position += Vec3::new(0.0, 0.0, move1 * -3.0); + next.control.orientation.rotate_z(move1 * 0.4); + + next.head.orientation.rotate_x(tension * 0.3); + next.control.position += Vec3::new(0.0, 0.0, tension * 2.0); + }, + // ================================== + // HAMMER + // ================================== + Some("common.abilities.hammer.basic_guard") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = (move2base * 10.0).sin(); + + if d.velocity.xy().magnitude_squared() < 0.5_f32.powi(2) { + next.chest.position = + Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2); + next.chest.orientation = Quaternion::rotation_x(move1 * -0.15); + next.head.orientation = Quaternion::rotation_x(move1 * 0.25); + + next.belt.position = + Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5); + next.shorts.position = + Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0); + + next.belt.orientation = Quaternion::rotation_x(move1 * 0.15); + next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25); + + next.foot_l.position = + Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5); + + next.foot_r.position = + Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5); + } + + match d.hands { + (Some(Hands::Two), _) => { + next.hand_l.position = + Vec3::new(s_a.hhl.0, s_a.hhl.1 + move1 * 6.0, s_a.hhl.2 + move1 * 6.0); + next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3 + move1 * -0.5) + * Quaternion::rotation_y(s_a.hhl.4 + move1 * 1.5) + * Quaternion::rotation_z(s_a.hhl.5 + move1 * PI); + next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3) + * Quaternion::rotation_y(s_a.hhr.4) + * Quaternion::rotation_z(s_a.hhr.5); + + next.control.position = Vec3::new( + s_a.hc.0 + move1 * 3.0, + s_a.hc.1 + move1 * 3.0, + s_a.hc.2 + move1 * 10.0, + ); + next.control.orientation = Quaternion::rotation_x(s_a.hc.3) + * Quaternion::rotation_y(s_a.hc.4) + * Quaternion::rotation_z(s_a.hc.5 + move1 * -1.0); + }, + (Some(Hands::One), offhand) => { + next.control_l.position = + Vec3::new(-7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0); + next.control_l.orientation = + Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * 1.0); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); + if offhand.is_some() { + next.control_r.position = + Vec3::new(7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0); + next.control_r.orientation = + Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(move1 * -1.0); + next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) + } else { + next.hand_r.position = Vec3::new(4.5, 8.0, 5.0); + next.hand_r.orientation = + Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5) + } + }, + (_, _) => {}, + } + }, + Some("common.abilities.hammer.solid_smash") => { + hammer_start(&mut next, s_a); + + next.control.orientation.rotate_x(move1 * 2.7); + next.control.orientation.rotate_z(move1 * 1.4); + next.control.position += Vec3::new(-12.0, 0.0, 0.0) * move1; + next.control.orientation.rotate_x(move1 * -1.2); + twist_back(&mut next, move1, 0.8, 0.3, 0.1, 0.5); + + twist_forward(&mut next, move2, 1.4, 0.5, 0.3, 1.0); + next.control.orientation.rotate_x(move2 * -1.9); + next.control.orientation.rotate_z(move2 * 0.6); + }, + Some("common.abilities.hammer.scornful_swipe") => { + hammer_start(&mut next, s_a); + let move1_pre = move1.min(0.5) * 2.0; + let move1_shake = ((move1.max(0.3) - 0.3) * 15.0).sin(); + let move1_late = move1.powi(4); + + next.control.orientation.rotate_x(move1_pre * 2.3); + next.control.position += Vec3::new(0.0, 2.0, 16.0) * move1_pre; + next.control.position += Vec3::new(0.0, 0.0, 4.0) * move1_shake; + next.control.orientation.rotate_y(move1_late * 1.6); + next.control.position += Vec3::new(-8.0, 0.0, -8.0) * move1_late; + twist_back(&mut next, move1_late, 1.0, 0.4, 0.2, 0.7); + next.control.orientation.rotate_z(move1_late * 1.2); + + twist_forward(&mut next, move2, 1.9, 0.9, 0.6, 1.1); + next.control.orientation.rotate_y(move2 * -1.7); + next.control.orientation.rotate_z(move2 * -2.7); + }, + Some("common.abilities.hammer.heavy_whorl") => { + hammer_start(&mut next, s_a); + + twist_back(&mut next, move1, 2.0, 0.8, 0.4, 1.4); + next.control.orientation.rotate_x(move1 * 0.6); + + next.torso.orientation.rotate_z(move2base * -2.0 * PI); + twist_forward(&mut next, move2, 3.4, 1.2, 0.8, 1.8); + next.control.orientation.rotate_z(move2 * -2.3); + next.control.position += Vec3::new(6.0, 0.0, 6.0) * move2; + }, + Some("common.abilities.hammer.dual_heavy_whorl") => { + dual_wield_start(&mut next); + + twist_back(&mut next, move1, 2.0, 0.8, 0.4, 1.4); + next.control_l.orientation.rotate_y(move1 * -PI / 2.0); + next.control_r.orientation.rotate_y(move1 * -PI / 2.0); + next.control.position += Vec3::new(0.0, 0.0, 4.0) * move1; + + next.torso.orientation.rotate_z(move2base * -2.0 * PI); + twist_forward(&mut next, move2, 3.4, 1.2, 0.8, 1.8); + next.control_l.orientation.rotate_z(move2 * -2.3); + next.control_r.orientation.rotate_z(move2 * -2.3); + }, + Some("common.abilities.hammer.breach") => { + hammer_start(&mut next, s_a); + + next.control.orientation.rotate_x(move1 * 2.5); + next.control.orientation.rotate_z(move1 * -4.8); + next.control.position += Vec3::new(-12.0, 0.0, 22.0) * move1; + twist_back(&mut next, move1, 0.6, 0.2, 0.0, 0.3); + + twist_forward(&mut next, move2, 1.6, 0.4, 0.2, 0.7); + next.control.orientation.rotate_x(move2 * -4.5); + next.control.position += Vec3::new(0.0, 0.0, -20.0) * move2; + }, + Some("common.abilities.hammer.pile_driver") => { + hammer_start(&mut next, s_a); + let shake = (move1base * 15.0).sin(); + let move1 = (move1base * 2.0).min(1.0) * pullback; + + twist_back(&mut next, move1, 0.9, 0.3, 0.1, 0.5); + next.control.orientation.rotate_x(move1 * 2.4); + next.control.position += Vec3::new(-14.0, 0.0, 14.0) * move1; + next.control.orientation.rotate_z(move1 * 1.8); + + next.control.orientation.rotate_x(shake * 0.15); + + twist_forward(&mut next, move2, 1.6, 0.5, 0.2, 0.9); + next.control.orientation.rotate_x(move2 * -4.0); + next.control.orientation.rotate_z(move2 * 0.4); + next.control.position += Vec3::new(0.0, 0.0, -12.0) * move2; + }, + Some("common.abilities.hammer.upheaval") => { + hammer_start(&mut next, s_a); + let move1_twist = move1 * (move1 * PI * 1.5).sin(); + + twist_forward(&mut next, move1_twist, 0.8, 0.3, 0.0, 0.4); + let angle1 = 5.0; + let angle2 = 4.0; + next.control + .orientation + .rotate_x(move1base * (2.0 - angle1) + move2base * (2.0 - angle2)); + next.control.orientation.rotate_y(move1 * -0.8); + next.control + .orientation + .rotate_x(move1base * angle1 + move2base * angle2); + next.control.orientation.rotate_z(move1 * 1.0); + next.control.orientation.rotate_x(move2 * 6.0); + next.control.orientation.rotate_z(move2 * -0.6); + next.control.position += Vec3::new(-16.0, 0.0, 0.0) * move1; + next.control.position += Vec3::new(12.0, 0.0, 10.0) * move2; + twist_forward(&mut next, move2, 1.0, 0.9, 0.4, 1.1); + }, + Some("common.abilities.hammer.dual_upheaval") => { + dual_wield_start(&mut next); + let move1_return = (3.0 * move1base).sin(); + + next.control.orientation.rotate_x(4.0 * move1base); + next.control_l.orientation.rotate_z(move1 * 0.6); + next.control_r.orientation.rotate_z(move1 * -0.6); + next.control.position += Vec3::new(0.0, 6.0, 8.0) * move1_return; + next.control.orientation.rotate_x(3.5 * move2base); + next.control_l.orientation.rotate_z(move2 * -1.4); + next.control_r.orientation.rotate_z(move2 * 1.4); + next.control.position += Vec3::new(0.0, 12.0, 10.0) * move2; + }, + Some("common.abilities.hammer.wide_wallop") => { + hammer_start(&mut next, s_a); + let move1 = chargebase.min(1.0) * pullback; + let tension = (chargebase * 7.0).sin(); + + next.control.orientation.rotate_x(move1 * 1.1 + move2 * 0.6); + twist_back(&mut next, move1 + tension / 25.0, 1.7, 0.7, 0.3, 1.1); + next.control.orientation.rotate_y(move1 * -0.8); + next.control.position += Vec3::new(0.0, 0.0, 6.0) * move1; + + twist_forward(&mut next, move2, 4.8, 1.7, 0.7, 3.2); + next.control.orientation.rotate_y(move2 * 2.0); + next.control.orientation.rotate_z(move2 * -1.8); + }, + Some("common.abilities.hammer.intercept") => { + hammer_start(&mut next, s_a); + twist_back(&mut next, move1, 1.6, 0.7, 0.3, 1.1); + next.control.orientation.rotate_x(move1 * 1.8); + + twist_forward(&mut next, move2, 2.4, 0.9, 0.5, 1.4); + next.control.orientation.rotate_z(move2 * -2.7); + next.control.orientation.rotate_x(move2 * 2.0); + next.control.position += Vec3::new(5.0, 0.0, 11.0) * move2; + }, + Some("common.abilities.hammer.dual_intercept") => { + dual_wield_start(&mut next); + next.control_l.orientation.rotate_x(move1 * -1.4); + next.control_l.orientation.rotate_z(move1 * 0.8); + next.control_r.orientation.rotate_x(move1 * -1.4); + next.control_r.orientation.rotate_z(move1 * -0.8); + next.control.position += Vec3::new(0.0, 0.0, -6.0) * move1; + + next.control_l.orientation.rotate_z(move2 * -2.6); + next.control_l.orientation.rotate_x(move2 * 4.0); + next.control_r.orientation.rotate_z(move2 * 2.6); + next.control_r.orientation.rotate_x(move2 * 4.0); + next.control.position += Vec3::new(0.0, 0.0, 20.0) * move2; + }, + Some("common.abilities.hammer.spine_cracker") => { + hammer_start(&mut next, s_a); + + twist_back(&mut next, move1, 1.9, 1.5, 0.5, 1.2); + next.head.position += Vec3::new(-2.0, 2.0, 0.0) * move1; + next.control.orientation.rotate_x(move1 * 1.8); + next.control.position += Vec3::new(0.0, 0.0, 8.0) * move1; + next.control.orientation.rotate_y(move1 * 0.4); + + twist_forward(&mut next, move2, 2.1, 1.6, 0.4, 1.3); + next.control.orientation.rotate_z(move2 * 1.6); + next.control.position += Vec3::new(-16.0, 12.0, -8.0) * move2; + }, + Some("common.abilities.hammer.lung_pummel") => { + hammer_start(&mut next, s_a); + + twist_back(&mut next, move1, 1.9, 0.7, 0.3, 1.2); + next.control.orientation.rotate_x(move1 * 1.2); + next.control.orientation.rotate_z(move1 * 1.0); + next.control.position += Vec3::new(-12.0, 0.0, 0.0) * move1; + + twist_forward(&mut next, move2, 3.4, 1.4, 0.9, 2.1); + next.control.orientation.rotate_z(move2 * -4.0); + next.control.position += Vec3::new(12.0, 0.0, 14.0) * move2; + }, + Some("common.abilities.hammer.helm_crusher") => { + hammer_start(&mut next, s_a); + + twist_back(&mut next, move1, 0.8, 0.3, 0.1, 0.5); + next.control.orientation.rotate_x(move1 * -0.8); + next.control.orientation.rotate_z(move1 * -1.6); + next.control.orientation.rotate_x(move1 * 2.8); + next.control.position += Vec3::new(-9.0, 0.0, 8.0) * move1; + next.control.orientation.rotate_z(move1 * -0.4); + + twist_forward(&mut next, move2, 1.8, 0.7, 0.4, 1.1); + next.control.orientation.rotate_x(move2 * -5.0); + next.control.orientation.rotate_z(move2 * -1.0); + next.control.position += Vec3::new(-12.0, 0.0, -8.0) * move2; + }, + Some("common.abilities.hammer.thunderclap") => { + hammer_start(&mut next, s_a); + + twist_back(&mut next, move1, 1.8, 0.9, 0.5, 1.1); + next.control.orientation.rotate_x(move1 * 2.4); + next.control.position += Vec3::new(-16.0, -8.0, 12.0) * move1; + next.control.orientation.rotate_z(move1 * PI / 2.0); + next.control.orientation.rotate_x(move1 * 0.6); + + twist_forward(&mut next, move2, 2.4, 1.1, 0.6, 1.4); + next.control.orientation.rotate_x(move2 * -5.0); + next.control.position += Vec3::new(4.0, 12.0, -12.0) * move2; + next.control.orientation.rotate_z(move2 * 0.6); + }, + Some("common.abilities.hammer.earthshaker") => { + hammer_start(&mut next, s_a); + + next.hand_l.orientation.rotate_y(move1 * -PI); + next.hand_r.orientation.rotate_y(move1 * -PI); + next.control.orientation.rotate_x(2.4 * move1); + next.control.orientation.rotate_z(move1 * -PI / 2.0); + next.control.orientation.rotate_x(-0.6 * move1); + next.control.position += Vec3::new(-8.0, 0.0, 24.0) * move1; + next.chest.orientation.rotate_x(move1 * 0.5); + next.torso.position += Vec3::new(0.0, 0.0, 8.0) * move1; + + next.torso.position += Vec3::new(0.0, 0.0, -8.0) * move2; + next.control.orientation.rotate_x(move2 * -0.8); + next.control.position += Vec3::new(0.0, 0.0, -10.0) * move2; + next.chest.orientation.rotate_x(move2 * -0.8); + }, + Some("common.abilities.hammer.judgement") => { + hammer_start(&mut next, s_a); + + next.control.orientation.rotate_x(2.4 * move1); + next.control.orientation.rotate_z(move1 * PI / 2.0); + next.control.orientation.rotate_x(-0.6 * move1); + next.control.position += Vec3::new(-8.0, 6.0, 24.0) * move1; + next.chest.orientation.rotate_x(move1 * 0.5); + next.torso.position += Vec3::new(0.0, 0.0, 8.0) * move1; + + next.torso.position += Vec3::new(0.0, 0.0, -8.0) * move2; + next.chest.orientation.rotate_x(-1.5 * move2); + next.belt.orientation.rotate_x(0.3 * move2); + next.shorts.orientation.rotate_x(0.6 * move2); + next.control.orientation.rotate_x(-3.0 * move2); + next.control.position += Vec3::new(0.0, 0.0, -16.0) * move2; + }, + Some("common.abilities.hammer.retaliate") => { + hammer_start(&mut next, s_a); + + twist_back(&mut next, move1, 0.6, 0.2, 0.0, 0.3); + next.control.orientation.rotate_x(move1 * 1.5); + next.control.orientation.rotate_y(move1 * 0.4); + next.control.position += Vec3::new(0.0, 0.0, 16.0) * move1; + + twist_forward(&mut next, move2, 2.1, 0.6, 0.4, 0.9); + next.control.orientation.rotate_y(move2 * 2.0); + next.control.orientation.rotate_x(move2 * -2.5); + next.control.orientation.rotate_z(move2 * -0.6); + next.control.position += Vec3::new(6.0, -10.0, -14.0) * move2; + }, + Some("common.abilities.hammer.tenacity") => { + hammer_start(&mut next, s_a); + + next.control.orientation.rotate_x(move1 * 0.6); + next.control.orientation.rotate_y(move1 * 0.9); + next.control.orientation.rotate_x(move1 * -0.6); + next.chest.orientation.rotate_x(move1 * 0.4); + next.control.position += Vec3::new(0.0, 4.0, 3.0) * move1; + + next.control.position += Vec3::new( + (move2 * 50.0).sin(), + (move2 * 67.0).sin(), + (move2 * 83.0).sin(), + ); + }, + Some("common.abilities.hammer.tremor") => { + hammer_start(&mut next, s_a); + + twist_back(&mut next, move1, 1.4, 0.7, 0.5, 0.9); + next.foot_l.orientation.rotate_z(move1 * 1.4); + next.foot_l.position += Vec3::new(-1.0, -3.0, 0.0) * move1; + next.control.orientation.rotate_x(move1 * 2.6); + next.control.orientation.rotate_y(move1 * 0.8); + + twist_forward(&mut next, move2, 2.1, 1.2, 0.9, 1.6); + next.foot_l.orientation.rotate_z(move2 * -1.4); + next.foot_l.position += Vec3::new(2.0, 7.0, 0.0) * move2; + next.control.orientation.rotate_z(move2 * 2.1); + next.control.orientation.rotate_x(move2 * -2.0); + next.control.orientation.rotate_z(move2 * 1.2); + next.control.position += Vec3::new(-16.0, 0.0, 0.0) * move2; + next.chest.orientation.rotate_x(-0.8 * move2); + }, + Some("common.abilities.hammer.rampart") => { + hammer_start(&mut next, s_a); + + next.control.orientation.rotate_x(move1 * 0.6); + next.control.orientation.rotate_y(move1 * -PI / 2.0); + next.hand_l.orientation.rotate_y(move1 * -PI); + next.hand_r.orientation.rotate_y(move1 * -PI); + next.control.position += Vec3::new(-5.0, 0.0, 30.0) * move1; + + next.control.position += Vec3::new(0.0, 0.0, -10.0) * move2; + next.torso.orientation.rotate_x(move2 * -0.6); + next.control.orientation.rotate_x(move2 * 0.6); + }, + Some("common.abilities.hammer.seismic_shock") => { + hammer_start(&mut next, s_a); + + next.control.orientation.rotate_x(move1 * 2.5); + next.control.position += Vec3::new(0.0, 0.0, 28.0) * move1; + next.head.orientation.rotate_x(move1 * 0.3); + next.chest.orientation.rotate_x(move1 * 0.3); + next.belt.orientation.rotate_x(move1 * -0.2); + next.shorts.orientation.rotate_x(move1 * -0.3); + + next.control.orientation.rotate_z(move2 * 2.0); + next.control.orientation.rotate_x(move2 * -4.0); + next.control.position += Vec3::new(-6.0, 0.0, -30.0) * move2; + next.head.orientation.rotate_x(move2 * -0.9); + next.chest.orientation.rotate_x(move2 * -0.5); + next.belt.orientation.rotate_x(move2 * 0.2); + next.shorts.orientation.rotate_x(move2 * 0.4); + }, + // ================================== + // BOW + // ================================== + Some("common.abilities.bow.charged" | "common.abilities.bow.shotgun") => { + let move2 = move2base; + + let ori: Vec2 = Vec2::from(d.orientation); + let last_ori = Vec2::from(d.last_ori); + let tilt = if vek::Vec2::new(ori, last_ori) + .map(|o| o.magnitude_squared()) + .map(|m| m > 0.001 && m.is_finite()) + .reduce_and() + && ori.angle_between(last_ori).is_finite() + { + ori.angle_between(last_ori).min(0.2) + * last_ori.determine_side(Vec2::zero(), ori).signum() + } else { + 0.0 + } * 1.3; + let ori_angle = d.orientation.y.atan2(d.orientation.x); + let lookdir_angle = d.look_dir.y.atan2(d.look_dir.x); + let swivel = lookdir_angle - ori_angle; + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + next.hand_l.position = Vec3::new( + s_a.bhl.0 + move2 * -8.0, + s_a.bhl.1 + move2 * -10.0, + s_a.bhl.2, + ); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.bhl.3) * Quaternion::rotation_y(move2 * 0.7); + next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3); + + next.hold.position = Vec3::new(0.0, -1.0 + move2 * 2.0, -5.2 + move2 * 7.0); + next.hold.orientation = Quaternion::rotation_x(-PI / 2.0); + next.hold.scale = Vec3::one() * 1.0 * (1.0 - move2); + + next.control.position = Vec3::new( + s_a.bc.0 + 11.0 + move2 * 2.0, + s_a.bc.1 + 2.0 + (d.look_dir.z * -5.0).min(-2.0) + move2 * -1.0, + s_a.bc.2 + 8.0 + (d.look_dir.z * 15.0).max(-8.0), + ); + next.control.orientation = Quaternion::rotation_x(d.look_dir.z) + * Quaternion::rotation_y(-d.look_dir.z + s_a.bc.4 - 1.25) + * Quaternion::rotation_z(s_a.bc.5 - 0.2 + move2 * -0.1); + + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + + next.head.orientation = Quaternion::rotation_x(d.look_dir.z * 0.7) + * Quaternion::rotation_z(tilt * -0.0); + next.chest.orientation = Quaternion::rotation_z(swivel * 0.8 + 0.8 + move2 * 0.5); + next.torso.orientation = Quaternion::rotation_z(swivel * 0.2); + + next.shoulder_l.orientation = Quaternion::rotation_x(move2 * 0.5); + }, + // ================================== + // FIRE STAFF + // ================================== + Some("common.abilities.staff.flamethrower") => { + let move1 = move1base; + let move2 = move2base; + let move3 = move3base; + + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthl.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.control.position = Vec3::new(-4.0, 7.0, 4.0); + next.control.orientation = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.15) + * Quaternion::rotation_z(0.0); + + next.control.position = Vec3::new( + s_a.stc.0 + (move1 * 16.0) * (1.0 - move3), + s_a.stc.1 + (move1 + (move2 * 8.0).sin() * 2.0) * (1.0 - move3), + s_a.stc.2 + (move1 * 10.0) * (1.0 - move3), + ); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3 + (move1 * -1.2) * (1.0 - move3)) + * Quaternion::rotation_y( + s_a.stc.4 + + (move1 * -1.4 + (move2 * 16.0).sin() * 0.07) * (1.0 - move3), + ) + * Quaternion::rotation_z( + (move1 * -1.7 + (move2 * 8.0 + PI / 4.0).sin() * 0.3) * (1.0 - move3), + ); + next.head.orientation = Quaternion::rotation_x(0.0); + + next.hand_l.position = Vec3::new( + 0.0 + (move1 * -1.0 + (move2 * 8.0).sin() * 3.5) * (1.0 - move3), + 0.0 + (move1 * -5.0 + (move2 * 8.0).sin() * -2.0 + (move2 * 16.0).sin() * -1.5) + * (1.0 - move3), + -4.0 + (move1 * 19.0 + (move2 * 8.0 + PI / 2.0).sin() * 3.5) * (1.0 - move3), + ); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthr.3 + (move1 * -0.3) * (1.0 - move3)) + * Quaternion::rotation_y( + (move1 * -1.1 + (move2 * 8.0 + PI / 2.0).sin() * -0.3) * (1.0 - move3), + ) + * Quaternion::rotation_z((move1 * -2.8) * (1.0 - move3)); + + if d.velocity.magnitude_squared() < 0.5_f32.powi(2) { + next.head.orientation = + Quaternion::rotation_z(move1 * -0.5 + (move2 * 16.0).sin() * 0.05); + + next.foot_l.position = + Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2); + next.foot_l.orientation = + Quaternion::rotation_x(move1 * -0.5) * Quaternion::rotation_z(move1 * 0.5); + + next.foot_r.position = + Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * 4.0, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_z(move1 * 0.5); + next.chest.orientation = + Quaternion::rotation_x(move1 * -0.2 + (move2 * 8.0).sin() * 0.05) + * Quaternion::rotation_z(move1 * 0.5); + next.belt.orientation = + Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move1 * -0.1); + next.shorts.orientation = + Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move1 * -0.2); + }; + }, + Some("common.abilities.staff.fireshockwave") => { + let move1 = move1base; + let move2 = move2base; + let move3 = move3base; + + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3) * Quaternion::rotation_y(s_a.stc.4); + + let twist = move1 * 0.8; + + next.control.position = Vec3::new( + s_a.stc.0 + (move1 * 5.0) * (1.0 - move3), + s_a.stc.1 + (move1 * 5.0) * (1.0 - move3), + s_a.stc.2 + (move1 * 10.0 + move2 * -10.0) * (1.0 - move3), + ); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3 + (move1 * 0.8) * (1.0 - move3)) + * Quaternion::rotation_y( + s_a.stc.4 + (move1 * -0.15 + move2 * -0.15) * (1.0 - move3), + ) + * Quaternion::rotation_z((move1 * 0.8 + move2 * -0.8) * (1.0 - move3)); + + next.head.orientation = Quaternion::rotation_x((move1 * 0.4) * (1.0 - move3)) + * Quaternion::rotation_z((twist * 0.2 + move2 * -0.8) * (1.0 - move3)); + + next.chest.position = Vec3::new( + 0.0, + s_a.chest.0, + s_a.chest.1 + (move1 * 2.0 + move2 * -4.0) * (1.0 - move3), + ); + next.chest.orientation = Quaternion::rotation_x((move2 * -0.8) * (1.0 - move3)) + * Quaternion::rotation_z(twist * -0.2 + move2 * -0.1 + (1.0 - move3)); + + next.belt.orientation = Quaternion::rotation_x((move2 * 0.2) * (1.0 - move3)) + * Quaternion::rotation_z((twist * 0.6 + move2 * -0.48) * (1.0 - move3)); + + next.shorts.orientation = Quaternion::rotation_x((move2 * 0.3) * (1.0 - move3)) + * Quaternion::rotation_z((twist + move2 * -0.8) * (1.0 - move3)); + + if d.velocity.magnitude() < 0.5 { + next.foot_l.position = Vec3::new( + -s_a.foot.0, + s_a.foot.1 + move1 * -7.0 + move2 * 7.0, + s_a.foot.2, + ); + next.foot_l.orientation = Quaternion::rotation_x(move1 * -0.8 + move2 * 0.8) + * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.3); + + next.foot_r.position = Vec3::new( + s_a.foot.0, + s_a.foot.1 + move1 * 5.0 + move2 * -5.0, + s_a.foot.2, + ); + next.foot_r.orientation = Quaternion::rotation_y(move1 * -0.3 + move2 * 0.3) + * Quaternion::rotation_z(move1 * 0.4 + move2 * -0.4); + } + }, + Some("common.abilities.staff.firebomb") => { + let move1 = move1base; + let move2 = move2base.powf(0.25); + let move3 = move3base; + + let ori: Vec2 = Vec2::from(d.orientation); + let last_ori = Vec2::from(d.last_ori); + let tilt = if vek::Vec2::new(ori, last_ori) + .map(|o| o.magnitude_squared()) + .map(|m| m > 0.001 && m.is_finite()) + .reduce_and() + && ori.angle_between(last_ori).is_finite() + { + ori.angle_between(last_ori).min(0.2) + * last_ori.determine_side(Vec2::zero(), ori).signum() + } else { + 0.0 + } * 1.3; + let ori_angle = d.orientation.y.atan2(d.orientation.x); + let lookdir_angle = d.look_dir.y.atan2(d.look_dir.x); + let swivel = lookdir_angle - ori_angle; + let xmove = (move1 * 6.0 + PI).sin(); + let ymove = (move1 * 6.0 + PI * (0.5)).sin(); + + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3); + + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); + + next.control.position = Vec3::new( + s_a.stc.0 + (xmove * 3.0 + move1 * -4.0) * (1.0 - move3), + s_a.stc.1 + (2.0 + ymove * 3.0 + move2 * 3.0) * (1.0 - move3), + s_a.stc.2 + d.look_dir.z * 4.0, + ); + next.control.orientation = Quaternion::rotation_x( + d.look_dir.z + s_a.stc.3 + (move2 * 0.6) * (1.0 - move3), + ) * Quaternion::rotation_y( + s_a.stc.4 + (move1 * 0.5 + move2 * -0.5), + ) * Quaternion::rotation_z( + s_a.stc.5 - (0.2 + move1 * -0.5 + move2 * 0.8) * (1.0 - move3), + ); + + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + next.head.orientation = Quaternion::rotation_x(d.look_dir.z * 0.7) + * Quaternion::rotation_z( + tilt * -2.5 + (move1 * -0.2 + move2 * -0.4) * (1.0 - move3), + ); + next.chest.orientation = Quaternion::rotation_z(swivel * 0.8); + next.torso.orientation = Quaternion::rotation_z(swivel * 0.2); + }, + // ================================== + // NATURE SCEPTRE + // ================================== + Some("common.abilities.sceptre.lifestealbeam") => { + let move1 = move1base; + let move2 = move2base; + let move3 = move3base; + + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthl.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.control.position = Vec3::new(-4.0, 7.0, 4.0); + next.control.orientation = Quaternion::rotation_x(-0.3) + * Quaternion::rotation_y(0.15) + * Quaternion::rotation_z(0.0); + + next.control.position = Vec3::new( + s_a.stc.0 + (move1 * 16.0) * (1.0 - move3), + s_a.stc.1 + (move1 + (move2 * 8.0).sin() * 2.0) * (1.0 - move3), + s_a.stc.2 + (move1 * 10.0) * (1.0 - move3), + ); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3 + (move1 * -1.2) * (1.0 - move3)) + * Quaternion::rotation_y( + s_a.stc.4 + + (move1 * -1.4 + (move2 * 16.0).sin() * 0.07) * (1.0 - move3), + ) + * Quaternion::rotation_z( + (move1 * -1.7 + (move2 * 8.0 + PI / 4.0).sin() * 0.3) * (1.0 - move3), + ); + next.head.orientation = Quaternion::rotation_x(0.0); + + next.hand_l.position = Vec3::new( + 0.0 + (move1 * -1.0 + (move2 * 8.0).sin() * 3.5) * (1.0 - move3), + 0.0 + (move1 * -5.0 + (move2 * 8.0).sin() * -2.0 + (move2 * 16.0).sin() * -1.5) + * (1.0 - move3), + -4.0 + (move1 * 19.0 + (move2 * 8.0 + PI / 2.0).sin() * 3.5) * (1.0 - move3), + ); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthr.3 + (move1 * -0.3) * (1.0 - move3)) + * Quaternion::rotation_y( + (move1 * -1.1 + (move2 * 8.0 + PI / 2.0).sin() * -0.3) * (1.0 - move3), + ) + * Quaternion::rotation_z((move1 * -2.8) * (1.0 - move3)); + + if d.velocity.magnitude_squared() < 0.5_f32.powi(2) { + next.head.orientation = + Quaternion::rotation_z(move1 * -0.5 + (move2 * 16.0).sin() * 0.05); + + next.foot_l.position = + Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2); + next.foot_l.orientation = + Quaternion::rotation_x(move1 * -0.5) * Quaternion::rotation_z(move1 * 0.5); + + next.foot_r.position = + Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * 4.0, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_z(move1 * 0.5); + next.chest.orientation = + Quaternion::rotation_x(move1 * -0.2 + (move2 * 8.0).sin() * 0.05) + * Quaternion::rotation_z(move1 * 0.5); + next.belt.orientation = + Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move1 * -0.1); + next.shorts.orientation = + Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move1 * -0.2); + }; + }, + Some( + "common.abilities.sceptre.healingaura" | "common.abilities.sceptre.wardingaura", + ) => { + let move1 = move1base; + let move2 = move2base; + let move3 = move3base; + + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + + next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3) * Quaternion::rotation_y(s_a.stc.4); + + let twist = move1 * 0.8; + + next.control.position = Vec3::new( + s_a.stc.0 + (move1 * 5.0) * (1.0 - move3), + s_a.stc.1 + (move1 * 5.0) * (1.0 - move3), + s_a.stc.2 + (move1 * 10.0 + move2 * -10.0) * (1.0 - move3), + ); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3 + (move1 * 0.8) * (1.0 - move3)) + * Quaternion::rotation_y( + s_a.stc.4 + (move1 * -0.15 + move2 * -0.15) * (1.0 - move3), + ) + * Quaternion::rotation_z((move1 * 0.8 + move2 * -0.8) * (1.0 - move3)); + + next.head.orientation = Quaternion::rotation_x((move1 * 0.4) * (1.0 - move3)) + * Quaternion::rotation_z((twist * 0.2 + move2 * -0.8) * (1.0 - move3)); + + next.chest.position = Vec3::new( + 0.0, + s_a.chest.0, + s_a.chest.1 + (move1 * 2.0 + move2 * -4.0) * (1.0 - move3), + ); + next.chest.orientation = Quaternion::rotation_x((move2 * -0.8) * (1.0 - move3)) + * Quaternion::rotation_z(twist * -0.2 + move2 * -0.1 + (1.0 - move3)); + + next.belt.orientation = Quaternion::rotation_x((move2 * 0.2) * (1.0 - move3)) + * Quaternion::rotation_z((twist * 0.6 + move2 * -0.48) * (1.0 - move3)); + + next.shorts.orientation = Quaternion::rotation_x((move2 * 0.3) * (1.0 - move3)) + * Quaternion::rotation_z((twist + move2 * -0.8) * (1.0 - move3)); + + if d.velocity.magnitude() < 0.5 { + next.foot_l.position = Vec3::new( + -s_a.foot.0, + s_a.foot.1 + move1 * -7.0 + move2 * 7.0, + s_a.foot.2, + ); + next.foot_l.orientation = Quaternion::rotation_x(move1 * -0.8 + move2 * 0.8) + * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.3); + + next.foot_r.position = Vec3::new( + s_a.foot.0, + s_a.foot.1 + move1 * 5.0 + move2 * -5.0, + s_a.foot.2, + ); + next.foot_r.orientation = Quaternion::rotation_y(move1 * -0.3 + move2 * 0.3) + * Quaternion::rotation_z(move1 * 0.4 + move2 * -0.4); + } + }, + // ================================== + // SHIELD + // ================================== + Some("common.abilities.shield.basic_guard" | "common.abilities.shield.power_guard") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = (move2base * 10.0).sin(); + + if d.velocity.xy().magnitude_squared() < 0.5_f32.powi(2) { + next.chest.position = + Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2); + next.chest.orientation = Quaternion::rotation_x(move1 * -0.15); + next.head.orientation = Quaternion::rotation_x(move1 * 0.25); + + next.belt.position = + Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5); + next.shorts.position = + Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0); + + next.belt.orientation = Quaternion::rotation_x(move1 * 0.15); + next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25); + + next.foot_l.position = + Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5); + + next.foot_r.position = + Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5); + } + + if let Some(info) = d.ability_info { + match info.hand { + Some(HandInfo::MainHand) => { + next.control_l.position = Vec3::new(1.5, 8.0, 4.0 + move1 * 3.0); + next.control_l.orientation = Quaternion::rotation_x(0.25) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(-1.5); + next.hand_l.position = Vec3::new(0.0, -2.0, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); + + next.control_r.position = Vec3::new(9.0, -5.0, 0.0); + next.control_r.orientation = + Quaternion::rotation_x(-1.75) * Quaternion::rotation_y(0.3); + next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); + }, + Some(HandInfo::OffHand) => { + next.control_r.position = Vec3::new(-1.5, 8.0, 4.0 + move1 * 3.0); + next.control_r.orientation = Quaternion::rotation_x(0.25) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(1.5); + next.hand_r.position = Vec3::new(0.0, -2.0, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); + + next.control_l.position = Vec3::new(-9.0, -5.0, 0.0); + next.control_l.orientation = + Quaternion::rotation_x(-1.75) * Quaternion::rotation_y(-0.3); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); + }, + Some(HandInfo::TwoHanded) | None => {}, + } + } + }, + // ================================== + // MISCELLANEOUS + // ================================== + Some("common.abilities.pick.swing") => { + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + next.second.position = Vec3::new(0.0, 0.0, 0.0); + next.second.orientation = Quaternion::rotation_z(0.0); + next.torso.position = Vec3::new(0.0, 0.0, 1.1); + next.torso.orientation = Quaternion::rotation_z(0.0); + + let move1 = move1base.powf(0.25); + let move3 = move3base.powi(4); + let pullback = 1.0 - move3; + let moveret1 = move1base * pullback; + let moveret2 = move2base * pullback; + + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + next.head.orientation = Quaternion::rotation_x(moveret1 * 0.1 + moveret2 * 0.3) + * Quaternion::rotation_z(move1 * -0.2 + moveret2 * 0.2); + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + moveret2 * -2.0); + next.chest.orientation = Quaternion::rotation_x(moveret1 * 0.4 + moveret2 * -0.7) + * Quaternion::rotation_y(moveret1 * 0.3 + moveret2 * -0.4) + * Quaternion::rotation_z(moveret1 * 0.5 + moveret2 * -0.5); + + next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + moveret2 * -7.0); + next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3) + * Quaternion::rotation_y(s_a.hhl.4) + * Quaternion::rotation_z(s_a.hhl.5); + next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3) + * Quaternion::rotation_y(s_a.hhr.4) + * Quaternion::rotation_z(s_a.hhr.5); + + next.control.position = Vec3::new( + s_a.hc.0 + moveret1 * -13.0 + moveret2 * 3.0, + s_a.hc.1 + (moveret2 * 5.0), + s_a.hc.2 + moveret1 * 8.0 + moveret2 * -6.0, + ); + next.control.orientation = + Quaternion::rotation_x(s_a.hc.3 + (moveret1 * 1.5 + moveret2 * -2.55)) + * Quaternion::rotation_y(s_a.hc.4 + moveret1 * PI / 2.0 + moveret2 * 0.5) + * Quaternion::rotation_z(s_a.hc.5 + (moveret2 * -0.5)); + + if skeleton.holding_lantern { + next.hand_r.position = + Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 12.0); + next.hand_r.orientation = + Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9); + + next.lantern.position = Vec3::new(-0.5, -0.5, -1.5); + next.lantern.orientation = next.hand_r.orientation.inverse(); + } + }, + Some("common.abilities.shovel.dig") => { + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); + next.second.position = Vec3::new(0.0, 0.0, 0.0); + next.second.orientation = Quaternion::rotation_z(0.0); + next.torso.position = Vec3::new(0.0, 0.0, 1.1); + next.torso.orientation = Quaternion::rotation_z(0.0); + + let move1 = move1base.powf(0.25); + let move3 = move3base.powi(4); + let pullback = 1.0 - move3; + let moveret1 = move1base * pullback; + let moveret2 = move2base * pullback; + + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + next.head.orientation = Quaternion::rotation_x(moveret1 * 0.1 + moveret2 * 0.3) + * Quaternion::rotation_z(move1 * -0.2 + moveret2 * 0.2); + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + moveret2 * -2.0); + next.chest.orientation = Quaternion::rotation_x(moveret1 * 0.4 + moveret2 * -0.7) + * Quaternion::rotation_y(moveret1 * 0.3 + moveret2 * -0.4) + * Quaternion::rotation_z(moveret1 * 0.5 + moveret2 * -0.5); + + next.hand_l.position = Vec3::new(8.0, 6.0, 3.0); + next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); + next.hand_r.position = Vec3::new(8.0, 6.0, 15.0); + next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); + next.main.position = Vec3::new(7.5, 7.5, 13.2); + next.main.orientation = Quaternion::rotation_y(PI); + + next.control.position = Vec3::new(-11.0 + moveret1 * 8.0, 1.8, 4.0); + next.control.orientation = Quaternion::rotation_x(moveret1 * 0.3 + moveret2 * 0.2) + * Quaternion::rotation_y(0.8 - moveret1 * 0.7 + moveret2 * 0.7) + * Quaternion::rotation_z(moveret2 * 0.1 - moveret1 * 0.4); + + if skeleton.holding_lantern { + next.hand_r.position = + Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 12.0); + next.hand_r.orientation = + Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9); + + next.lantern.position = Vec3::new(-0.5, -0.5, -1.5); + next.lantern.orientation = next.hand_r.orientation.inverse(); + } + }, + _ => {}, + } + + next + } +} diff --git a/voxygen/anim/src/character/beam.rs b/voxygen/anim/src/character/beam.rs deleted file mode 100644 index 572e66ae03..0000000000 --- a/voxygen/anim/src/character/beam.rs +++ /dev/null @@ -1,119 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - CharacterSkeleton, SkeletonAttr, -}; -use common::{ - comp::item::{Hands, ToolKind}, - states::utils::{AbilityInfo, StageSection}, -}; -use std::f32::consts::PI; - -pub struct BeamAnimation; - -impl Animation for BeamAnimation { - type Dependency<'a> = ( - Option, - (Option, Option), - f32, - f32, - Option, - ); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_beam\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_beam")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_info, hands, _global_time, velocity, stage_section): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - - next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); - next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthl.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.control.position = Vec3::new(-4.0, 7.0, 4.0); - next.control.orientation = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.15) - * Quaternion::rotation_z(0.0); - - match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { - next.control.position = Vec3::new( - s_a.stc.0 + (move1 * 16.0) * (1.0 - move3), - s_a.stc.1 + (move1 + (move2 * 8.0).sin() * 2.0) * (1.0 - move3), - s_a.stc.2 + (move1 * 10.0) * (1.0 - move3), - ); - next.control.orientation = - Quaternion::rotation_x(s_a.stc.3 + (move1 * -1.2) * (1.0 - move3)) - * Quaternion::rotation_y( - s_a.stc.4 - + (move1 * -1.4 + (move2 * 16.0).sin() * 0.07) * (1.0 - move3), - ) - * Quaternion::rotation_z( - (move1 * -1.7 + (move2 * 8.0 + PI / 4.0).sin() * 0.3) * (1.0 - move3), - ); - next.head.orientation = Quaternion::rotation_x(0.0); - - next.hand_l.position = Vec3::new( - 0.0 + (move1 * -1.0 + (move2 * 8.0).sin() * 3.5) * (1.0 - move3), - 0.0 + (move1 * -5.0 + (move2 * 8.0).sin() * -2.0 + (move2 * 16.0).sin() * -1.5) - * (1.0 - move3), - -4.0 + (move1 * 19.0 + (move2 * 8.0 + PI / 2.0).sin() * 3.5) * (1.0 - move3), - ); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.sthr.3 + (move1 * -0.3) * (1.0 - move3)) - * Quaternion::rotation_y( - (move1 * -1.1 + (move2 * 8.0 + PI / 2.0).sin() * -0.3) * (1.0 - move3), - ) - * Quaternion::rotation_z((move1 * -2.8) * (1.0 - move3)); - - if velocity < 0.5 { - next.head.orientation = - Quaternion::rotation_z(move1 * -0.5 + (move2 * 16.0).sin() * 0.05); - - next.foot_l.position = - Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2); - next.foot_l.orientation = - Quaternion::rotation_x(move1 * -0.5) * Quaternion::rotation_z(move1 * 0.5); - - next.foot_r.position = - Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * 4.0, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_z(move1 * 0.5); - next.chest.orientation = - Quaternion::rotation_x(move1 * -0.2 + (move2 * 8.0).sin() * 0.05) - * Quaternion::rotation_z(move1 * 0.5); - next.belt.orientation = - Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move1 * -0.1); - next.shorts.orientation = - Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move1 * -0.2); - }; - }, - _ => {}, - } - - if let (None, Some(Hands::Two)) = hands { - next.second = next.main; - } - - next - } -} diff --git a/voxygen/anim/src/character/beta.rs b/voxygen/anim/src/character/beta.rs deleted file mode 100644 index ca88ace8e3..0000000000 --- a/voxygen/anim/src/character/beta.rs +++ /dev/null @@ -1,148 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - CharacterSkeleton, SkeletonAttr, -}; -use common::{ - comp::item::{Hands, ToolKind}, - states::utils::{AbilityInfo, StageSection}, -}; -use core::f32::consts::PI; - -pub struct BetaAnimation; -impl Animation for BetaAnimation { - type Dependency<'a> = ( - (Option, Option), - Option<&'a str>, - f32, - f32, - Option, - Option, - ); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_beta\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_beta")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (hands, _ability_id, _velocity, _global_time, stage_section, ability_info): Self::Dependency< - '_, - >, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - if matches!( - stage_section, - Some(StageSection::Action | StageSection::Recover) - ) { - next.main_weapon_trail = true; - next.off_weapon_trail = true; - } - next.second.position = Vec3::new(0.0, 0.0, 0.0); - next.second.orientation = Quaternion::rotation_z(0.0); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - let pullback = 1.0 - move3; - if let Some(ToolKind::Sword) = ability_info.and_then(|a| a.tool) { - next.chest.orientation = Quaternion::rotation_x(0.15) - * Quaternion::rotation_y((-0.1) * pullback) - * Quaternion::rotation_z((0.4 + move1 * 1.5 + move2 * -2.5) * pullback); - next.head.orientation = Quaternion::rotation_z(-0.4 + move1 * -1.0 + move2 * 1.5); - } - #[allow(clippy::single_match)] - match hands { - (Some(Hands::Two), _) | (None, Some(Hands::Two)) => match ability_info - .and_then(|a| a.tool) - { - Some(ToolKind::Sword) => { - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); - - next.control.position = Vec3::new( - s_a.sc.0 + (-1.4 + move1 * -3.0 + move2 * -2.0) * pullback, - s_a.sc.1 + (-1.4 + move1 * 3.0 + move2 * 3.0) * pullback, - s_a.sc.2 + (-1.9 + move1 * 2.5 * pullback), - ); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * pullback) - * Quaternion::rotation_y( - s_a.sc.4 + (0.4 + move1 * 1.5 + move2 * -2.5) * pullback, - ) - * Quaternion::rotation_z(s_a.sc.5 + (1.67 + move2 * PI / 2.0) * pullback); - }, - _ => {}, - }, - (_, _) => {}, - }; - - match hands { - #[allow(clippy::single_match)] - (Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Sword) => { - next.control_l.position = Vec3::new(-12.0, 8.0, 2.0); - next.control_l.orientation = Quaternion::rotation_x(1.7) - * Quaternion::rotation_y(-3.7 + move1 * -0.75 + move2 * 1.0) - * Quaternion::rotation_z(3.69); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) - }, - - _ => {}, - }, - (_, _) => {}, - }; - match hands { - #[allow(clippy::single_match)] - (None | Some(Hands::One), Some(Hands::One)) => { - match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Sword) => { - next.control_r.position = Vec3::new(0.0 + move1 * -8.0, 13.0, 2.0); - next.control_r.orientation = Quaternion::rotation_x(1.7) - * Quaternion::rotation_y(-2.3 + move1 * -2.3 + move2 * 1.0) - * Quaternion::rotation_z(3.69); - next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) - }, - - _ => {}, - } - }, - (_, _) => {}, - }; - - match hands { - (None, None) | (None, Some(Hands::One)) => { - next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0); - next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5) - }, - (_, _) => {}, - }; - match hands { - (None, None) | (Some(Hands::One), None) => { - next.hand_r.position = Vec3::new(4.5, 8.0, 5.0); - next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5) - }, - (_, _) => {}, - }; - - if let (None, Some(Hands::Two)) = hands { - next.second = next.main; - } - - next - } -} diff --git a/voxygen/anim/src/character/block.rs b/voxygen/anim/src/character/block.rs deleted file mode 100644 index 2fec758d54..0000000000 --- a/voxygen/anim/src/character/block.rs +++ /dev/null @@ -1,351 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - CharacterSkeleton, SkeletonAttr, -}; -use common::{ - comp::item::{Hands, ToolKind}, - states::utils::{AbilityInfo, StageSection}, -}; -use core::f32::consts::PI; - -pub struct BlockAnimation; - -type BlockAnimationDependency<'a> = ( - (Option, Option), - Option, - Option, - Vec3, - Option<&'a str>, - Option, - Option, -); -impl Animation for BlockAnimation { - type Dependency<'a> = BlockAnimationDependency<'a>; - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_block\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_block")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - ( - hands, - active_tool_kind, - second_tool_kind, - velocity, - ability_id, - stage_section, - _ability_info, - ): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - 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 { - None - | Some("common.abilities.sword.basic_guard") - | Some("common.abilities.axe.basic_guard") - | Some("common.abilities.hammer.basic_guard") - | Some("common.abilities.sword.defensive_guard") - | Some("common.abilities.shield.basic_guard") - | Some("common.abilities.shield.power_guard") => { - let speed = Vec2::::from(velocity).magnitude(); - - let (movement1base, move2, movement3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, (anim_time * 10.0).sin(), 0.0), - - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - movement3; - let move1 = movement1base * pullback; - - if speed > 0.5 { - } else { - next.chest.position = - Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2); - next.chest.orientation = Quaternion::rotation_x(move1 * -0.15); - next.head.orientation = Quaternion::rotation_x(move1 * 0.25); - - next.belt.position = - Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5); - next.shorts.position = - Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0); - - next.belt.orientation = Quaternion::rotation_x(move1 * 0.15); - next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25); - - next.foot_l.position = - Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5); - - next.foot_r.position = - Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5); - }; - - match (hands, active_tool_kind, second_tool_kind) { - ((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => { - match tool { - Some(ToolKind::Sword) => { - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3) - * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = Vec3::new( - s_a.shr.0 + move1 * -2.0, - s_a.shr.1, - s_a.shr.2 + move1 * 20.0, - ); - next.hand_r.orientation = Quaternion::rotation_x(s_a.shr.3) - * Quaternion::rotation_y(s_a.shr.4) - * Quaternion::rotation_z(move1 * 1.5); - - next.control.position = Vec3::new( - s_a.sc.0 + move1 * -3.0, - s_a.sc.1, - s_a.sc.2 + move1 * 4.0, - ); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3) - * Quaternion::rotation_y(move1 * 1.1) - * Quaternion::rotation_z(move1 * 1.7); - }, - - Some(ToolKind::Axe) => { - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) - * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.ahr.3) - * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new( - s_a.ac.0 + move1 * 13.0, - s_a.ac.1 + move1 * -3.0, - s_a.ac.2 + move1 * 8.0, - ); - next.control.orientation = - Quaternion::rotation_x(s_a.ac.3 + move1 * -2.0) - * Quaternion::rotation_y(s_a.ac.4 + move1 * -1.8) - * Quaternion::rotation_z(s_a.ac.5 + move1 * 4.0); - }, - Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => { - next.hand_l.position = Vec3::new( - s_a.hhl.0, - s_a.hhl.1 + move1 * 6.0, - s_a.hhl.2 + move1 * 6.0, - ); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.hhl.3 + move1 * -0.5) - * Quaternion::rotation_y(s_a.hhl.4 + move1 * 1.5) - * Quaternion::rotation_z(s_a.hhl.5 + move1 * PI); - next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3) - * Quaternion::rotation_y(s_a.hhr.4) - * Quaternion::rotation_z(s_a.hhr.5); - - next.control.position = Vec3::new( - s_a.hc.0 + move1 * 3.0, - s_a.hc.1 + move1 * 3.0, - s_a.hc.2 + move1 * 10.0, - ); - next.control.orientation = Quaternion::rotation_x(s_a.hc.3) - * Quaternion::rotation_y(s_a.hc.4) - * Quaternion::rotation_z(s_a.hc.5 + move1 * -1.0); - }, - Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { - next.hand_r.position = - Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.sthr.3) - * Quaternion::rotation_y(s_a.sthr.4); - - next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2); - - next.hand_l.position = - Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3); - - next.control.orientation = Quaternion::rotation_x(s_a.stc.3) - * Quaternion::rotation_y(s_a.stc.4) - * Quaternion::rotation_z(s_a.stc.5); - }, - Some(ToolKind::Bow) => { - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3); - next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3); - - next.hold.position = Vec3::new(0.0, -1.0, -5.2); - next.hold.orientation = Quaternion::rotation_x(-PI / 2.0); - next.hold.scale = Vec3::one() * 1.0; - - next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2); - next.control.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(s_a.bc.4) - * Quaternion::rotation_z(s_a.bc.5); - }, - Some(ToolKind::Debug) => { - next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0); - next.hand_l.orientation = Quaternion::rotation_x(1.27); - next.main.position = Vec3::new(-5.0, 5.0, 23.0); - next.main.orientation = Quaternion::rotation_x(PI); - }, - Some(ToolKind::Farming) => { - next.hand_l.position = Vec3::new(9.0, 1.0, 1.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); - next.hand_r.position = Vec3::new(9.0, 1.0, 11.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); - next.main.position = Vec3::new(7.5, 7.5, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); - - next.control.position = Vec3::new(-11.0, 1.8, 4.0); - next.control.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.6) - * Quaternion::rotation_z(0.0); - }, - Some(ToolKind::Shield) => { - next.control.position = Vec3::new(2.0, 9.0, 8.0); - next.control.orientation = - Quaternion::rotation_x(0.25) * Quaternion::rotation_z(-1.5); - - next.hand_l.position = Vec3::new(0.0, -2.0, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); - - next.hand_r.position = Vec3::new(0.0, 0.0, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) - * Quaternion::rotation_y(PI / 2.0); - }, - _ => {}, - } - }, - ((Some(Hands::One), Some(Hands::One)), _, Some(ToolKind::Shield)) => { - next.control_r.position = Vec3::new(-1.5, 8.0, 4.0 + move1 * 3.0); - next.control_r.orientation = Quaternion::rotation_x(0.25) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(1.5); - next.hand_r.position = Vec3::new(0.0, -2.0, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); - - next.control_l.position = Vec3::new(-9.0, -5.0, 0.0); - next.control_l.orientation = - Quaternion::rotation_x(-1.75) * Quaternion::rotation_y(-0.3); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); - }, - ((Some(Hands::One), _), Some(ToolKind::Shield), _) => { - next.control_l.position = Vec3::new(1.5, 8.0, 4.0 + move1 * 3.0); - next.control_l.orientation = Quaternion::rotation_x(0.25) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(-1.5); - next.hand_l.position = Vec3::new(0.0, -2.0, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); - - next.control_r.position = Vec3::new(9.0, -5.0, 0.0); - next.control_r.orientation = - Quaternion::rotation_x(-1.75) * Quaternion::rotation_y(0.3); - next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); - }, - ((Some(Hands::One), _), _, _) => { - match hands { - (Some(Hands::One), _) => { - next.control_l.position = - Vec3::new(-7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0); - next.control_l.orientation = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(move1 * 1.0); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) - }, - (_, _) => {}, - }; - match hands { - (None | Some(Hands::One), Some(Hands::One)) => { - next.control_r.position = - Vec3::new(7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0); - next.control_r.orientation = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(move1 * -1.0); - next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0) - }, - (_, _) => {}, - }; - match hands { - (None, None) | (None, Some(Hands::One)) => { - next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0); - next.hand_l.orientation = - Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5) - }, - (_, _) => {}, - }; - match hands { - (None, None) | (Some(Hands::One), None) => { - next.hand_r.position = Vec3::new(4.5, 8.0, 5.0); - next.hand_r.orientation = - Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5) - }, - (_, _) => {}, - }; - - if let (None, Some(Hands::Two)) = hands { - next.second = next.main; - } - }, - ((_, _), _, _) => {}, - }; - }, - Some("common.abilities.sword.defensive_deflect") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powi(2), 0.0, 0.0), - Some(StageSection::Action) => (1.0, (anim_time * 20.0).sin(), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(0.5)), - _ => (0.0, 0.0, 0.0), - }; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1 * -0.9); - - next.chest.orientation = Quaternion::rotation_z(move1 * -0.6); - next.head.orientation = Quaternion::rotation_z(move1 * 0.2); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.1); - next.shorts.orientation = Quaternion::rotation_z(move1 * 0.1); - next.control.orientation.rotate_y(move1 * -1.7); - next.control.orientation.rotate_z(move1 * 0.6); - next.control.position += Vec3::new(move1 * 11.0, move1 * 2.0, move1 * 5.0); - - next.control.orientation.rotate_y(move2 / 50.0); - - next.chest.orientation.rotate_z(move3 * -0.6); - next.head.orientation.rotate_z(move3 * 0.4); - next.belt.orientation.rotate_z(move3 * 0.2); - next.shorts.orientation.rotate_z(move3 * 0.6); - next.control.position += Vec3::new(move3 * 6.0, 0.0, move3 * 9.0); - next.control.orientation.rotate_z(move3 * -0.5); - next.control.orientation.rotate_y(move3 * 0.6); - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/chargeswing.rs b/voxygen/anim/src/character/chargeswing.rs deleted file mode 100644 index b31937587c..0000000000 --- a/voxygen/anim/src/character/chargeswing.rs +++ /dev/null @@ -1,291 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, -}; -use common::states::utils::StageSection; -use core::f32::consts::{PI, TAU}; - -pub struct ChargeswingAnimation; - -type ChargeswingAnimationDependency<'a> = (Option<&'a str>, StageSection); - -impl Animation for ChargeswingAnimation { - type Dependency<'a> = ChargeswingAnimationDependency<'a>; - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_chargeswing\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_chargeswing")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, stage_section): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - 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); - if matches!(stage_section, StageSection::Action) { - next.main_weapon_trail = true; - next.off_weapon_trail = true; - } - - match ability_id { - Some( - "common.abilities.sword.basic_thrust" - | "common.abilities.sword.defensive_vital_jab", - ) => { - let (move1, move2, move3, tension) = match stage_section { - StageSection::Charge => ( - anim_time.powf(0.25).min(1.0), - 0.0, - 0.0, - (anim_time * 20.0).sin() - 0.5, - ), - StageSection::Action => (1.0, anim_time.powi(2), 0.0, 0.0), - StageSection::Recover => (1.0, 1.0, anim_time.powi(4), 0.0), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(PI * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + move2 * 5.0); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -0.9) - * Quaternion::rotation_y(move1 * 1.0 + move2 * -1.0) - * Quaternion::rotation_z(move1 * 1.3 + move2 * -1.3); - - next.chest.orientation = - Quaternion::rotation_z(move1 * 1.0 + tension * 0.02 + move2 * -1.2); - next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4); - }, - Some("common.abilities.sword.heavy_slam") => { - let (move1, move2, move3, tension) = match stage_section { - StageSection::Charge => ( - anim_time.powf(0.25).min(1.0), - 0.0, - 0.0, - (anim_time * 20.0).sin(), - ), - StageSection::Action => (1.0, anim_time.powi(2), 0.0, 0.0), - StageSection::Recover => (1.0, 1.0, anim_time.powi(4), 0.0), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3) - * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.7); - - next.control - .orientation - .rotate_x(move1 * 1.4 + tension / 50.0); - next.control.position += - Vec3::new(move1 * -1.0, move1 * 2.0, move1 * 8.0) + Vec3::one() * tension / 4.0; - next.chest.orientation = Quaternion::rotation_z(move1 * 0.4 + tension / 50.0); - - if move2 < f32::EPSILON { - next.main_weapon_trail = false; - next.off_weapon_trail = false; - } - next.control.orientation.rotate_x(move2 * -3.0); - next.control.orientation.rotate_z(move2 * -0.4); - next.control.position += Vec3::new(move2 * 10.0, 0.0, move2 * -10.0); - next.chest.orientation.rotate_z(move2 * -0.6); - }, - Some("common.abilities.sword.crippling_deep_rend") => { - let (move1, move2, tension, move3, move4) = match stage_section { - StageSection::Buildup => (anim_time, 0.0, 0.0, 0.0, 0.0), - StageSection::Charge => { - (1.0, anim_time.min(1.0), (anim_time * 20.0).sin(), 0.0, 0.0) - }, - StageSection::Action => (1.0, 1.0, 0.0, anim_time, 0.0), - StageSection::Recover => (1.0, 1.0, 0.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0, 0.0, 0.0), - }; - let move1pre = move1.min(0.5) * 2.0; - let move1post = move1.max(0.5) * 2.0 - 1.0; - let pullback = 1.0 - move4; - let move1pre = move1pre * pullback; - let move1post = move1post * pullback; - let move2 = move2 * pullback; - let move3 = move3 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1pre * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1pre * PI / 2.0); - - next.foot_r.position += Vec3::new(0.0, move1pre * -3.0, 0.0); - next.foot_r.orientation.rotate_z(move1pre * -1.2); - next.chest.orientation = Quaternion::rotation_z(move1pre * -1.3); - next.head.orientation = Quaternion::rotation_z(move1pre * 0.7); - next.belt.orientation = Quaternion::rotation_z(move1pre * 0.4); - next.shorts.orientation = Quaternion::rotation_z(move1pre * 0.8); - next.control.orientation.rotate_y(move1pre * -1.5); - next.control.orientation.rotate_z(move1pre * 0.0); - next.control.position += Vec3::new(move1pre * 12.0, 0.0, 0.0); - - next.chest.orientation.rotate_z(move1post * 1.2); - next.head.orientation.rotate_z(move1post * -0.7); - next.belt.orientation.rotate_z(move1post * -0.3); - next.shorts.orientation.rotate_z(move1post * -0.8); - next.foot_r.orientation.rotate_z(move1post * 1.2); - next.foot_r.orientation.rotate_x(move1post * -0.6); - next.control.orientation.rotate_z(move1post * -1.2); - next.control.position += Vec3::new(0.0, move1post * 4.0, move1post * 3.0); - - next.control - .orientation - .rotate_y(move2 * -2.0 + tension / 10.0); - next.chest.orientation.rotate_z(move2 * -0.4 + move3 * -1.4); - next.control - .orientation - .rotate_z(move2 * 0.3 + move3 * -1.2); - next.head.orientation.rotate_z(move2 * 0.2 + move3 * 0.7); - next.belt.orientation.rotate_z(move3 * 0.3); - next.shorts.orientation.rotate_z(move2 * 0.2 + move3 * 0.7); - next.chest - .orientation - .rotate_y(move2 * -0.3 - tension / 100.0); - next.foot_r.orientation.rotate_z(move3 * -1.5); - }, - Some( - "common.abilities.sword.cleaving_spiral_slash" - | "common.abilities.sword.cleaving_dual_spiral_slash", - ) => { - let (move1, tension, move2, move3) = match stage_section { - StageSection::Charge => ( - anim_time.powf(0.25).min(1.0), - (anim_time * 15.0).sin(), - 0.0, - 0.0, - ), - StageSection::Action => (1.0, 0.0, anim_time, 0.0), - StageSection::Recover => (1.0, 0.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - - let move2_no_pullback = move2; - let move2_pre = move2.min(0.3) * 10.0 / 3.0; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - let move2_pre = move2_pre * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.chest.orientation = Quaternion::rotation_z(move1 * 1.2 + tension / 50.0); - next.head.orientation = Quaternion::rotation_z(move1 * -0.7); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.3); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.8); - next.control.orientation.rotate_x(move1 * 0.2); - next.foot_r - .orientation - .rotate_x(move1 * -0.4 + move2_pre * 0.4); - next.foot_r.orientation.rotate_z(move1 * 1.4); - - next.control.orientation.rotate_y(move2_pre * -1.6); - next.control.position += Vec3::new(0.0, 0.0, move2_pre * 4.0); - next.torso.orientation.rotate_z(move2_no_pullback * -TAU); - next.chest.orientation.rotate_z(move2 * -2.0); - next.head.orientation.rotate_z(move2 * 1.3); - next.belt.orientation.rotate_z(move2 * 0.6); - next.shorts.orientation.rotate_z(move2 * 1.5); - next.foot_r.orientation.rotate_z(move2_pre * -1.7); - next.control.orientation.rotate_z(move2 * -1.8); - next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0); - }, - Some("common.abilities.axe.cleave") => { - let (move1, move2, move3, tension) = match stage_section { - StageSection::Charge => { - (anim_time.min(1.0), 0.0, 0.0, (anim_time * 20.0).sin()) - }, - StageSection::Action => (1.0, anim_time.powi(2), 0.0, 0.0), - StageSection::Recover => (1.0, 1.0, anim_time, 0.0), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new( - s_a.ac.0 + move1 * 7.0, - s_a.ac.1 + move1 * -4.0, - s_a.ac.2 + move1 * 18.0 + tension / 5.0, - ); - next.control.orientation = - Quaternion::rotation_x(s_a.ac.3 + move1 * -1.0 + tension / 30.0) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); - - next.control.orientation.rotate_x(move2 * -3.0); - next.control.position += Vec3::new(0.0, move2 * 8.0, move2 * -30.0); - }, - Some("common.abilities.hammer.wide_wallop") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3, tension) = match stage_section { - StageSection::Charge => (anim_time.min(1.0), 0.0, 0.0, (anim_time * 7.0).sin()), - StageSection::Action => (1.0, anim_time, 0.0, 0.0), - StageSection::Recover => (1.0, 1.0, anim_time, 0.0), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.control.orientation.rotate_x(move1 * 1.1 + move2 * 0.6); - twist_back(&mut next, move1 + tension / 25.0, 1.7, 0.7, 0.3, 1.1); - next.control.orientation.rotate_y(move1 * -0.8); - next.control.position += Vec3::new(0.0, 0.0, 6.0) * move1; - - twist_forward(&mut next, move2, 4.8, 1.7, 0.7, 3.2); - next.control.orientation.rotate_y(move2 * 2.0); - next.control.orientation.rotate_z(move2 * -1.8); - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/dash.rs b/voxygen/anim/src/character/dash.rs deleted file mode 100644 index f7b21747a1..0000000000 --- a/voxygen/anim/src/character/dash.rs +++ /dev/null @@ -1,86 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - dual_wield_start, hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, -}; -use common::states::utils::StageSection; - -pub struct DashAnimation; - -type DashAnimationDependency<'a> = (Option<&'a str>, StageSection); -impl Animation for DashAnimation { - type Dependency<'a> = DashAnimationDependency<'a>; - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_dash\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_dash")] - #[allow(clippy::single_match)] // TODO: Pending review in #587 - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, stage_section): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - if matches!(stage_section, StageSection::Action | StageSection::Charge) { - next.main_weapon_trail = true; - next.off_weapon_trail = true; - } - - match ability_id { - Some("common.abilities.hammer.intercept") => { - hammer_start(&mut next, s_a); - let (move1, _move2, move3, move4) = match stage_section { - StageSection::Buildup => (anim_time, 0.0, 0.0, 0.0), - StageSection::Charge => (1.0, anim_time, 0.0, 0.0), - StageSection::Action => (1.0, 0.0, anim_time, 0.0), - StageSection::Recover => (1.0, 0.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move4; - let move1 = move1 * pullback; - let move3 = move3 * pullback; - - twist_back(&mut next, move1, 1.6, 0.7, 0.3, 1.1); - next.control.orientation.rotate_x(move1 * 1.8); - - twist_forward(&mut next, move3, 2.4, 0.9, 0.5, 1.4); - next.control.orientation.rotate_z(move3 * -2.7); - next.control.orientation.rotate_x(move3 * 2.0); - next.control.position += Vec3::new(5.0, 0.0, 11.0) * move3; - }, - Some("common.abilities.hammer.dual_intercept") => { - dual_wield_start(&mut next); - let (move1, _move2, move3, move4) = match stage_section { - StageSection::Buildup => (anim_time, 0.0, 0.0, 0.0), - StageSection::Charge => (1.0, anim_time, 0.0, 0.0), - StageSection::Action => (1.0, 0.0, anim_time, 0.0), - StageSection::Recover => (1.0, 0.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move4; - let move1 = move1 * pullback; - let move3 = move3 * pullback; - - next.control_l.orientation.rotate_x(move1 * -1.4); - next.control_l.orientation.rotate_z(move1 * 0.8); - next.control_r.orientation.rotate_x(move1 * -1.4); - next.control_r.orientation.rotate_z(move1 * -0.8); - next.control.position += Vec3::new(0.0, 0.0, -6.0) * move1; - - next.control_l.orientation.rotate_z(move3 * -2.6); - next.control_l.orientation.rotate_x(move3 * 4.0); - next.control_r.orientation.rotate_z(move3 * 2.6); - next.control_r.orientation.rotate_x(move3 * 4.0); - next.control.position += Vec3::new(0.0, 0.0, 20.0) * move3; - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/divemelee.rs b/voxygen/anim/src/character/divemelee.rs deleted file mode 100644 index b8c23e5a39..0000000000 --- a/voxygen/anim/src/character/divemelee.rs +++ /dev/null @@ -1,140 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - CharacterSkeleton, SkeletonAttr, -}; -use common::states::utils::{AbilityInfo, StageSection}; -use core::f32::consts::{PI, TAU}; - -pub struct DiveMeleeAnimation; -impl Animation for DiveMeleeAnimation { - type Dependency<'a> = ( - Option<&'a str>, - Option, - f32, - Option, - ); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_dive_melee\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_dive_melee")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, stage_section, ground_dist, _ability_info): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - 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() { - 0.0 - } else { - ground_dist - }; - - match ability_id { - Some("common.abilities.sword.cleaving_earth_splitter") => { - let (move1, move1alt, move2, move3, move4) = match stage_section { - Some(StageSection::Movement) => ( - anim_time.min(1.0).powi(2), - (anim_time.min(1.5) / 1.5).powf(1.5), - (1.0 - ground_dist).powi(2), - 0.0, - 0.0, - ), - Some(StageSection::Action) => (1.0, 1.0, 1.0, anim_time.powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move4; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - let move3 = move3 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - next.torso.orientation.rotate_x(move1alt * -TAU); - - next.torso.orientation.rotate_x(move1 * -0.8); - next.control.orientation.rotate_x(move1 * 1.5); - next.control.position += Vec3::new(move1 * 7.0, move1.powi(4) * -6.0, move1 * 20.0); - - next.torso.orientation.rotate_x(move2 * 0.8); - next.chest.orientation = Quaternion::rotation_x(move2 * -0.4); - next.control.orientation.rotate_x(move2 * -1.2); - next.control.position += Vec3::new(0.0, move2 * 12.0, move2 * -8.0); - - next.control.orientation.rotate_x(move3 * -1.2); - next.control.position += Vec3::new(0.0, move3 * 4.0, move3 * -8.0); - }, - Some("common.abilities.sword.heavy_pillar_thrust") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.5), 0.0, 0.0), - Some(StageSection::Movement) => (anim_time.min(1.0).powf(0.5), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - - let move1alt1 = move1.min(0.5) * 2.0; - let move1alt2 = (move1.max(0.5) - 0.5) * 2.0; - - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move1alt1 = move1alt1 * pullback; - let move1alt2 = move1alt2 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3 + move1alt2 * PI) - * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = Vec3::new( - -s_a.sc.0 + 6.0 + move1alt1 * -12.0, - -4.0 + move1alt1 * 3.0, - -2.0, - ); - next.hand_r.orientation = - Quaternion::rotation_x(0.9 + move1 * 0.5 + move1alt1 * PI); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.control.position += Vec3::new( - move1 * 6.0, - (1.0 - (move1 - 0.5).abs() * 2.0) * 3.0, - move1 * 22.0, - ); - next.control.orientation.rotate_x(move1 * -1.5); - - next.chest.orientation = Quaternion::rotation_x(move2 * -0.4); - next.head.orientation = Quaternion::rotation_x(move2 * 0.2); - next.belt.orientation = Quaternion::rotation_x(move2 * 0.4); - next.shorts.orientation = Quaternion::rotation_x(move2 * 0.8); - next.control.orientation.rotate_x(move2 * -0.4); - next.control.position += Vec3::new(0.0, 0.0, move2 * -10.0); - next.belt.position += Vec3::new(0.0, move2 * 2.0, move2 * 0.0); - next.shorts.position += Vec3::new(0.0, move2 * 4.0, move2 * 1.0); - next.chest.position += Vec3::new(0.0, move2 * -2.5, 0.0); - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/finishermelee.rs b/voxygen/anim/src/character/finishermelee.rs deleted file mode 100644 index cb8974405f..0000000000 --- a/voxygen/anim/src/character/finishermelee.rs +++ /dev/null @@ -1,590 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, -}; -use common::states::utils::{AbilityInfo, StageSection}; -use core::f32::consts::{PI, TAU}; - -pub struct FinisherMeleeAnimation; -impl Animation for FinisherMeleeAnimation { - type Dependency<'a> = (Option<&'a str>, Option, Option); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_finisher_melee\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_finisher_melee")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, stage_section, _ability_info): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - 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); - if matches!(stage_section, Some(StageSection::Action)) { - next.main_weapon_trail = true; - next.off_weapon_trail = true; - } - - match ability_id { - Some("common.abilities.sword.basic_mighty_strike") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powf(0.1), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new( - s_a.sc.0 + move2 * 12.0, - s_a.sc.1, - s_a.sc.2 + move1 * 6.0 - move2 * 8.0, - ); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3 + move1 * 1.6 + move2 * -2.6) - * Quaternion::rotation_y(move1 * -0.4 + move2 * 0.6) - * Quaternion::rotation_z(move1 * -0.2 + move2 * -0.2); - - next.chest.orientation = Quaternion::rotation_z(move1 * 1.0 + move2 * -1.2); - next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4); - }, - Some("common.abilities.sword.heavy_guillotine") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3) - * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.7); - - next.control.orientation.rotate_x(move1 * 1.4); - next.control.position += Vec3::new(move1 * -1.0, move1 * 2.0, move1 * 8.0); - next.chest.orientation = Quaternion::rotation_z(move1 * 0.4); - - next.control.orientation.rotate_x(move2 * -3.0); - next.control.orientation.rotate_z(move2 * -0.4); - next.control.position += Vec3::new(move2 * 10.0, 0.0, move2 * -10.0); - next.chest.orientation.rotate_z(move2 * -0.6); - }, - Some("common.abilities.sword.defensive_counter") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.5), 0.0, 0.0), - Some(StageSection::Action) => { - (1.0, (anim_time.min(2.0 / 3.0) * 1.5).powi(2), 0.0) - }, - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move2 * -PI / 4.0); - - next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_l.orientation = Quaternion::identity(); - next.foot_r.orientation = Quaternion::identity(); - - next.foot_r.position += - Vec3::new(0.0, move1 * 4.0, (1.0 - (move1 - 0.5) * 2.0) * 2.0); - next.torso.position += Vec3::new(0.0, move1 * -2.0, 0.0); - next.chest.position += Vec3::new(0.0, move1 * 2.0, move1 * -3.0); - next.shorts.orientation = Quaternion::rotation_x(move1 * 0.5); - next.shorts.position += Vec3::new(0.0, move1 * 1.5, 0.0); - next.control.orientation.rotate_y(move1 * -1.5); - next.control.orientation.rotate_z(move1 * 0.8); - - next.chest.orientation = Quaternion::rotation_z(move2 * -0.7); - next.head.orientation = Quaternion::rotation_z(move2 * 0.4); - next.shorts.orientation.rotate_z(move2 * 0.5); - next.belt.orientation = Quaternion::rotation_z(move2 * 0.1); - next.control.orientation.rotate_z(move2 * -1.4); - next.control.orientation.rotate_x(move2 * 0.5); - next.control.position += Vec3::new(move2 * 7.0, 0.0, move2 * 6.0); - }, - Some("common.abilities.axe.execute") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); - - next.control.orientation.rotate_x(move1 * 0.9); - next.chest.orientation.rotate_z(move1 * 1.2); - next.head.orientation.rotate_z(move1 * -0.5); - next.belt.orientation.rotate_z(move1 * -0.3); - next.shorts.orientation.rotate_z(move1 * -0.7); - next.control.position += Vec3::new(move1 * 4.0, move1 * -12.0, move1 * 11.0); - - next.chest.orientation.rotate_z(move2 * -2.0); - next.head.orientation.rotate_z(move2 * 0.9); - next.belt.orientation.rotate_z(move2 * 0.4); - next.shorts.orientation.rotate_z(move2 * 1.1); - next.control.orientation.rotate_x(move2 * -5.0); - next.control.position += Vec3::new(move2 * -3.0, move2 * 12.0, move2 * -17.0); - next.control.orientation.rotate_z(move2 * 0.7); - }, - Some("common.abilities.axe.maelstrom") => { - let (move1, move2_raw, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2_raw * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); - - next.control.orientation.rotate_x(move1 * 0.9); - next.chest.orientation.rotate_z(move1 * 1.2); - next.head.orientation.rotate_z(move1 * -0.5); - next.belt.orientation.rotate_z(move1 * -0.3); - next.shorts.orientation.rotate_z(move1 * -0.7); - next.control.position += Vec3::new(move1 * 4.0, move1 * -12.0, move1 * 11.0); - - next.chest.orientation.rotate_z(move2 * -2.0); - next.head.orientation.rotate_z(move2 * 0.9); - next.belt.orientation.rotate_z(move2 * 0.4); - next.shorts.orientation.rotate_z(move2 * 1.1); - next.control.orientation.rotate_x(move2 * -5.0); - next.control.position += Vec3::new(move2 * 5.0, move2 * 12.0, move2 * -17.0); - next.control.orientation.rotate_y(move2 * -2.0); - next.control.orientation.rotate_z(move2 * -1.0); - next.torso.orientation.rotate_z(move2_raw * -4.0 * PI); - }, - Some("common.abilities.axe.lacerate") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2_reset = ((move2 - 0.5).abs() - 0.5).abs() * 2.0; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2 + 10.0); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 - move1 * PI * 0.75); - - next.chest.orientation.rotate_z(move1 * 1.2); - next.head.orientation.rotate_z(move1 * -0.7); - next.shorts.orientation.rotate_z(move1 * -0.9); - next.belt.orientation.rotate_z(move1 * -0.3); - - next.chest.orientation.rotate_z(move2 * -2.9); - next.head.orientation.rotate_z(move2 * 1.2); - next.shorts.orientation.rotate_z(move2 * 2.0); - next.belt.orientation.rotate_z(move2 * 0.7); - next.control.orientation.rotate_x(move2_reset * -1.0); - next.control.orientation.rotate_z(move2 * -5.0); - next.control.position += Vec3::new(move2 * 17.0, move2 * 3.0, 0.0); - }, - Some("common.abilities.axe.riptide") => { - let (move1, move2_raw, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2_reset = ((move2_raw - 0.5).abs() - 0.5).abs() * 2.0; - let move2 = move2_raw * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 - move1 * PI * 0.75); - - next.chest.orientation.rotate_z(move1 * 1.2); - next.head.orientation.rotate_z(move1 * -0.7); - next.shorts.orientation.rotate_z(move1 * -0.9); - next.belt.orientation.rotate_z(move1 * -0.3); - - next.chest.orientation.rotate_z(move2 * -2.9); - next.head.orientation.rotate_z(move2 * 1.2); - next.shorts.orientation.rotate_z(move2 * 2.0); - next.belt.orientation.rotate_z(move2 * 0.7); - next.control.orientation.rotate_x(move2_reset * -1.0); - next.control.orientation.rotate_z(move2 * -5.0); - next.control.position += Vec3::new(move2 * 17.0, move2 * 3.0, 0.0); - next.torso.orientation.rotate_z(move2_raw * -TAU) - }, - Some("common.abilities.axe.keelhaul") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5); - - next.control.orientation.rotate_z(move1 * -3.3); - next.control.orientation.rotate_x(move1 * 0.8); - next.control.position += - Vec3::new(move1 * 4.0, move1 * 4.0 - move2 * 6.0, move1 * 10.0); - - next.chest.orientation.rotate_z(move2 * 1.2); - next.head.orientation.rotate_z(move2 * -0.5); - next.belt.orientation.rotate_z(move2 * -0.3); - next.shorts.orientation.rotate_z(move2 * -0.9); - next.control.orientation.rotate_z(move2 * -1.2); - }, - Some("common.abilities.axe.bulkhead") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI * 0.75 + move2 * PI * 0.25); - - next.chest.orientation.rotate_z(move1 * 1.8); - next.head.orientation.rotate_z(move1 * -0.6); - next.belt.orientation.rotate_z(move1 * -0.4); - next.shorts.orientation.rotate_z(move1 * -1.3); - next.control.orientation.rotate_x(move1 * -0.8); - - next.chest.orientation.rotate_z(move2 * -3.8); - next.head.orientation.rotate_z(move2 * 1.2); - next.belt.orientation.rotate_z(move2 * 0.8); - next.shorts.orientation.rotate_z(move2 * 2.1); - next.control.orientation.rotate_x(move2 * 0.6); - next.control.orientation.rotate_z(move2 * -4.0); - next.control.position += Vec3::new(move2 * 12.0, move2 * -6.0, 0.0); - }, - Some("common.abilities.axe.capsize") => { - let (move1, move2_raw, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2_raw * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI * 0.75 + move2 * PI * 0.25); - - next.chest.orientation.rotate_z(move1 * 1.8); - next.head.orientation.rotate_z(move1 * -0.6); - next.belt.orientation.rotate_z(move1 * -0.4); - next.shorts.orientation.rotate_z(move1 * -1.3); - next.control.orientation.rotate_x(move1 * -0.8); - - next.chest.orientation.rotate_z(move2 * -3.8); - next.head.orientation.rotate_z(move2 * 1.2); - next.belt.orientation.rotate_z(move2 * 0.8); - next.shorts.orientation.rotate_z(move2 * 2.1); - next.control.orientation.rotate_x(move2 * 0.6); - next.control.orientation.rotate_z(move2 * -4.0); - next.control.position += Vec3::new(move2 * 12.0, move2 * -6.0, 0.0); - next.torso.orientation.rotate_z(move2_raw * -TAU); - }, - Some("common.abilities.axe.fracture") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI / 2.0 + move2 * -0.5); - - next.control.orientation.rotate_x(move1 * 0.0); - next.chest.orientation.rotate_x(move1 * -0.5); - next.chest.orientation.rotate_z(move1 * 0.7); - next.head.orientation.rotate_z(move1 * -0.3); - next.belt.orientation.rotate_z(move1 * -0.1); - next.shorts.orientation.rotate_z(move1 * -0.4); - - next.chest.orientation.rotate_z(move2 * -1.8); - next.head.orientation.rotate_z(move2 * 0.9); - next.shorts.orientation.rotate_z(move2 * 1.3); - next.belt.orientation.rotate_z(move2 * 0.6); - next.control.orientation.rotate_x(move2 * -0.9); - next.control.orientation.rotate_z(move2 * -3.5); - next.control.position += Vec3::new(move2 * 14.0, move2 * 6.0, 0.0); - }, - Some("common.abilities.hammer.spine_cracker") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 1.9, 1.5, 0.5, 1.2); - next.head.position += Vec3::new(-2.0, 2.0, 0.0) * move1; - next.control.orientation.rotate_x(move1 * 1.8); - next.control.position += Vec3::new(0.0, 0.0, 8.0) * move1; - next.control.orientation.rotate_y(move1 * 0.4); - - twist_forward(&mut next, move2, 2.1, 1.6, 0.4, 1.3); - next.control.orientation.rotate_z(move2 * 1.6); - next.control.position += Vec3::new(-16.0, 12.0, -8.0) * move2; - }, - Some("common.abilities.hammer.lung_pummel") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 1.9, 0.7, 0.3, 1.2); - next.control.orientation.rotate_x(move1 * 1.2); - next.control.orientation.rotate_z(move1 * 1.0); - next.control.position += Vec3::new(-12.0, 0.0, 0.0) * move1; - - twist_forward(&mut next, move2, 3.4, 1.4, 0.9, 2.1); - next.control.orientation.rotate_z(move2 * -4.0); - next.control.position += Vec3::new(12.0, 0.0, 14.0) * move2; - }, - Some("common.abilities.hammer.helm_crusher") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 0.8, 0.3, 0.1, 0.5); - next.control.orientation.rotate_x(move1 * -0.8); - next.control.orientation.rotate_z(move1 * -1.6); - next.control.orientation.rotate_x(move1 * 2.8); - next.control.position += Vec3::new(-9.0, 0.0, 8.0) * move1; - next.control.orientation.rotate_z(move1 * -0.4); - - twist_forward(&mut next, move2, 1.8, 0.7, 0.4, 1.1); - next.control.orientation.rotate_x(move2 * -5.0); - next.control.orientation.rotate_z(move2 * -1.0); - next.control.position += Vec3::new(-12.0, 0.0, -8.0) * move2; - }, - Some("common.abilities.hammer.thunderclap") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 1.8, 0.9, 0.5, 1.1); - next.control.orientation.rotate_x(move1 * 2.4); - next.control.position += Vec3::new(-16.0, -8.0, 12.0) * move1; - next.control.orientation.rotate_z(move1 * PI / 2.0); - next.control.orientation.rotate_x(move1 * 0.6); - - twist_forward(&mut next, move2, 2.4, 1.1, 0.6, 1.4); - next.control.orientation.rotate_x(move2 * -5.0); - next.control.position += Vec3::new(4.0, 12.0, -12.0) * move2; - next.control.orientation.rotate_z(move2 * 0.6); - }, - Some("common.abilities.hammer.earthshaker") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.orientation.rotate_y(move1 * -PI); - next.hand_r.orientation.rotate_y(move1 * -PI); - next.control.orientation.rotate_x(2.4 * move1); - next.control.orientation.rotate_z(move1 * -PI / 2.0); - next.control.orientation.rotate_x(-0.6 * move1); - next.control.position += Vec3::new(-8.0, 0.0, 24.0) * move1; - next.chest.orientation.rotate_x(move1 * 0.5); - next.torso.position += Vec3::new(0.0, 0.0, 8.0) * move1; - - next.torso.position += Vec3::new(0.0, 0.0, -8.0) * move2; - next.control.orientation.rotate_x(move2 * -0.8); - next.control.position += Vec3::new(0.0, 0.0, -10.0) * move2; - next.chest.orientation.rotate_x(move2 * -0.8); - }, - Some("common.abilities.hammer.judgement") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.control.orientation.rotate_x(2.4 * move1); - next.control.orientation.rotate_z(move1 * PI / 2.0); - next.control.orientation.rotate_x(-0.6 * move1); - next.control.position += Vec3::new(-8.0, 6.0, 24.0) * move1; - next.chest.orientation.rotate_x(move1 * 0.5); - next.torso.position += Vec3::new(0.0, 0.0, 8.0) * move1; - - next.torso.position += Vec3::new(0.0, 0.0, -8.0) * move2; - next.chest.orientation.rotate_x(-1.5 * move2); - next.belt.orientation.rotate_x(0.3 * move2); - next.shorts.orientation.rotate_x(0.6 * move2); - next.control.orientation.rotate_x(-3.0 * move2); - next.control.position += Vec3::new(0.0, 0.0, -16.0) * move2; - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/leapmelee.rs b/voxygen/anim/src/character/leapmelee.rs deleted file mode 100644 index ad5f3e646c..0000000000 --- a/voxygen/anim/src/character/leapmelee.rs +++ /dev/null @@ -1,27 +0,0 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::states::utils::StageSection; - -pub struct LeapAnimation; - -type LeapAnimationDependency = (StageSection,); -impl Animation for LeapAnimation { - type Dependency<'a> = LeapAnimationDependency; - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_leapmelee\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_leapmelee")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - _stage_section: Self::Dependency<'_>, - _anim_time: f32, - rate: &mut f32, - _s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - /* let mut next = */ - (*skeleton).clone() - // next - } -} diff --git a/voxygen/anim/src/character/mod.rs b/voxygen/anim/src/character/mod.rs index 6748dfbd42..9eb62a2cbe 100644 --- a/voxygen/anim/src/character/mod.rs +++ b/voxygen/anim/src/character/mod.rs @@ -1,34 +1,20 @@ -pub mod alpha; -pub mod beam; -pub mod beta; -pub mod block; +pub mod basic; pub mod boost; -pub mod chargeswing; pub mod climb; pub mod collect; -pub mod combomelee; pub mod consume; pub mod dance; -pub mod dash; -pub mod divemelee; pub mod equip; -pub mod finishermelee; pub mod glidewield; pub mod gliding; pub mod idle; pub mod jump; -pub mod leapmelee; pub mod mount; +pub mod multi; pub mod music; pub mod pet; -pub mod rapidmelee; -pub mod repeater; -pub mod ripostemelee; pub mod roll; pub mod run; -pub mod selfbuff; -pub mod shockwave; -pub mod shoot; pub mod sit; pub mod sleep; pub mod sneak; @@ -46,21 +32,37 @@ pub mod wield; // Reexports pub use self::{ - alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, block::BlockAnimation, - boost::BoostAnimation, chargeswing::ChargeswingAnimation, climb::ClimbAnimation, - collect::CollectAnimation, combomelee::ComboAnimation, consume::ConsumeAnimation, - dance::DanceAnimation, dash::DashAnimation, divemelee::DiveMeleeAnimation, - equip::EquipAnimation, finishermelee::FinisherMeleeAnimation, glidewield::GlideWieldAnimation, - gliding::GlidingAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapAnimation, - mount::MountAnimation, music::MusicAnimation, pet::PetAnimation, - rapidmelee::RapidMeleeAnimation, repeater::RepeaterAnimation, - ripostemelee::RiposteMeleeAnimation, roll::RollAnimation, run::RunAnimation, - selfbuff::SelfBuffAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation, - sit::SitAnimation, sleep::SleepAnimation, sneak::SneakAnimation, - sneakequip::SneakEquipAnimation, sneakwield::SneakWieldAnimation, - staggered::StaggeredAnimation, stand::StandAnimation, steer::SteerAnimation, - stunned::StunnedAnimation, swim::SwimAnimation, swimwield::SwimWieldAnimation, - talk::TalkAnimation, wallrun::WallrunAnimation, wield::WieldAnimation, + basic::{BasicAction, BasicActionDependency}, + boost::BoostAnimation, + climb::ClimbAnimation, + collect::CollectAnimation, + consume::ConsumeAnimation, + dance::DanceAnimation, + equip::EquipAnimation, + glidewield::GlideWieldAnimation, + gliding::GlidingAnimation, + idle::IdleAnimation, + jump::JumpAnimation, + mount::MountAnimation, + multi::{MultiAction, MultiActionDependency}, + music::MusicAnimation, + pet::PetAnimation, + roll::RollAnimation, + run::RunAnimation, + sit::SitAnimation, + sleep::SleepAnimation, + sneak::SneakAnimation, + sneakequip::SneakEquipAnimation, + sneakwield::SneakWieldAnimation, + staggered::StaggeredAnimation, + stand::StandAnimation, + steer::SteerAnimation, + stunned::StunnedAnimation, + swim::SwimAnimation, + swimwield::SwimWieldAnimation, + talk::TalkAnimation, + wallrun::WallrunAnimation, + wield::WieldAnimation, }; use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton, TrailSource}; use common::comp::{ diff --git a/voxygen/anim/src/character/combomelee.rs b/voxygen/anim/src/character/multi.rs similarity index 63% rename from voxygen/anim/src/character/combomelee.rs rename to voxygen/anim/src/character/multi.rs index de42458814..33f2918fd8 100644 --- a/voxygen/anim/src/character/combomelee.rs +++ b/voxygen/anim/src/character/multi.rs @@ -1,28 +1,39 @@ use super::{ super::{vek::*, Animation}, - hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, + dual_wield_start, hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, +}; +use common::{ + states::utils::{AbilityInfo, HandInfo, StageSection}, + util::Dir, }; -use common::states::utils::{AbilityInfo, HandInfo, StageSection}; use core::f32::consts::{PI, TAU}; +use std::ops::{Mul, Sub}; -pub struct ComboAnimation; -impl Animation for ComboAnimation { - type Dependency<'a> = ( - Option<&'a str>, - Option, - Option, - usize, - Vec2, - ); +pub struct MultiAction; + +pub struct MultiActionDependency<'a> { + pub ability_id: Option<&'a str>, + pub stage_section: Option, + pub ability_info: Option, + pub current_action: u32, + pub max_actions: Option, + pub move_dir: Vec2, + pub orientation: Vec3, + pub look_dir: Dir, + pub velocity: Vec3, +} + +impl Animation for MultiAction { + type Dependency<'a> = MultiActionDependency<'a>; type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_combo\0"; + const UPDATE_FN: &'static [u8] = b"character_multi\0"; - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_combo")] + #[cfg_attr(feature = "be-dyn-lib", export_name = "character_multi")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (ability_id, stage_section, _ability_info, current_strike, move_dir): Self::Dependency<'_>, + d: Self::Dependency<'_>, anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, @@ -34,19 +45,35 @@ impl Animation for ComboAnimation { 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); - if matches!(stage_section, Some(StageSection::Action)) { + if matches!(d.stage_section, Some(StageSection::Action)) { next.main_weapon_trail = true; next.off_weapon_trail = true; } - let multi_strike_pullback = 1.0 - - if matches!(stage_section, Some(StageSection::Recover)) { + let multi_action_pullback = 1.0 + - if matches!(d.stage_section, Some(StageSection::Recover)) { anim_time.powi(4) } else { 0.0 }; - for strike in 0..=current_strike { - match ability_id { + for action in 0..=d.current_action { + let (move1base, move2base, move3base) = if action == d.current_action { + match d.stage_section { + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Action) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), + _ => (0.0, 0.0, 0.0), + } + } else { + (1.0, 1.0, 1.0) + }; + let move1 = move1base * multi_action_pullback; + let move2 = move2base * multi_action_pullback; + + match d.ability_id { + // ================================== + // SWORD + // ================================== Some( "common.abilities.sword.basic_double_slash" | "common.abilities.sword.heavy_double_slash" @@ -55,23 +82,11 @@ impl Animation for ComboAnimation { | "common.abilities.sword.crippling_double_slash" | "common.abilities.sword.cleaving_double_slash", ) => { - let (move1, move2, move2alt) = if strike == current_strike { - match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => { - (1.0, anim_time.powi(2), anim_time.powf(0.25)) - }, - Some(StageSection::Recover) => (1.0, 1.0, 1.0), - _ => (0.0, 0.0, 0.0), - } - } else { - (1.0, 1.0, 1.0) - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - let move2alt = move2alt * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; + let move2alt = move2base.powf(0.25) * multi_action_pullback; - match strike { + match action { 0 => { next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3) @@ -115,19 +130,6 @@ impl Animation for ComboAnimation { } }, Some("common.abilities.sword.heavy_sweep") => { - let (move1, move2) = if strike == current_strike { - match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0), - Some(StageSection::Action) => (1.0, anim_time), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - } - } else { - (1.0, 1.0) - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); @@ -147,14 +149,8 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * 24.0, 0.0, 0.0); }, Some("common.abilities.sword.heavy_pommel_strike") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -181,14 +177,8 @@ impl Animation for ComboAnimation { next.control.orientation.rotate_z(move2 * 0.4); }, Some("common.abilities.sword.agile_quick_draw") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -215,14 +205,8 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * 9.0, move2 * 4.0, 0.0); }, Some("common.abilities.sword.agile_feint") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -236,7 +220,7 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(0.0, 0.0, move1 * 4.0); // Right feint if x < 0, else left - if move_dir.x < 0.0 { + if d.move_dir.x < 0.0 { next.chest.orientation = Quaternion::rotation_z(move1 * -0.5); next.head.orientation = Quaternion::rotation_z(move1 * 0.3); next.shorts.orientation = Quaternion::rotation_z(move1 * 0.4); @@ -264,14 +248,8 @@ impl Animation for ComboAnimation { } }, Some("common.abilities.sword.defensive_disengage") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -299,14 +277,8 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * 12.0, 0.0, 0.0); }, Some("common.abilities.sword.crippling_gouge") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -333,19 +305,9 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(0.0, move2 * 6.0, move2 * -3.0); }, Some("common.abilities.sword.crippling_hamstring") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - - let move2alt = move2.min(0.5) * 2.0; - let move2 = (move2.max(0.5) - 0.5) * 2.0; - - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - let move2alt = move2alt * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = (move2base.powi(2).max(0.5) - 0.5) * 2.0 * multi_action_pullback; + let move2alt = move2base.powi(2).min(0.5) * 2.0 * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -380,20 +342,10 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * 14.0, move2 * 3.0, move2 * 6.0); }, Some("common.abilities.sword.offensive_combo") => { - let (move1, move2) = if strike == current_strike { - match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - } - } else { - (1.0, 1.0) - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; - match strike { + match action { 0 => { next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3) @@ -481,14 +433,8 @@ impl Animation for ComboAnimation { | "common.abilities.sword.crippling_crescent_slash" | "common.abilities.sword.cleaving_crescent_slash", ) => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -527,14 +473,8 @@ impl Animation for ComboAnimation { | "common.abilities.sword.crippling_fell_strike" | "common.abilities.sword.cleaving_fell_strike", ) => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powf(0.5)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powf(0.5) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -567,14 +507,8 @@ impl Animation for ComboAnimation { | "common.abilities.sword.crippling_skewer" | "common.abilities.sword.cleaving_skewer", ) => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -611,14 +545,8 @@ impl Animation for ComboAnimation { | "common.abilities.sword.crippling_cascade" | "common.abilities.sword.cleaving_cascade", ) => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -649,22 +577,11 @@ impl Animation for ComboAnimation { | "common.abilities.sword.crippling_cross_cut" | "common.abilities.sword.cleaving_cross_cut", ) => { - let (move1, move2) = if strike == current_strike { - match stage_section { - Some(StageSection::Buildup) => { - (((anim_time.max(0.4) - 0.4) * 1.5).powf(0.5), 0.0) - }, - Some(StageSection::Action) => (1.0, (anim_time.min(0.4) * 2.5).powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - } - } else { - (1.0, 1.0) - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = + ((move1base.max(0.4) - 0.4) * 1.5).powf(0.5) * multi_action_pullback; + let move2 = (move2base.min(0.4) * 2.5).powi(2) * multi_action_pullback; - match strike { + match action { 0 => { let fast1 = move1.min(0.2) * 5.0; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); @@ -724,20 +641,9 @@ impl Animation for ComboAnimation { | "common.abilities.sword.crippling_dual_cross_cut" | "common.abilities.sword.cleaving_dual_cross_cut", ) => { - let (move1, move2) = if strike == current_strike { - match stage_section { - Some(StageSection::Buildup) => { - (((anim_time.max(0.4) - 0.4) * 1.5).powf(0.5), 0.0) - }, - Some(StageSection::Action) => (1.0, (anim_time.min(0.4) * 2.5).powi(2)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - } - } else { - (1.0, 1.0) - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = + ((move1base.max(0.4) - 0.4) * 1.5).powf(0.5) * multi_action_pullback; + let move2 = (move2base.min(0.4) * 2.5).powi(2) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -766,14 +672,8 @@ impl Animation for ComboAnimation { next.control_r.position += Vec3::new(move2 * -8.0, move2 * 2.0, move2 * -9.0); }, Some("common.abilities.sword.crippling_bloody_gash") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powf(0.5)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powf(0.5) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -800,14 +700,8 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * -7.0, 0.0, move2 * 6.0); }, Some("common.abilities.sword.crippling_eviscerate") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powf(0.5)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powf(0.5) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -854,14 +748,8 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0); }, Some("common.abilities.sword.cleaving_sky_splitter") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), - Some(StageSection::Action) => (1.0, anim_time.powf(0.5)), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move1 = move1base.powf(0.25) * multi_action_pullback; + let move2 = move2base.powf(0.5) * multi_action_pullback; next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = @@ -881,99 +769,279 @@ impl Animation for ComboAnimation { next.control.orientation.rotate_x(move2 * 2.7); next.control.position += Vec3::new(0.0, move2 * -9.0, move2 * 17.0); }, - Some("common.abilities.axe.triple_chop") => { - let (move1, move2) = if strike == current_strike { - match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0), - Some(StageSection::Action) => (1.0, anim_time), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - } + Some( + "common.abilities.sword.cleaving_whirlwind_slice" + | "common.abilities.sword.cleaving_bladestorm" + | "common.abilities.sword.cleaving_dual_whirlwind_slice" + | "common.abilities.sword.cleaving_dual_bladestorm", + ) => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base * pullback; + let move2_no_pullback = move2base + d.current_action as f32; + let move2base = if d.current_action == 0 { + move2base } else { - (1.0, 1.0) + 1.0 }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; + let move2_pre = move2base.min(0.3) * 10.0 / 3.0 * pullback; + let move2 = move2base * pullback; - match strike { - 0 => { - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) - * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.ahr.3) - * Quaternion::rotation_z(s_a.ahr.5); + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = Vec3::new(-s_a.sc.0 + -6.0, -1.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(1.4); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1 * PI); - next.control.position = Vec3::new( - s_a.ac.0 + move1 * -1.0, - s_a.ac.1 + move1 * -4.0, - s_a.ac.2, - ); - next.control.orientation = - Quaternion::rotation_x(s_a.ac.3 + move1 * -1.5) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 + move1 * (0.4 - PI)); - - next.chest.orientation.rotate_z(move1 * 0.4); - next.head.orientation.rotate_z(move1 * -0.2); - next.belt.orientation.rotate_z(move1 * -0.1); - next.shorts.orientation.rotate_z(move1 * -0.2); - - next.chest.orientation.rotate_z(move2 * -0.6); - next.head.orientation.rotate_z(move2 * 0.3); - next.belt.orientation.rotate_z(move2 * 0.1); - next.shorts.orientation.rotate_z(move2 * 0.2); - next.control.orientation = next.control.orientation - * Quaternion::rotation_z(move2 * -0.5) - * Quaternion::rotation_x(move2 * 2.0); - next.control.orientation.rotate_y(move2 * -0.7); - next.control.position += Vec3::new(move2 * 15.0, 0.0, move2 * -4.0); - }, - 1 => { - next.chest.orientation.rotate_z(move1 * -0.2); - next.head.orientation.rotate_z(move1 * 0.1); - next.shorts.orientation.rotate_z(move1 * 0.1); - next.control.orientation.rotate_y(move1 * 0.9); - next.control.orientation.rotate_x(move1 * 1.5); - next.control.orientation.rotate_z(move1 * -0.4); - next.control.position += Vec3::new(move1 * 4.0, 0.0, move1 * 4.0); - - next.chest.orientation.rotate_z(move2 * 0.6); - next.head.orientation.rotate_z(move2 * -0.3); - next.belt.orientation.rotate_z(move2 * -0.1); - next.shorts.orientation.rotate_z(move2 * -0.2); - next.control.orientation = next.control.orientation - * Quaternion::rotation_z(move2 * 0.5) - * Quaternion::rotation_x(move2 * 2.0); - next.control.orientation.rotate_y(move2 * 0.7); - next.control.position += Vec3::new(move2 * -15.0, 0.0, move2 * -4.0); - }, - 2 => { - next.control.orientation.rotate_z(move1 * -0.4); - next.control.orientation.rotate_x(move1 * 2.5); - next.control.orientation.rotate_z(move1 * -1.0); - next.control.position += Vec3::new(move1 * -3.0, 0.0, move1 * 4.0); - - next.chest.orientation.rotate_z(move2 * -0.3); - next.head.orientation.rotate_z(move2 * 0.1); - next.shorts.orientation.rotate_z(move2 * 0.1); - next.control.orientation.rotate_x(move2 * -2.5); - next.control.orientation.rotate_z(move2 * -0.8); - next.control.position += Vec3::new(move2 * 5.0, 0.0, move2 * -6.0); - }, - _ => {}, + if move2 < f32::EPSILON { + next.main_weapon_trail = false; + next.off_weapon_trail = false; } + next.chest.orientation = Quaternion::rotation_z(move1 * 1.2); + next.head.orientation = Quaternion::rotation_z(move1 * -0.7); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.3); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.8); + next.control.orientation.rotate_x(move1 * 0.2); + next.foot_r + .orientation + .rotate_x(move1 * -0.4 + move2_pre * 0.4); + next.foot_r.orientation.rotate_z(move1 * 1.4); + + next.control.orientation.rotate_y(move2_pre * -1.6); + next.control.position += Vec3::new(0.0, 0.0, move2_pre * 4.0); + next.torso.orientation.rotate_z(move2_no_pullback * TAU); + next.chest.orientation.rotate_z(move2 * -2.0); + next.head.orientation.rotate_z(move2 * 1.3); + next.belt.orientation.rotate_z(move2 * 0.6); + next.shorts.orientation.rotate_z(move2 * 1.5); + next.foot_r.orientation.rotate_z(move2_pre * -1.7); + next.control.orientation.rotate_z(move2 * -1.8); + next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0); + }, + Some( + "common.abilities.sword.agile_perforate" + | "common.abilities.sword.agile_flurry", + ) => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = (move2base.min(0.5).mul(2.0).powi(2) + - move2base.max(0.5).sub(0.5).mul(2.0)) + * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.chest.orientation = Quaternion::rotation_z(move1 * 0.7); + next.head.orientation = Quaternion::rotation_z(move1 * -0.4); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); + next.control.orientation.rotate_x(move1 * -1.1); + next.control.orientation.rotate_z(move1 * -0.7); + next.control.position += Vec3::new(move1 * 1.0, move1 * -1.0, move1 * 4.0); + + next.chest.orientation.rotate_z(move2 * -1.2); + next.head.orientation.rotate_z(move2 * 0.6); + next.belt.orientation.rotate_z(move2 * 0.3); + next.shorts.orientation.rotate_z(move2 * 0.7); + next.control.orientation.rotate_z(move2 * 1.2); + next.control.position += Vec3::new(0.0, move2 * 12.0, 0.0); + }, + Some( + "common.abilities.sword.agile_dual_perforate" + | "common.abilities.sword.agile_dual_flurry", + ) => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = (move2base.min(0.5).mul(2.0).powi(2) + - move2base.max(0.5).sub(0.5).mul(2.0)) + * pullback; + let dir = if d.current_action % 2 == 1 { 1.0 } else { -1.0 }; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = Vec3::new(-s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.shl.3); + next.control_l.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control_l.orientation = Quaternion::rotation_x(s_a.sc.3); + next.control_r.position = Vec3::new(-s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control_r.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.control_l.orientation.rotate_x(move1 * -1.1); + next.control_l.orientation.rotate_z(move1 * 0.7); + next.control_l.position += Vec3::new(move1 * 1.0, move1 * -1.0, move1 * 4.0); + next.control_r.orientation.rotate_x(move1 * -1.1); + next.control_r.orientation.rotate_z(move1 * -0.7); + next.control_r.position += Vec3::new(move1 * -1.0, move1 * -1.0, move1 * 4.0); + + next.chest.orientation.rotate_z(move2 * -1.2 * dir); + next.head.orientation.rotate_z(move2 * 0.6 * dir); + next.belt.orientation.rotate_z(move2 * 0.3 * dir); + next.shorts.orientation.rotate_z(move2 * 0.7 * dir); + next.control_l + .orientation + .rotate_z(move2 * 1.2 * dir.max(0.0)); + next.control_l.position += Vec3::new(0.0, move2 * 18.0 * dir.max(0.0), 0.0); + next.control_r + .orientation + .rotate_z(move2 * 1.2 * dir.min(0.0)); + next.control_r.position += Vec3::new(0.0, move2 * 18.0 * -(dir.min(0.0)), 0.0); + next.control_l.orientation.rotate_z(move1 * -0.7); + next.control_r.orientation.rotate_z(move1 * 0.7); + }, + Some("common.abilities.sword.agile_hundred_cuts") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = move2base.powf(0.25) * pullback; + let (move2a, move2b, move2c, move2d) = match d.current_action % 4 { + 0 => (move2, 0.0, 0.0, 0.0), + 1 => (1.0, move2, 0.0, 0.0), + 2 => (1.0, 1.0, move2, 0.0), + 3 => (1.0, 1.0, 1.0, move2), + _ => (0.0, 0.0, 0.0, 0.0), + }; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.chest.orientation = Quaternion::rotation_z(move1 * 0.4); + next.head.orientation = Quaternion::rotation_z(move1 * -0.2); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.2); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.1); + next.control.orientation.rotate_y(move1 * -1.2); + next.control.position += Vec3::new(0.0, 0.0, move1 * 10.0); + + next.chest.orientation.rotate_z(move2a * -0.2); + next.control.orientation.rotate_z(move2a * -2.0); + next.control.position += Vec3::new(move2a * 12.0, 0.0, move2a * -6.0); + + next.chest.orientation.rotate_z(move2b * 0.2); + next.control.orientation.rotate_z(move2b * 2.9); + next.control.position += Vec3::new(move2b * -12.0, 0.0, 0.0); + + next.chest.orientation.rotate_z(move2c * -0.2); + next.control.orientation.rotate_z(move2c * -2.3); + next.control.position += Vec3::new(move2c * 12.0, 0.0, move2c * 12.0); + + next.chest.orientation.rotate_z(move2d * -0.2); + next.control.orientation.rotate_z(move2d * -2.7); + next.control.position += Vec3::new(move2d * 12.0, 0.0, move2a * -6.0); + }, + Some("common.abilities.sword.crippling_mutilate") => { + let pullback = 1.0 - move3base.powi(4); + let move1 = move1base.powf(0.25) * pullback; + let move2 = if d.current_action % 2 == 0 { + move2base + } else { + 1.0 - move2base + } * pullback; + + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = + Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); + next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3); + + next.chest.orientation = Quaternion::rotation_z(move1 * 0.7); + next.head.orientation = Quaternion::rotation_z(move1 * -0.4); + next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5); + next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); + next.control.orientation.rotate_x(move1 * -0.6); + next.control.orientation.rotate_z(move1 * -0.7); + next.control.position += Vec3::new(move1 * 1.0, move1 * -4.0, move1 * 4.0); + + next.chest.orientation.rotate_z(move2 * -1.2); + next.head.orientation.rotate_z(move2 * 0.6); + next.belt.orientation.rotate_z(move2 * 0.3); + next.shorts.orientation.rotate_z(move2 * 0.7); + next.control.orientation.rotate_z(move2 * 1.2); + next.control.position += Vec3::new(0.0, move2 * 14.0, move2 * 12.0); + }, + // ================================== + // AXE + // ================================== + Some("common.abilities.axe.triple_chop") => match action { + 0 => { + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = + Vec3::new(s_a.ac.0 + move1 * -1.0, s_a.ac.1 + move1 * -4.0, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3 + move1 * -1.5) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 + move1 * (0.4 - PI)); + + next.chest.orientation.rotate_z(move1 * 0.4); + next.head.orientation.rotate_z(move1 * -0.2); + next.belt.orientation.rotate_z(move1 * -0.1); + next.shorts.orientation.rotate_z(move1 * -0.2); + + next.chest.orientation.rotate_z(move2 * -0.6); + next.head.orientation.rotate_z(move2 * 0.3); + next.belt.orientation.rotate_z(move2 * 0.1); + next.shorts.orientation.rotate_z(move2 * 0.2); + next.control.orientation = next.control.orientation + * Quaternion::rotation_z(move2 * -0.5) + * Quaternion::rotation_x(move2 * 2.0); + next.control.orientation.rotate_y(move2 * -0.7); + next.control.position += Vec3::new(move2 * 15.0, 0.0, move2 * -4.0); + }, + 1 => { + next.chest.orientation.rotate_z(move1 * -0.2); + next.head.orientation.rotate_z(move1 * 0.1); + next.shorts.orientation.rotate_z(move1 * 0.1); + next.control.orientation.rotate_y(move1 * 0.9); + next.control.orientation.rotate_x(move1 * 1.5); + next.control.orientation.rotate_z(move1 * -0.4); + next.control.position += Vec3::new(move1 * 4.0, 0.0, move1 * 4.0); + + next.chest.orientation.rotate_z(move2 * 0.6); + next.head.orientation.rotate_z(move2 * -0.3); + next.belt.orientation.rotate_z(move2 * -0.1); + next.shorts.orientation.rotate_z(move2 * -0.2); + next.control.orientation = next.control.orientation + * Quaternion::rotation_z(move2 * 0.5) + * Quaternion::rotation_x(move2 * 2.0); + next.control.orientation.rotate_y(move2 * 0.7); + next.control.position += Vec3::new(move2 * -15.0, 0.0, move2 * -4.0); + }, + 2 => { + next.control.orientation.rotate_z(move1 * -0.4); + next.control.orientation.rotate_x(move1 * 2.5); + next.control.orientation.rotate_z(move1 * -1.0); + next.control.position += Vec3::new(move1 * -3.0, 0.0, move1 * 4.0); + + next.chest.orientation.rotate_z(move2 * -0.3); + next.head.orientation.rotate_z(move2 * 0.1); + next.shorts.orientation.rotate_z(move2 * 0.1); + next.control.orientation.rotate_x(move2 * -2.5); + next.control.orientation.rotate_z(move2 * -0.8); + next.control.position += Vec3::new(move2 * 5.0, 0.0, move2 * -6.0); + }, + _ => {}, }, Some("common.abilities.axe.brutal_swing") => { - let (move1, move2_raw) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0), - Some(StageSection::Action) => (1.0, anim_time), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2_raw * multi_strike_pullback; - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); @@ -989,18 +1057,9 @@ impl Animation for ComboAnimation { next.control.orientation.rotate_z(move2 * -3.5); next.control.position += Vec3::new(move2 * 12.0, move2 * 4.0, 0.0); - next.torso.orientation.rotate_z(move2_raw * -TAU); + next.torso.orientation.rotate_z(move2base * -TAU); }, Some("common.abilities.axe.rising_tide") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0), - Some(StageSection::Action) => (1.0, anim_time), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); @@ -1030,15 +1089,6 @@ impl Animation for ComboAnimation { next.control.orientation.rotate_z(move2 * -1.0); }, Some("common.abilities.axe.rake") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0), - Some(StageSection::Action) => (1.0, anim_time), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); @@ -1062,15 +1112,6 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * -6.0, move2 * -20.0, move2 * -4.0); }, Some("common.abilities.axe.skull_bash") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0), - Some(StageSection::Action) => (1.0, anim_time), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); @@ -1099,15 +1140,6 @@ impl Animation for ComboAnimation { next.control.position += Vec3::new(move2 * 9.0, move2 * 2.0, move2 * -5.0); }, Some("common.abilities.axe.plunder") => { - let (move1, move2) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0), - Some(StageSection::Action) => (1.0, anim_time), - Some(StageSection::Recover) => (1.0, 1.0), - _ => (0.0, 0.0), - }; - let move1 = move1 * multi_strike_pullback; - let move2 = move2 * multi_strike_pullback; - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); @@ -1133,20 +1165,198 @@ impl Animation for ComboAnimation { next.control.orientation.rotate_x(move2 * -1.2); next.control.position += Vec3::new(move2 * 8.0, 0.0, 0.0); }, - Some("common.abilities.shield.singlestrike") => { - let move1 = if strike == current_strike { - match stage_section { - Some(StageSection::Buildup) => anim_time, - Some(StageSection::Action) => 1.0, - Some(StageSection::Recover) => 1.0, - _ => 0.0, - } - } else { - 1.0 - }; - let move1 = move1 * multi_strike_pullback; + Some("common.abilities.axe.fierce_raze") => { + let move2 = (move2base.min(0.5).mul(2.0) + - move2base.max(0.5).sub(0.5).mul(2.0)) + * multi_action_pullback; - if let Some(ability_info) = _ability_info { + if anim_time > 0.5 { + next.main_weapon_trail = false; + next.off_weapon_trail = false; + } + + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI); + + next.chest.orientation.rotate_z(move1 * 0.7); + next.head.orientation.rotate_z(move1 * -0.3); + next.belt.orientation.rotate_z(move1 * -0.2); + next.shorts.orientation.rotate_z(move1 * -0.4); + next.control.orientation.rotate_x(move1 * -2.1); + next.control.orientation.rotate_z(move1 * -0.5); + next.control.position += Vec3::new(move1 * 6.0, move1 * -3.0, 0.0); + next.control.orientation.rotate_y(move1 * -0.3); + + next.chest.orientation.rotate_z(move2 * -1.8); + next.head.orientation.rotate_z(move2 * 0.8); + next.belt.orientation.rotate_z(move2 * 0.4); + next.shorts.orientation.rotate_z(move2 * 1.1); + next.control.orientation.rotate_x(move2 * -2.7); + next.control.position += Vec3::new(move2 * 4.0, 0.0, move2 * -7.0); + }, + Some("common.abilities.axe.dual_fierce_raze") => { + let move2 = (move2base.min(0.5).mul(2.0) + - move2base.max(0.5).sub(0.5).mul(2.0)) + * multi_action_pullback; + + if anim_time > 0.5 { + next.main_weapon_trail = false; + next.off_weapon_trail = false; + } + + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2 + -4.0); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + + next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); + next.control.orientation = Quaternion::rotation_x(s_a.ac.3) + * Quaternion::rotation_y(s_a.ac.4) + * Quaternion::rotation_z(s_a.ac.5); + next.control_r.position += Vec3::new(8.0, 0.0, 0.0); + + next.chest.orientation.rotate_z(move1 * 0.7); + next.head.orientation.rotate_z(move1 * -0.3); + next.belt.orientation.rotate_z(move1 * -0.2); + next.shorts.orientation.rotate_z(move1 * -0.4); + next.control.orientation.rotate_x(move1 * -2.1); + next.control.orientation.rotate_z(move1 * -0.5); + next.control.position += Vec3::new(move1 * 6.0, move1 * -3.0, 0.0); + next.control.orientation.rotate_y(move1 * -0.3); + + next.chest.orientation.rotate_z(move2 * -1.8); + next.head.orientation.rotate_z(move2 * 0.8); + next.belt.orientation.rotate_z(move2 * 0.4); + next.shorts.orientation.rotate_z(move2 * 1.1); + next.control.orientation.rotate_x(move2 * -2.7); + next.control.position += Vec3::new(move2 * 4.0, 0.0, move2 * -7.0); + }, + // ================================== + // HAMMER + // ================================== + Some("common.abilities.hammer.vigorous_bash") => { + hammer_start(&mut next, s_a); + twist_forward(&mut next, move1, 1.4, 0.7, 0.5, 0.9); + next.control.orientation.rotate_y(move1 * 0.3); + next.control.orientation.rotate_z(move1 * -0.3); + next.control.position += Vec3::new(12.0, -3.0, 3.0) * move1; + + twist_back(&mut next, move2, 1.8, 0.9, 0.6, 1.1); + next.control.orientation.rotate_z(move2 * -2.1); + next.control.orientation.rotate_x(move2 * 0.6); + next.control.position += Vec3::new(-20.0, 8.0, 0.0) * move2; + }, + Some("common.abilities.hammer.iron_tempest") => { + hammer_start(&mut next, s_a); + + let move2_tot = move2base + d.current_action as f32; + let move2 = + move2_tot / d.max_actions.map_or(1.0, |x| x as f32) * multi_action_pullback; + + twist_back(&mut next, move1, 2.0, 0.8, 0.3, 1.4); + next.control.orientation.rotate_x(move1 * 0.8); + next.control.position += Vec3::new(-15.0, 0.0, 6.0) * move1; + next.control.orientation.rotate_z(move1 * 1.2); + + next.torso.orientation.rotate_z(-TAU * move2_tot); + twist_forward(&mut next, move2, 3.0, 1.2, 0.5, 1.8); + next.control.orientation.rotate_z(move2 * -5.0); + next.control.position += Vec3::new(20.0, 0.0, 0.0) * move2; + }, + Some("common.abilities.hammer.dual_iron_tempest") => { + dual_wield_start(&mut next); + + let move2_tot = move2base + d.current_action as f32; + let move2 = + move2_tot / d.max_actions.map_or(1.0, |x| x as f32) * multi_action_pullback; + + twist_back(&mut next, move1, 2.0, 0.8, 0.3, 1.4); + next.control_l.orientation.rotate_y(move1 * -PI / 2.0); + next.control_r.orientation.rotate_y(move1 * -PI / 2.0); + next.control.orientation.rotate_z(move1 * 1.2); + next.control.position += Vec3::new(-10.0, 10.0, 6.0) * move1; + next.control_r.position += Vec3::new(0.0, -10.0, 0.0) * move1; + + next.torso.orientation.rotate_z(-TAU * move2_tot); + twist_forward(&mut next, move2, 3.0, 1.2, 0.5, 1.8); + next.control.orientation.rotate_z(move2 * -3.0); + next.control.position += Vec3::new(20.0, -10.0, 0.0) * move2; + next.control_r.position += Vec3::new(0.0, 10.0, 0.0) * move2; + next.control_l.position += Vec3::new(0.0, -10.0, 0.0) * move2; + }, + // ================================== + // BOW + // ================================== + Some("common.abilities.bow.repeater") => { + let speed = Vec2::::from(d.velocity).magnitude(); + let ori_angle = d.orientation.y.atan2(d.orientation.x); + let lookdir_angle = d.look_dir.y.atan2(d.look_dir.x); + let swivel = lookdir_angle - ori_angle; + + next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3); + next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = + Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); + + next.hold.position = Vec3::new(0.0, -1.0 + move2 * 2.0, -5.2); + next.hold.orientation = + Quaternion::rotation_x(-PI / 2.0) * Quaternion::rotation_z(0.0); + next.hold.scale = Vec3::one() * (1.0); + + next.chest.orientation = Quaternion::rotation_z(swivel * 0.8); + next.torso.orientation = Quaternion::rotation_z(swivel * 0.2); + + if speed < 0.5 { + next.foot_l.position = + Vec3::new(-s_a.foot.0 - 0.75, s_a.foot.1 + 4.0, s_a.foot.2); + next.foot_l.orientation = + Quaternion::rotation_x(0.2 + move1 * -0.1 + move2 * -0.2) + * Quaternion::rotation_z(move2 * 0.1); + + next.foot_r.position = Vec3::new(s_a.foot.0 + 0.75, s_a.foot.1, s_a.foot.2); + next.foot_r.orientation = + Quaternion::rotation_x(0.06 + move1 * -0.2 + move2 * -0.5) + * Quaternion::rotation_z(-0.6 + move2 * 0.8); + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); + next.chest.orientation = Quaternion::rotation_x(0.0); + }; + next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + 2.0, s_a.shorts.1); + next.shorts.orientation = Quaternion::rotation_x(0.2 + move2 * 0.2); + next.belt.position = Vec3::new(0.0, s_a.belt.0 + 1.0, s_a.belt.1); + next.belt.orientation = Quaternion::rotation_x(0.1 + move2 * 0.1); + next.control.position = + Vec3::new(s_a.bc.0 + 5.0, s_a.bc.1 + 3.0, s_a.bc.2 + 5.0); + next.control.orientation = Quaternion::rotation_x(s_a.bc.3 + 0.4) + * Quaternion::rotation_y(s_a.bc.4 + 0.8) + * Quaternion::rotation_z(s_a.bc.5); + next.head.orientation = + Quaternion::rotation_x(0.15) * Quaternion::rotation_y(0.15 + move1 * 0.05); + next.torso.orientation = Quaternion::rotation_x(0.25 + move2 * -0.2); + + next.hand_l.position = Vec3::new(0.0, -2.5 + move2 * -6.0, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.5) + * Quaternion::rotation_y(-0.0) + * Quaternion::rotation_z(-0.3); + }, + // ================================== + // SHIELD + // ================================== + Some("common.abilities.shield.singlestrike") => { + if let Some(ability_info) = d.ability_info { match ability_info.hand { Some(HandInfo::TwoHanded) => { next.main.orientation = Quaternion::rotation_x(0.0); @@ -1208,28 +1418,6 @@ impl Animation for ComboAnimation { } } }, - Some("common.abilities.hammer.vigorous_bash") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - twist_forward(&mut next, move1, 1.4, 0.7, 0.5, 0.9); - next.control.orientation.rotate_y(move1 * 0.3); - next.control.orientation.rotate_z(move1 * -0.3); - next.control.position += Vec3::new(12.0, -3.0, 3.0) * move1; - - twist_back(&mut next, move2, 1.8, 0.9, 0.6, 1.1); - next.control.orientation.rotate_z(move2 * -2.1); - next.control.orientation.rotate_x(move2 * 0.6); - next.control.position += Vec3::new(-20.0, 8.0, 0.0) * move2; - }, _ => {}, } } diff --git a/voxygen/anim/src/character/rapidmelee.rs b/voxygen/anim/src/character/rapidmelee.rs deleted file mode 100644 index a409fe9d7e..0000000000 --- a/voxygen/anim/src/character/rapidmelee.rs +++ /dev/null @@ -1,438 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - dual_wield_start, hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, -}; -use common::states::utils::{AbilityInfo, StageSection}; -use core::f32::consts::{PI, TAU}; -use std::ops::{Mul, Sub}; - -pub struct RapidMeleeAnimation; -impl Animation for RapidMeleeAnimation { - type Dependency<'a> = ( - Option<&'a str>, - Option, - (u32, Option), - Option, - ); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_rapid_melee\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_rapid_melee")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, stage_section, (current_strike, max_strikes), _ability_info): Self::Dependency< - '_, - >, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - 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); - if matches!(stage_section, Some(StageSection::Action)) { - next.main_weapon_trail = true; - next.off_weapon_trail = true; - } - - match ability_id { - Some( - "common.abilities.sword.cleaving_whirlwind_slice" - | "common.abilities.sword.cleaving_bladestorm" - | "common.abilities.sword.cleaving_dual_whirlwind_slice" - | "common.abilities.sword.cleaving_dual_bladestorm", - ) => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - - let move2_no_pullback = move2 + current_strike as f32; - let move2 = if current_strike == 0 { move2 } else { 1.0 }; - let move2_pre = move2.min(0.3) * 10.0 / 3.0; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - let move2_pre = move2_pre * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = Vec3::new(-s_a.sc.0 + -6.0, -1.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(1.4); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1 * PI); - - if move2 < f32::EPSILON { - next.main_weapon_trail = false; - next.off_weapon_trail = false; - } - next.chest.orientation = Quaternion::rotation_z(move1 * 1.2); - next.head.orientation = Quaternion::rotation_z(move1 * -0.7); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.3); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.8); - next.control.orientation.rotate_x(move1 * 0.2); - next.foot_r - .orientation - .rotate_x(move1 * -0.4 + move2_pre * 0.4); - next.foot_r.orientation.rotate_z(move1 * 1.4); - - next.control.orientation.rotate_y(move2_pre * -1.6); - next.control.position += Vec3::new(0.0, 0.0, move2_pre * 4.0); - next.torso.orientation.rotate_z(move2_no_pullback * TAU); - next.chest.orientation.rotate_z(move2 * -2.0); - next.head.orientation.rotate_z(move2 * 1.3); - next.belt.orientation.rotate_z(move2 * 0.6); - next.shorts.orientation.rotate_z(move2 * 1.5); - next.foot_r.orientation.rotate_z(move2_pre * -1.7); - next.control.orientation.rotate_z(move2 * -1.8); - next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0); - }, - Some( - "common.abilities.sword.agile_perforate" | "common.abilities.sword.agile_flurry", - ) => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => ( - 1.0, - anim_time.min(0.5).mul(2.0).powi(2) - anim_time.max(0.5).sub(0.5).mul(2.0), - 0.0, - ), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.chest.orientation = Quaternion::rotation_z(move1 * 0.7); - next.head.orientation = Quaternion::rotation_z(move1 * -0.4); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); - next.control.orientation.rotate_x(move1 * -1.1); - next.control.orientation.rotate_z(move1 * -0.7); - next.control.position += Vec3::new(move1 * 1.0, move1 * -1.0, move1 * 4.0); - - next.chest.orientation.rotate_z(move2 * -1.2); - next.head.orientation.rotate_z(move2 * 0.6); - next.belt.orientation.rotate_z(move2 * 0.3); - next.shorts.orientation.rotate_z(move2 * 0.7); - next.control.orientation.rotate_z(move2 * 1.2); - next.control.position += Vec3::new(0.0, move2 * 12.0, 0.0); - }, - Some( - "common.abilities.sword.agile_dual_perforate" - | "common.abilities.sword.agile_dual_flurry", - ) => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => ( - 1.0, - anim_time.min(0.5).mul(2.0).powi(2) - anim_time.max(0.5).sub(0.5).mul(2.0), - 0.0, - ), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - let dir = if current_strike % 2 == 1 { 1.0 } else { -1.0 }; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = Vec3::new(-s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.shl.3); - next.control_l.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control_l.orientation = Quaternion::rotation_x(s_a.sc.3); - next.control_r.position = Vec3::new(-s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control_r.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.control_l.orientation.rotate_x(move1 * -1.1); - next.control_l.orientation.rotate_z(move1 * 0.7); - next.control_l.position += Vec3::new(move1 * 1.0, move1 * -1.0, move1 * 4.0); - next.control_r.orientation.rotate_x(move1 * -1.1); - next.control_r.orientation.rotate_z(move1 * -0.7); - next.control_r.position += Vec3::new(move1 * -1.0, move1 * -1.0, move1 * 4.0); - - next.chest.orientation.rotate_z(move2 * -1.2 * dir); - next.head.orientation.rotate_z(move2 * 0.6 * dir); - next.belt.orientation.rotate_z(move2 * 0.3 * dir); - next.shorts.orientation.rotate_z(move2 * 0.7 * dir); - next.control_l - .orientation - .rotate_z(move2 * 1.2 * dir.max(0.0)); - next.control_l.position += Vec3::new(0.0, move2 * 18.0 * dir.max(0.0), 0.0); - next.control_r - .orientation - .rotate_z(move2 * 1.2 * dir.min(0.0)); - next.control_r.position += Vec3::new(0.0, move2 * 18.0 * -(dir.min(0.0)), 0.0); - next.control_l.orientation.rotate_z(move1 * -0.7); - next.control_r.orientation.rotate_z(move1 * 0.7); - }, - Some("common.abilities.sword.agile_hundred_cuts") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - let (move2a, move2b, move2c, move2d) = match current_strike % 4 { - 0 => (move2, 0.0, 0.0, 0.0), - 1 => (1.0, move2, 0.0, 0.0), - 2 => (1.0, 1.0, move2, 0.0), - 3 => (1.0, 1.0, 1.0, move2), - _ => (0.0, 0.0, 0.0, 0.0), - }; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.chest.orientation = Quaternion::rotation_z(move1 * 0.4); - next.head.orientation = Quaternion::rotation_z(move1 * -0.2); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.2); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.1); - next.control.orientation.rotate_y(move1 * -1.2); - next.control.position += Vec3::new(0.0, 0.0, move1 * 10.0); - - next.chest.orientation.rotate_z(move2a * -0.2); - next.control.orientation.rotate_z(move2a * -2.0); - next.control.position += Vec3::new(move2a * 12.0, 0.0, move2a * -6.0); - - next.chest.orientation.rotate_z(move2b * 0.2); - next.control.orientation.rotate_z(move2b * 2.9); - next.control.position += Vec3::new(move2b * -12.0, 0.0, 0.0); - - next.chest.orientation.rotate_z(move2c * -0.2); - next.control.orientation.rotate_z(move2c * -2.3); - next.control.position += Vec3::new(move2c * 12.0, 0.0, move2c * 12.0); - - next.chest.orientation.rotate_z(move2d * -0.2); - next.control.orientation.rotate_z(move2d * -2.7); - next.control.position += Vec3::new(move2d * 12.0, 0.0, move2a * -6.0); - }, - Some("common.abilities.sword.crippling_mutilate") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => ( - 1.0, - if current_strike % 2 == 0 { - anim_time - } else { - 1.0 - anim_time - }, - 0.0, - ), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.chest.orientation = Quaternion::rotation_z(move1 * 0.7); - next.head.orientation = Quaternion::rotation_z(move1 * -0.4); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); - next.control.orientation.rotate_x(move1 * -0.6); - next.control.orientation.rotate_z(move1 * -0.7); - next.control.position += Vec3::new(move1 * 1.0, move1 * -4.0, move1 * 4.0); - - next.chest.orientation.rotate_z(move2 * -1.2); - next.head.orientation.rotate_z(move2 * 0.6); - next.belt.orientation.rotate_z(move2 * 0.3); - next.shorts.orientation.rotate_z(move2 * 0.7); - next.control.orientation.rotate_z(move2 * 1.2); - next.control.position += Vec3::new(0.0, move2 * 14.0, move2 * 12.0); - }, - Some("common.abilities.axe.fierce_raze") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => ( - 1.0, - anim_time.min(0.5).mul(2.0) - anim_time.max(0.5).sub(0.5).mul(2.0), - 0.0, - ), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - if anim_time > 0.5 { - next.main_weapon_trail = false; - next.off_weapon_trail = false; - } - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 + move1 * -PI); - - next.chest.orientation.rotate_z(move1 * 0.7); - next.head.orientation.rotate_z(move1 * -0.3); - next.belt.orientation.rotate_z(move1 * -0.2); - next.shorts.orientation.rotate_z(move1 * -0.4); - next.control.orientation.rotate_x(move1 * -2.1); - next.control.orientation.rotate_z(move1 * -0.5); - next.control.position += Vec3::new(move1 * 6.0, move1 * -3.0, 0.0); - next.control.orientation.rotate_y(move1 * -0.3); - - next.chest.orientation.rotate_z(move2 * -1.8); - next.head.orientation.rotate_z(move2 * 0.8); - next.belt.orientation.rotate_z(move2 * 0.4); - next.shorts.orientation.rotate_z(move2 * 1.1); - next.control.orientation.rotate_x(move2 * -2.7); - next.control.position += Vec3::new(move2 * 4.0, 0.0, move2 * -7.0); - }, - Some("common.abilities.axe.dual_fierce_raze") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => ( - 1.0, - anim_time.min(0.5).mul(2.0) - anim_time.max(0.5).sub(0.5).mul(2.0), - 0.0, - ), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - if anim_time > 0.5 { - next.main_weapon_trail = false; - next.off_weapon_trail = false; - } - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2 + -4.0); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5); - next.control_r.position += Vec3::new(8.0, 0.0, 0.0); - - next.chest.orientation.rotate_z(move1 * 0.7); - next.head.orientation.rotate_z(move1 * -0.3); - next.belt.orientation.rotate_z(move1 * -0.2); - next.shorts.orientation.rotate_z(move1 * -0.4); - next.control.orientation.rotate_x(move1 * -2.1); - next.control.orientation.rotate_z(move1 * -0.5); - next.control.position += Vec3::new(move1 * 6.0, move1 * -3.0, 0.0); - next.control.orientation.rotate_y(move1 * -0.3); - - next.chest.orientation.rotate_z(move2 * -1.8); - next.head.orientation.rotate_z(move2 * 0.8); - next.belt.orientation.rotate_z(move2 * 0.4); - next.shorts.orientation.rotate_z(move2 * 1.1); - next.control.orientation.rotate_x(move2 * -2.7); - next.control.position += Vec3::new(move2 * 4.0, 0.0, move2 * -7.0); - }, - Some("common.abilities.hammer.iron_tempest") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2_tot = current_strike as f32 + move2; - let move2 = move2_tot / max_strikes.map_or(1.0, |x| x as f32); - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 2.0, 0.8, 0.3, 1.4); - next.control.orientation.rotate_x(move1 * 0.8); - next.control.position += Vec3::new(-15.0, 0.0, 6.0) * move1; - next.control.orientation.rotate_z(move1 * 1.2); - - next.torso.orientation.rotate_z(-TAU * move2_tot); - twist_forward(&mut next, move2, 3.0, 1.2, 0.5, 1.8); - next.control.orientation.rotate_z(move2 * -5.0); - next.control.position += Vec3::new(20.0, 0.0, 0.0) * move2; - }, - Some("common.abilities.hammer.dual_iron_tempest") => { - dual_wield_start(&mut next); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2_tot = current_strike as f32 + move2; - let move2 = move2_tot / max_strikes.map_or(1.0, |x| x as f32); - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 2.0, 0.8, 0.3, 1.4); - next.control_l.orientation.rotate_y(move1 * -PI / 2.0); - next.control_r.orientation.rotate_y(move1 * -PI / 2.0); - next.control.orientation.rotate_z(move1 * 1.2); - next.control.position += Vec3::new(-10.0, 10.0, 6.0) * move1; - next.control_r.position += Vec3::new(0.0, -10.0, 0.0) * move1; - - next.torso.orientation.rotate_z(-TAU * move2_tot); - twist_forward(&mut next, move2, 3.0, 1.2, 0.5, 1.8); - next.control.orientation.rotate_z(move2 * -3.0); - next.control.position += Vec3::new(20.0, -10.0, 0.0) * move2; - next.control_r.position += Vec3::new(0.0, 10.0, 0.0) * move2; - next.control_l.position += Vec3::new(0.0, -10.0, 0.0) * move2; - // next.control.position += Vec3::new(20.0, 0.0, 0.0) * move2; - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/repeater.rs b/voxygen/anim/src/character/repeater.rs deleted file mode 100644 index 75e3dc3090..0000000000 --- a/voxygen/anim/src/character/repeater.rs +++ /dev/null @@ -1,116 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - CharacterSkeleton, SkeletonAttr, -}; -use common::{ - comp::item::{Hands, ToolKind}, - states::utils::{AbilityInfo, StageSection}, - util::Dir, -}; -use core::f32::consts::PI; - -pub struct RepeaterAnimation; - -impl Animation for RepeaterAnimation { - type Dependency<'a> = ( - Option, - (Option, Option), - Vec3, - Dir, - Vec3, - f32, - Option, - ); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_repeater\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_repeater")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_info, hands, orientation,look_dir, velocity, _global_time, stage_section): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - let speed = Vec2::::from(velocity).magnitude(); - let ori_angle = orientation.y.atan2(orientation.x); - let lookdir_angle = look_dir.y.atan2(look_dir.x); - let swivel = lookdir_angle - ori_angle; - let (move1base, move2base, move3base, move4) = match stage_section { - Some(StageSection::Movement) => (anim_time, 0.0, 0.0, 0.0), - Some(StageSection::Buildup) => (1.0, anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, 1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move4; - let move1 = move1base * pullback; - let move2 = move2base * pullback; - let move3 = move3base * pullback; - // end spin stuff - - if let Some(ToolKind::Bow) = ability_info.and_then(|a| a.tool) { - next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3); - next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); - - next.hold.position = Vec3::new(0.0, -1.0 + move3 * 2.0, -5.2); - next.hold.orientation = Quaternion::rotation_x(-PI / 2.0) * Quaternion::rotation_z(0.0); - next.hold.scale = Vec3::one() * (1.0); - - next.chest.orientation = Quaternion::rotation_z(swivel * 0.8); - next.torso.orientation = Quaternion::rotation_z(swivel * 0.2); - - if speed < 0.5 { - next.foot_l.position = Vec3::new( - -s_a.foot.0 + move1 * -0.75, - s_a.foot.1 + move1 * 4.0, - s_a.foot.2, - ); - next.foot_l.orientation = - Quaternion::rotation_x(move1 * 0.2 + move2 * -0.1 + move3 * -0.2) - * Quaternion::rotation_z(move3 * 0.1); - - next.foot_r.position = Vec3::new(s_a.foot.0 + move1 * 0.75, s_a.foot.1, s_a.foot.2); - next.foot_r.orientation = - Quaternion::rotation_x(move1 * 0.06 + move2 * -0.2 + move3 * -0.5) - * Quaternion::rotation_z(move1 * -0.6 + move3 * 0.8); - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); - next.chest.orientation = Quaternion::rotation_x(0.0); - }; - next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + move1 * 2.0, s_a.shorts.1); - next.shorts.orientation = Quaternion::rotation_x(move1 * 0.2 + move3 * 0.2); - next.belt.position = Vec3::new(0.0, s_a.belt.0 + move1 * 1.0, s_a.belt.1); - next.belt.orientation = Quaternion::rotation_x(move1 * 0.1 + move3 * 0.1); - next.control.position = Vec3::new( - s_a.bc.0 + move1 * 5.0, - s_a.bc.1 + move1 * 3.0, - s_a.bc.2 + move1 * 5.0, - ); - next.control.orientation = Quaternion::rotation_x(s_a.bc.3 + move1 * 0.4) - * Quaternion::rotation_y(s_a.bc.4 + move1 * 0.8) - * Quaternion::rotation_z(s_a.bc.5); - next.head.orientation = Quaternion::rotation_x(move1 * 0.15) - * Quaternion::rotation_y(move1 * 0.15 + move2 * 0.05); - next.torso.orientation = Quaternion::rotation_x(move1 * 0.25 + move3 * -0.2); - - next.hand_l.position = Vec3::new(0.0, -2.5 + move3 * -6.0, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(1.5) - * Quaternion::rotation_y(-0.0) - * Quaternion::rotation_z(-0.3); - } - - if let (None, Some(Hands::Two)) = hands { - next.second = next.main; - } - - next - } -} diff --git a/voxygen/anim/src/character/ripostemelee.rs b/voxygen/anim/src/character/ripostemelee.rs deleted file mode 100644 index d08e9492d3..0000000000 --- a/voxygen/anim/src/character/ripostemelee.rs +++ /dev/null @@ -1,110 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, -}; -use common::states::utils::{AbilityInfo, StageSection}; - -pub struct RiposteMeleeAnimation; -impl Animation for RiposteMeleeAnimation { - type Dependency<'a> = (Option<&'a str>, Option, Option); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_riposte_melee\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_riposte_melee")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, stage_section, _ability_info): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - 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); - - if matches!(stage_section, Some(StageSection::Action)) { - next.main_weapon_trail = true; - next.off_weapon_trail = true; - } - - match ability_id { - Some("common.abilities.sword.defensive_riposte") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - - let move2_slow = move2.powi(4); - - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - let move2_slow = move2_slow * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3) - * Quaternion::rotation_z(move1 * 1.3 + move2 * -0.7); - - next.chest.orientation = Quaternion::rotation_z(move1 * 0.8); - next.head.orientation = Quaternion::rotation_z(move1 * -0.4); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.2); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5); - next.control.orientation.rotate_x(move1 * 0.5); - next.control.orientation.rotate_y(move1 * 2.1); - next.control.orientation.rotate_z(move1 * -0.5); - next.control.position += Vec3::new(0.0, move1 * 5.0, move1 * 8.0); - - next.chest.orientation.rotate_z(move2 * -1.4); - next.head.orientation.rotate_z(move2 * 0.9); - next.belt.orientation.rotate_z(move2 * -0.3); - next.shorts.orientation.rotate_z(move2 * 0.6); - next.control.orientation.rotate_y(move2 * -4.0); - next.control - .orientation - .rotate_z(move2_slow * -3.0 + move2 * 1.0); - next.control.position += - Vec3::new(move2_slow * 11.0, move2_slow * -4.0, move2_slow * -6.0); - }, - Some("common.abilities.hammer.retaliate") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 0.6, 0.2, 0.0, 0.3); - next.control.orientation.rotate_x(move1 * 1.5); - next.control.orientation.rotate_y(move1 * 0.4); - next.control.position += Vec3::new(0.0, 0.0, 16.0) * move1; - - twist_forward(&mut next, move2, 2.1, 0.6, 0.4, 0.9); - next.control.orientation.rotate_y(move2 * 2.0); - next.control.orientation.rotate_x(move2 * -2.5); - next.control.orientation.rotate_z(move2 * -0.6); - next.control.position += Vec3::new(6.0, -10.0, -14.0) * move2; - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/selfbuff.rs b/voxygen/anim/src/character/selfbuff.rs deleted file mode 100644 index fbe8fb29e1..0000000000 --- a/voxygen/anim/src/character/selfbuff.rs +++ /dev/null @@ -1,424 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - hammer_start, CharacterSkeleton, SkeletonAttr, -}; -use common::states::utils::{AbilityInfo, StageSection}; -use core::f32::consts::{PI, TAU}; - -pub struct SelfBuffAnimation; -impl Animation for SelfBuffAnimation { - type Dependency<'a> = (Option<&'a str>, Option, Option); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_self_buff\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_self_buff")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, stage_section, _ability_info): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - 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.heavy_fortitude") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.foot_l.position += Vec3::new(move1 * 1.0, move1 * 2.0, 0.0); - next.chest.orientation = Quaternion::rotation_z(move1 * -0.4); - next.head.orientation = Quaternion::rotation_z(move1 * 0.2); - next.shorts.orientation = Quaternion::rotation_z(move1 * 0.3); - next.belt.orientation = Quaternion::rotation_z(move1 * 0.1); - next.control.orientation.rotate_x(move1 * 0.4 + move2 * 0.6); - next.control.orientation.rotate_z(move1 * 0.4); - - next.foot_r.position += Vec3::new(move2 * -1.0, move2 * -2.0, 0.0); - next.control.position += Vec3::new(move2 * 5.0, move2 * 7.0, move2 * 5.0); - next.chest.position += Vec3::new(0.0, 0.0, move2 * -1.0); - next.shorts.orientation.rotate_x(move2 * 0.2); - next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0); - }, - Some("common.abilities.sword.defensive_stalwart_sword") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move2 * -0.5); - - next.foot_r.position += Vec3::new(move1 * 1.0, move1 * -2.0, 0.0); - next.foot_r.orientation.rotate_z(move1 * -0.9); - next.chest.orientation = Quaternion::rotation_z(move1 * -0.5); - next.head.orientation = Quaternion::rotation_z(move1 * 0.3); - next.shorts.orientation = Quaternion::rotation_z(move1 * 0.1); - next.control.orientation.rotate_x(move1 * 0.4); - next.control.orientation.rotate_z(move1 * 0.5); - next.control.position += Vec3::new(0.0, 0.0, move1 * 4.0); - - next.control.position += Vec3::new(move2 * 8.0, 0.0, move2 * -1.0); - next.control.orientation.rotate_x(move2 * -0.6); - next.chest.position += Vec3::new(0.0, 0.0, move2 * -2.0); - next.belt.position += Vec3::new(0.0, 0.0, move2 * 1.0); - next.shorts.position += Vec3::new(0.0, 0.0, move2 * 1.0); - next.shorts.orientation.rotate_x(move2 * 0.2); - next.control.orientation.rotate_z(move2 * 0.4); - }, - Some("common.abilities.sword.agile_dancing_edge") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.head.orientation = Quaternion::rotation_x(move1 * 0.3); - next.head.position += Vec3::new(0.0, 0.0, move1 * -1.0); - next.control.position += Vec3::new(move1 * 8.0, move1 * 5.0, 0.0); - - next.head.orientation.rotate_x(move2 * 0.2); - next.head.position += Vec3::new(0.0, 0.0, move2 * -1.0); - next.control.position += Vec3::new(0.0, move2 * -2.0, move2 * 12.0); - next.control.orientation.rotate_x(move2 * 1.1); - }, - Some("common.abilities.sword.cleaving_blade_fever") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = - Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0); - next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3); - - next.foot_l.position += Vec3::new(move1 * 1.0, move1 * 2.0, 0.0); - next.chest.orientation = Quaternion::rotation_z(move1 * -0.4); - next.head.orientation = Quaternion::rotation_z(move1 * 0.2); - next.shorts.orientation = Quaternion::rotation_z(move1 * 0.3); - next.belt.orientation = Quaternion::rotation_z(move1 * 0.1); - next.control.orientation.rotate_x(move1 * 0.4 + move2 * 0.6); - next.control.orientation.rotate_z(move1 * 0.4); - - next.foot_r.position += Vec3::new(move2 * -1.0, move2 * -2.0, 0.0); - next.control.position += Vec3::new(move2 * 5.0, move2 * 7.0, move2 * 5.0); - next.chest.position += Vec3::new(0.0, 0.0, move2 * -1.0); - next.shorts.orientation.rotate_x(move2 * 0.2); - next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0); - }, - Some("common.abilities.axe.berserk") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5); - - next.control.orientation.rotate_z(move1 * -2.0); - next.control.orientation.rotate_x(move1 * 3.5); - next.control.position += Vec3::new(move1 * 14.0, move1 * -6.0, move1 * 15.0); - - next.head.orientation.rotate_x(move2 * 0.6); - next.chest.orientation.rotate_x(move2 * 0.4); - }, - Some("common.abilities.axe.savage_sense") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5); - - next.chest.orientation = Quaternion::rotation_z(move1 * 0.6); - next.head.orientation = Quaternion::rotation_z(move1 * -0.2); - next.belt.orientation = Quaternion::rotation_z(move1 * -0.3); - next.shorts.orientation = Quaternion::rotation_z(move1 * -0.1); - next.foot_r.position += Vec3::new(0.0, move1 * 4.0, move1 * 4.0); - next.foot_r.orientation.rotate_x(move1 * 1.2); - - next.foot_r.position += Vec3::new(0.0, move2 * 4.0, move2 * -4.0); - next.foot_r.orientation.rotate_x(move2 * -1.2); - }, - Some("common.abilities.axe.adrenaline_rush") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); - - next.control.orientation.rotate_z(move1 * -1.8); - next.control.orientation.rotate_y(move1 * 1.5); - next.control.position += Vec3::new(move1 * 11.0, 0.0, 0.0); - - next.control.orientation.rotate_y(move2 * 0.7); - next.control.orientation.rotate_z(move2 * 1.6); - next.control.position += Vec3::new(move2 * -8.0, 0.0, move2 * -3.0); - }, - Some("common.abilities.axe.bloodfeast") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5); - - next.control.orientation.rotate_z(move1 * -3.4); - next.control.orientation.rotate_x(move1 * 1.1); - next.control.position += Vec3::new(move1 * 14.0, move1 * -3.0, 0.0); - - next.control.orientation.rotate_x(move2 * 1.7); - next.control.orientation.rotate_z(move2 * -1.3); - next.control.orientation.rotate_y(move2 * 0.8); - }, - Some("common.abilities.axe.furor") => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5 - move1 * PI); - - next.control.orientation.rotate_x(move1 * -1.0); - next.control.position += Vec3::new(move1 * 3.0, move1 * -2.0, move1 * 14.0); - next.control.orientation.rotate_z(move1 * 1.5); - - next.control.orientation.rotate_y(move2 * -1.0); - next.control.orientation.rotate_z(move2 * -1.6); - next.control.orientation.rotate_y(move2 * 0.7); - next.control.orientation.rotate_x(move2 * -0.5); - next.control.position += Vec3::new(move2 * 9.0, move2 * -3.0, move2 * -14.0); - }, - Some("common.abilities.axe.sunder") => { - let (move1_raw, move2_raw, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1_raw * pullback; - let move2 = move2_raw * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5); - - next.control.orientation.rotate_z(move1 * -1.5); - next.control.position += Vec3::new(move1 * 12.0, 0.0, move1 * 5.0); - next.control.orientation.rotate_y(move1 * 0.5); - next.main.position += Vec3::new(0.0, move1 * 10.0, 0.0); - next.main.orientation.rotate_z(move1_raw * TAU); - next.second.position += Vec3::new(0.0, move1 * 10.0, 0.0); - next.second.orientation.rotate_z(move1_raw * -TAU); - - next.main.orientation.rotate_z(move2_raw * TAU); - next.main.position += Vec3::new(0.0, move2 * -10.0, 0.0); - next.second.orientation.rotate_z(move2_raw * -TAU); - next.second.position += Vec3::new(0.0, move2 * -10.0, 0.0); - next.control.position += Vec3::new(0.0, 0.0, move2 * -5.0); - }, - Some("common.abilities.axe.defiance") => { - let (move1, tension, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, (anim_time * 20.0).sin(), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - - next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); - next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - - next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); - next.control.orientation = Quaternion::rotation_x(s_a.ac.3) - * Quaternion::rotation_y(s_a.ac.4) - * Quaternion::rotation_z(s_a.ac.5); - - next.control.orientation.rotate_z(move1 * -1.6); - next.control.orientation.rotate_x(move1 * 1.7); - next.control.position += Vec3::new(move1 * 12.0, move1 * -10.0, move1 * 18.0); - next.head.orientation.rotate_x(move1 * 0.6); - next.head.position += Vec3::new(0.0, 0.0, move1 * -3.0); - next.control.orientation.rotate_z(move1 * 0.4); - - next.head.orientation.rotate_x(tension * 0.3); - next.control.position += Vec3::new(0.0, 0.0, tension * 2.0); - }, - Some("common.abilities.hammer.tenacity") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.control.orientation.rotate_x(move1 * 0.6); - next.control.orientation.rotate_y(move1 * 0.9); - next.control.orientation.rotate_x(move1 * -0.6); - next.chest.orientation.rotate_x(move1 * 0.4); - next.control.position += Vec3::new(0.0, 4.0, 3.0) * move1; - - next.control.position += Vec3::new( - (move2 * 50.0).sin(), - (move2 * 67.0).sin(), - (move2 * 83.0).sin(), - ); - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/shockwave.rs b/voxygen/anim/src/character/shockwave.rs deleted file mode 100644 index 04a697761c..0000000000 --- a/voxygen/anim/src/character/shockwave.rs +++ /dev/null @@ -1,194 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr, -}; -use common::states::utils::StageSection; -use std::f32::consts::PI; - -pub struct Input { - pub attack: bool, -} -pub struct ShockwaveAnimation; - -impl Animation for ShockwaveAnimation { - type Dependency<'a> = (Option<&'a str>, f32, f32, Option); - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_shockwave\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_shockwave")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (ability_id, _global_time, velocity, stage_section): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let mut next = (*skeleton).clone(); - - if matches!(stage_section, Some(StageSection::Action)) { - next.main_weapon_trail = true; - next.off_weapon_trail = true; - } - - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - - match ability_id { - Some( - "common.abilities.staff.fireshockwave" - | "common.abilities.sceptre.healingaura" - | "common.abilities.sceptre.wardingaura", - ) => { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - - next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); - next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2); - next.control.orientation = - Quaternion::rotation_x(s_a.stc.3) * Quaternion::rotation_y(s_a.stc.4); - - let twist = move1 * 0.8; - - next.control.position = Vec3::new( - s_a.stc.0 + (move1 * 5.0) * (1.0 - move3), - s_a.stc.1 + (move1 * 5.0) * (1.0 - move3), - s_a.stc.2 + (move1 * 10.0 + move2 * -10.0) * (1.0 - move3), - ); - next.control.orientation = - Quaternion::rotation_x(s_a.stc.3 + (move1 * 0.8) * (1.0 - move3)) - * Quaternion::rotation_y( - s_a.stc.4 + (move1 * -0.15 + move2 * -0.15) * (1.0 - move3), - ) - * Quaternion::rotation_z((move1 * 0.8 + move2 * -0.8) * (1.0 - move3)); - - next.head.orientation = Quaternion::rotation_x((move1 * 0.4) * (1.0 - move3)) - * Quaternion::rotation_z((twist * 0.2 + move2 * -0.8) * (1.0 - move3)); - - next.chest.position = Vec3::new( - 0.0, - s_a.chest.0, - s_a.chest.1 + (move1 * 2.0 + move2 * -4.0) * (1.0 - move3), - ); - next.chest.orientation = Quaternion::rotation_x((move2 * -0.8) * (1.0 - move3)) - * Quaternion::rotation_z(twist * -0.2 + move2 * -0.1 + (1.0 - move3)); - - next.belt.orientation = Quaternion::rotation_x((move2 * 0.2) * (1.0 - move3)) - * Quaternion::rotation_z((twist * 0.6 + move2 * -0.48) * (1.0 - move3)); - - next.shorts.orientation = Quaternion::rotation_x((move2 * 0.3) * (1.0 - move3)) - * Quaternion::rotation_z((twist + move2 * -0.8) * (1.0 - move3)); - - if velocity < 0.5 { - next.foot_l.position = Vec3::new( - -s_a.foot.0, - s_a.foot.1 + move1 * -7.0 + move2 * 7.0, - s_a.foot.2, - ); - next.foot_l.orientation = Quaternion::rotation_x(move1 * -0.8 + move2 * 0.8) - * Quaternion::rotation_z(move1 * 0.3 + move2 * -0.3); - - next.foot_r.position = Vec3::new( - s_a.foot.0, - s_a.foot.1 + move1 * 5.0 + move2 * -5.0, - s_a.foot.2, - ); - next.foot_r.orientation = Quaternion::rotation_y(move1 * -0.3 + move2 * 0.3) - * Quaternion::rotation_z(move1 * 0.4 + move2 * -0.4); - } - }, - Some("common.abilities.hammer.tremor") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - twist_back(&mut next, move1, 1.4, 0.7, 0.5, 0.9); - next.foot_l.orientation.rotate_z(move1 * 1.4); - next.foot_l.position += Vec3::new(-1.0, -3.0, 0.0) * move1; - next.control.orientation.rotate_x(move1 * 2.6); - next.control.orientation.rotate_y(move1 * 0.8); - - twist_forward(&mut next, move2, 2.1, 1.2, 0.9, 1.6); - next.foot_l.orientation.rotate_z(move2 * -1.4); - next.foot_l.position += Vec3::new(2.0, 7.0, 0.0) * move2; - next.control.orientation.rotate_z(move2 * 2.1); - next.control.orientation.rotate_x(move2 * -2.0); - next.control.orientation.rotate_z(move2 * 1.2); - next.control.position += Vec3::new(-16.0, 0.0, 0.0) * move2; - next.chest.orientation.rotate_x(-0.8 * move2); - }, - Some("common.abilities.hammer.rampart") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.control.orientation.rotate_x(move1 * 0.6); - next.control.orientation.rotate_y(move1 * -PI / 2.0); - next.hand_l.orientation.rotate_y(move1 * -PI); - next.hand_r.orientation.rotate_y(move1 * -PI); - next.control.position += Vec3::new(-5.0, 0.0, 30.0) * move1; - - next.control.position += Vec3::new(0.0, 0.0, -10.0) * move2; - next.torso.orientation.rotate_x(move2 * -0.6); - next.control.orientation.rotate_x(move2 * 0.6); - }, - Some("common.abilities.hammer.seismic_shock") => { - hammer_start(&mut next, s_a); - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1 * pullback; - let move2 = move2 * pullback; - - next.control.orientation.rotate_x(move1 * 2.5); - next.control.position += Vec3::new(0.0, 0.0, 28.0) * move1; - next.head.orientation.rotate_x(move1 * 0.3); - next.chest.orientation.rotate_x(move1 * 0.3); - next.belt.orientation.rotate_x(move1 * -0.2); - next.shorts.orientation.rotate_x(move1 * -0.3); - - next.control.orientation.rotate_z(move2 * 2.0); - next.control.orientation.rotate_x(move2 * -4.0); - next.control.position += Vec3::new(-6.0, 0.0, -30.0) * move2; - next.head.orientation.rotate_x(move2 * -0.9); - next.chest.orientation.rotate_x(move2 * -0.5); - next.belt.orientation.rotate_x(move2 * 0.2); - next.shorts.orientation.rotate_x(move2 * 0.4); - }, - _ => {}, - } - - next - } -} diff --git a/voxygen/anim/src/character/shoot.rs b/voxygen/anim/src/character/shoot.rs deleted file mode 100644 index db2fccdfd6..0000000000 --- a/voxygen/anim/src/character/shoot.rs +++ /dev/null @@ -1,164 +0,0 @@ -use super::{ - super::{vek::*, Animation}, - CharacterSkeleton, SkeletonAttr, -}; -use common::{ - comp::item::{Hands, ToolKind}, - states::utils::{AbilityInfo, StageSection}, - util::Dir, -}; -use core::f32::consts::PI; - -pub struct ShootAnimation; - -type ShootAnimationDependency = ( - Option, - (Option, Option), - f32, - Vec3, - Vec3, - Dir, - f32, - Option, -); -impl Animation for ShootAnimation { - type Dependency<'a> = ShootAnimationDependency; - type Skeleton = CharacterSkeleton; - - #[cfg(feature = "use-dyn-lib")] - const UPDATE_FN: &'static [u8] = b"character_shoot\0"; - - #[cfg_attr(feature = "be-dyn-lib", export_name = "character_shoot")] - fn update_skeleton_inner( - skeleton: &Self::Skeleton, - ( - ability_info, - hands, - velocity, - orientation, - last_ori, - look_dir, - _global_time, - stage_section, - ): Self::Dependency<'_>, - anim_time: f32, - rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - *rate = 1.0; - let _speed = Vec2::::from(velocity).magnitude(); - - let mut next = (*skeleton).clone(); - - let lab: f32 = 1.0; - let ori: Vec2 = Vec2::from(orientation); - let last_ori = Vec2::from(last_ori); - let tilt = if vek::Vec2::new(ori, last_ori) - .map(|o| o.magnitude_squared()) - .map(|m| m > 0.001 && m.is_finite()) - .reduce_and() - && ori.angle_between(last_ori).is_finite() - { - ori.angle_between(last_ori).min(0.2) - * last_ori.determine_side(Vec2::zero(), ori).signum() - } else { - 0.0 - } * 1.3; - let ori_angle = orientation.y.atan2(orientation.x); - let lookdir_angle = look_dir.y.atan2(look_dir.x); - let swivel = lookdir_angle - ori_angle; - match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { - let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0), - }; - let xmove = (move1 * 6.0 * lab + PI).sin(); - let ymove = (move1 * 6.0 * lab + PI * (0.5)).sin(); - next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3); - - next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); - - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_y(0.0); - - next.control.position = Vec3::new( - s_a.stc.0 + (xmove * 3.0 + move1 * -4.0) * (1.0 - move3), - s_a.stc.1 + (2.0 + ymove * 3.0 + move2 * 3.0) * (1.0 - move3), - s_a.stc.2 + look_dir.z * 4.0, - ); - next.control.orientation = - Quaternion::rotation_x(look_dir.z + s_a.stc.3 + (move2 * 0.6) * (1.0 - move3)) - * Quaternion::rotation_y(s_a.stc.4 + (move1 * 0.5 + move2 * -0.5)) - * Quaternion::rotation_z( - s_a.stc.5 - (0.2 + move1 * -0.5 + move2 * 0.8) * (1.0 - move3), - ); - - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - next.head.orientation = Quaternion::rotation_x(look_dir.z * 0.7) - * Quaternion::rotation_z( - tilt * -2.5 + (move1 * -0.2 + move2 * -0.4) * (1.0 - move3), - ); - next.chest.orientation = Quaternion::rotation_z(swivel * 0.8); - next.torso.orientation = Quaternion::rotation_z(swivel * 0.2); - }, - Some(ToolKind::Bow) => { - let (_move1, move2, _move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), - Some(StageSection::Action) => (1.0, anim_time, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), - _ => (0.0, 0.0, 0.0), - }; - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new( - s_a.bhl.0 + move2 * -8.0, - s_a.bhl.1 + move2 * -10.0, - s_a.bhl.2, - ); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.bhl.3) * Quaternion::rotation_y(move2 * 0.7); - next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3); - - next.hold.position = Vec3::new(0.0, -1.0 + move2 * 2.0, -5.2 + move2 * 7.0); - next.hold.orientation = Quaternion::rotation_x(-PI / 2.0); - next.hold.scale = Vec3::one() * 1.0 * (1.0 - move2); - - next.control.position = Vec3::new( - s_a.bc.0 + 11.0 + move2 * 2.0, - s_a.bc.1 + 2.0 + (look_dir.z * -5.0).min(-2.0) + move2 * -1.0, - s_a.bc.2 + 8.0 + (look_dir.z * 15.0).max(-8.0), - ); - next.control.orientation = Quaternion::rotation_x(look_dir.z) - * Quaternion::rotation_y(-look_dir.z + s_a.bc.4 - 1.25) - * Quaternion::rotation_z(s_a.bc.5 - 0.2 + move2 * -0.1); - - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - - next.head.orientation = - Quaternion::rotation_x(look_dir.z * 0.7) * Quaternion::rotation_z(tilt * -0.0); - next.chest.orientation = Quaternion::rotation_z(swivel * 0.8 + 0.8 + move2 * 0.5); - next.torso.orientation = Quaternion::rotation_z(swivel * 0.2); - - next.shoulder_l.orientation = Quaternion::rotation_x(move2 * 0.5); - }, - _ => {}, - } - - next.back.orientation = Quaternion::rotation_x(-0.3); - - next.lantern.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0); - - if let (None, Some(Hands::Two)) = hands { - next.second = next.main; - } - - next - } -} diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index d4261e6ffe..f33c0b24aa 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -1160,6 +1160,9 @@ impl FigureMgr { // Average velocity relative to the current ground let rel_avg_vel = (state.avg_vel - physics.ground_vel) / scale; + let orientation = ori * anim::vek::Vec3::::unit_y(); + let last_ori = state.last_ori * anim::vek::Vec3::::unit_y(); + let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), _ => continue, @@ -1322,14 +1325,19 @@ impl FigureMgr { }, _ => 0.0, }; - anim::character::AlphaAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( + anim::character::BasicActionDependency { ability_id, hands, - Some(s.stage_section), - Some(s.static_data.ability_info), - ), + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1349,13 +1357,19 @@ impl FigureMgr { }, _ => 0.0, }; - anim::character::FinisherMeleeAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( + anim::character::BasicActionDependency { ability_id, - Some(s.stage_section), - Some(s.static_data.ability_info), - ), + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1382,14 +1396,19 @@ impl FigureMgr { .0 .powi(2) / vel.0.magnitude_squared(); - anim::character::DiveMeleeAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( + anim::character::BasicActionDependency { ability_id, - Some(s.stage_section), - ground_dist, - Some(s.static_data.ability_info), - ), + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: Some(ground_dist), + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1409,13 +1428,19 @@ impl FigureMgr { }, _ => 0.0, }; - anim::character::SelfBuffAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( + anim::character::BasicActionDependency { ability_id, - Some(s.stage_section), - Some(s.static_data.ability_info), - ), + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1435,19 +1460,19 @@ impl FigureMgr { _ => 0.0, }; - anim::character::ShootAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( - Some(s.static_data.ability_info), + anim::character::BasicActionDependency { + ability_id, hands, - rel_vel.magnitude(), - // TODO: Update to use the quaternion. - ori * anim::vek::Vec3::::unit_y(), - state.last_ori * anim::vek::Vec3::::unit_y(), + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, look_dir, - time, - Some(s.stage_section), - ), + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1467,19 +1492,19 @@ impl FigureMgr { _ => 0.0, }; - anim::character::ShootAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( - Some(s.static_data.ability_info), + anim::character::BasicActionDependency { + ability_id, hands, - rel_vel.magnitude(), - // TODO: Update to use the quaternion. - ori * anim::vek::Vec3::::unit_y(), - state.last_ori * anim::vek::Vec3::::unit_y(), + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, look_dir, - time, - Some(s.stage_section), - ), + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1507,10 +1532,19 @@ impl FigureMgr { }, _ => 0.0, }; - - anim::character::ChargeswingAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - (ability_id, s.stage_section), + anim::character::BasicActionDependency { + ability_id, + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1519,7 +1553,7 @@ impl FigureMgr { CharacterState::RepeaterRanged(s) => { let stage_time = s.timer.as_secs_f32(); - let stage_progress = match s.stage_section { + let progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.buildup_duration.as_secs_f32() }, @@ -1532,18 +1566,20 @@ impl FigureMgr { _ => 0.0, }; - anim::character::RepeaterAnimation::update_skeleton( + anim::character::MultiAction::update_skeleton( &target_base, - ( - Some(s.static_data.ability_info), - hands, - ori * anim::vek::Vec3::::unit_y(), + anim::character::MultiActionDependency { + ability_id, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + current_action: s.projectiles_fired, + max_actions: None, + move_dir, + orientation, look_dir, - rel_vel, - time, - Some(s.stage_section), - ), - stage_progress, + velocity: rel_vel, + }, + progress, &mut state_animation_rate, skeleton_attr, ) @@ -1616,9 +1652,19 @@ impl FigureMgr { }, _ => 0.0, }; - anim::character::DashAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - (ability_id, s.stage_section), + anim::character::BasicActionDependency { + ability_id, + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1638,9 +1684,19 @@ impl FigureMgr { }, _ => 0.0, }; - anim::character::ShockwaveAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - (ability_id, time, rel_vel.magnitude(), Some(s.stage_section)), + anim::character::BasicActionDependency { + ability_id, + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1660,11 +1716,19 @@ impl FigureMgr { }, _ => 0.0, }; - - // ? Aura confirmed just shockwave - anim::character::ShockwaveAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - (ability_id, time, rel_vel.magnitude(), Some(s.stage_section)), + anim::character::BasicActionDependency { + ability_id, + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1684,36 +1748,19 @@ impl FigureMgr { }, _ => 0.0, }; - - anim::character::ShockwaveAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - (ability_id, time, rel_vel.magnitude(), Some(s.stage_section)), - stage_progress, - &mut state_animation_rate, - skeleton_attr, - ) - }, - CharacterState::LeapMelee(s) => { - let stage_time = s.timer.as_secs_f32(); - let stage_progress = match s.stage_section { - StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f32() + anim::character::BasicActionDependency { + ability_id, + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, }, - StageSection::Movement => { - stage_time / s.static_data.movement_duration.as_secs_f32() - }, - StageSection::Action => { - stage_time / s.static_data.swing_duration.as_secs_f32() - }, - StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f32() - }, - _ => 0.0, - }; - - anim::character::LeapAnimation::update_skeleton( - &target_base, - (s.stage_section,), stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1721,7 +1768,7 @@ impl FigureMgr { }, CharacterState::RapidMelee(s) => { let stage_time = s.timer.as_secs_f32(); - let stage_progress = match s.stage_section { + let progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.buildup_duration.as_secs_f32() }, @@ -1734,15 +1781,20 @@ impl FigureMgr { _ => 0.0, }; - anim::character::RapidMeleeAnimation::update_skeleton( + anim::character::MultiAction::update_skeleton( &target_base, - ( + anim::character::MultiActionDependency { ability_id, - Some(s.stage_section), - (s.current_strike, s.static_data.max_strikes), - Some(s.static_data.ability_info), - ), - stage_progress, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + current_action: s.current_strike, + max_actions: s.static_data.max_strikes, + move_dir, + orientation, + look_dir, + velocity: rel_vel, + }, + progress, &mut state_animation_rate, skeleton_attr, ) @@ -1812,15 +1864,19 @@ impl FigureMgr { }, _ => 0.0, }; - anim::character::BeamAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( - Some(s.static_data.ability_info), + anim::character::BasicActionDependency { + ability_id, hands, - time, - rel_vel.magnitude(), - Some(s.stage_section), - ), + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -1843,15 +1899,19 @@ impl FigureMgr { _ => 0.0, }; - anim::character::ComboAnimation::update_skeleton( + anim::character::MultiAction::update_skeleton( &target_base, - ( + anim::character::MultiActionDependency { ability_id, - Some(s.stage_section), - Some(s.static_data.ability_info), - current_strike, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + current_action: current_strike as u32, + max_actions: Some(s.static_data.strikes.len() as u32), move_dir, - ), + orientation, + look_dir, + velocity: rel_vel, + }, progress, &mut state_animation_rate, skeleton_attr, @@ -1869,17 +1929,19 @@ impl FigureMgr { }, _ => 0.0, }; - anim::character::BlockAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( - hands, - active_tool_kind, - second_tool_kind, - rel_vel, + anim::character::BasicActionDependency { ability_id, - Some(s.stage_section), - Some(s.static_data.ability_info), - ), + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr, @@ -2115,14 +2177,19 @@ impl FigureMgr { }, _ => 0.0, }; - - anim::character::RiposteMeleeAnimation::update_skeleton( + anim::character::BasicAction::update_skeleton( &target_base, - ( + anim::character::BasicActionDependency { ability_id, - Some(s.stage_section), - Some(s.static_data.ability_info), - ), + hands, + stage_section: Some(s.stage_section), + ability_info: Some(s.static_data.ability_info), + velocity: rel_vel, + ground_dist: None, + last_ori, + orientation, + look_dir, + }, stage_progress, &mut state_animation_rate, skeleton_attr,