bunch of animations and more attacks

This commit is contained in:
jshipsey 2020-11-21 14:06:36 -05:00 committed by Sam
parent 6f72e68ad6
commit f411ff7e04
43 changed files with 944 additions and 66 deletions

View File

@ -1,10 +0,0 @@
BasicMelee(
energy_cost: 0,
buildup_duration: 500,
swing_duration: 150,
recover_duration: 400,
base_damage: 200,
knockback: 25.0,
range: 4.0,
max_angle: 120.0,
)

View File

@ -0,0 +1,23 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
max_damage: 60,
damage_increase: 10,
knockback: 5.0,
range: 3.5,
angle: 60.0,
base_buildup_duration: 500,
base_swing_duration: 150,
base_recover_duration: 400,
forward_movement: 3.0,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -0,0 +1,14 @@
BasicBeam(
buildup_duration: 400,
recover_duration: 250,
beam_duration: 500,
base_hps: 0,
base_dps: 150,
tick_rate: 3.0,
range: 15.0,
max_angle: 22.5,
lifesteal_eff: 0.0,
energy_regen: 0,
energy_cost: 0,
energy_drain: 0,
)

View File

@ -0,0 +1,49 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
max_damage: 120,
damage_increase: 10,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 900,
base_swing_duration: 100,
base_recover_duration: 300,
forward_movement: 2.0,
),
(
stage: 2,
base_damage: 80,
max_damage: 110,
damage_increase: 15,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 500,
base_swing_duration: 100,
base_recover_duration: 300,
forward_movement: 1.5,
),
(
stage: 3,
base_damage: 130,
max_damage: 170,
damage_increase: 20,
knockback: 10.0,
range: 3.5,
angle: 30.0,
base_buildup_duration: 500,
base_swing_duration: 100,
base_recover_duration: 300,
forward_movement: 1.5,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -1,10 +0,0 @@
BasicMelee(
energy_cost: 0,
buildup_duration: 600,
swing_duration: 100,
recover_duration: 350,
base_damage: 200,
knockback: 25.0,
range: 2.0,
max_angle: 120.0,
)

View File

@ -0,0 +1,23 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
max_damage: 60,
damage_increase: 10,
knockback: 5.0,
range: 3.5,
angle: 60.0,
base_buildup_duration: 500,
base_swing_duration: 150,
base_recover_duration: 400,
forward_movement: 3.0,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -5,39 +5,39 @@ ComboMelee(
base_damage: 100,
max_damage: 120,
damage_increase: 10,
knockback: 5.0,
knockback: 10.0,
range: 3.5,
angle: 60.0,
base_buildup_duration: 800,
base_swing_duration: 150,
base_recover_duration: 400,
forward_movement: 3.0,
angle: 30.0,
base_buildup_duration: 900,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 2.0,
),
(
stage: 2,
base_damage: 80,
max_damage: 110,
damage_increase: 15,
knockback: 5.0,
knockback: 10.0,
range: 3.5,
angle: 60.0,
base_buildup_duration: 600,
base_swing_duration: 150,
base_recover_duration: 300,
forward_movement: 3.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 1.0,
),
(
stage: 3,
base_damage: 130,
max_damage: 170,
damage_increase: 20,
knockback: 5.0,
knockback: 10.0,
range: 3.5,
angle: 60.0,
base_buildup_duration: 600,
base_swing_duration: 150,
base_recover_duration: 300,
forward_movement: 4.5,
angle: 30.0,
base_buildup_duration: 200,
base_swing_duration: 100,
base_recover_duration: 200,
forward_movement: 1.0,
),
],
initial_energy_gain: 0,

View File

