work around broken binrw enums

This commit is contained in:
Quaternions 2024-07-26 16:57:41 -07:00
parent 020eae4781
commit b6fede20bf

View File

@ -46,10 +46,15 @@ impl From<strafesnet_common::gameplay_attributes::ContactingLadder> for Contacti
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
pub enum ContactingBehaviour{ pub enum ContactingBehaviour{
#[brw(magic=0u8)]
Surf, Surf,
#[brw(magic=1u8)]
Ladder(ContactingLadder), Ladder(ContactingLadder),
#[brw(magic=2u8)]
NoJump, NoJump,
#[brw(magic=3u8)]
Cling, Cling,
#[brw(magic=4u8)]
Elastic(u32), Elastic(u32),
} }
impl Into<strafesnet_common::gameplay_attributes::ContactingBehaviour> for ContactingBehaviour{ impl Into<strafesnet_common::gameplay_attributes::ContactingBehaviour> for ContactingBehaviour{
@ -138,7 +143,9 @@ impl From<strafesnet_common::gameplay_attributes::Accelerator> for Accelerator{
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
pub enum Booster{ pub enum Booster{
#[brw(magic=0u8)]
Velocity(Planar64Vec3), Velocity(Planar64Vec3),
#[brw(magic=1u8)]
Energy{direction:Planar64Vec3,energy:Planar64}, Energy{direction:Planar64Vec3,energy:Planar64},
} }
impl Into<strafesnet_common::gameplay_attributes::Booster> for Booster{ impl Into<strafesnet_common::gameplay_attributes::Booster> for Booster{
@ -200,18 +207,24 @@ impl From<strafesnet_common::gameplay_attributes::TrajectoryChoice> for Trajecto
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
pub enum SetTrajectory{ pub enum SetTrajectory{
#[brw(magic=0u8)]
AirTime(Time), AirTime(Time),
#[brw(magic=1u8)]
Height(Planar64), Height(Planar64),
#[brw(magic=2u8)]
DotVelocity{direction:Planar64Vec3,dot:Planar64}, DotVelocity{direction:Planar64Vec3,dot:Planar64},
#[brw(magic=3u8)]
TargetPointTime{ TargetPointTime{
target_point:Planar64Vec3, target_point:Planar64Vec3,
time:Time, time:Time,
}, },
#[brw(magic=4u8)]
TargetPointSpeed{ TargetPointSpeed{
target_point:Planar64Vec3, target_point:Planar64Vec3,
speed:Planar64, speed:Planar64,
trajectory_choice:TrajectoryChoice, trajectory_choice:TrajectoryChoice,
}, },
#[brw(magic=5u8)]
Velocity(Planar64Vec3), Velocity(Planar64Vec3),
} }
impl Into<strafesnet_common::gameplay_attributes::SetTrajectory> for SetTrajectory{ impl Into<strafesnet_common::gameplay_attributes::SetTrajectory> for SetTrajectory{
@ -400,11 +413,14 @@ impl From<strafesnet_common::gameplay_attributes::IntersectingAttributes> for In
#[binrw::binrw] #[binrw::binrw]
#[brw(little)] #[brw(little)]
pub enum CollisionAttributes{ pub enum CollisionAttributes{
#[brw(magic=0u8)]
Decoration, Decoration,
#[brw(magic=1u8)]
Contact{ Contact{
contacting:ContactingAttributes, contacting:ContactingAttributes,
general:GeneralAttributes, general:GeneralAttributes,
}, },
#[brw(magic=2u8)]
Intersect{ Intersect{
intersecting:IntersectingAttributes, intersecting:IntersectingAttributes,
general:GeneralAttributes, general:GeneralAttributes,