Implement animation root motion deltas (#84)
Implements root motion and adds a dash attack. Reviewed-on: #84 Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #84.
This commit is contained in:
@@ -17,6 +17,7 @@ pub struct FighterAttackScript {
|
||||
pub iasa_frame: Option<u32>,
|
||||
pub wont_autocancel_window: Option<(u32, u32)>,
|
||||
pub landing_duration: Option<u32>,
|
||||
pub use_root_motion: bool
|
||||
}
|
||||
|
||||
impl FighterAttackScript {
|
||||
|
||||
@@ -17,6 +17,7 @@ struct MoveCompiler {
|
||||
iasa_frame: Option<u32>,
|
||||
landing_duration: Option<u32>,
|
||||
cursor: u32,
|
||||
use_root_motion: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
@@ -114,6 +115,10 @@ impl MoveCompiler {
|
||||
self.iasa_frame = Some(iasa_frame);
|
||||
}
|
||||
|
||||
fn enable_root_motion(&mut self) {
|
||||
self.use_root_motion = true;
|
||||
}
|
||||
|
||||
fn into_attack_script(mut self) -> Result<FighterAttackScript, String> {
|
||||
self.remove_all_hitboxes().map_err(|err| err.to_string())?;
|
||||
let mut hitboxes = self.hitboxes;
|
||||
@@ -124,6 +129,7 @@ impl MoveCompiler {
|
||||
iasa_frame: self.iasa_frame,
|
||||
wont_autocancel_window: self.wont_autocancel_window,
|
||||
landing_duration: self.landing_duration,
|
||||
use_root_motion: self.use_root_motion,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -232,6 +238,18 @@ pub fn compile_script(text: &str) -> Result<FighterAttackScript, String> {
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
let mc = mc.clone();
|
||||
engine.register_fn(
|
||||
"enable_root_motion",
|
||||
move || -> Result<(), Box<EvalAltResult>> {
|
||||
let mut b = mc.borrow_mut();
|
||||
b.enable_root_motion();
|
||||
Ok(())
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
let mc = mc.clone();
|
||||
engine.register_fn(
|
||||
|
||||
Reference in New Issue
Block a user