@ -0,0 +1,23 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 10,
max_damage: 20,
damage_increase: 10,
knockback: 5.0,
range: 3.5,
angle: 60.0,
base_buildup_duration: 300,
base_swing_duration: 150,
base_recover_duration: 300,
forward_movement: 1.0,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -0,0 +1,23 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
max_damage: 60,
damage_increase: 10,
knockback: 5.0,
range: 7.5,
angle: 60.0,
base_buildup_duration: 500,
base_swing_duration: 150,
base_recover_duration: 400,
forward_movement: 3.0,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -0,0 +1,49 @@
ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
max_damage: 120,
damage_increase: 10,
knockback: 10.0,
range: 7.5,
angle: 30.0,
base_buildup_duration: 900,
base_swing_duration: 150,
base_recover_duration: 300,
forward_movement: 3.0,
),
(
stage: 2,
base_damage: 80,
max_damage: 110,
damage_increase: 15,
knockback: 10.0,
range: 5.5,
angle: 30.0,
base_buildup_duration: 500,
base_swing_duration: 150,
base_recover_duration: 150,
forward_movement: 2.0,
),
(
stage: 3,
base_damage: 130,
max_damage: 170,
damage_increase: 20,
knockback: 10.0,
range: 5.5,
angle: 30.0,
base_buildup_duration: 350,
base_swing_duration: 125,
base_recover_duration: 900,
forward_movement: 2.0,
),
],
initial_energy_gain: 0,
max_energy_gain: 100,
energy_increase: 20,
speed_increase: 0.05,
max_speed_increase: 1.8,
is_interruptible: true,
)

View File

@ -79,8 +79,8 @@
skills: [],
),
Unique(QuadMedHoof): (
primary: "common.abilities.unique.quadmedbasic.basic",
secondary: "common.abilities.unique.quadmedbasic.basic",
primary: "common.abilities.unique.quadmedhoof.basic",
secondary: "common.abilities.unique.quadmedhoof.basic",
skills: [],
),
Unique(QuadMedBasic): (
@ -89,10 +89,15 @@
skills: [],
),
Unique(QuadLowRanged): (
primary: "common.abilities.unique.quadlowranged.basic",
primary: "common.abilities.unique.quadlowranged.singlestrike",
secondary: "common.abilities.unique.quadlowranged.firebomb",
skills: [],
),
Unique(QuadLowBreathe): (
primary: "common.abilities.unique.quadlowbreathe.flamethrower",
secondary: "common.abilities.unique.quadlowbreathe.triplestrike",
skills: [],
),
Unique(QuadLowTail): (
primary: "common.abilities.unique.quadlowtail.charged",
secondary: "common.abilities.unique.quadlowtail.triplestrike",
@ -105,7 +110,17 @@
),
Unique(QuadLowBasic): (
primary: "common.abilities.unique.quadlowbasic.triplestrike",
secondary: "common.abilities.unique.quadlowbasic.basic",
secondary: "common.abilities.unique.quadlowbasic.singlestrike",
skills: [],
),
Unique(QuadSmallBasic): (
primary: "common.abilities.unique.quadsmallbasic.singlestrike",
secondary: "common.abilities.unique.quadsmallbasic.singlestrike",
skills: [],
),
Unique(TheropodBasic): (
primary: "common.abilities.unique.theropodbasic.triplestrike",
secondary: "common.abilities.unique.theropodbasic.triplestrike",
skills: [],
),
Debug: (

View File

@ -0,0 +1,15 @@
ItemDef(
name: "Quad Low Breathe",
description: "testing123",
kind: Tool(
(
kind: Unique(QuadLowBreathe),
stats: (
equip_time_millis: 10,
power: 1.00,
speed: 1.00,
),
)
),
quality: Low,
)

View File

@ -0,0 +1,15 @@
ItemDef(
name: "Quad Small Basic",
description: "testing123",
kind: Tool(
(
kind: Unique(QuadSmallBasic),
stats: (
equip_time_millis: 10,
power: 1.00,
speed: 1.00,
),
)
),
quality: Low,
)

View File

@ -0,0 +1,15 @@
ItemDef(
name: "Theropod Basic",
description: "testing123",
kind: Tool(
(
kind: Unique(TheropodBasic),
stats: (
equip_time_millis: 10,
power: 1.00,
speed: 1.00,
),
)
),
quality: Low,
)

View File

@ -769,6 +769,10 @@
"hakulaq": {
"keyword": "hakulaq",
"generic": "Hakulaq"
},
"lavadrake": {
"keyword": "lavadrake",
"generic": "Lava Drake"
}
}
}

