diff --git a/common/src/comp/action_state.rs b/common/src/comp/action_state.rs index 7296e1031f..821fee92b7 100644 --- a/common/src/comp/action_state.rs +++ b/common/src/comp/action_state.rs @@ -7,6 +7,7 @@ pub struct ActionState { pub attacking: bool, pub rolling: bool, pub gliding: bool, + pub wielding: bool, } impl Default for ActionState { @@ -17,6 +18,7 @@ impl Default for ActionState { attacking: false, rolling: false, gliding: false, + wielding: false, } } } diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index 913a9d4664..2ec6fdb8aa 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -15,7 +15,7 @@ pub use agent::Agent; pub use animation::{Animation, AnimationInfo}; pub use body::{humanoid, quadruped, quadruped_medium, Body}; pub use controller::Controller; -pub use inputs::{Attacking, Gliding, Jumping, MoveDir, Wielding, OnGround, Respawning, Rolling}; +pub use inputs::{Attacking, Gliding, Jumping, MoveDir, OnGround, Respawning, Rolling, Wielding}; pub use inventory::{item, Inventory}; pub use phys::{ForceUpdate, Ori, Pos, Vel}; pub use player::Player; diff --git a/common/src/sys/action_state.rs b/common/src/sys/action_state.rs index 08c1a3d514..aa2f27e0d0 100644 --- a/common/src/sys/action_state.rs +++ b/common/src/sys/action_state.rs @@ -1,7 +1,7 @@ use crate::{ comp::{ ActionState, Animation, AnimationInfo, Attacking, Controller, ForceUpdate, Gliding, - Jumping, OnGround, Ori, Pos, Rolling, Vel, + Jumping, OnGround, Ori, Pos, Rolling, Vel, Wielding, }, state::DeltaTime, sys::phys::MOVEMENT_THRESHOLD_VEL, @@ -20,6 +20,7 @@ impl<'a> System<'a> for Sys { ReadStorage<'a, Jumping>, ReadStorage<'a, Gliding>, ReadStorage<'a, Attacking>, + ReadStorage<'a, Wielding>, ReadStorage<'a, Rolling>, WriteStorage<'a, ActionState>, ); @@ -35,6 +36,7 @@ impl<'a> System<'a> for Sys { jumpings, glidings, attackings, + wieldings, rollings, mut action_states, ): Self::SystemData, @@ -47,6 +49,7 @@ impl<'a> System<'a> for Sys { jumping, gliding, attacking, + wielding, rolling, mut action_state, ) in ( @@ -57,6 +60,7 @@ impl<'a> System<'a> for Sys { jumpings.maybe(), glidings.maybe(), attackings.maybe(), + wieldings.maybe(), rollings.maybe(), &mut action_states, ) @@ -66,6 +70,7 @@ impl<'a> System<'a> for Sys { on_ground: on_ground.is_some(), moving: vel.0.magnitude_squared() > MOVEMENT_THRESHOLD_VEL.powf(2.0), attacking: attacking.is_some(), + wielding: wielding.is_some(), rolling: rolling.is_some(), gliding: gliding.is_some(), }; diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 5f429512b0..00f811a389 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -20,17 +20,27 @@ impl<'a> System<'a> for Sys { warn!("{}", message); Animation::Idle } - let animation = match (a.on_ground, a.moving, a.attacking, a.gliding, a.rolling) { - (_, _, true, true, _) => impossible_animation("Attack while gliding"), - (_, _, true, _, true) => impossible_animation("Roll while attacking"), - (_, _, _, true, true) => impossible_animation("Roll while gliding"), - (_, false, _, _, true) => impossible_animation("Roll without moving"), - (_, true, false, false, true) => Animation::Roll, - (true, false, false, false, false) => Animation::Idle, - (true, true, false, false, false) => Animation::Run, - (false, _, false, false, false) => Animation::Jump, - (_, _, false, true, false) => Animation::Gliding, - (_, _, true, false, false) => Animation::Attack, + let animation = match ( + a.on_ground, + a.moving, + a.attacking, + a.gliding, + a.rolling, + a.wielding, + ) { + (_, _, true, true, _, _) => impossible_animation("Attack while gliding"), + (_, _, true, _, true, _) => impossible_animation("Roll while attacking"), + (_, _, _, true, true, _) => impossible_animation("Roll while gliding"), + (_, false, _, _, true, _) => impossible_animation("Roll without moving"), + (_, true, false, false, true, _) => Animation::Roll, + (true, false, false, false, false, false) => Animation::Idle, + (true, true, false, false, false, false) => Animation::Run, + (false, _, false, false, false, false) => Animation::Jump, + (true, false, false, false, false, true) => Animation::Cidle, + (true, true, false, false, false, true) => Animation::Crun, + (false, _, false, false, false, true) => Animation::Cjump, + (_, _, false, true, false, _) => Animation::Gliding, + (_, _, true, false, false, _) => Animation::Attack, }; let new_time = animation_infos diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 0861fa30f3..46bce443ae 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -1,6 +1,6 @@ use crate::{ comp::{ - Attacking, Wielding, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel}, + Attacking, HealthSource, Stats, Wielding, {ForceUpdate, Ori, Pos, Vel}, }, state::{DeltaTime, Uid}, }; diff --git a/voxygen/src/anim/character/cidle.rs b/voxygen/src/anim/character/cidle.rs index 33c84f3d4d..139109518e 100644 --- a/voxygen/src/anim/character/cidle.rs +++ b/voxygen/src/anim/character/cidle.rs @@ -29,8 +29,6 @@ impl Animation for CidleAnimation { let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); - - let head_look = Vec2::new( ((global_time + anim_time) as f32 / 1.5) .floor() diff --git a/voxygen/src/anim/character/cjump.rs b/voxygen/src/anim/character/cjump.rs index 2bfafd30cc..a585e923a6 100644 --- a/voxygen/src/anim/character/cjump.rs +++ b/voxygen/src/anim/character/cjump.rs @@ -43,19 +43,11 @@ impl Animation for CjumpAnimation { next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new( - -7.0, - 4.0, - 0.0 + wave_stop * 2.0, - ); + next.l_hand.offset = Vec3::new(-7.0, 4.0, 0.0 + wave_stop * 2.0); next.l_hand.ori = Quaternion::rotation_x(-0.3); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new( - -7.0, - 3.0, - -2.0 + wave_stop * 2.0, - ); + next.r_hand.offset = Vec3::new(-7.0, 3.0, -2.0 + wave_stop * 2.0); next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/crun.rs b/voxygen/src/anim/character/crun.rs index 96dd7d4166..72d5788c27 100644 --- a/voxygen/src/anim/character/crun.rs +++ b/voxygen/src/anim/character/crun.rs @@ -60,19 +60,11 @@ impl Animation for CrunAnimation { next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new( - -6.0, - 4.0, - 0.0, - ); + next.l_hand.offset = Vec3::new(-6.0, 4.0, 0.0); next.l_hand.ori = Quaternion::rotation_x(-0.3); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new( - -6.0, - 3.0, - -2.0, - ); + 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(); @@ -84,11 +76,7 @@ impl Animation for CrunAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.0, - 0.0, - ); + next.weapon.offset = Vec3::new(-6.0 + skeleton_attr.weapon_x, 4.0, 0.0); next.weapon.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 3df382b709..a13e41a469 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -60,12 +60,19 @@ impl Animation for GlidingAnimation { next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-10.0, -5.0 + wave_very_slow * 0.1, 8.5); - next.l_hand.ori = - Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1) * skeleton_attr.scaler; + next.l_hand.offset = Vec3::new( + -9.5 + wave_very_slow_cos * -1.5, + -7.0 + wave_very_slow_cos * 1.5, + 9.0, + ); + next.l_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(10.0, -5.0 + wave_very_slow * 0.1, 8.5); + next.r_hand.offset = Vec3::new( + 9.5 + wave_very_slow_cos * -1.5, + -7.0 + wave_very_slow_cos * -1.5, + 9.0, + ); next.r_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.10); next.r_hand.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 3a4e6c3055..65d15ec481 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -1,7 +1,7 @@ pub mod attack; pub mod cidle; -pub mod crun; pub mod cjump; +pub mod crun; pub mod gliding; pub mod idle; pub mod jump; @@ -11,8 +11,8 @@ pub mod run; // Reexports pub use self::attack::AttackAnimation; pub use self::cidle::CidleAnimation; -pub use self::crun::CrunAnimation; pub use self::cjump::CjumpAnimation; +pub use self::crun::CrunAnimation; pub use self::gliding::GlidingAnimation; pub use self::idle::IdleAnimation; pub use self::jump::JumpAnimation; @@ -85,7 +85,6 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), - ] } diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 8fe0a4f56d..227dac1da8 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -107,7 +107,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { neck_height: match (body.race, body.body_type) { (Orc, Male) => -2.0, (Orc, Female) => -2.0, - (Human, Male) => 0.0, + (Human, Male) => -0.5, (Human, Female) => -2.0, (Elf, Male) => -0.5, (Elf, Female) => -1.25, diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index dd21b3b548..108b5cf19a 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -621,28 +621,28 @@ impl FigureMgr { ) } comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton( - state.skeleton_mut(), - time, - animation_info.time, - skeleton_attr, + state.skeleton_mut(), + time, + animation_info.time, + skeleton_attr, ), comp::Animation::Roll => anim::character::RollAnimation::update_skeleton( - state.skeleton_mut(), - time, - animation_info.time, - skeleton_attr, + state.skeleton_mut(), + time, + animation_info.time, + skeleton_attr, ), comp::Animation::Crun => anim::character::CrunAnimation::update_skeleton( - state.skeleton_mut(), - (vel.0.magnitude(), time), - animation_info.time, - skeleton_attr, + state.skeleton_mut(), + (vel.0.magnitude(), time), + animation_info.time, + skeleton_attr, ), comp::Animation::Cidle => anim::character::CidleAnimation::update_skeleton( - state.skeleton_mut(), - time, - animation_info.time, - skeleton_attr, + state.skeleton_mut(), + time, + animation_info.time, + skeleton_attr, ), comp::Animation::Gliding => { anim::character::GlidingAnimation::update_skeleton(