neurodoom 0.6.7

Deterministic no_std Doom engine with semantic and depth perception buffers for AI
Documentation
//! Game-specific enums and bitflags for type-safe gameplay code.

use enumflags2::bitflags;
use strum::{EnumCount, FromRepr};

/// Player input buttons.
#[bitflags]
#[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Button {
    Attack = 1,
    Use = 2,
    Change = 4,
}

pub type Buttons = enumflags2::BitFlags<Button>;

/// Armor type.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default, EnumCount, FromRepr)]
#[repr(u8)]
pub enum ArmorType {
    #[default]
    None = 0,
    /// Green armor — absorbs 1/3 damage.
    Green = 1,
    /// Blue armor — absorbs 1/2 damage.
    Blue = 2,
}

/// Ammo type — indexes into ammo/max_ammo arrays.
#[derive(Clone, Copy, Debug, PartialEq, Eq, EnumCount, FromRepr)]
#[repr(usize)]
pub enum AmmoType {
    Bullets = 0,
    Shells = 1,
    Cells = 2,
    Rockets = 3,
}

/// Weapon type.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default, EnumCount, FromRepr)]
#[repr(u8)]
pub enum WeaponType {
    Fist = 0,
    #[default]
    Pistol = 1,
    Shotgun = 2,
    Chaingun = 3,
    RocketLauncher = 4,
    PlasmaRifle = 5,
    Bfg = 6,
    Chainsaw = 7,
    SuperShotgun = 8,
}

/// Key card / skull key.
#[derive(Clone, Copy, Debug, PartialEq, Eq, EnumCount, FromRepr)]
#[repr(usize)]
pub enum Card {
    BlueCard = 0,
    YellowCard = 1,
    RedCard = 2,
    BlueSkull = 3,
    YellowSkull = 4,
    RedSkull = 5,
}

/// Sector special type — determines light effects and damage.
#[derive(Clone, Copy, Debug, PartialEq, Eq, FromRepr)]
#[repr(i16)]
pub enum SectorSpecial {
    None = 0,
    LightFlicker = 1,
    StrobeFast = 2,
    StrobeSlow = 3,
    StrobeFastDamage = 4,
    LightGlow = 8,
    Secret = 9,
    DoorCloseIn30 = 10,
    SyncStrobeSlow = 12,
    SyncStrobeFast = 13,
    DoorRaiseIn5Min = 14,
    LightFireFlicker = 17,
}

// Well-known numeric identifiers from the WAD format live in the `map`
// module alongside the MapThing / Line loader that parses them. Re-export
// from here too for backward compatibility — these were historically
// reached via `types::doomednum` / `types::line_special`.
pub use crate::map::{doomednum, line_special};

/// Movement direction (8 cardinal + diagonal, plus None).
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default, EnumCount, FromRepr)]
#[repr(u8)]
pub enum MoveDir {
    East = 0,
    NorthEast = 1,
    North = 2,
    NorthWest = 3,
    West = 4,
    SouthWest = 5,
    South = 6,
    SouthEast = 7,
    #[default]
    None = 8,
}