diff --git a/src/wld/fragments/mod.rs b/src/wld/fragments/mod.rs index ba85647..9720cd4 100644 --- a/src/wld/fragments/mod.rs +++ b/src/wld/fragments/mod.rs @@ -8,6 +8,7 @@ mod t4_texture; mod t54_mesh; mod t5_texture_list_wrapper; mod t45_dm_sprite_ref; +mod t17_skeleton_ref; pub use t18_track_def::WldTrackDef; pub use t19_track::WldTrack; @@ -19,3 +20,4 @@ pub use t4_texture::WldTextureList; pub use t54_mesh::WldMesh; pub use t5_texture_list_wrapper::WldTextureRef; pub use t45_dm_sprite_ref::WldDmSpriteRef; +pub use t17_skeleton_ref::WldSkeletonRef; diff --git a/src/wld/fragments/t17_skeleton_ref.rs b/src/wld/fragments/t17_skeleton_ref.rs new file mode 100644 index 0000000..65aa9d9 --- /dev/null +++ b/src/wld/fragments/t17_skeleton_ref.rs @@ -0,0 +1,32 @@ +use std::rc::Rc; + +use bytes::{Bytes, Buf}; + +use crate::wld::names::WldNames; +use crate::Decoder; + +#[derive(Clone, Debug)] +pub struct WldSkeletonRef { + pub name: Option, + pub reference : u32, + pub params1: u32, +} + +impl Decoder for WldSkeletonRef { + type Settings = Rc; + + fn new(input: &mut Bytes, settings: Self::Settings) -> Result + where + Self: Sized, + { + let name = settings.get_name(input); + let reference = input.get_u32_le(); + let params1 = input.get_u32_le(); + + Ok(Self { + name, + reference, + params1, + }) + } +} diff --git a/src/wld/mod.rs b/src/wld/mod.rs index 6e14945..1dd632a 100644 --- a/src/wld/mod.rs +++ b/src/wld/mod.rs @@ -24,6 +24,7 @@ pub struct WldFile { pub t3: HashMap, pub t4: HashMap, pub t5: HashMap, + pub t17: HashMap, pub t18: HashMap, pub t19: HashMap, pub t20: HashMap, @@ -58,6 +59,7 @@ impl Decoder for WldFile { let t3 = extract_fragments(&raw_fragments, 3, names.clone()); let t4 = extract_fragments(&raw_fragments, 4, names.clone()); let t5 = extract_fragments(&raw_fragments, 5, names.clone()); + let t17 = extract_fragments(&raw_fragments, 17, names.clone()); let t18 = extract_fragments(&raw_fragments, 18, names.clone()); let t19 = extract_fragments(&raw_fragments, 19, names.clone()); let t20 = extract_fragments(&raw_fragments, 20, names.clone()); @@ -68,7 +70,7 @@ impl Decoder for WldFile { let remaining: HashSet = raw_fragments .iter() .map(|(_, frag)| frag.0) - .filter(|a| ![3, 4, 5, 18, 19, 20, 45, 48, 49, 54].contains(a)) + .filter(|a| ![3, 4, 5, 17, 18, 19, 20, 45, 48, 49, 54].contains(a)) .collect(); if !remaining.is_empty() { info!("{:?}", remaining); @@ -80,6 +82,7 @@ impl Decoder for WldFile { t3, t4, t5, + t17, t18, t19, t20, @@ -130,4 +133,12 @@ impl WldFile { pub fn get_texture_list_ref(&self, index: u32) -> WldTextureRef { self.t5.get(&index).unwrap().clone() } + + pub fn get_skeleton_ref(&self, index: u32) -> WldSkeletonRef { + self.t17.get(&index).unwrap().clone() + } + + pub fn get_fragment_type(&self, index:u32) -> u32 { + self.raw_fragments.get(&index).unwrap().0 + } }