clean up wad.rs comments

gui-branch
an 2019-03-31 15:04:18 -04:00
parent 07f08752d1
commit 023519ad0a
2 changed files with 25 additions and 46 deletions

View File

@ -132,7 +132,6 @@ fn process_ppm(opt: &Options, b: &[u8]) -> ResultS<()>
fn main() -> ResultS<()> fn main() -> ResultS<()>
{ {
use argparse::*; use argparse::*;
use memmap::Mmap;
let mut opt: Options = Default::default(); let mut opt: Options = Default::default();
{ {
@ -221,7 +220,7 @@ fn main() -> ResultS<()>
}; };
let fp = fs::File::open(fna)?; let fp = fs::File::open(fna)?;
let mm = unsafe {Mmap::map(&fp)?}; let mm = unsafe {memmap::Mmap::map(&fp)?};
let b = &mm[machdr::try_mac_header(&mm)..]; let b = &mm[machdr::try_mac_header(&mm)..];
match typ { match typ {

View File

@ -51,7 +51,7 @@ pub fn read_chunks(b: &[u8], old_dat: bool, siz_cnk: usize)
b"PRpx" => Chunk::Prpx(rd_array(data, phy::read_prpx)?), b"PRpx" => Chunk::Prpx(rd_array(data, phy::read_prpx)?),
b"PXpx" => Chunk::Pxpx(rd_array(data, phy::read_pxpx)?), b"PXpx" => Chunk::Pxpx(rd_array(data, phy::read_pxpx)?),
b"WPpx" => Chunk::Wppx(rd_array(data, phy::read_wppx)?), b"WPpx" => Chunk::Wppx(rd_array(data, phy::read_wppx)?),
_ => Chunk::Data{iden, data: data.to_vec()}, _ => Chunk::Data{iden, data: data.to_vec()},
}); });
p = end; p = end;
@ -142,51 +142,31 @@ pub fn read_wad(b: &[u8]) -> ResultS<Wad>
#[derive(Debug, Eq, PartialEq)] #[derive(Debug, Eq, PartialEq)]
pub enum Chunk pub enum Chunk
{ {
/// A `PICT` chunk. /** A `PICT` chunk. */ Pict(image::Image8),
Pict(image::Image8), /** A `Minf` chunk. */ Minf(map::Minf),
/// A `Minf` chunk. /** An `iidx` chunk. */ Iidx(Vec<u16>),
Minf(map::Minf), /** A `PNTS` chunk. */ Pnts(Vec<map::Point>),
/// An `iidx` chunk. /** A `LINS` chunk. */ Lins(Vec<map::Line>),
Iidx(Vec<u16>), /** A `SIDS` chunk. */ Sids(Vec<map::Side>),
/// A `PNTS` chunk. /** A `POLY` chunk. */ Poly(Vec<map::Polygon>),
Pnts(Vec<map::Point>), /** A `LITE` chunk. */ Lite(Vec<map::Light>),
/// A `LINS` chunk. /** An `OBJS` chunk. */ Objs(Vec<map::Object>),
Lins(Vec<map::Line>), /** A `plac` chunk. */ Plac(Vec<map::ObjectFreq>),
/// A `SIDS` chunk. /** An `ambi` chunk. */ Ambi(Vec<map::SoundAmbi>),
Sids(Vec<map::Side>), /** A `bonk` chunk. */ Bonk(Vec<map::SoundRand>),
/// A `POLY` chunk. /** A `medi` chunk. */ Medi(Vec<map::Media>),
Poly(Vec<map::Polygon>), /** A `plat` chunk. */ Plat(Vec<map::Platform>),
/// A `LITE` chunk. /** A `NOTE` chunk. */ Note(Vec<map::Note>),
Lite(Vec<map::Light>), /** A `term` chunk. */ Term(Vec<trm::Terminal>),
/// An `OBJS` chunk. /** A `FXpx` chunk. */ Fxpx(Vec<phy::Effect>),
Objs(Vec<map::Object>), /** A `MNpx` chunk. */ Mnpx(Vec<phy::Monster>),
/// A `plac` chunk. /** A `PRpx` chunk. */ Prpx(Vec<phy::Projectile>),
Plac(Vec<map::ObjectFreq>), /** A `PXpx` chunk. */ Pxpx(Vec<phy::Physics>),
/// An `ambi` chunk. /** A `WPpx` chunk. */ Wppx(Vec<phy::Weapon>),
Ambi(Vec<map::SoundAmbi>),
/// A `bonk` chunk.
Bonk(Vec<map::SoundRand>),
/// A `medi` chunk.
Medi(Vec<map::Media>),
/// A `plat` chunk.
Plat(Vec<map::Platform>),
/// A `NOTE` chunk.
Note(Vec<map::Note>),
/// A `term` chunk.
Term(Vec<trm::Terminal>),
/// A `FXpx` chunk.
Fxpx(Vec<phy::Effect>),
/// A `MNpx` chunk.
Mnpx(Vec<phy::Monster>),
/// A `PRpx` chunk.
Prpx(Vec<phy::Projectile>),
/// A `PXpx` chunk.
Pxpx(Vec<phy::Physics>),
/// A `WPpx` chunk.
Wppx(Vec<phy::Weapon>),
/// Any other type of chunk, which may have arbitrary data in it. /// Any other type of chunk, which may have arbitrary data in it.
Data{/** The name of the chunk. */ iden: Ident, Data{/** The name of the chunk. */ iden: Ident,
/** The data. */ data: Vec<u8>}, /** The data. */ data: Vec<u8>},
} }
/// An entry containing chunks and application-specific data. /// An entry containing chunks and application-specific data.