mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added ability to use 2 x 1h weapons or shields
This commit is contained in:
parent
0a8c896572
commit
d53b51954b
@ -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
|
||||
|
||||
|
@ -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<Right-Click to use>",
|
||||
kind: Tool(
|
||||
(
|
||||
kind: Dagger(BasicDagger),
|
||||
|
@ -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<Right-Click to use>",
|
||||
kind: Tool (
|
||||
(
|
||||
kind: Shield(BasicShield),
|
||||
|
@ -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
|
||||
|
BIN
assets/voxygen/voxel/weapon/dagger/dagger_rusty.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/weapon/dagger/dagger_rusty.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/weapon/shield/wood-0.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/weapon/shield/wood-0.vox
(Stored with Git LFS)
Binary file not shown.
@ -2,7 +2,7 @@ pub mod armor;
|
||||
pub mod tool;
|
||||
|
||||
// Reexports
|
||||
pub use tool::{DebugKind, SwordKind, Tool, ToolCategory, ToolKind};
|
||||
pub use tool::{DebugKind, Hands, SwordKind, Tool, ToolCategory, ToolKind};
|
||||
|
||||
use crate::{
|
||||
assets::{self, Asset},
|
||||
|
@ -115,6 +115,28 @@ pub enum ToolKind {
|
||||
Empty,
|
||||
}
|
||||
|
||||
impl ToolKind {
|
||||
pub fn into_hands(self) -> 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 {
|
||||
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 {
|
||||
|
@ -18,7 +18,11 @@ use vek::*;
|
||||
pub type Segment = Dyna<Cell, ()>;
|
||||
|
||||
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<Cell>) -> Self {
|
||||
for pos in self.full_pos_iter() {
|
||||
|
@ -16,6 +16,7 @@ pub struct EntityInfo {
|
||||
pub body: Body,
|
||||
pub name: Option<String>,
|
||||
pub main_tool: Option<Item>,
|
||||
pub second_tool: Option<Item>,
|
||||
pub scale: f32,
|
||||
pub level: Option<u32>,
|
||||
pub loot_drop: Option<Item>,
|
||||
@ -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
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
item::{ItemKind, Tool},
|
||||
item::{Hands, ItemKind, Tool},
|
||||
CharacterState, StateUpdate,
|
||||
},
|
||||
event::LocalEvent,
|
||||
@ -188,6 +188,21 @@ 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() {
|
||||
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
|
||||
@ -197,6 +212,20 @@ pub fn handle_ability2_input(data: &JoinData, update: &mut StateUpdate) {
|
||||
{
|
||||
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();
|
||||
}
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 { .. } => {},
|
||||
|
@ -18,7 +18,7 @@ pub enum DynaError {
|
||||
pub struct Dyna<V: Vox, M, A: Access = ColumnAccess> {
|
||||
vox: Vec<V>,
|
||||
meta: M,
|
||||
sz: Vec3<u32>,
|
||||
pub sz: Vec3<u32>,
|
||||
_phantom: std::marker::PhantomData<A>,
|
||||
}
|
||||
|
||||
|
@ -6,13 +6,13 @@ use vek::*;
|
||||
pub struct GlideWieldAnimation;
|
||||
|
||||
impl Animation for GlideWieldAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, 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,
|
||||
|
@ -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<ToolKind>, f32, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f32, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f32, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f32, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
);
|
||||
|
||||
impl Animation for GlideWieldAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, 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);
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Dagger(_)) => {
|
||||
next.main.offset = Vec3::new(-4.0, -5.0, 7.0);
|
||||
next.main.ori =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25);
|
||||
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;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
);
|
||||
|
||||
impl Animation for GlidingAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, 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();
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
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;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
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;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
);
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f32, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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;
|
||||
|
||||
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() + slow_abs * -0.05;
|
||||
},
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
);
|
||||
|
||||
impl Animation for SwimAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, 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;
|
||||
|
||||
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 + short * 0.25);
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -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<ToolKind>, f32, f64);
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, 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
|
||||
}
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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,67 +675,66 @@ 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),
|
||||
.color(match tool_kind {
|
||||
Some(ToolKind::Bow(_)) => Some(BG_COLOR_2),
|
||||
Some(ToolKind::Staff(_)) => Some(BG_COLOR_2),
|
||||
_ => 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,
|
||||
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,
|
||||
},
|
||||
_ => 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,
|
||||
}) // 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,
|
||||
},
|
||||
)
|
||||
.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,
|
||||
},
|
||||
)
|
||||
})
|
||||
.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(_) => {
|
||||
.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)
|
||||
}
|
||||
},
|
||||
ToolKind::Staff(StaffKind::Sceptre) => {
|
||||
Some(ToolKind::Staff(StaffKind::Sceptre)) => {
|
||||
if self.energy.current() as f64 >= 400.0 {
|
||||
Color::Rgba(1.0, 1.0, 1.0, 1.0)
|
||||
} else {
|
||||
@ -741,10 +742,7 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
}
|
||||
},
|
||||
_ => Color::Rgba(1.0, 1.0, 1.0, 1.0),
|
||||
},
|
||||
_ => 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
|
||||
|
@ -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)
|
||||
|
@ -177,12 +177,25 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
{
|
||||
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)),
|
||||
]
|
||||
|
@ -46,6 +46,9 @@ fn graceful_load_vox(mesh_name: &str) -> Arc<DotVoxData> {
|
||||
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<f32>) -> Mesh<FigurePipeline>,
|
||||
) -> Mesh<FigurePipeline> {
|
||||
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<Self> {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user