upgrade to rust 1.33
parent
9250b5c2b1
commit
51f4eab9fe
|
@ -109,33 +109,39 @@ macro_rules! define_fixed_types {
|
|||
|
||||
/// Returns the number of ones in the bit representation of self.
|
||||
#[inline]
|
||||
pub fn count_ones(self) -> u32 {self.0.count_ones()}
|
||||
pub const fn count_ones(self) -> u32 {self.0.count_ones()}
|
||||
|
||||
/// Returns the number of zeros in the bit representation of self.
|
||||
#[inline]
|
||||
pub fn count_zeros(self) -> u32 {self.0.count_zeros()}
|
||||
pub const fn count_zeros(self) -> u32 {self.0.count_zeros()}
|
||||
|
||||
/// Returns the number of leading zeros in the bit representation of
|
||||
/// self.
|
||||
#[inline]
|
||||
pub fn leading_zeros(self) -> u32 {self.0.leading_zeros()}
|
||||
pub const fn leading_zeros(self) -> u32 {self.0.leading_zeros()}
|
||||
|
||||
/// Returns the number of trailing zeros in the bit representation of
|
||||
/// self.
|
||||
#[inline]
|
||||
pub fn trailing_zeros(self) -> u32 {self.0.trailing_zeros()}
|
||||
pub const fn trailing_zeros(self) -> u32 {self.0.trailing_zeros()}
|
||||
|
||||
/// Rotates all bits left by `n`.
|
||||
#[inline]
|
||||
pub fn rotate_left(self, n: u32) -> $t {$t(self.0.rotate_left(n))}
|
||||
pub const fn rotate_left(self, n: u32) -> $t
|
||||
{
|
||||
$t(self.0.rotate_left(n))
|
||||
}
|
||||
|
||||
/// Rotates all bits right by `n`.
|
||||
#[inline]
|
||||
pub fn rotate_right(self, n: u32) -> $t {$t(self.0.rotate_right(n))}
|
||||
pub const fn rotate_right(self, n: u32) -> $t
|
||||
{
|
||||
$t(self.0.rotate_right(n))
|
||||
}
|
||||
|
||||
/// Reverses the byte order of the bit representation of self.
|
||||
#[inline]
|
||||
pub fn swap_bytes(self) -> $t {$t(self.0.swap_bytes())}
|
||||
pub const fn swap_bytes(self) -> $t {$t(self.0.swap_bytes())}
|
||||
|
||||
/// Raises self to the power of `exp`.
|
||||
#[inline]
|
||||
|
@ -152,12 +158,12 @@ macro_rules! define_fixed_types {
|
|||
/// Returns true if self is positive and false if the number is zero
|
||||
/// or negative.
|
||||
#[inline]
|
||||
pub fn is_positive(self) -> bool {self.0.is_positive()}
|
||||
pub const fn is_positive(self) -> bool {self.0.is_positive()}
|
||||
|
||||
/// Returns true if self is negative and false if the number is zero
|
||||
/// or positive.
|
||||
#[inline]
|
||||
pub fn is_negative(self) -> bool {self.0.is_negative()}
|
||||
pub const fn is_negative(self) -> bool {self.0.is_negative()}
|
||||
|
||||
/// Return the memory representation of this integer as a byte array
|
||||
/// in big-endian (network) byte order.
|
||||
|
@ -169,11 +175,6 @@ macro_rules! define_fixed_types {
|
|||
#[inline]
|
||||
pub fn to_le_bytes(self) -> [u8; $bytes] {self.0.to_le_bytes()}
|
||||
|
||||
/// Return the memory representation of this integer as a byte array
|
||||
/// in native byte order.
|
||||
#[inline]
|
||||
pub fn to_ne_bytes(self) -> [u8; $bytes] {self.0.to_ne_bytes()}
|
||||
|
||||
/// Create a value from its representation as a byte array in
|
||||
/// big-endian byte order.
|
||||
#[inline]
|
||||
|
@ -190,14 +191,6 @@ macro_rules! define_fixed_types {
|
|||
$t($ti::from_le_bytes(b))
|
||||
}
|
||||
|
||||
/// Create a value from its representation as a byte array in
|
||||
/// native byte order.
|
||||
#[inline]
|
||||
pub fn from_ne_bytes(b: [u8; $bytes]) -> $t
|
||||
{
|
||||
$t($ti::from_ne_bytes(b))
|
||||
}
|
||||
|
||||
/// Creates a value of this type with the bit pattern `bits`.
|
||||
#[inline]
|
||||
pub const fn from_bits(bits: $tu) -> $t {$t(bits as $ti)}
|
||||
|
@ -208,7 +201,7 @@ macro_rules! define_fixed_types {
|
|||
|
||||
/// Returns the raw bit pattern.
|
||||
#[inline]
|
||||
pub fn to_bits(self) -> $tu {self.0 as $tu}
|
||||
pub const fn to_bits(self) -> $tu {self.0 as $tu}
|
||||
|
||||
/// Sets the raw bit pattern to `bits`.
|
||||
#[inline]
|
||||
|
|
|
@ -50,21 +50,21 @@ pub fn read_minf(b: &[u8]) -> ResultS<Minf>
|
|||
{
|
||||
read_data! {
|
||||
88, BE in b =>
|
||||
texture_id = u16[0];
|
||||
physics_id = u16[2];
|
||||
skypict_id = u16[4];
|
||||
missi_flags = u16[6];
|
||||
envir_flags = u16[8];
|
||||
level_name = mac_roman_cstr[18..84];
|
||||
entry_flags = u32[84];
|
||||
texture_id = u16[0];
|
||||
physics_id = u16[2];
|
||||
skypict_id = u16[4];
|
||||
miss_flags = u16[6];
|
||||
envi_flags = u16[8];
|
||||
level_name = mac_roman_cstr[18..84];
|
||||
entr_flags = u32[84];
|
||||
}
|
||||
|
||||
let missi_flags = flag_ok!(MsnFlags, missi_flags)?;
|
||||
let envir_flags = flag_ok!(EnvFlags, envir_flags)?;
|
||||
let entry_flags = flag_ok!(EntFlags, entry_flags)?;
|
||||
let miss_flags = flag_ok!(MsnFlags, miss_flags)?;
|
||||
let envi_flags = flag_ok!(EnvFlags, envi_flags)?;
|
||||
let entr_flags = flag_ok!(EntFlags, entr_flags)?;
|
||||
|
||||
Ok(Minf{texture_id, physics_id, skypict_id, missi_flags, envir_flags,
|
||||
entry_flags, level_name})
|
||||
Ok(Minf{texture_id, physics_id, skypict_id, miss_flags, envi_flags,
|
||||
entr_flags, level_name})
|
||||
}
|
||||
|
||||
/// Reads an old `Minf` chunk.
|
||||
|
@ -72,17 +72,17 @@ pub fn read_old_minf(b: &[u8]) -> ResultS<Minf>
|
|||
{
|
||||
let minf = read_minf(b)?;
|
||||
|
||||
let mut entry_flags = if minf.entry_flags.is_empty() {
|
||||
EntFlags::Solo
|
||||
let mut entr_flags = if minf.entr_flags.is_empty() {
|
||||
EntFlags::SOLO
|
||||
} else {
|
||||
minf.entry_flags
|
||||
minf.entr_flags
|
||||
};
|
||||
|
||||
if entry_flags.intersects(EntFlags::Solo | EntFlags::Carnage) {
|
||||
entry_flags.insert(EntFlags::CoOp)
|
||||
if entr_flags.intersects(EntFlags::SOLO | EntFlags::CARNAGE) {
|
||||
entr_flags.insert(EntFlags::CO_OP)
|
||||
}
|
||||
|
||||
Ok(Minf{entry_flags, ..minf})
|
||||
Ok(Minf{entr_flags, ..minf})
|
||||
}
|
||||
|
||||
/// Reads an `iidx` chunk.
|
||||
|
@ -166,7 +166,7 @@ pub fn read_old_sids(b: &[u8]) -> ResultS<(Side, usize)>
|
|||
|
||||
Ok((Side{tex_tra: SideTex{tex_id: OptU16::none(), ..side.tex_tra},
|
||||
shade: 0.into(),
|
||||
flags: side.flags | SideFlags::ItemOpt,
|
||||
flags: side.flags | SideFlags::ITEM_OPT,
|
||||
..side}, siz))
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ pub fn read_old_lite(b: &[u8]) -> ResultS<(Light, usize)>
|
|||
let lite = &OLD_LIGHT_DEFINITIONS[ltype];
|
||||
let on = mode == 0 || mode == 1;
|
||||
let strobe = ltype == 3;
|
||||
let flags = if on {lite.flags | LightFlags::InitActive} else {lite.flags};
|
||||
let flags = if on {lite.flags | LightFlags::INIT_ACTIVE} else {lite.flags};
|
||||
|
||||
// modify each old light function accordingly
|
||||
let old_lfun = move |func: &LightFunc| -> LightFunc {
|
||||
|
@ -499,13 +499,13 @@ impl Default for Minf
|
|||
{
|
||||
fn default() -> Self
|
||||
{
|
||||
Minf{texture_id: 0,
|
||||
physics_id: 1,
|
||||
skypict_id: 0,
|
||||
missi_flags: MsnFlags::empty(),
|
||||
envir_flags: EnvFlags::empty(),
|
||||
entry_flags: EntFlags::Solo,
|
||||
level_name: "Map".to_string()}
|
||||
Minf{texture_id: 0,
|
||||
physics_id: 1,
|
||||
skypict_id: 0,
|
||||
miss_flags: MsnFlags::empty(),
|
||||
envi_flags: EnvFlags::empty(),
|
||||
entr_flags: EntFlags::SOLO,
|
||||
level_name: "Map".to_string()}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,13 +700,13 @@ pub struct Note
|
|||
#[derive(Debug, PartialEq, serde::Serialize)]
|
||||
pub struct Minf
|
||||
{
|
||||
pub texture_id: u16,
|
||||
pub physics_id: u16,
|
||||
pub skypict_id: u16,
|
||||
pub missi_flags: MsnFlags,
|
||||
pub envir_flags: EnvFlags,
|
||||
pub entry_flags: EntFlags,
|
||||
pub level_name: String,
|
||||
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 level_name: String,
|
||||
}
|
||||
|
||||
/// The action type of a `Polygon`.
|
||||
|
@ -744,12 +744,12 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct LineFlags: u16
|
||||
{
|
||||
const TransSide = 1 << 9;
|
||||
const ElevVar = 1 << 10;
|
||||
const Elevation = 1 << 11;
|
||||
const Landscape = 1 << 12;
|
||||
const Transparent = 1 << 13;
|
||||
const Solid = 1 << 14;
|
||||
const TRANS_SIDE = 1 << 9;
|
||||
const ELEV_VAR = 1 << 10;
|
||||
const ELEVATION = 1 << 11;
|
||||
const LANDSCAPE = 1 << 12;
|
||||
const TRANSPARENT = 1 << 13;
|
||||
const SOLID = 1 << 14;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -758,14 +758,14 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct SideFlags: u16
|
||||
{
|
||||
const Status = 1;
|
||||
const Panel = 1 << 1;
|
||||
const Repair = 1 << 2;
|
||||
const ItemUse = 1 << 3;
|
||||
const Lighted = 1 << 4;
|
||||
const CanDestroy = 1 << 5;
|
||||
const HitOnly = 1 << 6;
|
||||
const ItemOpt = 1 << 7;
|
||||
const STATUS = 1;
|
||||
const PANEL = 1 << 1;
|
||||
const REPAIR = 1 << 2;
|
||||
const ITEM_USE = 1 << 3;
|
||||
const LIGHTED = 1 << 4;
|
||||
const CAN_DESTROY = 1 << 5;
|
||||
const HIT_ONLY = 1 << 6;
|
||||
const ITEM_OPT = 1 << 7;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -774,17 +774,17 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct EnvFlags: u16
|
||||
{
|
||||
const Vacuum = 1;
|
||||
const Magnetic = 1 << 1;
|
||||
const Rebellion = 1 << 2;
|
||||
const LowGrav = 1 << 3;
|
||||
const M1Glue = 1 << 4;
|
||||
const LavaFloor = 1 << 5;
|
||||
const Rebellion2 = 1 << 6;
|
||||
const Music = 1 << 7;
|
||||
const TermPause = 1 << 8;
|
||||
const M1Monster = 1 << 9;
|
||||
const M1Weps = 1 << 10;
|
||||
const VACUUM = 1;
|
||||
const MAGNETIC = 1 << 1;
|
||||
const REBELLION = 1 << 2;
|
||||
const LOW_GRAV = 1 << 3;
|
||||
const M1_GLUE = 1 << 4;
|
||||
const LAVA_FLOOR = 1 << 5;
|
||||
const REBELLION2 = 1 << 6;
|
||||
const MUSIC = 1 << 7;
|
||||
const TERM_PAUSE = 1 << 8;
|
||||
const M1_MONSTER = 1 << 9;
|
||||
const M1_WEPS = 1 << 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -793,13 +793,13 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct EntFlags: u32
|
||||
{
|
||||
const Solo = 1;
|
||||
const CoOp = 1 << 1;
|
||||
const Carnage = 1 << 2;
|
||||
const SOLO = 1;
|
||||
const CO_OP = 1 << 1;
|
||||
const CARNAGE = 1 << 2;
|
||||
const KTMWTB = 1 << 3;
|
||||
const KOTH = 1 << 4;
|
||||
const Defense = 1 << 5;
|
||||
const Rugby = 1 << 6;
|
||||
const DEFENSE = 1 << 5;
|
||||
const RUGBY = 1 << 6;
|
||||
const CTF = 1 << 7;
|
||||
}
|
||||
}
|
||||
|
@ -809,11 +809,11 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct MsnFlags: u16
|
||||
{
|
||||
const Extermination = 1;
|
||||
const Exploration = 1 << 1;
|
||||
const Retrieval = 1 << 2;
|
||||
const Repair = 1 << 3;
|
||||
const Rescue = 1 << 4;
|
||||
const EXTERMINATION = 1;
|
||||
const EXPLORATION = 1 << 1;
|
||||
const RETRIEVAL = 1 << 2;
|
||||
const REPAIR = 1 << 3;
|
||||
const RESCUE = 1 << 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -822,7 +822,7 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct PolyFlags: u16
|
||||
{
|
||||
const Detached = 1 << 14;
|
||||
const DETACHED = 1 << 14;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -831,9 +831,9 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct LightFlags: u16
|
||||
{
|
||||
const InitActive = 1;
|
||||
const SlaveValue = 1 << 1;
|
||||
const Stateless = 1 << 2;
|
||||
const INIT_ACTIVE = 1;
|
||||
const SLAVE_VALUE = 1 << 1;
|
||||
const STATELESS = 1 << 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -842,12 +842,12 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct ObjectFlags: u16
|
||||
{
|
||||
const Invisible = 1;
|
||||
const Ceiling = 1 << 1;
|
||||
const Blind = 1 << 2;
|
||||
const Deaf = 1 << 3;
|
||||
const Floating = 1 << 4;
|
||||
const NetOnly = 1 << 5;
|
||||
const INVISIBLE = 1;
|
||||
const CEILING = 1 << 1;
|
||||
const BLIND = 1 << 2;
|
||||
const DEAF = 1 << 3;
|
||||
const FLOATING = 1 << 4;
|
||||
const NET_ONLY = 1 << 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -856,33 +856,33 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct PlatformFlags: u32
|
||||
{
|
||||
const InitActive = 1;
|
||||
const InitExtended = 1 << 1;
|
||||
const StopAtEachLevel = 1 << 2;
|
||||
const StopAtInitLevel = 1 << 3;
|
||||
const StartAdjOnStop = 1 << 4;
|
||||
const ExtendsFloorToCeil = 1 << 5;
|
||||
const ComesFromFloor = 1 << 6;
|
||||
const ComesFromCeil = 1 << 7;
|
||||
const CausesDamage = 1 << 8;
|
||||
const NoActivateParent = 1 << 9;
|
||||
const ActivatesOnce = 1 << 10;
|
||||
const ActivatesLight = 1 << 11;
|
||||
const DeactivatesLight = 1 << 12;
|
||||
const PlayerControls = 1 << 13;
|
||||
const MonsterControls = 1 << 14;
|
||||
const ReverseOnObstruct = 1 << 15;
|
||||
const NoExtDeactivation = 1 << 16;
|
||||
const UsePolygonHeights = 1 << 17;
|
||||
const DelayedActivation = 1 << 18;
|
||||
const StartAdjOnStart = 1 << 19;
|
||||
const StopAdjOnStart = 1 << 20;
|
||||
const StopAdjOnStop = 1 << 21;
|
||||
const Slow = 1 << 22;
|
||||
const StartAtEachLevel = 1 << 23;
|
||||
const Locked = 1 << 24;
|
||||
const Secret = 1 << 25;
|
||||
const Door = 1 << 26;
|
||||
const INIT_ACTIVE = 1;
|
||||
const INIT_EXTENDED = 1 << 1;
|
||||
const STOP_AT_EACH_LEVEL = 1 << 2;
|
||||
const STOP_AT_INIT_LEVEL = 1 << 3;
|
||||
const START_ADJ_ON_STOP = 1 << 4;
|
||||
const EXTENDS_FLOOR_TO_CEIL = 1 << 5;
|
||||
const COMES_FROM_FLOOR = 1 << 6;
|
||||
const COMES_FROM_CEIL = 1 << 7;
|
||||
const CAUSES_DAMAGE = 1 << 8;
|
||||
const NO_ACTIVATE_PARENT = 1 << 9;
|
||||
const ACTIVATES_ONCE = 1 << 10;
|
||||
const ACTIVATES_LIGHT = 1 << 11;
|
||||
const DEACTIVATES_LIGHT = 1 << 12;
|
||||
const PLAYER_CONTROLS = 1 << 13;
|
||||
const MONSTER_CONTROLS = 1 << 14;
|
||||
const REVERSE_ON_OBSTRUCT = 1 << 15;
|
||||
const NO_EXT_DEACTIVATION = 1 << 16;
|
||||
const USE_POLYGON_HEIGHTS = 1 << 17;
|
||||
const DELAYED_ACTIVATION = 1 << 18;
|
||||
const START_ADJ_ON_START = 1 << 19;
|
||||
const STOP_ADJ_ON_START = 1 << 20;
|
||||
const STOP_ADJ_ON_STOP = 1 << 21;
|
||||
const SLOW = 1 << 22;
|
||||
const START_AT_EACH_LEVEL = 1 << 23;
|
||||
const LOCKED = 1 << 24;
|
||||
const SECRET = 1 << 25;
|
||||
const DOOR = 1 << 26;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -941,7 +941,7 @@ pub const TICKS_PER_SECOND: u16 = 30;
|
|||
const OLD_LIGHT_DEFINITIONS: [Light; 8] = [
|
||||
// Normal
|
||||
Light{ltype: LightType::Normal,
|
||||
flags: LightFlags::SlaveValue,
|
||||
flags: LightFlags::SLAVE_VALUE,
|
||||
phase: 0,
|
||||
act_pri: LightFunc{ftype: LightFuncType::Constant,
|
||||
prd_nrm: TICKS_PER_SECOND,
|
||||
|
@ -977,7 +977,7 @@ const OLD_LIGHT_DEFINITIONS: [Light; 8] = [
|
|||
|
||||
// Rheostat
|
||||
Light{ltype: LightType::Normal,
|
||||
flags: LightFlags::SlaveValue,
|
||||
flags: LightFlags::SLAVE_VALUE,
|
||||
phase: 0,
|
||||
act_pri: LightFunc{ftype: LightFuncType::Constant,
|
||||
prd_nrm: TICKS_PER_SECOND,
|
||||
|
@ -1013,7 +1013,7 @@ const OLD_LIGHT_DEFINITIONS: [Light; 8] = [
|
|||
|
||||
// Flourescent
|
||||
Light{ltype: LightType::Normal,
|
||||
flags: LightFlags::SlaveValue,
|
||||
flags: LightFlags::SLAVE_VALUE,
|
||||
phase: 0,
|
||||
act_pri: LightFunc{ftype: LightFuncType::Constant,
|
||||
prd_nrm: TICKS_PER_SECOND,
|
||||
|
@ -1049,7 +1049,7 @@ const OLD_LIGHT_DEFINITIONS: [Light; 8] = [
|
|||
|
||||
// Strobe
|
||||
Light{ltype: LightType::Normal,
|
||||
flags: LightFlags::SlaveValue,
|
||||
flags: LightFlags::SLAVE_VALUE,
|
||||
phase: 0,
|
||||
act_pri: LightFunc{ftype: LightFuncType::Constant,
|
||||
prd_nrm: TICKS_PER_SECOND,
|
||||
|
@ -1085,7 +1085,7 @@ const OLD_LIGHT_DEFINITIONS: [Light; 8] = [
|
|||
|
||||
// Flicker
|
||||
Light{ltype: LightType::Normal,
|
||||
flags: LightFlags::SlaveValue,
|
||||
flags: LightFlags::SLAVE_VALUE,
|
||||
phase: 0,
|
||||
act_pri: LightFunc{ftype: LightFuncType::Constant,
|
||||
prd_nrm: TICKS_PER_SECOND,
|
||||
|
@ -1121,7 +1121,7 @@ const OLD_LIGHT_DEFINITIONS: [Light; 8] = [
|
|||
|
||||
// Pulsate
|
||||
Light{ltype: LightType::Normal,
|
||||
flags: LightFlags::SlaveValue,
|
||||
flags: LightFlags::SLAVE_VALUE,
|
||||
phase: 0,
|
||||
act_pri: LightFunc{ftype: LightFuncType::Smooth,
|
||||
prd_nrm: TICKS_PER_SECOND * 2,
|
||||
|
@ -1157,7 +1157,7 @@ const OLD_LIGHT_DEFINITIONS: [Light; 8] = [
|
|||
|
||||
// Annoying
|
||||
Light{ltype: LightType::Normal,
|
||||
flags: LightFlags::SlaveValue,
|
||||
flags: LightFlags::SLAVE_VALUE,
|
||||
phase: 0,
|
||||
act_pri: LightFunc{ftype: LightFuncType::Random,
|
||||
prd_nrm: 2,
|
||||
|
@ -1193,7 +1193,7 @@ const OLD_LIGHT_DEFINITIONS: [Light; 8] = [
|
|||
|
||||
// Energy Efficient
|
||||
Light{ltype: LightType::Normal,
|
||||
flags: LightFlags::SlaveValue,
|
||||
flags: LightFlags::SLAVE_VALUE,
|
||||
phase: 0,
|
||||
act_pri: LightFunc{ftype: LightFuncType::Constant,
|
||||
prd_nrm: TICKS_PER_SECOND,
|
||||
|
|
|
@ -491,11 +491,11 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct EffectFlags: u16
|
||||
{
|
||||
const EndOnLoop = 1;
|
||||
const EndOnXferLoop = 1 << 1;
|
||||
const SoundOnly = 1 << 2;
|
||||
const MakeTwinVisible = 1 << 3;
|
||||
const MediaEffect = 1 << 4;
|
||||
const END_ON_LOOP = 1;
|
||||
const END_ON_XFER_LOOP = 1 << 1;
|
||||
const SOUND_ONLY = 1 << 2;
|
||||
const MAKE_TWIN_VISIBLE = 1 << 3;
|
||||
const MEDIA_EFFECT = 1 << 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,17 +504,17 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct WeaponFlags: u16
|
||||
{
|
||||
const Automatic = 1;
|
||||
const RemoveAfterUse = 1 << 1;
|
||||
const InstantCasing = 1 << 2;
|
||||
const Overloads = 1 << 3;
|
||||
const RandomAmmo = 1 << 4;
|
||||
const TemporaryPower = 1 << 5;
|
||||
const ReloadOneHand = 1 << 6;
|
||||
const FireOutOfPhase = 1 << 7;
|
||||
const FireUnderMedia = 1 << 8;
|
||||
const TriggerSameAmmo = 1 << 9;
|
||||
const SecondaryFlip = 1 << 10;
|
||||
const AUTOMATIC = 1;
|
||||
const REMOVE_AFTER_USE = 1 << 1;
|
||||
const INSTANT_CASING = 1 << 2;
|
||||
const OVERLOADS = 1 << 3;
|
||||
const RANDOM_AMMO = 1 << 4;
|
||||
const TEMPORARY_POWER = 1 << 5;
|
||||
const RELOAD_ONE_HAND = 1 << 6;
|
||||
const FIRE_OUT_OF_PHASE = 1 << 7;
|
||||
const FIRE_UNDER_MEDIA = 1 << 8;
|
||||
const TRIGGER_SAME_AMMO = 1 << 9;
|
||||
const SECONDARY_FLIP = 1 << 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -523,27 +523,27 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct ProjectileFlags: u32
|
||||
{
|
||||
const Guided = 1;
|
||||
const StopOnLoop = 1 << 1;
|
||||
const Persistent = 1 << 2;
|
||||
const Alien = 1 << 3;
|
||||
const Gravity = 1 << 4;
|
||||
const NoHorzError = 1 << 5;
|
||||
const NoVertError = 1 << 6;
|
||||
const TogglePanels = 1 << 7;
|
||||
const PosVertError = 1 << 8;
|
||||
const Melee = 1 << 9;
|
||||
const Ripper = 1 << 10;
|
||||
const PassTransRandom = 1 << 11;
|
||||
const PassTransMore = 1 << 12;
|
||||
const DoubleGravity = 1 << 13;
|
||||
const ReboundFloor = 1 << 14;
|
||||
const ThroughMedia = 1 << 15;
|
||||
const BecomeItem = 1 << 16;
|
||||
const Bloody = 1 << 17;
|
||||
const WanderHorz = 1 << 18;
|
||||
const UseLowGrav = 1 << 19;
|
||||
const PassMedia = 1 << 20;
|
||||
const GUIDED = 1;
|
||||
const STOP_ON_LOOP = 1 << 1;
|
||||
const PERSISTENT = 1 << 2;
|
||||
const ALIEN = 1 << 3;
|
||||
const GRAVITY = 1 << 4;
|
||||
const NO_HORZ_ERROR = 1 << 5;
|
||||
const NO_VERT_ERROR = 1 << 6;
|
||||
const TOGGLE_PANELS = 1 << 7;
|
||||
const POS_VERT_ERROR = 1 << 8;
|
||||
const MELEE = 1 << 9;
|
||||
const RIPPER = 1 << 10;
|
||||
const PASS_TRANS_RANDOM = 1 << 11;
|
||||
const PASS_TRANS_MORE = 1 << 12;
|
||||
const DOUBLE_GRAVITY = 1 << 13;
|
||||
const REBOUND_FLOOR = 1 << 14;
|
||||
const THROUGH_MEDIA = 1 << 15;
|
||||
const BECOME_ITEM = 1 << 16;
|
||||
const BLOODY = 1 << 17;
|
||||
const WANDER_HORZ = 1 << 18;
|
||||
const USE_LOW_GRAV = 1 << 19;
|
||||
const PASS_MEDIA = 1 << 20;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -552,34 +552,34 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct MonsterFlags: u32
|
||||
{
|
||||
const IgnoreLOS = 1;
|
||||
const Flying = 1 << 1;
|
||||
const Alien = 1 << 2;
|
||||
const Major = 1 << 3;
|
||||
const Minor = 1 << 4;
|
||||
const NoOmit = 1 << 5;
|
||||
const Floats = 1 << 6;
|
||||
const NoAttack = 1 << 7;
|
||||
const Snipe = 1 << 8;
|
||||
const Invisible = 1 << 9;
|
||||
const SubtlyInvisible = 1 << 10;
|
||||
const Kamikaze = 1 << 11;
|
||||
const Berserker = 1 << 12;
|
||||
const Enlarged = 1 << 13;
|
||||
const DelayedDeath = 1 << 14;
|
||||
const FireSymmetrical = 1 << 15;
|
||||
const NuclearDeath = 1 << 16;
|
||||
const NoFireBackwards = 1 << 17;
|
||||
const CanDieInFlames = 1 << 18;
|
||||
const WaitForGoodShot = 1 << 19;
|
||||
const Tiny = 1 << 20;
|
||||
const FastAttack = 1 << 21;
|
||||
const LikesWater = 1 << 22;
|
||||
const LikesSewage = 1 << 23;
|
||||
const LikesLava = 1 << 24;
|
||||
const LikesGoo = 1 << 25;
|
||||
const TeleUnderMedia = 1 << 26;
|
||||
const UseRandomWeapon = 1 << 27;
|
||||
const IGNORE_LOS = 1;
|
||||
const FLYING = 1 << 1;
|
||||
const ALIEN = 1 << 2;
|
||||
const MAJOR = 1 << 3;
|
||||
const MINOR = 1 << 4;
|
||||
const NO_OMIT = 1 << 5;
|
||||
const FLOATS = 1 << 6;
|
||||
const NO_ATTACK = 1 << 7;
|
||||
const SNIPE = 1 << 8;
|
||||
const INVISIBLE = 1 << 9;
|
||||
const SUBTLY_INVISIBLE = 1 << 10;
|
||||
const KAMIKAZE = 1 << 11;
|
||||
const BERSERKER = 1 << 12;
|
||||
const ENLARGED = 1 << 13;
|
||||
const DELAYED_DEATH = 1 << 14;
|
||||
const FIRE_SYMMETRICAL = 1 << 15;
|
||||
const NUCLEAR_DEATH = 1 << 16;
|
||||
const NO_FIRE_BACKWARDS = 1 << 17;
|
||||
const CAN_DIE_IN_FLAMES = 1 << 18;
|
||||
const WAIT_FOR_GOOD_SHOT = 1 << 19;
|
||||
const TINY = 1 << 20;
|
||||
const FAST_ATTACK = 1 << 21;
|
||||
const LIKES_WATER = 1 << 22;
|
||||
const LIKES_SEWAGE = 1 << 23;
|
||||
const LIKES_LAVA = 1 << 24;
|
||||
const LIKES_GOO = 1 << 25;
|
||||
const TELE_UNDER_MEDIA = 1 << 26;
|
||||
const USE_RANDOM_WEAPON = 1 << 27;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,22 +588,22 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct MonsterClass: u32
|
||||
{
|
||||
const Player = 1;
|
||||
const Civilian = 1 << 1;
|
||||
const Madd = 1 << 2;
|
||||
const PossessedHummer = 1 << 3;
|
||||
const Defender = 1 << 4;
|
||||
const Fighter = 1 << 5;
|
||||
const Trooper = 1 << 6;
|
||||
const Hunter = 1 << 7;
|
||||
const Enforcer = 1 << 8;
|
||||
const Juggernaut = 1 << 9;
|
||||
const Hummer = 1 << 10;
|
||||
const Compiler = 1 << 11;
|
||||
const Cyborg = 1 << 12;
|
||||
const Assimilated = 1 << 13;
|
||||
const Tick = 1 << 14;
|
||||
const Yeti = 1 << 15;
|
||||
const PLAYER = 1;
|
||||
const CIVILIAN = 1 << 1;
|
||||
const MADD = 1 << 2;
|
||||
const POSSESSED_HUMMER = 1 << 3;
|
||||
const DEFENDER = 1 << 4;
|
||||
const FIGHTER = 1 << 5;
|
||||
const TROOPER = 1 << 6;
|
||||
const HUNTER = 1 << 7;
|
||||
const ENFORCER = 1 << 8;
|
||||
const JUGGERNAUT = 1 << 9;
|
||||
const HUMMER = 1 << 10;
|
||||
const COMPILER = 1 << 11;
|
||||
const CYBORG = 1 << 12;
|
||||
const ASSIMILATED = 1 << 13;
|
||||
const TICK = 1 << 14;
|
||||
const YETI = 1 << 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -612,30 +612,30 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct DamageTypeFlags: u32
|
||||
{
|
||||
const Explosion = 1;
|
||||
const ElectricalStaff = 1 << 1;
|
||||
const Projectile = 1 << 2;
|
||||
const Absorbed = 1 << 3;
|
||||
const Flame = 1 << 4;
|
||||
const HoundClaws = 1 << 5;
|
||||
const AlienProjectile = 1 << 6;
|
||||
const HulkSlap = 1 << 7;
|
||||
const CompilerBolt = 1 << 8;
|
||||
const FusionBolt = 1 << 9;
|
||||
const HunterBolt = 1 << 10;
|
||||
const Fist = 1 << 11;
|
||||
const Teleporter = 1 << 12;
|
||||
const Defender = 1 << 13;
|
||||
const YetiClaws = 1 << 14;
|
||||
const YetiProjectile = 1 << 15;
|
||||
const Crushing = 1 << 16;
|
||||
const Lava = 1 << 17;
|
||||
const Suffocation = 1 << 18;
|
||||
const Goo = 1 << 19;
|
||||
const EnergyDrain = 1 << 20;
|
||||
const OxygenDrain = 1 << 21;
|
||||
const HummerBolt = 1 << 22;
|
||||
const ShotgunProjectile = 1 << 23;
|
||||
const EXPLOSION = 1;
|
||||
const ELECTRICAL_STAFF = 1 << 1;
|
||||
const PROJECTILE = 1 << 2;
|
||||
const ABSORBED = 1 << 3;
|
||||
const FLAME = 1 << 4;
|
||||
const HOUND_CLAWS = 1 << 5;
|
||||
const ALIEN_PROJECTILE = 1 << 6;
|
||||
const HULK_SLAP = 1 << 7;
|
||||
const COMPILER_BOLT = 1 << 8;
|
||||
const FUSION_BOLT = 1 << 9;
|
||||
const HUNTER_BOLT = 1 << 10;
|
||||
const FIST = 1 << 11;
|
||||
const TELEPORTER = 1 << 12;
|
||||
const DEFENDER = 1 << 13;
|
||||
const YETI_CLAWS = 1 << 14;
|
||||
const YETI_PROJECTILE = 1 << 15;
|
||||
const CRUSHING = 1 << 16;
|
||||
const LAVA = 1 << 17;
|
||||
const SUFFOCATION = 1 << 18;
|
||||
const GOO = 1 << 19;
|
||||
const ENERGY_DRAIN = 1 << 20;
|
||||
const OXYGEN_DRAIN = 1 << 21;
|
||||
const HUMMER_BOLT = 1 << 22;
|
||||
const SHOTGUN_PROJECTILE = 1 << 23;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ pub fn read_bitmap(b: &[u8]) -> ResultS<Bitmap>
|
|||
|
||||
let compr = compr == u16::max_value();
|
||||
let flags = flag_ok!(BmpFlags, flags)?;
|
||||
let alpha = flags.contains(BmpFlags::Transparent);
|
||||
let cmajr = flags.contains(BmpFlags::ColumnMajor);
|
||||
let alpha = flags.contains(BmpFlags::TRANSPARENT);
|
||||
let cmajr = flags.contains(BmpFlags::COLUMN_MAJOR);
|
||||
|
||||
if depth != 8 {
|
||||
bail!("invalid bit depth (should always be 8)");
|
||||
|
@ -395,8 +395,8 @@ pub type CollectionDef = (Option<Collection>, Option<Collection>);
|
|||
bitflags! {
|
||||
struct BmpFlags: u16
|
||||
{
|
||||
const Transparent = 1 << 14;
|
||||
const ColumnMajor = 1 << 15;
|
||||
const TRANSPARENT = 1 << 14;
|
||||
const COLUMN_MAJOR = 1 << 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,9 +405,9 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct FrameFlags: u16
|
||||
{
|
||||
const Obscure = 1 << 13;
|
||||
const FlipY = 1 << 14;
|
||||
const FlipX = 1 << 15;
|
||||
const OBSCURE = 1 << 13;
|
||||
const FLIP_Y = 1 << 14;
|
||||
const FLIP_X = 1 << 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,13 +149,13 @@ bitflags! {
|
|||
#[derive(serde::Serialize)]
|
||||
pub struct SoundFlags: u16
|
||||
{
|
||||
const NoRestart = 1;
|
||||
const NoChannelSwitch = 1 << 1;
|
||||
const LessPitchChange = 1 << 2;
|
||||
const NoPitchChange = 1 << 3;
|
||||
const NoObstruction = 1 << 4;
|
||||
const NoMediaObstruct = 1 << 5;
|
||||
const Ambient = 1 << 6;
|
||||
const NO_RESTART = 1;
|
||||
const NO_CHANNEL_SWITCH = 1 << 1;
|
||||
const LESS_PITCH_CHANGE = 1 << 2;
|
||||
const NO_PITCH_CHANGE = 1 << 3;
|
||||
const NO_OBSTRUCTION = 1 << 4;
|
||||
const NO_MEDIA_OBSTRUCT = 1 << 5;
|
||||
const AMBIENT = 1 << 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,8 +163,8 @@ bitflags! {
|
|||
#[derive(Default, serde::Serialize)]
|
||||
pub struct GroupFlags: u16
|
||||
{
|
||||
const DrawOnRight = 1;
|
||||
const DrawCenter = 1 << 1;
|
||||
const DRAW_ON_RIGHT = 1;
|
||||
const DRAW_CENTER = 1 << 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
14
tests/map.rs
14
tests/map.rs
|
@ -7,13 +7,13 @@ fn read_minf_must_process()
|
|||
{
|
||||
const INPUT: &[u8] = include_bytes!("data/minf.in");
|
||||
|
||||
let out = map::Minf{env_code: 0,
|
||||
physi_id: 1,
|
||||
music_id: 1,
|
||||
missi_flags: map::MsnFlags::Repair,
|
||||
envir_flags: map::EnvFlags::empty(),
|
||||
entry_flags: map::EntFlags::Solo | map::EntFlags::CoOp,
|
||||
level_name: "Waterloo Waterpark".to_string()};
|
||||
let out = map::Minf{texture_id: 0,
|
||||
physics_id: 1,
|
||||
skypict_id: 1,
|
||||
miss_flags: map::MsnFlags::REPAIR,
|
||||
envi_flags: map::EnvFlags::empty(),
|
||||
entr_flags: map::EntFlags::SOLO | map::EntFlags::CO_OP,
|
||||
level_name: "Waterloo Waterpark".to_string()};
|
||||
|
||||
assert_eq!(map::read_minf(INPUT).unwrap(), out);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue