From 3d6a4ae4620a00083843b4c3f62f138fa1fcfd0c Mon Sep 17 00:00:00 2001 From: scott-c Date: Wed, 1 Jul 2020 17:51:06 +0800 Subject: [PATCH] Added ability to use 2 x 1h weapons or shields --- CHANGELOG.md | 1 + .../items/weapons/dagger/starter_dagger.ron | 4 +- .../common/items/weapons/shield/shield_1.ron | 4 +- .../voxel/humanoid_main_weapon_manifest.ron | 4 +- .../voxel/weapon/dagger/dagger_rusty.vox | Bin 1276 -> 1276 bytes assets/voxygen/voxel/weapon/shield/wood-0.vox | Bin 1512 -> 1512 bytes common/src/comp/inventory/item/mod.rs | 2 +- common/src/comp/inventory/item/tool.rs | 57 ++++- common/src/figure/mod.rs | 21 +- common/src/generation.rs | 7 + common/src/states/utils.rs | 49 +++- common/src/sys/stats.rs | 17 +- common/src/volumes/dyna.rs | 2 +- voxygen/src/anim/character/glidewield.rs | 8 +- voxygen/src/anim/src/character/alpha.rs | 139 +++++++++-- voxygen/src/anim/src/character/beta.rs | 20 +- voxygen/src/anim/src/character/block.rs | 15 +- voxygen/src/anim/src/character/blockidle.rs | 215 +++++++++++++++--- voxygen/src/anim/src/character/charge.rs | 22 +- voxygen/src/anim/src/character/climb.rs | 59 ++++- voxygen/src/anim/src/character/dance.rs | 50 +++- voxygen/src/anim/src/character/dash.rs | 110 ++++++++- voxygen/src/anim/src/character/equip.rs | 34 ++- voxygen/src/anim/src/character/glidewield.rs | 98 +++++++- voxygen/src/anim/src/character/gliding.rs | 45 +++- voxygen/src/anim/src/character/jump.rs | 60 ++++- voxygen/src/anim/src/character/roll.rs | 57 ++++- voxygen/src/anim/src/character/run.rs | 59 ++++- voxygen/src/anim/src/character/shoot.rs | 15 +- voxygen/src/anim/src/character/sit.rs | 55 ++++- voxygen/src/anim/src/character/spin.rs | 20 +- voxygen/src/anim/src/character/stand.rs | 54 ++++- voxygen/src/anim/src/character/swim.rs | 59 ++++- voxygen/src/anim/src/character/wield.rs | 115 ++++++++-- voxygen/src/hud/img_ids.rs | 4 + voxygen/src/hud/skillbar.rs | 132 ++++++----- voxygen/src/menu/char_selection/ui.rs | 2 +- voxygen/src/scene/figure/cache.rs | 15 +- voxygen/src/scene/figure/load.rs | 26 ++- voxygen/src/scene/figure/mod.rs | 91 ++++++-- 40 files changed, 1444 insertions(+), 303 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a433d61f68..e30efd1c49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added faction chat `/join_faction` `/faction` - Added regional, local, and global chat (`/region`, `/say`, and `/world`, respectively) - Added command shortcuts for each of the above chat modes (`/g`, `/f`, `/r`, `/s`, and `/w`, respectively and `/t` for `/tell`) +- Ability to wield 2 × 1h weapons and shields (Note: 1h weapons & shields are not currently avaliable, see [!1095](https://gitlab.com/veloren/veloren/-/merge_requests/1095) for more info) ### Changed diff --git a/assets/common/items/weapons/dagger/starter_dagger.ron b/assets/common/items/weapons/dagger/starter_dagger.ron index c4bd8891e6..98924729be 100644 --- a/assets/common/items/weapons/dagger/starter_dagger.ron +++ b/assets/common/items/weapons/dagger/starter_dagger.ron @@ -1,6 +1,6 @@ Item( - name: "Sharp Kitchen Knife", - description: "WIP", + name: "Rusty Dagger", + description: "One-Hand Dagger\n\nPower 5-6\n\n#writing.\n\n", kind: Tool( ( kind: Dagger(BasicDagger), diff --git a/assets/common/items/weapons/shield/shield_1.ron b/assets/common/items/weapons/shield/shield_1.ron index 6b4014ce7a..a9d2119ba8 100644 --- a/assets/common/items/weapons/shield/shield_1.ron +++ b/assets/common/items/weapons/shield/shield_1.ron @@ -1,6 +1,6 @@ Item( - name: "A Shield", - description: "WIP", + name: "A Tattered Targe", + description: "One-Hand Shield\n\nPower 5-6\n\n#writing.\n\n", kind: Tool ( ( kind: Shield(BasicShield), diff --git a/assets/voxygen/voxel/humanoid_main_weapon_manifest.ron b/assets/voxygen/voxel/humanoid_main_weapon_manifest.ron index 821c79343f..3ca33ada52 100644 --- a/assets/voxygen/voxel/humanoid_main_weapon_manifest.ron +++ b/assets/voxygen/voxel/humanoid_main_weapon_manifest.ron @@ -178,12 +178,12 @@ ), // Daggers Dagger(BasicDagger): ( - vox_spec: ("weapon.hammer.rusty_2h", (-2.5, -5.5, -4.0)), // TODO + vox_spec: ("weapon.dagger.dagger_rusty", (-1.5, -3.0, -3.0)), color: None ), // Shields Shield(BasicShield): ( - vox_spec: ("weapon.shield.wood-0", (-2.5, -6.5, -2.0)), + vox_spec: ("weapon.shield.wood-0", (-2.5, -5.5, -5.5)), color: None ), // Bows diff --git a/assets/voxygen/voxel/weapon/dagger/dagger_rusty.vox b/assets/voxygen/voxel/weapon/dagger/dagger_rusty.vox index 63ba5e9f0a90767b680603df8f23008428c2b7cb..50e7c501b3aa4c91eaa7117f8f4da14eabba7ad2 100644 GIT binary patch delta 216 zcmWm6yAc9032`lyzRY&c1eby+8IB6k3TT09hB1R?adxC6kzLeHTXwpkr^I>CCq|mM&)miMk7cM8 t7&F+lh_iId%9O~9XsfpDY(-Cr1{!IinHJmNp<)Ru4uP}to#)SQ3V+!Y8~y+Q delta 216 zcmW+wyA=X4472Pccex)7LCYW%^gx%e!zCRnunHYxF~Ailm-m!dwjz0pTYR5hK}3$k z?f$rY`L=T=pi_k*!8EJ-Clnd#611=IAwdYY6lkcbA;TQu*=yRaf`8OnZ5iS@3q^LW zNt&O<0_(24`XbFhBQaaeUA)r!Enf07R(UMJ!*wG-b#0?e2r%5uXniLH&Vn>6#5;qv|Nx@t2f$8(F|L5y@ znaE<5$3t0ko{wa4yZ?J_)weEQ?qBWE`*eEG)8m7UvhEz4s{i%8%X@c!zvtW4`q_2w Q@_gTaVf)@r;D09Y2^+q)-2eap literal 1512 zcmeH{O-oc^6vxkfdG5;?xN4(_uQP;Rm~fbiA(*io(~-&7NgbmRQOQY|ftes(qzh4) z1Q(4$LJWvTxshOcp-rvYw6H~ff_8n0fB##3g?2vhyXQXVp7TF1i+gWmx@})X(tSgB zY2=3znHb6@FZmZ9gEahOdL}z`r1@TvhyKITLZXOe(dwR9dPp>zIG*UXCno)d)hW8w zAsXMsqEFFBbfOW9@wVL|N?j4t*K!!Am`@v^hUM}*aa>OfEu<@>T_bFaF&fcBnzGw< zB06JC`VFH)Od}*FH57YMtf8o3@a|C4p|y#{7~Sy1WsGUEAKt~kGu|*eMNCgL`o*8c zWo`CvP)Fmey2%=x*YIKgrauR3+nm8+UpD;?aT#l~AII0Fet_1dw!?gv+5y(Exd(^1 zB*58i?#$uNT<$Eunu@v>QU0E(p_pg+DE4G}x?+wMU>-4vK~%sSzjLdP`}lL3nwrqs z+KON>i0B$G*`QYnm#j3ATAAe+r1m&;*cVFCGk9)&^y<#HKo zYin3vU&rR=CMuN*c6WDCtyXbxaDZB^hNGh+oSdBC^z;<?KEzV#k{{YVm^LSBS!ppT49B!2GYHJmr_XOw1f?w|i_)5NA2F`kb^8~sEy5LQE zh|EV2E5^|Gv=4(jgBU#+#nkI5ES@f+^r3{-+rtQsW#Q$P(fjBLZme!2zP*oR^%%p4 zb!6Xs!t&cMsBxBa_K%f@zw9J1+t`SYEiL#tJBz097$Wx%QK)`L^Jp`owJ3^bMbsvl TS7hEZ=3ShN4g9AK_& Hands { + match self { + ToolKind::Sword(_) => Hands::TwoHand, + ToolKind::Axe(_) => Hands::TwoHand, + ToolKind::Hammer(_) => Hands::TwoHand, + ToolKind::Bow(_) => Hands::TwoHand, + ToolKind::Dagger(_) => Hands::OneHand, + ToolKind::Staff(_) => Hands::TwoHand, + ToolKind::Shield(_) => Hands::OneHand, + ToolKind::Debug(_) => Hands::TwoHand, + ToolKind::Farming(_) => Hands::TwoHand, + ToolKind::Empty => Hands::OneHand, + } + } +} + +pub enum Hands { + OneHand, + TwoHand, +} + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum ToolCategory { Sword, @@ -271,14 +293,21 @@ impl Tool { projectile_gravity: Some(Gravity(0.05)), }, ], - Dagger(_) => vec![BasicMelee { - energy_cost: 0, - buildup_duration: Duration::from_millis(100), - recover_duration: Duration::from_millis(400), - base_healthchange: -5, - range: 3.5, - max_angle: 60.0, - }], + Dagger(_) => vec![ + BasicMelee { + energy_cost: 0, + buildup_duration: Duration::from_millis(100), + recover_duration: Duration::from_millis(400), + base_healthchange: -5, + range: 3.5, + max_angle: 60.0, + }, + DashMelee { + buildup_duration: Duration::from_millis(500), + recover_duration: Duration::from_millis(500), + base_damage: 20, + }, + ], Staff(StaffKind::BasicStaff) => vec![ BasicMelee { energy_cost: 0, @@ -359,7 +388,17 @@ impl Tool { max_angle: 45.0, }, ], - Shield(_) => vec![BasicBlock], + Shield(_) => vec![ + BasicMelee { + energy_cost: 0, + buildup_duration: Duration::from_millis(100), + recover_duration: Duration::from_millis(400), + base_healthchange: -4, + range: 3.0, + max_angle: 120.0, + }, + BasicBlock, + ], Debug(kind) => match kind { DebugKind::Boost => vec![ CharacterAbility::Boost { diff --git a/common/src/figure/mod.rs b/common/src/figure/mod.rs index aff29b0b06..211dd00161 100644 --- a/common/src/figure/mod.rs +++ b/common/src/figure/mod.rs @@ -18,7 +18,11 @@ use vek::*; pub type Segment = Dyna; impl From<&DotVoxData> for Segment { - fn from(dot_vox_data: &DotVoxData) -> Self { + fn from(dot_vox_data: &DotVoxData) -> Self { Segment::from_vox(dot_vox_data, false) } +} + +impl Segment { + pub fn from_vox(dot_vox_data: &DotVoxData, flipped: bool) -> Self { if let Some(model) = dot_vox_data.models.get(0) { let palette = dot_vox_data .palette @@ -36,11 +40,20 @@ impl From<&DotVoxData> for Segment { if let Some(&color) = palette.get(voxel.i as usize) { segment .set( - Vec3::new(voxel.x, voxel.y, voxel.z).map(i32::from), + Vec3::new( + if flipped { + model.size.x as u8 - 1 - voxel.x + } else { + voxel.x + }, + voxel.y, + voxel.z, + ) + .map(i32::from), Cell::new(color), ) .unwrap(); - } + }; } segment @@ -48,9 +61,7 @@ impl From<&DotVoxData> for Segment { Segment::filled(Vec3::zero(), Cell::empty(), ()) } } -} -impl Segment { /// Transform cells pub fn map(mut self, transform: impl Fn(Cell) -> Option) -> Self { for pos in self.full_pos_iter() { diff --git a/common/src/generation.rs b/common/src/generation.rs index 2a85e12b8f..d482a5b6b3 100644 --- a/common/src/generation.rs +++ b/common/src/generation.rs @@ -16,6 +16,7 @@ pub struct EntityInfo { pub body: Body, pub name: Option, pub main_tool: Option, + pub second_tool: Option, pub scale: f32, pub level: Option, pub loot_drop: Option, @@ -31,6 +32,7 @@ impl EntityInfo { body: Body::Humanoid(humanoid::Body::random()), name: None, main_tool: Some(Item::empty()), + second_tool: Some(Item::empty()), scale: 1.0, level: None, loot_drop: None, @@ -74,6 +76,11 @@ impl EntityInfo { self } + pub fn with_second_tool(mut self, second_tool: Item) -> Self { + self.second_tool = Some(second_tool); + self + } + pub fn with_loot_drop(mut self, loot_drop: Item) -> Self { self.loot_drop = Some(loot_drop); self diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index 539a2e12bd..ea99d4213c 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -1,6 +1,6 @@ use crate::{ comp::{ - item::{ItemKind, Tool}, + item::{Hands, ItemKind, Tool}, CharacterState, StateUpdate, }, event::LocalEvent, @@ -188,15 +188,44 @@ pub fn handle_ability1_input(data: &JoinData, update: &mut StateUpdate) { /// Will attempt to go into `loadout.active_item.ability2` pub fn handle_ability2_input(data: &JoinData, update: &mut StateUpdate) { if data.inputs.secondary.is_pressed() { - if let Some(ability) = data - .loadout - .active_item - .as_ref() - .and_then(|i| i.ability2.as_ref()) - .filter(|ability| ability.requirements_paid(data, update)) - { - update.character = ability.into(); - } + let active_tool_kind = match data.loadout.active_item.as_ref().map(|i| &i.item.kind) { + Some(ItemKind::Tool(Tool { kind, .. })) => Some(kind), + _ => None, + }; + + let second_tool_kind = match data.loadout.second_item.as_ref().map(|i| &i.item.kind) { + Some(ItemKind::Tool(Tool { kind, .. })) => Some(kind), + _ => None, + }; + + match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::TwoHand), _) => { + if let Some(ability) = data + .loadout + .active_item + .as_ref() + .and_then(|i| i.ability2.as_ref()) + .filter(|ability| ability.requirements_paid(data, update)) + { + update.character = ability.into(); + } + }, + (_, Some(Hands::OneHand)) => { + if let Some(ability) = data + .loadout + .second_item + .as_ref() + .and_then(|i| i.ability2.as_ref()) + .filter(|ability| ability.requirements_paid(data, update)) + { + update.character = ability.into(); + } + }, + (_, _) => {}, + }; } } diff --git a/common/src/sys/stats.rs b/common/src/sys/stats.rs index 2879b3f90d..3fb7384fe0 100644 --- a/common/src/sys/stats.rs +++ b/common/src/sys/stats.rs @@ -106,12 +106,25 @@ impl<'a> System<'a> for Sys { CharacterState::BasicMelee { .. } | CharacterState::DashMelee { .. } | CharacterState::TripleStrike { .. } - | CharacterState::BasicRanged { .. } - | CharacterState::BasicBlock { .. } => { + | CharacterState::BasicRanged { .. } => { if energy.get_unchecked().regen_rate != 0.0 { energy.get_mut_unchecked().regen_rate = 0.0 } }, + // recover small amount of pasive energy from blocking, and bonus energy from + // blocking attacks? + CharacterState::BasicBlock => { + let res = { + let energy = energy.get_unchecked(); + energy.current() < energy.maximum() + }; + + if res { + energy + .get_mut_unchecked() + .change_by(-3, EnergySource::Regen); + } + }, // Non-combat abilities that consume energy; // temporarily stall energy gain, but preserve regen_rate. CharacterState::Roll { .. } | CharacterState::Climb { .. } => {}, diff --git a/common/src/volumes/dyna.rs b/common/src/volumes/dyna.rs index 3475e6b0f2..5e2c6bc17b 100644 --- a/common/src/volumes/dyna.rs +++ b/common/src/volumes/dyna.rs @@ -18,7 +18,7 @@ pub enum DynaError { pub struct Dyna { vox: Vec, meta: M, - sz: Vec3, + pub sz: Vec3, _phantom: std::marker::PhantomData, } diff --git a/voxygen/src/anim/character/glidewield.rs b/voxygen/src/anim/character/glidewield.rs index 83d1cb2ee0..0b0985e64a 100644 --- a/voxygen/src/anim/character/glidewield.rs +++ b/voxygen/src/anim/character/glidewield.rs @@ -6,13 +6,13 @@ use vek::*; pub struct GlideWieldAnimation; impl Animation for GlideWieldAnimation { - type Dependency = (Option, Vec3, Vec3, Vec3, f64); + type Dependency = (Option, Option, Vec3, Vec3, Vec3, f64); type Skeleton = CharacterSkeleton; #[allow(clippy::useless_conversion)] // TODO: Pending review in #587 fn update_skeleton( skeleton: &Self::Skeleton, - (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, + (_active_tool_kind, _second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -191,7 +191,7 @@ impl Animation for GlideWieldAnimation { Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25); next.main.scale = Vec3::one(); - next.second.scale = Vec3::one() * 0.0; + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -279,7 +279,7 @@ impl Animation for GlideWieldAnimation { next.main.scale = Vec3::one(); next.second.offset = Vec3::new(0.0, 0.0, 0.0); - next.second.scale = Vec3::one() * 0.0; + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, diff --git a/voxygen/src/anim/src/character/alpha.rs b/voxygen/src/anim/src/character/alpha.rs index 4e79bb340e..1445463f42 100644 --- a/voxygen/src/anim/src/character/alpha.rs +++ b/voxygen/src/anim/src/character/alpha.rs @@ -1,12 +1,12 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; use vek::*; pub struct AlphaAnimation; impl Animation for AlphaAnimation { - type Dependency = (Option, f32, f64); + type Dependency = (Option, Option, f32, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +16,7 @@ impl Animation for AlphaAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, velocity, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, _global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -121,6 +121,94 @@ impl Animation for AlphaAnimation { * Quaternion::rotation_y(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; }, + Some(ToolKind::Dagger(_)) => { + next.head.offset = + Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); + next.head.ori = Quaternion::rotation_z(slow * -0.25) + * Quaternion::rotation_x(0.0 + slow * 0.15) + * Quaternion::rotation_y(slow * -0.15); + next.head.scale = Vec3::one() * skeleton_attr.head_scale; + + next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1); + next.chest.ori = Quaternion::rotation_z(slow * 0.4) + * Quaternion::rotation_x(0.0 + slow * -0.2) + * Quaternion::rotation_y(slow * 0.2); + next.chest.scale = Vec3::one(); + + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); + next.belt.ori = next.chest.ori * -0.3; + + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); + next.shorts.ori = next.chest.ori * -0.45; + + // TODO: Fix animation + next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(0.0); + next.l_hand.scale = Vec3::one() * 1.12; + + next.main.offset = Vec3::new(0.0, 0.0, 0.0); + next.main.ori = Quaternion::rotation_x(0.0); + + next.l_control.offset = Vec3::new(-10.0 + push * 5.0, 6.0 + push * 5.0, 2.0); + next.l_control.ori = Quaternion::rotation_x(-1.4 + slow * 0.4) + * Quaternion::rotation_y(slow * -1.3) + * Quaternion::rotation_z(1.4 + slow * -0.5); + next.l_control.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hand.ori = Quaternion::rotation_x(0.0); + next.r_hand.scale = Vec3::one() * 1.12; + + next.second.offset = Vec3::new(0.0, 0.0, 0.0); + next.second.ori = Quaternion::rotation_x(0.0); + + next.r_control.offset = Vec3::new(8.0, 0.0, 0.0); + next.r_control.ori = Quaternion::rotation_x(0.0); + next.r_control.scale = Vec3::one(); + + // next.r_control.offset = Vec3::new(-10.0 + push * 5.0, 6.0 + push * 5.0, 2.0); + // next.r_control.ori = Quaternion::rotation_x(-1.4 + slow * 0.4) + // * Quaternion::rotation_y(slow * -1.3) + // * Quaternion::rotation_z(1.4 + slow * -0.5); + // next.r_control.scale = Vec3::one(); + + // next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5); + // next.r_hand.ori = Quaternion::rotation_x(1.27); + // next.r_hand.scale = Vec3::one() * 1.05; + + // next.control.offset = Vec3::new(-10.0 + push * 5.0, 6.0 + push * 5.0, 2.0); + // next.control.ori = Quaternion::rotation_x(-1.4 + slow * 0.4) + // * Quaternion::rotation_y(slow * -1.3) + // * Quaternion::rotation_z(1.4 + slow * -0.5); + // next.control.scale = Vec3::one(); + + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + slow * -3.0 + quick * 3.0 - 4.0, + skeleton_attr.foot.2, + ); + next.l_foot.ori = Quaternion::rotation_x(slow * 0.6) + * Quaternion::rotation_y((slow * -0.2).max(0.0)); + next.l_foot.scale = Vec3::one(); + + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + slow * 3.0 + quick * -3.0 + 5.0, + skeleton_attr.foot.2, + ); + next.r_foot.ori = Quaternion::rotation_x(slow * -0.6) + * Quaternion::rotation_y((slow * 0.2).min(0.0)); + next.r_foot.scale = Vec3::one(); + + next.lantern.ori = + Quaternion::rotation_x(slow * -0.7 + 0.4) * Quaternion::rotation_y(slow * 0.4); + + next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; + next.torso.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0); + next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; + }, Some(ToolKind::Axe(_)) => { next.head.offset = Vec3::new( 0.0 + slowax * 2.0, @@ -312,35 +400,41 @@ impl Animation for AlphaAnimation { * Quaternion::rotation_x(0.0 + decel * -0.2) * Quaternion::rotation_y(decel * 0.2); - next.belt.offset = Vec3::new(0.0, 0.0, 5.0); + next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; + next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; + + next.belt.offset = Vec3::new(0.0, 0.0, 0.0); next.belt.ori = Quaternion::rotation_z(decel * -0.1) * Quaternion::rotation_x(0.0 + decel * -0.1) * Quaternion::rotation_y(decel * 0.1); - next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); + next.shorts.offset = Vec3::new(0.0, 0.0, 0.0); next.belt.ori = Quaternion::rotation_z(decel * -0.08) * Quaternion::rotation_x(0.0 + decel * -0.08) * Quaternion::rotation_y(decel * 0.08); - next.l_hand.offset = + + next.l_control.offset = Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0); - next.l_hand.ori = Quaternion::rotation_z(-0.8) + next.l_control.ori = Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + accel_med * -0.8) * Quaternion::rotation_y(0.0 + accel_med * -0.4); + + next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(0.0); next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = - Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0); - next.r_hand.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + accel_med * -0.8) - * Quaternion::rotation_y(0.0 + accel_med * -0.4); + next.main.offset = Vec3::new(0.0, 0.0, 0.0); + next.main.ori = Quaternion::rotation_z(0.0); + + next.r_control.offset = Vec3::new(8.0, 0.0, 0.0); + next.r_control.ori = Quaternion::rotation_x(0.0); + + next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hand.ori = Quaternion::rotation_x(0.0); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0); - next.main.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + accel_med * -0.8) - * Quaternion::rotation_y(0.0 + accel_med * -0.4); - next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; - next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; + next.second.offset = Vec3::new(0.0, 0.0, 0.0); + next.second.ori = Quaternion::rotation_x(0.0); }, Some(ToolKind::Debug(_)) => { next.head.offset = Vec3::new( @@ -393,6 +487,15 @@ impl Animation for AlphaAnimation { next.glider.scale = Vec3::one() * 0.0; next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/beta.rs b/voxygen/src/anim/src/character/beta.rs index c3ceb00365..293309be54 100644 --- a/voxygen/src/anim/src/character/beta.rs +++ b/voxygen/src/anim/src/character/beta.rs @@ -1,11 +1,11 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use vek::*; pub struct BetaAnimation; impl Animation for BetaAnimation { - type Dependency = (Option, f32, f64); + type Dependency = (Option, Option, f32, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for BetaAnimation { #[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _velocity, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, _velocity, _global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -44,7 +44,10 @@ impl Animation for BetaAnimation { match active_tool_kind { //TODO: Inventory - Some(ToolKind::Axe(_)) | Some(ToolKind::Hammer(_)) | Some(ToolKind::Sword(_)) => { + Some(ToolKind::Axe(_)) + | Some(ToolKind::Hammer(_)) + | Some(ToolKind::Sword(_)) + | Some(ToolKind::Dagger(_)) => { //INTENTION: SWORD next.head.offset = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); @@ -131,6 +134,15 @@ impl Animation for BetaAnimation { next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/block.rs b/voxygen/src/anim/src/character/block.rs index 7dc6f6b382..06773c1946 100644 --- a/voxygen/src/anim/src/character/block.rs +++ b/voxygen/src/anim/src/character/block.rs @@ -1,5 +1,5 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; @@ -9,7 +9,7 @@ pub struct Input { pub struct BlockAnimation; impl Animation for BlockAnimation { - type Dependency = (Option, f64); + type Dependency = (Option, Option, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,7 +18,7 @@ impl Animation for BlockAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_block")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -209,6 +209,15 @@ impl Animation for BlockAnimation { next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/blockidle.rs b/voxygen/src/anim/src/character/blockidle.rs index bc36193dc3..01da60564c 100644 --- a/voxygen/src/anim/src/character/blockidle.rs +++ b/voxygen/src/anim/src/character/blockidle.rs @@ -1,5 +1,5 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; @@ -9,7 +9,7 @@ pub struct Input { pub struct BlockIdleAnimation; impl Animation for BlockIdleAnimation { - type Dependency = (Option, f64); + type Dependency = (Option, Option, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,7 +18,7 @@ impl Animation for BlockIdleAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_blockidle")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -44,22 +44,33 @@ impl Animation for BlockIdleAnimation { next.head.offset = Vec3::new( 0.0 + wave_slow_cos * 0.2, -1.0 + skeleton_attr.head.0, - skeleton_attr.head.1 + 19.5 + wave_ultra_slow * 0.2, + skeleton_attr.head.1 + wave_ultra_slow * 0.2, ); - next.head.ori = Quaternion::rotation_x(-0.25); + next.head.ori = Quaternion::rotation_x(0.0); next.head.scale = Vec3::one() * 1.01 * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 5.0 + wave_ultra_slow * 0.2); - next.chest.ori = - Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.01); + next.chest.offset = Vec3::new( + 0.0 + wave_slow_cos * 0.2, + 0.0, + skeleton_attr.chest.1 + wave_ultra_slow * 0.2, + ); + next.chest.ori = Quaternion::rotation_y(wave_ultra_slow_cos * 0.01); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 3.0 + wave_ultra_slow * 0.2); + next.belt.offset = Vec3::new( + 0.0 + wave_slow_cos * 0.2, + 0.0, + skeleton_attr.belt.1 + wave_ultra_slow * 0.2, + ); next.belt.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.008); next.belt.scale = Vec3::one() * 1.01; - next.shorts.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 1.0 + wave_ultra_slow * 0.2); + next.shorts.offset = Vec3::new( + 0.0 + wave_slow_cos * 0.2, + 0.0, + skeleton_attr.shorts.1 + wave_ultra_slow * 0.2, + ); next.shorts.ori = Quaternion::rotation_x(0.1); next.shorts.scale = Vec3::one(); @@ -122,30 +133,98 @@ impl Animation for BlockIdleAnimation { * Quaternion::rotation_z(-0.85); next.main.scale = Vec3::one(); }, - Some(ToolKind::Shield(_)) => { - next.l_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.5 + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.0 + wave_ultra_slow_cos * 0.5, - -2.0 + wave_ultra_slow * 1.0, - ); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 4.5 + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); + Some(ToolKind::Dagger(_)) => { + // hands should be larger when holding a dagger grip, + // also reduce flicker with overlapping polygons + let hand_scale = 1.12; + + next.control.offset = Vec3::new(0.0, 0.0, 0.0); + // next.control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.control.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.l_hand.scale = Vec3::one() * hand_scale; + + next.main.offset = Vec3::new(0.0, 0.0, 0.0); + next.main.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); next.main.scale = Vec3::one(); + + next.l_control.offset = Vec3::new(-7.0, 0.0, 0.0); + // next.l_control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.l_control.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.r_hand.scale = Vec3::one() * hand_scale; + + next.second.offset = Vec3::new(0.0, 0.0, 0.0); + next.second.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.second.scale = Vec3::one(); + + next.r_control.offset = Vec3::new(7.0, 0.0, 0.0); + // next.r_control.ori = Quaternion::rotation_x(0.0 * PI) + // * Quaternion::rotation_y(0.0 * PI) + // * Quaternion::rotation_z(0.0 * PI); + // next.r_control.scale = Vec3::one(); + }, + Some(ToolKind::Shield(_)) => { + // hands should be larger when holding a dagger grip, + // also reduce flicker with overlapping polygons + let hand_scale = 1.12; + + next.control.offset = Vec3::new(0.0, 0.0, 0.0); + // next.control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.control.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.l_hand.scale = Vec3::one() * hand_scale; + + next.main.offset = Vec3::new(0.0, 0.0, 0.0); + next.main.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + + next.l_control.offset = Vec3::new(-7.0, 0.0, 0.0); + // next.l_control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.l_control.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.r_hand.scale = Vec3::one() * hand_scale; + + next.second.offset = Vec3::new(0.0, 0.0, 0.0); + next.second.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.second.scale = Vec3::one(); + + next.r_control.offset = Vec3::new(7.0, 0.0, 0.0); + // next.r_control.ori = Quaternion::rotation_x(0.0 * PI) + // * Quaternion::rotation_y(0.0 * PI) + // * Quaternion::rotation_z(0.0 * PI); + // next.r_control.scale = Vec3::one(); }, Some(ToolKind::Debug(_)) => { next.l_hand.offset = Vec3::new(-7.0, 3.5 + wave_ultra_slow * 2.0, 6.5); @@ -166,11 +245,64 @@ impl Animation for BlockIdleAnimation { }, _ => {}, } - next.l_foot.offset = Vec3::new(-3.4, 0.3, 8.0 + wave_ultra_slow_cos * 0.1); + + match second_tool_kind { + Some(ToolKind::Shield(_)) => { + // hands should be larger when holding a dagger grip, + // also reduce flicker with overlapping polygons + let hand_scale = 1.12; + + next.control.offset = Vec3::new(0.0, 0.0, 0.0); + // next.control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.control.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.l_hand.scale = Vec3::one() * hand_scale; + + next.main.offset = Vec3::new(0.0, 0.0, 0.0); + next.main.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.main.scale = Vec3::one(); + + next.l_control.offset = Vec3::new(-7.0, 0.0, 0.0); + // next.l_control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.l_control.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.r_hand.scale = Vec3::one() * hand_scale; + + next.second.offset = Vec3::new(0.0, 0.0, 0.0); + next.second.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.second.scale = Vec3::one(); + + next.r_control.offset = Vec3::new(3.0, 7.0, 5.0); + next.r_control.ori = Quaternion::rotation_x(0.5 * PI) + * Quaternion::rotation_y(0.5 * PI) + * Quaternion::rotation_z(0.0 * PI); + // next.r_control.scale = Vec3::one(); + }, + Some(ToolKind::Dagger(_)) => {}, + _ => {}, + } + + next.l_foot.offset = Vec3::new(-3.4, 0.3, skeleton_attr.foot.1 + wave_ultra_slow_cos * 0.1); next.l_foot.ori = Quaternion::rotation_x(-0.3); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, 1.2, 8.0 + wave_ultra_slow * 0.1); + next.r_foot.offset = Vec3::new(3.4, 1.2, skeleton_attr.foot.1 + wave_ultra_slow * 0.1); next.r_foot.ori = Quaternion::rotation_x(0.3); next.r_foot.scale = Vec3::one(); @@ -197,15 +329,24 @@ impl Animation for BlockIdleAnimation { skeleton_attr.lantern.2, ); next.lantern.ori = Quaternion::rotation_x(0.0); - next.lantern.scale = Vec3::one() * 0.0; + next.lantern.scale = Vec3::one(); next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; + next.control.scale = Vec3::one(); next.l_control.scale = Vec3::one(); - next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/charge.rs b/voxygen/src/anim/src/character/charge.rs index 817b96cb94..0563243364 100644 --- a/voxygen/src/anim/src/character/charge.rs +++ b/voxygen/src/anim/src/character/charge.rs @@ -1,12 +1,19 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; use vek::*; pub struct ChargeAnimation; impl Animation for ChargeAnimation { - type Dependency = (Option, f32, Vec3, Vec3, f64); + type Dependency = ( + Option, + Option, + f32, + Vec3, + Vec3, + f64, + ); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,7 +24,7 @@ impl Animation for ChargeAnimation { #[allow(clippy::useless_conversion)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -217,6 +224,15 @@ impl Animation for ChargeAnimation { next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/climb.rs b/voxygen/src/anim/src/character/climb.rs index cc3ff78184..1ef0618b6e 100644 --- a/voxygen/src/anim/src/character/climb.rs +++ b/voxygen/src/anim/src/character/climb.rs @@ -1,12 +1,18 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; use vek::*; pub struct ClimbAnimation; impl Animation for ClimbAnimation { - type Dependency = (Option, Vec3, Vec3, f64); + type Dependency = ( + Option, + Option, + Vec3, + Vec3, + f64, + ); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +21,7 @@ impl Animation for ClimbAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_climb")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, velocity, _orientation, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, _orientation, _global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -126,13 +132,41 @@ impl Animation for ClimbAnimation { next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new(-7.0, -5.0, 18.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + smootha * 0.25); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.offset = Vec3::new(0.0, 0.0, 0.0); - next.second.ori = Quaternion::rotation_y(0.0); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -152,6 +186,15 @@ impl Animation for ClimbAnimation { next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/dance.rs b/voxygen/src/anim/src/character/dance.rs index fd9ce57de3..8f3a8b573a 100644 --- a/voxygen/src/anim/src/character/dance.rs +++ b/voxygen/src/anim/src/character/dance.rs @@ -1,12 +1,12 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct DanceAnimation; impl Animation for DanceAnimation { - type Dependency = (Option, f64); + type Dependency = (Option, Option, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for DanceAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_dance")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -133,11 +133,41 @@ impl Animation for DanceAnimation { next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new(-7.0, -6.5, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + shorte * 0.25); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -160,6 +190,14 @@ impl Animation for DanceAnimation { next.r_control.scale = Vec3::one(); + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/dash.rs b/voxygen/src/anim/src/character/dash.rs index 173232d93c..1e91a9fd96 100644 --- a/voxygen/src/anim/src/character/dash.rs +++ b/voxygen/src/anim/src/character/dash.rs @@ -1,5 +1,5 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use vek::*; pub struct Input { @@ -8,7 +8,7 @@ pub struct Input { pub struct DashAnimation; impl Animation for DashAnimation { - type Dependency = (Option, f64); + type Dependency = (Option, Option, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,7 +18,7 @@ impl Animation for DashAnimation { #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, _global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -79,6 +79,101 @@ impl Animation for DashAnimation { next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, skeleton_attr.foot.2); next.r_foot.ori = Quaternion::rotation_x(foot * 0.4 - 0.8); }, + Some(ToolKind::Dagger(_)) => { + next.head.offset = Vec3::new( + 0.0, + -2.0 + skeleton_attr.head.0, + -2.0 + skeleton_attr.head.1, + ); + next.head.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0); + next.head.scale = Vec3::one() * skeleton_attr.head_scale; + + next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 2.0); + next.chest.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7); + + next.belt.offset = Vec3::new(0.0, 1.0, -1.0); + next.belt.ori = Quaternion::rotation_x(0.2) * Quaternion::rotation_z(0.2); + + next.shorts.offset = Vec3::new(0.0, 3.0, -3.0); + next.shorts.ori = Quaternion::rotation_x(0.4) * Quaternion::rotation_z(0.3); + + next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5); + next.l_hand.ori = Quaternion::rotation_x(1.27); + next.l_hand.scale = Vec3::one() * 1.04; + next.r_hand.offset = Vec3::new(0.75, -1.5, -5.5); + next.r_hand.ori = Quaternion::rotation_x(1.27); + next.r_hand.scale = Vec3::one() * 1.05; + next.main.offset = Vec3::new(0.0, 6.0, -1.0); + next.main.ori = Quaternion::rotation_x(-0.3); + next.main.scale = Vec3::one(); + + next.control.offset = Vec3::new(-8.0 - slow * 0.5, 3.0 - foot * 0.6, 3.0); + next.control.ori = + Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow * 0.2); + next.control.scale = Vec3::one(); + next.l_foot.offset = Vec3::new(-1.4, foot * 3.0 + 2.0, skeleton_attr.foot.2); + next.l_foot.ori = Quaternion::rotation_x(foot * -0.4 - 0.8); + + next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, skeleton_attr.foot.2); + next.r_foot.ori = Quaternion::rotation_x(foot * 0.4 - 0.8); + }, + _ => {}, + } + + match second_tool_kind { + //TODO: Inventory + Some(ToolKind::Dagger(_)) => { + next.head.offset = Vec3::new( + 0.0, + -2.0 + skeleton_attr.head.0, + -2.0 + skeleton_attr.head.1, + ); + next.head.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(0.0); + next.head.scale = Vec3::one() * skeleton_attr.head_scale; + + next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 2.0); + next.chest.ori = Quaternion::rotation_x(0.0); + + next.belt.offset = Vec3::new(0.0, 1.0, -1.0); + next.belt.ori = Quaternion::rotation_x(0.0); + + next.shorts.offset = Vec3::new(0.0, 3.0, -3.0); + next.shorts.ori = Quaternion::rotation_x(0.0); + + next.control.offset = Vec3::new(0.0, 0.0, 0.0); + next.control.ori = Quaternion::rotation_x(0.0); + next.control.scale = Vec3::one(); + + next.l_control.offset = Vec3::new(-8.0, -10.0, 0.0); + + next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(0.0); + next.l_hand.scale = Vec3::one() * 1.04; + + next.main.offset = Vec3::new(0.0, 0.0, 0.0); + next.main.ori = Quaternion::rotation_x(0.0); + next.main.scale = Vec3::one(); + + next.r_control.offset = Vec3::new(8.0, 10.0, 0.0); + + next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hand.ori = Quaternion::rotation_x(0.0); + next.r_hand.scale = Vec3::one() * 1.05; + + next.second.offset = Vec3::new(0.0, 6.0, -1.0); + next.second.ori = Quaternion::rotation_x(-0.3); + next.second.scale = Vec3::one(); + + next.l_foot.offset = Vec3::new(-1.4, foot * 3.0 + 2.0, skeleton_attr.foot.2); + next.l_foot.ori = Quaternion::rotation_x(foot * -0.4 - 0.8); + + next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, skeleton_attr.foot.2); + next.r_foot.ori = Quaternion::rotation_x(foot * 0.4 - 0.8); + }, _ => {}, } @@ -98,6 +193,15 @@ impl Animation for DashAnimation { next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/equip.rs b/voxygen/src/anim/src/character/equip.rs index 02676b33e3..c4f3d1c057 100644 --- a/voxygen/src/anim/src/character/equip.rs +++ b/voxygen/src/anim/src/character/equip.rs @@ -1,5 +1,5 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; @@ -7,7 +7,7 @@ use vek::*; pub struct EquipAnimation; impl Animation for EquipAnimation { - type Dependency = (Option, f32, f64); + type Dependency = (Option, Option, f32, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,7 +17,7 @@ impl Animation for EquipAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, velocity, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -151,15 +151,18 @@ impl Animation for EquipAnimation { next.control.scale = Vec3::one(); }, Some(ToolKind::Dagger(_)) => { - next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new(-6.0, 4.5, 0.0); - next.main.ori = Quaternion::rotation_x(-0.3); + // TODO: Fix animation + // next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0); + // next.l_hand.ori = Quaternion::rotation_x(-0.3); + // next.l_hand.scale = Vec3::one() * 1.01; + + // next.main.offset = Vec3::new(-6.0, 4.5, 0.0); + // next.main.ori = Quaternion::rotation_x(-0.3); next.main.scale = Vec3::one(); + + // next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); + // next.r_hand.ori = Quaternion::rotation_x(-0.3); + // next.r_hand.scale = Vec3::one() * 1.01; }, Some(ToolKind::Debug(_)) => { next.l_hand.offset = Vec3::new(-7.0, 4.0, 3.0); @@ -226,6 +229,15 @@ impl Animation for EquipAnimation { next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler; } + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/glidewield.rs b/voxygen/src/anim/src/character/glidewield.rs index 3e06f02d60..70646f2f95 100644 --- a/voxygen/src/anim/src/character/glidewield.rs +++ b/voxygen/src/anim/src/character/glidewield.rs @@ -1,12 +1,21 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct GlideWieldAnimation; +type GlideWieldAnimationDependency = ( + Option, + Option, + Vec3, + Vec3, + Vec3, + f64, +); + impl Animation for GlideWieldAnimation { - type Dependency = (Option, Vec3, Vec3, Vec3, f64); + type Dependency = GlideWieldAnimationDependency; type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +25,7 @@ impl Animation for GlideWieldAnimation { #[allow(clippy::useless_conversion)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -190,12 +199,41 @@ impl Animation for GlideWieldAnimation { next.r_shoulder.ori = Quaternion::rotation_x(short * -0.15 * walkintensity); next.r_shoulder.scale = Vec3::one() * 1.1; - next.main.offset = Vec3::new(-7.0, -6.5, 15.0); - next.main.ori = - Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -278,12 +316,41 @@ impl Animation for GlideWieldAnimation { ); next.r_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15; - next.main.offset = Vec3::new(-7.0, -5.0, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.offset = Vec3::new(0.0, 0.0, 0.0); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -303,6 +370,15 @@ impl Animation for GlideWieldAnimation { next.r_control.scale = Vec3::one(); } + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/gliding.rs b/voxygen/src/anim/src/character/gliding.rs index 5eb3da0ff9..704523b333 100644 --- a/voxygen/src/anim/src/character/gliding.rs +++ b/voxygen/src/anim/src/character/gliding.rs @@ -1,12 +1,21 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct GlidingAnimation; +type GlidingAnimationDependency = ( + Option, + Option, + Vec3, + Vec3, + Vec3, + f64, +); + impl Animation for GlidingAnimation { - type Dependency = (Option, Vec3, Vec3, Vec3, f64); + type Dependency = GlidingAnimationDependency; type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +25,7 @@ impl Animation for GlidingAnimation { #[allow(clippy::useless_conversion)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -122,11 +131,26 @@ impl Animation for GlidingAnimation { next.glider.ori = Quaternion::rotation_x(0.8) * Quaternion::rotation_y(slowa * 0.04); next.glider.scale = Vec3::one(); - next.main.offset = Vec3::new(-7.0, -5.0, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.main.scale = Vec3::one(); - next.second.scale = Vec3::one() * 0.0; + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -145,6 +169,15 @@ impl Animation for GlidingAnimation { next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/jump.rs b/voxygen/src/anim/src/character/jump.rs index b6033ca9b4..33730731c1 100644 --- a/voxygen/src/anim/src/character/jump.rs +++ b/voxygen/src/anim/src/character/jump.rs @@ -1,10 +1,17 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; +use std::f32::consts::PI; use vek::*; pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = (Option, Vec3, Vec3, f64); + type Dependency = ( + Option, + Option, + Vec3, + Vec3, + f64, + ); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -14,7 +21,7 @@ impl Animation for JumpAnimation { #[allow(clippy::useless_conversion)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, orientation, last_ori, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, orientation, last_ori, global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -144,13 +151,41 @@ impl Animation for JumpAnimation { next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new(-7.0, -5.0, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.offset = Vec3::new(0.0, 0.0, 0.0); - next.second.ori = Quaternion::rotation_y(0.0); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -176,6 +211,15 @@ impl Animation for JumpAnimation { next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/roll.rs b/voxygen/src/anim/src/character/roll.rs index fc31acf2d6..7a31246219 100644 --- a/voxygen/src/anim/src/character/roll.rs +++ b/voxygen/src/anim/src/character/roll.rs @@ -1,11 +1,18 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; +use std::f32::consts::PI; use vek::*; pub struct RollAnimation; impl Animation for RollAnimation { - type Dependency = (Option, Vec3, Vec3, f64); + type Dependency = ( + Option, + Option, + Vec3, + Vec3, + f64, + ); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +22,7 @@ impl Animation for RollAnimation { #[allow(clippy::useless_conversion)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, orientation, last_ori, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, orientation, last_ori, _global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -114,11 +121,40 @@ impl Animation for RollAnimation { next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new(-7.0, -5.0, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.offset = Vec3::new(0.0, 0.0, 0.0); + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( @@ -145,6 +181,15 @@ impl Animation for RollAnimation { next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/run.rs b/voxygen/src/anim/src/character/run.rs index 84da7ec394..a2877c1536 100644 --- a/voxygen/src/anim/src/character/run.rs +++ b/voxygen/src/anim/src/character/run.rs @@ -1,12 +1,21 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct RunAnimation; +type RunAnimationDependency = ( + Option, + Option, + Vec3, + Vec3, + Vec3, + f64, +); + impl Animation for RunAnimation { - type Dependency = (Option, Vec3, Vec3, Vec3, f64); + type Dependency = RunAnimationDependency; type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +25,7 @@ impl Animation for RunAnimation { #[allow(clippy::useless_conversion)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -187,11 +196,41 @@ impl Animation for RunAnimation { next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new(-7.0, -6.5, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -214,6 +253,14 @@ impl Animation for RunAnimation { next.r_control.scale = Vec3::one(); + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/shoot.rs b/voxygen/src/anim/src/character/shoot.rs index b9d82d5786..8b0a50d892 100644 --- a/voxygen/src/anim/src/character/shoot.rs +++ b/voxygen/src/anim/src/character/shoot.rs @@ -1,11 +1,11 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use vek::*; pub struct ShootAnimation; impl Animation for ShootAnimation { - type Dependency = (Option, f32, f64); + type Dependency = (Option, Option, f32, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for ShootAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, velocity, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, _global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -184,6 +184,15 @@ impl Animation for ShootAnimation { next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/sit.rs b/voxygen/src/anim/src/character/sit.rs index bef428103e..a7c29be2fc 100644 --- a/voxygen/src/anim/src/character/sit.rs +++ b/voxygen/src/anim/src/character/sit.rs @@ -1,12 +1,12 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct SitAnimation; impl Animation for SitAnimation { - type Dependency = (Option, f64); + type Dependency = (Option, Option, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for SitAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_sit")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -122,13 +122,41 @@ impl Animation for SitAnimation { next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new(-7.0, -5.0, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); - next.main.scale = Vec3::one() + slow_abs * -0.05; + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.main.scale = Vec3::one(); - next.second.offset = Vec3::new(0.0, 0.0, 0.0); - next.second.ori = Quaternion::rotation_y(0.0); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -145,6 +173,15 @@ impl Animation for SitAnimation { next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/spin.rs b/voxygen/src/anim/src/character/spin.rs index b0c27705af..e92886a5d5 100644 --- a/voxygen/src/anim/src/character/spin.rs +++ b/voxygen/src/anim/src/character/spin.rs @@ -1,5 +1,5 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; use vek::*; @@ -9,7 +9,7 @@ pub struct Input { pub struct SpinAnimation; impl Animation for SpinAnimation { - type Dependency = (Option, f64); + type Dependency = (Option, Option, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,7 +19,7 @@ impl Animation for SpinAnimation { #[allow(clippy::unnested_or_patterns)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, _global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -41,7 +41,10 @@ impl Animation for SpinAnimation { match active_tool_kind { //TODO: Inventory - Some(ToolKind::Axe(_)) | Some(ToolKind::Hammer(_)) | Some(ToolKind::Sword(_)) => { + Some(ToolKind::Axe(_)) + | Some(ToolKind::Hammer(_)) + | Some(ToolKind::Sword(_)) + | Some(ToolKind::Dagger(_)) => { //INTENTION: SWORD next.l_hand.offset = Vec3::new(-0.75, -1.0, -2.5); next.l_hand.ori = Quaternion::rotation_x(1.27); @@ -126,6 +129,15 @@ impl Animation for SpinAnimation { next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/stand.rs b/voxygen/src/anim/src/character/stand.rs index 645ce60f2f..eda90efb5c 100644 --- a/voxygen/src/anim/src/character/stand.rs +++ b/voxygen/src/anim/src/character/stand.rs @@ -1,12 +1,12 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; -use std::ops::Mul; +use common::comp::item::{Hands, ToolKind}; +use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct StandAnimation; impl Animation for StandAnimation { - type Dependency = (Option, f64); + type Dependency = (Option, Option, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for StandAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_stand")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -113,12 +113,41 @@ impl Animation for StandAnimation { next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new(-7.0, -5.0, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.offset = Vec3::new(0.0, 0.0, 0.0); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -137,6 +166,15 @@ impl Animation for StandAnimation { next.l_control.scale = Vec3::one(); next.r_control.scale = Vec3::one(); + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/swim.rs b/voxygen/src/anim/src/character/swim.rs index 3254df699f..12e9be25d3 100644 --- a/voxygen/src/anim/src/character/swim.rs +++ b/voxygen/src/anim/src/character/swim.rs @@ -1,12 +1,21 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct SwimAnimation; +type SwimAnimationDependency = ( + Option, + Option, + Vec3, + Vec3, + Vec3, + f64, +); + impl Animation for SwimAnimation { - type Dependency = (Option, Vec3, Vec3, Vec3, f64); + type Dependency = SwimAnimationDependency; type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +25,7 @@ impl Animation for SwimAnimation { #[allow(clippy::useless_conversion)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -141,11 +150,41 @@ impl Animation for SwimAnimation { next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new(-7.0, -5.0, 15.0); - next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25); + match active_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.main.offset = Vec3::new(-4.0, -5.0, 7.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.main.offset = Vec3::new(-0.0, -5.0, 3.0); + next.main.ori = + Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + _ => { + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } next.main.scale = Vec3::one(); - next.second.scale = Vec3::one() * 0.0; + match second_tool_kind { + Some(ToolKind::Dagger(_)) => { + next.second.offset = Vec3::new(4.0, -6.0, 7.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); + }, + Some(ToolKind::Shield(_)) => { + next.second.offset = Vec3::new(0.0, -4.0, 3.0); + next.second.ori = + Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); + }, + _ => { + next.second.offset = Vec3::new(-7.0, -5.0, 15.0); + next.second.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + } + next.second.scale = Vec3::one(); next.lantern.offset = Vec3::new( skeleton_attr.lantern.0, @@ -166,6 +205,14 @@ impl Animation for SwimAnimation { next.r_control.scale = Vec3::one(); + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/anim/src/character/wield.rs b/voxygen/src/anim/src/character/wield.rs index dbf11016bf..a4d2e54c5c 100644 --- a/voxygen/src/anim/src/character/wield.rs +++ b/voxygen/src/anim/src/character/wield.rs @@ -1,12 +1,12 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; -use common::comp::item::ToolKind; +use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct WieldAnimation; impl Animation for WieldAnimation { - type Dependency = (Option, f32, f64); + type Dependency = (Option, Option, f32, f64); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +16,7 @@ impl Animation for WieldAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, velocity, global_time): Self::Dependency, + (active_tool_kind, second_tool_kind, velocity, global_time): Self::Dependency, anim_time: f64, rate: &mut f32, skeleton_attr: &SkeletonAttr, @@ -125,6 +125,52 @@ impl Animation for WieldAnimation { * Quaternion::rotation_z(u_slowalt * 0.08); next.control.scale = Vec3::one(); }, + Some(ToolKind::Dagger(_)) => { + // hands should be larger when holding a dagger grip, + // also reduce flicker with overlapping polygons + let hand_scale = 1.12; + + next.control.offset = Vec3::new(0.0, 0.0, 0.0); + // next.control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.control.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.l_hand.scale = Vec3::one() * hand_scale; + + next.main.offset = Vec3::new(0.0, 0.0, 0.0); + next.main.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + + next.l_control.offset = Vec3::new(-7.0, 0.0, 0.0); + // next.l_control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.l_control.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.r_hand.scale = Vec3::one() * hand_scale; + + next.second.offset = Vec3::new(0.0, 0.0, 0.0); + next.second.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.second.scale = Vec3::one(); + + next.r_control.offset = Vec3::new(7.0, 0.0, 0.0); + // next.r_control.ori = Quaternion::rotation_x(0.0 * PI) + // * Quaternion::rotation_y(0.0 * PI) + // * Quaternion::rotation_z(0.0 * PI); + // next.r_control.scale = Vec3::one(); + }, Some(ToolKind::Axe(_)) => { next.l_hand.offset = Vec3::new(-4.0, 3.0, 6.0); next.l_hand.ori = Quaternion::rotation_x(-0.3) @@ -186,17 +232,50 @@ impl Animation for WieldAnimation { next.control.scale = Vec3::one(); }, Some(ToolKind::Shield(_)) => { - next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new(-6.0, 4.5, 0.0); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.main.scale = Vec3::one(); + // hands should be larger when holding a dagger grip, + // also reduce flicker with overlapping polygons + let hand_scale = 1.12; + + next.control.offset = Vec3::new(0.0, 0.0, 0.0); + // next.control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.control.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.l_hand.scale = Vec3::one() * hand_scale; + + next.main.offset = Vec3::new(0.0, 0.0, 0.0); + next.main.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + + next.l_control.offset = Vec3::new(-7.0, 0.0, 0.0); + // next.l_control.ori = Quaternion::rotation_x(u_slow * 0.15 + 1.0) + // * Quaternion::rotation_y(0.0) + // * Quaternion::rotation_z(u_slowalt * 0.08); + // next.l_control.scale = Vec3::one(); + + next.r_hand.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hand.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.r_hand.scale = Vec3::one() * hand_scale; + + next.second.offset = Vec3::new(0.0, 0.0, 0.0); + next.second.ori = Quaternion::rotation_x(0.0 * PI) + * Quaternion::rotation_y(0.0 * PI) + * Quaternion::rotation_z(0.0 * PI); + next.second.scale = Vec3::one(); + + next.r_control.offset = Vec3::new(7.0, 0.0, 0.0); + // next.r_control.ori = Quaternion::rotation_x(0.0 * PI) + // * Quaternion::rotation_y(0.0 * PI) + // * Quaternion::rotation_z(0.0 * PI); + // next.r_control.scale = Vec3::one(); }, Some(ToolKind::Bow(_)) => { next.l_hand.offset = Vec3::new(2.0, 1.5, 0.0); @@ -274,6 +353,14 @@ impl Animation for WieldAnimation { next.r_control.scale = Vec3::one(); + next.second.scale = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + next } } diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index ed61f149e9..f73921253b 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -135,6 +135,10 @@ image_ids! { // Skill Icons twohsword_m1: "voxygen.element.icons.2hsword_m1", twohsword_m2: "voxygen.element.icons.2hsword_m2", + onehdagger_m1: "voxygen.element.icons.daggers", + onehdagger_m2: "voxygen.element.icons.skill_slice_2", + onehshield_m1: "voxygen.element.icons.swordshield", + onehshield_m2: "voxygen.element.icons.character", twohhammer_m1: "voxygen.element.icons.2hhammer_m1", twohhammer_m2: "voxygen.element.icons.2hhammer_m2", twohaxe_m1: "voxygen.element.icons.2haxe_m1", diff --git a/voxygen/src/hud/skillbar.rs b/voxygen/src/hud/skillbar.rs index 3c8fc56e1b..c2aa0af80e 100644 --- a/voxygen/src/hud/skillbar.rs +++ b/voxygen/src/hud/skillbar.rs @@ -18,7 +18,7 @@ use crate::{ use common::comp::{ item::{ tool::{DebugKind, StaffKind, Tool, ToolKind}, - ItemKind, + Hands, ItemKind, }, CharacterState, ControllerInputs, Energy, Inventory, Loadout, Stats, }; @@ -611,6 +611,8 @@ impl<'a> Widget for Skillbar<'a> { match self.loadout.active_item.as_ref().map(|i| &i.item.kind) { Some(ItemKind::Tool(Tool { kind, .. })) => match kind { ToolKind::Sword(_) => self.imgs.twohsword_m1, + ToolKind::Dagger(_) => self.imgs.onehdagger_m1, + ToolKind::Shield(_) => self.imgs.onehshield_m1, ToolKind::Hammer(_) => self.imgs.twohhammer_m1, ToolKind::Axe(_) => self.imgs.twohaxe_m1, ToolKind::Bow(_) => self.imgs.bow_m1, @@ -673,78 +675,74 @@ impl<'a> Widget for Skillbar<'a> { }, } + let active_tool_kind = match self.loadout.active_item.as_ref().map(|i| &i.item.kind) { + Some(ItemKind::Tool(Tool { kind, .. })) => Some(kind), + _ => None, + }; + + let second_tool_kind = match self.loadout.second_item.as_ref().map(|i| &i.item.kind) { + Some(ItemKind::Tool(Tool { kind, .. })) => Some(kind), + _ => None, + }; + + let tool_kind = match ( + active_tool_kind.map(|tk| tk.into_hands()), + second_tool_kind.map(|tk| tk.into_hands()), + ) { + (Some(Hands::TwoHand), _) => active_tool_kind, + (_, Some(Hands::OneHand)) => second_tool_kind, + (_, _) => None, + }; + Image::new(self.imgs.skillbar_slot_big_bg) .w_h(38.0 * scale, 38.0 * scale) - .color( - match self.loadout.active_item.as_ref().map(|i| &i.item.kind) { - Some(ItemKind::Tool(Tool { kind, .. })) => match kind { - ToolKind::Bow(_) => Some(BG_COLOR_2), - ToolKind::Staff(_) => Some(BG_COLOR_2), - _ => Some(BG_COLOR_2), - }, - _ => Some(BG_COLOR_2), - }, - ) + .color(match tool_kind { + Some(ToolKind::Bow(_)) => Some(BG_COLOR_2), + Some(ToolKind::Staff(_)) => Some(BG_COLOR_2), + _ => Some(BG_COLOR_2), + }) .middle_of(state.ids.m2_slot) .set(state.ids.m2_slot_bg, ui); - Button::image( - match self.loadout.active_item.as_ref().map(|i| &i.item.kind) { - Some(ItemKind::Tool(Tool { kind, .. })) => match kind { - ToolKind::Sword(_) => self.imgs.charge, - ToolKind::Hammer(_) => self.imgs.nothing, - ToolKind::Axe(_) => self.imgs.nothing, - ToolKind::Bow(_) => self.imgs.bow_m2, - ToolKind::Staff(StaffKind::Sceptre) => self.imgs.heal_0, - ToolKind::Staff(_) => self.imgs.staff_m2, - ToolKind::Debug(DebugKind::Boost) => self.imgs.flyingrod_m2, - _ => self.imgs.nothing, - }, - _ => self.imgs.nothing, - }, - ) // Insert Icon here - .w( - match self.loadout.active_item.as_ref().map(|i| &i.item.kind) { - Some(ItemKind::Tool(Tool { kind, .. })) => match kind { - ToolKind::Staff(_) => 30.0 * scale, - ToolKind::Bow(_) => 30.0 * scale, - _ => 38.0 * scale, - }, - _ => 38.0 * scale, - }, - ) - .h( - match self.loadout.active_item.as_ref().map(|i| &i.item.kind) { - Some(ItemKind::Tool(Tool { kind, .. })) => match kind { - ToolKind::Staff(_) => 30.0 * scale, - ToolKind::Bow(_) => 30.0 * scale, - _ => 38.0 * scale, - }, - _ => 38.0 * scale, - }, - ) + Button::image(match tool_kind { + Some(ToolKind::Sword(_)) => self.imgs.charge, + Some(ToolKind::Dagger(_)) => self.imgs.onehdagger_m2, + Some(ToolKind::Shield(_)) => self.imgs.onehshield_m2, + Some(ToolKind::Hammer(_)) => self.imgs.nothing, + Some(ToolKind::Axe(_)) => self.imgs.nothing, + Some(ToolKind::Bow(_)) => self.imgs.bow_m2, + Some(ToolKind::Staff(StaffKind::Sceptre)) => self.imgs.heal_0, + Some(ToolKind::Staff(_)) => self.imgs.staff_m2, + Some(ToolKind::Debug(DebugKind::Boost)) => self.imgs.flyingrod_m2, + _ => self.imgs.nothing, + }) // Insert Icon here + .w(match tool_kind { + Some(ToolKind::Staff(_)) => 30.0 * scale, + Some(ToolKind::Bow(_)) => 30.0 * scale, + _ => 38.0 * scale, + }) + .h(match tool_kind { + Some(ToolKind::Staff(_)) => 30.0 * scale, + Some(ToolKind::Bow(_)) => 30.0 * scale, + _ => 38.0 * scale, + }) .middle_of(state.ids.m2_slot_bg) - .image_color( - match self.loadout.active_item.as_ref().map(|i| &i.item.kind) { - Some(ItemKind::Tool(Tool { kind, .. })) => match kind { - ToolKind::Sword(_) => { - if self.energy.current() as f64 >= 200.0 { - Color::Rgba(1.0, 1.0, 1.0, 1.0) - } else { - Color::Rgba(0.3, 0.3, 0.3, 0.8) - } - }, - ToolKind::Staff(StaffKind::Sceptre) => { - if self.energy.current() as f64 >= 400.0 { - Color::Rgba(1.0, 1.0, 1.0, 1.0) - } else { - Color::Rgba(0.3, 0.3, 0.3, 0.8) - } - }, - _ => Color::Rgba(1.0, 1.0, 1.0, 1.0), - }, - _ => Color::Rgba(1.0, 1.0, 1.0, 1.0), + .image_color(match tool_kind { + Some(ToolKind::Sword(_)) => { + if self.energy.current() as f64 >= 200.0 { + Color::Rgba(1.0, 1.0, 1.0, 1.0) + } else { + Color::Rgba(0.3, 0.3, 0.3, 0.8) + } }, - ) + Some(ToolKind::Staff(StaffKind::Sceptre)) => { + if self.energy.current() as f64 >= 400.0 { + Color::Rgba(1.0, 1.0, 1.0, 1.0) + } else { + Color::Rgba(0.3, 0.3, 0.3, 0.8) + } + }, + _ => Color::Rgba(1.0, 1.0, 1.0, 1.0), + }) .set(state.ids.m2_content, ui); // Slots let content_source = (self.hotbar, self.inventory, self.loadout, self.energy); // TODO: avoid this diff --git a/voxygen/src/menu/char_selection/ui.rs b/voxygen/src/menu/char_selection/ui.rs index f81d063914..7e6d7ff201 100644 --- a/voxygen/src/menu/char_selection/ui.rs +++ b/voxygen/src/menu/char_selection/ui.rs @@ -1318,7 +1318,7 @@ impl CharSelectionUi { .set(self.ids.daggers_button, ui_widgets) .was_clicked() { - // self.character_tool = Some(STARTER_DAGGER); + // *tool = Some(STARTER_DAGGER); } // REMOVE THIS AFTER IMPLEMENTATION Rectangle::fill_with([67.0, 67.0], color::rgba(0.0, 0.0, 0.0, 0.8)) .middle_of(self.ids.daggers) diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index 0af88d92d5..941a4da22a 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -177,12 +177,25 @@ impl FigureModelCache { { Some(humanoid_main_weapon_spec.mesh_main_weapon( loadout.active_item.as_ref().map(|i| &i.item.kind), + false, + generate_mesh, + )) + } else { + None + }, + if camera_mode != CameraMode::FirstPerson + || character_state + .map(|cs| cs.is_attack() || cs.is_block() || cs.is_wield()) + .unwrap_or_default() + { + Some(humanoid_main_weapon_spec.mesh_main_weapon( + loadout.second_item.as_ref().map(|i| &i.item.kind), + true, generate_mesh, )) } else { None }, - None, Some(humanoid_armor_lantern_spec.mesh_lantern(&body, loadout, generate_mesh)), Some(mesh_hold(generate_mesh)), ] diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 08c920775f..51d0f66720 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -46,6 +46,9 @@ fn graceful_load_vox(mesh_name: &str) -> Arc { fn graceful_load_segment(mesh_name: &str) -> Segment { Segment::from(graceful_load_vox(mesh_name).as_ref()) } +fn graceful_load_segment_flipped(mesh_name: &str) -> Segment { + Segment::from_vox(graceful_load_vox(mesh_name).as_ref(), true) +} fn graceful_load_mat_segment(mesh_name: &str) -> MatSegment { MatSegment::from(graceful_load_vox(mesh_name).as_ref()) } @@ -783,6 +786,7 @@ impl HumMainWeaponSpec { pub fn mesh_main_weapon( &self, item_kind: Option<&ItemKind>, + flipped: bool, generate_mesh: impl FnOnce(&Segment, Vec3) -> Mesh, ) -> Mesh { let tool_kind = if let Some(ItemKind::Tool(Tool { kind, .. })) = item_kind { @@ -799,10 +803,28 @@ impl HumMainWeaponSpec { }, }; - let tool_kind_segment = graceful_load_segment(&spec.vox_spec.0); - generate_mesh(&tool_kind_segment, Vec3::from(spec.vox_spec.1)) + let tool_kind_segment = if flipped { + graceful_load_segment_flipped(&spec.vox_spec.0) + } else { + graceful_load_segment(&spec.vox_spec.0) + }; + + let offset = Vec3::new( + if flipped { + //log::warn!("tool kind segment {:?}", ); + //tool_kind_segment.; + 0.0 - spec.vox_spec.1[0] - (tool_kind_segment.sz.x as f32) + } else { + spec.vox_spec.1[0] + }, + spec.vox_spec.1[1], + spec.vox_spec.1[2], + ); + + generate_mesh(&tool_kind_segment, offset) } } + // Lantern impl HumArmorLanternSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index eb5ed03ddc..4567125201 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -510,6 +510,16 @@ impl FigureMgr { None }; + let second_item_kind = loadout + .and_then(|l| l.second_item.as_ref()) + .map(|i| &i.item.kind); + + let second_tool_kind = if let Some(ItemKind::Tool(tool)) = second_item_kind { + Some(tool.kind) + } else { + None + }; + match body { Body::Humanoid(_) => { let skeleton_attr = &self @@ -545,7 +555,7 @@ impl FigureMgr { // Standing (true, false, _) => anim::character::StandAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, time), + (active_tool_kind, second_tool_kind, time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -553,7 +563,14 @@ impl FigureMgr { // Running (true, true, _) => anim::character::RunAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, vel.0, ori, state.last_ori, time), + ( + active_tool_kind, + second_tool_kind, + vel.0, + ori, + state.last_ori, + time, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -561,7 +578,13 @@ impl FigureMgr { // In air (false, _, false) => anim::character::JumpAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, ori, state.last_ori, time), + ( + active_tool_kind, + second_tool_kind, + ori, + state.last_ori, + time, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -569,7 +592,14 @@ impl FigureMgr { // Swim (false, _, true) => anim::character::SwimAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, vel.0, ori, state.last_ori, time), + ( + active_tool_kind, + second_tool_kind, + vel.0, + ori, + state.last_ori, + time, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -579,7 +609,13 @@ impl FigureMgr { CharacterState::Roll { .. } => { anim::character::RollAnimation::update_skeleton( &target_base, - (active_tool_kind, ori, state.last_ori, time), + ( + active_tool_kind, + second_tool_kind, + ori, + state.last_ori, + time, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -588,7 +624,7 @@ impl FigureMgr { CharacterState::BasicMelee(_) => { anim::character::AlphaAnimation::update_skeleton( &target_base, - (active_tool_kind, vel.0.magnitude(), time), + (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -598,7 +634,7 @@ impl FigureMgr { if data.exhausted { anim::character::ShootAnimation::update_skeleton( &target_base, - (active_tool_kind, vel.0.magnitude(), time), + (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -608,6 +644,7 @@ impl FigureMgr { &target_base, ( active_tool_kind, + second_tool_kind, vel.0.magnitude(), ori, state.last_ori, @@ -622,7 +659,7 @@ impl FigureMgr { CharacterState::Boost(_) => { anim::character::AlphaAnimation::update_skeleton( &target_base, - (active_tool_kind, vel.0.magnitude(), time), + (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -631,7 +668,7 @@ impl FigureMgr { CharacterState::DashMelee(_) => { anim::character::DashAnimation::update_skeleton( &target_base, - (active_tool_kind, time), + (active_tool_kind, second_tool_kind, time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -641,7 +678,7 @@ impl FigureMgr { triple_strike::Stage::First => { anim::character::AlphaAnimation::update_skeleton( &target_base, - (active_tool_kind, vel.0.magnitude(), time), + (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -650,7 +687,7 @@ impl FigureMgr { triple_strike::Stage::Second => { anim::character::SpinAnimation::update_skeleton( &target_base, - (active_tool_kind, time), + (active_tool_kind, second_tool_kind, time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -659,7 +696,7 @@ impl FigureMgr { triple_strike::Stage::Third => { anim::character::BetaAnimation::update_skeleton( &target_base, - (active_tool_kind, vel.0.magnitude(), time), + (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -669,7 +706,7 @@ impl FigureMgr { CharacterState::BasicBlock { .. } => { anim::character::BlockIdleAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, time), + (active_tool_kind, second_tool_kind, time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -688,7 +725,7 @@ impl FigureMgr { CharacterState::Equipping { .. } => { anim::character::EquipAnimation::update_skeleton( &target_base, - (active_tool_kind, vel.0.magnitude(), time), + (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -697,7 +734,7 @@ impl FigureMgr { CharacterState::Wielding { .. } => { anim::character::WieldAnimation::update_skeleton( &target_base, - (active_tool_kind, vel.0.magnitude(), time), + (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -706,7 +743,14 @@ impl FigureMgr { CharacterState::Glide { .. } => { anim::character::GlidingAnimation::update_skeleton( &target_base, - (active_tool_kind, vel.0, ori, state.last_ori, time), + ( + active_tool_kind, + second_tool_kind, + vel.0, + ori, + state.last_ori, + time, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -715,7 +759,7 @@ impl FigureMgr { CharacterState::Climb { .. } => { anim::character::ClimbAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, vel.0, ori, time), + (active_tool_kind, second_tool_kind, vel.0, ori, time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -724,7 +768,7 @@ impl FigureMgr { CharacterState::Sit { .. } => { anim::character::SitAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, time), + (active_tool_kind, second_tool_kind, time), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -733,7 +777,14 @@ impl FigureMgr { CharacterState::GlideWield { .. } => { anim::character::GlideWieldAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, vel.0, ori, state.last_ori, time), + ( + active_tool_kind, + second_tool_kind, + vel.0, + ori, + state.last_ori, + time, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -742,7 +793,7 @@ impl FigureMgr { CharacterState::Dance { .. } => { anim::character::DanceAnimation::update_skeleton( &CharacterSkeleton::new(), - (active_tool_kind, time), + (active_tool_kind, second_tool_kind, time), state.state_time, &mut state_animation_rate, skeleton_attr,