From 688f9173084a0ad86677855d719c4fd4f8984e67 Mon Sep 17 00:00:00 2001 From: Justin Shipsey Date: Sun, 14 Jun 2020 09:22:21 +0000 Subject: [PATCH] asset missing fix --- CHANGELOG.md | 2 + assets/voxygen/element/icons/bow_m2.png | 3 + common/src/comp/inventory/item/tool.rs | 76 +++++++++++++++++-------- voxygen/src/anim/character/charge.rs | 22 ++++--- voxygen/src/anim/character/equip.rs | 9 ++- voxygen/src/anim/character/mod.rs | 12 ++-- voxygen/src/anim/character/shoot.rs | 11 +++- voxygen/src/anim/character/stand.rs | 2 +- voxygen/src/anim/character/wield.rs | 12 +++- voxygen/src/hud/img_ids.rs | 3 +- voxygen/src/hud/skillbar.rs | 4 +- voxygen/src/scene/figure/cache.rs | 2 +- voxygen/src/scene/figure/load.rs | 10 ++++ 13 files changed, 115 insertions(+), 53 deletions(-) create mode 100644 assets/voxygen/element/icons/bow_m2.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 6576a27406..ca61daa7d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Show where screenshots are saved to in the chat - Added basic auto walk - Added weapon/attack sound effects +- M2 attack for bow ### Changed @@ -30,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - slim the game size through lossless asset optimization - Lanterns now stop glowing if you throw a lit one out of your inventory - Fixed a crash caused by certain audio devices on OSX +- Bow animations now show held arrows ### Removed diff --git a/assets/voxygen/element/icons/bow_m2.png b/assets/voxygen/element/icons/bow_m2.png new file mode 100644 index 0000000000..31627cde58 --- /dev/null +++ b/assets/voxygen/element/icons/bow_m2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b580f448d4d3d0f86a5f3382842c6ef29507b7717d5c2994e902a0d9d82d8f0b +size 16863 diff --git a/common/src/comp/inventory/item/tool.rs b/common/src/comp/inventory/item/tool.rs index 0c3b3225b5..a46c8262bf 100644 --- a/common/src/comp/inventory/item/tool.rs +++ b/common/src/comp/inventory/item/tool.rs @@ -221,30 +221,56 @@ impl Tool { range: 3.0, max_angle: 60.0, }], - Bow(_) => vec![BasicRanged { - energy_cost: 0, - holdable: true, - prepare_duration: Duration::from_millis(100), - recover_duration: Duration::from_millis(500), - projectile: Projectile { - hit_solid: vec![projectile::Effect::Stick], - hit_entity: vec![ - projectile::Effect::Damage(HealthChange { - // TODO: This should not be fixed (?) - amount: -5, - cause: HealthSource::Projectile { owner: None }, - }), - projectile::Effect::Knockback(10.0), - projectile::Effect::RewardEnergy(100), - projectile::Effect::Vanish, - ], - time_left: Duration::from_secs(15), - owner: None, + Bow(_) => vec![ + BasicRanged { + energy_cost: 0, + holdable: true, + prepare_duration: Duration::from_millis(100), + recover_duration: Duration::from_millis(500), + projectile: Projectile { + hit_solid: vec![projectile::Effect::Stick], + hit_entity: vec![ + projectile::Effect::Damage(HealthChange { + // TODO: This should not be fixed (?) + amount: -3, + cause: HealthSource::Projectile { owner: None }, + }), + projectile::Effect::Knockback(10.0), + projectile::Effect::RewardEnergy(100), + projectile::Effect::Vanish, + ], + time_left: Duration::from_secs(15), + owner: None, + }, + projectile_body: Body::Object(object::Body::Arrow), + projectile_light: None, + projectile_gravity: Some(Gravity(0.2)), }, - projectile_body: Body::Object(object::Body::Arrow), - projectile_light: None, - projectile_gravity: Some(Gravity(0.1)), - }], + BasicRanged { + energy_cost: 350, + holdable: true, + prepare_duration: Duration::from_millis(250), + recover_duration: Duration::from_millis(700), + projectile: Projectile { + hit_solid: vec![projectile::Effect::Stick], + hit_entity: vec![ + projectile::Effect::Damage(HealthChange { + // TODO: This should not be fixed (?) + amount: -9, + cause: HealthSource::Projectile { owner: None }, + }), + projectile::Effect::Knockback(15.0), + projectile::Effect::RewardEnergy(50), + projectile::Effect::Vanish, + ], + time_left: Duration::from_secs(15), + owner: None, + }, + projectile_body: Body::Object(object::Body::Arrow), + projectile_light: None, + projectile_gravity: Some(Gravity(0.05)), + }, + ], Dagger(_) => vec![BasicMelee { energy_cost: 0, buildup_duration: Duration::from_millis(100), @@ -264,7 +290,7 @@ impl Tool { }, BasicRanged { energy_cost: 0, - holdable: false, + holdable: true, prepare_duration: Duration::from_millis(250), recover_duration: Duration::from_millis(200), projectile: Projectile { @@ -291,7 +317,7 @@ impl Tool { }, BasicRanged { energy_cost: 400, - holdable: false, + holdable: true, prepare_duration: Duration::from_millis(800), recover_duration: Duration::from_millis(50), projectile: Projectile { diff --git a/voxygen/src/anim/character/charge.rs b/voxygen/src/anim/character/charge.rs index be62c34405..4e71e03e85 100644 --- a/voxygen/src/anim/character/charge.rs +++ b/voxygen/src/anim/character/charge.rs @@ -64,8 +64,8 @@ impl Animation for ChargeAnimation { } * 1.3; next.head.offset = Vec3::new( - 0.0 + stop * -2.0, - -2.0 + stop * 2.5 + skeleton_attr.head.0, + stop * -2.0, + -3.5 + stop * 2.5 + skeleton_attr.head.0, skeleton_attr.head.1, ); next.head.ori = @@ -107,25 +107,31 @@ impl Animation for ChargeAnimation { next.control.scale = Vec3::one(); }, Some(ToolKind::Bow(_)) => { - next.l_hand.offset = Vec3::new(1.0, -4.0 + stop * -1.0, 0.0); + next.l_hand.offset = Vec3::new(1.0, -2.0 + stop * -1.0, 0.0); next.l_hand.ori = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); next.l_hand.scale = Vec3::one() * 1.05; - next.r_hand.offset = Vec3::new(3.0, -1.0, -5.0); + next.r_hand.offset = Vec3::new(4.9, 1.0, -5.0); next.r_hand.ori = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); next.r_hand.scale = Vec3::one() * 1.05; - next.main.offset = Vec3::new(3.0, 2.0, -13.0); + next.main.offset = Vec3::new(3.0, -1.0, -14.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.3) * Quaternion::rotation_z(-0.6); - next.control.offset = Vec3::new(-9.0 + stop * 13.0, 6.0 + stop * 4.0, 8.0); + next.hold.offset = Vec3::new(0.4, -0.3, -5.8); + next.hold.ori = Quaternion::rotation_x(-1.6) + * Quaternion::rotation_y(-0.1) + * Quaternion::rotation_z(0.0); + next.hold.scale = Vec3::one() * 1.0; + + next.control.offset = Vec3::new(-10.0 + stop * 13.0, 6.0 + stop * 4.0, 8.0); next.control.ori = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(stop * -0.5) - * Quaternion::rotation_z(stop * -0.9); + * Quaternion::rotation_y(stop * -0.4) + * Quaternion::rotation_z(stop * -0.6); next.control.scale = Vec3::one(); }, _ => {}, diff --git a/voxygen/src/anim/character/equip.rs b/voxygen/src/anim/character/equip.rs index a877968c11..1a6a1e95ab 100644 --- a/voxygen/src/anim/character/equip.rs +++ b/voxygen/src/anim/character/equip.rs @@ -20,7 +20,6 @@ impl Animation for EquipAnimation { ) -> Self::Skeleton { *rate = 1.0; let mut next = (*skeleton).clone(); - let lab = 1.0; let short = (((5.0) @@ -125,12 +124,12 @@ impl Animation for EquipAnimation { next.main.scale = Vec3::one(); }, Some(ToolKind::Bow(_)) => { - next.l_hand.offset = Vec3::new(1.0, -4.0, -1.0); + next.l_hand.offset = Vec3::new(2.0, 1.5, 0.0); next.l_hand.ori = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); next.l_hand.scale = Vec3::one() * 1.05; - next.r_hand.offset = Vec3::new(3.0, -1.0, -5.0); + next.r_hand.offset = Vec3::new(5.9, 4.5, -5.0); next.r_hand.ori = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); @@ -196,7 +195,7 @@ impl Animation for EquipAnimation { next.head.offset = Vec3::new( 0.0, -3.0 + skeleton_attr.head.0, - -1.0 + skeleton_attr.head.1 + short * 0.2, + skeleton_attr.head.1 + short * 0.2, ); next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); @@ -221,7 +220,7 @@ impl Animation for EquipAnimation { next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); - next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; + next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler; } next } diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 13e0278d23..23b493b459 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -65,7 +65,7 @@ impl CharacterSkeleton { impl Skeleton for CharacterSkeleton { type Attr = SkeletonAttr; - fn bone_count(&self) -> usize { 15 } + fn bone_count(&self) -> usize { 16 } fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3) { let chest_mat = self.chest.compute_base_matrix(); @@ -107,7 +107,11 @@ impl Skeleton for CharacterSkeleton { ), FigureBoneData::new(lantern_final_mat), FigureBoneData::new( - torso_mat * chest_mat * l_hand_mat * self.hold.compute_base_matrix(), + torso_mat + * chest_mat + * control_mat + * l_hand_mat + * self.hold.compute_base_matrix(), ), ], (lantern_final_mat * Vec4::new(0.0, 0.0, 0.0, 1.0)).xyz(), @@ -236,7 +240,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (Danari, Female) => (0.5, 13.5), }, chest: match (body.species, body.body_type) { - (_, _) => (0.0, 7.0), + (_, _) => (0.0, 8.0), }, belt: match (body.species, body.body_type) { (_, _) => (0.0, -2.0), @@ -251,7 +255,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (_, _) => (7.0, -0.25, 0.5), }, foot: match (body.species, body.body_type) { - (_, _) => (3.4, 0.5, 1.0), + (_, _) => (3.4, 0.5, 2.0), }, shoulder: match (body.species, body.body_type) { (_, _) => (5.0, 0.0, 5.0), diff --git a/voxygen/src/anim/character/shoot.rs b/voxygen/src/anim/character/shoot.rs index e666afb348..a8a7ce1956 100644 --- a/voxygen/src/anim/character/shoot.rs +++ b/voxygen/src/anim/character/shoot.rs @@ -21,7 +21,6 @@ impl Animation for ShootAnimation { let mut next = (*skeleton).clone(); let lab = 1.0; - let foot = (((5.0) / (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32))) .sqrt()) @@ -81,12 +80,12 @@ impl Animation for ShootAnimation { next.control.scale = Vec3::one(); }, Some(ToolKind::Bow(_)) => { - next.l_hand.offset = Vec3::new(1.0 - exp * 2.0, -4.0 - exp * 7.0, -1.0 + exp * 6.0); + next.l_hand.offset = Vec3::new(1.0 - exp * 2.0, -4.0 - exp * 4.0, -1.0 + exp * 6.0); next.l_hand.ori = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6 + exp * 0.8) * Quaternion::rotation_z(-0.3 + exp * 0.9); next.l_hand.scale = Vec3::one() * 1.05; - next.r_hand.offset = Vec3::new(3.0, -1.0, -5.0); + next.r_hand.offset = Vec3::new(4.9, 3.0, -4.0); next.r_hand.ori = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); @@ -168,6 +167,12 @@ impl Animation for ShootAnimation { Quaternion::rotation_x(exp * -0.7 + 0.4) * Quaternion::rotation_y(exp * 0.4); next.lantern.scale = Vec3::one() * 0.65; + next.hold.offset = Vec3::new(17.4, -24.8, -10.5); + next.hold.ori = Quaternion::rotation_x(-1.6) + * Quaternion::rotation_y(-0.1) + * Quaternion::rotation_z(0.0); + next.hold.scale = Vec3::one() * 0.0; + next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/stand.rs b/voxygen/src/anim/character/stand.rs index 9baadafbf7..c424ff7c86 100644 --- a/voxygen/src/anim/character/stand.rs +++ b/voxygen/src/anim/character/stand.rs @@ -124,7 +124,7 @@ impl Animation for StandAnimation { next.lantern.ori = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1); next.lantern.scale = Vec3::one() * 0.65; - next.torso.offset = Vec3::new(0.0, -0.1, 0.1) * skeleton_attr.scaler; + next.torso.offset = Vec3::new(0.0, 0.0, 0.) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; diff --git a/voxygen/src/anim/character/wield.rs b/voxygen/src/anim/character/wield.rs index 03e576fb4c..2c52c6153a 100644 --- a/voxygen/src/anim/character/wield.rs +++ b/voxygen/src/anim/character/wield.rs @@ -76,14 +76,14 @@ impl Animation for WieldAnimation { next.l_foot.offset = Vec3::new( -skeleton_attr.foot.0, - skeleton_attr.foot.1, + -2.0 + skeleton_attr.foot.1, skeleton_attr.foot.2, ); next.l_foot.ori = Quaternion::rotation_x(u_slowalt * 0.035 - 0.2); next.r_foot.offset = Vec3::new( skeleton_attr.foot.0, - skeleton_attr.foot.1, + 2.0 + skeleton_attr.foot.1, skeleton_attr.foot.2, ); next.r_foot.ori = Quaternion::rotation_x(u_slow * 0.035); @@ -200,7 +200,7 @@ impl Animation for WieldAnimation { * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); next.l_hand.scale = Vec3::one() * 1.05; - next.r_hand.offset = Vec3::new(4.0, 4.5, -5.0); + next.r_hand.offset = Vec3::new(5.9, 4.5, -5.0); next.r_hand.ori = Quaternion::rotation_x(1.20) * Quaternion::rotation_y(-0.6) * Quaternion::rotation_z(-0.3); @@ -210,6 +210,12 @@ impl Animation for WieldAnimation { * Quaternion::rotation_y(0.3) * Quaternion::rotation_z(-0.6); + next.hold.offset = Vec3::new(1.2, -1.0, -5.2); + next.hold.ori = Quaternion::rotation_x(-1.7) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(-0.1); + next.hold.scale = Vec3::one() * 1.0; + next.control.offset = Vec3::new(-7.0, 6.0, 6.0); next.control.ori = Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1); diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index d16bfacb8b..b7717367ff 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -59,7 +59,6 @@ image_ids! { // Skill Icons - bow_m2: "voxygen.element.icons.bow_m2", // Icons flower: "voxygen.element.icons.item_flower", @@ -142,7 +141,7 @@ image_ids! { twohaxe_m1: "voxygen.element.icons.2haxe_m1", twohaxe_m2: "voxygen.element.icons.2haxe_m2", bow_m1: "voxygen.element.icons.bow_m1", - //bow_m2: "voxygen.element.icons.bow_m2", + bow_m2: "voxygen.element.icons.bow_m2", staff_m1: "voxygen.element.icons.staff_m1", staff_m2: "voxygen.element.icons.staff_m2", flyingrod_m1: "voxygen.element.icons.debug_wand_m1", diff --git a/voxygen/src/hud/skillbar.rs b/voxygen/src/hud/skillbar.rs index fc352e4532..3c8fc56e1b 100644 --- a/voxygen/src/hud/skillbar.rs +++ b/voxygen/src/hud/skillbar.rs @@ -693,7 +693,7 @@ impl<'a> Widget for Skillbar<'a> { ToolKind::Sword(_) => self.imgs.charge, ToolKind::Hammer(_) => self.imgs.nothing, ToolKind::Axe(_) => self.imgs.nothing, - ToolKind::Bow(_) => 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, @@ -706,6 +706,7 @@ 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::Staff(_) => 30.0 * scale, + ToolKind::Bow(_) => 30.0 * scale, _ => 38.0 * scale, }, _ => 38.0 * scale, @@ -715,6 +716,7 @@ 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::Staff(_) => 30.0 * scale, + ToolKind::Bow(_) => 30.0 * scale, _ => 38.0 * scale, }, _ => 38.0 * scale, diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index be6778e981..cb89da0a1d 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -184,7 +184,7 @@ impl FigureModelCache { }, None, Some(humanoid_armor_lantern_spec.mesh_lantern(&body, loadout, generate_mesh)), - None, + Some(mesh_hold(generate_mesh)), ] }, Body::QuadrupedSmall(body) => { diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 7128a4fd73..d4ea8ccc41 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -964,6 +964,16 @@ pub fn mesh_glider( ) } +pub fn mesh_hold( + generate_mesh: impl FnOnce(&Segment, Vec3) -> Mesh, +) -> Mesh { + load_mesh( + "weapon.projectile.simple-arrow", + Vec3::new(-0.5, -6.0, -1.5), + generate_mesh, + ) +} + ///////// #[derive(Serialize, Deserialize)] pub struct QuadrupedSmallCentralSpec(HashMap<(QSSpecies, QSBodyType), SidedQSCentralVoxSpec>);