bowser spin animation

This commit is contained in:
James Melkonian 2024-03-05 23:26:44 -08:00
parent 5e9cbdf754
commit 7a23314e3b
9 changed files with 301 additions and 49 deletions

View File

@ -1,6 +1,6 @@
[target.x86_64-unknown-linux-gnu] [target.x86_64-unknown-linux-gnu]
rustflags = [ rustflags = [
"-C", "link-arg=-fuse-ld=gold", "-C", "link-arg=-fuse-ld=mold",
] ]
[target.x86_64-pc-windows-gnu] [target.x86_64-pc-windows-gnu]

View File

@ -535,6 +535,13 @@
secondary: Simple(None, "common.abilities.custom.quadlowbasic.singlestrike"), secondary: Simple(None, "common.abilities.custom.quadlowbasic.singlestrike"),
abilities: [], abilities: [],
), ),
Custom("Rocksnapper"): (
primary: Simple(None, "common.abilities.custom.rocksnapper.triplestrike"),
secondary: Simple(None, "common.abilities.custom.rocksnapper.singlestrike"),
abilities: [
Simple(None, "common.abilities.custom.rocksnapper.dash"),
],
),
Custom("Quad Low Beam"): ( Custom("Quad Low Beam"): (
primary: Simple(None, "common.abilities.custom.quadlowbeam.lifestealbeam"), primary: Simple(None, "common.abilities.custom.quadlowbeam.lifestealbeam"),
secondary: Simple(None, "common.abilities.custom.quadlowbreathe.triplestrike"), secondary: Simple(None, "common.abilities.custom.quadlowbreathe.triplestrike"),

View File

@ -0,0 +1,28 @@
DashMelee(
energy_cost: 0,
melee_constructor: (
kind: Bash(
damage: 16.0,
poise: 0.0,
knockback: 4.0,
energy_regen: 0.0,
),
scaled: Some((
kind: Bash(
damage: 36.0,
poise: 8.0,
knockback: 23.0,
energy_regen: 0.0,
))),
range: 2.5,
angle: 360.0,
),
energy_drain: 0,
forward_speed: 5.0,
buildup_duration: 1.0,
charge_duration: 2.0,
swing_duration: 2.0,
recover_duration: 0.5,
ori_modifier: 0.3,
charge_through: true,
)

View File

@ -0,0 +1,25 @@
ComboMelee2(
strikes: [
(
melee_constructor: (
kind: Bash(
damage: 36,
poise: 28,
knockback: 3,
energy_regen: 0,
),
range: 3.0,
angle: 90.0,
),
buildup_duration: 0.5,
swing_duration: 0.2,
hit_timing: 0.5,
recover_duration: 0.5,
movement: (
swing: Some(Forward(0.1)),
),
ori_modifier: 0.6,
),
],
energy_cost_per_strike: 0,
)

View File

@ -0,0 +1,65 @@
ComboMelee2(
strikes: [
(
melee_constructor: (
kind: Slash(
damage: 36,
poise: 24,
knockback: 3,
energy_regen: 0,
),
range: 4.0,
angle: 30.0,
),
buildup_duration: 0.75,
swing_duration: 0.45,
hit_timing: 0.5,
recover_duration: 0.4,
movement: (
swing: Some(Forward(0.4)),
),
ori_modifier: 0.65,
),
(
melee_constructor: (
kind: Stab(
damage: 18,
poise: 18,
knockback: 15,
energy_regen: 0,
),
range: 3.5,
angle: 75.0,
),
buildup_duration: 0.35,
swing_duration: 0.35,
hit_timing: 0.5,
recover_duration: 0.3,
movement: (
swing: Some(Forward(0.2)),
),
ori_modifier: 0.65,
),
(
melee_constructor: (
kind: Bash(
damage: 28,
poise: 36,
knockback: 3,
energy_regen: 0,
),
range: 3.0,
angle: 55.0,
),
buildup_duration: 0.55,
swing_duration: 0.25,
hit_timing: 0.5,
recover_duration: 0.6,
movement: (
swing: Some(Forward(0.3)),
),
ori_modifier: 0.65,
),
],
energy_cost_per_strike: 0,
)

View File

@ -0,0 +1,20 @@
ItemDef(
legacy_name: "Rocksnapper",
legacy_description: "Rocksnapper's totally awesome legacy description",
kind: Tool((
kind: Natural,
hands: Two,
stats: (
equip_time_secs: 0.01,
power: 1.0,
effect_power: 1.0,
speed: 1.0,
range: 1.0,
energy_efficiency: 1.0,
buff_strength: 1.0,
),
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Rocksnapper")),
)

View File

@ -686,6 +686,9 @@ fn default_main_tool(body: &Body) -> Item {
quadruped_low::Species::Driggle => Some(Item::new_from_asset_expect( quadruped_low::Species::Driggle => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.driggle", "common.items.npc_weapons.unique.driggle",
)), )),
quadruped_low::Species::Rocksnapper => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.rocksnapper",
)),
_ => Some(Item::new_from_asset_expect( _ => Some(Item::new_from_asset_expect(
"common.items.npc_weapons.unique.quadlowbasic", "common.items.npc_weapons.unique.quadlowbasic",
)), )),

View File

@ -9,7 +9,7 @@ use std::f32::consts::PI;
pub struct DashAnimation; pub struct DashAnimation;
impl Animation for DashAnimation { impl Animation for DashAnimation {
type Dependency<'a> = (f32, f32, Option<StageSection>, f32); type Dependency<'a> = (Option<&'a str>, f32, f32, Option<StageSection>, f32);
type Skeleton = QuadrupedLowSkeleton; type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")] #[cfg(feature = "use-dyn-lib")]
@ -18,64 +18,167 @@ impl Animation for DashAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_dash")] #[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_dash")]
fn update_skeleton_inner( fn update_skeleton_inner(
skeleton: &Self::Skeleton, skeleton: &Self::Skeleton,
(_velocity, global_time, stage_section, timer): Self::Dependency<'_>, (ability_id, _velocity, global_time, stage_section, timer): Self::Dependency<'_>,
anim_time: f32, anim_time: f32,
_rate: &mut f32, _rate: &mut f32,
_s_a: &SkeletonAttr, s_a: &SkeletonAttr,
) -> Self::Skeleton { ) -> Self::Skeleton {
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let (movement1base, chargemovementbase, movement2base, movement3) = match stage_section { match ability_id {
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0), Some("common.abilities.custom.rocksnapper.dash") => {
Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0), let (movement1, charge, movement2, movement3) = match stage_section {
Some(StageSection::Action) => (1.0, 1.0, anim_time.powi(4), 0.0), Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), Some(StageSection::Charge) => (1.0, anim_time, 0.0, 0.0),
_ => (0.0, 0.0, 0.0, 0.0), Some(StageSection::Action) => (1.0, 1.0, anim_time, 0.0),
}; Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
let pullback = 1.0 - movement3; _ => (0.0, 0.0, 0.0, 0.0),
let subtract = global_time - timer; };
let check = subtract - subtract.trunc(); let subtract = global_time - timer;
let mirror = (check - 0.5).signum(); let check = subtract - subtract.trunc();
let twitch1 = (mirror * movement1base * 9.5).sin(); let mirror = (check - 0.5).signum();
let twitch1fast = (mirror * movement1base * 25.0).sin(); let twitch1 = (mirror * movement1.sqrt() * 9.5).sin();
//let twitch3 = (mirror * movement3 * 4.0).sin(); fn quintic(x: f32) -> f32 { x.powf(0.2) }
//let movement1 = mirror * movement1base * pullback; let quick_movement1 = movement1.powf(0.2);
//let movement2 = mirror * movement2base * pullback; //let quick_movement3 = movement3.powf(0.2);
let movement1abs = movement1base * pullback; let quick_movement3 = elastic(movement3);
let movement2abs = movement2base * pullback; next.head_upper.position = Vec3::new(
let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2))) 0.0,
.sqrt()) s_a.head_upper.0 + (-1.0 * quick_movement1 + quick_movement3) * 10.0,
* ((anim_time * 16.0_f32 + PI * 0.25).sin()) s_a.head_upper.1,
* chargemovementbase );
* pullback; next.head_upper.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
let shortalt = (anim_time * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback; next.head_lower.position = Vec3::new(
0.0,
s_a.head_lower.0 + (-1.0 * quick_movement1 + quick_movement3) * 10.0,
s_a.head_lower.1,
);
next.head_lower.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
next.foot_fl.position = Vec3::new(
-s_a.feet_f.0 + (quick_movement1 - quick_movement3) * 8.0,
s_a.feet_f.1 + (-1.0 * quick_movement1 + quick_movement3) * 8.0,
s_a.feet_f.2 + (quick_movement1 - quick_movement3) * 8.0,
);
next.foot_fl.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
next.foot_fr.position = Vec3::new(
s_a.feet_f.0 - (quick_movement1 - quick_movement3) * 8.0,
s_a.feet_f.1 + (-1.0 * quick_movement1 + quick_movement3) * 8.0,
s_a.feet_f.2 + (quick_movement1 - quick_movement3) * 8.0,
);
next.foot_fr.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
next.foot_bl.position = Vec3::new(
-s_a.feet_b.0 + (quick_movement1 - quick_movement3) * 8.0,
s_a.feet_b.1 + (quick_movement1 - quick_movement3) * 8.0,
s_a.feet_b.2 + (quick_movement1 - quick_movement3) * 8.0,
);
next.foot_bl.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
next.foot_br.position = Vec3::new(
s_a.feet_b.0 - (quick_movement1 - quick_movement3) * 8.0,
s_a.feet_b.1 + (quick_movement1 - quick_movement3) * 8.0,
s_a.feet_b.2 + (quick_movement1 - quick_movement3) * 8.0,
);
next.foot_br.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
next.tail_front.position = Vec3::new(
0.0,
s_a.tail_front.0 + (quick_movement1 - quick_movement3) * 20.0,
s_a.tail_front.1,
);
next.tail_front.scale = Vec3::one() * (1.0 - movement1 + quick_movement3);
next.tail_rear.position = Vec3::new(
0.0,
s_a.tail_rear.0 + (quick_movement1 - quick_movement3) * 20.0,
s_a.tail_rear.1,
);
next.tail_rear.scale = Vec3::one() * (1.0 - movement1 + movement3);
next.head_upper.orientation = fn bounce(x: f32) -> f32 {
Quaternion::rotation_x(movement1abs * 0.4 + movement2abs * 0.3) if x < (1.0 / 2.75) {
* Quaternion::rotation_z(short * -0.06 + twitch1 * -0.3); 7.5625 * x.powi(2)
} else if x < (2.0 / 2.75) {
7.5625 * (x - (1.5 / 2.75)).powi(2) + 0.75
} else if x < (2.5 / 2.75) {
7.5625 * (x - (2.25 / 2.75)).powi(2) + 0.9375
} else {
7.5625 * (x - (2.625 / 2.75)).powi(2) + 0.984375
}
}
next.head_lower.orientation = fn elastic(x: f32) -> f32 {
Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * -0.5) fn f(x: f32, a: f32, b: f32) -> f32 {
* Quaternion::rotation_z(short * 0.15 + twitch1 * 0.3); let p = 0.8;
b + a * 2.0_f32.powf(a * 10.0 * x) * ((4.0 * PI * x) / p).cos()
}
f(x, -1.0, 1.0) / f(1.0, -1.0, 1.0)
}
next.jaw.orientation = Quaternion::rotation_x( next.chest.position = Vec3::new(
twitch1fast * 0.2 0.0,
+ movement1abs * -0.3 0.0,
+ movement2abs * 1.2 s_a.chest.1 - bounce(movement1) * 5.0 + elastic(movement3) * 5.0,
+ chargemovementbase * -0.5, );
); let smooth_end_charge = if charge < 0.5 {
next.chest.orientation = charge
Quaternion::rotation_z(twitch1 * 0.06) * Quaternion::rotation_y(short * 0.06); } else {
3.0 * charge.powi(2) - 2.0 * charge.powi(3)
};
next.chest.orientation =
Quaternion::rotation_z(2.0 * PI * movement1 + 4.0 * PI * charge);
},
_ => {
let (movement1, chargemovementbase, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0),
Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0),
Some(StageSection::Action) => (1.0, 1.0, anim_time.powi(4), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
_ => (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();
let twitch1 = (mirror * movement1 * 9.5).sin();
let twitch1fast = (mirror * movement1 * 25.0).sin();
//let twitch3 = (mirror * movement3 * 4.0).sin();
//let movement1 = mirror * movement1 * pullback;
//let movement2 = mirror * movement2 * pullback;
let movement1abs = movement1 * pullback;
let movement2abs = movement2 * pullback;
let short = ((1.0
/ (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2)))
.sqrt())
* ((anim_time * 16.0_f32 + PI * 0.25).sin())
* chargemovementbase
* pullback;
let shortalt =
(anim_time * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback;
next.tail_front.orientation = Quaternion::rotation_x( next.head_upper.orientation =
0.15 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2, Quaternion::rotation_x(movement1abs * 0.4 + movement2abs * 0.3)
) * Quaternion::rotation_z(shortalt * 0.15); * Quaternion::rotation_z(short * -0.06 + twitch1 * -0.3);
next.tail_rear.orientation = next.head_lower.orientation =
Quaternion::rotation_x( Quaternion::rotation_x(movement1abs * -0.4 + movement2abs * -0.5)
-0.12 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2, * Quaternion::rotation_z(short * 0.15 + twitch1 * 0.3);
) * Quaternion::rotation_z(shortalt * 0.15 + twitch1fast * 0.3);
next.jaw.orientation = Quaternion::rotation_x(
twitch1fast * 0.2
+ movement1abs * -0.3
+ movement2abs * 1.2
+ chargemovementbase * -0.5,
);
next.chest.orientation =
Quaternion::rotation_z(twitch1 * 0.06) * Quaternion::rotation_y(short * 0.06);
next.tail_front.orientation = Quaternion::rotation_x(
0.15 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2,
) * Quaternion::rotation_z(shortalt * 0.15);
next.tail_rear.orientation =
Quaternion::rotation_x(
-0.12 + movement1abs * -0.4 + movement2abs * 0.2 + chargemovementbase * 0.2,
) * Quaternion::rotation_z(shortalt * 0.15 + twitch1fast * 0.3);
},
}
next next
} }
} }

View File

@ -3098,6 +3098,7 @@ impl FigureMgr {
anim::quadruped_low::DashAnimation::update_skeleton( anim::quadruped_low::DashAnimation::update_skeleton(
&target_base, &target_base,
( (
ability_id,
rel_vel.magnitude(), rel_vel.magnitude(),
time, time,
Some(s.stage_section), Some(s.stage_section),