mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 18:24:05 +02:00
bitcoord fixes
This commit is contained in:
parent
e132636447
commit
a46f9edec2
1 changed files with 15 additions and 1 deletions
|
|
@ -942,6 +942,17 @@ fn test_send_prop_value_roundtrip() {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
send_prop_value_roundtrip(
|
||||||
|
SendPropValue::Vector(Vector {
|
||||||
|
x: 1.0,
|
||||||
|
y: -25.96875,
|
||||||
|
z: 0.1875,
|
||||||
|
}),
|
||||||
|
SendPropParseDefinition::Vector {
|
||||||
|
changes_often: false,
|
||||||
|
definition: FloatDefinition::CoordMP,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<i32> for SendPropValue {
|
impl From<i32> for SendPropValue {
|
||||||
|
|
@ -1243,7 +1254,7 @@ pub fn write_bit_coord_mp(
|
||||||
) -> ReadResult<()> {
|
) -> ReadResult<()> {
|
||||||
let abs = val.abs();
|
let abs = val.abs();
|
||||||
let in_bounds = (abs as u32) <= 2u32.pow(10);
|
let in_bounds = (abs as u32) <= 2u32.pow(10);
|
||||||
let has_int_val = abs > 1.0;
|
let has_int_val = abs >= 1.0;
|
||||||
in_bounds.write(stream)?;
|
in_bounds.write(stream)?;
|
||||||
has_int_val.write(stream)?;
|
has_int_val.write(stream)?;
|
||||||
|
|
||||||
|
|
@ -1283,6 +1294,9 @@ fn test_bit_coord_mp_roundtrip() {
|
||||||
);
|
);
|
||||||
assert_eq!(pos, read.pos());
|
assert_eq!(pos, read.pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bit_coord_mp_normal(1.0, false, false);
|
||||||
|
|
||||||
bit_coord_mp_normal(0.0, false, false);
|
bit_coord_mp_normal(0.0, false, false);
|
||||||
bit_coord_mp_normal(0.5, false, false);
|
bit_coord_mp_normal(0.5, false, false);
|
||||||
bit_coord_mp_normal(-0.5, false, false);
|
bit_coord_mp_normal(-0.5, false, false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue