Trails now controlled and enabled from animation files.

This commit is contained in:
Sam 2022-02-16 11:25:52 -05:00
parent fc1a9f3c61
commit a967daa2f5
5 changed files with 15 additions and 26 deletions

View File

@ -49,6 +49,9 @@ impl Animation for AlphaAnimation {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword | ToolKind::Dagger) => {
if matches!(stage_section, Some(StageSection::Action | StageSection::Recover)) {
next.main_weapon_trail = true;
}
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);

View File

@ -78,6 +78,7 @@ skeleton_impls!(struct CharacterSkeleton {
control_r,
:: // Begin non-bone fields
holding_lantern: bool,
main_weapon_trail: bool,
});
impl CharacterSkeleton {
@ -156,7 +157,7 @@ impl Skeleton for CharacterSkeleton {
.into(),
..Default::default()
},
weapon_trail_mat: Some(main_mat),
weapon_trail_mat: self.main_weapon_trail.then_some(main_mat),
}
}
}

View File

@ -1,4 +1,7 @@
#![feature(generic_associated_types)]
#![feature(
generic_associated_types,
bool_to_option,
)]
#![allow(incomplete_features)]
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");

View File

@ -33,7 +33,7 @@ use common::{
comp::{
inventory::slot::EquipSlot,
item::{Hands, ItemKind, ToolKind},
Body, CharacterAbilityType, CharacterState, Collider, Controller, Health, Inventory, Item,
Body, CharacterState, Collider, Controller, Health, Inventory, Item,
ItemKey, Last, LightAnimation, LightEmitter, Ori, PhysicsState, PoiseState, Pos, Scale,
Vel,
},
@ -864,7 +864,6 @@ impl FigureMgr {
mount_transform_pos,
body: Some(body),
tools: (active_tool_kind, second_tool_kind),
char_ability: character.map(|c| c.into()),
col,
dt,
_lpindex: lpindex,
@ -6249,7 +6248,6 @@ pub struct FigureUpdateCommonParameters<'a> {
pub mount_transform_pos: Option<(anim::vek::Transform<f32, f32, f32>, anim::vek::Vec3<f32>)>,
pub body: Option<Body>,
pub tools: (Option<ToolKind>, Option<ToolKind>),
pub char_ability: Option<CharacterAbilityType>,
pub col: vek::Rgba<f32>,
pub dt: f32,
// TODO: evaluate unused variable
@ -6304,7 +6302,6 @@ impl<S: Skeleton> FigureState<S> {
mount_transform_pos,
body,
tools,
char_ability,
col,
dt,
_lpindex,
@ -6465,24 +6462,11 @@ impl<S: Skeleton> FigureState<S> {
if let (Some((p1, p2)), Some((p4, p3))) =
(self.abs_trail_points, offsets_abs_trail_points)
{
use StageSection::{Action, Movement, Recover};
if matches!(
char_ability,
Some(
CharacterAbilityType::BasicMelee(Action)
| CharacterAbilityType::ChargedMelee(Action)
| CharacterAbilityType::DashMelee(Action)
| CharacterAbilityType::ComboMelee(Action | Recover, _)
| CharacterAbilityType::LeapMelee(Movement | Action)
| CharacterAbilityType::SpinMelee(Action)
)
) {
let vertex = |p: anim::vek::Vec3<f32>| trail::Vertex {
pos: p.into_array(),
};
let quad = Quad::new(vertex(p1), vertex(p2), vertex(p3), vertex(p4));
quad_mesh.replace_quad(trail_mgr.offset * 4, quad);
}
let vertex = |p: anim::vek::Vec3<f32>| trail::Vertex {
pos: p.into_array(),
};
let quad = Quad::new(vertex(p1), vertex(p2), vertex(p3), vertex(p4));
quad_mesh.replace_quad(trail_mgr.offset * 4, quad);
}
}
}

View File

@ -158,7 +158,6 @@ impl Scene {
mount_transform_pos: None,
body: None,
tools: (None, None),
char_ability: None,
col: Rgba::broadcast(1.0),
dt: 15.0, // Want to get there immediately.
_lpindex: 0,
@ -351,7 +350,6 @@ impl Scene {
mount_transform_pos: None,
body: None,
tools: (None, None),
char_ability: None,
col: Rgba::broadcast(1.0),
dt: scene_data.delta_time,
_lpindex: 0,