maraiah: fix style inconsistency
parent
ad792b99d3
commit
31c6701dd5
|
@ -16,8 +16,7 @@
|
|||
/// use std::convert::TryFrom;
|
||||
///
|
||||
/// c_enum! {
|
||||
/// enum MyEnum: u16
|
||||
/// {
|
||||
/// enum MyEnum: u16 {
|
||||
/// Zero = 0,
|
||||
/// One = 1,
|
||||
/// Two = 2
|
||||
|
@ -44,8 +43,7 @@ macro_rules! c_enum
|
|||
$(#[$outer])*
|
||||
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||
#[repr($ti)]
|
||||
$vi enum $t
|
||||
{
|
||||
$vi enum $t {
|
||||
$($(#[$vouter])* $en = $va,)+
|
||||
}
|
||||
|
||||
|
@ -73,8 +71,7 @@ mod test
|
|||
use std::convert::TryFrom;
|
||||
|
||||
c_enum! {
|
||||
enum TestEnum: u16
|
||||
{
|
||||
enum TestEnum: u16 {
|
||||
Zero = 0,
|
||||
One = 1,
|
||||
Two = 2,
|
||||
|
|
|
@ -417,8 +417,7 @@ impl HuffmanTable
|
|||
}
|
||||
}
|
||||
|
||||
struct HuffmanTable
|
||||
{
|
||||
struct HuffmanTable {
|
||||
nums: [u16; 16],
|
||||
syms: Vec<u16>,
|
||||
}
|
||||
|
|
|
@ -85,8 +85,7 @@ impl Default for CStringVec
|
|||
|
||||
/// An owned null-terminated string vector.
|
||||
#[derive(Debug)]
|
||||
pub struct CStringVec
|
||||
{
|
||||
pub struct CStringVec {
|
||||
sv: Vec<CString>,
|
||||
cv: Vec<NT>,
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ pub fn validate_folder_path(p: &str) -> ResultS<()>
|
|||
}
|
||||
|
||||
/// Opens the file at `path` and skips past any macintosh headers.
|
||||
pub fn open_mac_file<P: AsRef<Path>>(path: P) -> ResultS<fs::File>
|
||||
pub fn open_mac<P: AsRef<Path>>(path: P) -> ResultS<fs::File>
|
||||
{
|
||||
let mut fp = fs::File::open(path)?;
|
||||
|
||||
|
|
|
@ -236,8 +236,7 @@ pub struct Color8(u8, u8, u8);
|
|||
/// An RGB16 image.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Image16
|
||||
{
|
||||
pub struct Image16 {
|
||||
w: usize,
|
||||
h: usize,
|
||||
|
||||
|
@ -248,8 +247,7 @@ pub struct Image16
|
|||
/// An RGB8 image.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Image8
|
||||
{
|
||||
pub struct Image8 {
|
||||
w: usize,
|
||||
h: usize,
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ pub fn read<'a>(b: &'a [u8],
|
|||
Ok((&b[p..], Header{pitch, pack_t, depth, clut, rle}))
|
||||
}
|
||||
|
||||
pub struct Header
|
||||
{
|
||||
pub struct Header {
|
||||
pub pitch: usize,
|
||||
pub pack_t: PackType,
|
||||
pub depth: Depth,
|
||||
|
@ -64,8 +63,7 @@ pub struct Header
|
|||
}
|
||||
|
||||
c_enum! {
|
||||
pub enum Depth: u16
|
||||
{
|
||||
pub enum Depth: u16 {
|
||||
_1 = 1,
|
||||
_2 = 2,
|
||||
_4 = 4,
|
||||
|
@ -76,8 +74,7 @@ c_enum! {
|
|||
}
|
||||
|
||||
c_enum! {
|
||||
pub enum PackType: u16
|
||||
{
|
||||
pub enum PackType: u16 {
|
||||
Default = 0,
|
||||
None = 1,
|
||||
NoPad = 2,
|
||||
|
|
|
@ -18,8 +18,7 @@ pub fn read(b: &[u8]) -> ResultS<(SoundAmbi, usize)>
|
|||
/// An ambient sound definition.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct SoundAmbi
|
||||
{
|
||||
pub struct SoundAmbi {
|
||||
pub index: u16,
|
||||
pub volume: u16,
|
||||
}
|
||||
|
|
|
@ -24,8 +24,7 @@ pub fn read(b: &[u8]) -> ResultS<Attack>
|
|||
/// The definition of a monster's attack.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Attack
|
||||
{
|
||||
pub struct Attack {
|
||||
pub ptype: OptU16,
|
||||
pub rep: u16,
|
||||
pub error: Angle,
|
||||
|
|
|
@ -28,8 +28,7 @@ pub fn read(b: &[u8]) -> ResultS<(SoundRand, usize)>
|
|||
/// A randomly played sound definition.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct SoundRand
|
||||
{
|
||||
pub struct SoundRand {
|
||||
pub flags: SoundRandFlags,
|
||||
pub index: u16,
|
||||
pub vol_nrm: u16,
|
||||
|
@ -45,8 +44,7 @@ pub struct SoundRand
|
|||
bitflags! {
|
||||
/// Flags for `SoundRand`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct SoundRandFlags: u16
|
||||
{
|
||||
pub struct SoundRandFlags: u16 {
|
||||
const NO_DIRECTION = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ pub fn read(b: &[u8]) -> ResultS<Damage>
|
|||
/// A damage definition.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Damage
|
||||
{
|
||||
pub struct Damage {
|
||||
pub dtype: DamageType,
|
||||
pub flags: DamageFlags,
|
||||
pub dmg_base: u16,
|
||||
|
@ -34,8 +33,7 @@ pub struct Damage
|
|||
bitflags! {
|
||||
/// The composite type of damage taken by something.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct DamageTypeFlags: u32
|
||||
{
|
||||
pub struct DamageTypeFlags: u32 {
|
||||
const EXPLOSION = 1;
|
||||
const ELECTRICAL_STAFF = 1 << 1;
|
||||
const PROJECTILE = 1 << 2;
|
||||
|
@ -66,8 +64,7 @@ bitflags! {
|
|||
bitflags! {
|
||||
/// Flags for `Damage`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct DamageFlags: u16
|
||||
{
|
||||
pub struct DamageFlags: u16 {
|
||||
const ALIEN = 1;
|
||||
}
|
||||
}
|
||||
|
@ -75,8 +72,7 @@ bitflags! {
|
|||
c_enum! {
|
||||
/// A named type of damage taken by something.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum DamageType: u16
|
||||
{
|
||||
pub enum DamageType: u16 {
|
||||
Explosion = 0,
|
||||
ElectricalStaff = 1,
|
||||
Projectile = 2,
|
||||
|
|
|
@ -79,8 +79,7 @@ pub fn read_all(head: &head::Header,
|
|||
/// The loaded data of a Map file entry.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Default, Eq, PartialEq)]
|
||||
pub struct EntryData
|
||||
{
|
||||
pub struct EntryData {
|
||||
/** `EPNT` chunk data. */ pub epnt: Option<Vec<map::epnt::Endpoint>>,
|
||||
/** `FXpx` chunk data. */ pub fxpx: Option<Vec<map::fxpx::Effect>>,
|
||||
/** `LINS` chunk data. */ pub lins: Option<Vec<map::lins::Line>>,
|
||||
|
|
|
@ -45,8 +45,7 @@ pub fn read_all(map: &head::Map) -> ResultS<EntryMap<'_>>
|
|||
/// An entry containing chunked data and application-specific data.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Entry<'a>
|
||||
{
|
||||
pub struct Entry<'a> {
|
||||
/// The data in this `Entry`.
|
||||
pub data: &'a [u8],
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ pub fn to_pnts(v: &[Endpoint]) -> Vec<pnts::Point>
|
|||
/// A pre-processed point in world-space.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Endpoint
|
||||
{
|
||||
pub struct Endpoint {
|
||||
pub flags: EndpointFlags,
|
||||
pub hei_hi: Unit,
|
||||
pub hei_lo: Unit,
|
||||
|
@ -41,8 +40,7 @@ pub struct Endpoint
|
|||
bitflags! {
|
||||
/// Flags for `Endpoint`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct EndpointFlags: u16
|
||||
{
|
||||
pub struct EndpointFlags: u16 {
|
||||
const SOLID = 1;
|
||||
const SAME_HEIGHT = 1 << 1;
|
||||
const TRANSPARENT = 1 << 2;
|
||||
|
|
|
@ -23,8 +23,7 @@ pub fn read(b: &[u8]) -> ResultS<(Effect, usize)>
|
|||
/// An effect definition.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Effect
|
||||
{
|
||||
pub struct Effect {
|
||||
pub collection: u16,
|
||||
pub shape: u16,
|
||||
pub pitch: Fixed,
|
||||
|
@ -36,8 +35,7 @@ pub struct Effect
|
|||
bitflags! {
|
||||
/// Flags for an effect.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct EffectFlags: u16
|
||||
{
|
||||
pub struct EffectFlags: u16 {
|
||||
const END_ON_LOOP = 1;
|
||||
const END_ON_XFER_LOOP = 1 << 1;
|
||||
const SOUND_ONLY = 1 << 2;
|
||||
|
|
|
@ -111,8 +111,7 @@ impl Map
|
|||
/// A Map header.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Header
|
||||
{
|
||||
pub struct Header {
|
||||
/// The original name of this file.
|
||||
pub name: String,
|
||||
|
||||
|
@ -124,8 +123,7 @@ pub struct Header
|
|||
/// A Map file.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Map
|
||||
{
|
||||
pub struct Map {
|
||||
head: Header,
|
||||
data: Vec<u8>,
|
||||
dir_ofs: usize,
|
||||
|
@ -135,8 +133,7 @@ pub struct Map
|
|||
c_enum! {
|
||||
/// The version of a Map file.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum Ver: u16
|
||||
{
|
||||
pub enum Ver: u16 {
|
||||
Base = 0,
|
||||
Dir = 1,
|
||||
Over = 2,
|
||||
|
|
|
@ -24,8 +24,7 @@ pub fn read(b: &[u8]) -> ResultS<(Line, usize)>
|
|||
/// A line segment.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Line
|
||||
{
|
||||
pub struct Line {
|
||||
pub flags: LineFlags,
|
||||
pub pnt_beg: u16,
|
||||
pub pnt_end: u16,
|
||||
|
@ -38,8 +37,7 @@ pub struct Line
|
|||
bitflags! {
|
||||
/// Flags for `Line`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct LineFlags: u16
|
||||
{
|
||||
pub struct LineFlags: u16 {
|
||||
const TRANS_SIDE = 1 << 9;
|
||||
const ELEV_VAR = 1 << 10;
|
||||
const ELEVATION = 1 << 11;
|
||||
|
|
|
@ -73,8 +73,7 @@ pub fn read_old(b: &[u8]) -> ResultS<(Light, usize)>
|
|||
/// A dynamic polygon light.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Light
|
||||
{
|
||||
pub struct Light {
|
||||
pub ltype: LightType,
|
||||
pub flags: LightFlags,
|
||||
pub phase: i16,
|
||||
|
@ -90,8 +89,7 @@ pub struct Light
|
|||
bitflags! {
|
||||
/// Flags for `Light`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct LightFlags: u16
|
||||
{
|
||||
pub struct LightFlags: u16 {
|
||||
const INIT_ACTIVE = 1;
|
||||
const SLAVE_VALUE = 1 << 1;
|
||||
const STATELESS = 1 << 2;
|
||||
|
@ -101,8 +99,7 @@ bitflags! {
|
|||
c_enum! {
|
||||
/// The type of a `Light`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum LightType: u16
|
||||
{
|
||||
pub enum LightType: u16 {
|
||||
Normal = 0,
|
||||
Strobe = 1,
|
||||
Media = 2,
|
||||
|
|
|
@ -33,8 +33,7 @@ pub fn write(v: &LightFunc) -> Vec<u8>
|
|||
/// A light function.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct LightFunc
|
||||
{
|
||||
pub struct LightFunc {
|
||||
pub ftype: LightFuncType,
|
||||
pub prd_nrm: u16,
|
||||
pub prd_dta: u16,
|
||||
|
@ -45,8 +44,7 @@ pub struct LightFunc
|
|||
c_enum! {
|
||||
/// The type of function for a `LightFunc`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum LightFuncType: u16
|
||||
{
|
||||
pub enum LightFuncType: u16 {
|
||||
Constant = 0,
|
||||
Linear = 1,
|
||||
Smooth = 2,
|
||||
|
|
|
@ -34,8 +34,7 @@ pub fn read(b: &[u8]) -> ResultS<(Media, usize)>
|
|||
/// A media, as in a part of a polygon which goes up the middle of the wall.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Media
|
||||
{
|
||||
pub struct Media {
|
||||
pub mtype: MediaType,
|
||||
pub flags: MediaFlags,
|
||||
pub control: u16,
|
||||
|
@ -53,8 +52,7 @@ pub struct Media
|
|||
c_enum! {
|
||||
/// The liquid type of a `Media`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum MediaType: u16
|
||||
{
|
||||
pub enum MediaType: u16 {
|
||||
Water = 0,
|
||||
Lava = 1,
|
||||
Goo = 2,
|
||||
|
@ -65,8 +63,7 @@ c_enum! {
|
|||
bitflags! {
|
||||
/// Flags for `Media`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct MediaFlags: u16
|
||||
{
|
||||
pub struct MediaFlags: u16 {
|
||||
const OBSTRUCT = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,8 +71,7 @@ impl Default for Info
|
|||
/// Static map information.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Info
|
||||
{
|
||||
pub struct Info {
|
||||
pub texture_id: u16,
|
||||
pub physics_id: u16,
|
||||
pub skypict_id: u16,
|
||||
|
@ -85,8 +84,7 @@ pub struct Info
|
|||
bitflags! {
|
||||
/// Static environment flags.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct EnvironmentFlags: u16
|
||||
{
|
||||
pub struct EnvironmentFlags: u16 {
|
||||
const VACUUM = 1;
|
||||
const MAGNETIC = 1 << 1;
|
||||
const REBELLION = 1 << 2;
|
||||
|
@ -104,8 +102,7 @@ bitflags! {
|
|||
bitflags! {
|
||||
/// Static entry point flags.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct EntryFlags: u32
|
||||
{
|
||||
pub struct EntryFlags: u32 {
|
||||
const SOLO = 1;
|
||||
const CO_OP = 1 << 1;
|
||||
const CARNAGE = 1 << 2;
|
||||
|
@ -120,8 +117,7 @@ bitflags! {
|
|||
bitflags! {
|
||||
/// Static mission flags.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct MissionFlags: u16
|
||||
{
|
||||
pub struct MissionFlags: u16 {
|
||||
const EXTERMINATION = 1;
|
||||
const EXPLORATION = 1 << 1;
|
||||
const RETRIEVAL = 1 << 2;
|
||||
|
|
|
@ -86,8 +86,7 @@ pub fn read(b: &[u8]) -> ResultS<(Monster, usize)>
|
|||
/// A monster definition.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Monster
|
||||
{
|
||||
pub struct Monster {
|
||||
pub collection: u16,
|
||||
pub vitality: u16,
|
||||
pub dty_immune: damg::DamageTypeFlags,
|
||||
|
@ -144,8 +143,7 @@ pub struct Monster
|
|||
bitflags! {
|
||||
/// Flags for a monster.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct MonsterFlags: u32
|
||||
{
|
||||
pub struct MonsterFlags: u32 {
|
||||
const IGNORE_LOS = 1;
|
||||
const FLYING = 1 << 1;
|
||||
const ALIEN = 1 << 2;
|
||||
|
@ -180,8 +178,7 @@ bitflags! {
|
|||
bitflags! {
|
||||
/// The composite type of a monster.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct MonsterClass: u32
|
||||
{
|
||||
pub struct MonsterClass: u32 {
|
||||
const PLAYER = 1;
|
||||
const CIVILIAN = 1 << 1;
|
||||
const MADD = 1 << 2;
|
||||
|
|
|
@ -20,8 +20,7 @@ pub fn read(b: &[u8]) -> ResultS<(Note, usize)>
|
|||
/// Overhead map annotations.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Note
|
||||
{
|
||||
pub struct Note {
|
||||
pub pos: pnts::Point,
|
||||
pub poly: u16,
|
||||
pub text: String,
|
||||
|
|
|
@ -30,8 +30,7 @@ pub fn read(b: &[u8]) -> ResultS<(Object, usize)>
|
|||
/// An object in the world.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Object
|
||||
{
|
||||
pub struct Object {
|
||||
pub group: u16,
|
||||
pub index: u16,
|
||||
pub angle: Angle,
|
||||
|
@ -46,8 +45,7 @@ pub struct Object
|
|||
bitflags! {
|
||||
/// Flags for `Object`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct ObjectFlags: u16
|
||||
{
|
||||
pub struct ObjectFlags: u16 {
|
||||
const INVISIBLE = 1;
|
||||
const CEILING = 1 << 1;
|
||||
const BLIND = 1 << 2;
|
||||
|
|
|
@ -23,8 +23,7 @@ pub fn read(b: &[u8]) -> ResultS<(ObjectFreq, usize)>
|
|||
/// The difficulty definition for various object types.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct ObjectFreq
|
||||
{
|
||||
pub struct ObjectFreq {
|
||||
pub flags: ObjectFreqFlags,
|
||||
pub cnt_ini: u16,
|
||||
pub cnt_min: u16,
|
||||
|
@ -36,8 +35,7 @@ pub struct ObjectFreq
|
|||
bitflags! {
|
||||
/// Flags for `ObjectFreq`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct ObjectFreqFlags: u16
|
||||
{
|
||||
pub struct ObjectFreqFlags: u16 {
|
||||
const RANDOM_LOCATION = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@ pub fn read(b: &[u8]) -> ResultS<(Platform, usize)>
|
|||
/// Extra information for polygons with platforms.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Platform
|
||||
{
|
||||
pub struct Platform {
|
||||
pub ptype: u16,
|
||||
pub speed: u16,
|
||||
pub delay: u16,
|
||||
|
@ -40,8 +39,7 @@ pub struct Platform
|
|||
bitflags! {
|
||||
/// Flags for `Platform`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct PlatformFlags: u32
|
||||
{
|
||||
pub struct PlatformFlags: u32 {
|
||||
const INIT_ACTIVE = 1;
|
||||
const INIT_EXTENDED = 1 << 1;
|
||||
const STOP_AT_EACH_LEVEL = 1 << 2;
|
||||
|
|
|
@ -30,8 +30,7 @@ pub fn read(b: &[u8]) -> ResultS<(Point, usize)> {Ok((read_o(b)?, 4))}
|
|||
/// A point in world-space.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
|
||||
pub struct Point
|
||||
{
|
||||
pub struct Point {
|
||||
pub x: Unit,
|
||||
pub y: Unit,
|
||||
}
|
||||
|
|
|
@ -131,8 +131,7 @@ impl Default for PolygonType
|
|||
/// A polygon segment.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||
pub struct Polygon
|
||||
{
|
||||
pub struct Polygon {
|
||||
pub ptype: PolygonType,
|
||||
pub tex_flr: OptU16,
|
||||
pub tex_cei: OptU16,
|
||||
|
@ -154,8 +153,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 PolygonType
|
||||
{
|
||||
pub enum PolygonType {
|
||||
Normal,
|
||||
ImpassItem,
|
||||
ImpassMons,
|
||||
|
@ -185,8 +183,7 @@ pub enum PolygonType
|
|||
bitflags! {
|
||||
/// Flags for `Polygon`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct PolygonFlags: u16
|
||||
{
|
||||
pub struct PolygonFlags: u16 {
|
||||
const DETACHED = 1 << 14;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,7 @@ pub fn read(b: &[u8]) -> ResultS<(Projectile, usize)>
|
|||
/// A projectile definition.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Projectile
|
||||
{
|
||||
pub struct Projectile {
|
||||
pub collection: OptU16,
|
||||
pub shape: u16,
|
||||
pub fxt_explode: OptU16,
|
||||
|
@ -62,8 +61,7 @@ pub struct Projectile
|
|||
bitflags! {
|
||||
/// Flags for a projectile.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct ProjectileFlags: u32
|
||||
{
|
||||
pub struct ProjectileFlags: u32 {
|
||||
const GUIDED = 1;
|
||||
const STOP_ON_LOOP = 1 << 1;
|
||||
const PERSISTENT = 1 << 2;
|
||||
|
|
|
@ -45,8 +45,7 @@ pub fn read(b: &[u8]) -> ResultS<(Physics, usize)>
|
|||
/// Static physics information.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Physics
|
||||
{
|
||||
pub struct Physics {
|
||||
pub acc_ang: Fixed,
|
||||
pub acc_cli: Fixed,
|
||||
pub acc_grv: Fixed,
|
||||
|
|
|
@ -41,8 +41,7 @@ pub fn read_old(b: &[u8]) -> ResultS<(Side, usize)>
|
|||
/// One side of a line segment.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Side
|
||||
{
|
||||
pub struct Side {
|
||||
pub stype: SideType,
|
||||
pub flags: SideFlags,
|
||||
pub tex_pri: stex::SideTex,
|
||||
|
@ -59,8 +58,7 @@ pub struct Side
|
|||
bitflags! {
|
||||
/// Flags for `Side`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct SideFlags: u16
|
||||
{
|
||||
pub struct SideFlags: u16 {
|
||||
const STATUS = 1;
|
||||
const PANEL = 1 << 1;
|
||||
const REPAIR = 1 << 2;
|
||||
|
@ -75,8 +73,7 @@ bitflags! {
|
|||
c_enum! {
|
||||
/// The texture type of a `Side`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum SideType: u16
|
||||
{
|
||||
pub enum SideType: u16 {
|
||||
Full = 0,
|
||||
High = 1,
|
||||
Low = 2,
|
||||
|
|
|
@ -28,8 +28,7 @@ pub fn write(v: &SideTex) -> Vec<u8>
|
|||
/// The texture of a side segment.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct SideTex
|
||||
{
|
||||
pub struct SideTex {
|
||||
pub offs: pnts::Point,
|
||||
pub tex_id: OptU16,
|
||||
}
|
||||
|
|
|
@ -46,8 +46,7 @@ pub fn read(b: &[u8]) -> ResultS<(Terminal, usize)>
|
|||
/// A terminal definition, with collections of groups and faces.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Terminal
|
||||
{
|
||||
pub struct Terminal {
|
||||
pub lines: u16,
|
||||
pub groups: Vec<trmg::Group>,
|
||||
pub faces: Vec<trmf::Face>,
|
||||
|
|
|
@ -36,8 +36,7 @@ pub fn read(b: &[u8]) -> ResultS<Trigger>
|
|||
/// The definition of one of two triggers for a weapon.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Trigger
|
||||
{
|
||||
pub struct Trigger {
|
||||
pub burst: u16,
|
||||
pub dx: i16,
|
||||
pub dz: i16,
|
||||
|
@ -61,8 +60,7 @@ pub struct Trigger
|
|||
c_enum! {
|
||||
/// A bullet shell casing emitted by a weapon.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum CasingType: u16
|
||||
{
|
||||
pub enum CasingType: u16 {
|
||||
Rifle = 0,
|
||||
Pistol = 1,
|
||||
PistolLeft = 2,
|
||||
|
|
|
@ -19,8 +19,7 @@ pub fn read(b: &[u8]) -> ResultS<(Face, usize)>
|
|||
/// A text face.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Face
|
||||
{
|
||||
pub struct Face {
|
||||
pub start: usize,
|
||||
pub face: u16,
|
||||
pub color: u16,
|
||||
|
|
|
@ -48,8 +48,7 @@ impl Default for GroupType
|
|||
|
||||
/// Interim structure.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct InterGroup
|
||||
{
|
||||
pub struct InterGroup {
|
||||
pub flags: GroupFlags,
|
||||
pub ttype: GroupType,
|
||||
pub lines: u16,
|
||||
|
@ -60,8 +59,7 @@ pub struct InterGroup
|
|||
/// A terminal command grouping.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Group
|
||||
{
|
||||
pub struct Group {
|
||||
pub flags: GroupFlags,
|
||||
pub ttype: GroupType,
|
||||
pub lines: u16,
|
||||
|
@ -71,8 +69,7 @@ pub struct Group
|
|||
/// The command of a `Group`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum GroupType
|
||||
{
|
||||
pub enum GroupType {
|
||||
Logon(u16),
|
||||
Unfinished,
|
||||
Success,
|
||||
|
@ -95,8 +92,7 @@ pub enum GroupType
|
|||
bitflags! {
|
||||
/// Flags for `Group`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct GroupFlags: u16
|
||||
{
|
||||
pub struct GroupFlags: u16 {
|
||||
/// Draws the picture on the right.
|
||||
const DRAW_ON_RIGHT = 1;
|
||||
/// Draws the picture in the center.
|
||||
|
|
|
@ -48,8 +48,7 @@ pub fn read(b: &[u8]) -> ResultS<(Weapon, usize)>
|
|||
/// A weapon definition.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Weapon
|
||||
{
|
||||
pub struct Weapon {
|
||||
pub amp_bob: Fixed,
|
||||
pub amp_horz: Fixed,
|
||||
pub collection: u16,
|
||||
|
@ -80,8 +79,7 @@ pub struct Weapon
|
|||
bitflags! {
|
||||
/// Flags for a weapon.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct WeaponFlags: u16
|
||||
{
|
||||
pub struct WeaponFlags: u16 {
|
||||
const AUTOMATIC = 1;
|
||||
const REMOVE_AFTER_USE = 1 << 1;
|
||||
const INSTANT_CASING = 1 << 2;
|
||||
|
@ -99,8 +97,7 @@ bitflags! {
|
|||
c_enum! {
|
||||
/// The type of functionality a weapon provides.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum WeaponType: u16
|
||||
{
|
||||
pub enum WeaponType: u16 {
|
||||
Melee = 0,
|
||||
Normal = 1,
|
||||
DualFunc = 2,
|
||||
|
|
|
@ -22,7 +22,7 @@ macro_rules! meta_str {
|
|||
}
|
||||
}
|
||||
|
||||
meta_str!(
|
||||
meta_str! {
|
||||
/// The authors of this crate, `:` separated.
|
||||
authors = env!("CARGO_PKG_AUTHORS");
|
||||
/// The description of this crate.
|
||||
|
@ -45,6 +45,6 @@ meta_str!(
|
|||
version_patch = env!("CARGO_PKG_VERSION_PATCH");
|
||||
/// The pre-release version of this crate.
|
||||
version_pre = env!("CARGO_PKG_VERSION_PRE");
|
||||
);
|
||||
}
|
||||
|
||||
// EOF
|
||||
|
|
|
@ -114,8 +114,7 @@ impl Image for ImageShp<'_, '_>
|
|||
|
||||
/// An unpacked Shape bitmap.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Bitmap
|
||||
{
|
||||
pub struct Bitmap {
|
||||
w: usize,
|
||||
h: usize,
|
||||
cr: Vec<u8>,
|
||||
|
@ -126,15 +125,13 @@ pub struct Bitmap
|
|||
/// An image from a Shape. This mainly just exists so that `Bitmap` can use the
|
||||
/// `Image` trait.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct ImageShp<'a, 'b>
|
||||
{
|
||||
pub struct ImageShp<'a, 'b> {
|
||||
bmp: &'a Bitmap,
|
||||
clut: &'b [clut::ColorShp],
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
struct BmpFlags: u16
|
||||
{
|
||||
struct BmpFlags: u16 {
|
||||
const TRANSPARENT = 1 << 14;
|
||||
const COLUMN_MAJOR = 1 << 15;
|
||||
}
|
||||
|
|
|
@ -93,8 +93,7 @@ impl Color for ColorShp
|
|||
/// A color in a `Clut`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum ColorShp
|
||||
{
|
||||
pub enum ColorShp {
|
||||
/// A completely translucent color.
|
||||
Translucent,
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ pub fn read(b: &[u8]) -> ResultS<Collection>
|
|||
|
||||
/// A collection of color tables, bitmaps, frames and sequences.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Collection
|
||||
{
|
||||
pub struct Collection {
|
||||
/// The type of collection this is.
|
||||
pub ctyp: CollectionType,
|
||||
|
||||
|
@ -57,8 +56,7 @@ pub struct Collection
|
|||
c_enum! {
|
||||
/// The type of a collection.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum CollectionType: u16
|
||||
{
|
||||
pub enum CollectionType: u16 {
|
||||
Unused = 0,
|
||||
Wall = 1,
|
||||
Object = 2,
|
||||
|
|
|
@ -26,8 +26,7 @@ pub fn read(b: &[u8]) -> ResultS<Frame>
|
|||
/// A frame, also known as a low level shape.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Frame
|
||||
{
|
||||
pub struct Frame {
|
||||
/// The flags for this frame.
|
||||
pub flags: FrameFlags,
|
||||
|
||||
|
@ -59,8 +58,7 @@ pub struct Frame
|
|||
bitflags! {
|
||||
/// Flags for `Frame`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct FrameFlags: u16
|
||||
{
|
||||
pub struct FrameFlags: u16 {
|
||||
/// The player's torso will obscure the player's legs.
|
||||
const OBSCURE = 1 << 13;
|
||||
/// The bitmap will be flipped on the vertical axis.
|
||||
|
|
|
@ -32,8 +32,7 @@ pub fn read(b: &[u8]) -> ResultS<Sequence>
|
|||
/// A sequence, also known as a high level shape.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Sequence
|
||||
{
|
||||
pub struct Sequence {
|
||||
/// The display name for this sequence.
|
||||
pub name: String,
|
||||
|
||||
|
@ -71,8 +70,7 @@ pub struct Sequence
|
|||
c_enum! {
|
||||
/// The type of or number of views for a sequence.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum ViewType: u16
|
||||
{
|
||||
pub enum ViewType: u16 {
|
||||
Anim = 1,
|
||||
Anim8from2 = 2,
|
||||
Anim4from3 = 3,
|
||||
|
|
|
@ -43,8 +43,7 @@ pub fn read(b: &[u8]) -> ResultS<Option<(Vec<usize>, u16, SoundDef)>>
|
|||
|
||||
/// A sound definition containing one, many or no sounds.
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct SoundDef
|
||||
{
|
||||
pub struct SoundDef {
|
||||
/// The volume type for this sound.
|
||||
pub volume: Volume,
|
||||
|
||||
|
@ -67,8 +66,7 @@ pub struct SoundDef
|
|||
bitflags! {
|
||||
/// Flags for `SoundDef`.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub struct SoundFlags: u16
|
||||
{
|
||||
pub struct SoundFlags: u16 {
|
||||
/// The sound will not restart when trying to play over itself.
|
||||
const NO_RESTART = 1;
|
||||
/// The sound will not switch channels when trying to play over itself.
|
||||
|
@ -89,8 +87,7 @@ bitflags! {
|
|||
c_enum! {
|
||||
/// The type of volume this sound has.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum Volume: u16
|
||||
{
|
||||
pub enum Volume: u16 {
|
||||
Quiet = 0,
|
||||
Normal = 1,
|
||||
Loud = 2,
|
||||
|
|
|
@ -86,8 +86,7 @@ impl Sound for Sound16
|
|||
/// A 16-bit PCM stream.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Sound16
|
||||
{
|
||||
pub struct Sound16 {
|
||||
rate: u16,
|
||||
lp_beg: usize,
|
||||
lp_end: usize,
|
||||
|
|
|
@ -8,8 +8,7 @@ impl Default for TransferMode
|
|||
c_enum! {
|
||||
/// A rendering style for many things.
|
||||
#[cfg_attr(feature = "serde_obj", derive(serde::Serialize))]
|
||||
pub enum TransferMode: u16
|
||||
{
|
||||
pub enum TransferMode: u16 {
|
||||
Normal = 0,
|
||||
FadeBlack = 1,
|
||||
Invisibility = 2,
|
||||
|
|
Loading…
Reference in New Issue