Add outcomes to animations

Functioning outcome sfx

Switch to animation events

Fix rebase
This commit is contained in:
James Melkonian 2021-03-29 16:54:16 -07:00
parent a37174d6f2
commit e83567c9dc
130 changed files with 819 additions and 465 deletions

View File

@ -68,6 +68,10 @@ pub enum Outcome {
pos: Vec3<f32>,
state: PoiseState,
},
Footstep {
pos: Vec3<f32>,
vel: f32,
},
}
impl Outcome {
@ -81,6 +85,7 @@ impl Outcome {
| Outcome::SummonedCreature { pos, .. }
| Outcome::Damage { pos, .. }
| Outcome::Block { pos, .. }
| Outcome::Footstep { pos, .. }
| Outcome::PoiseChange { pos, .. } => Some(*pos),
Outcome::BreakBlock { pos, .. } => Some(pos.map(|e| e as f32 + 0.5)),
Outcome::ExpChange { .. } | Outcome::ComboChange { .. } => None,

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
@ -32,9 +32,10 @@ impl Animation for AlphaAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab: f32 = 0.65 * s_a.tempo;
@ -202,6 +203,6 @@ impl Animation for AlphaAnimation {
},
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
@ -32,9 +32,10 @@ impl Animation for BeamAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
@ -124,6 +125,6 @@ impl Animation for BeamAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
@ -31,9 +31,10 @@ impl Animation for BetaAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab: f32 = 0.65 * s_a.tempo;
@ -203,6 +204,6 @@ impl Animation for BetaAnimation {
},
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
@ -32,9 +32,10 @@ impl Animation for BlinkAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab: f32 = 0.65 * s_a.tempo;
@ -107,6 +108,7 @@ impl Animation for BlinkAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -27,8 +27,9 @@ impl Animation for ChargeAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 1.0;
@ -147,6 +148,6 @@ impl Animation for ChargeAnimation {
Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
@ -29,9 +29,10 @@ impl Animation for DashAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 0.65 * s_a.tempo;
let speed = Vec2::<f32>::from(velocity).magnitude();
@ -139,6 +140,6 @@ impl Animation for DashAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -22,9 +22,10 @@ impl Animation for EquipAnimation {
anim_time: f32,
rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos();
let equip_slowa = 1.0 + (anim_time * 12.0 + PI / 4.0).cos();
@ -59,6 +60,7 @@ impl Animation for EquipAnimation {
},
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -21,8 +21,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 1.0;
let torso = (anim_time * lab + 1.5 * PI).sin() * 1.5;
@ -140,6 +141,6 @@ impl Animation for IdleAnimation {
next.foot_r.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -21,8 +21,9 @@ impl Animation for JumpAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 1.0;
let torso = (anim_time * lab + 1.5 * PI).sin();
@ -113,6 +114,6 @@ impl Animation for JumpAnimation {
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 8.0 * s_a.scaler;
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
@ -26,9 +26,10 @@ impl Animation for LeapAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1, movement2, movement3, movement4) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0),
@ -83,6 +84,6 @@ impl Animation for LeapAnimation {
next.foot_r.orientation = Quaternion::rotation_x(0.9 + movement3 * -1.7);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -40,8 +40,9 @@ impl Animation for RunAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let speedavg = Vec2::<f32>::from(avg_vel).magnitude();
@ -433,6 +434,6 @@ impl Animation for RunAnimation {
next.foot_r.orientation = Quaternion::rotation_x(-0.5 * speednorm + slow * 0.1);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
@ -27,9 +27,10 @@ impl Animation for ShockwaveAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
@ -97,6 +98,6 @@ impl Animation for ShockwaveAnimation {
next.foot_r.orientation = Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * -0.4);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
@ -43,11 +43,12 @@ impl Animation for ShootAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let speed = Vec2::<f32>::from(velocity).magnitude();
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 0.65 * s_a.tempo;
let speednorm = (speed / 12.0).powf(0.4);
@ -209,6 +210,6 @@ impl Animation for ShootAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
@ -26,9 +26,10 @@ impl Animation for SpinAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 1.0;
@ -123,6 +124,6 @@ impl Animation for SpinAnimation {
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
@ -32,9 +32,10 @@ impl Animation for SpinMeleeAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
@ -122,6 +123,6 @@ impl Animation for SpinMeleeAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
@ -24,9 +24,10 @@ impl Animation for StunnedAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 0.65 * s_a.tempo; //.65
@ -373,6 +374,6 @@ impl Animation for StunnedAnimation {
next.foot_r.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
@ -32,9 +32,10 @@ impl Animation for SummonAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
@ -114,6 +115,6 @@ impl Animation for SummonAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,8 +1,10 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::comp::item::{ToolKind, UniqueKind};
use common::{
comp::item::{ToolKind, UniqueKind},
};
use std::{f32::consts::PI, ops::Mul};
pub struct WieldAnimation;
@ -21,8 +23,9 @@ impl Animation for WieldAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let lab: f32 = 0.65 * s_a.tempo; //.65
@ -412,6 +415,6 @@ impl Animation for WieldAnimation {
next.foot_r.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedSmallSkeleton, SkeletonAttr,
};
use common::{
@ -47,8 +47,9 @@ impl Animation for AlphaAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let fast = (anim_time * 10.0).sin();
@ -140,6 +141,6 @@ impl Animation for AlphaAnimation {
},
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedSmallSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -42,8 +42,9 @@ impl Animation for DashAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let fast = (anim_time * 10.0).sin();
@ -104,6 +105,6 @@ impl Animation for DashAnimation {
next.tail.orientation = Quaternion::rotation_x(0.05 * fastalt * speednormcancel)
* Quaternion::rotation_z(fast * 0.15 * speednormcancel);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedSmallSkeleton, SkeletonAttr,
};
@ -22,8 +22,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slow = (anim_time * 4.0).sin();
next.foot_l.scale = Vec3::one() * s_a.scaler / 11.0;
@ -44,6 +45,6 @@ impl Animation for IdleAnimation {
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) * s_a.scaler / 11.0;
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) * s_a.scaler / 11.0;
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedSmallSkeleton, SkeletonAttr,
};
use std::{f32::consts::PI, ops::Mul};
@ -23,8 +23,9 @@ impl Animation for RunAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = 1.0;
let speednorm = (speed / 9.4).powf(0.4);
@ -158,6 +159,6 @@ impl Animation for RunAnimation {
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedSmallSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
@ -44,8 +44,9 @@ impl Animation for ShootAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let fast = (anim_time * 10.0).sin();
@ -148,6 +149,6 @@ impl Animation for ShootAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedSmallSkeleton, SkeletonAttr,
};
use common::{
@ -49,8 +49,9 @@ impl Animation for StunnedAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let speednorm = speed / 9.4;
@ -184,6 +185,7 @@ impl Animation for StunnedAnimation {
next.foot_r.position =
Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) * s_a.scaler / 11.0;
};
next
(next, anim_events)
}
}

View File

@ -1,8 +1,10 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BipedSmallSkeleton, SkeletonAttr,
};
use common::comp::item::{ToolKind, UniqueKind};
use common::{
comp::item::{ToolKind, UniqueKind},
};
use std::f32::consts::PI;
pub struct WieldAnimation;
@ -32,8 +34,9 @@ impl Animation for WieldAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let fastacc = (acc_vel * 2.0).sin();
@ -158,6 +161,6 @@ impl Animation for WieldAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -20,8 +20,9 @@ impl Animation for AlphaAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (move1base, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
@ -103,6 +104,6 @@ impl Animation for AlphaAnimation {
} else {
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use common::{states::utils::StageSection, util::Dir};
@ -30,8 +30,9 @@ impl Animation for BreatheAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2base, movement3, twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
@ -130,6 +131,6 @@ impl Animation for BreatheAnimation {
* Quaternion::rotation_y(tilt * 1.8);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use std::ops::Mul;
@ -20,8 +20,9 @@ impl Animation for FeedAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let duck_head_look = Vec2::new(
(global_time / 2.0 + anim_time / 8.0)
@ -95,6 +96,6 @@ impl Animation for FeedAnimation {
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.0);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
@ -19,8 +19,9 @@ impl Animation for FlyAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slow = (anim_time * 2.0).sin();
let fast = (anim_time * 4.0).sin();
@ -172,6 +173,6 @@ impl Animation for FlyAnimation {
next.foot_r.orientation = Quaternion::rotation_x(slow * -0.05);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use std::ops::Mul;
@ -20,8 +20,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let duck_head_look = Vec2::new(
(global_time / 2.0 + anim_time / 8.0)
@ -93,6 +94,6 @@ impl Animation for IdleAnimation {
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.0);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -20,8 +20,10 @@ impl Animation for RunAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(22.0);
*rate = 1.0;
@ -154,6 +156,6 @@ impl Animation for RunAnimation {
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(tilt * -0.5);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -21,8 +21,9 @@ impl Animation for ShockwaveAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2base, movement3, _twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.5), 0.0, 0.0, 0.0),
@ -101,6 +102,6 @@ impl Animation for ShockwaveAnimation {
} else {
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use common::{states::utils::StageSection, util::Dir};
@ -22,8 +22,9 @@ impl Animation for ShootAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2base, movement3, twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
@ -105,6 +106,6 @@ impl Animation for ShootAnimation {
} else {
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -20,8 +20,9 @@ impl Animation for StunnedAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let wave_slow_cos = (anim_time * 4.5).cos();
@ -86,6 +87,6 @@ impl Animation for StunnedAnimation {
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdLargeSkeleton, SkeletonAttr,
};
use std::ops::Mul;
@ -21,8 +21,9 @@ impl Animation for SwimAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let duck_head_look = Vec2::new(
(global_time / 2.0 + anim_time / 8.0)
@ -97,6 +98,6 @@ impl Animation for SwimAnimation {
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.0);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdMediumSkeleton, SkeletonAttr,
};
use std::ops::Mul;
@ -21,8 +21,9 @@ impl Animation for FeedAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let wave_slow = (anim_time * 4.5).sin();
let wave = (anim_time * 8.0).sin();
@ -66,6 +67,7 @@ impl Animation for FeedAnimation {
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdMediumSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -20,8 +20,9 @@ impl Animation for FlyAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 12.0; //14.0
@ -61,6 +62,7 @@ impl Animation for FlyAnimation {
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_r.orientation = Quaternion::rotation_x(-1.3 + footr * 0.06);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdMediumSkeleton, SkeletonAttr,
};
use std::ops::Mul;
@ -21,8 +21,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let wave_slow = (anim_time * 4.5).sin();
let wave_slow_cos = (anim_time * 4.5).cos();
@ -63,6 +64,7 @@ impl Animation for IdleAnimation {
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
BirdMediumSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -20,8 +20,9 @@ impl Animation for RunAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 16.0; //14.0
@ -62,6 +63,7 @@ impl Animation for RunAnimation {
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + footr * 1.0, s_a.foot.2) / 11.0;
next.leg_r.orientation = Quaternion::rotation_x(footr * 0.5);
next
(next, anim_events)
}
}

View File

@ -0,0 +1,43 @@
use super::{super::{AnimationEvent, Animation}, BirdSmallSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use super::super::vek::*;
pub struct IdleAnimation;
impl Animation for IdleAnimation {
type Dependency = f32;
type Skeleton = BirdSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"bird_small_idle\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_small_idle")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f32,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
next.head.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.torso.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
next.wing_l.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 10.88;
next.wing_r.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_r.scale = Vec3::one() / 10.88;
(next, anim_events)
}
}

View File

@ -0,0 +1,43 @@
use super::{super::{AnimationEvent, Animation}, BirdSmallSkeleton, SkeletonAttr};
//use std::f32::consts::PI;
use super::super::vek::*;
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (f32, f32);
type Skeleton = BirdSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"bird_small_jump\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_small_jump")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f32,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
next.head.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.torso.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
next.wing_l.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 10.88;
next.wing_r.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_r.scale = Vec3::one() / 10.88;
(next, anim_events)
}
}

View File

@ -0,0 +1,43 @@
use super::{super::{AnimationEvent, Animation}, BirdSmallSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use super::super::vek::*;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (f32, f32);
type Skeleton = BirdSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"bird_small_run\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_small_run")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, _global_time): Self::Dependency,
_anim_time: f32,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
next.head.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.torso.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
next.wing_l.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 10.88;
next.wing_r.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_r.scale = Vec3::one() / 10.88;
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -30,9 +30,10 @@ impl Animation for AlphaAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (move1, move2, move3, move2h) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
@ -300,6 +301,6 @@ impl Animation for AlphaAnimation {
next.lantern.orientation = next.hand_r.orientation.inverse();
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -32,9 +32,10 @@ impl Animation for BeamAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
@ -117,6 +118,6 @@ impl Animation for BeamAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -30,9 +30,10 @@ impl Animation for BetaAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
@ -131,6 +132,6 @@ impl Animation for BetaAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -32,9 +32,10 @@ impl Animation for BlockAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
@ -229,6 +230,6 @@ impl Animation for BlockAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -31,9 +31,10 @@ impl Animation for ChargeswingAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 1.0;
@ -174,6 +175,6 @@ impl Animation for ChargeswingAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -27,8 +27,10 @@ impl Animation for ClimbAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lateral = Vec2::<f32>::from(velocity).magnitude();
let speed = velocity.z;
*rate = speed;
@ -161,6 +163,6 @@ impl Animation for ClimbAnimation {
next.torso.position = Vec3::new(0.0, -0.2, 0.4) * s_a.scaler;
};
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -21,8 +21,9 @@ impl Animation for DanceAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
*rate = 1.0;
@ -107,6 +108,6 @@ impl Animation for DanceAnimation {
next.torso.position = Vec3::new(0.0, -0.3, 0.0) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(short * -0.2);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -31,9 +31,10 @@ impl Animation for DashAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1, movement2, movement3, move4) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
@ -175,6 +176,6 @@ impl Animation for DashAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -22,9 +22,11 @@ impl Animation for EquipAnimation {
anim_time: f32,
rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos();
let equip_slowa = 1.0 + (anim_time * 12.0 + PI / 4.0).cos();
next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57);
@ -55,6 +57,6 @@ impl Animation for EquipAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
@ -20,8 +20,10 @@ impl Animation for GlideWieldAnimation {
_anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
*rate = 1.0;
next.hand_l.position = Vec3::new(-2.0 - s_a.hand.0, s_a.hand.1, s_a.hand.2 + 15.0);
@ -34,6 +36,6 @@ impl Animation for GlideWieldAnimation {
next.glider.position = Vec3::new(0.0, -5.0, 13.0);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use std::ops::Mul;
@ -23,8 +23,9 @@ impl Animation for GlidingAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speednorm = velocity.magnitude().min(50.0) / 50.0;
let slow = (acc_vel * 0.5).sin();
@ -77,6 +78,6 @@ impl Animation for GlidingAnimation {
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + speedlog * -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(-speedlog + slow * 0.3 * speedlog);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
@ -27,8 +27,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slow = (anim_time * 1.0).sin();
let head_look = Vec2::new(
@ -146,6 +147,6 @@ impl Animation for IdleAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,8 +1,10 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use common::{
comp::item::{Hands, ToolKind},
};
use std::f32::consts::PI;
pub struct JumpAnimation;
@ -30,8 +32,9 @@ impl Animation for JumpAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slow = (anim_time * 7.0).sin();
let subtract = global_time - anim_time as f32;
@ -238,6 +241,6 @@ impl Animation for JumpAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -30,9 +30,10 @@ impl Animation for LeapAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1, movement2, movement3, move4) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0),
@ -241,6 +242,6 @@ impl Animation for LeapAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -30,9 +30,10 @@ impl Animation for RepeaterAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (move1, move2, move3, _move4) = match stage_section {
Some(StageSection::Movement) => (anim_time, 0.0, 0.0, 0.0),
@ -104,6 +105,6 @@ impl Animation for RepeaterAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
@ -31,9 +31,10 @@ impl Animation for RollAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
@ -113,6 +114,6 @@ impl Animation for RollAnimation {
next.torso.orientation = Quaternion::rotation_x(movement1 * -0.4 + movement2 * -2.0 * PI)
* Quaternion::rotation_z(tilt * -10.0);
next
(next, anim_events)
}
}

View File

@ -1,8 +1,10 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use common::{
comp::item::{Hands, ToolKind},
};
use std::{f32::consts::PI, ops::Mul};
pub struct RunAnimation;
@ -44,8 +46,9 @@ impl Animation for RunAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let mut anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = 1.0;
@ -309,6 +312,13 @@ impl Animation for RunAnimation {
next.second = next.main;
}
next
if (footvertsl).abs() < 0.1 {
anim_events.push(AnimationEvent::Footstep { pos_offset: (next.foot_l.position + next.torso.position) / 11.0 });
}
if (footvertsr).abs() < 0.1 {
anim_events.push(AnimationEvent::Footstep { pos_offset: (next.foot_r.position + next.torso.position) / 11.0 });
}
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -34,9 +34,10 @@ impl Animation for ShockwaveAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
@ -113,6 +114,6 @@ impl Animation for ShockwaveAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -45,12 +45,12 @@ impl Animation for ShootAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
*rate = 1.0;
let speed = Vec2::<f32>::from(velocity).magnitude();
let mut next = (*skeleton).clone();
let lab: f32 = 1.0;
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
@ -183,6 +183,6 @@ impl Animation for ShootAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -21,8 +21,9 @@ impl Animation for SitAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slow = (anim_time * 1.0).sin();
let slowa = (anim_time * 1.0 + PI / 2.0).sin();
@ -107,6 +108,6 @@ impl Animation for SitAnimation {
* Quaternion::rotation_y(fast2 * 0.1);
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -22,8 +22,10 @@ impl Animation for SneakAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = 1.0;
let slow = (anim_time * 3.0).sin();
@ -167,6 +169,6 @@ impl Animation for SneakAnimation {
next.lantern.orientation = next.hand_r.orientation.inverse();
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -31,9 +31,10 @@ impl Animation for SpinAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
@ -252,6 +253,6 @@ impl Animation for SpinAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -32,7 +32,10 @@ impl Animation for SpinMeleeAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
*rate = 1.0;
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
@ -43,7 +46,6 @@ impl Animation for SpinMeleeAnimation {
let pullback = 1.0 - movement3;
let move1 = movement1 * pullback;
let move2 = movement2 * pullback;
let mut next = (*skeleton).clone();
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
@ -209,6 +211,6 @@ impl Animation for SpinMeleeAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -43,9 +43,10 @@ impl Animation for StaggeredAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0),
@ -260,6 +261,6 @@ impl Animation for StaggeredAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,8 +1,8 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use common::{comp::item::{Hands, ToolKind}};
use std::ops::Mul;
pub struct StandAnimation;
@ -28,8 +28,9 @@ impl Animation for StandAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slow = (anim_time * 1.0).sin();
let impact = (avg_vel.z).max(-15.0);
@ -173,6 +174,6 @@ impl Animation for StandAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -43,9 +43,10 @@ impl Animation for StunnedAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0),
@ -220,6 +221,6 @@ impl Animation for StunnedAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,8 +1,10 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use common::{
comp::item::{Hands, ToolKind},
};
use std::{f32::consts::PI, ops::Mul};
pub struct SwimAnimation;
@ -42,8 +44,9 @@ impl Animation for SwimAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let avgspeed = Vec2::<f32>::from(avg_vel).magnitude();
let avgtotal = avg_vel.magnitude();
@ -268,6 +271,6 @@ impl Animation for SwimAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,8 +1,8 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use common::{comp::item::{Hands, ToolKind}};
use std::{f32::consts::PI, ops::Mul};
pub struct SwimWieldAnimation;
@ -29,8 +29,9 @@ impl Animation for SwimWieldAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
*rate = 1.0;
let lab: f32 = 1.0;
let speed = Vec3::<f32>::from(velocity).magnitude();
@ -335,6 +336,6 @@ impl Animation for SwimWieldAnimation {
next.second = next.main;
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, util::Dir};
@ -22,9 +22,10 @@ impl Animation for TalkAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slowa = (anim_time * 6.0).sin();
let slowb = (anim_time * 4.0 + PI / 2.0).sin();
@ -49,6 +50,6 @@ impl Animation for TalkAnimation {
next.hand_r.orientation = Quaternion::rotation_y(0.2 + slowa * -0.1 + slowb * 0.07)
* Quaternion::rotation_x(1.3 + slowb * -0.15 + slowc * 0.05);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{
@ -44,12 +44,14 @@ impl Animation for WieldAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let mut anim_events: Vec<AnimationEvent> = Vec::new();
*rate = 1.0;
let lab: f32 = 1.0;
let speed = Vec2::<f32>::from(velocity).magnitude();
let speednorm = speed / 9.5;
let mut next = (*skeleton).clone();
let head_look = Vec2::new(
(global_time + anim_time / 3.0).floor().mul(7331.0).sin() * 0.2,
(global_time + anim_time / 3.0).floor().mul(1337.0).sin() * 0.1,
@ -349,7 +351,13 @@ impl Animation for WieldAnimation {
tilt * 1.0 * fast + tilt * 1.0 + fast2 * speednorm * 0.25 + fast2 * 0.1,
);
}
if (footvertlstatic).abs() < 0.1 {
anim_events.push(AnimationEvent::Footstep { pos_offset: (next.foot_l.position + next.main.position) / 11.0 });
}
if (footvertrstatic).abs() < 0.1 {
anim_events.push(AnimationEvent::Footstep { pos_offset: (next.foot_r.position + next.main.position) / 11.0 });
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
DragonSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -20,8 +20,9 @@ impl Animation for FlyAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 12.0;
@ -105,6 +106,6 @@ impl Animation for FlyAnimation {
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.orientation = Quaternion::rotation_y((-0.35 + wingr * 0.6).min(-0.2));
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
DragonSkeleton, SkeletonAttr,
};
use std::{f32::consts::PI, ops::Mul};
@ -20,8 +20,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let ultra_slow = (anim_time * 1.0).sin();
let slow = (anim_time * 2.5).sin();
@ -93,6 +94,6 @@ impl Animation for IdleAnimation {
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.orientation = Quaternion::rotation_y(2.0 - slow * 0.02);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
DragonSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -20,8 +20,9 @@ impl Animation for RunAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 0.6; //6
@ -154,6 +155,6 @@ impl Animation for RunAnimation {
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.orientation = Quaternion::rotation_y(2.0 + tilt * 1.0);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
FishMediumSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -23,8 +23,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slow = (anim_time * 3.5 + PI).sin();
let slowalt = (anim_time * 3.5 + PI + 0.2).sin();
@ -51,6 +52,7 @@ impl Animation for IdleAnimation {
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
next.fin_r.orientation = Quaternion::rotation_z(-slow * 0.1 + 0.1);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
FishMediumSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -23,8 +23,9 @@ impl Animation for SwimAnimation {
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slowalt = (acc_vel * s_a.tempo / 1.5 + PI + 0.2).sin();
let fast = (acc_vel * s_a.tempo + PI).sin();
@ -69,6 +70,7 @@ impl Animation for SwimAnimation {
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
next.fin_r.orientation = Quaternion::rotation_z(fast * -slowvel + 0.1 + tilt * -0.5);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
FishSmallSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -23,8 +23,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slow = (anim_time * 3.5 + PI).sin();
@ -40,6 +41,7 @@ impl Animation for IdleAnimation {
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
next.fin_r.orientation = Quaternion::rotation_z(-slow * 0.1 + 0.1);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
FishSmallSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -23,8 +23,9 @@ impl Animation for SwimAnimation {
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let fast = (acc_vel * s_a.tempo + PI).sin();
@ -59,6 +60,7 @@ impl Animation for SwimAnimation {
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
next.fin_r.orientation = Quaternion::rotation_z(fast * -0.6 * slowvel + 0.3 + tilt * -0.5);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
GolemSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -21,8 +21,9 @@ impl Animation for AlphaAnimation {
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (move1base, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
@ -80,6 +81,7 @@ impl Animation for AlphaAnimation {
Quaternion::rotation_y(0.0) * Quaternion::rotation_x(move1 * -1.0 + move2 * 1.8);
};
next.torso.position = Vec3::new(0.0, move1 * 0.7, move1 * -0.3);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
GolemSkeleton, SkeletonAttr,
};
use std::{f32::consts::PI, ops::Mul};
@ -21,8 +21,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let lab: f32 = 1.0;
let breathe = (anim_time * lab + 1.5 * PI).sin();
@ -82,6 +83,7 @@ impl Animation for IdleAnimation {
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + breathe * -0.2);
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
GolemSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -21,8 +21,9 @@ impl Animation for RunAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = Vec2::<f32>::from(velocity).magnitude();
let mixed_vel = acc_vel + anim_time * 2.0; //sets run frequency using speed, with anim_time setting a floor
@ -136,6 +137,7 @@ impl Animation for RunAnimation {
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
next.torso.orientation = Quaternion::rotation_x(-0.2 * speednorm);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
GolemSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -22,8 +22,9 @@ impl Animation for ShockwaveAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (move1base, move2base, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
@ -75,6 +76,7 @@ impl Animation for ShockwaveAnimation {
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + move2);
} else {
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
GolemSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -22,8 +22,9 @@ impl Animation for SpinMeleeAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
@ -83,6 +84,6 @@ impl Animation for SpinMeleeAnimation {
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
next.torso.orientation = Quaternion::rotation_z(0.0);
next
(next, anim_events)
}
}

View File

@ -149,7 +149,7 @@ pub trait Animation {
_anim_time: f32,
_rate: &mut f32,
_skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
) -> Self::Skeleton;
) -> (Self::Skeleton, Vec<AnimationEvent>);
/// Calls `update_skeleton_inner` either directly or via `libloading` to
/// generate the new skeleton.
@ -159,7 +159,7 @@ pub trait Animation {
anim_time: f32,
rate: &mut f32,
skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
#[cfg(not(feature = "use-dyn-lib"))]
{
Self::update_skeleton_inner(skeleton, dependency, anim_time, rate, skeleton_attr)
@ -176,7 +176,7 @@ pub trait Animation {
f32,
&mut f32,
&<Self::Skeleton as Skeleton>::Attr,
) -> Self::Skeleton,
) -> (Self::Skeleton, Vec<AnimationEvent>),
> = unsafe {
//let start = std::time::Instant::now();
// Overhead of 0.5-5 us (could use hashmap to mitigate if this is an issue)
@ -199,3 +199,12 @@ pub trait Animation {
}
}
}
pub enum AnimationEvent {
Footstep {
pos_offset: Vec3<f32>,
},
WeaponTrail {
pos_offset: Vec3<f32>,
},
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
ObjectSkeleton, SkeletonAttr,
};
use common::{
@ -29,10 +29,10 @@ impl Animation for BeamAnimation {
_anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0;
next.bone0.orientation = Quaternion::rotation_z(0.0);
@ -40,6 +40,6 @@ impl Animation for BeamAnimation {
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0;
next.bone1.orientation = Quaternion::rotation_z(0.0);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
ObjectSkeleton, SkeletonAttr,
};
use common::comp::item::ToolKind;
@ -21,13 +21,14 @@ impl Animation for IdleAnimation {
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0;
next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0;
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
ObjectSkeleton, SkeletonAttr,
};
use common::{
@ -29,10 +29,11 @@ impl Animation for ShootAnimation {
anim_time: f32,
rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
*rate = 1.0;
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
@ -57,6 +58,6 @@ impl Animation for ShootAnimation {
_ => {},
}
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -21,8 +21,9 @@ impl Animation for AlphaAnimation {
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0),
@ -55,6 +56,7 @@ impl Animation for AlphaAnimation {
next.tail_rear.orientation = Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -21,8 +21,9 @@ impl Animation for BetaAnimation {
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0),
@ -55,6 +56,7 @@ impl Animation for BetaAnimation {
next.tail_rear.orientation = Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * 0.2);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -22,8 +22,9 @@ impl Animation for BreatheAnimation {
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, _movement2base, movement3, twitch) = match stage_section {
@ -66,8 +67,8 @@ impl Animation for BreatheAnimation {
next.foot_bl.orientation = Quaternion::rotation_y(twitch2 * 0.02);
next.foot_br.orientation = Quaternion::rotation_y(twitch2 * 0.02);
} else {
};
next
}
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -22,8 +22,9 @@ impl Animation for DashAnimation {
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, chargemovementbase, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0),
@ -76,6 +77,6 @@ impl Animation for DashAnimation {
-0.12 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2,
) * Quaternion::rotation_z(shortalt * 0.15 + twitch1fast * 0.3);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use std::{f32::consts::PI, ops::Mul};
@ -20,8 +20,9 @@ impl Animation for IdleAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let slower = (anim_time * 1.25).sin();
let slow = (anim_time * 2.5).sin();
@ -80,6 +81,6 @@ impl Animation for IdleAnimation {
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation = Quaternion::rotation_y(slow * -0.05);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
@ -19,8 +19,9 @@ impl Animation for JumpAnimation {
_anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
next.jaw.scale = Vec3::one() * 0.98;
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
@ -47,6 +48,6 @@ impl Animation for JumpAnimation {
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use std::f32::consts::PI;
@ -20,8 +20,9 @@ impl Animation for RunAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(15.0);
let speednorm = (speed / 15.0).powf(0.25);
@ -152,6 +153,6 @@ impl Animation for RunAnimation {
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothorirb * -0.4 + tilt * -2.0);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -20,8 +20,9 @@ impl Animation for ShootAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
@ -60,8 +61,8 @@ impl Animation for ShootAnimation {
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
} else {
};
next
}
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -21,8 +21,9 @@ impl Animation for StunnedAnimation {
anim_time: f32,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2, twitch) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
@ -53,6 +54,7 @@ impl Animation for StunnedAnimation {
next.tail_rear.orientation =
Quaternion::rotation_x(-0.12) * Quaternion::rotation_z(movement1 * -0.4);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -20,8 +20,9 @@ impl Animation for TailwhipAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let (movement1base, movement2base, movement3, twitch1, twitch2) = match stage_section {
Some(StageSection::Charge) => {
@ -70,6 +71,7 @@ impl Animation for TailwhipAnimation {
+ movement2 * 0.7
+ twitch2 * 0.3 * mirror,
);
next
(next, anim_events)
}
}

View File

@ -1,5 +1,5 @@
use super::{
super::{vek::*, Animation},
super::{AnimationEvent, vek::*, Animation},
QuadrupedMediumSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
@ -20,8 +20,9 @@ impl Animation for AlphaAnimation {
anim_time: f32,
_rate: &mut f32,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
) -> (Self::Skeleton, Vec<AnimationEvent>) {
let mut next = (*skeleton).clone();
let anim_events: Vec<AnimationEvent> = Vec::new();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, movement2base, movement3) = match stage_section {
@ -94,7 +95,8 @@ impl Animation for AlphaAnimation {
next.foot_br.orientation =
Quaternion::rotation_x(movement1abs * -0.5 + movement2abs * -0.3);
};
next
}
(next, anim_events)
}
}

Some files were not shown because too many files have changed in this diff Show More