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]
|
||||
#[brw(little,repr=u8)]
|
||||
pub enum Boolio{
|
||||
|
@ -1,9 +1,10 @@
|
||||
use super::common::{flag,Boolio};
|
||||
use super::integer::{Time,Planar64,Planar64Vec3};
|
||||
|
||||
#[binrw::binrw]
|
||||
#[brw(little)]
|
||||
pub struct ContactingLadder{
|
||||
pub sticky:super::common::Boolio,
|
||||
pub sticky:Boolio,
|
||||
}
|
||||
impl Into<strafesnet_common::gameplay_attributes::ContactingLadder> for 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{
|
||||
fn from(value:strafesnet_common::gameplay_attributes::GeneralAttributes)->Self{
|
||||
let header=
|
||||
value.booster.is_some() as u8&GeneralAttributes::BOOSTER
|
||||
|value.trajectory.is_some() as u8&GeneralAttributes::TRAJECTORY
|
||||
|value.wormhole.is_some() as u8&GeneralAttributes::WORMHOLE
|
||||
|value.accelerator.is_some() as u8&GeneralAttributes::ACCELERATOR;
|
||||
flag(value.booster.is_some(),GeneralAttributes::BOOSTER)
|
||||
|flag(value.trajectory.is_some(),GeneralAttributes::TRAJECTORY)
|
||||
|flag(value.wormhole.is_some(),GeneralAttributes::WORMHOLE)
|
||||
|flag(value.accelerator.is_some(),GeneralAttributes::ACCELERATOR);
|
||||
Self{
|
||||
header,
|
||||
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{
|
||||
fn from(value:strafesnet_common::gameplay_attributes::ContactingAttributes)->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),
|
||||
}
|
||||
}
|
||||
@ -385,7 +386,7 @@ impl Into<strafesnet_common::gameplay_attributes::IntersectingAttributes> for In
|
||||
impl From<strafesnet_common::gameplay_attributes::IntersectingAttributes> for IntersectingAttributes{
|
||||
fn from(value:strafesnet_common::gameplay_attributes::IntersectingAttributes)->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),
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
use super::common::flag;
|
||||
|
||||
#[binrw::binrw]
|
||||
#[brw(little)]
|
||||
pub struct StageElement{
|
||||
@ -47,8 +49,8 @@ impl From<strafesnet_common::gameplay_modes::StageElement> for StageElement{
|
||||
};
|
||||
let header=
|
||||
behaviour
|
||||
|value.jump_limit().is_some() as u8&StageElement::JUMP_LIMIT
|
||||
|value.force() as u8&StageElement::FORCE;
|
||||
|flag(value.jump_limit().is_some(),StageElement::JUMP_LIMIT)
|
||||
|flag(value.force(),StageElement::FORCE);
|
||||
Self{
|
||||
header,
|
||||
stage_id:value.stage_id().get(),
|
||||
|
@ -1,3 +1,4 @@
|
||||
use super::common::flag;
|
||||
use super::integer::{Time,Ratio64,Planar64,Planar64Vec3};
|
||||
|
||||
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{
|
||||
fn from(value:strafesnet_common::gameplay_style::StyleModifiers)->Self{
|
||||
let header=
|
||||
value.strafe.is_some() as u8&StyleModifiers::STRAFE
|
||||
|value.rocket.is_some() as u8&StyleModifiers::ROCKET
|
||||
|value.jump.is_some() as u8&StyleModifiers::JUMP
|
||||
|value.walk.is_some() as u8&StyleModifiers::WALK
|
||||
|value.ladder.is_some() as u8&StyleModifiers::LADDER
|
||||
|value.swim.is_some() as u8&StyleModifiers::SWIM;
|
||||
flag(value.strafe.is_some(),StyleModifiers::STRAFE)
|
||||
|flag(value.rocket.is_some(),StyleModifiers::ROCKET)
|
||||
|flag(value.jump.is_some(),StyleModifiers::JUMP)
|
||||
|flag(value.walk.is_some(),StyleModifiers::WALK)
|
||||
|flag(value.ladder.is_some(),StyleModifiers::LADDER)
|
||||
|flag(value.swim.is_some(),StyleModifiers::SWIM);
|
||||
Self{
|
||||
header,
|
||||
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{
|
||||
fn from(value:strafesnet_common::gameplay_style::StrafeSettings)->Self{
|
||||
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{
|
||||
header,
|
||||
enable:enable.into(),
|
||||
|
@ -1,3 +1,4 @@
|
||||
use super::common::flag;
|
||||
use strafesnet_common::model::PolygonIter;
|
||||
|
||||
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{
|
||||
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{
|
||||
header,
|
||||
texture:value.texture.map(|texture_id|texture_id.get()),
|
||||
|
Loading…
Reference in New Issue
Block a user