mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 10:44:07 +02:00
update dependencies
This commit is contained in:
parent
7aacb8a6eb
commit
b9177ea51b
6 changed files with 165 additions and 112 deletions
142
Cargo.lock
generated
142
Cargo.lock
generated
|
|
@ -19,9 +19,9 @@ checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
|
|||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.2"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
|
||||
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
|
|
@ -31,9 +31,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||
|
||||
[[package]]
|
||||
name = "binrw"
|
||||
version = "0.10.0"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f846d8732b2a55b569b885852ecc925a2b1f24568f4707f8b1ccd5dc6805ea9b"
|
||||
checksum = "5a1b8720bedc0a503fd5c90bef3fbdc397144ac7efcc5610b30bde08083d7495"
|
||||
dependencies = [
|
||||
"array-init",
|
||||
"binrw_derive",
|
||||
|
|
@ -42,28 +42,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "binrw_derive"
|
||||
version = "0.10.0"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c2aa66a5e35daf7f91ed44c945886597ef4c327f34f68b6bbf22951a250ceeb"
|
||||
checksum = "0741a1b1a70a36a1e7fb0316bba0828f6487a3b6e577353cf974b59fbbb92081"
|
||||
dependencies = [
|
||||
"either",
|
||||
"owo-colors",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.105",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "build_const"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7"
|
||||
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||
|
||||
[[package]]
|
||||
name = "bv"
|
||||
|
|
@ -110,13 +104,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
version = "1.8.1"
|
||||
version = "3.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
|
||||
checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe"
|
||||
dependencies = [
|
||||
"build_const",
|
||||
"crc-catalog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc-catalog"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.3.2"
|
||||
|
|
@ -141,12 +141,34 @@ version = "1.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "feature-probe"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lzma"
|
||||
version = "0.2.2"
|
||||
|
|
@ -158,9 +180,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "lzma-rs"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aba8ecb0450dfabce4ad72085eed0a75dffe8f21f7ada05638564ea9db2d7fb1"
|
||||
checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e"
|
||||
dependencies = [
|
||||
"byteorder 1.4.3",
|
||||
"crc",
|
||||
|
|
@ -172,6 +194,12 @@ version = "0.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "155db5e86c6e45ee456bf32fad5a290ee1f7151c2faca27ea27097568da67d1a"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||
|
||||
[[package]]
|
||||
name = "merge"
|
||||
version = "0.1.0"
|
||||
|
|
@ -191,7 +219,7 @@ dependencies = [
|
|||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.105",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -205,23 +233,23 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num_enum"
|
||||
version = "0.5.7"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9"
|
||||
checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0"
|
||||
dependencies = [
|
||||
"num_enum_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_enum_derive"
|
||||
version = "0.5.7"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
|
||||
checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.105",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -232,9 +260,9 @@ checksum = "059c95245738cdc7b40078cdd51a23200252a4c0a0a6dd005136152b3f467a4a"
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.16.0"
|
||||
version = "1.18.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
|
||||
[[package]]
|
||||
name = "owo-colors"
|
||||
|
|
@ -244,13 +272,12 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "1.2.1"
|
||||
version = "1.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9"
|
||||
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"thiserror",
|
||||
"toml",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -262,7 +289,7 @@ dependencies = [
|
|||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.105",
|
||||
"syn 1.0.109",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
|
|
@ -295,12 +322,6 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.149"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "256b9932320c590e707b94576e3cc1f7c9024d0ee6612dfbcf1cb106cbe8e055"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
|
|
@ -332,9 +353,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.105"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -354,38 +375,46 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.37"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
|
||||
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.37"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
|
||||
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.105",
|
||||
"syn 2.0.39",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.9"
|
||||
name = "toml_datetime"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
||||
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.19.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"indexmap",
|
||||
"toml_datetime",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.5"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "vbsp"
|
||||
|
|
@ -423,6 +452,15 @@ version = "0.9.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip-lzma"
|
||||
version = "0.6.3"
|
||||
|
|
|
|||
14
Cargo.toml
14
Cargo.toml
|
|
@ -9,17 +9,17 @@ license = "MIT"
|
|||
edition = "2021"
|
||||
readme = "README.md"
|
||||
exclude = ["*.bsp"]
|
||||
rust-version = "1.62.0"
|
||||
rust-version = "1.67.0"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.7.2"
|
||||
bitflags = "1.3"
|
||||
arrayvec = "0.7.4"
|
||||
bitflags = "2.4.1"
|
||||
bv = "0.11.1"
|
||||
thiserror = "1.0.37"
|
||||
lzma-rs = "0.2.0"
|
||||
binrw = "0.10.0"
|
||||
thiserror = "1.0.50"
|
||||
lzma-rs = "0.3.0"
|
||||
binrw = "0.13.1"
|
||||
static_assertions = "1.1.0"
|
||||
num_enum = "0.5.7"
|
||||
num_enum = "0.7.1"
|
||||
vbsp-derive = { path = "derive", version = "0.1.0", features = ["__vbsp_as_self"] }
|
||||
cgmath = "0.18.0"
|
||||
zip = { package = "zip-lzma", version = "0.6.3", default-features = false, features = ["lzma"] }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use super::vector::Vector;
|
||||
use crate::data::try_read_enum;
|
||||
use crate::error::InvalidNeighbourError;
|
||||
use binrw::{BinRead, BinResult, ReadOptions};
|
||||
use binrw::{BinRead, BinResult, Endian};
|
||||
use bitflags::bitflags;
|
||||
use num_enum::TryFromPrimitive;
|
||||
use std::fmt::Debug;
|
||||
|
|
@ -60,17 +60,17 @@ impl DisplacementNeighbour {
|
|||
}
|
||||
|
||||
impl BinRead for DisplacementNeighbour {
|
||||
type Args = ();
|
||||
type Args<'a> = ();
|
||||
|
||||
fn read_options<R: Read + Seek>(
|
||||
reader: &mut R,
|
||||
options: &ReadOptions,
|
||||
args: Self::Args,
|
||||
endian: Endian,
|
||||
args: Self::Args<'_>,
|
||||
) -> BinResult<Self> {
|
||||
Ok(DisplacementNeighbour {
|
||||
sub_neighbours: [
|
||||
read_option_sub_neighbour(reader, options, args)?,
|
||||
read_option_sub_neighbour(reader, options, args)?,
|
||||
read_option_sub_neighbour(reader, endian, args)?,
|
||||
read_option_sub_neighbour(reader, endian, args)?,
|
||||
],
|
||||
})
|
||||
}
|
||||
|
|
@ -78,10 +78,10 @@ impl BinRead for DisplacementNeighbour {
|
|||
|
||||
fn read_option_sub_neighbour<R: Read + Seek>(
|
||||
reader: &mut R,
|
||||
options: &ReadOptions,
|
||||
endian: Endian,
|
||||
args: (),
|
||||
) -> BinResult<Option<DisplacementSubNeighbour>> {
|
||||
let neighbour_index = u16::read_options(reader, options, args)?;
|
||||
let neighbour_index = u16::read_options(reader, endian, args)?;
|
||||
|
||||
// for non-connected sub-neighbours, the orientations and spans sometimes contain garbage
|
||||
// so we just skip over it
|
||||
|
|
@ -93,7 +93,7 @@ fn read_option_sub_neighbour<R: Read + Seek>(
|
|||
} else {
|
||||
reader.seek(SeekFrom::Current(-2))?;
|
||||
Ok(Some(DisplacementSubNeighbour::read_options(
|
||||
reader, options, args,
|
||||
reader, endian, args,
|
||||
)?))
|
||||
}
|
||||
}
|
||||
|
|
@ -134,16 +134,16 @@ pub enum NeighbourSpan {
|
|||
}
|
||||
|
||||
impl BinRead for NeighbourSpan {
|
||||
type Args = ();
|
||||
type Args<'a> = ();
|
||||
|
||||
fn read_options<R: Read + Seek>(
|
||||
reader: &mut R,
|
||||
options: &ReadOptions,
|
||||
args: Self::Args,
|
||||
endian: Endian,
|
||||
args: Self::Args<'_>,
|
||||
) -> BinResult<Self> {
|
||||
try_read_enum(
|
||||
reader,
|
||||
options,
|
||||
endian,
|
||||
args,
|
||||
InvalidNeighbourError::InvalidNeighbourSpan,
|
||||
)
|
||||
|
|
@ -160,16 +160,16 @@ pub enum NeighbourOrientation {
|
|||
}
|
||||
|
||||
impl BinRead for NeighbourOrientation {
|
||||
type Args = ();
|
||||
type Args<'a> = ();
|
||||
|
||||
fn read_options<R: Read + Seek>(
|
||||
reader: &mut R,
|
||||
options: &ReadOptions,
|
||||
args: Self::Args,
|
||||
endian: Endian,
|
||||
args: Self::Args<'static>,
|
||||
) -> BinResult<Self> {
|
||||
try_read_enum(
|
||||
reader,
|
||||
options,
|
||||
endian,
|
||||
args,
|
||||
InvalidNeighbourError::InvalidNeighbourOrientation,
|
||||
)
|
||||
|
|
@ -217,9 +217,11 @@ pub struct DisplacementTriangle {
|
|||
pub tags: DisplacementTriangleFlags,
|
||||
}
|
||||
|
||||
#[derive(BinRead, Debug, Clone, Copy)]
|
||||
pub struct DisplacementTriangleFlags(u8);
|
||||
|
||||
bitflags! {
|
||||
#[derive(BinRead)]
|
||||
pub struct DisplacementTriangleFlags: u8 {
|
||||
impl DisplacementTriangleFlags: u8 {
|
||||
const SURFACE = 0x01;
|
||||
const WALKABLE = 0x02;
|
||||
const BULDABLE = 0x04;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::error::UnsupportedLumpVersion;
|
||||
use crate::{lzma_decompress_with_header, BspError, FixedString, Vector};
|
||||
use binrw::{BinRead, BinReaderExt, BinResult, ReadOptions};
|
||||
use binrw::{BinRead, BinReaderExt, BinResult, Endian};
|
||||
use bitflags::bitflags;
|
||||
use cgmath::{Deg, Quaternion, Rotation3};
|
||||
use std::borrow::Cow;
|
||||
|
|
@ -15,7 +15,10 @@ pub struct GameLumpHeader {
|
|||
}
|
||||
|
||||
impl GameLumpHeader {
|
||||
pub fn find<T: GameLumpType<Args = (u16,)>>(&self, data: &[u8]) -> Option<Result<T, BspError>> {
|
||||
pub fn find<T: GameLumpType<Args<'static> = (u16,)>>(
|
||||
&self,
|
||||
data: &[u8],
|
||||
) -> Option<Result<T, BspError>> {
|
||||
let (i, lump) = self
|
||||
.lumps
|
||||
.iter()
|
||||
|
|
@ -67,9 +70,11 @@ pub struct GameLump {
|
|||
pub length: i32,
|
||||
}
|
||||
|
||||
#[derive(BinRead, Debug, Clone, Copy)]
|
||||
pub struct GameLumpFlags(u16);
|
||||
|
||||
bitflags! {
|
||||
#[derive(BinRead)]
|
||||
pub struct GameLumpFlags: u16 {
|
||||
impl GameLumpFlags: u16 {
|
||||
const COMPRESSED = 0b0000_0000_0000_0000_0001;
|
||||
}
|
||||
}
|
||||
|
|
@ -143,18 +148,16 @@ impl StaticPropLump {
|
|||
}
|
||||
|
||||
impl BinRead for StaticPropLump {
|
||||
type Args = (u16,);
|
||||
type Args<'a> = (u16,);
|
||||
|
||||
fn read_options<R: Read + Seek>(
|
||||
reader: &mut R,
|
||||
options: &ReadOptions,
|
||||
args: Self::Args,
|
||||
endian: Endian,
|
||||
args: Self::Args<'static>,
|
||||
) -> BinResult<Self> {
|
||||
match args.0 {
|
||||
6 => StaticPropLumpV6::read_options(reader, options, ()).map(StaticPropLump::from),
|
||||
7 | 10 => {
|
||||
StaticPropLumpV10::read_options(reader, options, ()).map(StaticPropLump::from)
|
||||
}
|
||||
6 => StaticPropLumpV6::read_options(reader, endian, ()).map(StaticPropLump::from),
|
||||
7 | 10 => StaticPropLumpV10::read_options(reader, endian, ()).map(StaticPropLump::from),
|
||||
version => Err(binrw::Error::Custom {
|
||||
err: Box::new(UnsupportedLumpVersion {
|
||||
lump_type: "static props",
|
||||
|
|
@ -166,9 +169,11 @@ impl BinRead for StaticPropLump {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(BinRead, Debug, Clone, Copy)]
|
||||
pub struct StaticPropLumpFlags(u32);
|
||||
|
||||
bitflags! {
|
||||
#[derive(BinRead)]
|
||||
pub struct StaticPropLumpFlags: u32 {
|
||||
impl StaticPropLumpFlags: u32 {
|
||||
const FLAG_FADES = 0x1;
|
||||
const USE_LIGHTING_ORIGIN = 0x2;
|
||||
const NO_DRAW = 0x4;
|
||||
|
|
@ -224,9 +229,11 @@ fn test_static_prop_lump_v6_bytes() {
|
|||
super::test_read_bytes::<StaticPropLumpV6>();
|
||||
}
|
||||
|
||||
#[derive(BinRead, Debug, Clone, Copy)]
|
||||
struct StaticPropLumpFlagsV6(u8);
|
||||
|
||||
bitflags! {
|
||||
#[derive(BinRead)]
|
||||
struct StaticPropLumpFlagsV6: u8 {
|
||||
impl StaticPropLumpFlagsV6: u8 {
|
||||
const FLAG_FADES = 0x1;
|
||||
const USE_LIGHTING_ORIGIN = 0x2;
|
||||
const NO_DRAW = 0x4;
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ use crate::bspfile::LumpType;
|
|||
use crate::{BspResult, StringError};
|
||||
use arrayvec::ArrayString;
|
||||
use binrw::error::CustomError;
|
||||
use binrw::{BinRead, BinResult, ReadOptions};
|
||||
use binrw::{BinRead, BinResult, Endian};
|
||||
use bitflags::bitflags;
|
||||
use bv::BitVec;
|
||||
use num_enum::TryFromPrimitive;
|
||||
use num_enum::{TryFromPrimitive, TryFromPrimitiveError};
|
||||
use std::borrow::Cow;
|
||||
use std::cmp::min;
|
||||
use std::fmt;
|
||||
|
|
@ -30,7 +30,8 @@ use zip::ZipArchive;
|
|||
#[cfg(test)]
|
||||
fn test_read_bytes<T: BinRead>()
|
||||
where
|
||||
T::Args: Default,
|
||||
T::Args<'static>: Default,
|
||||
<T as BinRead>::Args<'static>: Clone,
|
||||
{
|
||||
use binrw::BinReaderExt;
|
||||
use std::any::type_name;
|
||||
|
|
@ -84,9 +85,11 @@ pub struct LeafFace {
|
|||
pub face: u16,
|
||||
}
|
||||
|
||||
#[derive(BinRead, Debug, Clone, Copy)]
|
||||
pub struct TextureFlags(u32);
|
||||
|
||||
bitflags! {
|
||||
#[derive(BinRead)]
|
||||
pub struct TextureFlags: u32 {
|
||||
impl TextureFlags: u32 {
|
||||
const LIGHT = 0b0000_0000_0000_0000_0001; // value will hold the light strength
|
||||
const SKY2D = 0b0000_0000_0000_0000_0010; // don't draw, indicate we should skylight + draw 2d sky but don't draw the 3d skybox
|
||||
const SKY = 0b0000_0000_0000_0000_0100; // don't draw, but add the skybox
|
||||
|
|
@ -129,18 +132,18 @@ impl<const LEN: usize> Display for FixedString<LEN> {
|
|||
}
|
||||
|
||||
impl<const LEN: usize> BinRead for FixedString<LEN> {
|
||||
type Args = ();
|
||||
type Args<'a> = ();
|
||||
|
||||
fn read_options<R: Read + binrw::io::Seek>(
|
||||
reader: &mut R,
|
||||
options: &ReadOptions,
|
||||
args: Self::Args,
|
||||
endian: Endian,
|
||||
args: Self::Args<'static>,
|
||||
) -> BinResult<Self> {
|
||||
use std::str;
|
||||
|
||||
let start = reader.stream_position().unwrap();
|
||||
|
||||
let name_buf = <[u8; LEN]>::read_options(reader, options, args)?;
|
||||
let name_buf = <[u8; LEN]>::read_options(reader, endian, args)?;
|
||||
|
||||
let zero_pos =
|
||||
name_buf
|
||||
|
|
@ -269,9 +272,11 @@ impl Brush {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(BinRead, Debug, Clone, Copy)]
|
||||
pub struct BrushFlags(u32);
|
||||
|
||||
bitflags! {
|
||||
#[derive(BinRead)]
|
||||
pub struct BrushFlags: u32 {
|
||||
impl BrushFlags: u32 {
|
||||
const EMPTY = 0; // No contents
|
||||
const SOLID = 0x1; // an eye is never valid in a solid
|
||||
const WINDOW = 0x2; // translucent, but not watery (glass)
|
||||
|
|
@ -475,19 +480,19 @@ impl Packfile {
|
|||
|
||||
fn try_read_enum<Enum, Reader, Error, ErrorFn>(
|
||||
reader: &mut Reader,
|
||||
options: &ReadOptions,
|
||||
args: <<Enum as TryFromPrimitive>::Primitive as BinRead>::Args,
|
||||
endian: Endian,
|
||||
args: <<Enum as TryFromPrimitive>::Primitive as BinRead>::Args<'static>,
|
||||
err_map: ErrorFn,
|
||||
) -> BinResult<Enum>
|
||||
where
|
||||
Reader: Read + Seek,
|
||||
Enum: TryFromPrimitive,
|
||||
Enum: TryFromPrimitive<Error = TryFromPrimitiveError<Enum>>,
|
||||
Enum::Primitive: BinRead,
|
||||
ErrorFn: FnOnce(Enum::Primitive) -> Error,
|
||||
Error: CustomError + 'static,
|
||||
{
|
||||
let start = reader.stream_position().unwrap();
|
||||
let raw = <Enum::Primitive>::read_options(reader, options, args)?;
|
||||
let raw = <Enum::Primitive>::read_options(reader, endian, args)?;
|
||||
|
||||
Enum::try_from_primitive(raw)
|
||||
.map_err(|e| err_map(e.number))
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ impl<R: BinReaderExt + Read> LumpReader<R> {
|
|||
|
||||
pub fn read<T: BinRead + Debug>(&mut self) -> BspResult<T>
|
||||
where
|
||||
T::Args: Default,
|
||||
T::Args<'static>: Default,
|
||||
<T as BinRead>::Args<'static>: Clone,
|
||||
{
|
||||
// let start = self.inner.stream_position().unwrap() as usize;
|
||||
let result = self.inner.read_le()?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue