diff --git a/Cargo.toml b/Cargo.toml index 6de5ed8..b7ee64d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,10 +14,10 @@ publish = false serde_obj = ["serde"] [workspace] -members = ["source/leela", "source/tycho"] +members = ["leela", "tycho"] [dependencies] -bitflags = "1.0" +bitflags = "1.1" failure = {version = "0.1", features = ["std"]} serde = {version = "1.0", features = ["derive"], optional = true} memchr = "2.0" @@ -31,4 +31,4 @@ lto = true [lib] name = "maraiah" -path = "source/lib.rs" +path = "maraiah/lib.rs" diff --git a/leela/Cargo.toml b/leela/Cargo.toml new file mode 100644 index 0000000..6161788 --- /dev/null +++ b/leela/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "maraiah-leela" +version = "0.0.0" +edition = "2018" + +[dependencies] +clap = "2" +maraiah = {path = "..", features = ["serde_obj"]} +serde = "1.0" +serde_yaml = "0.8" + +[[bin]] +name = "leela" +path = "main.rs" diff --git a/source/leela/main.rs b/leela/main.rs similarity index 61% rename from source/leela/main.rs rename to leela/main.rs index d493a02..ad826e2 100644 --- a/source/leela/main.rs +++ b/leela/main.rs @@ -1,13 +1,13 @@ #![allow(clippy::unit_arg)] -use maraiah::{err::*, file::*, image::*, sound::*, - machdr, map, shp, snd}; +use maraiah::{err::*, file::*, image::*, machdr, map, shp, snd, sound::*}; use std::{collections::HashSet, fs, io, slice::from_ref}; -fn open(path: &str) -> ResultS +/* +fn open(path: &str) -> ResultS { let fp = fs::File::open(path)?; - Ok(unsafe {memmap::Mmap::map(&fp)?}) + Ok(io::BufReader::new(fp)) } fn file_read(path: &str, f: F) -> ResultS @@ -22,14 +22,15 @@ fn file_read(path: &str, f: F) -> ResultS fn exists(path: String) -> Result<(), String> { match std::fs::metadata(path) { - Ok(_) => Ok(()), + Ok(_) => Ok(()), Err(e) => Err(e.to_string()), } } fn each_value(opt: &clap::ArgMatches<'_>, name: &str, - mut f: F) -> ResultS<()> + mut f: F) + -> ResultS<()> where F: FnMut(&str) -> ResultS<()> { if let Some(values) = opt.values_of(name) { @@ -91,43 +92,60 @@ fn sub_info_c(opt: &clap::ArgMatches<'_>) -> ResultS<()> Ok(()) } +*/ fn main() -> ResultS<()> { + use std::io::prelude::*; + + let inp = include_bytes!("../tests/data/map/Test.in"); + let mut rd = std::io::BufReader::new(&inp[..]); + + let mp = map::head::read(&mut rd).unwrap(); + let en = map::entr::read_all(&mp).unwrap(); + let ed = map::data::read_all(mp.head(), &en).unwrap(); + + write!(&mut std::fs::File::create("dicks.txt").unwrap(), "{:#?}", ed); + + /* use clap::clap_app; - let sub_data = - clap_app!(@subcommand data => - (about: "Dumps data into a discrete folder/YAML format")); + let sub_data = clap_app! { + @subcommand data => + (about: "Dumps data into a discrete folder/YAML format") + }; - let sub_dump = - clap_app!(@subcommand dump => + let sub_dump = clap_app! { + @subcommand dump => (about: "Dumps particular parts of data") (@arg chunks: -c --chunks [name]... "Dumps named chunks from an entry") (@group files => - (@attributes +required +multiple) - (@arg map: -m --map [file]... {exists} "Loads Map files") - (@arg shp: -s --shp [file]... {exists} "Loads Shapes files") - (@arg snd: -n --snd [file]... {exists} "Loads Sounds files"))); + (@attributes +required +multiple) + (@arg map: -m --map [file]... {exists} "Loads Map files") + (@arg shp: -s --shp [file]... {exists} "Loads Shapes files") + (@arg snd: -n --snd [file]... {exists} "Loads Sounds files")) + }; - let sub_info = - clap_app!(@subcommand info => + let sub_info = clap_app! { + @subcommand info => (about: "Outputs debug info") (@group files => - (@attributes +required +multiple) - (@arg map: -m --map [file]... {exists} "Loads Map files") - (@arg shp: -s --shp [file]... {exists} "Loads Shapes files") - (@arg snd: -n --snd [file]... {exists} "Loads Sounds files"))); + (@attributes +required +multiple) + (@arg map: -m --map [file]... {exists} "Loads Map files") + (@arg shp: -s --shp [file]... {exists} "Loads Shapes files") + (@arg snd: -n --snd [file]... {exists} "Loads Sounds files")) + }; - let opt = - clap_app!((env!("CARGO_PKG_NAME")) => - (version: env!("CARGO_PKG_VERSION")) - (author: env!("CARGO_PKG_AUTHORS")) - (about: env!("CARGO_PKG_DESCRIPTION")) + let opt = clap_app! { + (env!("CARGO_PKG_NAME")) => + (version: maraiah::meta::version()) + (author: maraiah::meta::authors().replace(':', ", ")) + (about: maraiah::meta::description()) (setting: clap::AppSettings::SubcommandRequiredElseHelp) (subcommand: sub_data) (subcommand: sub_dump) - (subcommand: sub_info)); + (subcommand: sub_info) + }; let opt = opt.get_matches(); @@ -137,6 +155,7 @@ fn main() -> ResultS<()> ("info", Some(opt)) => sub_info_c(opt)?, _ => unreachable!(), } + */ Ok(()) } diff --git a/source/bin.rs b/maraiah/bin.rs similarity index 98% rename from source/bin.rs rename to maraiah/bin.rs index 6112795..6186c6c 100644 --- a/source/bin.rs +++ b/maraiah/bin.rs @@ -559,7 +559,7 @@ impl OptU16 } } -impl fmt::Debug for OptU16 +impl fmt::Display for OptU16 { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -570,6 +570,17 @@ impl fmt::Debug for OptU16 } } +impl fmt::Debug for OptU16 +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result + { + match self.get() { + None => write!(f, "OptU16::none()"), + Some(n) => write!(f, "OptU16::from({})", n), + } + } +} + impl PartialEq<[u8; 4]> for Ident { #[inline] diff --git a/source/bit.rs b/maraiah/bit.rs similarity index 100% rename from source/bit.rs rename to maraiah/bit.rs diff --git a/source/cenum.rs b/maraiah/cenum.rs similarity index 95% rename from source/cenum.rs rename to maraiah/cenum.rs index 4ee5867..a9b3ac5 100644 --- a/source/cenum.rs +++ b/maraiah/cenum.rs @@ -16,7 +16,6 @@ /// use std::convert::TryFrom; /// /// c_enum! { -/// #[derive(Debug)] /// enum MyEnum: u16 /// { /// Zero = 0, @@ -43,7 +42,7 @@ macro_rules! c_enum } ) => { $(#[$outer])* - #[derive(Copy, Clone, Eq, Ord, PartialEq, PartialOrd)] + #[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] #[repr($ti)] $vi enum $t { @@ -74,7 +73,6 @@ mod test use std::convert::TryFrom; c_enum! { - #[derive(Debug)] enum TestEnum: u16 { Zero = 0, diff --git a/source/cksum.rs b/maraiah/cksum.rs similarity index 100% rename from source/cksum.rs rename to maraiah/cksum.rs diff --git a/source/defl.rs b/maraiah/defl.rs similarity index 100% rename from source/defl.rs rename to maraiah/defl.rs diff --git a/source/doc.rs b/maraiah/doc.rs similarity index 100% rename from source/doc.rs rename to maraiah/doc.rs diff --git a/source/err.rs b/maraiah/err.rs similarity index 100% rename from source/err.rs rename to maraiah/err.rs diff --git a/source/ffi.rs b/maraiah/ffi.rs similarity index 100% rename from source/ffi.rs rename to maraiah/ffi.rs diff --git a/source/file.rs b/maraiah/file.rs similarity index 100% rename from source/file.rs rename to maraiah/file.rs diff --git a/source/fixed.rs b/maraiah/fixed.rs similarity index 99% rename from source/fixed.rs rename to maraiah/fixed.rs index 5692f7a..86ef221 100644 --- a/source/fixed.rs +++ b/maraiah/fixed.rs @@ -588,7 +588,9 @@ macro_rules! define_fixed_types { { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(self, f) + write!(f, + concat!(stringify!($t), "::from_bits({})"), + self.to_bits()) } } )*}; diff --git a/source/image.rs b/maraiah/image.rs similarity index 100% rename from source/image.rs rename to maraiah/image.rs diff --git a/source/image/pict.rs b/maraiah/image/pict.rs similarity index 100% rename from source/image/pict.rs rename to maraiah/image/pict.rs diff --git a/source/image/pict/clut.rs b/maraiah/image/pict/clut.rs similarity index 100% rename from source/image/pict/clut.rs rename to maraiah/image/pict/clut.rs diff --git a/source/image/pict/pm.rs b/maraiah/image/pict/pm.rs similarity index 100% rename from source/image/pict/pm.rs rename to maraiah/image/pict/pm.rs diff --git a/source/image/pict/pm/area.rs b/maraiah/image/pict/pm/area.rs similarity index 100% rename from source/image/pict/pm/area.rs rename to maraiah/image/pict/pm/area.rs diff --git a/source/image/pict/pm/head.rs b/maraiah/image/pict/pm/head.rs similarity index 100% rename from source/image/pict/pm/head.rs rename to maraiah/image/pict/pm/head.rs diff --git a/source/image/pict/pm/ind.rs b/maraiah/image/pict/pm/ind.rs similarity index 100% rename from source/image/pict/pm/ind.rs rename to maraiah/image/pict/pm/ind.rs diff --git a/source/image/pict/pm/r5g5b5.rs b/maraiah/image/pict/pm/r5g5b5.rs similarity index 100% rename from source/image/pict/pm/r5g5b5.rs rename to maraiah/image/pict/pm/r5g5b5.rs diff --git a/source/image/pict/pm/rgb8.rs b/maraiah/image/pict/pm/rgb8.rs similarity index 100% rename from source/image/pict/pm/rgb8.rs rename to maraiah/image/pict/pm/rgb8.rs diff --git a/source/image/pict/rle.rs b/maraiah/image/pict/rle.rs similarity index 100% rename from source/image/pict/rle.rs rename to maraiah/image/pict/rle.rs diff --git a/source/image/ppm.rs b/maraiah/image/ppm.rs similarity index 100% rename from source/image/ppm.rs rename to maraiah/image/ppm.rs diff --git a/source/image/tga.rs b/maraiah/image/tga.rs similarity index 100% rename from source/image/tga.rs rename to maraiah/image/tga.rs diff --git a/source/lib.rs b/maraiah/lib.rs similarity index 100% rename from source/lib.rs rename to maraiah/lib.rs diff --git a/source/machdr.rs b/maraiah/machdr.rs similarity index 100% rename from source/machdr.rs rename to maraiah/machdr.rs diff --git a/source/map.rs b/maraiah/map.rs similarity index 100% rename from source/map.rs rename to maraiah/map.rs diff --git a/source/map/ambi.rs b/maraiah/map/ambi.rs similarity index 100% rename from source/map/ambi.rs rename to maraiah/map/ambi.rs diff --git a/source/map/attk.rs b/maraiah/map/attk.rs similarity index 100% rename from source/map/attk.rs rename to maraiah/map/attk.rs diff --git a/source/map/bonk.rs b/maraiah/map/bonk.rs similarity index 100% rename from source/map/bonk.rs rename to maraiah/map/bonk.rs diff --git a/source/map/damg.rs b/maraiah/map/damg.rs similarity index 99% rename from source/map/damg.rs rename to maraiah/map/damg.rs index 9aee448..56bb18a 100644 --- a/source/map/damg.rs +++ b/maraiah/map/damg.rs @@ -75,7 +75,6 @@ bitflags! { c_enum! { /// A named type of damage taken by something. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum DamageType: u16 { Explosion = 0, diff --git a/source/map/data.rs b/maraiah/map/data.rs similarity index 100% rename from source/map/data.rs rename to maraiah/map/data.rs diff --git a/source/map/entr.rs b/maraiah/map/entr.rs similarity index 100% rename from source/map/entr.rs rename to maraiah/map/entr.rs diff --git a/source/map/epnt.rs b/maraiah/map/epnt.rs similarity index 100% rename from source/map/epnt.rs rename to maraiah/map/epnt.rs diff --git a/source/map/fxpx.rs b/maraiah/map/fxpx.rs similarity index 100% rename from source/map/fxpx.rs rename to maraiah/map/fxpx.rs diff --git a/source/map/head.rs b/maraiah/map/head.rs similarity index 98% rename from source/map/head.rs rename to maraiah/map/head.rs index d23b337..8330531 100644 --- a/source/map/head.rs +++ b/maraiah/map/head.rs @@ -134,7 +134,7 @@ pub struct Map c_enum! { /// The version of a Map file. - #[derive(Debug)] + #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] pub enum Ver: u16 { Base = 0, diff --git a/source/map/iidx.rs b/maraiah/map/iidx.rs similarity index 100% rename from source/map/iidx.rs rename to maraiah/map/iidx.rs diff --git a/source/map/lins.rs b/maraiah/map/lins.rs similarity index 100% rename from source/map/lins.rs rename to maraiah/map/lins.rs diff --git a/source/map/lite.rs b/maraiah/map/lite.rs similarity index 99% rename from source/map/lite.rs rename to maraiah/map/lite.rs index 19c2a15..0570f45 100644 --- a/source/map/lite.rs +++ b/maraiah/map/lite.rs @@ -101,7 +101,6 @@ bitflags! { c_enum! { /// The type of a `Light`. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum LightType: u16 { Normal = 0, diff --git a/source/map/ltfn.rs b/maraiah/map/ltfn.rs similarity index 98% rename from source/map/ltfn.rs rename to maraiah/map/ltfn.rs index 7167180..e8626da 100644 --- a/source/map/ltfn.rs +++ b/maraiah/map/ltfn.rs @@ -45,7 +45,6 @@ pub struct LightFunc c_enum! { /// The type of function for a `LightFunc`. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum LightFuncType: u16 { Constant = 0, diff --git a/source/map/medi.rs b/maraiah/map/medi.rs similarity index 98% rename from source/map/medi.rs rename to maraiah/map/medi.rs index db29de2..eee9503 100644 --- a/source/map/medi.rs +++ b/maraiah/map/medi.rs @@ -53,7 +53,6 @@ pub struct Media c_enum! { /// The liquid type of a `Media`. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum MediaType: u16 { Water = 0, diff --git a/source/map/minf.rs b/maraiah/map/minf.rs similarity index 81% rename from source/map/minf.rs rename to maraiah/map/minf.rs index af6b106..001139a 100644 --- a/source/map/minf.rs +++ b/maraiah/map/minf.rs @@ -11,10 +11,10 @@ pub fn read(b: &[u8]) -> ResultS let texture_id = u16[0]; let physics_id = u16[2]; let skypict_id = u16[4]; - let miss_flags = u16[6] flag MsnFlags; - let envi_flags = u16[8] flag EnvFlags; + let miss_flags = u16[6] flag MissionFlags; + let envi_flags = u16[8] flag EnvironmentFlags; let level_name = mac_roman_cstr[18; 66] no_try; - let entr_flags = u32[84] flag EntFlags; + let entr_flags = u32[84] flag EntryFlags; } } @@ -42,13 +42,13 @@ pub fn read_old(b: &[u8]) -> ResultS let minf = read(b)?; let mut entr_flags = if minf.entr_flags.is_empty() { - EntFlags::SOLO + EntryFlags::SOLO } else { minf.entr_flags }; - if entr_flags.intersects(EntFlags::SOLO | EntFlags::CARNAGE) { - entr_flags.insert(EntFlags::CO_OP) + if entr_flags.intersects(EntryFlags::SOLO | EntryFlags::CARNAGE) { + entr_flags.insert(EntryFlags::CO_OP) } Ok(Info{entr_flags, ..minf}) @@ -61,9 +61,9 @@ impl Default for Info Self{texture_id: 0, physics_id: 1, skypict_id: 0, - miss_flags: MsnFlags::empty(), - envi_flags: EnvFlags::empty(), - entr_flags: EntFlags::SOLO, + miss_flags: MissionFlags::empty(), + envi_flags: EnvironmentFlags::empty(), + entr_flags: EntryFlags::SOLO, level_name: "Map".to_string()} } } @@ -76,16 +76,16 @@ pub struct Info pub texture_id: u16, pub physics_id: u16, pub skypict_id: u16, - pub miss_flags: MsnFlags, - pub envi_flags: EnvFlags, - pub entr_flags: EntFlags, + pub miss_flags: MissionFlags, + pub envi_flags: EnvironmentFlags, + pub entr_flags: EntryFlags, pub level_name: String, } bitflags! { /// Static environment flags. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - pub struct EnvFlags: u16 + pub struct EnvironmentFlags: u16 { const VACUUM = 1; const MAGNETIC = 1 << 1; @@ -104,7 +104,7 @@ bitflags! { bitflags! { /// Static entry point flags. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - pub struct EntFlags: u32 + pub struct EntryFlags: u32 { const SOLO = 1; const CO_OP = 1 << 1; @@ -120,7 +120,7 @@ bitflags! { bitflags! { /// Static mission flags. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - pub struct MsnFlags: u16 + pub struct MissionFlags: u16 { const EXTERMINATION = 1; const EXPLORATION = 1 << 1; diff --git a/source/map/mnpx.rs b/maraiah/map/mnpx.rs similarity index 100% rename from source/map/mnpx.rs rename to maraiah/map/mnpx.rs diff --git a/source/map/name.rs b/maraiah/map/name.rs similarity index 100% rename from source/map/name.rs rename to maraiah/map/name.rs diff --git a/source/map/note.rs b/maraiah/map/note.rs similarity index 100% rename from source/map/note.rs rename to maraiah/map/note.rs diff --git a/source/map/objs.rs b/maraiah/map/objs.rs similarity index 100% rename from source/map/objs.rs rename to maraiah/map/objs.rs diff --git a/source/map/plac.rs b/maraiah/map/plac.rs similarity index 100% rename from source/map/plac.rs rename to maraiah/map/plac.rs diff --git a/source/map/plat.rs b/maraiah/map/plat.rs similarity index 100% rename from source/map/plat.rs rename to maraiah/map/plat.rs diff --git a/source/map/pnts.rs b/maraiah/map/pnts.rs similarity index 100% rename from source/map/pnts.rs rename to maraiah/map/pnts.rs diff --git a/source/map/poly.rs b/maraiah/map/poly.rs similarity index 58% rename from source/map/poly.rs rename to maraiah/map/poly.rs index a311a74..9858038 100644 --- a/source/map/poly.rs +++ b/maraiah/map/poly.rs @@ -42,7 +42,7 @@ pub fn read(b: &[u8]) -> ResultS<(Polygon, usize)> } let poly = read_poly_inter(b)?; - let ptype = PolyType::new(ptype, pdata)?; + let ptype = PolygonType::new(ptype, pdata)?; Ok((Polygon{ptype, ori_flr, ori_cei, med_ind, med_ctl, snd_ind, snd_amb, snd_rnd, ..poly}, 128)) @@ -59,73 +59,73 @@ pub fn read_old(b: &[u8]) -> ResultS<(Polygon, usize)> } let poly = read_poly_inter(b)?; - let ptype = PolyType::new_old(ptype, pdata)?; + let ptype = PolygonType::new_old(ptype, pdata)?; Ok((Polygon{ptype, ..poly}, 128)) } -impl PolyType +impl PolygonType { - /// Creates a `PolyType` from a `n`/`pdata` pair. + /// Creates a `PolygonType` from a `n`/`pdata` pair. pub fn new(n: u16, pdata: u16) -> Result { match n { - 0 => Ok(PolyType::Normal), - 1 => Ok(PolyType::ImpassItem), - 2 => Ok(PolyType::ImpassMons), - 3 => Ok(PolyType::Hill), - 4 => Ok(PolyType::Base), - 5 => Ok(PolyType::Platform(pdata)), - 6 => Ok(PolyType::TrigLightOn(pdata)), - 7 => Ok(PolyType::TrigPlatOn(pdata)), - 8 => Ok(PolyType::TrigLightOff(pdata)), - 9 => Ok(PolyType::TrigPlatOff(pdata)), - 10 => Ok(PolyType::Teleporter(pdata)), - 11 => Ok(PolyType::ZoneBorder), - 12 => Ok(PolyType::Goal), - 13 => Ok(PolyType::TrigMonsVis), - 14 => Ok(PolyType::TrigMonsInv), - 15 => Ok(PolyType::TrigMonsDual), - 16 => Ok(PolyType::TrigItems), - 17 => Ok(PolyType::MustExplore), - 18 => Ok(PolyType::AutoExit), - 19 => Ok(PolyType::OuchMinor), - 20 => Ok(PolyType::OuchMajor), - 21 => Ok(PolyType::Glue), - 22 => Ok(PolyType::GlueTrigger(pdata)), - 23 => Ok(PolyType::GlueSuper), + 0 => Ok(PolygonType::Normal), + 1 => Ok(PolygonType::ImpassItem), + 2 => Ok(PolygonType::ImpassMons), + 3 => Ok(PolygonType::Hill), + 4 => Ok(PolygonType::Base), + 5 => Ok(PolygonType::Platform(pdata)), + 6 => Ok(PolygonType::TrigLightOn(pdata)), + 7 => Ok(PolygonType::TrigPlatOn(pdata)), + 8 => Ok(PolygonType::TrigLightOff(pdata)), + 9 => Ok(PolygonType::TrigPlatOff(pdata)), + 10 => Ok(PolygonType::Teleporter(pdata)), + 11 => Ok(PolygonType::ZoneBorder), + 12 => Ok(PolygonType::Goal), + 13 => Ok(PolygonType::TrigMonsVis), + 14 => Ok(PolygonType::TrigMonsInv), + 15 => Ok(PolygonType::TrigMonsDual), + 16 => Ok(PolygonType::TrigItems), + 17 => Ok(PolygonType::MustExplore), + 18 => Ok(PolygonType::AutoExit), + 19 => Ok(PolygonType::OuchMinor), + 20 => Ok(PolygonType::OuchMajor), + 21 => Ok(PolygonType::Glue), + 22 => Ok(PolygonType::GlueTrigger(pdata)), + 23 => Ok(PolygonType::GlueSuper), n => Err(ReprError::new(n)), } } - /// Creates a `PolyType` from a Marathon 1 compatible `n`/`pdata` pair. + /// Creates a `PolygonType` from a Marathon 1 compatible `n`/`pdata` pair. fn new_old(n: u16, pdata: u16) -> Result { match n { - 0 => Ok(PolyType::Normal), - 1 => Ok(PolyType::ImpassItem), - 2 => Ok(PolyType::ImpassMons), - 3 => Ok(PolyType::OuchMinor), - 4 => Ok(PolyType::OuchMajor), - 5 => Ok(PolyType::Platform(pdata)), - 6 => Ok(PolyType::TrigLightOn(pdata)), - 7 => Ok(PolyType::TrigPlatOn(pdata)), - 8 => Ok(PolyType::TrigLightOff(pdata)), - 9 => Ok(PolyType::TrigPlatOff(pdata)), - 10 => Ok(PolyType::Teleporter(pdata)), - 11 => Ok(PolyType::Glue), - 12 => Ok(PolyType::GlueTrigger(pdata)), - 13 => Ok(PolyType::GlueSuper), - 14 => Ok(PolyType::MustExplore), - 15 => Ok(PolyType::AutoExit), + 0 => Ok(PolygonType::Normal), + 1 => Ok(PolygonType::ImpassItem), + 2 => Ok(PolygonType::ImpassMons), + 3 => Ok(PolygonType::OuchMinor), + 4 => Ok(PolygonType::OuchMajor), + 5 => Ok(PolygonType::Platform(pdata)), + 6 => Ok(PolygonType::TrigLightOn(pdata)), + 7 => Ok(PolygonType::TrigPlatOn(pdata)), + 8 => Ok(PolygonType::TrigLightOff(pdata)), + 9 => Ok(PolygonType::TrigPlatOff(pdata)), + 10 => Ok(PolygonType::Teleporter(pdata)), + 11 => Ok(PolygonType::Glue), + 12 => Ok(PolygonType::GlueTrigger(pdata)), + 13 => Ok(PolygonType::GlueSuper), + 14 => Ok(PolygonType::MustExplore), + 15 => Ok(PolygonType::AutoExit), n => Err(ReprError::new(n)), } } } -impl Default for PolyType +impl Default for PolygonType { - fn default() -> Self {PolyType::Normal} + fn default() -> Self {PolygonType::Normal} } /// A polygon segment. @@ -133,7 +133,7 @@ impl Default for PolyType #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct Polygon { - pub ptype: PolyType, + pub ptype: PolygonType, pub tex_flr: OptU16, pub tex_cei: OptU16, pub hei_flr: Unit, @@ -154,7 +154,7 @@ pub struct Polygon /// The action type of a `Polygon`. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] #[derive(Clone, Copy, Debug, Eq, PartialEq)] -pub enum PolyType +pub enum PolygonType { Normal, ImpassItem, @@ -185,7 +185,7 @@ pub enum PolyType bitflags! { /// Flags for `Polygon`. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - pub struct PolyFlags: u16 + pub struct PolygonFlags: u16 { const DETACHED = 1 << 14; } diff --git a/source/map/prpx.rs b/maraiah/map/prpx.rs similarity index 100% rename from source/map/prpx.rs rename to maraiah/map/prpx.rs diff --git a/source/map/pxpx.rs b/maraiah/map/pxpx.rs similarity index 100% rename from source/map/pxpx.rs rename to maraiah/map/pxpx.rs diff --git a/source/map/sids.rs b/maraiah/map/sids.rs similarity index 99% rename from source/map/sids.rs rename to maraiah/map/sids.rs index fed500f..7d0c3b0 100644 --- a/source/map/sids.rs +++ b/maraiah/map/sids.rs @@ -75,7 +75,6 @@ bitflags! { c_enum! { /// The texture type of a `Side`. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum SideType: u16 { Full = 0, diff --git a/source/map/stex.rs b/maraiah/map/stex.rs similarity index 100% rename from source/map/stex.rs rename to maraiah/map/stex.rs diff --git a/source/map/term.rs b/maraiah/map/term.rs similarity index 100% rename from source/map/term.rs rename to maraiah/map/term.rs diff --git a/source/map/trig.rs b/maraiah/map/trig.rs similarity index 99% rename from source/map/trig.rs rename to maraiah/map/trig.rs index b144a4b..5cf3c3c 100644 --- a/source/map/trig.rs +++ b/maraiah/map/trig.rs @@ -61,7 +61,6 @@ pub struct Trigger c_enum! { /// A bullet shell casing emitted by a weapon. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum CasingType: u16 { Rifle = 0, diff --git a/source/map/trmf.rs b/maraiah/map/trmf.rs similarity index 100% rename from source/map/trmf.rs rename to maraiah/map/trmf.rs diff --git a/source/map/trmg.rs b/maraiah/map/trmg.rs similarity index 100% rename from source/map/trmg.rs rename to maraiah/map/trmg.rs diff --git a/source/map/wppx.rs b/maraiah/map/wppx.rs similarity index 99% rename from source/map/wppx.rs rename to maraiah/map/wppx.rs index 3d98e9b..3dcc1db 100644 --- a/source/map/wppx.rs +++ b/maraiah/map/wppx.rs @@ -99,7 +99,6 @@ bitflags! { c_enum! { /// The type of functionality a weapon provides. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum WeaponType: u16 { Melee = 0, diff --git a/maraiah/meta.rs b/maraiah/meta.rs new file mode 100644 index 0000000..394cd3c --- /dev/null +++ b/maraiah/meta.rs @@ -0,0 +1,50 @@ +//! Meta-information of this crate. + +macro_rules! meta_str { + ($($(#[$outer:meta])* $name:ident = $e:expr;)*) => { + $($(#[$outer])* pub const fn $name() -> &'static str {$e})* + + pub mod ffi + { + $( + doc_comment! { + concat!("FFI variant of [`", + stringify!($name), + "`]\n\n[`", + stringify!($name), + "`]: ../fn.", + stringify!($name), + ".html"), + pub const fn $name() -> crate::ffi::NT {c_str!($e)} + } + )* + } + } +} + +meta_str!( + /// The authors of this crate, `:` separated. + authors = env!("CARGO_PKG_AUTHORS"); + /// The description of this crate. + description = env!("CARGO_PKG_DESCRIPTION"); + /// The home page of this crate. + homepage = env!("CARGO_PKG_HOMEPAGE"); + /// The full license text of this crate. + license_text = include_str!("../LICENSE"); + /// The name of this crate. + name = env!("CARGO_PKG_NAME"); + /// The repository of this crate. + repository = env!("CARGO_PKG_REPOSITORY"); + /// The full version of this crate. + version = env!("CARGO_PKG_VERSION"); + /// The major version of this crate. + version_major = env!("CARGO_PKG_VERSION_MAJOR"); + /// The minor version of this crate. + version_minor = env!("CARGO_PKG_VERSION_MINOR"); + /// The patch version of this crate. + version_patch = env!("CARGO_PKG_VERSION_PATCH"); + /// The pre-release version of this crate. + version_pre = env!("CARGO_PKG_VERSION_PRE"); +); + +// EOF diff --git a/source/shp.rs b/maraiah/shp.rs similarity index 100% rename from source/shp.rs rename to maraiah/shp.rs diff --git a/source/shp/bmap.rs b/maraiah/shp/bmap.rs similarity index 100% rename from source/shp/bmap.rs rename to maraiah/shp/bmap.rs diff --git a/source/shp/clut.rs b/maraiah/shp/clut.rs similarity index 100% rename from source/shp/clut.rs rename to maraiah/shp/clut.rs diff --git a/source/shp/coll.rs b/maraiah/shp/coll.rs similarity index 98% rename from source/shp/coll.rs rename to maraiah/shp/coll.rs index da0d019..268d094 100644 --- a/source/shp/coll.rs +++ b/maraiah/shp/coll.rs @@ -57,7 +57,6 @@ pub struct Collection c_enum! { /// The type of a collection. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum CollectionType: u16 { Unused = 0, diff --git a/source/shp/fram.rs b/maraiah/shp/fram.rs similarity index 100% rename from source/shp/fram.rs rename to maraiah/shp/fram.rs diff --git a/source/shp/sequ.rs b/maraiah/shp/sequ.rs similarity index 99% rename from source/shp/sequ.rs rename to maraiah/shp/sequ.rs index 591f037..cd2a6ed 100644 --- a/source/shp/sequ.rs +++ b/maraiah/shp/sequ.rs @@ -71,7 +71,6 @@ pub struct Sequence c_enum! { /// The type of or number of views for a sequence. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum ViewType: u16 { Anim = 1, diff --git a/source/snd.rs b/maraiah/snd.rs similarity index 100% rename from source/snd.rs rename to maraiah/snd.rs diff --git a/source/snd/defs.rs b/maraiah/snd/defs.rs similarity index 99% rename from source/snd/defs.rs rename to maraiah/snd/defs.rs index fdee1a5..c301028 100644 --- a/source/snd/defs.rs +++ b/maraiah/snd/defs.rs @@ -89,7 +89,6 @@ bitflags! { c_enum! { /// The type of volume this sound has. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum Volume: u16 { Quiet = 0, diff --git a/source/snd/snds.rs b/maraiah/snd/snds.rs similarity index 100% rename from source/snd/snds.rs rename to maraiah/snd/snds.rs diff --git a/source/sound.rs b/maraiah/sound.rs similarity index 100% rename from source/sound.rs rename to maraiah/sound.rs diff --git a/source/sound/wav.rs b/maraiah/sound/wav.rs similarity index 100% rename from source/sound/wav.rs rename to maraiah/sound/wav.rs diff --git a/source/text.rs b/maraiah/text.rs similarity index 100% rename from source/text.rs rename to maraiah/text.rs diff --git a/source/xfer.rs b/maraiah/xfer.rs similarity index 97% rename from source/xfer.rs rename to maraiah/xfer.rs index 3cb1070..4e0f256 100644 --- a/source/xfer.rs +++ b/maraiah/xfer.rs @@ -8,7 +8,6 @@ impl Default for TransferMode c_enum! { /// A rendering style for many things. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] - #[derive(Debug)] pub enum TransferMode: u16 { Normal = 0, diff --git a/source/leela/Cargo.toml b/source/leela/Cargo.toml deleted file mode 100644 index 1d010c2..0000000 --- a/source/leela/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "maraiah-leela" -version = "0.1.0" -authors = ["Alison Watson "] -description = "Maraiah testbed program." -edition = "2018" - -[dependencies] -clap = "2" -maraiah = {path = "../..", features = ["serde_obj"]} -memmap = "0.7" -serde = "1.0" -serde_yaml = "0.8" - -[[bin]] -name = "leela" -path = "main.rs" diff --git a/source/meta.rs b/source/meta.rs deleted file mode 100644 index c0cabfd..0000000 --- a/source/meta.rs +++ /dev/null @@ -1,51 +0,0 @@ -//! Meta-information of this crate. - -macro_rules! meta_str { - ($($(#[$outer:meta])* $name:ident = $cname:ident = $e:expr;)*) => { - $( - $(#[$outer])* pub const $name: &'static str = $e; - )* - pub mod ffi - { - $( - doc_comment! { - concat!("FFI variant of [`", - stringify!($name), - "`]\n\n[`", - stringify!($name), - "`]: ../constant.", - stringify!($name), - ".html"), - pub const $cname: crate::ffi::NT = c_str!($e); - } - )* - } - } -} - -meta_str!( - /// The authors of this crate, `:` separated. - AUTHORS = AUTHORS_C = env!("CARGO_PKG_AUTHORS"); - /// The description of this crate. - DESCRIPTION = DESCRIPTION_C = env!("CARGO_PKG_DESCRIPTION"); - /// The home page of this crate. - HOMEPAGE = HOMEPAGE_C = env!("CARGO_PKG_HOMEPAGE"); - /// The full license text of this crate. - LICENSE_TEXT = LICENSE_TEXT_C = include_str!("../LICENSE"); - /// The name of this crate. - NAME = NAME_C = env!("CARGO_PKG_NAME"); - /// The repository of this crate. - REPOSITORY = REPOSITORY_C = env!("CARGO_PKG_REPOSITORY"); - /// The full version of this crate. - VERSION = VERSION_C = env!("CARGO_PKG_VERSION"); - /// The major version of this crate. - VERSION_MAJOR = VERSION_MAJOR_C = env!("CARGO_PKG_VERSION_MAJOR"); - /// The minor version of this crate. - VERSION_MINOR = VERSION_MINOR_C = env!("CARGO_PKG_VERSION_MINOR"); - /// The patch version of this crate. - VERSION_PATCH = VERSION_PATCH_C = env!("CARGO_PKG_VERSION_PATCH"); - /// The pre-release version of this crate. - VERSION_PRE = VERSION_PRE_C = env!("CARGO_PKG_VERSION_PRE"); -); - -// EOF diff --git a/tests/data/m2/Map b/tests/data/m2/Map new file mode 100644 index 0000000..c2be89e Binary files /dev/null and b/tests/data/m2/Map differ diff --git a/tests/data/defl/Shapes.out b/tests/data/m2/Shapes similarity index 100% rename from tests/data/defl/Shapes.out rename to tests/data/m2/Shapes diff --git a/tests/data/map/minf.out b/tests/data/map/minf.out index 1e67f78..7f4d925 100644 --- a/tests/data/map/minf.out +++ b/tests/data/map/minf.out @@ -2,8 +2,8 @@ map::minf::Info{ texture_id: 0, physics_id: 1, skypict_id: 1, - miss_flags: map::minf::MsnFlags::REPAIR, - envi_flags: map::minf::EnvFlags::empty(), - entr_flags: map::minf::EntFlags::SOLO | map::minf::EntFlags::CO_OP, + miss_flags: map::minf::MissionFlags::REPAIR, + envi_flags: map::minf::EnvironmentFlags::empty(), + entr_flags: map::minf::EntryFlags::SOLO | map::minf::EntryFlags::CO_OP, level_name: "Waterloo Waterpark".to_owned() } diff --git a/tests/data/map/testmap.in b/tests/data/map/testmap.in new file mode 100644 index 0000000..2288cf1 Binary files /dev/null and b/tests/data/map/testmap.in differ diff --git a/tests/data/map/testmap.out b/tests/data/map/testmap.out new file mode 100644 index 0000000..1245b99 --- /dev/null +++ b/tests/data/map/testmap.out @@ -0,0 +1,2185 @@ +EntryData { + epnt: None, + fxpx: None, + lins: Some( + vec![ + Line { + flags: LineFlags::SOLID, + pnt_beg: 0, + pnt_end: 1, + side_fr: OptU16::none(), + side_bk: OptU16::none(), + poly_fr: OptU16::none(), + poly_bk: OptU16::from(0), + }, + Line { + flags: LineFlags::SOLID, + pnt_beg: 1, + pnt_end: 2, + side_fr: OptU16::none(), + side_bk: OptU16::none(), + poly_fr: OptU16::none(), + poly_bk: OptU16::from(0), + }, + Line { + flags: LineFlags::SOLID, + pnt_beg: 2, + pnt_end: 3, + side_fr: OptU16::none(), + side_bk: OptU16::none(), + poly_fr: OptU16::none(), + poly_bk: OptU16::from(0), + }, + Line { + flags: LineFlags::SOLID, + pnt_beg: 3, + pnt_end: 0, + side_fr: OptU16::none(), + side_bk: OptU16::none(), + poly_fr: OptU16::none(), + poly_bk: OptU16::from(0), + }, + ], + ), + lite: Some( + vec![ + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(62258), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(62258), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(62258), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(58981), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(58981), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(58981), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(55704), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(55704), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(55704), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(52428), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(52428), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(52428), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(49151), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(49151), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(49151), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(45874), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(45874), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(45874), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(42597), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(42597), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(42597), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(39321), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(39321), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(39321), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(36044), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(36044), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(36044), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(32767), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(32767), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(32767), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(29490), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(29490), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(29490), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(26214), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(26214), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(26214), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(22937), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(22937), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(22937), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(19660), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(19660), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(19660), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(16383), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(16383), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(16383), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(13107), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(13107), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(13107), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(9830), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(9830), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(9830), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(6553), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(6553), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(6553), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(3276), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(3276), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(3276), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + Light { + ltype: LightType::Normal, + flags: LightFlags::INIT_ACTIVE | LightFlags::SLAVE_VALUE, + phase: 0, + act_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(0), + val_dta: Fixed::from_bits(0), + }, + act_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(0), + val_dta: Fixed::from_bits(0), + }, + act_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(0), + val_dta: Fixed::from_bits(0), + }, + ina_pri: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_sec: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + ina_mid: LightFunc { + ftype: LightFuncType::Constant, + prd_nrm: 30, + prd_dta: 0, + val_nrm: Fixed::from_bits(65535), + val_dta: Fixed::from_bits(0), + }, + tag: 0, + }, + ], + ), + mnpx: None, + minf: Some( + Info { + texture_id: 0, + physics_id: 0, + skypict_id: 0, + miss_flags: MissionFlags::empty(), + envi_flags: EnvironmentFlags::empty(), + entr_flags: EntryFlags::SOLO, + level_name: "Untitled Level".to_string(), + }, + ), + name: None, + note: Some( + vec![], + ), + objs: Some( + vec![ + Object { + group: 3, + index: 0, + angle: Angle::from_bits(0), + poly: 0, + pos_x: Unit::from_bits(47630), + pos_y: Unit::from_bits(45794), + pos_z: Unit::from_bits(0), + flags: ObjectFlags::empty(), + bias: 0, + }, + ], + ), + pict: None, + pnts: Some( + vec![ + Point { + x: Unit::from_bits(40960), + y: Unit::from_bits(39936), + }, + Point { + x: Unit::from_bits(40960), + y: Unit::from_bits(52224), + }, + Point { + x: Unit::from_bits(54272), + y: Unit::from_bits(52224), + }, + Point { + x: Unit::from_bits(54272), + y: Unit::from_bits(39936), + }, + ], + ), + poly: Some( + vec![ + Polygon { + ptype: PolygonType::Normal, + tex_flr: OptU16::none(), + tex_cei: OptU16::none(), + hei_flr: Unit::from_bits(0), + hei_cei: Unit::from_bits(1024), + lit_flr: 0, + lit_cei: 0, + xfr_flr: TransferMode::Normal, + xfr_cei: TransferMode::Normal, + ori_flr: Point { + x: Unit::from_bits(0), + y: Unit::from_bits(0), + }, + ori_cei: Point { + x: Unit::from_bits(0), + y: Unit::from_bits(0), + }, + med_ind: OptU16::none(), + med_ctl: 0, + snd_ind: 65535, + snd_amb: OptU16::none(), + snd_rnd: OptU16::none(), + }, + ], + ), + prpx: None, + pxpx: None, + sids: Some( + vec![], + ), + wppx: None, + ambi: Some( + vec![], + ), + bonk: Some( + vec![], + ), + iidx: None, + medi: Some( + vec![], + ), + plac: Some( + vec![ + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ObjectFreq { + flags: ObjectFreqFlags::empty(), + cnt_ini: 0, + cnt_min: 0, + cnt_max: 0, + cnt_rnd: 0, + chance: 0, + }, + ], + ), + plat: Some( + vec![], + ), + term: None, + unkn: vec![], +}, diff --git a/tests/defl.rs b/tests/defl.rs index 007b491..b6833c0 100644 --- a/tests/defl.rs +++ b/tests/defl.rs @@ -36,7 +36,7 @@ fn defl_alice_2() fn defl_shapes() { const INPUT: &[u8] = include_bytes!("data/defl/Shapes.in"); - const OUTPUT: &[u8] = include_bytes!("data/defl/Shapes.out"); + const OUTPUT: &[u8] = include_bytes!("data/m2/Shapes"); defl_gzip(INPUT, OUTPUT); } diff --git a/tests/map.rs b/tests/map.rs index b9ee488..dd1cc71 100644 --- a/tests/map.rs +++ b/tests/map.rs @@ -51,25 +51,65 @@ fn read_term_must_process() } } +#[test] +fn map_m2() +{ + let inp = include_bytes!("data/m2/Map"); + let mut rd = std::io::BufReader::new(&inp[..]); + + let mp = map::head::read(&mut rd).unwrap(); + let en = map::entr::read_all(&mp).unwrap(); + + assert!(map::data::read_all(mp.head(), &en).is_ok()); +} + +#[test] +#[ignore] +fn map_full_check() +{ + use maraiah::{bin::OptU16, + map::{data::*, lins::*, lite::*, ltfn::*, minf::*, objs::*, + plac::*, pnts::*, poly::*}, + xfer::TransferMode}; + use std::collections::BTreeMap; + + let inp = include_bytes!("data/map/testmap.in"); + let mut rd = std::io::BufReader::new(&inp[..]); + + let mp = map::head::read(&mut rd).unwrap(); + let en = map::entr::read_all(&mp).unwrap(); + let ed = map::data::read_all(mp.head(), &en).unwrap(); + + let mut out = BTreeMap::new(); + + out.insert(0, include!("data/map/testmap.out")); + + assert_eq!(out, ed); +} + #[test] fn map_must_not_process() { for inp in &RANDOM { - map::minf::read(inp).err().unwrap(); - map::minf::read_old(inp).err().unwrap(); + bin::rd_array(inp, map::fxpx::read).err().unwrap(); bin::rd_array(inp, map::lins::read).err().unwrap(); bin::rd_array(inp, map::lite::read).err().unwrap(); + bin::rd_array(inp, map::lite::read_old).err().unwrap(); bin::rd_array(inp, map::medi::read).err().unwrap(); + bin::rd_array(inp, map::mnpx::read).err().unwrap(); bin::rd_array(inp, map::note::read).err().unwrap(); bin::rd_array(inp, map::objs::read).err().unwrap(); bin::rd_array(inp, map::plat::read).err().unwrap(); bin::rd_array(inp, map::poly::read).err().unwrap(); + bin::rd_array(inp, map::poly::read_old).err().unwrap(); + bin::rd_array(inp, map::prpx::read).err().unwrap(); bin::rd_array(inp, map::sids::read).err().unwrap(); + bin::rd_array(inp, map::sids::read_old).err().unwrap(); bin::rd_array(inp, map::term::read).err().unwrap(); bin::rd_array(inp, map::trmg::read).err().unwrap(); - bin::rd_array(inp, map::lite::read_old).err().unwrap(); - bin::rd_array(inp, map::poly::read_old).err().unwrap(); - bin::rd_array(inp, map::sids::read_old).err().unwrap(); + bin::rd_array(inp, map::wppx::read).err().unwrap(); + map::minf::read(inp).err().unwrap(); + map::minf::read_old(inp).err().unwrap(); } } @@ -82,27 +122,9 @@ fn map_must_not_panic() drop(bin::rd_array(inp, map::epnt::read)); drop(bin::rd_array(inp, map::iidx::read)); drop(bin::rd_array(inp, map::plac::read)); + drop(bin::rd_array(inp, map::pxpx::read)); drop(bin::rd_array(inp, map::trmf::read)); } } -#[test] -fn phy_must_not_process() -{ - for inp in &RANDOM { - bin::rd_array(inp, map::fxpx::read).err().unwrap(); - bin::rd_array(inp, map::mnpx::read).err().unwrap(); - bin::rd_array(inp, map::prpx::read).err().unwrap(); - bin::rd_array(inp, map::wppx::read).err().unwrap(); - } -} - -#[test] -fn phy_must_not_panic() -{ - for inp in &RANDOM { - drop(bin::rd_array(inp, map::pxpx::read)); - } -} - // EOF diff --git a/tests/pict.rs b/tests/pict.rs index 335d32d..cd71366 100644 --- a/tests/pict.rs +++ b/tests/pict.rs @@ -1,4 +1,4 @@ -use maraiah::{image::{Color8, pict}}; +use maraiah::image::{pict, Color8}; include!("data/rand.rs"); diff --git a/source/tycho/CMakeLists.txt b/tycho/CMakeLists.txt similarity index 100% rename from source/tycho/CMakeLists.txt rename to tycho/CMakeLists.txt diff --git a/source/tycho/Cargo.toml b/tycho/Cargo.toml similarity index 73% rename from source/tycho/Cargo.toml rename to tycho/Cargo.toml index ef63210..7714924 100644 --- a/source/tycho/Cargo.toml +++ b/tycho/Cargo.toml @@ -5,12 +5,11 @@ edition = "2018" build = "build.rs" [dependencies] -maraiah = {path = "../.."} -memmap = "0.7" +maraiah = {path = ".."} [build-dependencies] cmake = "0.1" -maraiah = {path = "../.."} +maraiah = {path = ".."} rust_qt_binding_generator = "0.3" [[bin]] diff --git a/source/tycho/bindings.json b/tycho/bindings.json similarity index 100% rename from source/tycho/bindings.json rename to tycho/bindings.json diff --git a/source/tycho/build.rs b/tycho/build.rs similarity index 100% rename from source/tycho/build.rs rename to tycho/build.rs diff --git a/source/tycho/cc_headers/mapprops.h b/tycho/cc_headers/mapprops.h similarity index 100% rename from source/tycho/cc_headers/mapprops.h rename to tycho/cc_headers/mapprops.h diff --git a/source/tycho/cc_headers/menu.h b/tycho/cc_headers/menu.h similarity index 100% rename from source/tycho/cc_headers/menu.h rename to tycho/cc_headers/menu.h diff --git a/source/tycho/cc_headers/project.h b/tycho/cc_headers/project.h similarity index 100% rename from source/tycho/cc_headers/project.h rename to tycho/cc_headers/project.h diff --git a/source/tycho/cc_headers/tycho.h b/tycho/cc_headers/tycho.h similarity index 100% rename from source/tycho/cc_headers/tycho.h rename to tycho/cc_headers/tycho.h diff --git a/source/tycho/cc_source/main.cc b/tycho/cc_source/main.cc similarity index 100% rename from source/tycho/cc_source/main.cc rename to tycho/cc_source/main.cc diff --git a/source/tycho/cc_source/mapprops.cc b/tycho/cc_source/mapprops.cc similarity index 100% rename from source/tycho/cc_source/mapprops.cc rename to tycho/cc_source/mapprops.cc diff --git a/source/tycho/cc_source/menu.cc b/tycho/cc_source/menu.cc similarity index 100% rename from source/tycho/cc_source/menu.cc rename to tycho/cc_source/menu.cc diff --git a/source/tycho/cc_source/project.cc b/tycho/cc_source/project.cc similarity index 100% rename from source/tycho/cc_source/project.cc rename to tycho/cc_source/project.cc diff --git a/source/tycho/resources/color/lines.png b/tycho/resources/color/lines.png similarity index 100% rename from source/tycho/resources/color/lines.png rename to tycho/resources/color/lines.png diff --git a/source/tycho/resources/color/map.png b/tycho/resources/color/map.png similarity index 100% rename from source/tycho/resources/color/map.png rename to tycho/resources/color/map.png diff --git a/source/tycho/resources/color/pfhor-hand.png b/tycho/resources/color/pfhor-hand.png similarity index 100% rename from source/tycho/resources/color/pfhor-hand.png rename to tycho/resources/color/pfhor-hand.png diff --git a/source/tycho/resources/color/points.png b/tycho/resources/color/points.png similarity index 100% rename from source/tycho/resources/color/points.png rename to tycho/resources/color/points.png diff --git a/source/tycho/resources/color/polygons.png b/tycho/resources/color/polygons.png similarity index 100% rename from source/tycho/resources/color/polygons.png rename to tycho/resources/color/polygons.png diff --git a/source/tycho/resources/hc/lines.png b/tycho/resources/hc/lines.png similarity index 100% rename from source/tycho/resources/hc/lines.png rename to tycho/resources/hc/lines.png diff --git a/source/tycho/resources/hc/map.png b/tycho/resources/hc/map.png similarity index 100% rename from source/tycho/resources/hc/map.png rename to tycho/resources/hc/map.png diff --git a/source/tycho/resources/hc/points.png b/tycho/resources/hc/points.png similarity index 100% rename from source/tycho/resources/hc/points.png rename to tycho/resources/hc/points.png diff --git a/source/tycho/resources/hc/polygons.png b/tycho/resources/hc/polygons.png similarity index 100% rename from source/tycho/resources/hc/polygons.png rename to tycho/resources/hc/polygons.png diff --git a/source/tycho/resources/misc/tycho1.png b/tycho/resources/misc/tycho1.png similarity index 100% rename from source/tycho/resources/misc/tycho1.png rename to tycho/resources/misc/tycho1.png diff --git a/source/tycho/resources/misc/tycho2.png b/tycho/resources/misc/tycho2.png similarity index 100% rename from source/tycho/resources/misc/tycho2.png rename to tycho/resources/misc/tycho2.png diff --git a/source/tycho/resources/resources.qrc b/tycho/resources/resources.qrc similarity index 100% rename from source/tycho/resources/resources.qrc rename to tycho/resources/resources.qrc diff --git a/source/tycho/resources/sources/icons.psd b/tycho/resources/sources/icons.psd similarity index 100% rename from source/tycho/resources/sources/icons.psd rename to tycho/resources/sources/icons.psd diff --git a/source/tycho/resources/sources/pfhor-hand.xcf b/tycho/resources/sources/pfhor-hand.xcf similarity index 100% rename from source/tycho/resources/sources/pfhor-hand.xcf rename to tycho/resources/sources/pfhor-hand.xcf diff --git a/source/tycho/resources/sources/tycho1.psd b/tycho/resources/sources/tycho1.psd similarity index 100% rename from source/tycho/resources/sources/tycho1.psd rename to tycho/resources/sources/tycho1.psd diff --git a/source/tycho/resources/sources/tycho2.psd b/tycho/resources/sources/tycho2.psd similarity index 100% rename from source/tycho/resources/sources/tycho2.psd rename to tycho/resources/sources/tycho2.psd diff --git a/source/tycho/source/gui.rs b/tycho/source/gui.rs similarity index 100% rename from source/tycho/source/gui.rs rename to tycho/source/gui.rs diff --git a/source/tycho/source/gui/ffi.rs b/tycho/source/gui/ffi.rs similarity index 100% rename from source/tycho/source/gui/ffi.rs rename to tycho/source/gui/ffi.rs diff --git a/source/tycho/source/gui/map.rs b/tycho/source/gui/map.rs similarity index 68% rename from source/tycho/source/gui/map.rs rename to tycho/source/gui/map.rs index 4101746..cb18c0c 100644 --- a/source/tycho/source/gui/map.rs +++ b/tycho/source/gui/map.rs @@ -1,61 +1,46 @@ //! Map model. use super::ffi::*; -//use memmap::Mmap; use maraiah::map; +use memmap::Mmap; -pub struct MapModel +fn open_f(path: String) -> ResultS { - emit: MapModelEmitter, - model: MapModelTree, -} + let fp = std::fs::File::open(path)?; + let mm = unsafe { Mmap::map(&fp) }?; -impl Drop for MapModel -{ - fn drop(&mut self) - { - if cfg!(debug_assertions) { - eprintln!("drop MapModel"); - } - } + map::read(&mm) } impl MapModelTrait for MapModel { /// Returns a new `MapModel` instance. - fn new(emit: MapModelEmitter, model: MapModelTree) -> MapModel + fn new(emit: MapModelEmitter, model: MapModelTree) -> Self { if cfg!(debug_assertions) { eprintln!("new MapModel"); } - MapModel{emit, model} + Self { emit, + model, + map: map::Map::default() } } /// Returns the emitter of `self`. - fn emit(&mut self) -> &mut MapModelEmitter - { - &mut self.emit - } + fn emit(&mut self) -> &mut MapModelEmitter { &mut self.emit } /// Checks if `row` exists in the leaf `index`. - fn check_row(&self, index: usize, _row: usize) -> Option - { - None - } + fn check_row(&self, index: usize, _row: usize) -> Option { None } /// Returns the row `index` is in. - fn row(&self, index: usize) -> usize - { - index - } + fn row(&self, index: usize) -> usize { index } /// Returns the number of rows in `index`. fn row_count(&self, index: Option) -> usize { match index { Some(_) => 0, - None => 7, + None => 7, } } @@ -64,7 +49,7 @@ impl MapModelTrait for MapModel { match index { Some(_) => unreachable!(), - None => row, + None => row, } } @@ -75,15 +60,9 @@ impl MapModelTrait for MapModel None } - fn row_name(&self, row: usize) -> u64 - { - row as u64 + 1 - } + fn row_name(&self, row: usize) -> u64 { row as u64 + 1 } - fn some_number(&self, row: usize) -> u64 - { - 69420 - } + fn some_number(&self, row: usize) -> u64 { 69420 } /// Opens the map file at `path`. fn open(&mut self, path: String) -> bool @@ -92,20 +71,12 @@ impl MapModelTrait for MapModel eprintln!("opening project: {}", &path); } - /* - let fp = std::fs::File::open(path); - let fp = if let Ok(fp) = fp {fp} else {return false;}; - - let mm = unsafe {Mmap::map(&fp)}; - let mm = if let Ok(mm) = mm {mm} else {return false;}; - - if let Ok(wad) = map::read(&mm) { - self.wad.replace(Some(wad)); - return true; + if let Ok(map) = open_f(&mm) { + self.map = map; + true + } else { + false } - */ - - false } /// Saves the project into the original file. @@ -129,10 +100,24 @@ impl MapModelTrait for MapModel } /// Returns `true` if the file has been modified from its original state. - fn is_dirty(&self) -> bool + fn is_dirty(&self) -> bool { false } +} + +impl Drop for MapModel +{ + fn drop(&mut self) { - false + if cfg!(debug_assertions) { + eprintln!("drop MapModel"); + } } } +pub struct MapModel +{ + emit: MapModelEmitter, + model: MapModelTree, + map: map::Map, +} + // EOF diff --git a/source/tycho/source/main.rs b/tycho/source/main.rs similarity index 100% rename from source/tycho/source/main.rs rename to tycho/source/main.rs diff --git a/source/tycho/source/meta.rs b/tycho/source/meta.rs similarity index 100% rename from source/tycho/source/meta.rs rename to tycho/source/meta.rs diff --git a/source/tycho/ui/about.ui b/tycho/ui/about.ui similarity index 100% rename from source/tycho/ui/about.ui rename to tycho/ui/about.ui diff --git a/source/tycho/ui/license.ui b/tycho/ui/license.ui similarity index 100% rename from source/tycho/ui/license.ui rename to tycho/ui/license.ui diff --git a/source/tycho/ui/mapprops.ui b/tycho/ui/mapprops.ui similarity index 100% rename from source/tycho/ui/mapprops.ui rename to tycho/ui/mapprops.ui diff --git a/source/tycho/ui/mapview.ui b/tycho/ui/mapview.ui similarity index 100% rename from source/tycho/ui/mapview.ui rename to tycho/ui/mapview.ui diff --git a/source/tycho/ui/menu.ui b/tycho/ui/menu.ui similarity index 100% rename from source/tycho/ui/menu.ui rename to tycho/ui/menu.ui diff --git a/source/tycho/ui/points.ui b/tycho/ui/points.ui similarity index 100% rename from source/tycho/ui/points.ui rename to tycho/ui/points.ui diff --git a/source/tycho/ui/project.ui b/tycho/ui/project.ui similarity index 100% rename from source/tycho/ui/project.ui rename to tycho/ui/project.ui