BIN
assets/voxygen/voxel/npc/lavadrake/male/chest.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/foot_bl.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/foot_br.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/foot_fl.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/foot_fr.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/head_lower.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/head_upper.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/jaw.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/tail_front.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/lavadrake/male/tail_rear.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -572,4 +572,56 @@
central: ("npc.sandshark.male.tail_front"),
),
),
(Lavadrake, Male): (
upper: (
offset: (-6.5, -2.0, -6.0),
central: ("npc.lavadrake.male.head_upper"),
),
lower: (
offset: (-6.5, -1.0, -3.0),
central: ("npc.lavadrake.male.head_lower"),
),
jaw: (
offset: (-3.5, 0.0, -5.0),
central: ("npc.lavadrake.male.jaw"),
),
chest: (
offset: (-9.5, -11.5, -11.5),
central: ("npc.lavadrake.male.chest"),
),
tail_rear: (
offset: (-6.5, -24.0, -3.5),
central: ("npc.lavadrake.male.tail_rear"),
),
tail_front: (
offset: (-5.5, -12.0, -6.5),
central: ("npc.lavadrake.male.tail_front"),
),
),
(Lavadrake, Female): (
upper: (
offset: (-6.5, -2.0, -6.0),
central: ("npc.lavadrake.male.head_upper"),
),
lower: (
offset: (-6.5, -1.0, -3.0),
central: ("npc.lavadrake.male.head_lower"),
),
jaw: (
offset: (-3.5, 0.0, -5.0),
central: ("npc.lavadrake.male.jaw"),
),
chest: (
offset: (-9.5, -11.5, -11.5),
central: ("npc.lavadrake.male.chest"),
),
tail_rear: (
offset: (-6.5, -24.0, -3.5),
central: ("npc.lavadrake.male.tail_rear"),
),
tail_front: (
offset: (-5.5, -12.0, -6.5),
central: ("npc.lavadrake.male.tail_front"),
),
),
})

View File

@ -395,4 +395,40 @@
lateral: ("npc.sandshark.male.foot_br"),
),
),
(Lavadrake, Male): (
front_left: (
offset: (-14.0, -4.0, -10.0),
lateral: ("npc.lavadrake.male.foot_fl"),
),
front_right: (
offset: (0.0, -4.0, -10.0),
lateral: ("npc.lavadrake.male.foot_fr"),
),
back_left: (
offset: (-14.0, -7.5, -10.0),
lateral: ("npc.lavadrake.male.foot_bl"),
),
back_right: (
offset: (0.0, -7.5, -10.0),
lateral: ("npc.lavadrake.male.foot_br"),
),
),
(Lavadrake, Female): (
front_left: (
offset: (-14.0, -4.0, -10.0),
lateral: ("npc.lavadrake.male.foot_fl"),
),
front_right: (
offset: (0.0, -4.0, -10.0),
lateral: ("npc.lavadrake.male.foot_fr"),
),
back_left: (
offset: (-14.0, -7.5, -10.0),
lateral: ("npc.lavadrake.male.foot_bl"),
),
back_right: (
offset: (0.0, -7.5, -10.0),
lateral: ("npc.lavadrake.male.foot_br"),
),
),
})

View File

@ -45,6 +45,7 @@ make_case_elim!(
Maneater = 8,
Sandshark = 9,
Hakulaq = 10,
Lavadrake = 11,
}
);
@ -64,6 +65,7 @@ pub struct AllSpecies<SpeciesMeta> {
pub maneater: SpeciesMeta,
pub sandshark: SpeciesMeta,
pub hakulaq: SpeciesMeta,
pub lavadrake: SpeciesMeta,
}
impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta> {
@ -83,11 +85,12 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
Species::Maneater => &self.maneater,
Species::Sandshark => &self.sandshark,
Species::Hakulaq => &self.hakulaq,
Species::Lavadrake => &self.lavadrake,
}
}
}
pub const ALL_SPECIES: [Species; 11] = [
pub const ALL_SPECIES: [Species; 12] = [
Species::Crocodile,
Species::Alligator,
Species::Salamander,
@ -99,6 +102,7 @@ pub const ALL_SPECIES: [Species; 11] = [
Species::Maneater,
Species::Sandshark,
Species::Hakulaq,
Species::Lavadrake,
];
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {

View File

@ -178,7 +178,10 @@ pub enum UniqueKind {
QuadMedBasic,
QuadMedCharge,
QuadLowRanged,
QuadLowBreathe,
QuadLowTail,
QuadLowQuick,
QuadLowBasic,
QuadSmallBasic,
TheropodBasic,
}

View File

@ -152,12 +152,31 @@ impl LoadoutBuilder {
"common.items.npc_weapons.unique.quadlowquick",
));
},
quadruped_low::Species::Lavadrake => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowbreathe",
));
},
_ => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowbasic",
));
},
},
Body::QuadrupedSmall(quadruped_small) => match quadruped_small.species {
_ => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadsmallbasic",
));
},
},
Body::Theropod(theropod) => match theropod.species {
_ => {
main_tool = Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.theropodbasic",
));
},
},
Body::BipedLarge(biped_large) => match (biped_large.species, biped_large.body_type)
{
(biped_large::Species::Occultsaurok, _) => {

View File

@ -81,6 +81,7 @@ impl Body {
quadruped_low::Species::Maneater => 80.0,
quadruped_low::Species::Sandshark => 160.0,
quadruped_low::Species::Hakulaq => 140.0,
quadruped_low::Species::Lavadrake => 100.0,
},
}
}
@ -117,7 +118,7 @@ impl Body {
Body::BipedLarge(_) => 12.0,
Body::Object(_) => 5.0,
Body::Golem(_) => 8.0,
Body::Theropod(_) => 35.0,
Body::Theropod(_) => 1.0,
Body::QuadrupedLow(_) => 12.0,
}
}

