From 49253773a63f075c997ca57982a93ea3751f6389 Mon Sep 17 00:00:00 2001 From: Marrub Date: Fri, 1 Mar 2019 06:22:27 -0500 Subject: [PATCH] add NOTE loader --- MarathonData.md | 16 ++++++++- src/durandal/bin.rs | 5 ++- src/durandal/fixed.rs | 3 +- src/durandal/image.rs | 9 +++-- src/leela/main.rs | 41 +++------------------- src/marathon/map.rs | 79 +++++++++++++++++++++++++++---------------- src/marathon/phy.rs | 35 ++++++++++--------- src/marathon/shp.rs | 13 ++++--- src/marathon/snd.rs | 7 ++-- src/marathon/trm.rs | 11 +++--- src/marathon/wad.rs | 13 +++---- src/marathon/xfer.rs | 3 +- 12 files changed, 115 insertions(+), 120 deletions(-) diff --git a/MarathonData.md b/MarathonData.md index aad825c..4bd1fc7 100644 --- a/MarathonData.md +++ b/MarathonData.md @@ -378,7 +378,7 @@ Map tags: | `SIDS` | Array of Side | | `POLY` | Array of Polygon | | `LITE` | Array of Light | -| `NOTE` | Not analyzed (annotations) | +| `NOTE` | Array of Annotation | | `OBJS` | Array of Object | | `påth` | Not analyzed (guardpaths) (å is $8C) | | `plac` | Array of Object Frequency | @@ -782,6 +782,20 @@ Light is 100 bytes. - `ActivPri`, `ActivSec` and `ActivMid` are Light Function structures. - `InactPri`, `InactSec` and `InactMid` are Light Function structures. +### Map Annotation ### + +Map Annotation is 72 bytes. + +| Name | Type | Offset | +| ---- | ---- | ------ | +| `Type` | `u16` | `0` | +| `Location` | `struct` | `2` | +| `Polygon` | `u16` | `6` | +| `Text` | `u8[64]` | `8` | + +- `Type` is an index into the annotation type definition, but there's only one, +so this will always be `0` anyway. + ### Object ### Object is 16 bytes. diff --git a/src/durandal/bin.rs b/src/durandal/bin.rs index cccb55f..c8517cf 100644 --- a/src/durandal/bin.rs +++ b/src/durandal/bin.rs @@ -1,7 +1,6 @@ //! Binary data conversion utilities. use crate::durandal::err::*; -use serde::Serialize; use std::{fmt, num::NonZeroU16}; #[doc(hidden)] @@ -267,7 +266,7 @@ impl fmt::Debug for OptU16 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self.get() { - None => write!(f, "None"), + None => write!(f, "None"), Some(n) => write!(f, "Some({})", n), } } @@ -278,7 +277,7 @@ pub type Ident = [u8; 4]; /// An object identified by a `u16` which may be `u16::max_value()` to /// represent a nulled value. -#[derive(Serialize)] +#[derive(serde::Serialize, serde::Deserialize)] pub struct OptU16(Option); // EOF diff --git a/src/durandal/fixed.rs b/src/durandal/fixed.rs index cf2de80..c616c7f 100644 --- a/src/durandal/fixed.rs +++ b/src/durandal/fixed.rs @@ -1,6 +1,5 @@ //! Fixed point numbers. -use serde::Serialize; use std::{fmt::{self, Write}, ops}; @@ -10,7 +9,7 @@ macro_rules! define_fixed_type { struct $Type:ident ($IT:ident) : $UT:ident, $LT:ident, $FracBits:expr; ) => { $(#[$outer])* - #[derive(Clone, PartialEq, Serialize)] + #[derive(Clone, PartialEq, serde::Serialize)] pub struct $Type($IT); impl $Type diff --git a/src/durandal/image.rs b/src/durandal/image.rs index 960bef3..22b7845 100644 --- a/src/durandal/image.rs +++ b/src/durandal/image.rs @@ -1,7 +1,6 @@ //! Image and color representations. use crate::durandal::err::*; -use serde::Serialize; use std::io; /// Creates a RGB8 color from a R5G5B5 format color. @@ -187,15 +186,15 @@ impl Color for Color8 } /// An RGB16 color. -#[derive(Clone, Debug, PartialEq, Serialize)] +#[derive(Clone, Debug, PartialEq, serde::Serialize)] pub struct Color16(u16, u16, u16); /// An RGB8 color. -#[derive(Clone, Debug, PartialEq, Serialize)] +#[derive(Clone, Debug, PartialEq, serde::Serialize)] pub struct Color8(u8, u8, u8); /// An RGB16 image. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Image16 { w: usize, @@ -204,7 +203,7 @@ pub struct Image16 } /// An RGB8 image. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Image8 { w: usize, diff --git a/src/leela/main.rs b/src/leela/main.rs index cdfd42f..b6297f0 100644 --- a/src/leela/main.rs +++ b/src/leela/main.rs @@ -1,7 +1,6 @@ -use maraiah::{durandal::{err::*, file::*, image::*, sound::*, text::*}, +use maraiah::{durandal::{err::*, file::*, image::*, sound::*}, marathon::{machdr, shp, snd, wad}}; -use std::{fs, - io::{self, Write}}; +use std::{fs, io}; fn make_tga(_opt: &Options, fname: &str, im: &impl Image) -> ResultS<()> { @@ -9,13 +8,6 @@ fn make_tga(_opt: &Options, fname: &str, im: &impl Image) -> ResultS<()> write_tga(&mut out, im) } -fn make_data(_opt: &Options, fname: &str, data: &[u8]) -> ResultS<()> -{ - let mut out = io::BufWriter::new(fs::File::create(fname)?); - out.write_all(data)?; - Ok(()) -} - fn make_yaml(opt: &Options, data: &T) -> ResultS<()> where T: serde::Serialize + std::fmt::Debug { @@ -34,29 +26,6 @@ fn make_wav(fname: &str, snd: &impl Sound) -> ResultS<()> write_wav(&mut out, snd) } -fn dump_chunk(opt: &Options, cnk: &wad::Chunk, eid: u16) -> ResultS<()> -{ - if opt.wad_wrt_all { - match cnk { - wad::Chunk::Pict(im) => { - let fname = format!("{}/pict_{}.tga", opt.out_dir, eid); - make_tga(opt, &fname, im)?; - } - wad::Chunk::Data{iden, data} => { - if opt.wad_unknown { - let iden = mac_roman_conv(iden); - let fname = format!("{}/{:04}{}.bin", opt.out_dir, eid, iden); - make_data(opt, &fname, data)?; - } - make_yaml(opt, cnk)?; - } - _ => make_yaml(opt, cnk)?, - } - } - - Ok(()) -} - fn process_wad(opt: &Options, b: &[u8]) -> ResultS<()> { let wad = wad::read_wad(b)?; @@ -65,10 +34,8 @@ fn process_wad(opt: &Options, b: &[u8]) -> ResultS<()> make_yaml(opt, &wad.head)?; } - for (eid, ent) in wad.entries { - for cnk in ent.chunks { - dump_chunk(opt, &cnk, eid)?; - } + if opt.wad_wrt_all { + make_yaml(opt, &wad.entries)?; } Ok(()) diff --git a/src/marathon/map.rs b/src/marathon/map.rs index 3fe6e96..fba0e7d 100644 --- a/src/marathon/map.rs +++ b/src/marathon/map.rs @@ -3,7 +3,6 @@ use crate::{durandal::{bin::*, err::*, fixed::*, text::mac_roman_conv}, marathon::xfer::TransferMode}; use bitflags::bitflags; -use serde::Serialize; /// Reads a `Minf` chunk. pub fn read_minf(b: &[u8]) -> ResultS @@ -311,8 +310,21 @@ pub fn read_plat(b: &[u8]) -> ResultS<(Platform, usize)> Ok((Platform{ptype, speed, delay, hei_min, hei_max, flags, index, tag}, 32)) } +/// Reads a `NOTE` chunk. +pub fn read_note(b: &[u8]) -> ResultS<(Note, usize)> +{ + read_data! { + 72, BE in b => + pos = read_point[2..6]; + poly = u16[6]; + text = mac_roman_conv[8..72] nt; + } + + Ok((Note{pos, poly, text}, 72)) +} + /// A point in world-space. -#[derive(Clone, PartialEq, Serialize)] +#[derive(Clone, PartialEq, serde::Serialize)] pub struct Point { pub x: Unit, @@ -320,7 +332,7 @@ pub struct Point } /// A line segment. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Line { pub flags: LineFlags, @@ -333,7 +345,7 @@ pub struct Line } /// The texture of a side segment. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct SideTex { pub offs: Point, @@ -341,7 +353,7 @@ pub struct SideTex } /// One side of a line segment. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Side { pub stype: SideType, @@ -358,7 +370,7 @@ pub struct Side } /// A polygon segment. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Polygon { pub ptype: PolyType, @@ -381,7 +393,7 @@ pub struct Polygon } /// A light function. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct LightFunc { pub ftype: LightFuncType, @@ -392,7 +404,7 @@ pub struct LightFunc } /// A dynamic polygon light. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Light { pub ltype: LightType, @@ -408,7 +420,7 @@ pub struct Light } /// An object in the world. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Object { pub group: u16, @@ -423,7 +435,7 @@ pub struct Object } /// The difficulty definition for various object types. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct ObjectFreq { pub rnd_loc: bool, @@ -435,7 +447,7 @@ pub struct ObjectFreq } /// An ambient sound definition. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct SoundAmbi { pub index: u16, @@ -443,7 +455,7 @@ pub struct SoundAmbi } /// A randomly played sound definition. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct SoundRand { pub no_dir: bool, @@ -459,7 +471,7 @@ pub struct SoundRand } /// A media, as in a part of a polygon which goes up the middle of the wall. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Media { pub mtype: MediaType, @@ -477,7 +489,7 @@ pub struct Media } /// Extra information for polygons with platforms. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Platform { pub ptype: u16, @@ -490,8 +502,17 @@ pub struct Platform pub tag: u16, } +/// Overhead map annotations. +#[derive(Debug, serde::Serialize)] +pub struct Note +{ + pub pos: Point, + pub poly: u16, + pub text: String, +} + /// Static map information. -#[derive(Debug, PartialEq, Serialize)] +#[derive(Debug, PartialEq, serde::Serialize)] pub struct Minf { pub env_code: u16, @@ -505,7 +526,7 @@ pub struct Minf bitflags! { /// Flags for `Line`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct LineFlags: u16 { const TransSide = 1 << 9; @@ -519,7 +540,7 @@ bitflags! { bitflags! { /// Flags for `Side`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct SideFlags: u16 { const Status = 1; @@ -535,7 +556,7 @@ bitflags! { bitflags! { /// Static environment flags. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct EnvFlags: u16 { const Vacuum = 1; @@ -556,7 +577,7 @@ bitflags! { bitflags! { /// Static entry point flags. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct EntFlags: u32 { const Solo = 1; @@ -572,7 +593,7 @@ bitflags! { bitflags! { /// Static mission flags. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct MsnFlags: u16 { const Extermination = 1; @@ -585,7 +606,7 @@ bitflags! { bitflags! { /// Flags for `Polygon`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct PolyFlags: u16 { const Detached = 1 << 14; @@ -594,7 +615,7 @@ bitflags! { bitflags! { /// Flags for `Light`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct LightFlags: u16 { const InitActive = 1; @@ -605,7 +626,7 @@ bitflags! { bitflags! { /// Flags for `Object`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct ObjectFlags: u16 { const Invisible = 1; @@ -619,7 +640,7 @@ bitflags! { bitflags! { /// Flags for `Platform`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct PlatformFlags: u32 { const InitActive = 1; @@ -654,7 +675,7 @@ bitflags! { c_enum! { /// The texture type of a `Side`. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum SideType: u16 { 0 => Full, @@ -667,7 +688,7 @@ c_enum! { c_enum! { /// The action type of a `Polygon`. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum PolyType: u16 { 0 => Normal, @@ -694,7 +715,7 @@ c_enum! { c_enum! { /// The type of function for a `LightFunc`. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum LightFuncType: u16 { 0 => Constant, @@ -706,7 +727,7 @@ c_enum! { c_enum! { /// The type of a `Light`. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum LightType: u16 { 0 => Normal, @@ -717,7 +738,7 @@ c_enum! { c_enum! { /// The liquid type of a `Media`. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum MediaType: u16 { 0 => Water, diff --git a/src/marathon/phy.rs b/src/marathon/phy.rs index 05663ab..b327fc1 100644 --- a/src/marathon/phy.rs +++ b/src/marathon/phy.rs @@ -2,7 +2,6 @@ use crate::{durandal::{bin::*, err::*, fixed::*}}; use bitflags::bitflags; -use serde::Serialize; /// Reads a `PXpx` chunk. pub fn read_pxpx(b: &[u8]) -> ResultS<(Physics, usize)> @@ -284,7 +283,7 @@ fn read_attack(b: &[u8]) -> ResultS } /// Static physics information. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Physics { pub acc_ang: Fixed, @@ -316,7 +315,7 @@ pub struct Physics } /// An effect definition. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Effect { pub collection: u16, @@ -328,7 +327,7 @@ pub struct Effect } /// A weapon definition. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Weapon { pub amp_bob: Fixed, @@ -359,7 +358,7 @@ pub struct Weapon } /// The definition of one of two triggers for a weapon. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Trigger { pub burst: u16, @@ -383,7 +382,7 @@ pub struct Trigger } /// A projectile definition. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Projectile { pub collection: OptU16, @@ -406,7 +405,7 @@ pub struct Projectile } /// A monster definition. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Monster { pub collection: u16, @@ -463,7 +462,7 @@ pub struct Monster } /// A damage definition. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Damage { pub dtype: DamageType, @@ -474,7 +473,7 @@ pub struct Damage } /// The definition of a monster's attack. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Attack { pub ptype: OptU16, @@ -489,7 +488,7 @@ pub struct Attack bitflags! { /// Flags for an effect. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct EffectFlags: u16 { const EndOnLoop = 1; @@ -502,7 +501,7 @@ bitflags! { bitflags! { /// Flags for a weapon. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct WeaponFlags: u16 { const Automatic = 1; @@ -521,7 +520,7 @@ bitflags! { bitflags! { /// Flags for a projectile. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct ProjectileFlags: u32 { const Guided = 1; @@ -550,7 +549,7 @@ bitflags! { bitflags! { /// Flags for a monster. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct MonsterFlags: u32 { const IgnoreLOS = 1; @@ -586,7 +585,7 @@ bitflags! { bitflags! { /// The composite type of a monster. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct MonsterClass: u32 { const Player = 1; @@ -610,7 +609,7 @@ bitflags! { bitflags! { /// The composite type of damage taken by something. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct DamageTypeFlags: u32 { const Explosion = 1; @@ -642,7 +641,7 @@ bitflags! { c_enum! { /// A bullet shell casing emitted by a weapon. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum CasingType: u16 { 0 => Rifle, @@ -656,7 +655,7 @@ c_enum! { c_enum! { /// The type of functionality a weapon provides. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum WeaponType: u16 { 0 => Melee, @@ -669,7 +668,7 @@ c_enum! { c_enum! { /// A named type of damage taken by something. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum DamageType: u16 { 0 => Explosion, diff --git a/src/marathon/shp.rs b/src/marathon/shp.rs index 2ff54df..67d858a 100644 --- a/src/marathon/shp.rs +++ b/src/marathon/shp.rs @@ -3,7 +3,6 @@ use crate::{durandal::{bin::*, err::*, fixed::*, image::*, text::*}, marathon::xfer::TransferMode}; use bitflags::bitflags; -use serde::Serialize; /// Reads a color from a color table into `clut`. fn read_color(b: &[u8], clut: &mut [ColorShp]) -> ResultS<()> @@ -312,7 +311,7 @@ impl Color for ColorShp } /// A color in an `ImageShp`'s color table. -#[derive(Clone, Debug, Serialize)] +#[derive(Clone, Debug, serde::Serialize)] pub enum ColorShp { Translucent, @@ -345,7 +344,7 @@ pub struct ImageShp<'a, 'b> } /// A frame, also known as a low level shape. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Frame { flags: FrameFlags, @@ -360,7 +359,7 @@ pub struct Frame } /// A sequence, also known as a high level shape. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Sequence { name: String, @@ -400,7 +399,7 @@ bitflags! { bitflags! { /// Flags for `Frame`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct FrameFlags: u16 { const Obscure = 1 << 13; @@ -411,7 +410,7 @@ bitflags! { c_enum! { /// The type of a collection. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum CollectionType: u16 { 0 => Unused, @@ -424,7 +423,7 @@ c_enum! { c_enum! { /// The type of or number of views for a sequence. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum ViewType: u16 { 1 => Anim, diff --git a/src/marathon/snd.rs b/src/marathon/snd.rs index b613e32..63cce3b 100644 --- a/src/marathon/snd.rs +++ b/src/marathon/snd.rs @@ -2,7 +2,6 @@ use crate::durandal::{bin::*, err::*, fixed::*, sound::*}; use bitflags::bitflags; -use serde::Serialize; use std::collections::BTreeMap; /// Reads a sound. @@ -125,7 +124,7 @@ pub fn read_sounds(b: &[u8]) -> ResultS> } /// The header of a sound definition. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct SoundHead { pub volume: Volume, @@ -147,7 +146,7 @@ pub type SoundTable = BTreeMap; bitflags! { /// Flags for `SoundHead`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct SoundFlags: u16 { const NoRestart = 1; @@ -162,7 +161,7 @@ bitflags! { c_enum! { /// The type of volume this sound has. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum Volume: u16 { 0 => Quiet, diff --git a/src/marathon/trm.rs b/src/marathon/trm.rs index 072dfbe..3d4db16 100644 --- a/src/marathon/trm.rs +++ b/src/marathon/trm.rs @@ -2,7 +2,6 @@ use crate::durandal::{err::*, text::*}; use bitflags::bitflags; -use serde::Serialize; use std::fmt; /// Reads a `Group`. @@ -82,7 +81,7 @@ pub fn read_term(b: &[u8]) -> ResultS<(Terminal, usize)> } /// A terminal definition, with collections of groups and faces. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Terminal { lines: u16, @@ -91,7 +90,7 @@ pub struct Terminal } /// A text face. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Face { start: usize, @@ -100,7 +99,7 @@ pub struct Face } /// A terminal command grouping. -#[derive(Serialize)] +#[derive(serde::Serialize)] pub struct Group { flags: GroupFlags, @@ -112,7 +111,7 @@ pub struct Group bitflags! { /// Flags for `Group`. - #[derive(Serialize)] + #[derive(serde::Serialize)] pub struct GroupFlags: u16 { const DrawOnRight = 1; @@ -122,7 +121,7 @@ bitflags! { c_enum! { /// The command of a `Group`. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum GroupType: u16 { 0 => Logon, diff --git a/src/marathon/wad.rs b/src/marathon/wad.rs index 8c58bd2..a5e93a2 100644 --- a/src/marathon/wad.rs +++ b/src/marathon/wad.rs @@ -2,7 +2,6 @@ use crate::durandal::{bin::*, err::*, image, text::mac_roman_conv}; use crate::marathon::{map, phy, pict, trm}; -use serde::Serialize; use std::collections::BTreeMap; /// Reads all chunks in an entry. @@ -37,6 +36,7 @@ pub fn read_chunks(b: &[u8], siz_cnk: usize) -> ResultS> b"bonk" => Chunk::Bonk(rd_array(data, map::read_bonk)?), b"medi" => Chunk::Medi(rd_array(data, map::read_medi)?), b"plat" => Chunk::Plat(rd_array(data, map::read_plat)?), + b"NOTE" => Chunk::Note(rd_array(data, map::read_note)?), b"term" => Chunk::Term(rd_array(data, trm::read_term)?), b"FXpx" => Chunk::Fxpx(rd_array(data, phy::read_fxpx)?), b"MNpx" => Chunk::Mnpx(rd_array(data, phy::read_mnpx)?), @@ -129,7 +129,7 @@ pub fn read_wad(b: &[u8]) -> ResultS } /// Any kind of chunk in an `Entry`. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub enum Chunk { Pict(image::Image8), @@ -145,6 +145,7 @@ pub enum Chunk Bonk(Vec), Medi(Vec), Plat(Vec), + Note(Vec), Term(Vec), Fxpx(Vec), Mnpx(Vec), @@ -155,7 +156,7 @@ pub enum Chunk } /// An entry containing chunks and application-specific data. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Entry { pub chunks: Vec, @@ -163,7 +164,7 @@ pub struct Entry } /// The header of a `Wad`. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct WadHeader { pub ver_wad: Ver, @@ -173,7 +174,7 @@ pub struct WadHeader } /// A Map file containing entries. -#[derive(Debug, Serialize)] +#[derive(Debug, serde::Serialize)] pub struct Wad { pub head: WadHeader, @@ -182,7 +183,7 @@ pub struct Wad c_enum! { /// The version of a `Wad`. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum Ver: u16 { 0 => Base, diff --git a/src/marathon/xfer.rs b/src/marathon/xfer.rs index 876ebf1..792184a 100644 --- a/src/marathon/xfer.rs +++ b/src/marathon/xfer.rs @@ -1,11 +1,10 @@ //! Transfer Mode type. use crate::durandal::err::*; -use serde::Serialize; c_enum! { /// A rendering style for many things. - #[derive(Debug, Serialize)] + #[derive(Debug, serde::Serialize)] pub enum TransferMode: u16 { 0 => Normal,