4 Commits
temp ... master

Author SHA1 Message Date
9395d58a2c spaces 2024-12-31 04:32:46 -08:00
f8c623cd88 change api for no reason 2024-12-31 04:32:39 -08:00
0dc2d1f89e delete Boolio 2024-12-31 04:32:25 -08:00
39a7c31d32 v0.2.0 fixed wide vectors 2024-09-30 10:31:05 -07:00
6 changed files with 20 additions and 37 deletions

16
Cargo.lock generated
View File

@@ -65,7 +65,8 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "fixed_wide"
version = "0.1.0"
source = "git+https://git.itzana.me/StrafesNET/fixed_wide_vectors?rev=438d0ec6ec4ae97d13d950ea317ce324dd205e10#438d0ec6ec4ae97d13d950ea317ce324dd205e10"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "7a8d6e10c51c9df39ead915c62288afbc41d13e00368e526037e530ee5c58e13"
dependencies = [
"arrayvec",
"bnum",
@@ -93,7 +94,8 @@ dependencies = [
[[package]]
name = "linear_ops"
version = "0.1.0"
source = "git+https://git.itzana.me/StrafesNET/fixed_wide_vectors?rev=438d0ec6ec4ae97d13d950ea317ce324dd205e10#438d0ec6ec4ae97d13d950ea317ce324dd205e10"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "b2e6977ac24f47086d8a7a2d4ae1c720e86dfdc8407cf5e34c18bfa01053c456"
dependencies = [
"fixed_wide",
"paste",
@@ -133,12 +135,14 @@ dependencies = [
[[package]]
name = "ratio_ops"
version = "0.1.0"
source = "git+https://git.itzana.me/StrafesNET/fixed_wide_vectors?rev=438d0ec6ec4ae97d13d950ea317ce324dd205e10#438d0ec6ec4ae97d13d950ea317ce324dd205e10"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "01239195d6afe0509e7e3511b716c0540251dfe7ece0a9a5a27116afb766c42c"
[[package]]
name = "strafesnet_common"
version = "0.4.1"
source = "git+https://git.itzana.me/StrafesNET/common?rev=d3bc8e0e855503f368a60eee8e92b73302207272#d3bc8e0e855503f368a60eee8e92b73302207272"
version = "0.5.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "d8fcc44793ae84a1d80882f367980913292241c94eb87584de4010bdad4a918d"
dependencies = [
"arrayvec",
"bitflags",
@@ -151,7 +155,7 @@ dependencies = [
[[package]]
name = "strafesnet_snf"
version = "0.1.3"
version = "0.2.0"
dependencies = [
"binrw",
"id",

View File

@@ -1,6 +1,6 @@
[package]
name = "strafesnet_snf"
version = "0.1.3"
version = "0.2.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -8,4 +8,4 @@ edition = "2021"
[dependencies]
binrw = "0.14.0"
id = { version = "0.1.0", registry = "strafesnet" }
strafesnet_common = { git = "https://git.itzana.me/StrafesNET/common", rev = "d3bc8e0e855503f368a60eee8e92b73302207272" }
strafesnet_common = { version = "0.5.0", registry = "strafesnet" }

View File

@@ -1,6 +1,6 @@
//file format "sniff"
use binrw::{binrw, BinReaderExt, io::TakeSeekExt};
use binrw::{binrw,BinReaderExt,io::TakeSeekExt};
#[derive(Debug)]
pub enum Error{
@@ -92,7 +92,7 @@ impl<R:BinReaderExt> File<R>{
data:input,
})
}
pub(crate) fn as_mut(&mut self)->&mut R{
pub(crate) fn data_mut(&mut self)->&mut R{
&mut self.data
}
pub(crate) fn block_reader(&mut self,block_id:BlockId)->Result<binrw::io::TakeSeek<&mut R>,Error>{
@@ -102,7 +102,7 @@ impl<R:BinReaderExt> File<R>{
let block_start=self.header.block_location[block_id.get() as usize];
let block_end=self.header.block_location[block_id.get() as usize+1];
self.data.seek(std::io::SeekFrom::Start(block_start)).map_err(Error::Seek)?;
Ok(self.as_mut().take_seek(block_end-block_start))
Ok(self.data_mut().take_seek(block_end-block_start))
}
pub(crate) fn fourcc(&self)->FourCC{
self.header.fourcc

View File

@@ -214,7 +214,7 @@ pub struct StreamableMap<R:BinReaderExt>{
impl<R:BinReaderExt> StreamableMap<R>{
pub(crate) fn new(mut file:crate::file::File<R>)->Result<Self,Error>{
//assume the file seek is in the right place to start reading a map header
let header:MapHeader=file.as_mut().read_le().map_err(Error::InvalidHeader)?;
let header:MapHeader=file.data_mut().read_le().map_err(Error::InvalidHeader)?;
let modes=header.modes.into_iter().map(TryInto::try_into).collect::<Result<_,_>>().map_err(Error::InvalidMode)?;
let attributes=header.attributes.into_iter().map(Into::into).collect();
let render_configs=header.render_configs.into_iter().map(Into::into).collect();

View File

@@ -1,26 +1,3 @@
pub const fn flag(b:bool,mask:u8)->u8{
(-(b as i8) as u8)&mask
}
#[binrw::binrw]
#[brw(little,repr=u8)]
pub enum Boolio{
True,
False
}
impl Into<bool> for Boolio{
fn into(self)->bool{
match self{
Boolio::True=>true,
Boolio::False=>false,
}
}
}
impl From<bool> for Boolio{
fn from(value:bool)->Self{
match value{
true=>Boolio::True,
false=>Boolio::False,
}
}
}

View File

@@ -1,10 +1,12 @@
use super::common::{flag,Boolio};
use super::common::flag;
use super::integer::{Time,Planar64,Planar64Vec3};
#[binrw::binrw]
#[brw(little)]
pub struct ContactingLadder{
pub sticky:Boolio,
#[br(map=|paused:u8|paused!=0)]
#[bw(map=|paused:&bool|*paused as u8)]
pub sticky:bool,
}
impl Into<strafesnet_common::gameplay_attributes::ContactingLadder> for ContactingLadder{
fn into(self)->strafesnet_common::gameplay_attributes::ContactingLadder{