View File

@ -93,7 +93,7 @@ impl Animation for SwimAnimation {
let abstilt = tilt.abs();
let squash = if abstilt > 0.2 { 0.35 } else { 1.0 }; //condenses the body at strong turns
next.head.position = Vec3::new(0.0, -3.0 + s_a.head.0, s_a.head.1 - 1.0 + short * 0.3);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 - 1.0 + short * 0.3);
next.head.orientation =
Quaternion::rotation_z(head_look.x * 0.3 + short * -0.2 * intensity + tilt * 3.0)
* Quaternion::rotation_x(

View File

@ -0,0 +1,70 @@
use super::{
super::{vek::*, Animation},
QuadrupedLowSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
//use std::ops::Rem;
use std::f32::consts::PI;
pub struct BreatheAnimation;
impl Animation for BreatheAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_low_breathe\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_breathe")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, _movement2base, movement3, twitch) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.5), 0.0, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, (anim_time as f32).min(1.0), 0.0, anim_time as f32),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32, 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let twitch2 = mirror*(twitch*20.0).sin()*pullback;
let twitch2alt = mirror*(twitch*20.0+PI/2.0).sin()*pullback;
let movement1abs = movement1base * pullback;
next.head_upper.orientation = Quaternion::rotation_x(movement1abs * 0.3+twitch2alt*0.02);
next.head_lower.orientation =
Quaternion::rotation_x(movement1abs * -0.3 )
* Quaternion::rotation_y(twitch2 * 0.02);
next.jaw.orientation = Quaternion::rotation_x(movement1abs * -0.7 + twitch2 * 0.1);
next.chest.orientation = Quaternion::rotation_y(twitch2 * -0.02)
* Quaternion::rotation_z(0.0);
next.tail_front.orientation = Quaternion::rotation_x(0.15+movement1abs*-0.15+twitch2alt*0.02)
* Quaternion::rotation_z(0.0);
next.tail_rear.orientation = Quaternion::rotation_x(-0.12+movement1abs*-0.2+twitch2alt*0.08)
* Quaternion::rotation_z(0.0);
if speed < 0.5{
next.foot_fl.orientation = Quaternion::rotation_y(twitch2 * 0.02);
next.foot_fr.orientation = Quaternion::rotation_y(twitch2 * 0.02);
next.foot_bl.orientation = Quaternion::rotation_y(twitch2 * 0.02);
next.foot_br.orientation = Quaternion::rotation_y(twitch2 * 0.02);
} else{};
next
}
}

View File

