removed weapon_id attribs, replaced with matches

This commit is contained in:
jshipsey
2019-07-07 19:24:20 -04:00
parent 12667b9172
commit 529281e2c3
4 changed files with 426 additions and 408 deletions

View File

@ -2,6 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
CharacterSkeleton,
};
use common::comp::item::Weapon;
use std::{f32::consts::PI, ops::Mul};
use vek::*;
@ -60,7 +61,9 @@ impl Animation for CidleAnimation {
next.shorts.ori = Quaternion::rotation_x(0.0);
next.shorts.scale = Vec3::one();
if skeleton_attr.weapon_id == 1.0 {
match Weapon::Hammer {
//TODO: Inventory
Weapon::Sword => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
@ -84,7 +87,8 @@ impl Animation for CidleAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 2.0 {
}
Weapon::Axe => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
@ -108,7 +112,8 @@ impl Animation for CidleAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 3.0 {
}
Weapon::Hammer => {
next.l_hand.offset = Vec3::new(-7.0, 8.25, 2.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.2)
@ -128,7 +133,8 @@ impl Animation for CidleAnimation {
* Quaternion::rotation_y(-1.2)
* Quaternion::rotation_z(wave_ultra_slow * 0.2);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 4.0 {
}
Weapon::Staff => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
@ -152,7 +158,8 @@ impl Animation for CidleAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 5.0 {
}
Weapon::SwordShield => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
@ -176,7 +183,8 @@ impl Animation for CidleAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 6.0 {
}
Weapon::Bow => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
@ -200,7 +208,8 @@ impl Animation for CidleAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 7.0 {
}
Weapon::Daggers => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
@ -221,6 +230,7 @@ impl Animation for CidleAnimation {
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
}
next.l_foot.offset = Vec3::new(-3.4, -1.5, 8.0 + wave_slow * 0.2);
next.l_foot.ori = Quaternion::rotation_x(wave_ultra_slow_cos * 0.015);
next.l_foot.scale = Vec3::one();

View File

@ -2,6 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
CharacterSkeleton,
};
use common::comp::item::Weapon;
use std::f32::consts::PI;
use vek::*;
@ -42,7 +43,9 @@ impl Animation for CjumpAnimation {
next.shorts.ori = Quaternion::rotation_z(0.0);
next.shorts.scale = Vec3::one();
if skeleton_attr.weapon_id == 1.0 {
match Weapon::Hammer {
//TODO: Inventory
Weapon::Sword => {
next.l_hand.offset = Vec3::new(-7.0, 3.25, 0.25 + wave_stop * 2.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
@ -58,7 +61,8 @@ impl Animation for CjumpAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 2.0 {
}
Weapon::Axe => {
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;
@ -74,7 +78,8 @@ impl Animation for CjumpAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 3.0 {
}
Weapon::Hammer => {
next.l_hand.offset = Vec3::new(-7.0, 8.25, 2.0 + wave_stop * 2.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.2)
@ -94,7 +99,8 @@ impl Animation for CjumpAnimation {
* Quaternion::rotation_y(-1.2)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 4.0 {
}
Weapon::Staff => {
next.l_hand.offset = Vec3::new(-7.0, 7.5, 0.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.7)
@ -114,7 +120,8 @@ impl Animation for CjumpAnimation {
* Quaternion::rotation_y(-1.7)
* Quaternion::rotation_z(1.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 5.0 {
}
Weapon::SwordShield => {
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;
@ -130,7 +137,8 @@ impl Animation for CjumpAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 6.0 {
}
Weapon::Bow => {
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;
@ -146,7 +154,8 @@ impl Animation for CjumpAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 7.0 {
}
Weapon::Daggers => {
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;
@ -163,6 +172,7 @@ impl Animation for CjumpAnimation {
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
}
next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0);
next.l_foot.ori = Quaternion::rotation_x(wave_stop * -1.2 - wave_slow * 0.2);

View File

@ -2,6 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
CharacterSkeleton,
};
use common::comp::item::Weapon;
use std::f32::consts::PI;
use std::ops::Mul;
use vek::*;
@ -60,7 +61,9 @@ impl Animation for CrunAnimation {
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
next.shorts.scale = Vec3::one();
if skeleton_attr.weapon_id == 1.0 {
match Weapon::Hammer {
//TODO: Inventory
Weapon::Sword => {
next.l_hand.offset = Vec3::new(-6.0, 3.75, 0.25);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
@ -76,7 +79,8 @@ impl Animation for CrunAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 2.0 {
}
Weapon::Axe => {
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;
@ -92,7 +96,8 @@ impl Animation for CrunAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 3.0 {
}
Weapon::Hammer => {
next.l_hand.offset = Vec3::new(-7.0, 8.25, 3.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.2)
@ -112,7 +117,8 @@ impl Animation for CrunAnimation {
* Quaternion::rotation_y(-1.2)
* Quaternion::rotation_z(wave * -0.25);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 4.0 {
}
Weapon::Staff => {
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;
@ -128,7 +134,8 @@ impl Animation for CrunAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 5.0 {
}
Weapon::SwordShield => {
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;
@ -144,7 +151,8 @@ impl Animation for CrunAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 6.0 {
}
Weapon::Bow => {
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;
@ -160,7 +168,8 @@ impl Animation for CrunAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
} else if skeleton_attr.weapon_id == 7.0 {
}
Weapon::Daggers => {
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;
@ -177,6 +186,7 @@ impl Animation for CrunAnimation {
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
}
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11);
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.5);
next.l_foot.scale = Vec3::one();

View File

@ -54,7 +54,6 @@ pub struct SkeletonAttr {
neck_right: f32,
weapon_x: f32,
weapon_y: f32,
weapon_id: f32,
}
impl Default for SkeletonAttr {
@ -67,7 +66,6 @@ impl Default for SkeletonAttr {
neck_right: 1.0,
weapon_x: 1.0,
weapon_y: 1.0,
weapon_id: 0.0,
}
}
}
@ -166,16 +164,6 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
Weapon::Bow => -2.0,
Weapon::Daggers => -2.0,
},
weapon_id: match Weapon::Hammer {
// TODO: Inventory
Weapon::Sword => 1.0,
Weapon::Axe => 2.0,
Weapon::Hammer => 3.0,
Weapon::SwordShield => 4.0,
Weapon::Staff => 5.0,
Weapon::Bow => 6.0,
Weapon::Daggers => 7.0,
},
}
}
}