fix them
This commit is contained in:
parent
ef992feb63
commit
e9414f42b6
@ -1,3 +1,7 @@
|
|||||||
|
pub const fn flag(b:bool,mask:u8)->u8{
|
||||||
|
(-(b as i8) as u8)&mask
|
||||||
|
}
|
||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little,repr=u8)]
|
#[brw(little,repr=u8)]
|
||||||
pub enum Boolio{
|
pub enum Boolio{
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
use super::common::{flag,Boolio};
|
||||||
use super::integer::{Time,Planar64,Planar64Vec3};
|
use super::integer::{Time,Planar64,Planar64Vec3};
|
||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct ContactingLadder{
|
pub struct ContactingLadder{
|
||||||
pub sticky:super::common::Boolio,
|
pub sticky:Boolio,
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_attributes::ContactingLadder> for ContactingLadder{
|
impl Into<strafesnet_common::gameplay_attributes::ContactingLadder> for ContactingLadder{
|
||||||
fn into(self)->strafesnet_common::gameplay_attributes::ContactingLadder{
|
fn into(self)->strafesnet_common::gameplay_attributes::ContactingLadder{
|
||||||
@ -325,10 +326,10 @@ impl Into<strafesnet_common::gameplay_attributes::GeneralAttributes> for General
|
|||||||
impl From<strafesnet_common::gameplay_attributes::GeneralAttributes> for GeneralAttributes{
|
impl From<strafesnet_common::gameplay_attributes::GeneralAttributes> for GeneralAttributes{
|
||||||
fn from(value:strafesnet_common::gameplay_attributes::GeneralAttributes)->Self{
|
fn from(value:strafesnet_common::gameplay_attributes::GeneralAttributes)->Self{
|
||||||
let header=
|
let header=
|
||||||
value.booster.is_some() as u8&GeneralAttributes::BOOSTER
|
flag(value.booster.is_some(),GeneralAttributes::BOOSTER)
|
||||||
|value.trajectory.is_some() as u8&GeneralAttributes::TRAJECTORY
|
|flag(value.trajectory.is_some(),GeneralAttributes::TRAJECTORY)
|
||||||
|value.wormhole.is_some() as u8&GeneralAttributes::WORMHOLE
|
|flag(value.wormhole.is_some(),GeneralAttributes::WORMHOLE)
|
||||||
|value.accelerator.is_some() as u8&GeneralAttributes::ACCELERATOR;
|
|flag(value.accelerator.is_some(),GeneralAttributes::ACCELERATOR);
|
||||||
Self{
|
Self{
|
||||||
header,
|
header,
|
||||||
booster:value.booster.map(Into::into),
|
booster:value.booster.map(Into::into),
|
||||||
@ -359,7 +360,7 @@ impl Into<strafesnet_common::gameplay_attributes::ContactingAttributes> for Cont
|
|||||||
impl From<strafesnet_common::gameplay_attributes::ContactingAttributes> for ContactingAttributes{
|
impl From<strafesnet_common::gameplay_attributes::ContactingAttributes> for ContactingAttributes{
|
||||||
fn from(value:strafesnet_common::gameplay_attributes::ContactingAttributes)->Self{
|
fn from(value:strafesnet_common::gameplay_attributes::ContactingAttributes)->Self{
|
||||||
Self{
|
Self{
|
||||||
header:value.contact_behaviour.is_some() as u8&ContactingAttributes::CONTACTING_BEHAVIOUR,
|
header:flag(value.contact_behaviour.is_some(),ContactingAttributes::CONTACTING_BEHAVIOUR),
|
||||||
contact_behaviour:value.contact_behaviour.map(Into::into),
|
contact_behaviour:value.contact_behaviour.map(Into::into),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,7 +386,7 @@ impl Into<strafesnet_common::gameplay_attributes::IntersectingAttributes> for In
|
|||||||
impl From<strafesnet_common::gameplay_attributes::IntersectingAttributes> for IntersectingAttributes{
|
impl From<strafesnet_common::gameplay_attributes::IntersectingAttributes> for IntersectingAttributes{
|
||||||
fn from(value:strafesnet_common::gameplay_attributes::IntersectingAttributes)->Self{
|
fn from(value:strafesnet_common::gameplay_attributes::IntersectingAttributes)->Self{
|
||||||
Self{
|
Self{
|
||||||
header:value.water.is_some() as u8&IntersectingAttributes::INTERSECTING_WATER,
|
header:flag(value.water.is_some(),IntersectingAttributes::INTERSECTING_WATER),
|
||||||
water:value.water.map(Into::into),
|
water:value.water.map(Into::into),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use super::common::flag;
|
||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct StageElement{
|
pub struct StageElement{
|
||||||
@ -47,8 +49,8 @@ impl From<strafesnet_common::gameplay_modes::StageElement> for StageElement{
|
|||||||
};
|
};
|
||||||
let header=
|
let header=
|
||||||
behaviour
|
behaviour
|
||||||
|value.jump_limit().is_some() as u8&StageElement::JUMP_LIMIT
|
|flag(value.jump_limit().is_some(),StageElement::JUMP_LIMIT)
|
||||||
|value.force() as u8&StageElement::FORCE;
|
|flag(value.force(),StageElement::FORCE);
|
||||||
Self{
|
Self{
|
||||||
header,
|
header,
|
||||||
stage_id:value.stage_id().get(),
|
stage_id:value.stage_id().get(),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use super::common::flag;
|
||||||
use super::integer::{Time,Ratio64,Planar64,Planar64Vec3};
|
use super::integer::{Time,Ratio64,Planar64,Planar64Vec3};
|
||||||
|
|
||||||
pub type Controls=u32;
|
pub type Controls=u32;
|
||||||
@ -55,12 +56,12 @@ impl Into<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
|
|||||||
impl From<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
|
impl From<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
|
||||||
fn from(value:strafesnet_common::gameplay_style::StyleModifiers)->Self{
|
fn from(value:strafesnet_common::gameplay_style::StyleModifiers)->Self{
|
||||||
let header=
|
let header=
|
||||||
value.strafe.is_some() as u8&StyleModifiers::STRAFE
|
flag(value.strafe.is_some(),StyleModifiers::STRAFE)
|
||||||
|value.rocket.is_some() as u8&StyleModifiers::ROCKET
|
|flag(value.rocket.is_some(),StyleModifiers::ROCKET)
|
||||||
|value.jump.is_some() as u8&StyleModifiers::JUMP
|
|flag(value.jump.is_some(),StyleModifiers::JUMP)
|
||||||
|value.walk.is_some() as u8&StyleModifiers::WALK
|
|flag(value.walk.is_some(),StyleModifiers::WALK)
|
||||||
|value.ladder.is_some() as u8&StyleModifiers::LADDER
|
|flag(value.ladder.is_some(),StyleModifiers::LADDER)
|
||||||
|value.swim.is_some() as u8&StyleModifiers::SWIM;
|
|flag(value.swim.is_some(),StyleModifiers::SWIM);
|
||||||
Self{
|
Self{
|
||||||
header,
|
header,
|
||||||
controls_mask:value.controls_mask.bits(),
|
controls_mask:value.controls_mask.bits(),
|
||||||
@ -185,7 +186,7 @@ impl Into<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
|
|||||||
impl From<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
|
impl From<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
|
||||||
fn from(value:strafesnet_common::gameplay_style::StrafeSettings)->Self{
|
fn from(value:strafesnet_common::gameplay_style::StrafeSettings)->Self{
|
||||||
let (enable,mv,air_accel_limit,tick_rate)=value.into_inner();
|
let (enable,mv,air_accel_limit,tick_rate)=value.into_inner();
|
||||||
let header=air_accel_limit.is_some() as u8&StrafeSettings::AIR_ACCEL_LIMIT;
|
let header=flag(air_accel_limit.is_some(),StrafeSettings::AIR_ACCEL_LIMIT);
|
||||||
Self{
|
Self{
|
||||||
header,
|
header,
|
||||||
enable:enable.into(),
|
enable:enable.into(),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use super::common::flag;
|
||||||
use strafesnet_common::model::PolygonIter;
|
use strafesnet_common::model::PolygonIter;
|
||||||
|
|
||||||
use super::integer::{Planar64Vec3,Planar64Affine3};
|
use super::integer::{Planar64Vec3,Planar64Affine3};
|
||||||
@ -76,7 +77,7 @@ impl Into<strafesnet_common::model::RenderConfig> for RenderConfig{
|
|||||||
}
|
}
|
||||||
impl From<strafesnet_common::model::RenderConfig> for RenderConfig{
|
impl From<strafesnet_common::model::RenderConfig> for RenderConfig{
|
||||||
fn from(value:strafesnet_common::model::RenderConfig)->Self{
|
fn from(value:strafesnet_common::model::RenderConfig)->Self{
|
||||||
let header=value.texture.is_some() as u8&RenderConfig::TEXTURE;
|
let header=flag(value.texture.is_some(),RenderConfig::TEXTURE);
|
||||||
Self{
|
Self{
|
||||||
header,
|
header,
|
||||||
texture:value.texture.map(|texture_id|texture_id.get()),
|
texture:value.texture.map(|texture_id|texture_id.get()),
|
||||||
|
Loading…
Reference in New Issue
Block a user