@ -1,5 +1,6 @@
pub mod alpha;
pub mod beta;
pub mod breathe;
pub mod dash;
pub mod idle;
pub mod jump;
@ -9,7 +10,7 @@ pub mod tailwhip;
// Reexports
pub use self::{
alpha::AlphaAnimation, beta::BetaAnimation, dash::DashAnimation, idle::IdleAnimation,
alpha::AlphaAnimation, beta::BetaAnimation, breathe::BreatheAnimation, dash::DashAnimation, idle::IdleAnimation,
jump::JumpAnimation, run::RunAnimation, shoot::ShootAnimation, tailwhip::TailwhipAnimation,
};
@ -127,6 +128,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (7.0, 11.5),
(Sandshark, _) => (8.5, 0.5),
(Hakulaq, _) => (8.0, 10.0),
(Lavadrake, _) => (7.0, 8.0),
},
head_lower: match (body.species, body.body_type) {
(Crocodile, _) => (8.0, 0.0),
@ -141,6 +143,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (1.0, 4.5),
(Sandshark, _) => (13.5, -10.5),
(Hakulaq, _) => (10.5, 1.0),
(Lavadrake, _) => (11.5, -6.0),
},
jaw: match (body.species, body.body_type) {
(Crocodile, _) => (2.5, -3.0),
@ -155,6 +158,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (-1.0, 4.0),
(Sandshark, _) => (-8.0, -5.5),
(Hakulaq, _) => (-6.5, -4.0),
(Lavadrake, _) => (3.0, -5.0),
},
chest: match (body.species, body.body_type) {
(Crocodile, _) => (0.0, 5.0),
@ -169,6 +173,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (0.0, 12.0),
(Sandshark, _) => (0.0, 20.0),
(Hakulaq, _) => (0.0, 13.5),
(Lavadrake, _) => (0.0, 16.5),
},
tail_rear: match (body.species, body.body_type) {
(Crocodile, _) => (-12.5, -1.0),
@ -183,6 +188,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (-15.0, 4.0),
(Sandshark, _) => (-10.0, 0.5),
(Hakulaq, _) => (-9.0, -2.0),
(Lavadrake, _) => (-12.0, -2.0),
},
tail_front: match (body.species, body.body_type) {
(Crocodile, _) => (-6.0, 0.0),
@ -197,6 +203,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (-1.0, 4.0),
(Sandshark, _) => (-13.0, -8.0),
(Hakulaq, _) => (-6.0, -5.5),
(Lavadrake, _) => (-7.0, -4.5),
},
feet_f: match (body.species, body.body_type) {
(Crocodile, _) => (3.5, 6.0, -1.0),
@ -211,6 +218,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (4.5, 4.0, -5.5),
(Sandshark, _) => (5.5, 2.0, -8.0),
(Hakulaq, _) => (4.5, 2.0, -4.5),
(Lavadrake, _) => (4.5, 4.0, -6.5),
},
feet_b: match (body.species, body.body_type) {
(Crocodile, _) => (3.5, -6.0, -1.0),
@ -225,6 +233,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (4.5, -2.5, -3.0),
(Sandshark, _) => (3.5, -15.0, -14.0),
(Hakulaq, _) => (3.5, -8.0, -4.5),
(Lavadrake, _) => (3.5, -8.0, -6.5),
},
lean: match (body.species, body.body_type) {
(Pangolin, _) => (0.4, 0.0),
@ -232,7 +241,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
},
scaler: match (body.species, body.body_type) {
(Crocodile, _) => (1.3),
(Alligator, _) => (1.5),
(Alligator, _) => (1.4),
(Salamander, _) => (1.4),
(Monitor, _) => (1.1),
(Asp, _) => (1.4),
@ -242,6 +251,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (1.4),
(Sandshark, _) => (1.0),
(Hakulaq, _) => (1.0),
(Lavadrake, _) => (1.4),
},
tempo: match (body.species, body.body_type) {
(Crocodile, _) => (0.7),
@ -255,6 +265,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Maneater, _) => (0.9),
(Sandshark, _) => (1.0),
(Hakulaq, _) => (1.0),
(Lavadrake, _) => (1.1),
},
}
}

View File

@ -0,0 +1,99 @@
use super::{
super::{vek::*, Animation},
QuadrupedMediumSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
//use std::ops::Rem;
use std::f32::consts::PI;
pub struct DashAnimation;
impl Animation for DashAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_medium_dash\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_dash")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(24.0);
let (movement1base, chargemovementbase, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.5), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(4.0), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let twitch1 = (mirror * movement1base * 9.5).sin();
let twitch1fast = (mirror * movement1base * 25.0).sin();
//let twitch3 = (mirror * movement3 * 4.0).sin();
//let movement1 = mirror * movement1base * pullback;
//let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
let short = (((1.0)
/ (0.72
+ 0.28 * ((anim_time as f32 * 16.0 as f32 + PI * 0.25).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 as f32 + PI * 0.25).sin())
* chargemovementbase
* pullback;
let shortalt =
(anim_time as f32 * 16.0 as f32 + PI * 0.25).sin() * chargemovementbase * pullback;
next.head.orientation =
Quaternion::rotation_x(movement1abs * -0.2 + movement2abs * 0.8)
* Quaternion::rotation_z(short * -0.06 + twitch1 * 0.2);
next.neck.orientation =
Quaternion::rotation_x(movement1abs * -0.2 + movement2abs * 0.5)
* Quaternion::rotation_z(short * 0.15 + twitch1 * 0.2);
next.jaw.orientation = Quaternion::rotation_x(
twitch1fast * 0.2
+ movement1abs * -0.3
+ movement2abs * 1.2
+ chargemovementbase * -0.5,
);
next.torso_front.orientation =
Quaternion::rotation_z(twitch1 * 0.06) * Quaternion::rotation_y(short * 0.06);
next.tail.orientation = Quaternion::rotation_x(
0.15 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2,
) * Quaternion::rotation_z(shortalt * 0.15);
if speed < 0.5
{
if mirror == 1.0 {
next.leg_fl.orientation = Quaternion::rotation_x(movement1abs*0.6);
next.foot_fl.orientation = Quaternion::rotation_x(movement1abs*-0.6+twitch1 * 0.3);
next.leg_bl.orientation = Quaternion::rotation_x(movement1abs*0.6);
next.foot_bl.orientation = Quaternion::rotation_x(movement1abs*-0.6+twitch1 * 0.3);
}else{
next.leg_fr.orientation = Quaternion::rotation_x(movement1abs*0.6);
next.foot_fr.orientation = Quaternion::rotation_x(movement1abs*-0.6+twitch1 * 0.3);
next.leg_br.orientation = Quaternion::rotation_x(movement1abs*0.6);
next.foot_br.orientation = Quaternion::rotation_x(movement1abs*-0.6+twitch1 * 0.3);
}
}
next
}
}

View File

@ -1,5 +1,6 @@
pub mod alpha;
pub mod beta;
pub mod dash;
pub mod feed;
pub mod hoof;
pub mod idle;
@ -9,7 +10,7 @@ pub mod run;
// Reexports
pub use self::{
alpha::AlphaAnimation, beta::BetaAnimation, feed::FeedAnimation, hoof::HoofAnimation,
alpha::AlphaAnimation, beta::BetaAnimation, dash::DashAnimation, feed::FeedAnimation, hoof::HoofAnimation,
idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapMeleeAnimation, run::RunAnimation,
};

View File

@ -0,0 +1,53 @@
use super::{
super::{vek::*, Animation},
QuadrupedSmallSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
//use std::ops::Rem;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_small_alpha\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_small_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.5), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(4.0), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
next.head.orientation = Quaternion::rotation_x(movement1abs*-0.7+movement2abs*2.0)*Quaternion::rotation_y(movement1*-0.6+movement2*1.2);
next.chest.orientation = Quaternion::rotation_y(movement1 * -0.08 + movement2 * 0.15)
* Quaternion::rotation_z(movement1 * 0.2 + movement2 * -0.6);
next.tail.orientation = Quaternion::rotation_x(movement1abs*0.5+movement2abs*-1.0)
* Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2);
next
}
}

View File

@ -1,10 +1,11 @@
pub mod alpha;
pub mod feed;
pub mod idle;
pub mod jump;
pub mod run;
// Reexports
pub use self::{feed::FeedAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
pub use self::{alpha::AlphaAnimation, feed::FeedAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
use common::comp::{self};

View File

@ -0,0 +1,66 @@
use super::{
super::{vek::*, Animation},
TheropodSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
//use std::ops::Rem;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = TheropodSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"theropod_alpha\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "theropod_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(2.0), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(4.0), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
next.head.orientation = Quaternion::rotation_x(movement1abs*0.2)*Quaternion::rotation_y(movement1*0.1+movement2*0.2);
next.neck.orientation = Quaternion::rotation_x(movement1abs*-0.3)*Quaternion::rotation_y(movement1*0.1+movement2*0.1);
next.jaw.orientation = Quaternion::rotation_x(movement1abs * -0.5 +movement2abs*0.5);
next.chest_front.orientation = Quaternion::rotation_x(movement1abs * -0.2)
;
next.chest_back.orientation = Quaternion::rotation_x(movement1abs * 0.2);
next.leg_l.orientation = Quaternion::rotation_x(movement1abs *-0.1);
next.leg_r.orientation = Quaternion::rotation_x(movement1abs *-0.1);
next.foot_l.orientation = Quaternion::rotation_x(movement1abs *-0.3);
next.foot_r.orientation = Quaternion::rotation_x(movement1abs *-0.3);
next.tail_front.orientation = Quaternion::rotation_x(0.1+movement1abs*-0.1+movement2abs*-0.3)
* Quaternion::rotation_z(movement1 * -0.1 + movement2 * -0.2);
next.tail_back.orientation = Quaternion::rotation_x(0.1+movement1abs*-0.1+movement2abs*-0.3)
* Quaternion::rotation_z(movement1 * -0.1 + movement2 * -0.2);
next
}
}

View File

@ -0,0 +1,64 @@
use super::{
super::{vek::*, Animation},
TheropodSkeleton, SkeletonAttr,
};
use common::states::utils::StageSection;
//use std::ops::Rem;
pub struct BetaAnimation;
impl Animation for BetaAnimation {
type Dependency = (f32, f64, Option<StageSection>, f64);
type Skeleton = TheropodSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"theropod_beta\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "theropod_beta")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let (movement1base, movement2base, movement3) = match stage_section {
Some(StageSection::Buildup) => ((anim_time as f32).powf(2.0), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(4.0), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - movement3;
let subtract = global_time - timer;
let check = subtract - subtract.trunc();
let mirror = (check - 0.5).signum() as f32;
let movement1 = mirror * movement1base * pullback;
let movement2 = mirror * movement2base * pullback;
let movement1abs = movement1base * pullback;
let movement2abs = movement2base * pullback;
next.head.orientation = Quaternion::rotation_x(movement1abs*-0.4+movement2abs*1.2)*Quaternion::rotation_y(movement1*0.1+movement2*-0.1);
next.neck.orientation = Quaternion::rotation_x(movement1abs*0.4+movement2abs*-1.2)*Quaternion::rotation_y(movement1*0.1+movement2*-0.1);
next.chest_front.orientation = Quaternion::rotation_x(movement1abs * 0.6+movement2abs*-1.5)
;
next.chest_back.orientation = Quaternion::rotation_x(movement1abs * -0.6+movement2abs*1.5);
next.leg_l.orientation = Quaternion::rotation_x(movement1abs *-0.5);
next.leg_r.orientation = Quaternion::rotation_x(movement1abs *-0.5);
next.foot_l.orientation = Quaternion::rotation_x(movement1abs *0.4);
next.foot_r.orientation = Quaternion::rotation_x(movement1abs *0.4);
next.tail_front.orientation = Quaternion::rotation_x(0.1+movement1abs*-0.1+movement2abs*-0.3)
;
next.tail_back.orientation = Quaternion::rotation_x(0.1+movement1abs*-0.1+movement2abs*-0.3)
;
next
}
}

View File

@ -1,9 +1,11 @@
pub mod alpha;
pub mod beta;
pub mod idle;
pub mod jump;
pub mod run;
// Reexports
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
pub use self::{alpha::AlphaAnimation, beta::BetaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
use common::comp::{self};

View File

@ -21,7 +21,7 @@ impl Animation for RunAnimation {
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
let speed = (Vec2::<f32>::from(velocity).magnitude()).min(22.0);
*rate = 1.0;
let breathe = (anim_time as f32 * 0.8).sin();
@ -81,7 +81,7 @@ impl Animation for RunAnimation {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.3);
next.head.orientation = Quaternion::rotation_x(-0.1 + short * -0.05)
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(shortalt * -0.2 - tilt * 1.2);
* Quaternion::rotation_z(shortalt * -0.2 - tilt * 4.5);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(short * -0.03);
@ -89,7 +89,7 @@ impl Animation for RunAnimation {
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_x(-0.1 + short * -0.04)
* Quaternion::rotation_y(tilt * 0.3)
* Quaternion::rotation_z(shortalt * -0.1 - tilt * 1.2);
* Quaternion::rotation_z(shortalt * -0.1 - tilt * 4.2);
next.chest_front.position = Vec3::new(
0.0,
@ -123,25 +123,25 @@ impl Animation for RunAnimation {
next.leg_l.position = Vec3::new(
-s_a.leg.0,
s_a.leg.1 + amplitude3 * foot1b * -1.3,
s_a.leg.2 + amplitude3 * foot1a * 1.4,
s_a.leg.2 + amplitude3 * foot1a * 1.0,
);
next.leg_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.2)
next.leg_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.15)
* Quaternion::rotation_y(tilt * 0.5)
* Quaternion::rotation_z(foot1a * -0.3 + tilt * -0.5);
next.leg_r.position = Vec3::new(
s_a.leg.0,
s_a.leg.1 + amplitude3 * foot2b * -1.3,
s_a.leg.2 + amplitude3 * foot2a * 1.4,
s_a.leg.2 + amplitude3 * foot2a * 1.0,
);
next.leg_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.2)
next.leg_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.15)
* Quaternion::rotation_y(tilt * 0.5)
* Quaternion::rotation_z(foot2a * 0.3 + tilt * -0.5);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + canceler * -2.0 + amplitude3 * foot1b * -2.0,
s_a.foot.2 + canceler * 2.0 + (foot1a * 2.0).max(0.0) * amplitude2,
s_a.foot.1 + canceler * -1.0 + amplitude3 * foot1b * -2.0,
s_a.foot.2 + canceler * 2.0 + (foot1a * 1.5).max(0.0) * amplitude2,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot1b * -0.35)
* Quaternion::rotation_y(tilt * -1.0)
@ -149,8 +149,8 @@ impl Animation for RunAnimation {
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + canceler * -2.0 + amplitude3 * foot2b * -2.0,
s_a.foot.2 + canceler * 2.0 + (foot2a * 2.0).max(0.0) * amplitude2,
s_a.foot.1 + canceler * -1.0 + amplitude3 * foot2b * -2.0,
s_a.foot.2 + canceler * 2.0 + (foot2a * 1.5).max(0.0) * amplitude2,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot2b * -0.35)
* Quaternion::rotation_y(tilt * -1.0);

View File

@ -1415,6 +1415,46 @@ impl FigureMgr {
),
};
let target_bones = match &character {
CharacterState::ComboMelee(s) => {
let stage_index = (s.stage - 1) as usize;
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_buildup_duration
.as_secs_f64()
},
StageSection::Swing => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_swing_duration
.as_secs_f64()
},
StageSection::Recover => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_recover_duration
.as_secs_f64()
},
_ => 0.0,
};
match s.stage {
_ => anim::quadruped_small::AlphaAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
),
}
},
CharacterState::Sit { .. } => {
anim::quadruped_small::FeedAnimation::update_skeleton(
&target_base,
@ -1572,7 +1612,7 @@ impl FigureMgr {
},
_ => 0.0,
};
anim::quadruped_medium::AlphaAnimation::update_skeleton(
anim::quadruped_medium::DashAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
@ -1929,6 +1969,31 @@ impl FigureMgr {
),
}
},
CharacterState::BasicBeam(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Cast => s.timer.as_secs_f64(),
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::quadruped_low::BreatheAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::DashMelee(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
@ -2311,9 +2376,7 @@ impl FigureMgr {
&mut state_animation_rate,
skeleton_attr,
),
// TODO!
_ => anim::theropod::IdleAnimation::update_skeleton(
_=> anim::theropod::IdleAnimation::update_skeleton(
&TheropodSkeleton::default(),
time,
state.state_time,
@ -2321,8 +2384,63 @@ impl FigureMgr {
skeleton_attr,
),
};
let target_bones = match &character {
CharacterState::ComboMelee(s) => {
let stage_index = (s.stage - 1) as usize;
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_buildup_duration
.as_secs_f64()
},
StageSection::Swing => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_swing_duration
.as_secs_f64()
},
StageSection::Recover => {
stage_time
/ s.static_data.stage_data[stage_index]
.base_recover_duration
.as_secs_f64()
},
_ => 0.0,
};
match s.stage {
1 => anim::theropod::AlphaAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
),
_ => anim::theropod::BetaAnimation::update_skeleton(
&target_base,
(
vel.0.magnitude(),
time,
Some(s.stage_section),
state.state_time,
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
),
}
},
// TODO!
_ => target_base,
};
state.skeleton = anim::vek::Lerp::lerp(&state.skeleton, &target_base, dt_lerp);
state.skeleton = anim::vek::Lerp::lerp(&state.skeleton, &target_bones, dt_lerp);
state.update(
renderer,
pos.0,