1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-05 02:54:10 +02:00
This commit is contained in:
Robin Appelman 2019-03-02 22:33:22 +01:00
commit f2650dc32f
19 changed files with 3614 additions and 2210 deletions

View file

@ -206,11 +206,15 @@ pub fn read_bit_coord(stream: &mut Stream) -> ReadResult<f32> {
Ok(if has_int || has_frac {
let sign = if stream.read()? { -1f32 } else { 1f32 };
let int_val: u16 = if has_int { stream.read_sized::<u16>(14)? + 1 } else { 0 };
let int_val: u16 = if has_int {
stream.read_sized::<u16>(14)? + 1
} else {
0
};
let frac_val: u8 = if has_frac { stream.read_sized(5)? } else { 0 };
let value = int_val as f32 + (frac_val as f32 * (1f32 / 32f32));
value * sign
} else {
0f32
})
}
}