diff --git a/src/vpx/expanded.rs b/src/vpx/expanded.rs index a51a995..3a70fdd 100644 --- a/src/vpx/expanded.rs +++ b/src/vpx/expanded.rs @@ -559,11 +559,28 @@ fn read_old_materials_physics>( Ok(Some(materials)) } +/// Since it's common to change layer visibility we don't want that to cause a +/// difference in the item json, therefore we write this info in the index. +#[derive(Debug, serde::Serialize, serde::Deserialize)] +struct GameItemInfoJson { + file_name: String, + // most require these, only lightsequencer does not + #[serde(skip_serializing_if = "Option::is_none")] + is_locked: Option, + // most require these, only lightsequencer does not + #[serde(skip_serializing_if = "Option::is_none")] + editor_layer: Option, + #[serde(skip_serializing_if = "Option::is_none")] + editor_layer_name: Option, + #[serde(skip_serializing_if = "Option::is_none")] + editor_layer_visibility: Option, +} + fn write_gameitems>(vpx: &VPX, expanded_dir: &P) -> Result<(), WriteError> { let gameitems_dir = expanded_dir.as_ref().join("gameitems"); std::fs::create_dir_all(&gameitems_dir)?; let mut used_names_lowercase: HashSet = HashSet::new(); - let mut files: Vec = Vec::new(); + let mut files: Vec = Vec::new(); let mut id_gen = 0; for gameitem in &vpx.gameitems { let mut name = gameitem.name().to_string(); @@ -582,7 +599,14 @@ fn write_gameitems>(vpx: &VPX, expanded_dir: &P) -> Result<(), Wr used_names_lowercase.insert(lower_name); let file_name_json = format!("{}.json", &file_name); - files.push(file_name_json.clone()); + let gameitem_info = GameItemInfoJson { + file_name: file_name_json.clone(), + is_locked: gameitem.is_locked(), + editor_layer: gameitem.editor_layer(), + editor_layer_name: gameitem.editor_layer_name().clone(), + editor_layer_visibility: gameitem.editor_layer_visibility(), + }; + files.push(gameitem_info); let gameitem_path = gameitems_dir.join(file_name_json); // should not happen but we keep the check if gameitem_path.exists() { @@ -637,16 +661,20 @@ fn read_gameitems>(expanded_dir: &P) -> io::Result = read_json(gameitems_index_path)?; + let gameitems_index: Vec = read_json(gameitems_index_path)?; // for each item in the index read the items let gameitems_dir = expanded_dir.as_ref().join("gameitems"); let gameitems: io::Result> = gameitems_index .into_iter() - .map(|gameitem_file_name| { - let gameitem_path = gameitems_dir.join(&gameitem_file_name); + .map(|gameitem_info| { + let gameitem_path = gameitems_dir.join(&gameitem_info.file_name); if gameitem_path.exists() { - let item: GameItemEnum = read_json(&gameitem_path)?; - read_gameitem_binaries(&gameitems_dir, gameitem_file_name, item) + let mut item: GameItemEnum = read_json(&gameitem_path)?; + item.set_locked(gameitem_info.is_locked); + item.set_editor_layer(gameitem_info.editor_layer); + item.set_editor_layer_name(gameitem_info.editor_layer_name); + item.set_editor_layer_visibility(gameitem_info.editor_layer_visibility); + read_gameitem_binaries(&gameitems_dir, gameitem_info.file_name, item) } else { Err(io::Error::new( io::ErrorKind::NotFound, diff --git a/src/vpx/gameitem.rs b/src/vpx/gameitem.rs index a5f513e..507ff59 100644 --- a/src/vpx/gameitem.rs +++ b/src/vpx/gameitem.rs @@ -1,5 +1,4 @@ pub mod bumper; -pub mod collection; pub mod decal; pub mod dragpoint; pub mod flasher; @@ -10,7 +9,6 @@ pub mod generic; pub mod hittarget; pub mod kicker; pub mod light; -pub mod lightcenter; pub mod lightsequencer; pub mod plunger; pub mod primitive; @@ -18,7 +16,6 @@ pub mod ramp; pub mod reel; pub mod rubber; pub mod spinner; -pub mod table; pub mod textbox; pub mod timer; pub mod trigger; @@ -64,6 +61,384 @@ pub enum GameItemEnum { Generic(u32, generic::Generic), } +impl GameItemEnum { + // TODO clean up this mess + + pub(crate) fn editor_layer_visibility(&self) -> Option { + match self { + GameItemEnum::Wall(wall) => wall.editor_layer_visibility, + GameItemEnum::Flipper(flipper) => flipper.editor_layer_visibility, + GameItemEnum::Timer(timer) => timer.editor_layer_visibility, + GameItemEnum::Plunger(plunger) => plunger.editor_layer_visibility, + GameItemEnum::TextBox(textbox) => textbox.editor_layer_visibility, + GameItemEnum::Bumper(bumper) => bumper.editor_layer_visibility, + GameItemEnum::Trigger(trigger) => trigger.editor_layer_visibility, + GameItemEnum::Light(light) => light.editor_layer_visibility, + GameItemEnum::Kicker(kicker) => kicker.editor_layer_visibility, + GameItemEnum::Decal(decal) => decal.editor_layer_visibility, + GameItemEnum::Gate(gate) => gate.editor_layer_visibility, + GameItemEnum::Spinner(spinner) => spinner.editor_layer_visibility, + GameItemEnum::Ramp(ramp) => ramp.editor_layer_visibility, + GameItemEnum::Reel(reel) => reel.editor_layer_visibility, + GameItemEnum::LightSequencer(lightsequencer) => lightsequencer.editor_layer_visibility, + GameItemEnum::Primitive(primitive) => primitive.editor_layer_visibility, + GameItemEnum::Flasher(flasher) => flasher.editor_layer_visibility, + GameItemEnum::Rubber(rubber) => rubber.editor_layer_visibility, + GameItemEnum::HitTarget(hittarget) => hittarget.editor_layer_visibility, + GameItemEnum::Generic(_item_type, _generic) => None, + } + } + + pub(crate) fn editor_layer_name(&self) -> &Option { + match self { + GameItemEnum::Wall(wall) => &wall.editor_layer_name, + GameItemEnum::Flipper(flipper) => &flipper.editor_layer_name, + GameItemEnum::Timer(timer) => &timer.editor_layer_name, + GameItemEnum::Plunger(plunger) => &plunger.editor_layer_name, + GameItemEnum::TextBox(textbox) => &textbox.editor_layer_name, + GameItemEnum::Bumper(bumper) => &bumper.editor_layer_name, + GameItemEnum::Trigger(trigger) => &trigger.editor_layer_name, + GameItemEnum::Light(light) => &light.editor_layer_name, + GameItemEnum::Kicker(kicker) => &kicker.editor_layer_name, + GameItemEnum::Decal(decal) => &decal.editor_layer_name, + GameItemEnum::Gate(gate) => &gate.editor_layer_name, + GameItemEnum::Spinner(spinner) => &spinner.editor_layer_name, + GameItemEnum::Ramp(ramp) => &ramp.editor_layer_name, + GameItemEnum::Reel(reel) => &reel.editor_layer_name, + GameItemEnum::LightSequencer(lightsequencer) => &lightsequencer.editor_layer_name, + GameItemEnum::Primitive(primitive) => &primitive.editor_layer_name, + GameItemEnum::Flasher(flasher) => &flasher.editor_layer_name, + GameItemEnum::Rubber(rubber) => &rubber.editor_layer_name, + GameItemEnum::HitTarget(hittarget) => &hittarget.editor_layer_name, + GameItemEnum::Generic(_item_type, _generic) => &None, + } + } + + pub(crate) fn editor_layer(&self) -> Option { + match self { + GameItemEnum::Wall(wall) => Some(wall.editor_layer), + GameItemEnum::Flipper(flipper) => Some(flipper.editor_layer), + GameItemEnum::Timer(timer) => Some(timer.editor_layer), + GameItemEnum::Plunger(plunger) => Some(plunger.editor_layer), + GameItemEnum::TextBox(textbox) => Some(textbox.editor_layer), + GameItemEnum::Bumper(bumper) => Some(bumper.editor_layer), + GameItemEnum::Trigger(trigger) => Some(trigger.editor_layer), + GameItemEnum::Light(light) => Some(light.editor_layer), + GameItemEnum::Kicker(kicker) => Some(kicker.editor_layer), + GameItemEnum::Decal(decal) => Some(decal.editor_layer), + GameItemEnum::Gate(gate) => Some(gate.editor_layer), + GameItemEnum::Spinner(spinner) => Some(spinner.editor_layer), + GameItemEnum::Ramp(ramp) => Some(ramp.editor_layer), + GameItemEnum::Reel(reel) => Some(reel.editor_layer), + GameItemEnum::LightSequencer(lightsequencer) => lightsequencer.editor_layer, + GameItemEnum::Primitive(primitive) => Some(primitive.editor_layer), + GameItemEnum::Flasher(flasher) => Some(flasher.editor_layer), + GameItemEnum::Rubber(rubber) => Some(rubber.editor_layer), + GameItemEnum::HitTarget(hittarget) => Some(hittarget.editor_layer), + GameItemEnum::Generic(_item_type, _generic) => None, + } + } + + pub(crate) fn is_locked(&self) -> Option { + match self { + GameItemEnum::Wall(wall) => Some(wall.is_locked), + GameItemEnum::Flipper(flipper) => Some(flipper.is_locked), + GameItemEnum::Timer(timer) => Some(timer.is_locked), + GameItemEnum::Plunger(plunger) => Some(plunger.is_locked), + GameItemEnum::TextBox(textbox) => Some(textbox.is_locked), + GameItemEnum::Bumper(bumper) => Some(bumper.is_locked), + GameItemEnum::Trigger(trigger) => Some(trigger.is_locked), + GameItemEnum::Light(light) => Some(light.is_locked), + GameItemEnum::Kicker(kicker) => Some(kicker.is_locked), + GameItemEnum::Decal(decal) => Some(decal.is_locked), + GameItemEnum::Gate(gate) => Some(gate.is_locked), + GameItemEnum::Spinner(spinner) => Some(spinner.is_locked), + GameItemEnum::Ramp(ramp) => Some(ramp.is_locked), + GameItemEnum::Reel(reel) => Some(reel.is_locked), + GameItemEnum::LightSequencer(lightsequencer) => lightsequencer.is_locked, + GameItemEnum::Primitive(primitive) => Some(primitive.is_locked), + GameItemEnum::Flasher(flasher) => Some(flasher.is_locked), + GameItemEnum::Rubber(rubber) => Some(rubber.is_locked), + GameItemEnum::HitTarget(hittarget) => Some(hittarget.is_locked), + GameItemEnum::Generic(_item_type, _generic) => None, + } + } + + pub(crate) fn set_locked(&mut self, locked: Option) { + match self { + GameItemEnum::Wall(wall) => { + if let Some(locked) = locked { + wall.is_locked = locked; + } + } + GameItemEnum::Flipper(flipper) => { + if let Some(locked) = locked { + flipper.is_locked = locked; + } + } + GameItemEnum::Timer(timer) => { + if let Some(locked) = locked { + timer.is_locked = locked; + } + } + GameItemEnum::Plunger(plunger) => { + if let Some(locked) = locked { + plunger.is_locked = locked; + } + } + GameItemEnum::TextBox(textbox) => { + if let Some(locked) = locked { + textbox.is_locked = locked; + } + } + GameItemEnum::Bumper(bumper) => { + if let Some(locked) = locked { + bumper.is_locked = locked; + } + } + GameItemEnum::Trigger(trigger) => { + if let Some(locked) = locked { + trigger.is_locked = locked; + } + } + GameItemEnum::Light(light) => { + if let Some(locked) = locked { + light.is_locked = locked; + } + } + GameItemEnum::Kicker(kicker) => { + if let Some(locked) = locked { + kicker.is_locked = locked; + } + } + GameItemEnum::Decal(decal) => { + if let Some(locked) = locked { + decal.is_locked = locked; + } + } + GameItemEnum::Gate(gate) => { + if let Some(locked) = locked { + gate.is_locked = locked; + } + } + GameItemEnum::Spinner(spinner) => { + if let Some(locked) = locked { + spinner.is_locked = locked; + } + } + GameItemEnum::Ramp(ramp) => { + if let Some(locked) = locked { + ramp.is_locked = locked; + } + } + GameItemEnum::Reel(reel) => { + if let Some(locked) = locked { + reel.is_locked = locked; + } + } + GameItemEnum::LightSequencer(lightsequencer) => { + lightsequencer.is_locked = locked; + } + GameItemEnum::Primitive(primitive) => { + if let Some(locked) = locked { + primitive.is_locked = locked; + } + } + GameItemEnum::Flasher(flasher) => { + if let Some(locked) = locked { + flasher.is_locked = locked; + } + } + GameItemEnum::Rubber(rubber) => { + if let Some(locked) = locked { + rubber.is_locked = locked; + } + } + GameItemEnum::HitTarget(hittarget) => { + if let Some(locked) = locked { + hittarget.is_locked = locked; + } + } + GameItemEnum::Generic(_item_type, _generic) => {} + } + } + + pub(crate) fn set_editor_layer(&mut self, editor_layer: Option) { + match self { + GameItemEnum::Wall(wall) => { + if let Some(editor_layer) = editor_layer { + wall.editor_layer = editor_layer; + } + } + GameItemEnum::Flipper(flipper) => { + if let Some(editor_layer) = editor_layer { + flipper.editor_layer = editor_layer; + } + } + GameItemEnum::Timer(timer) => { + if let Some(editor_layer) = editor_layer { + timer.editor_layer = editor_layer; + } + } + GameItemEnum::Plunger(plunger) => { + if let Some(editor_layer) = editor_layer { + plunger.editor_layer = editor_layer; + } + } + GameItemEnum::TextBox(textbox) => { + if let Some(editor_layer) = editor_layer { + textbox.editor_layer = editor_layer; + } + } + GameItemEnum::Bumper(bumper) => { + if let Some(editor_layer) = editor_layer { + bumper.editor_layer = editor_layer; + } + } + GameItemEnum::Trigger(trigger) => { + if let Some(editor_layer) = editor_layer { + trigger.editor_layer = editor_layer; + } + } + GameItemEnum::Light(light) => { + if let Some(editor_layer) = editor_layer { + light.editor_layer = editor_layer; + } + } + GameItemEnum::Kicker(kicker) => { + if let Some(editor_layer) = editor_layer { + kicker.editor_layer = editor_layer; + } + } + GameItemEnum::Decal(decal) => { + if let Some(editor_layer) = editor_layer { + decal.editor_layer = editor_layer; + } + } + GameItemEnum::Gate(gate) => { + if let Some(editor_layer) = editor_layer { + gate.editor_layer = editor_layer; + } + } + GameItemEnum::Spinner(spinner) => { + if let Some(editor_layer) = editor_layer { + spinner.editor_layer = editor_layer; + } + } + GameItemEnum::Ramp(ramp) => { + if let Some(editor_layer) = editor_layer { + ramp.editor_layer = editor_layer; + } + } + GameItemEnum::Reel(reel) => { + if let Some(editor_layer) = editor_layer { + reel.editor_layer = editor_layer; + } + } + GameItemEnum::LightSequencer(lightsequencer) => { + lightsequencer.editor_layer = editor_layer; + } + GameItemEnum::Primitive(primitive) => { + if let Some(editor_layer) = editor_layer { + primitive.editor_layer = editor_layer; + } + } + GameItemEnum::Flasher(flasher) => { + if let Some(editor_layer) = editor_layer { + flasher.editor_layer = editor_layer; + } + } + GameItemEnum::Rubber(rubber) => { + if let Some(editor_layer) = editor_layer { + rubber.editor_layer = editor_layer; + } + } + GameItemEnum::HitTarget(hittarget) => { + if let Some(editor_layer) = editor_layer { + hittarget.editor_layer = editor_layer; + } + } + GameItemEnum::Generic(_item_type, _generic) => {} + } + } + + pub(crate) fn set_editor_layer_name(&mut self, editor_layer_name: Option) { + match self { + GameItemEnum::Wall(wall) => wall.editor_layer_name = editor_layer_name, + GameItemEnum::Flipper(flipper) => flipper.editor_layer_name = editor_layer_name, + GameItemEnum::Timer(timer) => timer.editor_layer_name = editor_layer_name, + GameItemEnum::Plunger(plunger) => plunger.editor_layer_name = editor_layer_name, + GameItemEnum::TextBox(textbox) => textbox.editor_layer_name = editor_layer_name, + GameItemEnum::Bumper(bumper) => bumper.editor_layer_name = editor_layer_name, + GameItemEnum::Trigger(trigger) => trigger.editor_layer_name = editor_layer_name, + GameItemEnum::Light(light) => light.editor_layer_name = editor_layer_name, + GameItemEnum::Kicker(kicker) => kicker.editor_layer_name = editor_layer_name, + GameItemEnum::Decal(decal) => decal.editor_layer_name = editor_layer_name, + GameItemEnum::Gate(gate) => gate.editor_layer_name = editor_layer_name, + GameItemEnum::Spinner(spinner) => spinner.editor_layer_name = editor_layer_name, + GameItemEnum::Ramp(ramp) => ramp.editor_layer_name = editor_layer_name, + GameItemEnum::Reel(reel) => reel.editor_layer_name = editor_layer_name, + GameItemEnum::LightSequencer(lightsequencer) => { + lightsequencer.editor_layer_name = editor_layer_name; + } + GameItemEnum::Primitive(primitive) => primitive.editor_layer_name = editor_layer_name, + GameItemEnum::Flasher(flasher) => flasher.editor_layer_name = editor_layer_name, + GameItemEnum::Rubber(rubber) => rubber.editor_layer_name = editor_layer_name, + GameItemEnum::HitTarget(hittarget) => hittarget.editor_layer_name = editor_layer_name, + GameItemEnum::Generic(_item_type, _generic) => {} + } + } + + pub(crate) fn set_editor_layer_visibility(&mut self, editor_layer_visibility: Option) { + match self { + GameItemEnum::Wall(wall) => wall.editor_layer_visibility = editor_layer_visibility, + GameItemEnum::Flipper(flipper) => { + flipper.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Timer(timer) => timer.editor_layer_visibility = editor_layer_visibility, + GameItemEnum::Plunger(plunger) => { + plunger.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::TextBox(textbox) => { + textbox.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Bumper(bumper) => { + bumper.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Trigger(trigger) => { + trigger.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Light(light) => light.editor_layer_visibility = editor_layer_visibility, + GameItemEnum::Kicker(kicker) => { + kicker.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Decal(decal) => decal.editor_layer_visibility = editor_layer_visibility, + GameItemEnum::Gate(gate) => gate.editor_layer_visibility = editor_layer_visibility, + GameItemEnum::Spinner(spinner) => { + spinner.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Ramp(ramp) => ramp.editor_layer_visibility = editor_layer_visibility, + GameItemEnum::Reel(reel) => reel.editor_layer_visibility = editor_layer_visibility, + GameItemEnum::LightSequencer(lightsequencer) => { + lightsequencer.editor_layer_visibility = editor_layer_visibility; + } + GameItemEnum::Primitive(primitive) => { + primitive.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Flasher(flasher) => { + flasher.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Rubber(rubber) => { + rubber.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::HitTarget(hittarget) => { + hittarget.editor_layer_visibility = editor_layer_visibility + } + GameItemEnum::Generic(_item_type, _generic) => {} + } + } +} + impl GameItemEnum { pub fn name(&self) -> &str { match self { diff --git a/src/vpx/gameitem/bumper.rs b/src/vpx/gameitem/bumper.rs index d354055..34ac6ce 100644 --- a/src/vpx/gameitem/bumper.rs +++ b/src/vpx/gameitem/bumper.rs @@ -72,13 +72,6 @@ struct BumperJson { hit_event: Option, is_collidable: Option, is_reflection_enabled: Option, - - // these are shared between all items - pub is_locked: bool, - pub editor_layer: u32, - pub editor_layer_name: Option, - // default "Layer_{editor_layer + 1}" - pub editor_layer_visibility: Option, } impl From<&Bumper> for BumperJson { @@ -108,10 +101,6 @@ impl From<&Bumper> for BumperJson { hit_event: bumper.hit_event, is_collidable: bumper.is_collidable, is_reflection_enabled: bumper.is_reflection_enabled, - is_locked: bumper.is_locked, - editor_layer: bumper.editor_layer, - editor_layer_name: bumper.editor_layer_name.clone(), - editor_layer_visibility: bumper.editor_layer_visibility, } } } @@ -192,10 +181,6 @@ impl<'de> Deserialize<'de> for Bumper { bumper.hit_event = bumper_json.hit_event; bumper.is_collidable = bumper_json.is_collidable; bumper.is_reflection_enabled = bumper_json.is_reflection_enabled; - bumper.is_locked = bumper_json.is_locked; - bumper.editor_layer = bumper_json.editor_layer; - bumper.editor_layer_name = bumper_json.editor_layer_name; - bumper.editor_layer_visibility = bumper_json.editor_layer_visibility; Ok(bumper) } } diff --git a/src/vpx/gameitem/collection.rs b/src/vpx/gameitem/collection.rs deleted file mode 100644 index f26d18d..0000000 --- a/src/vpx/gameitem/collection.rs +++ /dev/null @@ -1,110 +0,0 @@ -use crate::vpx::biff::{self, BiffRead, BiffReader}; -use fake::Dummy; -use serde::{Deserialize, Serialize}; - -#[derive(Debug, PartialEq, Dummy)] -pub struct Collection { - pub name: String, - - // these are shared between all items - pub is_locked: bool, - pub editor_layer: u32, - pub editor_layer_name: String, - // default "Layer_{editor_layer + 1}" - pub editor_layer_visibility: bool, -} - -#[derive(Debug, PartialEq, Serialize, Deserialize)] -struct CollectionJson { - name: String, - is_locked: bool, - editor_layer: u32, - editor_layer_name: String, - editor_layer_visibility: bool, -} - -impl Serialize for Collection { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - CollectionJson { - name: self.name.clone(), - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, - } - .serialize(serializer) - } -} - -impl<'de> Deserialize<'de> for Collection { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let json = CollectionJson::deserialize(deserializer)?; - Ok(Collection { - name: json.name, - is_locked: json.is_locked, - editor_layer: json.editor_layer, - editor_layer_name: json.editor_layer_name, - editor_layer_visibility: json.editor_layer_visibility, - }) - } -} - -impl BiffRead for Collection { - fn biff_read(reader: &mut BiffReader<'_>) -> Self { - let mut name = Default::default(); - - // these are shared between all items - let mut is_locked: bool = false; - let mut editor_layer: u32 = Default::default(); - let mut editor_layer_name: String = Default::default(); - let mut editor_layer_visibility: bool = true; - - loop { - reader.next(biff::WARN); - if reader.is_eof() { - break; - } - let tag = reader.tag(); - let tag_str = tag.as_str(); - match tag_str { - "NAME" => { - name = reader.get_wide_string(); - } - // shared - "LOCK" => { - is_locked = reader.get_bool(); - } - "LAYR" => { - editor_layer = reader.get_u32(); - } - "LANR" => { - editor_layer_name = reader.get_string(); - } - "LVIS" => { - editor_layer_visibility = reader.get_bool(); - } - _ => { - println!( - "Unknown tag {} for {}", - tag_str, - std::any::type_name::() - ); - reader.skip_tag(); - } - } - } - Self { - name, - is_locked, - editor_layer, - editor_layer_name, - editor_layer_visibility, - } - } -} diff --git a/src/vpx/gameitem/decal.rs b/src/vpx/gameitem/decal.rs index 68d40cc..b34e3fa 100644 --- a/src/vpx/gameitem/decal.rs +++ b/src/vpx/gameitem/decal.rs @@ -52,10 +52,6 @@ struct DecalJson { vertical_text: bool, backglass: bool, font: FontJson, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl DecalJson { @@ -76,10 +72,6 @@ impl DecalJson { vertical_text: decal.vertical_text, backglass: decal.backglass, font: FontJson::from_font(&decal.font), - is_locked: decal.is_locked, - editor_layer: decal.editor_layer, - editor_layer_name: decal.editor_layer_name.clone(), - editor_layer_visibility: decal.editor_layer_visibility, } } @@ -100,10 +92,14 @@ impl DecalJson { vertical_text: self.vertical_text, backglass: self.backglass, font: self.font.to_font(), - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } @@ -331,7 +327,12 @@ mod tests { let decal_json = DecalJson::from_decal(&decal); let json = serde_json::to_string(&decal_json).unwrap(); let decal_read_json: DecalJson = serde_json::from_str(&json).unwrap(); - let decal_read = decal_read_json.to_decal(); + let mut decal_read = decal_read_json.to_decal(); + // json does not store the shared fields + decal_read.is_locked = decal.is_locked; + decal_read.editor_layer = decal.editor_layer; + decal_read.editor_layer_name = decal.editor_layer_name.clone(); + decal_read.editor_layer_visibility = decal.editor_layer_visibility; assert_eq!(decal, decal_read); } } diff --git a/src/vpx/gameitem/flasher.rs b/src/vpx/gameitem/flasher.rs index 28026c6..cf18a4c 100644 --- a/src/vpx/gameitem/flasher.rs +++ b/src/vpx/gameitem/flasher.rs @@ -71,10 +71,6 @@ pub(crate) struct FlasherJson { filter_amount: u32, light_map: Option, drag_points: Vec, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl FlasherJson { @@ -104,10 +100,6 @@ impl FlasherJson { filter_amount: flasher.filter_amount, light_map: flasher.light_map.clone(), drag_points: flasher.drag_points.clone(), - is_locked: flasher.is_locked, - editor_layer: flasher.editor_layer, - editor_layer_name: flasher.editor_layer_name.clone(), - editor_layer_visibility: flasher.editor_layer_visibility, } } pub fn to_flasher(&self) -> Flasher { @@ -136,10 +128,14 @@ impl FlasherJson { filter_amount: self.filter_amount, light_map: self.light_map.clone(), drag_points: self.drag_points.clone(), - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/flipper.rs b/src/vpx/gameitem/flipper.rs index ca8ea84..605895c 100644 --- a/src/vpx/gameitem/flipper.rs +++ b/src/vpx/gameitem/flipper.rs @@ -90,10 +90,6 @@ pub(crate) struct FlipperJson { height: f32, image: Option, is_reflection_enabled: Option, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl FlipperJson { @@ -134,10 +130,6 @@ impl FlipperJson { height: flipper.height, image: flipper.image.clone(), is_reflection_enabled: flipper.is_reflection_enabled, - is_locked: flipper.is_locked, - editor_layer: flipper.editor_layer, - editor_layer_name: flipper.editor_layer_name.clone(), - editor_layer_visibility: flipper.editor_layer_visibility, } } @@ -178,10 +170,14 @@ impl FlipperJson { height: self.height, image: self.image.clone(), is_reflection_enabled: self.is_reflection_enabled, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/gate.rs b/src/vpx/gameitem/gate.rs index 6845806..b9fd755 100644 --- a/src/vpx/gameitem/gate.rs +++ b/src/vpx/gameitem/gate.rs @@ -158,10 +158,6 @@ pub(crate) struct GateJson { two_way: bool, is_reflection_enabled: Option, gate_type: Option, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl GateJson { @@ -190,10 +186,6 @@ impl GateJson { two_way: gate.two_way, is_reflection_enabled: gate.is_reflection_enabled, gate_type: gate.gate_type.clone(), - is_locked: gate.is_locked, - editor_layer: gate.editor_layer, - editor_layer_name: gate.editor_layer_name.clone(), - editor_layer_visibility: gate.editor_layer_visibility, } } pub fn to_gate(&self) -> Gate { @@ -221,10 +213,14 @@ impl GateJson { two_way: self.two_way, is_reflection_enabled: self.is_reflection_enabled, gate_type: self.gate_type.clone(), - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/hittarget.rs b/src/vpx/gameitem/hittarget.rs index 000651a..cfd3edf 100644 --- a/src/vpx/gameitem/hittarget.rs +++ b/src/vpx/gameitem/hittarget.rs @@ -148,10 +148,6 @@ struct HitTargetJson { raise_delay: Option, physics_material: Option, overwrite_physics: Option, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl HitTargetJson { @@ -185,10 +181,6 @@ impl HitTargetJson { raise_delay: hit_target.raise_delay, physics_material: hit_target.physics_material.clone(), overwrite_physics: hit_target.overwrite_physics, - is_locked: hit_target.is_locked, - editor_layer: hit_target.editor_layer, - editor_layer_name: hit_target.editor_layer_name.clone(), - editor_layer_visibility: hit_target.editor_layer_visibility, } } @@ -222,10 +214,14 @@ impl HitTargetJson { raise_delay: self.raise_delay, physics_material: self.physics_material.clone(), overwrite_physics: self.overwrite_physics, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/kicker.rs b/src/vpx/gameitem/kicker.rs index cdb2b61..dfaa4bb 100644 --- a/src/vpx/gameitem/kicker.rs +++ b/src/vpx/gameitem/kicker.rs @@ -47,10 +47,6 @@ struct KickerJson { orientation: f32, fall_through: bool, legacy_mode: bool, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl KickerJson { @@ -71,10 +67,6 @@ impl KickerJson { orientation: kicker.orientation, fall_through: kicker.fall_through, legacy_mode: kicker.legacy_mode, - is_locked: kicker.is_locked, - editor_layer: kicker.editor_layer, - editor_layer_name: kicker.editor_layer_name.clone(), - editor_layer_visibility: kicker.editor_layer_visibility, } } @@ -95,10 +87,14 @@ impl KickerJson { orientation: self.orientation, fall_through: self.fall_through, legacy_mode: self.legacy_mode, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name, - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/light.rs b/src/vpx/gameitem/light.rs index 7fdaedf..4a790f0 100644 --- a/src/vpx/gameitem/light.rs +++ b/src/vpx/gameitem/light.rs @@ -88,10 +88,6 @@ struct LightJson { shadows: Option, fader: Option, visible: Option, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, drag_points: Vec, } @@ -130,10 +126,6 @@ impl LightJson { shadows: light.shadows, fader: light.fader, visible: light.visible, - is_locked: light.is_locked, - editor_layer: light.editor_layer, - editor_layer_name: light.editor_layer_name.clone(), - editor_layer_visibility: light.editor_layer_visibility, drag_points: light.drag_points.clone(), } } @@ -172,10 +164,15 @@ impl LightJson { shadows: self.shadows, fader: self.fader, visible: self.visible, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, + // this is populated from a different file drag_points: self.drag_points.clone(), } } diff --git a/src/vpx/gameitem/lightcenter.rs b/src/vpx/gameitem/lightcenter.rs deleted file mode 100644 index c9c9c78..0000000 --- a/src/vpx/gameitem/lightcenter.rs +++ /dev/null @@ -1,64 +0,0 @@ -use crate::vpx::biff::{self, BiffRead, BiffReader}; -use fake::Dummy; -use serde::{Deserialize, Serialize, Serializer}; - -#[derive(Debug, PartialEq, Dummy)] -pub struct LightCenter { - pub name: String, -} - -#[derive(Serialize, Deserialize)] -struct LightCenterJson { - name: String, -} - -impl Serialize for LightCenter { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let json = LightCenterJson { - name: self.name.clone(), - }; - json.serialize(serializer) - } -} - -impl<'de> serde::Deserialize<'de> for LightCenter { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let json = LightCenterJson::deserialize(deserializer)?; - Ok(Self { name: json.name }) - } -} - -impl BiffRead for LightCenter { - fn biff_read(reader: &mut BiffReader<'_>) -> Self { - let mut name = Default::default(); - - loop { - reader.next(biff::WARN); - if reader.is_eof() { - break; - } - let tag = reader.tag(); - let tag_str = tag.as_str(); - match tag_str { - "NAME" => { - name = reader.get_wide_string(); - } - _ => { - println!( - "Unknown tag {} for {}", - tag_str, - std::any::type_name::() - ); - reader.skip_tag(); - } - } - } - Self { name } - } -} diff --git a/src/vpx/gameitem/lightsequencer.rs b/src/vpx/gameitem/lightsequencer.rs index ff4594d..10ed794 100644 --- a/src/vpx/gameitem/lightsequencer.rs +++ b/src/vpx/gameitem/lightsequencer.rs @@ -37,10 +37,6 @@ struct LightSequencerJson { timer_interval: u32, name: String, backglass: bool, - is_locked: Option, - editor_layer: Option, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl LightSequencerJson { @@ -55,10 +51,6 @@ impl LightSequencerJson { timer_interval: light_sequencer.timer_interval, name: light_sequencer.name.clone(), backglass: light_sequencer.backglass, - is_locked: light_sequencer.is_locked, - editor_layer: light_sequencer.editor_layer, - editor_layer_name: light_sequencer.editor_layer_name.clone(), - editor_layer_visibility: light_sequencer.editor_layer_visibility, } } pub fn to_light_sequencer(&self) -> LightSequencer { @@ -72,10 +64,14 @@ impl LightSequencerJson { timer_interval: self.timer_interval, name: self.name.clone(), backglass: self.backglass, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: None, + // this is populated from a different file + editor_layer: None, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/plunger.rs b/src/vpx/gameitem/plunger.rs index 78469cc..dde98cd 100644 --- a/src/vpx/gameitem/plunger.rs +++ b/src/vpx/gameitem/plunger.rs @@ -81,10 +81,6 @@ struct PlungerJson { spring_gauge: f32, spring_loops: f32, spring_end_loops: f32, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl PlungerJson { @@ -122,10 +118,6 @@ impl PlungerJson { spring_gauge: plunger.spring_gauge, spring_loops: plunger.spring_loops, spring_end_loops: plunger.spring_end_loops, - is_locked: plunger.is_locked, - editor_layer: plunger.editor_layer, - editor_layer_name: plunger.editor_layer_name.clone(), - editor_layer_visibility: plunger.editor_layer_visibility, } } @@ -163,10 +155,14 @@ impl PlungerJson { spring_gauge: self.spring_gauge, spring_loops: self.spring_loops, spring_end_loops: self.spring_end_loops, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/primitive.rs b/src/vpx/gameitem/primitive.rs index 8f6fd6d..c8e37c9 100644 --- a/src/vpx/gameitem/primitive.rs +++ b/src/vpx/gameitem/primitive.rs @@ -127,10 +127,6 @@ struct PrimitiveJson { reflection_strength: Option, refraction_probe: Option, refraction_thickness: Option, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl PrimitiveJson { @@ -191,10 +187,6 @@ impl PrimitiveJson { reflection_strength: primitive.reflection_strength, refraction_probe: primitive.refraction_probe.clone(), refraction_thickness: primitive.refraction_thickness, - is_locked: primitive.is_locked, - editor_layer: primitive.editor_layer, - editor_layer_name: primitive.editor_layer_name.clone(), - editor_layer_visibility: primitive.editor_layer_visibility, } } pub fn to_primitive(&self) -> Primitive { @@ -252,10 +244,14 @@ impl PrimitiveJson { reflection_strength: self.reflection_strength, refraction_probe: self.refraction_probe.clone(), refraction_thickness: self.refraction_thickness, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/ramp.rs b/src/vpx/gameitem/ramp.rs index 932a52e..31b334b 100644 --- a/src/vpx/gameitem/ramp.rs +++ b/src/vpx/gameitem/ramp.rs @@ -79,14 +79,7 @@ struct RampJson { is_reflection_enabled: Option, physics_material: Option, overwrite_physics: Option, // true; - drag_points: Vec, - - // these are shared between all items - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl RampJson { @@ -123,10 +116,6 @@ impl RampJson { physics_material: ramp.physics_material.clone(), overwrite_physics: ramp.overwrite_physics, drag_points: ramp.drag_points.clone(), - is_locked: ramp.is_locked, - editor_layer: ramp.editor_layer, - editor_layer_name: ramp.editor_layer_name.clone(), - editor_layer_visibility: ramp.editor_layer_visibility, } } @@ -163,10 +152,14 @@ impl RampJson { physics_material: self.physics_material.clone(), overwrite_physics: self.overwrite_physics, drag_points: self.drag_points.clone(), - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/reel.rs b/src/vpx/gameitem/reel.rs index f387169..7317e6e 100644 --- a/src/vpx/gameitem/reel.rs +++ b/src/vpx/gameitem/reel.rs @@ -60,10 +60,6 @@ struct ReelJson { use_image_grid: bool, is_visible: bool, images_per_grid_row: u32, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl ReelJson { @@ -88,10 +84,6 @@ impl ReelJson { use_image_grid: reel.use_image_grid, is_visible: reel.is_visible, images_per_grid_row: reel.images_per_grid_row, - is_locked: reel.is_locked, - editor_layer: reel.editor_layer, - editor_layer_name: reel.editor_layer_name.clone(), - editor_layer_visibility: reel.editor_layer_visibility, } } pub fn to_reel(&self) -> Reel { @@ -115,10 +107,14 @@ impl ReelJson { use_image_grid: self.use_image_grid, is_visible: self.is_visible, images_per_grid_row: self.images_per_grid_row, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/rubber.rs b/src/vpx/gameitem/rubber.rs index 8585080..0015bc9 100644 --- a/src/vpx/gameitem/rubber.rs +++ b/src/vpx/gameitem/rubber.rs @@ -67,10 +67,6 @@ struct RubberJson { is_reflection_enabled: Option, physics_material: Option, overwrite_physics: Option, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, points: Vec, } @@ -101,10 +97,6 @@ impl RubberJson { is_reflection_enabled: rubber.is_reflection_enabled, physics_material: rubber.physics_material.clone(), overwrite_physics: rubber.overwrite_physics, - is_locked: rubber.is_locked, - editor_layer: rubber.editor_layer, - editor_layer_name: rubber.editor_layer_name.clone(), - editor_layer_visibility: rubber.editor_layer_visibility, points: rubber.points.clone(), } } @@ -135,10 +127,14 @@ impl RubberJson { is_reflection_enabled: self.is_reflection_enabled, physics_material: self.physics_material.clone(), overwrite_physics: self.overwrite_physics, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, points: self.points.clone(), } } diff --git a/src/vpx/gameitem/spinner.rs b/src/vpx/gameitem/spinner.rs index ca3b947..858510c 100644 --- a/src/vpx/gameitem/spinner.rs +++ b/src/vpx/gameitem/spinner.rs @@ -51,13 +51,6 @@ struct SpinnerJson { surface: String, name: String, is_reflection_enabled: Option, // added in ? - - // these are shared between all items - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - // default "Layer_{editor_layer + 1}" - editor_layer_visibility: Option, } impl SpinnerJson { @@ -80,10 +73,6 @@ impl SpinnerJson { surface: spinner.surface.clone(), name: spinner.name.clone(), is_reflection_enabled: spinner.is_reflection_enabled, - is_locked: spinner.is_locked, - editor_layer: spinner.editor_layer, - editor_layer_name: spinner.editor_layer_name.clone(), - editor_layer_visibility: spinner.editor_layer_visibility, } } @@ -106,10 +95,14 @@ impl SpinnerJson { surface: self.surface.clone(), name: self.name.clone(), is_reflection_enabled: self.is_reflection_enabled, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/table.rs b/src/vpx/gameitem/table.rs deleted file mode 100644 index 0451131..0000000 --- a/src/vpx/gameitem/table.rs +++ /dev/null @@ -1,64 +0,0 @@ -use crate::vpx::biff::{self, BiffRead, BiffReader}; -use fake::Dummy; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - -#[derive(Debug, PartialEq, Dummy)] -pub struct Table { - pub name: String, -} - -#[derive(Serialize, Deserialize)] -struct TableJson { - name: String, -} - -impl Serialize for Table { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let json = TableJson { - name: self.name.clone(), - }; - json.serialize(serializer) - } -} - -impl<'de> Deserialize<'de> for Table { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let json = TableJson::deserialize(deserializer)?; - Ok(Self { name: json.name }) - } -} - -impl BiffRead for Table { - fn biff_read(reader: &mut BiffReader<'_>) -> Self { - let mut name = Default::default(); - - loop { - reader.next(biff::WARN); - if reader.is_eof() { - break; - } - let tag = reader.tag(); - let tag_str = tag.as_str(); - match tag_str { - "NAME" => { - name = reader.get_wide_string(); - } - _ => { - println!( - "Unknown tag {} for {}", - tag_str, - std::any::type_name::() - ); - reader.skip_tag(); - } - } - } - Self { name } - } -} diff --git a/src/vpx/gameitem/textbox.rs b/src/vpx/gameitem/textbox.rs index c633be4..bbce0f6 100644 --- a/src/vpx/gameitem/textbox.rs +++ b/src/vpx/gameitem/textbox.rs @@ -63,10 +63,6 @@ struct TextBoxJson { is_transparent: bool, is_dmd: Option, font: FontJson, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl TextBoxJson { @@ -85,10 +81,6 @@ impl TextBoxJson { is_transparent: textbox.is_transparent, is_dmd: textbox.is_dmd, font: FontJson::from_font(&textbox.font), - is_locked: textbox.is_locked, - editor_layer: textbox.editor_layer, - editor_layer_name: textbox.editor_layer_name.clone(), - editor_layer_visibility: textbox.editor_layer_visibility, } } @@ -107,10 +99,14 @@ impl TextBoxJson { is_transparent: self.is_transparent, is_dmd: self.is_dmd, font: self.font.to_font(), - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name, - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/timer.rs b/src/vpx/gameitem/timer.rs index b8544d0..81dcd05 100644 --- a/src/vpx/gameitem/timer.rs +++ b/src/vpx/gameitem/timer.rs @@ -27,10 +27,6 @@ struct TimerJson { timer_interval: i32, name: String, backglass: bool, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, } impl TimerJson { @@ -41,10 +37,6 @@ impl TimerJson { timer_interval: timer.timer_interval, name: timer.name.clone(), backglass: timer.backglass, - is_locked: timer.is_locked, - editor_layer: timer.editor_layer, - editor_layer_name: timer.editor_layer_name.clone(), - editor_layer_visibility: timer.editor_layer_visibility, } } pub fn to_timer(&self) -> Timer { @@ -54,10 +46,14 @@ impl TimerJson { timer_interval: self.timer_interval, name: self.name.clone(), backglass: self.backglass, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, } } } diff --git a/src/vpx/gameitem/trigger.rs b/src/vpx/gameitem/trigger.rs index e0a0380..b6aaabe 100644 --- a/src/vpx/gameitem/trigger.rs +++ b/src/vpx/gameitem/trigger.rs @@ -61,10 +61,6 @@ struct TriggerJson { shape: u32, anim_speed: f32, is_reflection_enabled: Option, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, drag_points: Vec, } @@ -88,10 +84,6 @@ impl TriggerJson { shape: trigger.shape, anim_speed: trigger.anim_speed, is_reflection_enabled: trigger.is_reflection_enabled, - is_locked: trigger.is_locked, - editor_layer: trigger.editor_layer, - editor_layer_name: trigger.editor_layer_name.clone(), - editor_layer_visibility: trigger.editor_layer_visibility, drag_points: trigger.drag_points.clone(), } } @@ -114,10 +106,14 @@ impl TriggerJson { shape: self.shape, anim_speed: self.anim_speed, is_reflection_enabled: self.is_reflection_enabled, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, drag_points: self.drag_points.clone(), } } diff --git a/src/vpx/gameitem/wall.rs b/src/vpx/gameitem/wall.rs index d5175e4..1f02ab3 100644 --- a/src/vpx/gameitem/wall.rs +++ b/src/vpx/gameitem/wall.rs @@ -86,10 +86,6 @@ struct WallJson { is_reflection_enabled: Option, physics_material: Option, overwrite_physics: Option, - is_locked: bool, - editor_layer: u32, - editor_layer_name: Option, - editor_layer_visibility: Option, drag_points: Vec, } @@ -128,10 +124,6 @@ impl WallJson { is_reflection_enabled: wall.is_reflection_enabled, physics_material: wall.physics_material.clone(), overwrite_physics: wall.overwrite_physics, - is_locked: wall.is_locked, - editor_layer: wall.editor_layer, - editor_layer_name: wall.editor_layer_name.clone(), - editor_layer_visibility: wall.editor_layer_visibility, drag_points: wall.drag_points.clone(), } } @@ -170,10 +162,14 @@ impl WallJson { is_reflection_enabled: self.is_reflection_enabled, physics_material: self.physics_material.clone(), overwrite_physics: self.overwrite_physics, - is_locked: self.is_locked, - editor_layer: self.editor_layer, - editor_layer_name: self.editor_layer_name.clone(), - editor_layer_visibility: self.editor_layer_visibility, + // this is populated from a different file + is_locked: false, + // this is populated from a different file + editor_layer: 0, + // this is populated from a different file + editor_layer_name: None, + // this is populated from a different file + editor_layer_visibility: None, drag_points: self.drag_points.clone(), } }